Ejemplo n.º 1
0
  private SimpleTreeNode find(int type) {
    SimpleTreeNode r = (SimpleTreeNode) this.getRoot();
    Enumeration e = r.breadthFirstEnumeration();

    while (e.hasMoreElements()) {
      SimpleTreeNode n = (SimpleTreeNode) e.nextElement();

      if (n.getType() == type) {
        return n;
      }
    }

    return null;
  }
Ejemplo n.º 2
0
  private static void addVariableNodes(
      SimpleTreeNode owner, VariableContext m, Icon icon, int nodetype, int permission) {
    owner.removeAllChildren();

    Iterator it = m.names(nodetype);

    while (it.hasNext()) {
      String element = (String) it.next();

      SimpleTreeNode node =
          createVariableNode(m.getVariable(element), icon, nodetype, permission, element);

      owner.add(node);
    }
  }
Ejemplo n.º 3
0
  /**
   * DOCUMENT ME!
   *
   * @param selected DOCUMENT ME!
   * @param oldKey DOCUMENT ME!
   * @param newKey DOCUMENT ME!
   * @param newVal DOCUMENT ME!
   * @return DOCUMENT ME!
   */
  public boolean replaceVariable(
      SimpleTreeNode selected, String oldKey, String newKey, Object newVal) {
    vm.replaceVariable(oldKey, newKey, newVal);

    Variable var = (Variable) selected.getUserObject();
    var.setVariable(newVal);
    var.setDisplayName(newKey);
    var.setVariableName(newKey);

    return true;
  }
Ejemplo n.º 4
0
  private static SimpleTreeNode asTree1(VariableContext context) {
    SimpleTreeNode rootNode =
        new SimpleTreeNode(new Variable(App.messages.getString("res.205"), 0), variableIcon);

    SimpleTreeNode catagory =
        new SimpleTreeNode(
            new Variable(App.messages.getString("res.206"), INSERTABLE),
            parameterIcon,
            VariableTree.PARAMETER_CATAGORY);

    addVariableNodes(
        catagory,
        context,
        parameterIcon,
        VariableContext.PARAMETER,
        REMOVABLE | EDITABLE | SETTABLE);

    rootNode.add(catagory);
    catagory =
        new SimpleTreeNode(
            new Variable(App.messages.getString("res.207"), INSERTABLE),
            formulaIcon,
            VariableTree.FORMULA_CATAGORY);

    addVariableNodes(
        catagory, context, formulaIcon, VariableContext.FORMULA, REMOVABLE | EDITABLE | SETTABLE);

    rootNode.add(catagory);

    commandNode =
        new SimpleTreeNode(
            new Variable(App.messages.getString("res.208"), INSERTABLE),
            commandIcon,
            VariableTree.COMMAND_CATAGORY);

    addVariableNodes(
        commandNode,
        context,
        commandIcon,
        VariableContext.COMMAND,
        REMOVABLE | EDITABLE | SETTABLE);

    rootNode.add(commandNode);

    catagory =
        new SimpleTreeNode(
            new Variable(App.messages.getString("res.209"), 0),
            componentIcon,
            VariableTree.COMPONENT_CATAGORY);

    addVariableNodes(catagory, context, componentIcon, VariableContext.COMPONENT, SETTABLE);
    rootNode.add(catagory);

    SimpleTreeNode sytemCatagory =
        new SimpleTreeNode(
            new Variable(App.messages.getString("res.210"), 0), sysIcon, SYSTEM_CATAGORY);
    String[] vars = VariableContext.getSystemVariables();

    for (int i = 0; i < vars.length; i++) {
      sytemCatagory.add(
          new SimpleTreeNode(
              new Variable(vars[i], SETTABLE, vars[i]), sysIcon, VariableContext.SYSTEM0));
    }

    rootNode.add(sytemCatagory);

    return rootNode;
  }