1.7B 5593 site.properties & site.style workings

I got around to documenting the site overrides in http://www.openvpms.org/documentation/csh/1.7/reference/style-site and then thought that I had better play with them.  Step 1 was to create both by extracting the changes that I make to default.properties and default.style and put these in the site.properties and site.style files as follows:

 MainPane.Menu.height = max(($font.size  * 1.333)  + 6, 18)

font.h6.size = $font.size * 1.333

# font.h6.size = $font.size * 1
# h6 is used to control the size of the top and left panel menu items
# change the scaling factor from 1 (the standard) to a max of around 1.333 if you want BIG  menu words

label.align = 'right'
theme.colour  = '#7A1D67' 

<stylesheet>
    <style name="MedicalRecordSummary.act.customerAccountInvoiceItem" type="nextapp.echo2.app.Component">
        <properties>
            <property name="layoutData">
                <layout-data type="nextapp.echo2.app.layout.TableLayoutData">
                    <properties>
                        <property name="background" value="#00ff00"/>
                    </properties>
                </layout-data>
            </property>
        </properties>
    </style>
    <style name="MainPane.Menu.Button"
           type="nextapp.echo2.app.button.AbstractButton">
        <properties>
            <property name="insets" value="${padding.small} 0px"/>
            <property name="foreground" value="#fdf5e6"/>
            <!-- oldlace -->
            <property name="background" value="${theme.colour}"/>
            <property name="pressedEnabled" value="true"/>
            <property name="pressedForeground" value="#000000"/>
            <!-- black -->
            <property name="rolloverEnabled" value="true"/>
            <property name="rolloverForeground" value="#000000"/>
            <property name="rolloverBackground" value="${theme.button.colour}"/>
            <property name="font">
                <font size="${font.h6.size}" bold="true">
                    <typeface name="${font.typeface}"/>
                </font>
            </property>
            <property name="border">
                <border style="none"/>
            </property>
            <property name="rolloverBorder">
                <border style="none"/>
            </property>
        </properties>
    </style>
    <style name="h6" base-name="default" type="nextapp.echo2.app.Label">
        <properties>
            <property name="font">
                <font size="${font.h6.size}" bold="true">
                    <typeface name="${font.typeface}"/>
                </font>
            </property>
        </properties>
    </style>
</stylesheet>   

Problem 1: When I restarted Tomcat and logged in, there was obviously a problem and checking openvpms-full.log showed that it was complaining that it could not find the 'default' dase-name for the h6 style.  I fixed this by also including the following from the standard default.style

    <style name="default" type="nextapp.echo2.app.Label">
        <properties>
            <property name="foreground" value="#000000"/>
            <!-- black -->
            <property name="font">
                <font size="${font.size}">
                    <typeface name="${font.typeface}"/>
                </font>
            </property>
        </properties>
    </style>

Problem 2: Things now started without error and appeared to be nearly OK - however, as can been seen in the screen shot below, the button colour and the location colour have disappeared.

Here is a shot of what things are like without the site files:

 

As a further indication of the differences, here are the two customer info screens:

and the good version:

As you can see things do not seem to be working as a simple "what is in the site file overrides what is in the default file" process.

What am I doing wrong?

Regards, Tim G

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: 1.7B 5593 site.properties & site.style workings

There's two issues:

1. styles cannot refer to styles defined in different stylesheets

So you can't have a base-name attribute in site.stylesheet that refers to a style defined in default.stylsheet. You need to either:

  • incorporate the original style in the custom style
  • copy the original style to site.stylesheet

2. styles that have the same name must all be copied

If a style name appears for different classes (e.g. "default" for nextapp.echo2.app.Label, and nextapp.echo2.app.WindowPane), and you want to customise the Label version, you have to copy all other occurences of "default" as well. This is due to a bug/feature in the echo2 framework, that replaces all instances of a style when merging stylesheets.

Raised as https://openvpms.atlassian.net/browse/OVPMS-1387

Re: 1.7B 5593 site.properties & site.style workings

Tim - I have updated the CSH text and put a comment on the Jira saying that the CSH text will need to be updated when the bug is fixed.

Regards, Tim G

Syndicate content