...
Weave supports the ability to configure multiple clients from the one instance. Each Client needs to have a unique ID which is used in the url when opening the client.
Code Block | |
---|---|
xml | xml |
linenumbers | true | ... <client:config id="main"> ... </client:config> <client:config id="police"> ... </client:config> ... |
In the above example there are two clients defined and each has a different id. When using the client open a browser and point to
http://server:port/weave/main.html
or
http://server:port/weave/police.html
Additionally, if there is more than one client configuration and the user viewshttp://server:port/weave
they will be presented with a list of the available client configurations.
...
For example to restrict the police
configuration to only those users who are in the police access control list you would change the configuration to:
Code Block | xml | xml | linenumbers | true
---|
... <client:config id="police"> <acl id="acl.police"> ... </client:config> ... |
this assumes that elsewhere in your configuration you have the ACL for acl.police
, something like:
Code Block | |
---|---|
xml | xml |
linenumbers | true | <acl:acl id="acl.police"> <entry type="allow">ROLE_POLICE</entry> <entry type="deny">*</deny> </acl:acl> |
...
For example, to provide a generic client that has a single button that should only be available to users in a certain group you could either create two separate client configurations, one with the button for the selected users and the other without the button for everyone else, or you could create one configuration with the button but attach an ACL to the button.
Code Block | |
---|---|
xml | |
linenumbers | true | ... <client:config id="main"> ... <toolbar> ... <item action="au.gov.police.ShowSpeedCameras"> <acl id="acl.police"/> </item> ... </toolbar> ... </client:config> ... |
...
The absolute minimum requirements for a client configuration is shown below (where CONFIGID, TITLE and LABEL are configured by you)
Code Block | xml | xml | linenumbers | true
---|
<client:config id="CONFIGID"> <title>TITLE</title> <perspective> <label>LABEL</label> </perspective> </client:config> |
...
So the next this we could do would be to add content to the default center region that was created. We do this by adding Views to the perspective. A View is responsible for presenting its content the the user in whatever way is appropriate, it could be a map image, a text input form or just a fixed image. What's shown in the region is different depending upon the id of the view that's added to the perspective, so for now we won't bother looking at the actual content of the view tags.
Code Block | xml | xml | linenumbers
---|---|
true | <client:config id="CONFIGID"> <title>TITLE</title> <perspective> <label>LABEL</label> <view id="VIEWID"> VIEWCONTENT </view> </perspective> </client:config> |
...
From there we can add additional views to show different content to the user.
Code Block | xml | xml | linenumbers | true
---|
<client:config id="CONFIGID"> <title>TITLE</title> <perspective> <label>LABEL</label> <view id="VIEWID1"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> </client:config> |
...
Say we wanted to move one of our views to be to the left of the other one, rather than having them both within the same region. To do this we'd add a layout to the perspective and then configure each of the views to be placed in a specific region within the layout. Remember at the moment there's a default layout created for us that has a single center region defined.
Code Block | |
---|---|
xml | xml |
linenumbers | true | <client:config id="CONFIGID"> <title>TITLE</title> <perspective> <label>LABEL</label> <layout> <west width="WIDTH"> <center> </layout> <view id="VIEWID1" location="west"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> </client:config> |
...
From there we can fill out the client configuration with some other components. We can add a toolbar and statusbar (as mentioned earlier).
Code Block | |
---|---|
xml | |
linenumbers | true | <client:config id="CONFIGID"> <title>TITLE</title> <toolbar> TOOLBARCONTENT </toolbar> <statusbar> STATUSBARCONTENT </statusbar> <perspective> <label>LABEL</label> <layout> <west width="WIDTH"> <center> </layout> <view id="VIEWID1" location="west"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> </client:config> |
...
We can also include a set of default values at the same level as perspectives to provide defaults values for various components that are included on the client, for example indicating the initial map extent to use if a map view doesn't specify it explicitly, or determining of a report should be opened in a new browser window.
Code Block | xml | xml | linenumbers | true
---|
<client:config id="CONFIGID"> <title>TITLE</title> <toolbar> TOOLBARCONTENT </toolbar> <statusbar> STATUSBARCONTENT </statusbar> <perspective> <label>LABEL</label> <layout> <west width="WIDTH"> <center> </layout> <view id="VIEWID1" location="west"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> <defaults> DEFAULTCONTENT </defaults> </client:config> |
...
Aside from that there are a couple of other minor items that could be added, one is a description, that's shown to the user if they get the option to choose between multiple client configurations. Another is a debug flag that indicates that the client should be loaded in debug mode which helps when modifying the client configuration. And finally it's possible to specify a theme to be used for the configuration.
Code Block | xml | xml | linenumbers | true
---|
<client:config id="CONFIGID"> <title>TITLE</title> <description>DESCRIPTION</description> <debug>true</debug> <theme>THEMENAME</theme> <toolbar> TOOLBARCONTENT </toolbar> <statusbar> STATUSBARCONTENT </statusbar> <perspective> <label>LABEL</label> <layout> <west width="WIDTH"> <center> </layout> <view id="VIEWID1" location="west"> VIEW1CONTENT </view> <view id="VIEWID2"> VIEW2CONTENT </view> </perspective> <defaults> DEFAULTCONTENT </defaults> </client:config> |
...
You can set various default options in the defaults
section in the client configuration. For example the default report format to generate, which entity to have active initially or which data to display when the user open a data grid.
Code Block | xml | xml | linenumbers
---|---|
true | <client:config id="CONFIGID"> ... <perspective> .. </perspective> <defaults> <entities> <entity id="property" isDefault="true"> <data>data.property.detail</data> <!-- set the default data definition for properties --> <search>search.property.byaddress</search> <!-- set the default search for properties --> </entity> <entity id="roads"> <data>data.road.detail</data> <!-- set the default data definition for roads --> <search>search.road.byname</search> <!-- set the default search for roads --> </entity> <entity id="parks" remove="true"/> <!-- remove parks as being an available entity --> <entity id="lights" remove="true"/> <!-- remove lights as being an available entity --> <entities> <report> <format>html</format> <openExternal>true</openExternal> <openWithScript>true</openWithScript> <timeout>240</timeout> </report> </defaults> </client:config> |
...
You can specify exactly what entities are available on the client for a user by specifying the name of a user attribute that contains the id's of the entities that should be available.
...
Setting entities based on a user attribute
Code Block | ||
---|---|---|
| ||
<client:config id="CONFIGID"> ... <perspective> .. </perspective> <defaults> <entities userattribute="entities"/> .... </defaults> </client:config> |
...
It's also possible to have the list of entities listed in the entities section refine the available entities directly. By default specifying multiple entity
tags within the entities
tag just modifies the settings for those entities, but by setting filter
to true
for in the entities
tag you can further specify that these entities listed will be the only ones available to the client.
...
Refining what entities are available
Code Block | ||
---|---|---|
| ||
<client:config id="CONFIGID"> ... <perspective> .. </perspective> <defaults> <entities filter="true"> <!-- user will only have access to property, roads and parks --> <entity id="property" isDefault="true"> <data>data.property.detail</data> <search>search.property.byaddress</search> </entity> <entity id="roads"> <data>data.road.detail</data> <search>search.road.byname</search> </entity> <entity id="parks"/> <entity id="lights"/> <entities> .... </defaults> </client:config> |
...
To see what current icons are available for use, open the HTML page /weave/styles/core.css
on the Weave instance
e.g. http://localhost:8080/weave/styles/core.css
and any line starting with .icon-
will be an icon available for use.
...
Pretty much any component can have its icon set by setting the iconCls
property to one of these icons, e.g. to use .icon-edit
in a toolbar:
Code Block | xml | xml
---|
<item action="weave.toggleToolbar" text="Edit" iconCls="icon-edit"> ... </item> |
If you want to remove the icon for a component set the iconCls
property to be blank, e.g. to remove the icon from the Legend panel in your layout:
Code Block | xml | xml
---|
<view id="com.cohga.client.panel.legend" iconCls=""> <label>Legend</label> <location>west</location> ... </view> |
...
Here is a bundle that contains a set of replacement buttons, com.cohga.client.weave.themes.collapse_1.0.0.jar, that you can use to alter the appearance.
...
Installing the new expand/collapse button theme
...
The image below shows an existing client config that been changed to add the line highlighted below. Note that your client config will not match the example below, the one below is just an example to show you where in your client config(s) you'd need to add the highlighted line to enable the larger expand/collapse buttons.
In the following example the client config is already setup to use the grey
theme, you may not be using a theme at all, in which case you won't have an existing theme
entry and you should just add a new theme
tag for the expand/collapse buttons.
...
Info |
---|
As of Weave 2.5.18 this bundle is already included and setup so all you need to do is the last step to add the |
...
It's possible to have the client display a licence that the user must agree to before continuing, or to display some general text, by adding one of the following configs to the client config
Displaying a licence agreement
Code Block | ||||
---|---|---|---|---|
| ||||
<client:config id="main"> <licence> <title>Licence Agreement</title> <!-- "Licence Agreement" is the default so this is not strictly required --> <text>This is where you would insert the agreement text you wish the user to confirm.</text> <!-- this must be set --> <url>http://example.com</url> <!-- optional link if the user does not agree --> </licence> <!-- rest of client config goes here --> </client:config> |
...
Displaying a startup tip
Code Block | ||||
---|---|---|---|---|
| ||||
<client:config id="main"> <tip> <delay>1000</delay> <!-- how long before the tip should popup, default is 1000ms so this is not strictly required --> <title>Tip o' the day</title> <!-- title for the tip window --> <text>Don't run with scissors</text> <!-- required text for the tip --> <time>3000</time> <!-- optional duration for how long the tip should show, if not set then the user will have to click to hide it --> </tip> <!-- rest of client config goes here --> </client:config> |
...