Package net.sf.graphiti.model

Examples of net.sf.graphiti.model.Graph


  }

  @Override
  public void setGraphType(Configuration configuration, ObjectType type) {
    // create an empty graph, may be overridden
    graph = new Graph(configuration, type, true);

    String fileExt = configuration.getFileFormat().getFileExtension();
    if (fileName == null) {
      setFileName("New " + type.getName() + "." + fileExt);
    } else {
View Full Code Here


          "Many configurations could parse the file");
    }

    // parse with the configuration
    try {
      Graph graph = parse(configuration, file);
      graph.setFileName(file.getFullPath());
      return graph;
    } catch (Throwable e) {
      throw new IncompatibleConfigurationFile(
          "The file could not be parsed with the matching configuration",
          e);
View Full Code Here

   */
  private Graph parseGraph(Configuration configuration, Element element)
      throws TransformedDocumentParseError {
    String typeName = element.getAttribute("type");
    ObjectType type = configuration.getGraphType(typeName);
    Graph graph = new Graph(configuration, type, true);

    // parse different sections
    Node node = element.getFirstChild();
    node = parseParameters(graph, type, node);
    node = parseVertices(graph, node);
View Full Code Here

      @Override
      public String isValid(Object value) {
        VertexEditPart part = (VertexEditPart) getHost();
        Vertex vertex = (Vertex) part.getModel();
        Graph graph = vertex.getParent();

        String vertexId = (String) value;
        if (vertexId.isEmpty()) {
          return "";
        }

        vertex = graph.findVertex(vertexId);
        if (vertex != null && !vertex.equals(getHost().getModel())) {
          return "A vertex already exists with the same identifier";
        }

        return null;
View Full Code Here

    return PropertiesConstants.CONTRIBUTOR_ID;
  }

  @Override
  public List<Object> getModelChildren() {
    Graph graph = (Graph) getModel();
    List<Object> children = new ArrayList<Object>();
    children.addAll(graph.vertexSet());
    return children;
  }
View Full Code Here

    model.setValue((String) id, defaultValue);
  }

  @Override
  public void setPropertyValue(Object id, Object value) {
    Graph graph;
    if (model instanceof Vertex) {
      graph = ((Vertex) model).getParent();
    } else if (model instanceof Edge) {
      graph = ((Edge) model).getParent();
    } else {
      graph = (Graph) model;
    }

    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow()
        .getActivePage();
    try {
      IEditorPart part = IDE.openEditor(page, graph.getFile());
      if (part instanceof GraphEditor) {
        String parameterName = (String) id;

        // only update value if it is different than before
        Object oldValue = model.getValue(parameterName);
View Full Code Here

   */
  public Graph getGraph() {
    // creates a new empty graph with the same properties as originalGraph
    // but configuration and type, that are overridden by newConfiguration
    // and newGraphType
    Graph graph = new Graph(originalGraph, newConfiguration, newGraphType);

    // change vertex and edge types
    Map<ObjectType, ObjectType> vertexTypes = fillVertexTypes();
    Map<ObjectType, ObjectType> edgeTypes = fillEdgeTypes();
    convertVertexTypes(graph, vertexTypes);
View Full Code Here

  @Override
  @SuppressWarnings({ "rawtypes", "unchecked" })
  protected List getModelSourceConnections() {
    if (getModel() instanceof Vertex) {
      Vertex vertex = (Vertex) getModel();
      Graph parent = vertex.getParent();

      // we get the *output* dependencies of vertex
      Set<Edge> edges = parent.outgoingEdgesOf(vertex);

      // return the dependencies
      List dependencies = new ArrayList(edges);
      return dependencies;
    }
View Full Code Here

  @Override
  @SuppressWarnings({ "rawtypes", "unchecked" })
  protected List getModelTargetConnections() {
    if (getModel() instanceof Vertex) {
      Vertex vertex = (Vertex) getModel();
      Graph parent = vertex.getParent();

      // we get the *input* dependencies of vertex
      Set<Edge> edges = parent.incomingEdgesOf(vertex);

      // dependencies
      List dependencies = new ArrayList(edges);
      return dependencies;
    }
View Full Code Here

   * @param fig
   */
  private void updatePorts(IFigure fig) {
    Vertex vertex = (Vertex) getModel();
    VertexFigure figure = (VertexFigure) fig;
    Graph parent = vertex.getParent();

    figure.resetPorts();

    for (Edge edge : parent.incomingEdgesOf(vertex)) {
      String port = (String) edge
          .getValue(ObjectType.PARAMETER_TARGET_PORT);
      figure.addInputPort(port);
    }

    for (Edge edge : parent.outgoingEdgesOf(vertex)) {
      String port = (String) edge
          .getValue(ObjectType.PARAMETER_SOURCE_PORT);
      figure.addOutputPort(port);
    }

View Full Code Here

TOP

Related Classes of net.sf.graphiti.model.Graph

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.