The resource controller is an object that lets handle the graphical render of a process document. To retrieve this object type, you just have to put an element object IResource. In this example, we directly put the current object IResource.(it is a resource).
getWorkflowModule().getController( getWorkflowInstance() );
getResourceController().setMandatory( "fldDocumentDescription", true ); getResourceController().setMandatory( "fldDocumentBody", false );
getResourceController().setEditable( "fldDocumentDescription", false ); getResourceController().setEditable ( "fldDocumentBody", true );
getResourceController().setHidden( "fldDocumentDescription", false ); getResourceController().setHidden( "fldPassword", true );
This code hides or displays the identified blocks. These blocks may be fragments or elements identified in the customization forms ("id" attribute defined).
getResourceController().showBodyBlock( "marker.DocumentSpace", true ); getResourceController().showBodyBlock( "marker.LifeCycle", false );
The following code indicates how to retrieve a workflow action and to hide it.
//retrieving the connected user then construction of a context IContext context = getWorkflowModule().getContext( Navigator.getNavigator().getLoggedOnUser().getExternId() ); //retrieving the definition and the active task to compare with the wanted step ITask task = getWorkflowInstance().getCurrentTaskInstance( context ).getTask(); if ( "TASK_NAME".equals( task.getName() ) ) { // retrieving the action IAction action = getWorkflowModule().getAction( context, task, "ACTION_NAME" ); // recovering the button corresponding to the action (search in the bottom container) CtlButton button = getResourceController().getButton( action.getLabel(), IResourceController.BOTTOM_CONTAINER ); // if the button is recovered, hide it if ( button != null ) button.setHidden( true ); }
Code extract from the class PlayWithButtonsExtension
CtlButton demoAlertBtn = new CtlButton( "alert", new CtlLocalizedText( "LG_ALERT" ) ); demoAlertBtn.addActionListener( new ActionListener() { public void onClick( ActionEvent event ) { Navigator.getNavigator().showAlertBox( "Ceci est un message Alert !" ); } } ); getResourceController().getButtonContainer( IResourceController.TOP_CONTAINER ).addLast( demoAlertBtn );