예제 #1
0
  /** The finite branch points of the curve */
  public Set<Point2D> getFiniteBranches() {
    if (this.branches == null) return new HashSet<Point2D>();

    Set<Point2D> branches = new HashSet<Point2D>(this.branches);
    branches.remove(INFINITY);
    return branches;
  }
예제 #2
0
 {
   for (myjava.gui.syntax.Painter painter : myjava.gui.syntax.Painter.getPainters()) {
     painterComboBox.addItem(painter);
     EntryListPanel panel = new EntryListPanel(painter);
     listPanelSet.add(panel);
     centerPanel.add(panel, painter.getName());
   }
   componentSet.addAll(Arrays.asList(matchBracket, painterComboBox, centerPanel));
 }
예제 #3
0
 public void resetListOfExpandedNodes() {
   expandedNodes.clear();
   for (int i = 1; i < getTree().getRowCount(); i++) {
     if (getTree().isExpanded(i)) {
       Object o = getTree().getPathForRow(i).getLastPathComponent();
       if (o instanceof Config) {
         expandedNodes.add(o);
       }
     }
   }
 }
예제 #4
0
 private void addPainter(myjava.gui.syntax.Painter painter) {
   EntryListPanel newPanel = new EntryListPanel(painter);
   listPanelSet.add(newPanel);
   centerPanel.add(newPanel, painter.getName());
   painterComboBox.removeItemListener(painterChangeListener);
   painterComboBox.removeAllItems();
   for (EntryListPanel p : listPanelSet) {
     painterComboBox.addItem(p.getPainter());
   }
   removedPainters.remove(painter);
   painterComboBox.addItemListener(painterChangeListener);
 }
예제 #5
0
  /**
   * Load the volume data to the display
   *
   * @throws RemoteException problem loading remote data
   * @throws VisADException problem loading the data
   */
  private void loadVolumeData() throws VisADException, RemoteException {
    Trace.call1("VRC.loadVolumeData");
    FieldImpl grid = getGridDataInstance().getGrid();
    FieldImpl newGrid = grid;

    if (getSkipValue() > 0) {
      grid = GridUtil.subset(grid, getSkipValue() + 1);
      newGrid = grid;
    }

    if (!usePoints) {
      // make sure the projection is correct before we start
      // transforming the data
      setProjectionInView(true, true);

      CoordinateSystem cs = getNavigatedDisplay().getDisplayCoordinateSystem();
      if ((cs != null) && (getNavigatedDisplay() instanceof MapProjectionDisplay)) {
        try {
          if (GridUtil.isConstantSpatialDomain(grid)) {
            newGrid = makeLinearGrid(grid, cs);
          } else {
            Set timeSet = GridUtil.getTimeSet(grid);
            for (int i = 0; i < timeSet.getLength(); i++) {
              FieldImpl timeField = makeLinearGrid((FieldImpl) grid.getSample(i, false), cs);
              if (i == 0) {
                FunctionType ft =
                    new FunctionType(
                        ((SetType) timeSet.getType()).getDomain(), timeField.getType());
                newGrid = new FieldImpl(ft, timeSet);
              }
              newGrid.setSample(i, timeField, false);
            }
          }
        } catch (VisADException ve) {
          ve.printStackTrace();
          userErrorMessage(
              "Can't render volume for "
                  + paramName
                  + " in this projection. Try using the data projection");
          newGrid = grid;
        }
      }
    }
    Trace.call1("VRC.loadVolumeData.loadData");
    myDisplay.loadData(newGrid);
    Trace.call2("VRC.loadVolumeData.loadData");
    Trace.call2("loadVolumeData");
  }
 WordListModel(ASDGrammar grammar) {
   Set entrySet = grammar.lexicon().entrySet();
   ArrayList words = new ArrayList(entrySet.size());
   for (Iterator it = entrySet.iterator(); it.hasNext(); ) {
     Map.Entry e = (Map.Entry) it.next();
     String word = (String) e.getKey();
     words.add(word);
   }
   Object[] wordArray = words.toArray();
   if (words.size() > 1)
     //       Arrays.sort(wordArray);
     Arrays.sort(wordArray, new WordComparator());
   for (int j = 0; j < wordArray.length; j++) {
     this.addElement((String) wordArray[j]);
   }
 }
예제 #7
0
  /**
   * Goal-driven recursive (depth-first, exhaustive) search with backtracking
   *
   * @param problem
   * @param algorithm
   * @param subtaskRelsInPath
   * @param depth
   */
  private boolean subtaskPlanningImpl(
      PlanningContext context,
      Set<Rel> relsWithSubtasks,
      EvaluationAlgorithm algorithm,
      LinkedList<Rel> subtaskRelsInPath,
      int depth) {

    Set<Rel> relsWithSubtasksCopy = new LinkedHashSet<Rel>(relsWithSubtasks);

    Set<Rel> relsWithSubtasksToRemove = new LinkedHashSet<Rel>();

    boolean firstMLB = true;

    // start building Maximal Linear Branch (MLB)
    MLB:
    while (!relsWithSubtasksCopy.isEmpty()) {

      if (isSubtaskLoggingOn()) {
        String print = p(depth) + "Starting new MLB with: ";
        for (Rel rel : relsWithSubtasksCopy) {
          print +=
              "\n" + p(depth) + "  " + rel.getParent().getFullName() + " : " + rel.getDeclaration();
        }
        /*
        print += "\n" + p( depth ) + " All remaining rels in problem:";
        for ( Rel rel : problem.getAllRels() ) {
            print += "\n" + p( depth ) + " " + rel.getParentObjectName() + " : " + rel.getDeclaration();
        }
        print += "\n" + p( depth ) + "All found variables: ";
        for ( Var var : problem.getFoundVars() ) {
            print += "\n" + p( depth ) + " " + var.toString();
        }
        */
        logger.debug(print);
      }

      // if this is a first attempt to construct an MLB to solve a subtask(i.e. depth>0),
      // do not invoke linear planning because it has already been done
      if ((depth == 0) || !firstMLB) {

        boolean solvedIntermediately = linearForwardSearch(context, algorithm, true);

        // Having constructed some MLBs the (sub)problem may be solved
        // and there is no need in wasting precious time planning unnecessary branches
        if (solvedIntermediately
            && ( // on the top level optimize only if computing goals
            (depth == 0 && !computeAll)
                // otherwise (inside subtasks) always optimize
                || (depth != 0))) {
          // If the problem is solved, optimize and return
          if (!isOptDisabled) Optimizer.optimize(context, algorithm);
          return true;
        }
      } else {
        firstMLB = false;
      }

      // or children
      OR:
      for (Iterator<Rel> subtaskRelIterator = relsWithSubtasksCopy.iterator();
          subtaskRelIterator.hasNext(); ) {

        Rel subtaskRel = subtaskRelIterator.next();

        if (isSubtaskLoggingOn())
          logger.debug(
              p(depth)
                  + "OR: depth: "
                  + (depth + 1)
                  + " rel - "
                  + subtaskRel.getParent().getFullName()
                  + " : "
                  + subtaskRel.getDeclaration());

        if (subtaskRel.equals(subtaskRelsInPath.peekLast())
            || (!context.isRelReadyToUse(subtaskRel))
            || context.getFoundVars().containsAll(subtaskRel.getOutputs())
            || (!isSubtaskRepetitionAllowed && subtaskRelsInPath.contains(subtaskRel))) {

          if (isSubtaskLoggingOn()) {
            logger.debug(p(depth) + "skipped");
            if (!context.isRelReadyToUse(subtaskRel)) {
              logger.debug(p(depth) + "because it has unknown inputs"); // TODO print unknown
            } else if (context.getFoundVars().containsAll(subtaskRel.getOutputs())) {
              logger.debug(p(depth) + "because all outputs in FoundVars");
            } else if (subtaskRel.equals(subtaskRelsInPath.peekLast())) {
              logger.debug(p(depth) + "because it is nested in itself");
            } else if (!isSubtaskRepetitionAllowed && subtaskRelsInPath.contains(subtaskRel)) {
              logger.debug(
                  p(depth)
                      + "This rel with subtasks is already in use, path: "
                      + subtaskRelsInPath);
            }
          }
          continue OR;
        }

        LinkedList<Rel> newPath = new LinkedList<Rel>(subtaskRelsInPath);
        newPath.add(subtaskRel);

        PlanningResult result = new PlanningResult(subtaskRel, true);

        // this is true if all subtasks are solvable
        boolean allSolved = true;
        // and children
        AND:
        for (SubtaskRel subtask : subtaskRel.getSubtasks()) {
          if (isSubtaskLoggingOn()) logger.debug(p(depth) + "AND: subtask - " + subtask);

          EvaluationAlgorithm sbtAlgorithm = null;

          ////////////////////// INDEPENDENT SUBTASK////////////////////////////////////////
          if (subtask.isIndependent()) {
            if (isSubtaskLoggingOn()) logger.debug("Independent!!!");

            if (subtask.isSolvable() == null) {
              if (isSubtaskLoggingOn())
                logger.debug("Start solving independent subtask " + subtask.getDeclaration());
              // independent subtask is solved only once
              Problem problemContext = subtask.getContext();
              DepthFirstPlanner planner = new DepthFirstPlanner();
              planner.indSubtasks = indSubtasks;
              planner.nested = true;
              sbtAlgorithm = planner.invokePlaning(problemContext, isOptDisabled);
              PlanningContext indCntx = problemContext.getCurrentContext();
              boolean solved = indCntx.getFoundVars().containsAll(indCntx.getAllGoals());
              if (solved) {
                subtask.setSolvable(Boolean.TRUE);
                indSubtasks.put(subtask, sbtAlgorithm);
                if (isSubtaskLoggingOn()) logger.debug("Solved " + subtask.getDeclaration());
              } else {
                subtask.setSolvable(Boolean.FALSE);
                if (RuntimeProperties.isLogInfoEnabled()) {
                  logger.debug("Unable to solve " + subtask.getDeclaration());
                }
              }
              allSolved &= solved;
            } else if (subtask.isSolvable() == Boolean.TRUE) {
              if (isSubtaskLoggingOn()) logger.debug("Already solved");
              allSolved &= true;
              sbtAlgorithm = indSubtasks.get(subtask);
            } else {
              if (isSubtaskLoggingOn()) logger.debug("Not solvable");
              allSolved &= false;
            }
            if (isSubtaskLoggingOn()) logger.debug("End of independent subtask " + subtask);

            if (!allSolved) {
              continue OR;
            }

            assert sbtAlgorithm != null;

            result.addSubtaskAlgorithm(subtask, sbtAlgorithm);
          }
          ////////////////////// DEPENDENT SUBTASK//////////////////////////////////////
          else {
            // lets clone the environment
            PlanningContext newContext = prepareNewContext(context, subtask);

            sbtAlgorithm = new EvaluationAlgorithm();

            // during linear planning, if some goals are found, they are removed from the set
            // "goals"
            boolean solved =
                linearForwardSearch(
                    newContext,
                    sbtAlgorithm,
                    // do not optimize here, because the solution may require additional rels with
                    // subtasks
                    true);

            if (solved) {
              if (isSubtaskLoggingOn()) logger.debug(p(depth) + "SOLVED subtask: " + subtask);

              if (!isOptDisabled) {
                // if a subtask has been solved, optimize its algorithm
                Optimizer.optimize(newContext, sbtAlgorithm);
              }

              result.addSubtaskAlgorithm(subtask, sbtAlgorithm);
              allSolved &= solved;
              continue AND;
            } else if (!solved && (depth == maxDepth)) {
              if (isSubtaskLoggingOn())
                logger.debug(p(depth) + "NOT SOLVED and cannot go any deeper, subtask: " + subtask);
              continue OR;
            }

            if (isSubtaskLoggingOn()) logger.debug(p(depth) + "Recursing deeper");

            solved =
                subtaskPlanningImpl(newContext, relsWithSubtasks, sbtAlgorithm, newPath, depth + 1);

            if (isSubtaskLoggingOn()) logger.debug(p(depth) + "Back to depth " + (depth + 1));

            // the linear planning has been performed at the end of MLB on the depth+1,
            // if the problem was solved, there is no need to run linear planning again
            if ((solved || (solved = linearForwardSearch(newContext, sbtAlgorithm, true)))
                && !isOptDisabled) {
              // if solved, optimize here with full list of goals in order to get rid of
              // unnecessary subtask instances and other relations
              Optimizer.optimize(newContext, sbtAlgorithm);
            }

            if (isSubtaskLoggingOn())
              logger.debug(p(depth) + (solved ? "" : "NOT") + " SOLVED subtask: " + subtask);

            allSolved &= solved;

            // if at least one subtask is not solvable, try another
            // branch
            if (!allSolved) {
              continue OR;
            }

            result.addSubtaskAlgorithm(subtask, sbtAlgorithm);
          }
        } // AND

        if (allSolved) {
          algorithm.add(result);

          Set<Var> newVars = new LinkedHashSet<Var>();

          unfoldVarsToSet(subtaskRel.getOutputs(), newVars);

          context.getKnownVars().addAll(newVars);
          context.getFoundVars().addAll(newVars);

          subtaskRelIterator.remove();

          if (isSubtaskLoggingOn()) {
            logger.debug(
                p(depth)
                    + "SOLVED ALL SUBTASKS for "
                    + subtaskRel.getParent().getFullName()
                    + " : "
                    + subtaskRel.getDeclaration());
            logger.debug(p(depth) + "Updating the problem graph and continuing building new MLB");
          }

          // this is used for incremental dfs
          if (depth == 0) {
            relsWithSubtasksToRemove.add(subtaskRel);
          }

          continue MLB;
        }
        if (isSubtaskLoggingOn())
          logger.debug(
              p(depth)
                  + "NOT SOLVED ALL subtasks, removing from path "
                  + subtaskRel.getParent().getFullName()
                  + " : "
                  + subtaskRel.getDeclaration());
        newPath.remove(subtaskRel);
      } // end OR

      // exit loop because there are no more rels with subtasks to be
      // applied
      // (i.e. no more rels can introduce new variables into the
      // algorithm)
      if (isSubtaskLoggingOn()) logger.debug(p(depth) + "No more MLB can be constructed");
      break MLB;
    }

    // incremental dfs, remove solved subtasks
    if (depth == 0) {
      relsWithSubtasks.removeAll(relsWithSubtasksToRemove);
    }

    return false;
  }
예제 #8
0
  /**
   * Linear forward search algorithm
   *
   * @param p
   * @param algorithm
   * @param targetVars
   * @param _computeAll
   * @return
   */
  private boolean linearForwardSearch(
      PlanningContext context, EvaluationAlgorithm algorithm, boolean _computeAll) {

    /*
     * while iterating through hashset, items cant be removed from/added to
     * that set. Theyre collected into these sets and added/removedall
     * together after iteration is finished
     */
    Set<Var> newVars = new LinkedHashSet<Var>();
    Set<Var> relOutputs = new LinkedHashSet<Var>();
    Set<Var> removableVars = new LinkedHashSet<Var>();

    boolean changed = true;

    if (isLinearLoggingOn())
      logger.debug(
          "------Starting linear planning with (sub)goals: "
              + context.getRemainingGoals()
              + "--------");

    if (isLinearLoggingOn()) logger.debug("Algorithm " + algorithm);

    int counter = 1;

    while ((!_computeAll && changed && !context.getRemainingGoals().isEmpty())
        || (changed && _computeAll)) {

      if (isLinearLoggingOn()) logger.debug("----Iteration " + counter + " ----");

      counter++;
      changed = false;

      // iterate through all knownvars
      if (isLinearLoggingOn()) logger.debug("Known:" + context.getKnownVars());

      for (Var var : context.getKnownVars()) {

        if (isLinearLoggingOn()) logger.debug("Current Known: " + var);

        // Check the relations of all components
        for (Rel rel : var.getRels()) {
          if (isLinearLoggingOn()) logger.debug("And its rel: " + rel);
          if (context.isAvailableRel(rel)) {
            context.removeUnknownInput(rel, var);

            if (isLinearLoggingOn()) logger.debug("problem contains it " + rel);

            removableVars.add(var);

            if (context.isRelReadyToUse(rel) && rel.getType() != RelType.TYPE_METHOD_WITH_SUBTASK) {

              if (isLinearLoggingOn()) logger.debug("rel is ready to be used " + rel);

              boolean relIsNeeded = false;

              if (isLinearLoggingOn()) logger.debug("its outputs " + rel.getOutputs());

              for (Var relVar : rel.getOutputs()) {

                if (!context.getFoundVars().contains(relVar)) {
                  relIsNeeded = true;
                }
              }

              if (rel.getOutputs().isEmpty()) {
                relIsNeeded = true;
              }
              if (isLinearLoggingOn()) logger.debug("relIsNeeded " + relIsNeeded);

              if (relIsNeeded) {

                if (isLinearLoggingOn()) logger.debug("needed rel:  " + rel);

                if (!rel.getOutputs().isEmpty()) {
                  relOutputs.clear();
                  unfoldVarsToSet(rel.getOutputs(), relOutputs);
                  newVars.addAll(relOutputs);
                  context.getFoundVars().addAll(relOutputs);
                }
                algorithm.addRel(rel);
                if (isLinearLoggingOn()) logger.debug("algorithm " + algorithm);
              }

              context.removeRel(rel);
              changed = true;
            }
          }
        }
      }

      // remove targets if they have already been found
      for (Iterator<Var> targetIter = context.getRemainingGoals().iterator();
          targetIter.hasNext(); ) {
        Var targetVar = targetIter.next();
        if (context.getFoundVars().contains(targetVar)) {
          targetIter.remove();
        }
      }

      if (isLinearLoggingOn()) logger.debug("foundvars " + context.getFoundVars());

      context.getKnownVars().addAll(newVars);
      context.getKnownVars().removeAll(removableVars);
      newVars.clear();
    }
    if (isLinearLoggingOn()) logger.debug("algorithm " + algorithm);

    if (!_computeAll) {
      Optimizer.optimize(context, algorithm);

      if (isLinearLoggingOn()) logger.debug("optimized algorithm " + algorithm);
    }

    if (isLinearLoggingOn()) logger.debug("\n---!!!Finished linear planning!!!---\n");

    return context.getRemainingGoals().isEmpty()
        || context.getFoundVars().containsAll(context.getAllGoals());
  }
예제 #9
0
 /**
  * Call when an expanded node has gone missing
  *
  * @param c The config that is gone
  */
 void nodeRemoved(Config c) {
   expandedNodes.remove(c);
 }
 @Override
 public boolean isAlwaysLeaf(Object element) {
   //noinspection SuspiciousMethodCalls
   return myLeaves.contains(element);
 }
 public static void removeChangeListener(ChangeListener cl) {
   if (changeListeners.contains(cl)) {
     changeListeners.remove(cl);
   }
 }
 public static void addChangeListener(ChangeListener cl) {
   changeListeners.add(cl);
 }
  public boolean execute() {
    if (CDState.getCycle() % period != 0) return false;

    MycoCast mycocast = (MycoCast) Network.get(0).getProtocol(mycocastPid);

    int bio = mycocast.countBiomass();
    int ext = mycocast.countExtending();
    int bra = mycocast.countBranching();
    int imm = mycocast.countImmobile();

    // Update vertices
    Set<MycoNode> activeNodes = new HashSet<MycoNode>();
    for (int i = 0; i < Network.size(); i++) {
      MycoNode n = (MycoNode) Network.get(i);
      activeNodes.add(n);
      HyphaData data = n.getHyphaData();
      // if (data.isBiomass()) { continue; }
      if (graph.containsVertex(n)) {
        graph.removeVertex(n);
      }
      if (!graph.containsVertex(n)) {
        graph.addVertex(n);
      }
    }
    Set<MycoNode> jungNodes = new HashSet<MycoNode>(graph.getVertices());
    jungNodes.removeAll(activeNodes);

    for (MycoNode n : jungNodes) {
      graph.removeVertex(n);
    }

    // Update edges
    for (int i = 0; i < Network.size(); i++) {
      MycoNode n = (MycoNode) Network.get(i);
      HyphaData data = n.getHyphaData();
      HyphaLink link = n.getHyphaLink();

      synchronized (graph) {

        // We now add in all links and tune out display in Visualizer
        java.util.List<MycoNode> neighbors = (java.util.List<MycoNode>) link.getNeighbors();

        //// Adding only links to hypha thins out links to biomass
        //    (java.util.List<MycoNode>) link.getHyphae();

        Collection<MycoNode> jungNeighbors = graph.getNeighbors(n);

        // Remove edges from Jung graph that are not in peersim graph
        for (MycoNode o : jungNeighbors) {
          if (!neighbors.contains(o)) {
            MycoEdge edge = graph.findEdge(n, o);
            while (edge != null) {
              graph.removeEdge(edge);
              edge = graph.findEdge(n, o);
            }
          }
        }

        // Add missing edges to Jung graph that are in peersim graph
        for (MycoNode o : neighbors) {
          if (graph.findEdge(n, o) == null) {
            MycoEdge edge = new MycoEdge();
            graph.addEdge(edge, n, o, EdgeType.DIRECTED);
          }
        }
      }

      // log.finest("VERTICES: " + graph.getVertices());
      // log.finest("EDGES: " + graph.getEdges());
    }

    for (ChangeListener cl : changeListeners) {
      cl.stateChanged(new ChangeEvent(graph));
    }
    if (walking) {
      try {
        Thread.sleep(walkDelay);
      } catch (InterruptedException e) {
      }
      stepBlocked = false;
    }

    try {
      while (stepBlocked && !noBlock) {
        synchronized (JungGraphObserver.class) {
          JungGraphObserver.class.wait();
        }
      }
    } catch (InterruptedException e) {
      stepBlocked = true;
    }
    stepBlocked = true;
    // System.out.println(graph.toString());
    return false;
  }
 public void removeLeaf(NodeElement element) {
   myLeaves.remove(element);
 }
 public void addLeaf(NodeElement element) {
   myLeaves.add(element);
 }
예제 #16
0
  public SyntaxTab() {
    super(new BorderLayout(), "Syntax highlighting");
    /*
     * upper checkboxes
     */
    JPanel upper = new JPanel(new GridLayout(2, 1, 0, 0));
    upper.setOpaque(false);
    upper.add(MyPanel.wrap(highlightSyntax));
    upper.add(MyPanel.wrap(matchBracket));
    highlightSyntax.addActionListener(
        new ActionListener() {
          @Override
          public void actionPerformed(ActionEvent ev) {
            SyntaxTab.this.updateComponentStatus();
          }
        });
    this.add(upper, BorderLayout.PAGE_START);
    /*
     * upper panel (painters)
     */
    painterComboBox.setSelectedItem(myjava.gui.syntax.Painter.getCurrentInstance());
    painterComboBox.setFont(f13);
    if (isMetal) painterComboBox.setBackground(Color.WHITE);
    painterComboBox.addItemListener(this.painterChangeListener);
    JButton addPainter =
        new MyButton("+") {
          {
            if (isMetal) {
              this.setPreferredSize(new Dimension(28, 28));
            }
          }

          @Override
          public void actionPerformed(ActionEvent ev) {
            String name;
            do {
              name =
                  JOptionPane.showInputDialog(
                      SyntaxTab.this, "Enter a name:", "Name", JOptionPane.QUESTION_MESSAGE);
            } while (!myjava.gui.syntax.Painter.isValidPrompt(name, SyntaxTab.this));
            if ((name != null) && (!name.isEmpty())) {
              // name is valid, neither cancelled nor pressed enter directly
              myjava.gui.syntax.Painter newPainter =
                  ((myjava.gui.syntax.Painter) (painterComboBox.getSelectedItem()))
                      .newInstance(name);
              addPainter(newPainter);
              System.out.println("now set, should call listener");
              painterComboBox.setSelectedItem(newPainter); // auto-call ItemListener(s)
            }
          }
        };
    JButton removePainter =
        new MyButton("-") {
          {
            if (isMetal) {
              this.setPreferredSize(new Dimension(28, 28));
            }
          }

          @Override
          public void actionPerformed(ActionEvent ev) {
            myjava.gui.syntax.Painter painter =
                (myjava.gui.syntax.Painter) (painterComboBox.getSelectedItem());
            if (painter.equals(myjava.gui.syntax.Painter.getDefaultInstance())) {
              JOptionPane.showMessageDialog(
                  SyntaxTab.this,
                  "The default painter cannot be removed.",
                  "Error",
                  JOptionPane.ERROR_MESSAGE);
            } else {
              int option =
                  JOptionPane.showConfirmDialog(
                      SyntaxTab.this,
                      "Remove painter \"" + painter.getName() + "\"?",
                      "Confirm",
                      JOptionPane.YES_NO_OPTION);
              if (option == JOptionPane.YES_OPTION) {
                // remove "painter"
                removedPainters.add(painter);
                painterComboBox.removeItemListener(painterChangeListener);
                painterComboBox.setSelectedItem(myjava.gui.syntax.Painter.getDefaultInstance());
                painterComboBox.removeItem(painter);
                for (Iterator<EntryListPanel> it = listPanelSet.iterator(); it.hasNext(); ) {
                  EntryListPanel panel = it.next();
                  if (panel.getPainter().getName().equals(painter.getName())) {
                    System.out.println("removing, then break");
                    it.remove();
                    centerPanel.remove(panel);
                    break;
                  }
                }
                painterComboBox.addItemListener(painterChangeListener);
                cardLayout.show(
                    centerPanel, myjava.gui.syntax.Painter.getDefaultInstance().getName());
              }
            }
          }
        };
    // lower part
    JPanel center = new JPanel(new BorderLayout());
    JLabel selectLabel = new MyLabel("Selected painter:");
    center.add(
        MyPanel.wrap(MyPanel.CENTER, selectLabel, painterComboBox, addPainter, removePainter),
        BorderLayout.PAGE_START);
    componentSet.addAll(Arrays.asList(selectLabel, addPainter, removePainter));
    center.add(centerPanel, BorderLayout.CENTER);
    this.add(center, BorderLayout.CENTER);
    cardLayout.show(centerPanel, myjava.gui.syntax.Painter.getCurrentInstance().getName());
  }
예제 #17
0
 Iterator getExpandedNodes() {
   return expandedNodes.iterator();
 }
예제 #18
0
 Config[] getCopyOfExpandedNodes() {
   return (Config[]) expandedNodes.toArray(new Config[0]);
 }
 public void reInitRoot(Node root) {
   myRoot = root;
   myElement2Node.clear();
   myLeaves.clear();
   myElement2Node.put(root.myElement, root);
 }