Ejemplo n.º 1
0
  /**
   * Construct the array of icons that displays the path
   *
   * @param path
   */
  private ArrayList<Positionable> makePathGroup(OPath path) {
    Portal fromPortal = path.getFromPortal();
    Portal toPortal = path.getToPortal();
    String name = path.getName();

    java.util.List<Positionable> list = _parent.getCircuitGroup();
    if (log.isDebugEnabled()) {
      log.debug("makePathGroup for " + name + " CircuitGroup size= " + list.size());
    }
    ArrayList<Positionable> pathGroup = new ArrayList<Positionable>();
    for (int i = 0; i < list.size(); i++) {
      Positionable pos = list.get(i);
      if (pos instanceof IndicatorTrack) {
        ArrayList<String> paths = ((IndicatorTrack) pos).getPaths();
        if (paths != null) {
          for (int j = 0; j < paths.size(); j++) {
            if (name.equals(paths.get(j))) {
              ((IndicatorTrack) pos).setControlling(true);
              pathGroup.add(pos);
            }
          }
        }
      } else {
        PortalIcon icon = (PortalIcon) pos;
        Portal portal = icon.getPortal();
        if (portal.equals(fromPortal)) {
          pathGroup.add(icon);
        } else if (portal.equals(toPortal)) {
          pathGroup.add(icon);
        }
      }
    }
    return pathGroup;
  }
Ejemplo n.º 2
0
 private void changePathNameInIcons(String name, OPath path) {
   // add or remove path name from IndicatorTrack icons
   Iterator<Positionable> iter = _parent.getCircuitGroup().iterator();
   while (iter.hasNext()) {
     Positionable pos = iter.next();
     if (_pathGroup.contains(pos)) {
       if (pos instanceof IndicatorTrack) {
         ((IndicatorTrack) pos).addPath(name);
       }
     } else {
       if (pos instanceof IndicatorTrack) {
         ((IndicatorTrack) pos).removePath(name);
       } else {
         PortalIcon pi = (PortalIcon) pos;
         //                   pi.setStatus(PortalIcon.VISIBLE);
         Portal p = pi.getPortal();
         p.removePath(path);
       }
     }
   }
 }
Ejemplo n.º 3
0
 private void clearPath() {
   for (int i = 0; i < _pathGroup.size(); i++) {
     Positionable pos = _pathGroup.get(i);
     if (pos instanceof PortalIcon) {
       ((PortalIcon) pos).setStatus(PortalIcon.VISIBLE);
     } else {
       ((IndicatorTrack) pos).removePath(TEST_PATH);
     }
   }
   int state = _block.getState() & ~OBlock.ALLOCATED;
   _pathGroup = new ArrayList<Positionable>();
   _block.pseudoPropertyChange("state", Integer.valueOf(0), Integer.valueOf(state));
 }
Ejemplo n.º 4
0
 /**
  * Sets the path icons for display
  *
  * @param pathChanged
  */
 protected void updatePath(boolean pathChanged) {
   // to avoid ConcurrentModificationException now set data
   Iterator<Positionable> iter = _pathGroup.iterator();
   while (iter.hasNext()) {
     Positionable pos = iter.next();
     if (pos instanceof IndicatorTrack) {
       ((IndicatorTrack) pos).addPath(TEST_PATH);
     } else {
       ((PortalIcon) pos).setStatus(PortalIcon.PATH);
     }
   }
   _pathChange = pathChanged;
   String name = _pathName.getText();
   if (name == null || name.length() == 0) {
     JOptionPane.showMessageDialog(
         this,
         Bundle.getMessage("needPathName"),
         Bundle.getMessage("makePath"),
         JOptionPane.INFORMATION_MESSAGE);
   } else {
   }
 }