Example #1
0
 /** Description of the Method */
 public void removeAllElements() {
   for (Enumeration<BPM_Element> e = listModel.elements(); e.hasMoreElements(); ) {
     BPM_Element elm = e.nextElement();
     elm.stopMonitor();
   }
   listModel.removeAllElements();
 }
Example #2
0
  // ------------------------------------------------------------------------
  // SCREEN PAINTER
  // Put some function here to paint whatever you want over the screen before and after
  // all edges and nodes have been painted.
  public void PaintScreenBefore(Graphics g) {

    Dimension d = MainClass.mainFrame.GetGraphDisplayPanel().getSize();
    NodeInfo nodeInfo;
    int x = 0;
    int y = 0;
    int step = 10;

    for (; x < d.width; x += step) {
      for (y = 0; y < d.height; y += step) {
        double val = 0;
        double sum = 0;
        double total = 0;
        double min = 10000000;
        for (Enumeration nodes = proprietaryNodeInfo.elements(); nodes.hasMoreElements(); ) {
          nodeInfo = (NodeInfo) nodes.nextElement();
          double dist = distance(x, y, nodeInfo.centerX, nodeInfo.centerY);
          if (nodeInfo.value != -1 && nodeInfo.nodeNumber.intValue() != 1) { // 121
            if (dist < min) min = dist;
            val += ((double) nodeInfo.value) / dist / dist;
            sum += (1 / dist / dist);
          }
        }
        int reading = (int) (val / sum);
        reading = reading >> 2;
        if (reading > 255) reading = 255;
        g.setColor(new Color(reading, reading, reading));
        g.fillRect(x, y, step, step);
      }
    }
  }
  void drawboard(Graphics g) {
    g.setColor(Color.black);
    g.fillRect(0, 0, getWidth(), getHeight());

    sqw = getWidth() / xdim;
    sqh = getHeight() / ydim;

    // draw background panels
    if (def != null) {
      for (int y = 0; y < ydim; y++) {
        for (int x = 0; x < xdim; x++) def.drawObject(g, x, y, sqw, sqh, this);
      }
    }

    if (USEVEC) {
      // draw each element in the vector
      for (Enumeration e = boardVec.elements(); e.hasMoreElements(); ) {
        boardContainer c = (boardContainer) e.nextElement();
        c.o.drawObject(g, c.d.width, c.d.height, sqw, sqh, this);
      }
    } else {
      // draw from grid
      for (int y = 0; y < ydim; y++) {
        for (int x = 0; x < xdim; x++)
          if (board[x][y] != null) board[x][y].drawObject(g, x, y, sqw, sqh, this);
      }
    }
  }
 private void traverseToLeaves(
     final PackageDependenciesNode treeNode,
     final StringBuffer denyRules,
     final StringBuffer allowRules) {
   final Enumeration enumeration = treeNode.breadthFirstEnumeration();
   while (enumeration.hasMoreElements()) {
     PsiElement childPsiElement =
         ((PackageDependenciesNode) enumeration.nextElement()).getPsiElement();
     if (myIllegalDependencies.containsKey(childPsiElement)) {
       final Map<DependencyRule, Set<PsiFile>> illegalDeps =
           myIllegalDependencies.get(childPsiElement);
       for (final DependencyRule rule : illegalDeps.keySet()) {
         if (rule.isDenyRule()) {
           if (denyRules.indexOf(rule.getDisplayText()) == -1) {
             denyRules.append(rule.getDisplayText());
             denyRules.append("\n");
           }
         } else {
           if (allowRules.indexOf(rule.getDisplayText()) == -1) {
             allowRules.append(rule.getDisplayText());
             allowRules.append("\n");
           }
         }
       }
     }
   }
 }
  public HierarchyBrowserBaseEx(@NotNull Project project, @NotNull PsiElement element) {
    super(project);

    setHierarchyBase(element);

    myCardLayout = new CardLayout();
    myTreePanel = new JPanel(myCardLayout);

    createTrees(myType2TreeMap);

    final HierarchyBrowserManager.State state =
        HierarchyBrowserManager.getInstance(project).getState();
    for (String type : myType2TreeMap.keySet()) {
      myType2ScopeMap.put(type, state.SCOPE != null ? state.SCOPE : SCOPE_ALL);
    }

    final Enumeration<String> keys = myType2TreeMap.keys();
    while (keys.hasMoreElements()) {
      final String key = keys.nextElement();
      final JTree tree = myType2TreeMap.get(key);
      myOccurrenceNavigators.put(
          key,
          new OccurenceNavigatorSupport(tree) {
            @Override
            @Nullable
            protected Navigatable createDescriptorForNode(DefaultMutableTreeNode node) {
              final HierarchyNodeDescriptor descriptor = getDescriptor(node);
              if (descriptor == null) return null;
              PsiElement psiElement = getOpenFileElementFromDescriptor(descriptor);
              if (psiElement == null || !psiElement.isValid()) return null;
              final VirtualFile virtualFile = psiElement.getContainingFile().getVirtualFile();
              if (virtualFile == null) return null;
              return new OpenFileDescriptor(
                  psiElement.getProject(), virtualFile, psiElement.getTextOffset());
            }

            @Override
            public String getNextOccurenceActionName() {
              return getNextOccurenceActionNameImpl();
            }

            @Override
            public String getPreviousOccurenceActionName() {
              return getPrevOccurenceActionNameImpl();
            }
          });
      myTreePanel.add(ScrollPaneFactory.createScrollPane(tree), key);
    }

    final JPanel legendPanel = createLegendPanel();
    final JPanel contentPanel;
    if (legendPanel != null) {
      contentPanel = new JPanel(new BorderLayout());
      contentPanel.add(myTreePanel, BorderLayout.CENTER);
      contentPanel.add(legendPanel, BorderLayout.SOUTH);
    } else {
      contentPanel = myTreePanel;
    }
    buildUi(createToolbar(getActionPlace(), HELP_ID).getComponent(), contentPanel);
  }
Example #6
0
 /**
  * notify listeners of a popup selection
  *
  * @param popStr popup selection string
  */
 void popNotify(String popStr) {
   Enumeration en = popListeners.elements();
   for (; en.hasMoreElements(); ) {
     PopListener listener = (PopListener) en.nextElement();
     listener.popHappened(popStr);
   }
 } // popNotify()
  protected final void loadChildren(DynamicNode node) throws DbException {
    if (node.hasLoaded() || node.isLeaf()) return;
    node.setHasLoaded();
    Object userObject = node.getUserObject();
    if (userObject == ROOT) return;
    SrVector children = new SrVector(10);
    boolean isSorted = true;
    DbObject dbParent = null;
    if (userObject == DB_RAM) {
      Db[] dbs = Db.getDbs();
      for (int i = 0; i < dbs.length; i++) {
        if (dbs[i] instanceof DbRAM) insertProjects(children, dbs[i]);
      }
    } else if (userObject instanceof Db) {
      insertProjects(children, (Db) userObject);
    } else {
      dbParent = (DbObject) userObject;
      dbParent.getDb().beginTrans(Db.READ_TRANS);
      insertComponents(children, dbParent);
      isSorted = childrenAreSorted(dbParent);
      dbParent.getDb().commitTrans();
    }

    if (isSorted) {
      children.sort(getComparator(dbParent));
    }

    ArrayList groupNodeList = new ArrayList();
    DynamicNode groupNode = null;
    Enumeration enumeration = children.elements();
    while (enumeration.hasMoreElements()) {
      DynamicNode childNode = (DynamicNode) enumeration.nextElement();
      GroupParams group = childNode.getGroupParams();
      if (group.name == null) {
        node.add(childNode);
      } else {
        if (groupNode == null) {
          groupNode = createGroupNode(group);
          node.add(groupNode);
          groupNodeList.add(groupNode);
        } else if (!groupNode.toString().equals(group.name)) {
          boolean groupFound = false;
          for (int i = 0; i < groupNodeList.size(); i++) {
            groupNode = (DynamicNode) groupNodeList.get(i);
            if (groupNode.toString().equals(group.name)) {
              groupFound = true;
              break;
            }
          }
          if (!groupFound) {
            groupNode = createGroupNode(group);
            node.add(groupNode);
            groupNodeList.add(groupNode);
          }
        }
        groupNode.add(childNode);
      }
    }
    groupNodeList.clear();
  }
    private void restorePath(ArrayList<Object> newPath, int idx) {
      if (idx >= myPath.length) return;
      InspectionTreeNode oldNode = (InspectionTreeNode) myPath[idx];

      InspectionTreeNode newRoot = (InspectionTreeNode) newPath.get(idx - 1);

      InspectionResultsViewComparator comparator = InspectionResultsViewComparator.getInstance();
      Enumeration children = newRoot.children();
      while (children.hasMoreElements()) {
        InspectionTreeNode child = (InspectionTreeNode) children.nextElement();
        if (comparator.compare(child, oldNode) == 0) {
          newPath.add(child);
          restorePath(newPath, idx + 1);
          return;
        }
      }

      // Exactly same element not found. Trying to select somewhat near.
      int count = newRoot.getChildCount();
      if (count > 0) {
        if (myIndicies[idx] < count) {
          newPath.add(newRoot.getChildAt(myIndicies[idx]));
        } else {
          newPath.add(newRoot.getChildAt(count - 1));
        }
      }
    }
Example #9
0
  public DefaultMutableTreeNode findNode(DefaultMutableTreeNode parent, String match) {
    if (parent == null) return null;
    // Commented by Balan on 15/03/03
    // String treename =  (String)parent.getUserObject ();
    // Comment Ends

    // Added by Balan  on 15/03/03
    String treename = "" + ((Hashtable) parent.getUserObject()).get("TREE-NAME");
    // Add Ends

    if (treename != null) {
      if (treename.equals(match)) return parent;
    }

    if (frame.model.isLeaf(parent)) return null;

    Enumeration en = parent.children();
    if ((en == null) || (!en.hasMoreElements())) return null;
    for (; en.hasMoreElements(); ) {

      DefaultMutableTreeNode child = (DefaultMutableTreeNode) en.nextElement();
      DefaultMutableTreeNode returnNode = findNode(child, match);
      if (returnNode != null) return returnNode;
    }
    return null;
  }
 private void checkNodeValidity(@NotNull DefaultMutableTreeNode node) {
   Enumeration enumeration = node.children();
   while (enumeration.hasMoreElements()) {
     checkNodeValidity((DefaultMutableTreeNode) enumeration.nextElement());
   }
   if (node instanceof Node && node != getModelRoot()) ((Node) node).update(this);
 }
Example #11
0
 private static void expand(JTree tree, TreePath path, int levels) {
   if (levels == 0) return;
   tree.expandPath(path);
   TreeNode node = (TreeNode) path.getLastPathComponent();
   Enumeration children = node.children();
   while (children.hasMoreElements()) {
     expand(tree, path.pathByAddingChild(children.nextElement()), levels - 1);
   }
 }
Example #12
0
 // {{{ traverseNodes() method
 public static boolean traverseNodes(
     DefaultMutableTreeNode node, HyperSearchTreeNodeCallback callbackInterface) {
   if (!callbackInterface.processNode(node)) return false;
   for (Enumeration e = node.children(); e.hasMoreElements(); ) {
     DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) e.nextElement();
     if (!traverseNodes(childNode, callbackInterface)) return false;
   }
   return true;
 } // }}}
 /*
  * Applet is no longer displayed
  */
 public void stop() {
   // Tell all pages to stop talking to the server
   Enumeration e = pages.elements();
   while (e.hasMoreElements()) {
     SOAPMonitorPage pg = (SOAPMonitorPage) e.nextElement();
     if (pg != null) {
       pg.stop();
     }
   }
 }
 private int getChildIndex(InspectionTreeNode node, InspectionTreeNode child) {
   int idx = 0;
   Enumeration children = node.children();
   while (children.hasMoreElements()) {
     InspectionTreeNode ch = (InspectionTreeNode) children.nextElement();
     if (ch == child) break;
     idx++;
   }
   return idx;
 }
Example #15
0
 @Override
 public void actionPerformed(ActionEvent evt) {
   TreePath path = resultTree.getSelectionPath();
   DefaultMutableTreeNode operNode = (DefaultMutableTreeNode) path.getLastPathComponent();
   for (Enumeration e = operNode.children(); e.hasMoreElements(); ) {
     DefaultMutableTreeNode node = (DefaultMutableTreeNode) e.nextElement();
     resultTree.collapsePath(new TreePath(node.getPath()));
   }
   resultTree.scrollPathToVisible(new TreePath(operNode.getPath()));
 }
 private void step() {
   myNext = null;
   while (myEnum.hasMoreElements()) {
     final Object o = myEnum.nextElement();
     if (o instanceof FileTreeNode) {
       myNext = ((FileTreeNode) o).getFilePointer();
       break;
     }
   }
 }
 protected final void updateInsertIndexInChildrenOfNode(DynamicNode parentNode)
     throws DbException {
   Enumeration childrenEnum = parentNode.children();
   while (childrenEnum.hasMoreElements()) {
     DynamicNode node = (DynamicNode) childrenEnum.nextElement();
     DbObject dbo = (DbObject) node.getRealObject();
     DbObject dbParent = dbo.getComposite();
     node.insertIndex = getSequence(dbParent, dbo);
   }
 }
 /**
  * Writes all of the edge comments to the writer to create the comment file and whether a datamap
  * entry is generated or not. Each line represents an entry of the datamap. Each line contains a 1
  * or a 0 that signifies if generates or not and is followed by a comment if there is one.
  */
 public void writeComments(Writer commentWriter) throws IOException {
   // Write out all the edge comments
   Enumeration e = rep.edges();
   while (e.hasMoreElements()) {
     NamedEdge edge = (NamedEdge) e.nextElement();
     if (edge.isGenerated()) {
       commentWriter.write("1 " + edge.getComment() + '\n');
     } else commentWriter.write("0 " + edge.getComment() + '\n');
   }
 }
 @Override
 public JComponent getPreferredFocusedComponent() {
   final Enumeration<AbstractButton> enumeration = myGroup.getElements();
   while (enumeration.hasMoreElements()) {
     final AbstractButton button = enumeration.nextElement();
     if (button.isSelected()) {
       return button;
     }
   }
   return myPanel;
 }
  private static void sortNode(ParentNode node, final Comparator<ElementNode> sortComparator) {
    ArrayList<MemberNode> arrayList = new ArrayList<MemberNode>();
    Enumeration<MemberNode> children = node.children();
    while (children.hasMoreElements()) {
      arrayList.add(children.nextElement());
    }

    Collections.sort(arrayList, sortComparator);

    replaceChildren(node, arrayList);
  }
  private Set<Object> addPaths(Enumeration elements) {
    ArrayList<Object> elementArray = new ArrayList<Object>();
    if (elements != null) {
      while (elements.hasMoreElements()) {
        Object each = elements.nextElement();
        elementArray.add(each);
      }
    }

    return addPaths(elementArray);
  }
 public void save(PrintStream stream) {
   saved = true;
   stream.println("<?xml version=\"1.0\"?>");
   stream.println("<scale>");
   stream.println("  <name>" + nameTF.getText() + "</name>");
   for (Enumeration en = sp.notes.elements(); en.hasMoreElements(); ) {
     ScalePanel.Notik cur = (ScalePanel.Notik) en.nextElement();
     stream.println("  <note>" + cur.n + "</note>");
   }
   stream.println("</scale>");
 }
Example #23
0
 /**
  * Returns the bPM attribute of the BPMsTable object
  *
  * @param name The Parameter
  * @return The bPM value
  */
 public BPM_Element getBPM(String name) {
   BPM_Element bpmElm = null;
   Enumeration<BPM_Element> bpm_enum = listModel.elements();
   while (bpm_enum.hasMoreElements()) {
     BPM_Element bpmElm1 = bpm_enum.nextElement();
     if (bpmElm1.getName().equals(name)) {
       bpmElm = bpmElm1;
     }
   }
   return bpmElm;
 }
Example #24
0
 // Get what the user selects as the answer
 public String getSelection() {
   String selectedChoice = null;
   Enumeration<AbstractButton> buttons = bg.getElements();
   while (buttons.hasMoreElements()) {
     JRadioButton temp = (JRadioButton) buttons.nextElement();
     if (temp.isSelected()) {
       selectedChoice = temp.getText();
     }
   }
   return (selectedChoice);
 }
  protected void doSort() {
    Pair<ElementNode, List<ElementNode>> pair = storeSelection();

    Enumeration<ParentNode> children = getRootNodeChildren();
    while (children.hasMoreElements()) {
      ParentNode classNode = children.nextElement();
      sortNode(classNode, myComparator);
      myTreeModel.nodeStructureChanged(classNode);
    }

    restoreSelection(pair);
  }
  private void createClusterManagerElement() {
    ConfigElementFactory factory = new ConfigElementFactory(mBroker.getRepository().getAllLatest());
    ConfigElement cluster_manager = factory.create("Sample Cluster", "cluster_manager");
    for (Enumeration e = mNodesListModel.elements(); e.hasMoreElements(); ) {
      cluster_manager.addProperty("cluster_node", (String) e.nextElement());
    }

    cluster_manager.addProperty("plugin_path", "${VJ_BASE_DIR}/lib/gadgeteer/plugins/");
    cluster_manager.addProperty("plugin", "RemoteInputManager");
    cluster_manager.addProperty("plugin", "ApplicationDataManager");
    mBroker.add(mContext, cluster_manager);
  }
 private void restoreExpansionStatus(InspectionTreeNode node) {
   if (myExpandedUserObjects.contains(node.getUserObject())) {
     sortChildren(node);
     TreeNode[] pathToNode = node.getPath();
     expandPath(new TreePath(pathToNode));
     Enumeration children = node.children();
     while (children.hasMoreElements()) {
       InspectionTreeNode childNode = (InspectionTreeNode) children.nextElement();
       restoreExpansionStatus(childNode);
     }
   }
 }
Example #28
0
 /**
  * Sets the selected strack trace level on the radio buttons. The radio buttons store their stack
  * trace level as a client property and I'll look for a match using that. This way, we don't have
  * to edit this if new levels are created.
  *
  * @param newStackTraceLevel the new stack trace level.
  */
 private void setSelectedStackTraceLevel(ShowStacktrace newStackTraceLevel) {
   Enumeration<AbstractButton> buttonEnumeration = stackTraceButtonGroup.getElements();
   while (buttonEnumeration.hasMoreElements()) {
     JRadioButton radioButton = (JRadioButton) buttonEnumeration.nextElement();
     ShowStacktrace level =
         (ShowStacktrace) radioButton.getClientProperty(STACK_TRACE_LEVEL_CLIENT_PROPERTY);
     if (newStackTraceLevel == level) {
       radioButton.setSelected(true);
       return;
     }
   }
 }
Example #29
0
 private void save() {
   try {
     Document doc = XmlUtil.getDocument();
     Element root = doc.createElement("profiles");
     doc.appendChild(root);
     Enumeration<String> keys = table.keys();
     while (keys.hasMoreElements()) {
       table.get(keys.nextElement()).appendTo(root);
     }
     FileUtil.setText(new File(filename), FileUtil.utf8, XmlUtil.toString(doc));
   } catch (Exception ignore) {
   }
 }
Example #30
0
  /**
   * List results by date
   *
   * @param reslist result list
   * @param ldisp
   */
  private void listByDateRun(ResultList reslist, boolean ldisp) {
    StringTokenizer tokenizer = new StringTokenizer((String) reslist.get("list"), "\n");

    Vector vdata = new Vector();
    while (tokenizer.hasMoreTokens()) {
      String data = convertToPretty(tokenizer.nextToken());
      if (datasets.contains(data) || ldisp) vdata.add(data);
    }
    datasets.removeAllElements();

    Enumeration en = vdata.elements();
    while (en.hasMoreElements()) datasets.addElement(en.nextElement());
  }