Package org.mj.eclipse.reporting.classpath.mvc.models

Examples of org.mj.eclipse.reporting.classpath.mvc.models.INode


   *
   * @param project
   * @return the created project as <code>INode</code> instance.
   */
  public INode createProject(IProject project) {
    INode tmpProject = null;
    if (project instanceof INode) {
      tmpProject = (INode) project;
    } else {
      tmpProject = new ProjectModel(project);
    }
View Full Code Here


   * @param source
   * @param target
   * @return the connection as a <code>IConnector</code> instance.
   */
  public IConnector createConnector(IProject source, IProject target) {
    INode src = createProject(source);
    INode dst = createProject(target);
    IConnector connector = new ConnectorModel(src, dst);

    int idx = this.connectors.indexOf(connector);
    if (idx >= 0) {
      return this.connectors.get(idx);
View Full Code Here

          }
          // Makes a copy of the current path to enable back tracking if no solution is found.
          ArrayList<IConnector> subPath = (ArrayList<IConnector>) memoPoint.path.clone();
          subPath.add(connector);

          INode connectorSource = connector.getSource();
          INode connectorTarget = connector.getTarget();
          if (!connectorTarget.equals(src) && !connectorTarget.equals(memoPoint.src)) {
            // -- VERSION 2: Check for cycle --           
            int cycleStart = -1;
            int cycleEnd = -1;
            ArrayStack<INode> compressedSubPath = (ArrayStack<INode>) memoPoint.compressedPath.clone(); // using only nodes (No edge) {startNode, nextNode, nextNode, ..., endNode}
            if (compressedSubPath.isEmpty()) {
              // Add startNode
              compressedSubPath.push(connectorSource);
              compressedSubPath.push(connectorTarget);
            } else if (compressedSubPath.contains(connectorTarget)) {
              // CYCLE FOUND
              cycleStart = compressedSubPath.indexOf(connectorTarget);
              cycleEnd = compressedSubPath.size() - 1;
            } else {
              // Add nextNode
              compressedSubPath.push(connectorTarget);
            }
            if (cycleStart != -1 && cycleEnd != -1) {
              ArrayList<IConnector> cyclePath = new ArrayList<IConnector>(cycleEnd - cycleStart + 1);
              // mark cycle
              for (int i = cycleStart; i <= cycleEnd; i++) {
                IConnector inCycleConnector = subPath.get(i);
                inCycleConnector.setInCycle(true);
                cyclePath.add(inCycleConnector);
              }
              Status status = new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Cycle found : " + cyclePath
                  + " as subset of path : " + subPath);
              LOGGER.log(status);
              continue;
            }
            // -- VERSION 2 :  End cycle detection as subset of path --

            if (connectorTarget.equals(dst)) {
              // Path from src to dst is found
              allPath.add(subPath);
              continue;
            } else {
              // Simulate recursive function call.
View Full Code Here

      logger.fine("Refreshing visulals");
    }
    super.refreshVisuals();

    ProjectFigure figure = (ProjectFigure) getFigure();
    INode model = (INode) getModel();
    figure.setName(model.getName());
   
    // TODO Remove the cast hack !  Never access internal model
    figure.setTitleColor(((ProjectModel)model).getColor());
   
    refreshLayout();
View Full Code Here

      constraint = new Rectangle(bounds);
    }
    ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, constraint);

    // Check for first Layout refresh and set model to preferred size
    INode model = (INode) getModel();
    if (model.getHeightInLayout() == -1 || model.getWidthInLayout() == -1) {
      Dimension size = getFigure().getPreferredSize();
      // TODO remove hack
      model.setSizeInLayout(size.width * 1.618, size.height * 1.618); // Factor Phi
//      model.setSizeInLayout(size.width, size.height);
    }
  }
View Full Code Here

  /**
   * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelSourceConnections()
   */
  @Override
  protected List<IConnector> getModelSourceConnections() {
    INode projectModel = (INode) getModel();
    Collection<IConnector> outgoingConnections = projectModel.getOutgoingConnections();
    return applyFilters(outgoingConnections);
  }
View Full Code Here

  /**
   * @see org.eclipse.gef.editparts.AbstractGraphicalEditPart#getModelTargetConnections()
   */
  @Override
  protected List<IConnector> getModelTargetConnections() {
    INode projectModel = (INode) getModel();
    Collection<IConnector> incamingConnections = projectModel.getIncomingConnections();
    return applyFilters(incamingConnections);
  }
View Full Code Here

    if (logger.isLoggable(Level.FINE)) {
      //$ANALYSIS-IGNORE
      logger.fine("EditPart : " + child + " , constraint :" + constraint);
    }
    final Rectangle rectangle = (Rectangle) constraint;
    final INode node = (INode) child.getAdapter(INode.class); // = EditPart.getModel()
    Command command = new LayoutCommand(node, request, rectangle);
    return command;
  }
View Full Code Here

TOP

Related Classes of org.mj.eclipse.reporting.classpath.mvc.models.INode

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.