View
The “view” element may be used in two different ways:
- child tag when used in the context of a form or an explorer templatescreens;
- parent tag when used in the context of portlets or easysite contents.
The user interface associated with the “view” tag is produced by the following class template: com.axemble.vdp.ui.framework.composites.xml.XMLView.
In the case of views, two provider classes may be used:
- standard view:
com.axemble.vdoc.sdk.providers.BaseViewProvider; - browsing view:
com.axemble.vdoc.sdk.providers.BaseBrowsableViewProvider;
XML Attributes
The view tag may be completed by the following attributes:
| Attributes | Description |
|---|---|
| selectable | indicates if the view displays “tick boxes” elements enabling to select lines. |
| filterable | indicates if the filters must be placed |
| paginable | indicates if the page per page is supported |
| rowsperpage | indicates the lines number displayed per page |
Sub-tags:
| Tag | Description |
|---|---|
| button | Enables to add a navigation button in the interface |
| image | Enables to place image buttons associated to commands or navigation. |
| link | Enables to specify a browsing link. |
| column | Enables to specify the columns of the view. |
Column
The column tag may be completed by the following attributes:
| Attributes | Type | Description |
|---|---|---|
| ctrl | String (class path) | The widget for the rendering can be customized |
| decimals | Integer | Number of decimals displayed for numbers |
| displayAsList | Boolean | Collection only : If false, the collection will be displayed in one line, values separated by commas |
| displayLabel | Boolean | True to display the column label (default true) |
| displayZeros | Boolean | True to display zeros for numbers (default true) |
| format | String | Dates only : date, time or datetime |
| formula | String | The formula to apply |
| hasLink | Boolean | True to add a link on, the column value (default false) |
| headerspan | Integer | The colspan for the title |
| label | String | The column’s label (translation key) |
| maxElements | Integer | List will be truncated if more the maxElements |
| maxLength | Integer | Data will be truncated if more than maxLength |
| name | String | The column’s name (identifier) |
| target | String | Set target display (list, tooltip, or hidden) |
| width | String | The column’s width (ex: 100px, 20%) |
| zone | String | Display zone for this column (mostly for selectors): title, description, reference, state, icon, thumbnail, date, actor, attachments, path, properties, additionalProperties, extendedProperties, thumbnail-background, content, hidden (since Process2026.0.0, used to hide column we want to sort/filter on). |
XML example
<view name="DEMO" label="LG_DEMO" selectable="true" provider="com.axemble.education.providers.demo.DemoViewProvider" paginable="true" filterable="true">
<button name="delete" label="LG_DELETE" style="style2">
<action class="DEMO" name="delete"/>
</button>
<button name="import" label="LG_IMPORT" style="style3">
<action class="DEMO" name="import"/>
</button>
<link name="browse">
<action class="DEMO" name="browse"/>
</link>
<image name="delete">
<action class="DEMO" name="delete"/>
</image>
<image name="properties">
<action class="DEMO" name="edit"/>
</image>
<image name="security">
<action class="DEMO" name="security"/>
</image>
<column name="column1" label="LG_COLUMN1" zone="title"/>
<column name="column2" label="LG_COLUMN2"/>
<column name="column3" label="LG_COLUMN3"/>
<column name="column4" label="LG_COLUMN4"/>
</view>Simple form preview
Create a view provider
This involves defining an XML and associating a provider with it which will always inherit from BaseViewProvider, but will implement the ICollectionViewProvider interface.
Method implementation
/**
* Retourne tous les objets natifs à présenter dans la vue (vos objets), le type de ces objets correspond au generics de la classe (T).
*/
public abstract Collection getObjects();
/**
* Converti un objet (de type T) en tant que ViewModelItem
*/
public ViewModelItem fetchLine( T object );
/**
* Appelé avant de récupérer les objets
*/
public void beforeFetch();
/**
* Appelé après avoir fait tous les fetchLine()
*/
public void afterFetch();Implementation example
public class NewViewProvider extends BaseViewProvider implements ICollectionViewProvider<MyCustomObject> {
private static com.axemble.vdoc.sdk.utils.Logger LOG = com.axemble.vdoc.sdk.utils.Logger.getLogger(NewViewProvider.class);
public NewViewProvider (INavigateContext context, CtlAbstractView view) {
super(context, view);
}
/**
* @see com.axemble.vdp.ui.core.providers.ICollectionViewProvider#getObjects()
*/
@Override
public Collection<MyCustomObject> getObjects() {
return getAllMyCustomObjects();
}
/**
* @see com.axemble.vdp.ui.core.providers.ISelectableViewProvider#fetchLine(java.lang.Object)
*/
@Override
public ViewModelItem fetchLine(MyCustomObject customObject) {
ViewModelItem viewModelItem = new ViewModelItem(customObject);
viewModelItem.setValue("label", customObject.getLabel());
return viewModelItem;
}
/**
* @see com.axemble.vdp.ui.core.providers.base.AbstractViewProvider#beforeFetch()
*/
@Override
public void beforeFetch() {
LOG.error("Called before fetching");
}
/**
* @see com.axemble.vdp.ui.core.providers.base.AbstractViewProvider#afterFetch()
*/
@Override
public void afterFetch() {
LOG.error("Called after fetching");
}
}Source: https://wiki.myvdoc.net/xwiki/bin/view/Dev+Floor/HowToBuildNewVDoc14Views
