Examples of TreeControlNode


Examples of org.apache.webapp.admin.TreeControlNode

                values[0] = defaultContexts[i];
                mBServer.invoke(fname, operation,
                                values, removeDefaultContextTypes);
                if (control != null) {
                    control.selectNode(null);
                    TreeControlNode node = control.findNode(defaultContexts[i]);
                    if (node != null) {
                        node.remove();
                    } else {
                        getServlet().log("Missing TreeControlNode for " +
                                         defaultContexts[i]);
                    }
                } else {
View Full Code Here

Examples of org.apache.webapp.admin.TreeControlNode

                // Add the new Connector to our tree control node
                TreeControl control = (TreeControl)
                    session.getAttribute("treeControlTest");
                if (control != null) {
                    String parentName = serviceName;
                    TreeControlNode parentNode = control.findNode(parentName);
                    if (parentNode != null) {
                        String nodeLabel = resources.getMessage(locale,
                            "server.service.treeBuilder.connector") + " (" +
                            cform.getPortText() + ")";
                        String encodedName =
                            URLEncoder.encode(cObjectName,TomcatTreeBuilder.URL_ENCODING);
                        TreeControlNode childNode =
                            new TreeControlNode(cObjectName,
                                                "Connector.gif",
                                                nodeLabel,
                                                "EditConnector.do?select=" +
                                                encodedName,
                                                "content",
View Full Code Here

Examples of org.apache.webapp.admin.TreeControlNode

                // Add the new Connector to our tree control node
                TreeControl control = (TreeControl)
                    session.getAttribute("treeControlTest");
                if (control != null) {
                    String parentName = serviceName;
                    TreeControlNode parentNode = control.findNode(parentName);
                    if (parentNode != null) {
                        String nodeLabel = resources.getMessage(locale,
                            "server.service.treeBuilder.connector") + " (" +
                            cform.getPortText() + ")";
                        String encodedName =
                            URLEncoder.encode(cObjectName);
                        TreeControlNode childNode =
                            new TreeControlNode(cObjectName,
                                                "Connector.gif",
                                                nodeLabel,
                                                "EditConnector.do?select=" +
                                                encodedName,
                                                "content",
View Full Code Here

Examples of org.apache.webapp.admin.TreeControlNode

                // Add the new Connector to our tree control node
                TreeControl control = (TreeControl)
                    session.getAttribute("treeControlTest");
                if (control != null) {
                    String parentName = serviceName;
                    TreeControlNode parentNode = control.findNode(parentName);
                    if (parentNode != null) {
                        String nodeLabel =
                           "Connector (" + cform.getPortText() + ")";
                        String encodedName =
                            URLEncoder.encode(cObjectName);
                        TreeControlNode childNode =
                            new TreeControlNode(cObjectName,
                                                "Connector.gif",
                                                nodeLabel,
                                                "EditConnector.do?select=" +
                                                encodedName,
                                                "content",
View Full Code Here

Examples of org.apache.webapp.admin.TreeControlNode

                TreeControl control = (TreeControl)
                    session.getAttribute("treeControlTest");
                if (control != null) {
                    String parentName =
                          TomcatTreeBuilder.SERVICE_TYPE + ",name=" + serviceName;
                    TreeControlNode parentNode = control.findNode(parentName);
                    if (parentNode != null) {
                        String nodeLabel =
                           "Connector (" + cform.getPortText() + ")";
                        String encodedName =
                            URLEncoder.encode(cObjectName);
                        TreeControlNode childNode =
                            new TreeControlNode(cObjectName,
                                                "Connector.gif",
                                                nodeLabel,
                                                "EditConnector.do?select=" +
                                                encodedName,
                                                "content",
View Full Code Here

Examples of org.apache.webapp.admin.TreeControlNode

           
            // Add the new Valve to our tree control node
            TreeControl control = (TreeControl)
            session.getAttribute("treeControlTest");
            if (control != null) {
                TreeControlNode parentNode = control.findNode(parentNodeName);
                if (parentNode != null) {
                    String nodeLabel =
                    "Valve for " + parentNode.getLabel();
                    String encodedName =
                    URLEncoder.encode(vObjectName);
                    TreeControlNode childNode =
                    new TreeControlNode(vObjectName,
                    "Valve.gif",
                    nodeLabel,
                    "EditValve.do?select=" + encodedName +
                    "&nodeLabel=" + URLEncoder.encode(nodeLabel) +
                    "&parent=" + URLEncoder.encode(parentNodeName),
View Full Code Here

Examples of org.apache.webapp.admin.TreeControlNode

                TreeControl control = (TreeControl)
                    session.getAttribute("treeControlTest");
                if (control != null) {
                    String parentName =
                          TomcatTreeBuilder.SERVICE_TYPE + ",name=" + serviceName;
                    TreeControlNode parentNode = control.findNode(parentName);
                    if (parentNode != null) {
                        String nodeLabel =
                           "Connector (" + cform.getPortText() + ")";
                        String encodedName =
                            URLEncoder.encode(cObjectName);
                        TreeControlNode childNode =
                            new TreeControlNode(cObjectName,
                                                "Connector.gif",
                                                nodeLabel,
                                                "EditConnector.do?select=" +
                                                encodedName,
                                                "content",
View Full Code Here

Examples of org.apache.webapp.admin.TreeControlNode

        }
       
      String node = actionRequest.getParameter("node");
      if(node != null)
      {
          TreeControlNode controlNode = control.findNode(node);
          if(controlNode != null)
          {
              controlNode.setExpanded(!controlNode.isExpanded());
          }
      }
     
      String selectedNode = actionRequest.getParameter(PortletApplicationResources.REQUEST_SELECT_NODE);
      if(selectedNode != null)
      {
          control.selectNode(selectedNode);
          TreeControlNode child = control.findNode(selectedNode);
          if(child != null)
          {
              MutablePortletApplication pa = null;
             
            String domain = child.getDomain();
            if(domain.equals("PA_APP_DOMAIN"))
            {
                pa = registry.getPortletApplicationByIdentifier(selectedNode);
                if(pa != null)
                {
                    actionRequest.getPortletSession().removeAttribute(PortletApplicationResources.REQUEST_SELECT_PORTLET, PortletSession.APPLICATION_SCOPE);
                }
            }
            else if(domain.equals("PD_DOMAIN"))
            {
                TreeControlNode parent = child.getParent();
                  pa = registry.getPortletApplicationByIdentifier(parent.getName());
                 
                  //set selected tab to portlets tab
                  if(pa != null)
                  {
                      //TODO:  do we need to look up the pdef?  Could we just pass the child name into setAttribute?
View Full Code Here

Examples of org.apache.webapp.admin.TreeControlNode

    }
  }
 
  private TreeControl buildTree(Collection apps, Locale locale)
    {     
    TreeControlNode root =
            new TreeControlNode("ROOT-NODE",
                                null,
                                "J2_ROOT",
                                PortletApplicationResources.PORTLET_URL,
                                null,
                                true,
                                "J2_DOMAIN");
   
    TreeControl control = new TreeControl(root);
   
   
    TreeControlNode portletApps =
      new TreeControlNode("APP_ROOT",
                                null,
                                "APP_ROOT",
                                PortletApplicationResources.PORTLET_URL,
                                null,
                                false,
                                "J2_DOMAIN");
    root.addChild(portletApps);
   
    Iterator it = apps.iterator();
        while (it.hasNext())
        {
            MutablePortletApplication pa = (MutablePortletApplication)it.next();
            TreeControlNode appNode = new TreeControlNode(pa.getName(),
                                                          null,
                                                          pa.getName(),
                                                          PortletApplicationResources.PORTLET_URL,
                                                          null,
                                                          false,
                                                          "PA_APP_DOMAIN"  );
            portletApps.addChild(appNode);
           
            Iterator pdefIter = pa.getPortletDefinitionList().iterator();
            while (pdefIter.hasNext())
            {
                PortletDefinitionComposite portlet = (PortletDefinitionComposite) pdefIter.next();
                TreeControlNode portletNode = new TreeControlNode(pa.getName() + "::" + portlet.getName(),
                                                                  null,
                                                                  portlet.getDisplayNameText(locale),
                                                                  PortletApplicationResources.PORTLET_URL,
                                                                  null,
                                                                  false,
View Full Code Here

Examples of org.apache.webapp.admin.TreeControlNode

        // null, then do not render root node in the tree.
       
        if ("ROOT-NODE".equalsIgnoreCase(node.getName()) &&
        (node.getLabel() == null)) {
            // Render the children of this node
            TreeControlNode children[] = node.findChildren();
            int lastIndex = children.length - 1;
            int newLevel = level + 1;
            for (int i = 0; i < children.length; i++) {
                render(out, children[i], newLevel, width, i == lastIndex);
            }
            return;
        }
       
        // Render the beginning of this node
        out.println("  <tr valign=\"middle\">");

        // Create the appropriate number of indents
        for (int i = 0; i < level; i++) {
            int levels = level - i;
            TreeControlNode parent = node;
            for (int j = 1; j <= levels; j++)
                parent = parent.getParent();
            if (parent.isLast())
                out.print("    <td></td>");
            else {
                out.print("    <td><img src=\"");
                out.print(images);
                out.print("/");
                out.print(IMAGE_LINE_VERTICAL);
                out.print("\" alt=\"\" border=\"0\"></td>");
            }
            out.println();
        }

        // Render the tree state image for this node

        // HACK to take into account special characters like = and &
        // in the node name, could remove this code if encode URL
        // and later request.getParameter() could deal with = and &
        // character in parameter values.
        String encodedNodeName = URLEncoder.encode(node.getName());

        PortletURL treeActionUrl = renderResponse.createActionURL();
        treeActionUrl.setParameter("node", node.getName());
        String treeAction = treeActionUrl.toString();
//        String action = replace(getAction(), "${name}", encodedNodeName);

       
//        String updateTreeAction =
//            replace(getAction(), "tree=${name}", "select=" + encodedNodeName);
//        updateTreeAction =
//            ((HttpServletResponse) pageContext.getResponse()).
//            encodeURL(updateTreeAction);

        out.print("    <td>");
       
    //add an anchor so that we can return to this node
        out.print("<a name=\"");
        out.print(node.getName());
        out.print("\">");
       
        if ((action != null) && !node.isLeaf()) {
            out.print("<a href=\"");
            out.print(response.encodeURL(treeAction));
            out.print("\">");
        }
        out.print("<img src=\"");
        out.print(images);
        out.print("/");
        if (node.isLeaf()) {
            if (node.isLast())
                out.print(IMAGE_LINE_LAST);
            else
                out.print(IMAGE_LINE_MIDDLE);
            out.print("\" alt=\"");
        } else if (node.isExpanded()) {
            if (node.isLast())
                out.print(IMAGE_HANDLE_DOWN_LAST);
            else
                out.print(IMAGE_HANDLE_DOWN_MIDDLE);
            out.print("\" alt=\"close node");
        } else {
            if (node.isLast())
                out.print(IMAGE_HANDLE_RIGHT_LAST);
            else
                out.print(IMAGE_HANDLE_RIGHT_MIDDLE);
            out.print("\" alt=\"expand node");
        }
        out.print("\" border=\"0\">");
        if ((action != null) && !node.isLeaf())
            out.print("</a>");
        out.println("</td>");

        // Calculate the hyperlink for this node (if any)
        String hyperlink = null;
        String nodeAction = node.getAction();
        if(nodeAction == null && node.isExpandWhenClicked())
        {
            hyperlink = treeAction;
        }
        if (nodeAction != null)
        {
            if(node.getAction().equals("portlet_url"))
            {
                PortletURL actionUrl = renderResponse.createActionURL();
                actionUrl.setParameter("select_node", node.getName());
                hyperlink = ((HttpServletResponse) pageContext.getResponse()).encodeURL(actionUrl.toString());
            }
            else
            {
              hyperlink = ((HttpServletResponse) pageContext.getResponse()).
                  encodeURL(node.getAction());
            }
        }

        // Render the icon for this node (if any)
        out.print("    <td colspan=\"");
        out.print(width - level + 1);
        out.print("\"");
       
        if(node.getLabel() != null)
        {
            //make sure text does not wrap
            out.print(" style=\"");
            out.print("white-space:nowrap;");
            out.print("\"");
        }
       
        out.print(">");
        if (node.getIcon() != null) {
            if (hyperlink != null) {
                out.print("<a href=\"");
                out.print(hyperlink);
                out.print("\"");
                String target = node.getTarget();
                if(target != null) {
                    out.print(" target=\"");
                    out.print(target);
                    out.print("\"");
                }
                /* Invalid, not used, and not usefull
                // to refresh the tree in the same 'self' frame
                out.print(" onclick=\"");
                out.print("self.location.href='" + updateTreeAction + "'");
                out.print("\"");
                */
                out.print(">");
            }
            out.print("<img src=\"");
            out.print(images);
            out.print("/");
            out.print(node.getIcon());
            out.print("\" alt=\"");
            out.print("\" border=\"0\">");
            if (hyperlink != null)
                out.print("</a>");
        }

        // Render the label for this node (if any)

        if (node.getLabel() != null) {
            String labelStyle = node.getCSSClass();
            if (node.isSelected() && (styleSelected != null))
                labelStyle = styleSelected;
            else if (!node.isSelected() && (styleUnselected != null))
                labelStyle = styleUnselected;
            if (hyperlink != null) {
                // Note the leading space so that the text has some space
                // between it and any preceding images
                out.print(" <a href=\"");
                out.print(hyperlink);
                out.print("\"");
                String target = node.getTarget();
                if(target != null) {
                    out.print(" target=\"");
                    out.print(target);
                    out.print("\"");
                }
                if (labelStyle != null) {
                    out.print(" class=\"");
                    out.print(labelStyle);
                    out.print("\"");
                }
               
                if(node.getTitle() != null)
                {
                    out.print(" title=\"");
                    out.print(node.getTitle());
                    out.print("\"");
                }
               
                /* Invalid, not used, and not usefull
                // to refresh the tree in the same 'self' frame
                out.print(" onclick=\"");
                out.print("self.location.href='" + updateTreeAction + "'");
                out.print("\"");
                */
                out.print(">");
            } else if (labelStyle != null) {
                out.print("<span class=\"");
                out.print(labelStyle);
                out.print("\">");
            }
            out.print(node.getLabel());
            if (hyperlink != null)
                out.print("</a>");
            else if (labelStyle != null)
                out.print("</span>");
        }
        out.println("</td>");

        // Render the end of this node
        out.println("  </tr>");

        // Render the children of this node
        if (node.isExpanded()) {
            TreeControlNode children[] = node.findChildren();
            int lastIndex = children.length - 1;
            int newLevel = level + 1;
            for (int i = 0; i < children.length; i++) {
                render(out, children[i], newLevel, width, i == lastIndex);
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.