<%-- * Licensed Materials - Property of IBM * * 5724-U18 * * (C) COPYRIGHT IBM CORP. 2006, 2016 All Rights Reserved. * * US Government Users Restricted Rights - Use, duplication or * disclosure restricted by GSA ADP Schedule Contract with * IBM Corp. --%><%-- This JSP is the handler for "treenode" component. It provides a wrapper/container for this treenode and its children. It handles the following events - render - render within refresh of parent when parent is expanded - collapse --%><%@ include file="../common/simpleheader.jsp" %><% String label = component.getProperty("label"); String cdataTest = (String)app.get("incdata"); if(designmode && component.needsRender()) { %> <%@ include file="../common/designerevents.jsp" %> <% label = control.getLocalizedType(); String automationIdTn = ""; String automationIdChildren = ""; if(automation) { automationIdTn="automationid=\""+realId+"_tn\""; automationIdChildren="automationid=\""+realId+"_children\""; } %>
  • style="<%=designerSelected%>">
    > ><%@ include file="../common/uistatusindicator.jsp" %><%=label%>...
  • <% }//if design mode if(!designmode) { TreeNode treeNode = (TreeNode)control; Tree treeControl = treeNode.getTree(); ControlInstance parentNode = (ControlInstance)control.getParentInstance(); //Attributes and flags specified for this control from tree TreeNode selectedNode = treeControl.getSelectedNode(); String lastSelectedNodeId = treeControl.getLastSelectedNodeId(); String restrictActionOn = treeControl.getRestrictActionOn(); //Attributes specified for this control (in xml) String nodeImage = component.getProperty("image"); String selectImage = component.getProperty("selectimage"); String objectname = component.getProperty("objectname"); String keyValue = treeNode.getKeyValue(); String collapsedImage = component.getProperty("collapsedimage"); String expandedImage = component.getProperty("expandedimage"); String noChildImage = component.getProperty("nochildrenimage"); String waitImage = component.getProperty("waitimage"); String toggleEvent = component.getProperty("toggleevent"); String nodeEvent = component.getProperty("nodeevent"); String nodeImageEvent = component.getProperty("nodeimageevent"); String nodeClass = "n "; String nodeLabelClass = ""; String nodeImageClass= ""; String nodeLabel = treeNode.getNodeLabel(); String nodeLinkTextDecoration = "style=\"text-decoration:none\""; boolean enableReturn = component.getProperty("enablereturn").equals("true"); boolean enableSelectNode = component.getProperty("enableselectnode").equals("true"); boolean displayNodeImage = component.getProperty("displaynodeimage").equals("true"); boolean nodeHasChildren = treeNode.hasChildNodes(); boolean handleAction = true; boolean expanded = treeNode.isExpanded(); boolean collapsed = treeNode.isCollapsed(); boolean isfakenode = treeNode.isFakeMessageNode(); boolean ishidden = treeNode.isDataHidden(); boolean ismarkedfordelete = treeNode.isMarkedForDelete(); String unformattedKeyValue = keyValue.replaceAll("'",""); //Set events String nodeStateImage = (nodeHasChildren)? collapsedImage : noChildImage; JSONObject selectNodeEvent = new JSONObject(); selectNodeEvent.put("eventtype", "selectnode"); selectNodeEvent.put("targetid", id); selectNodeEvent.put("value", unformattedKeyValue); //For clicking only on the node name String nodeEvents = "onmouseout=\"return noStatus();\" "+ "onmouseover=\"return noStatus();\" "+ "onfocus=\"return noStatus(); this.style.border='1px solid black'\" "+ "onblur=\"return noStatus(); this.style.border='1px transparent'\" "; //Alts and Messages String browser = wcs.getUserAgentName(); String selectRecordlbl = wcs.getMessage("tableinfo","cntrlTableAltSelectRow"); String selectNodelbl = wcs.getMessage("jspmessages","selectnode",new String[]{nodeLabel}); String expandalt = wcs.getMessage("jspmessages","expandnode"); String collapsealt = wcs.getMessage("jspmessages","collapsenode"); String controlId = id; String collapseExpandEvents = "changeImageSrc('"+controlId + "_state_image','"+IMAGE_PATH + waitImage+"'),sendEvent('"+toggleEvent+"','"+id+"','"+unformattedKeyValue+"')"; JSONObject nodeEventJson = new JSONObject();//For clicking on the node image if(nodeEvent.length()>0) { nodeEventJson.put("eventtype", nodeEvent); nodeEventJson.put("targetid", id); nodeEventJson.put("value", unformattedKeyValue); } //nodeEvent = "sendEvent('"+nodeEvent+"','"+id+"','"+unformattedKeyValue+"')";//For clicking on the node image JSONObject nodeImageEventJson = new JSONObject();//for custom event if(nodeImageEvent.length()>0) { nodeImageEventJson.put("eventtype", nodeImageEvent); nodeImageEventJson.put("targetid", id); nodeImageEventJson.put("value", unformattedKeyValue); } toggleEvent = (nodeHasChildren)? toggleEvent: "";//toggle event if(expanded) { nodeStateImage = expandedImage; } if(!nodeHasChildren) nodeStateImage = noChildImage; //Determine if action needed based on node type if(!restrictActionOn.equals("")) { if(restrictActionOn.equalsIgnoreCase(Tree.CONST_RESTRICT_ACTION_ON_BRANCHNODES)) { if(!nodeHasChildren) handleAction = false; } else if(restrictActionOn.equalsIgnoreCase(Tree.CONST_RESTRICT_ACTION_ON_LEAFNODES)) { if(nodeHasChildren) handleAction = false; } } String tabIndex = "-1"; boolean currentlySelected = (selectedNode!=null && selectedNode.getRenderId().equals(control.getRenderId())); if(currentlySelected || (selectedNode==null && !parentNode.getType().equals("treenode")) && parentNode.getChildren().get(0) == control){ tabIndex = "0"; } if(ismarkedfordelete) { nodeLinkTextDecoration = "style=\"text-decoration: line-through;\""; } if(isfakenode) { nodeStateImage = component.getProperty("overflowimage"); nodeLabelClass = "fnl"; nodeClass = "fn"; } if(ishidden) { nodeLabelClass = "nn"; nodeEvent=""; nodeEventJson.clear(); selectNodeEvent.clear(); collapseExpandEvents=""; } //If needs render and the parent doesnt need render, and parent is NOT tree and parent is expanded if(component.needsRender()) { if(!parentNode.needsRender() && (parentNode instanceof TreeNode)) { String automationIdWrapper = ""; if(automation) { automationIdWrapper="automationid=\""+realId+"_wrapper\""; } if(treeNode.isFirstChildForParent()) { holderId = parentNode.getRenderId()+"-trn_children"; %> <%@ include file="../common/componentholder_start.jsp" %> <% } } JSONObject primaryEvent = new JSONObject(); if(enableSelectNode) { primaryEvent = selectNodeEvent; } JSONObject secondaryEvent = nodeEventJson; if(treeControl.getId().contains("associateClassification_tree")) { primaryEvent = nodeEventJson; } if(enableReturn && handleAction) { if(currentlySelected) { nodeLabelClass = "sn"; } else { nodeLabelClass = "nn"; } } else { if(enableSelectNode) { if(selectedNode!=null && selectedNode.getId().equals(controlId)) nodeLabelClass = "sn"; else nodeLabelClass = "nn"; } else nodeLabelClass = "nn"; } nodeLabelClass = nodeLabelClass + " " + cssclass; String topULId = treeControl.getTopULId(); %>