Extending AbstractAttributesComponentBuilder
Creating the Panel Configuration
1. Implement the buildAttributesComponentConfig() method to create the panel configuration.
a. Create the panel config.
Call the ComponentConfigFactory embedded in the class to create an AttributePanelConfig.
ComponentConfigFactory factory = getComponentConfigFactory();
AttributePanelConfig panelConfig = factory.newAttributePanelConfig
(<id of your component>);
Set the desired properties on the panel config. See
Customization Points for configuration points. Do not set the component mode as it will be overridden by the parent class. Also, do not set the
ComponentType in this method, that can be done in step 2.
b. Create the attribute and group configs.
Every panel must have at least one group. Simple attribute panels must have only one group, which will not be visible in the UI. For simple attribute panels, you can use the technique described in Case 1 below, which will automatically create a group config for you. For advanced attribute panels, use the technique in Case 2 below to create one or more groups with labels of you choosing.
Case 1: Simple attribute panel
i. Create one attribute config for each attribute you want to display using the ComponentConfigFactory :
AttributeConfig attrConfig = factory.newAttributeConfig
(“<attribute name>”);
Set additional properties on the
AttributeConfig if desired. See
AttributeConfig Properties for configuration points. Note you should not set
rowPos,
colPos, or colSpan properties on
AttributeConfigs for simple attribute panels.
ii. Add the attribute configs to the panel as follows:
panelConfig.addComponent(attrConfig);
The addComponent() method will create a group config automatically the first time it is called.
Case 2: Advanced attribute panel
a. Create at least one GroupConfig using the ComponentConfigFactory :
GroupConfig groupConfig = factory.newGroupConfig
("<id of your group>");
groupConfig.setLabel("<your group label>");
The label is the title that will be displayed in the UI and should be localized from a resource file if appropriate:
b. Create the attribute configs and add them to the group config.
Create an AttributeConfig for each attribute you want to display in the panel using the ComponentConfigFactory. For example:
AttributeConfig attrConfig = factory.newAttributeConfig(“<attribute name>”);
Add each AttributeConfig to the GroupConfig :
groupConfig.addComponent(attrConfig);
c. Add the group config to the panel config.
panelConfig.addComponent(groupConfig);
2. Override the getComponentType() method to set the component type of the panel, if desired. If you do not override this method, the parent class will set the ComponentType as described below.
◦ If ComponentMode is ComponentMode.VIEW, ComponentType is set to ComponentType.INFO_ATTRIBUTES_TABLE
◦ Otherwise, ComponentType is set to ComponentType.TABLE
If the panel is to be displayed in a create or edit wizard and contains attributes you want the framework form processors to set automatically for you, you should return component type ComponentType.WIZARD_ATTRIBUTES_TABLE. Otherwise, you can accept the default setting for wizard panels.
Modifying the Panel View (JSP)
Modifying the Panel Context Object
Parent topic