Column Values Including Additional Icons

A column can include an icon in addition to the object name using any of these methods described in this section.


The emxFramework.UIComponents.OverriddenTypeIcon.Program=<JPO Name>:<Method Name> property in emxSystem.properties defines a global JPO:method used for all fields and columns that define the Show Alternate Icon or the Show Type Icon setting, and for all navigation trees. To use a different JPO:method for a specific column, use the Type Icon Function and Type Icon Program settings.

The JPO:method specified in the emxSystem.properties file and the one specified using the Type Icon Function and Type Icon Program settings determine the icon to show in addition to the type or alternate icon already defined. For this JPO to be called, either the Show Alternate Icon or the Show Type Icon setting must be set to true. If both of those settings are set to false, the default JPO and any Type Icon Function and Type Icon Program values are ignored.

You cannot use the additional icon if the value for the Column Type setting is any of these values:


  • checkbox
  • file
  • icon
  • image
  • programHTMLOutput
  • separator

The function that retrieves the list of custom icons to display in the column must return an image name or path for each id that is passed to it. The path, including the image name, must be specified relative to the ematrix\common directory. The image must be a gif image, and cannot include any spaces or special characters.

If the function returns:


  • Image name--the image is used (you must provide all images not expressly installed with the ENOVIA products)
  • Blank image name--the default image defined for the object type is used
  • Invalid image name--the standard red X icon is used

The method signature is:

public static MapList getCustomIcons(Context context, String[] 
args) throws FrameworkException

The input args[] array contains a packed map with the entries defined in this table.

# Key Content

1

paramMap

A map containing key/value pairs of the request parameters originally passed to emxTable.jsp or emxIndentedTable.jsp.

2

columnMap or fieldMap

Information about the column or field

3

ObjectList

A MapList (derived from the ArrayList) of maps with information about each object, such as object id or connection id, in the table or structure browser.

If the column has also been defined with the Show Alternate Icon and Alternate OID expression settings, it is possible that the expression could return multiple values. In this case, the Type Icon Function must be passed the same list of resolved object ids, as shown in this example:

Key Value Description

id

Object id of the table row

id[connection]

Relationship id of the table row

Alternate OID

List of Alternate Object Ids:

123.495.7238.7888

123.495.7238.7889

Key

Value Description

id

Object id of the table row

id[connection]

Relationship id of the table row

Alternate OID

List of Alternate Object Ids:

123.495.7238.7888

123.495.7238.7889

When the Show Type Icon setting is set to true, the MapList output (that specifies the name of the additional icon) from a function that processes alternate OIDs should look like this:

Key Value

121.783.378.7774

completeState.gif

121.783.378.7734

startState.gif

Key

Value

121.783.378.7778

completeState.gif

121.783.378.7755

startState.gif

When the Show Type Icon setting is set to true for a specific column, the MapList output (that specifies the name of the additional icon) from a function that processes alternate OIDs should look like this:

Key Value (Alternate HashMap)

121.783.378.7774

Alternate OID

Value

121.783.378.7722

completeState.gif

121.783.378.7755

startState.gif

121.783.378.7734

Alternate OID

Value

121.783.378.7711

completeState.gif

121.783.378.7799

startState.gif

Sample Code for Type Icon Program/Function Used with Show Type Icon

Public static MapList getCustomIcons (Context context, String[] 
args) throws FrameworkException
{
    // unpack args array to get input map
Map programMap = (Map) JPO.unpackArgs(args);
// get object list
MapList ObjectList= (MapList) programMap.get("objectList");
MapList iconList = new MapList();
String bArr [] = new String[ObjectList.size()];
StringList bSel = new StringList();
bSel.add(DomainConstants.SELECT_CURRENT);
 bSel.add(DomainConstants.SELECT_TYPE);
        
// Get the object elements - OIDs and RELIDs - if required
for (int i = 0; i < ObjectList.size(); i++)
{
// Get Business object Id
bArr [i] =(String)((HashMap) ObjectList.get(i)).get("id");
}
// Get the required information for the objects.
BusinessObjectWithSelectList bwsl 
=BusinessObject.getSelectBusinessObjectData (context, bArr, 
bSel);
for (int i = 0; i < ObjectList.size(); i++)
 {
    String currentObjectid =(String)((HashMap) 
ObjectList.get(i)).get("id");
// get the current state value
String state = bwsl.getElement(i).getSelectData("state");
String type = bwsl.getElement(i).getSelectData("type");
HashMap retMap = new HashMap();
// Based on the object state add the required icon
//Pass the required information to this method and get the 
required icon //name.
    String objectIcon = getIcons(context,typeName,state, 
currentObjectid);
retMap.put(currentObjectId, objectIcon);
// Size of the iconList should be as same as ObjectList.
iconList.add(retMap);
}
// return final list
return iconList;
    }

Sample Code for Type Icon Program/Function Used with Show Alternate Icon

Public static MapList geAlternateCustomIcons (Context context, 
String[] args) throws FrameworkException
{
// unpack the incoming arguments into a HashMap called 
'programMap' 
 Map programMap = (Map) JPO.unpackArgs(args);
         // Get the objectList
MapList relBusObjPageList= (MapList) 
programMap.get("objectList");
         MapList iconList = new MapList();
         StringList bSel = new StringList();
         String state = new String();
 String typeName = new String();
// Add the Domain Constants as required.
bSel.add(DomainConstants.SELECT_CURRENT);
         bSel.add(DomainConstants.SELECT_TYPE);
for(int j=0;j<relBusObjPageList.size();j++){
       //Create a hashmap to contain each object id as key and 
icon as value
       HashMap retMap = new HashMap();
             Map objectMap = (Map) relBusObjPageList.get(j);
             // Get the current Object id from the objectMap
String ObjectId = (String)objectMap.get("id");
// Define a Map which contains the alternateObject id  as key 
and icon name as value
HashMap alternateMap = new HashMap();
// Get the alternate object id list from the objectMap
    StringList alternateObjectList = 
(StringList)objectMap.get("Alternate OID");
//Validating if the objectlist have the alternate object ids.
/*If true then get the alternate object ids from the list and 
get the corresponding  icons and put these values in a alternate 
map with alternate object id as key and icon as value. After 
processing all the alternate object ids put this HashMap in a 
returnMap where current object Id is the key and this map as 
value so that the iconList size become same as ObjectList size*/
       if(alternateObjectList!=null){
String alternateObjects[] = new 
String[alternateObjectList.size()];
    for (int k = 0; k < alternateObjectList.size(); k++)
    alternateObjects[k] = (String) alternateObjectList.get(k);
// Get the required informations for the alternate objects
BusinessObjectWithSelectList alternatebwsl = 
BusinessObject.getSelectBusinessObjectData(context,alternateObj
ects, bSel);
    for (int k = 0; k < alternateObjectList.size(); k++) {
       if (alternatebwsl.getElement(k) != null) {
state = alternatebwsl.getElement(k). getSelectData 
(DomainConstants.SELECT_CURRENT);
typeName = alternatebwsl.getElement(k). getSelectData 
(DomainConstants.SELECT_TYPE);
                        }
                         String alternateOID = (String) 
alternateObjectList.get(k);
//Pass the required information to this method and get the 
required icon //name.
    String alternateIcon = 
getIcons(context,typeName,state,altOID);
// alternateMap should contain altOID as key and  icon name as 
value. 
alternateMap.put(alternateOID,alternateIcon);
} //end for
//Now put the original object id as key and the alternateMap as 
a value in the //return Map.
retMap.put(ObjectId,alternateMap);
            }
// iconList size should be as same as ObjectList size.
            iconList.add(relMap);
        }
        return iconList;
    }
public static String getIcons(Context context, String typeName, 
String state,String objectAltId) {
        if (state.equalsIgnoreCase("state_name")) // eg 
Preliminary
            return "image_name.gif";
        else if (state.equalsIgnoreCase("state_name")) // eg 
Review
            return "image_name.gif";
        else {
            String typeIcon = 
UINavigatorUtil.getTypeIconProperty(context,typeName);
            return typeIcon;
        }
    }