Package net.sf.graphiti.model

Examples of net.sf.graphiti.model.Configuration


  private void updateSelection(IGraphTypeSettable page) {
    int index = listGraphTypes.getSelectionIndex();
    String graphType = listGraphTypes.getItem(index);

    ObjectType type = graphTypeNames.get(graphType);
    Configuration configuration = graphTypeConfigurations.get(type);
    page.setGraphType(configuration, type);
  }
View Full Code Here


   * @param graph
   *            A {@link Graph}.
   */
  public void setGraph(Graph graph) {
    this.graph = graph;
    Configuration configuration = graph.getConfiguration();
    ObjectType type = graph.getType();
    String fileExt = configuration.getFileFormat().getFileExtension();
    setFileExtension(fileExt);
    if (fileName == null) {
      setFileName("New " + type.getName() + "." + fileExt);
    } else {
      setFileName(fileName + "." + fileExt);
View Full Code Here

   * @param byteStream
   *            The {@link OutputStream} to write to.
   */
  public void write(String path, OutputStream byteStream) {
    Element element = null;
    Configuration configuration = graph.getConfiguration();
    FileFormat format = configuration.getFileFormat();

    List<Transformation> transformations = format
        .getExportTransformations();
    try {
      for (Transformation transformation : transformations) {
        if (transformation.isXslt()) {
          if (element == null) {
            // writes graph
            element = writeGraph();
          }
         
          XsltTransformer transformer = new XsltTransformer(
              configuration.getContributorId(),
              transformation.getFileName());
          transformer.setParameter("path", path);
          element = transformer.transformDomToDom(element);
        } else {
          transformation.getInstance().transform(graph, byteStream);
View Full Code Here

      if (format.getFileExtension().equals(fileExt)) {
        configurations.add(configuration);
      }
    }

    Configuration configuration;
    if (configurations.isEmpty()) {
      throw new IncompatibleConfigurationFile(
          "No configuration could parse the file" + file.getFullPath());
    } else if (configurations.size() == 1) {
      configuration = configurations.get(0);
View Full Code Here

   * @throws TransformedDocumentParseError
   *             If the edges could not be parsed.
   */
  private Node parseEdges(Graph graph, Node node)
      throws TransformedDocumentParseError {
    Configuration configuration = graph.getConfiguration();
    node = DomHelper.getFirstSiblingNamed(node, "edges");
    Node child = node.getFirstChild();
    while (child != null) {
      if (child.getNodeName().equals("edge")) {
        Element element = (Element) child;

        String typeName = element.getAttribute("type");
        ObjectType type = configuration.getEdgeType(typeName);

        String sourceId = element.getAttribute("source");
        Vertex source = graph.findVertex(sourceId);

        String targetId = element.getAttribute("target");
View Full Code Here

   * @param node
   *            A child node of &lt;graph&gt;.
   * @return The node following &lt;vertices&gt;.
   */
  private Node parseVertices(Graph graph, Node node) {
    Configuration configuration = graph.getConfiguration();
    node = DomHelper.getFirstSiblingNamed(node, "vertices");
    Node child = node.getFirstChild();
    while (child != null) {
      if (child.getNodeName().equals("vertex")) {
        String typeName = ((Element) child).getAttribute("type");
        ObjectType type = configuration.getVertexType(typeName);
        Vertex vertex = new Vertex(type);

        // set layout information if present
        String xAttr = ((Element) child).getAttribute("x");
        String yAttr = ((Element) child).getAttribute("y");
View Full Code Here

    IExtensionRegistry registry = Platform.getExtensionRegistry();
    IConfigurationElement[] elements = registry
        .getConfigurationElementsFor(PLUGIN_ID + ".definition");
    for (IConfigurationElement element : elements) {
      Configuration configuration = parseConfiguration(element);
      configurations.put(configuration.getName(), configuration);
    }
  }
View Full Code Here

      refinementPolicy = (IRefinementPolicy) element
          .createExecutableExtension("refinement");
    }

    IContributor contributor = element.getContributor();
    Configuration configuration = new Configuration(name,
        contributor.getName(), format, graphTypes, vertexTypes,
        edgeTypes, validator, refinementPolicy);
    return configuration;
  }
View Full Code Here

   */
  private static void addEdgeTypes(Graph graph, PaletteContainer container) {
    if (graph != null) {
      PaletteDrawer edgeDrawer = new PaletteDrawer("Connections");

      Configuration config = graph.getConfiguration();
      Set<ObjectType> edgeTypes = config.getEdgeTypes();
      for (ObjectType type : edgeTypes) {
        String typeStr = type.getName();

        ImageDescriptor id = getImgDescEdge(type);

View Full Code Here

   */
  private static void addVertexTypes(Graph graph, PaletteContainer container) {
    if (graph != null) {
      PaletteDrawer toolDrawer = new PaletteDrawer("Vertices");

      Configuration config = graph.getConfiguration();
      Set<ObjectType> vertexTypes = config.getVertexTypes();
      for (ObjectType type : vertexTypes) {
        String typeStr = type.getName();

        ImageDescriptor id = getImgDescVertex(type);

View Full Code Here

TOP

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

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.