Customization

Recover the resource controller

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() );

Fields

Make the process document fields mandatory

getResourceController().setMandatory( "fldDocumentDescription", true );
getResourceController().setMandatory( "fldDocumentBody", false );

Make the process document fields editable

getResourceController().setEditable( "fldDocumentDescription", false );
getResourceController().setEditable ( "fldDocumentBody", true );

Hide the process document fields

getResourceController().setHidden( "fldDocumentDescription", false );
getResourceController().setHidden( "fldPassword", true );

Hide identified interface elements of the process document

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 );

Hide a workflow action

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().getRootNavigator().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 );
	}
}

Add a button on a process document

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().getRootNavigator().showAlertBox( "Ceci est un message Alert !" );
		}
	} );

getResourceController().getButtonContainer( IResourceController.TOP_CONTAINER ).addLast( demoAlertBtn );