VDoc offers a simple navigation system that permits to easily navigate from a screen to another. There are several ways to integrate a new screen into an existing one:
In the screens XML definition document, it is possible to add screens and to specify image buttons, simple buttons or hyperlinks that enable to browse to other screens.
In the following example, the action of the button named "demo1" enables to navigate to the screen [DEMO, action1]. And, the image button named "demo2" enables to navigate to the screen [DEMO, action2].
Example of caller screen
<!-- adding a button in the my documents view --> <explorer override="catalog.access"> <tabs> <tab name="MYDOCS"> <links> <link name="myActiveDocs"> <view name="myActiveDocs"> <button name="demo1" label="LG_DEMO_LABEL"> <action class="DEMO" name="action1"/> </button> <image name="demo2"> <action class="DEMO" name="action2" /> </image> </view> </link> </links> </tab> </tabs> </explorer>
Example of callee screen
<form name="DEMO" action="action1" label="LG_VIEW_PROP" information="LG_PUT_VIEW_INFO" provider="com.axemble.education.providers.demo.DemoFormProvider"> <fields> <field name="fldLabel1" label="LG_LABEL1" ctrl="com.axemble.vdp.ui.core.document.fields.TextBoxField" mandatory="true" /> <field name="fldLabel2" label="LG_LABEL2" ctrl="com.axemble.vdp.ui.core.document.fields.TextBoxField" mandatory="false" /> </fields> </form>
In the Workflow Designer, you may define a customizable "screen_embedder"-type field which allows to define the call to a new screen. This field is displayed in the usual form of a button calling a selector.
Field attributes
Attribute | Description |
screen | System name for the screen |
method | Action name linked to the screen |
shared-document-key (optional) | Key name enabling to find the parent document from the browsing context received in the provider. If this attribute is not specified, both screens will share the same document. |
shared-field-key (optional) | Key name enabling to find the (screen_embedder) field from the navigation context received in the provider. |
The attributes « shared-document-key » and « shared-field-key » are optional. If these attributes are not used, the caller screen receives, as AbstractDocument parameter in the constructor, the CoreDocument object of the caller screen.
On the contrary, the CoreDocument object will be placed as callee screen's navigation context parameter. It will be possible to get it back thanks to the key indicated in the « shared-document-key » attribute. It is the same for the CoreField object.
Code extract of the class NotSharedDocumentSheetProvider : the keys set in the customization of the « screen_embedder » field are sharedDocument and sharedField.
public NotSharedDocumentSheetProvider( INavigateContext context, AbstractDocument document, CtlAbstractSheet abstractSheet ) { super( context, document, abstractSheet ); this.sharedDocument = (CoreDocument)this.context.getParameterMap().get( "sharedDocument" ); this.sharedField = (CoreField)this.context.getParameterMap().get( "sharedField" ); }
It is possible, from the providers or the document extension classes, to create elements such as buttons, and to associate a navigation to the « onClick » event.
In the examples below two methods are used:
Example of browsing
CtlButton demoBtn = new CtlButton( "demo", new CtlLocalizedText( "LG_DEMO" ) ); demoBtn.addActionListener( new ActionListener() { public void onClick( ActionEvent event ) { NavigateContext ctx = new NavigateContext(); ctx.setClassName( "DEMO" ); ctx.setMethodName( "action1" ); Navigator.getNavigator().navigate( ctx ); } } ); getResourceController().getButtonContainer( IResourceController.TOP_CONTAINER ).addLast(demoBtn);
Example of screen replacement (forward)
CtlButton simpleBtn = new CtlButton( "simple", new CtlText( "Simple" ) ); simpleBtn.addActionListener( new ActionListener() { public void onClick( ActionEvent event ) { NavigateContext ctx = new NavigateContext(); ctx.setClassName( "DEMO" ); ctx.setMethodName( "action1" ); Navigator.getNavigator().forward( ctx ); } } ); controller().getButtonContainer(IResourceController.BOTTOM_CONTAINER).addLast(simpleBtn);