Simple and Advanced Attribute Panels in a Wizard
This is a composite example displaying four attribute panels in the Set Attributes step for a new object of type Novel. (Note: this is not a working wizard as no FormProcessor has been defined for it).
Panel 1
This is a composite component that displays:
A simple panel containing a single attribute – the name of the container for the new object
The type of object being created
Note that if this object type had subtypes, a type picker would be displayed here instead of a read-only field
A simple panel with an input field for Organization Id (only displayed if the preference Display > Expose Organization is set to “Yes”)
An advanced panel titled Attributes, which contains most of the non-driver attributes of the new object. This panel is based on the layout for the screen type “Create New” (ScreenDefinitionName.CREATE) for the parent WTDocument type.
This composite panel is created automatically by the JCA framework when we included the contents of the file <Windchill>/codebase/WEB-INF/jsp/object/defineItemAttributesWizStep.jsp in our wizard step JSP. That file is the default JSP for the Set Attributes wizard step. If we had not wanted to include additional panels in this wizard step, we could have used the default action “defineItemAttributesWizStep” in the wizardStep tag and not had to write any JSPs or Java code for the wizard.
Panel 2
This panel, titled “Additional Attributes” is an advanced attribute panel displaying two attributes of Novel that were not included in the “Create New” layout for the Novel type.
This panel is created by the following statement in the step jsp:
<jsp:include page="${mvc:getComponentURL('carambola.attributePanel.
WizardPanelForEnabledAndDepartment')}"/>
This statement tells the JCA framework to look for a Java builder class with the component builder id “carambola.attributePanel.WizardPanelForEnabledAndDepartment.” It will find the builder class EnabledAndDepartmentPanelBuilder, which will configure the panel, acquire the data for it, and set the JSP that will display the panel.
Some things to note about this builder are:
The buildComponentData() method returns a TypeInstance for a new Novel object. If the panel object is a Windchill business object, it is important that datum object be a TypeInstance so that any constraints defined for the attributes are captured and made available to the data utilities.
The panel component type is set to ComponentType.WIZARD_ATTRIBUTES_TABLE. This is needed so that the HTML names of the input fields are created such that the framework can identify the attributes it needs to set on the object after the wizard is submitted.
See Solution – Create a Simple or Advanced Attribute Panel Using a Configuration Created in a Java Builder Class for more information about this technique for creating attribute panels.
Panel 3
This is a simple attribute panel with one property, “Copyrighted,” that is not an attribute of the Novel object type. You might use this technique when you want to capture some additional information from the user besides the object’s attributes. Note that because the Copyrighted information is not an object attribute, a custom FormProcessor or FormProcessorDelegate would be needed to handle this information when the wizard is submitted.
This panel is created by the following statement in the step JSP:
<jsp:include page="${mvc:getComponentURL
('carambola.attributePanel.WizardPanelForCopyrightInfo')}"/>
Just as in the previous example, this statement tells the JCA framework to call a MVC Java builder class, which, in this case, is the class CopyrightAttributePanelBuilder. Some things to note about this example builder are:
In this case we don’t set the component type of the panel to ComponentType.WIZARD_ATTRIBUTES_TABLE because we don’t want the framework to create an HTML name for the input field such that the framework form processors would try to set the value of the field as an attribute on the object. Instead, we want the HTML name to be such that our custom form processor can find the property value in the form data and process it. In this case, the value will have the key “copyrighted,” which is the column name set in the buildComponentData() method.
We set the view to “components/simpleAttributePanel.jsp” in our panel config because we do not want a border around our panel or other advanced features.
The buildComponentData() method of the builder returns a HashMap as the datum that will be passed to the data utilities. The key is the string “copyrighted” and the value is a BooleanInputComponent. We need to create the input component because the DefaultDataUtility would not know the type of the property we want to display and could not determine which type-specific data utility should be used. Alternatively, we could have created and registered a data utility for this property.
See Solution – Create a Simple or Advanced Attribute Panel Using a Configuration Created in a Java Builder Class for more information about this technique for creating attribute panels.
Panel 4
This is a simple attribute panel containing one attribute of the panel object type. In this case the panel was created using JSP tags in the wizard step JSP.
See Solution - Create a Simple Panel Using JSP Tags for more information about this technique for creating attribute panels.
Actions Models Used in This Example
None
Actions Used in This Example
Action Name
Object Type Name
File
wizardWithAttributePanels
attributePanel
/config/actions/Carambola-actions.xml
defineItemAttributesWizStepForAttrPanelWizard
Novel
/config/actions/Carambola-actions.xml
Files Used in This Example
Source File
Description
codebase/netmarkets/jsp/carambola/customization/examples/attributePanel/wizardWithAttributePanels.jsp
Main wizard JSP
/com/ptc/mvc/builders/carambola/attributePanel/DefineItemAttributesWizStepBuilderForAttrPanelWizard
Builder for the wizard step
codebase/WEB-INF/jsp/carambola/attributePanel/defineItemAttributesWizStepForAttrPanelWizard.jsp
JSP for the wizard step
com/ptc/mvc/builders/carambola/attributePanel/EnabledAndDepartmentPanelBuilder.java
Builder for the Additional Attributes panel
com/ptc/mvc/builders/carambola/attributePanel/CopyrightAttributePanelBuilder.java
Builder for the Copyrighted panel
codebase/config/actions/Carambola-actions.xml
Contains the actions for the example
com/ptc/carambola/customization/examples/attributePanel/AttributePanelExampleResource.java
UI text for example
Was this helpful?