protected void restoreTree() {
    Pair<ElementNode, List<ElementNode>> selection = storeSelection();

    DefaultMutableTreeNode root = getRootNode();
    if (!myShowClasses || myContainerNodes.isEmpty()) {
      List<ParentNode> otherObjects = new ArrayList<ParentNode>();
      Enumeration<ParentNode> children = getRootNodeChildren();
      ParentNode newRoot =
          new ParentNode(
              null, new MemberChooserObjectBase(getAllContainersNodeName()), new Ref<Integer>(0));
      while (children.hasMoreElements()) {
        final ParentNode nextElement = children.nextElement();
        if (nextElement instanceof ContainerNode) {
          final ContainerNode containerNode = (ContainerNode) nextElement;
          Enumeration<MemberNode> memberNodes = containerNode.children();
          List<MemberNode> memberNodesList = new ArrayList<MemberNode>();
          while (memberNodes.hasMoreElements()) {
            memberNodesList.add(memberNodes.nextElement());
          }
          for (MemberNode memberNode : memberNodesList) {
            newRoot.add(memberNode);
          }
        } else {
          otherObjects.add(nextElement);
        }
      }
      replaceChildren(root, otherObjects);
      sortNode(newRoot, myComparator);
      if (newRoot.children().hasMoreElements()) root.add(newRoot);
    } else {
      Enumeration<ParentNode> children = getRootNodeChildren();
      while (children.hasMoreElements()) {
        ParentNode allClassesNode = children.nextElement();
        Enumeration<MemberNode> memberNodes = allClassesNode.children();
        ArrayList<MemberNode> arrayList = new ArrayList<MemberNode>();
        while (memberNodes.hasMoreElements()) {
          arrayList.add(memberNodes.nextElement());
        }
        Collections.sort(arrayList, myComparator);
        for (MemberNode memberNode : arrayList) {
          myNodeToParentMap.get(memberNode).add(memberNode);
        }
      }
      replaceChildren(root, myContainerNodes);
    }
    myTreeModel.nodeStructureChanged(root);

    defaultExpandTree();

    restoreSelection(selection);
  }
Example #2
0
 public void accept(SqlContext ctx) {
   SqlContext childCtx = new SqlContextImpl(ctx);
   super.accept(childCtx);
   if (childCtx.isEnabled()) {
     ctx.addSql(childCtx.getSql(), childCtx.getBindVariables(), childCtx.getBindVariableTypes());
   }
 }
 public void addComponent(Renderable renderable) {
   // as of Jan 22, stoichiometry is disabled.
   //      // Check stoichiometries first
   //      Renderable target = getTarget(renderable);
   //      // Have to make stoichiometries consistent
   //      Integer value = (Integer) stoichiometries.get(target);
   //      if (value == null)
   //      stoichiometries.put(target, new Integer(1));
   //      else
   //      stoichiometries.put(target, new Integer(value.intValue() + 1));
   //      // Check if renderable has been added to components
   //      for (Iterator it = components.iterator(); it.hasNext();) {
   //      Renderable r = (Renderable) it.next();
   //      if (r instanceof Shortcut)
   //      r = ((Shortcut)r).getTarget();
   //      if (r == target)
   //      return;
   //      }
   components.add(renderable);
   rebuildHierarchy();
   if (hideComponents) {
     renderable.setIsVisible(false);
     if (renderable instanceof ContainerNode) ((ContainerNode) renderable).hideComponents(true);
   }
 }
 /** Override the super class method to handle components if they have been hidden. */
 @Override
 public void move(int dx, int dy) {
   super.move(dx, dy);
   if (hideComponents && isResizing()) {
     // Want to make all components to have the same sizing as the current components
     copyBoundsToComponents();
   }
 }
Example #5
0
 private String[] getWebServerName(ContainerRoot model) {
   for (ContainerNode node : model.getNodes()) {
     for (ComponentInstance component : node.getComponents()) {
       //				for (TypeDefinition typeDefinition :
       // component.getTypeDefinition().getSuperTypesForJ()) {
       org.kevoree.log.Log.debug(component.getTypeDefinition().getName());
       if ("SprayWebServer"
           .equals(
               component
                   .getTypeDefinition()
                   .getName())) { // must be change if the webserver implementation is changed
         return new String[] {component.getName(), node.getName()};
       }
       //				}
     }
   }
   return null;
 }
 @Override
 public void setBoundsFromComponents() {
   super.setBoundsFromComponents();
   // Need to calculate the text layout position
   if (components != null && components.size() > 0 && textBounds != null) {
     // Create a union
     textBounds.y = bounds.y + bounds.height + 2;
     int x1 = Math.min(textBounds.x, bounds.x);
     int y1 = Math.min(textBounds.y, bounds.y);
     int x2 = Math.max(textBounds.x + textBounds.width, bounds.x + bounds.width);
     int y2 = Math.max(textBounds.y + textBounds.height, bounds.y + bounds.height);
     bounds.x = x1;
     bounds.y = y1;
     bounds.width = x2 - x1;
     bounds.height = y2 - y1;
     // Make sure text in the middle of the bottom
     textBounds.x = bounds.x + (bounds.width - textBounds.width) / 2;
     validatePositionFromBounds();
     needCheckBounds = false;
     needCheckTextBounds = false;
   }
 }
Example #7
0
 public void readObject(ContainerNode node) throws java.lang.Exception {
   pjsua2JNI.TransportConfig_readObject(swigCPtr, this, ContainerNode.getCPtr(node), node);
 }
 @Override
 protected void initBounds(Graphics g) {
   super.initBounds(g);
   ensureTextInBounds(false);
   if (hideComponents) copyBoundsToComponents();
 }
Example #9
0
 public void writeObject(ContainerNode node) throws java.lang.Exception {
   pjsua2JNI.EpConfig_writeObject(swigCPtr, this, ContainerNode.getCPtr(node), node);
 }