Examples of JmtCell


Examples of jmt.gui.jmodel.JGraphMod.JmtCell

   * editing for the specified item.
   */
  public void startEditingAtCell(Object cell) {
    graph.startEditingAtCell(cell);
    if ((cell != null) && (cell instanceof JmtCell)) {
      JmtCell jcell = (JmtCell) cell;
      StationParameterPanel stationPanel = new jmt.gui.common.panels.StationParameterPanel(model, model,
          ((CellComponent) jcell.getUserObject()).getKey());
      // Adds on the top a panel to change station name
      stationPanel.add(new StationNamePanel(model, ((CellComponent) jcell.getUserObject()).getKey()), BorderLayout.NORTH);
      dialogFactory.getDialog(stationPanel, "Editing " + jcell.getUserObject().toString() + " Properties...");

      // Updates cell dimensions if name was changed too much...
      Hashtable<Object, Map> nest = new Hashtable<Object, Map>();
      Dimension cellDimension = jcell.getSize(graph);
      Map attr = jcell.getAttributes();
      Rectangle2D oldBounds = GraphConstants.getBounds(attr);
      if (oldBounds.getWidth() != cellDimension.getWidth()) {
        GraphConstants.setBounds(attr, new Rectangle2D.Double(oldBounds.getX(), oldBounds.getY(), cellDimension.getWidth(), cellDimension
            .getHeight()));
        nest.put(cell, attr);
        jcell.updatePortPositions(nest, GraphConstants.getIcon(attr), cellDimension);
        graph.getGraphLayoutCache().edit(nest);
      }
    }
    // Blocking region editing
    else if ((cell != null) && (cell instanceof BlockingRegion)) {
View Full Code Here

Examples of jmt.gui.jmodel.JGraphMod.JmtCell

  public void updateStationPositions() {
    Object key;
    Object[] cells = graph.getDescendants(graph.getRoots());
    for (Object cell : cells) {
      if (cell instanceof JmtCell) {
        JmtCell jcell = (JmtCell) cell;
        key = ((CellComponent) jcell.getUserObject()).getKey();
        // Sets cell coordinate into data structure
        model.setStationPosition(key, new JMTPoint(getCellCoordinates(jcell), !jcell.isLeftInputCell()));
      }
    }
  }
View Full Code Here

Examples of jmt.gui.jmodel.JGraphMod.JmtCell

   * <br>Author: Bertoli Marco
   */
  public void populateGraph() {
    Object[] stations = model.getStationKeys().toArray();
    HashMap<Object, JmtCell> cells = new HashMap<Object, JmtCell>();
    JmtCell cell;

    // Variables for auto-placement. Currently items are placed on a grid...
    // Need to be improved!!!
    int count = 0;
    int X = 150; // distance on the X axis
View Full Code Here

Examples of jmt.gui.jmodel.JGraphMod.JmtCell

    // Put cells not in a blocking region to back
    HashSet<Object> putBack = new HashSet<Object>();
    for (Object cell2 : cells) {
      if (cell2 instanceof JmtCell && ((JmtCell) cell2).parentChanged()) {
        // This cell was moved in, out or between blocking regions
        JmtCell cell = (JmtCell) cell2;
        Object key = ((CellComponent) cell.getUserObject()).getKey();
        Object oldRegionKey, newRegionKey;
        if (!(cell.getParent() instanceof BlockingRegion)) {
          // Object removed from blocking region
          putBack.add(cell2);
          oldRegionKey = ((BlockingRegion) cell.getPrevParent()).getKey();
          model.removeRegionStation(oldRegionKey, key);
          // If region is empty, removes region too
          if (model.getBlockingRegionStations(oldRegionKey).size() == 0) {
            model.deleteBlockingRegion(oldRegionKey);
          }
          // Allow adding of removed objects to a new blocking region
          enableAddBlockingRegion(true);
        } else if (cell.getPrevParent() instanceof BlockingRegion) {
          // Object changed blocking region
          oldRegionKey = ((BlockingRegion) cell.getPrevParent()).getKey();
          model.removeRegionStation(oldRegionKey, key);
          // If region is empty, removes region too
          if (model.getBlockingRegionStations(oldRegionKey).size() == 0) {
            model.deleteBlockingRegion(oldRegionKey);
          }
          newRegionKey = ((BlockingRegion) cell.getParent()).getKey();
          model.addRegionStation(newRegionKey, key);
        } else {
          // Object added to a blocking region
          newRegionKey = ((BlockingRegion) cell.getParent()).getKey();
          if (!model.addRegionStation(newRegionKey, key)) {
            // object cannot be added to blocking region (for
            // example it's a source)
            cell.removeFromParent();
            graph.getModel().insert(new Object[] { cell }, null, null, null, null);
            putBack.add(cell);
          }
          // Doesn't allow adding of selected objects to a new
          // blocking region
          enableAddBlockingRegion(false);
        }
        // Resets parent for this cell
        cell.resetParent();
      }
      // Avoid insertion of a blocking region in an other
      else if (cell2 instanceof BlockingRegion) {
        BlockingRegion region = (BlockingRegion) cell2;
        if (region.getParent() != null) {
View Full Code Here

Examples of jmt.gui.jmodel.JGraphMod.JmtCell

      if ((cell instanceof BlockingRegion) || cell instanceof JmtEdge) {
        continue;
      }

      JmtCell current = (JmtCell) cell;

      Map<Object, Map> nested = new Hashtable<Object, Map>();
      Map attributeMap = new Hashtable();
      ImageIcon icon;
      if (current.isLeftInputCell()) {
        icon = JMTImageLoader.loadImage(current.getIcon(), ImageLoader.MODIFIER_MIRROR);
      } else {
        icon = JMTImageLoader.loadImage(current.getIcon());
      }
      GraphConstants.setIcon(attributeMap, icon);

      nested.put(cell, attributeMap);
      current.setLeftInputCell(!current.isLeftInputCell());
      current.updatePortPositions(nested, icon, current.getSize(graph));
      // _____DA INSERIRE QUI L AGGIORNAMENTO DELLA DECORAZIONE DELLA
      // FRECCIA______
      graph.getGraphLayoutCache().edit(nested);
    }
    avoidOverlappingCell(cells);
View Full Code Here

Examples of jmt.gui.jmodel.JGraphMod.JmtCell

    }
    // Questa parte gestisce quando abbiamo un progetto close
    if (!sourceIn && projectClose && !serverWithZeroIn) {

      int tmpMax = 0;
      JmtCell tmpCell = null;
      for (Object cell : cells) {
        if (cell instanceof JmtCell) {
          int tmpIn = (((JmtCell) cell).in);
          if (tmpMax < tmpIn) {
            tmpMax = tmpIn;
View Full Code Here

Examples of jmt.gui.jmodel.JGraphMod.JmtCell

    // inserisco tutti gli archi uscenti e entranti di min.get(j) in
    // listEdges
    listEdges = DefaultGraphModel.getOutgoingEdges(graphmodel, prev);
    Vector<Object> listEdgestmp = new Vector<Object>();
    for (Object listEdge : listEdges) {
      JmtCell qq = (JmtCell) (graphmodel.getParent(graphmodel.getTarget(listEdge)));
      if (!(qq).seen) {
        listEdgestmp.add(listEdge);
      }
    }
    listEdges = listEdgestmp.toArray();
View Full Code Here

Examples of jmt.gui.jmodel.JGraphMod.JmtCell

    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
View Full Code Here

Examples of jmt.gui.jmodel.JGraphMod.JmtCell

  public void paste(Point2D where) {
    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
View Full Code Here

Examples of jmt.gui.jmodel.JGraphMod.JmtCell

        //        bb.okin = true;
        //        flag=true;

        if ((firstPort != null) && ((VertexView) (firstPort.getParentView()) != null)) {
          if ((JmtCell) ((VertexView) (firstPort.getParentView())).getCell() != null) {
            JmtCell cell = (JmtCell) ((VertexView) (firstPort.getParentView())).getCell();

            mediator.avoidOverlappingCell(new JmtCell[] { cell });

          }
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.