Package jmt.gui.jmodel.JGraphMod

Examples of jmt.gui.jmodel.JGraphMod.JmtEdge


      Map<Object, Map> viewMap = new Hashtable<Object, Map>();
      // ---- Adds connection into underlayng data structure -- BERTOLI
      // MARCO
      Object sourceKey = ((CellComponent) ((JmtCell) ((OutputPort) (outPort.getCell())).getUserObject()).getUserObject()).getKey();
      Object targetKey = ((CellComponent) ((JmtCell) ((InputPort) (inPort.getCell())).getUserObject()).getUserObject()).getKey();
      JmtEdge connection = new JmtEdge(sourceKey, targetKey, this);
      viewMap.put(connection, map);
      Object[] insert = new Object[] { connection };
      ConnectionSet cs = new ConnectionSet();
      cs.connect(connection, outPort.getCell(), true);
      cs.connect(connection, inPort.getCell(), false);
View Full Code Here


    GraphConstants.setRouting(map, GraphConstants.ROUTING_SIMPLE);
    GraphConstants.setRouting(map, JmtGraphConstants.ROUTING_JMT);
    GraphConstants.setLineEnd(map, GraphConstants.ARROW_CLASSIC);
    GraphConstants.setEndFill(map, true);
    Map<Object, Map> viewMap = new Hashtable<Object, Map>();
    JmtEdge connection = new JmtEdge(sourceKey, targetKey, this);
    viewMap.put(connection, map);
    Object[] insert = new Object[] { connection };
    ConnectionSet cs = new ConnectionSet();
    // Finds sourcePort
    Iterator it;
View Full Code Here

    // Removes cells from data structure
    for (Object cell : cells) {
      if (cell instanceof JmtCell) {
        model.deleteStation(((CellComponent) ((JmtCell) cell).getUserObject()).getKey());
      } else if (cell instanceof JmtEdge) {
        JmtEdge link = (JmtEdge) cell;
        model.setConnected(link.getSourceKey(), link.getTargetKey(), false);
      }
    }

    // If no stations remains gray select and link buttons
    if (graph.getModel().getRootCount() == 0) {
View Full Code Here

    JmodelStationDefinition sd = mediator.getStationDefinition();
    JGraph graph = mediator.getGraph();
    Object cells[] = graph.getDescendants(graph.getSelectionCells());
    // Temp variables
    Object key; // Station key
    JmtEdge edgetmp;
    JmtCell celltmp;
    Point2D location; // position of a station
    // Saves into data structure selected stations (including position) and links
    for (Object cell : cells) {
      if (cell instanceof JmtCell) {
        celltmp = (JmtCell) cell;
        key = ((CellComponent) celltmp.getUserObject()).getKey();
        stations.put(key, sd.serializeStation(key));
        location = mediator.getCellCoordinates(celltmp);
        stationpositions.put(key, location);
        // Initialize 'zero' as the upper-leftmost point of selected stations
        // Will be used as a bias while pasting
        if (zero == null) {
          zero = location;
        }
        if (zero.getX() > location.getX()) {
          zero = new Point2D.Double(location.getX(), zero.getY());
        }
        if (zero.getY() > location.getY()) {
          zero = new Point2D.Double(zero.getX(), location.getY());
        }
      } else if (cell instanceof JmtEdge) {
        edgetmp = (JmtEdge) cell;
        links.add(new Connection(edgetmp.getSourceKey(), edgetmp.getTargetKey()));
      }
    }
  }
View Full Code Here

    HashMap<Object, Object> tempkey = new HashMap<Object, Object>(); // Used as a translator from old key to new one to paste correct links
    HashMap<Object, JmtCell> newstations = new HashMap<Object, JmtCell>(); // Used to store newly created stations
    Vector<DefaultGraphCell> select = new Vector<DefaultGraphCell>(); // Elements to be selected after paste
    // Temp variables
    JmtCell newcell; //New created cell
    JmtEdge newEdge; //New created edge (link)
    Object newkey; // New station key
    Object oldkey; // Old station key
    Iterator<Object> keys; // All keys in Hashmap stations
    Point2D oldpos; // Old station position
    Point2D newpos; // New station position
View Full Code Here

TOP

Related Classes of jmt.gui.jmodel.JGraphMod.JmtEdge

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.