NmObject Utilities
The value of an attribute in an attribute panel or table/tree cell needs to be extracted from a different object than the datum object for the panel or table/tree row.
Problem: The object identifier used to identify a selected table/tree row or construct the actions menu for a table/tree row cannot or should not be that of the row datum object.
Background
Each attribute panel and each row in a JCA table or tree has a datum object from which the data for the attribute or table cell values is extracted and the object identifier for row actions and for row selections is obtained. The datum object is provided by the buildComponent() method of a Java builder class or by a getModel() or getIEModel() JSP tag. Datum objects are typically Persistable objects or, in the case of create and edit wizards, TypeInstances representing Persistable objects. However, other types of Java objects (for example, a HashMap) can be used.
Retrieving Attribute Values from Datum Objects
JCA provides ways to configure how datum objects are processed by data utilities to extract the attribute values that are displayed in the UI. Without additional configuration, JCA handles datum objects in the same way that the JSP EL handles Java beans, meaning that you can refer to a property name and the infrastructure will look for a corresponding getter on your object. For example, if you have described a table that has a column with the name “foo”, the infrastructure will look for a "getFoo" method on the datum object. If the method isn't found, the infrastructure does not fail but instead will simply return a null value for the UI component to process in whatever way it chooses. By default, the UI components just render a blank in this case.
You are not limited to simple properties of the datum object. In fact, anything you can do with the JSP EL can also be accomplished with JCA. For example, you can use the dot notation to refer to nested properties. In addition, JCA treats Map objects as beans, so if your API returns a Map or has a nested Map property, you can refer to it just as if it had getter methods. For complete information on what you can specify in bean notation, refer to the documentation for beanutils, the core package that JCA uses to process bean properties.
More examples:
bar[0]: get the first value of the bar property. This works if bar maps to a List or an Array.
foo.bar: get the nested "bar" property of a "foo" property. If getFoo() returns a Map, then this would correspond to getFoo().get("bar")
In addition to bean-style properties, JCA is able to look up the values for global attributes if the datum object is a Persistable or TypeInstance. Also, JCA provides a number of data utilities that are able to create values for attribute ids that are not properties of the datum object. Some of these do additional data acquisition to find necessary information that does not exist in the datum object.
Retrieving Row Identifiers from Datum Objects
Without additional configuration, the JCA table and tree framework assumes that each row object they are processing is a Windchill Persistable object whose object identifier can uniquely identify the object when a row is selected or when a row-level actions menu needs to be displayed.
The correct target object has been specified for the panel, table or tree.
這是否有幫助?