Skip to Content

Within the aBPM excel sheet one can define the parameters for every attribute in the param column.

Mainly the label and field spans as well as dialog width and height can be defined here. But also table toolbar visibilities and row counts within TextEdit fields are set in the param column.

Sometimes one can face situation in which one want to change this params during runtime, e.g. if the UI is opened on a mobile device.

This becomes possible within the callback implementation of aBPM and will be shown in the following coding examples.

Most UI elements within aBPM are represented by the simple “UIElementParam” type. This type is extended with additional params for the following UI element types (available params for a specific UI element can be found within the aBPM Cookbook):

  • TableParam
  • RadioButtonGroupParam
  • AttachmentParam
  • MonthPickerParam
  • CheckboxGroupParam
  • TextViewParam

Thus, editing the params of an input field when opening the UI on a tablet looks like shown in the following code example:

public ICallbackResult onBeforeDisplay(AbstractWrappedCallbackContext<Inbox> ctx) {

	if (Device.TABLET.equals(ctx.getDevice())) {
		AttributeMetaData amd = ctx.getBusinessObject().getAttribute(InboxFieldsEnum.FILTER_REFRESHDATE).getAttributeMetaData();	
		UIElementParam paramRefreshDate = (UIElementParam) BeanUtils.cloneBean(amd.getUiElementParam());
		paramRefreshDate.setLabelSpan(UIElementParam.Span.DEFAULT);
		ctx.getElementParams().put(InboxFieldsEnum.FILTER_REFRESHDATE.getName(), paramRefreshDate);
	}
}

It is also possible to initialize a completely new UIElementParam Object. But then, we have to set all params, that were already specified in the excel sheet for the respective attribute:

UIElementParam paramRefreshDate = new UIElementParam();
paramRefreshDate.setLabelSpan(UIElementParam.Span.DEFAULT);
paramRefreshDate.setCalcWidthByLength(true);
paramRefreshDate.setLengthIndicator(true);            
ctx.getElementParams().put(InboxFieldsEnum.FILTER_REFRESHDATE.getName(), paramRefreshDate);

As already mentioned above in case of more complex UI elements there are extended types. Therefore, the implementation would look like shown below:

public ICallbackResult onBeforeDisplay(AbstractWrappedCallbackContext<Inbox> ctx) {

	if (Device.TABLET.equals(ctx.getDevice())) {
	
		//Tables
		AttributeMetaData amdTaskTable = ctx.getBusinessObject().getAttribute(InboxFieldsEnum.TASKTABLE).getAttributeMetaData();
		TableParam paramTaskTable = (TableParam) BeanUtils.cloneBean(amdTaskTable.getUiElementParam());
		paramTaskTable.setHorizontalScrollable(true);
		ctx.getElementParams().put(InboxFieldsEnum.TASKTABLE.getName(), paramTaskTable);

		//TextView
		TextViewParam paramPriority = new TextViewParam();
		paramPriority.setColumnWidth("180px");
		paramPriority.setNoFrame(true);
		ctx.getElementParams().put(TaskTableFieldsEnum.TASKTABLE_PRIORITY.getName(), paramPriority);    

	}
}

 

Note: The params belong to the BO meta data. Therefore, it is not possible to set different params e.g. for different rows of a table. They will always have to use the same BO meta data.

To report this post you need to login first.

Be the first to leave a comment

You must be Logged on to comment or reply to a post.

Leave a Reply