Manipulate Selected Rows

You can set up the structure tree to display with check boxes or radio buttons in the freeze pane column so that the user can select and process items using the custom pages.

For example, you can write custom pages to disconnect or delete the selected objects. Initially, the system displays check box or radio buttons using the URL parameter selection assigned to multiple or single. You can configure the toolbar command to interact with the selected items. The necessary settings are outlined below.

The href administrative parameter is associated with the toolbar command item configured for processing the selected rows. This parameter is assigned to a JSP file that processes the selected rows. See the following table for the settings associated with the toolbar command item configured for processing the selected rows.

Setting Name Description

Target Location

Assigned one of the following:

listHidden--if the processing is purely a background action and no UI is required.

popup--if the processing requires a user interface dialog. (If the value is popup, use the associated settings such as "Popup Modal").

Submit

Assigned to true so that the selected items in the structure are posted to the processing page.

Confirm Message

Configures a custom message.

Row Select

Assign to single or multi to control the selection.

The processing page gets the selected items as the posted data. The following request parameters are available to the processing page:


  • objectId--Contains one or more object IDs of the root objects in the structure tree.
  • emxTableRowId--Gives all the selected items as a string or array of strings. The values can be read using servlet APIs.
  • request.getParameter()--returns string
  • request.getParameterValues()--returns string array

Each value for emxTableRowId contains: relId, ovjectId, and parented for the selected node, separated by pipe "|", in the format <relId>|<objectId>|parentId>.

  1. relId--relationship ID for the selected node
  2. objectId--object ID of the selected node
  3. parentId--the object ID of the parent node to be the selected node

The processing page uses the passed-in values and processes them as required. Sends a message back to the structure browser component as the desired action when processing completes.

The processing JSP must return the following XML:

<mxRoot>
<action><![CDATA[<%= action %>]]></action>
<message><![CDATA[<%= msg %>]]></message>
</mxRoot>

In the above XML, action is a JSP variable. It can also be a static string. Its value should be one of the following:


  • remove--Removes the selected nodes from the display
  • refresh--Refreshes the structure view
  • error--Error condition
  • void--No action

The XML also contains the variable msg. It can be assigned any text to display as an alert message.

The following shows a JSP sample/template for the processing JSP:

<%@include file = "../common/emxNavigatorInclude.inc"%>
<%
String action = "remove";
String msg = "";
//read the necessary parameters from the posted data
String tableRowIdList[] = emxGetParameterValues(request, 
"emxTableRowId");
String objectId = emxGetParameter(request, "emxTableRowId");
try {
    ContextUtil.startTransaction(context, true);
    if (tableRowIdList!= null)       {
       for (int i=0; i< tableRowIdList.length; i++) {
          System.out.println("tableRowId ::: " +  
tableRowIdList[i]);
          //process -  relId|objectId|parentId - using the 
tableRowId
          String tableRowId = tableRowIdList[i];
       }
    }
} catch (Exception ex) {
    ContextUtil.abortTransaction(context);
    action = "error";
    if (ex.toString() != null && (ex.toString().trim()).length() 
> 0){
        msg = ex.toString().trim();
    }
} finally {
    ContextUtil.commitTransaction(context);
}
//clear the output buffer
out.clear(); %>
<mxRoot>
<action><![CDATA[<%= action %>]]></action>
<message><![CDATA[ <%= msg %>]]></message>
</mxRoot>