private void setVertexColor(Object vertex, Color color) {

    DefaultGraphCell cell = m_jgAdapter.getVertexCell(vertex);
    AttributeMap attr = cell.getAttributes();

    GraphConstants.setBackground(attr, color);

    AttributeMap cellAttr = new AttributeMap();

    cellAttr.put(cell, attr);

    m_jgAdapter.edit(cellAttr, null, null, null);
  }
  private void positionVertexAt(Object vertex, int x, int y) {

    DefaultGraphCell cell = m_jgAdapter.getVertexCell(vertex);
    AttributeMap attr = cell.getAttributes();
    Rectangle2D b = GraphConstants.getBounds(attr);

    Rectangle2D newBounds = new Rectangle2D.Double(x, y, 5, 5);
    GraphConstants.setBounds(attr, newBounds);

    AttributeMap cellAttr = new AttributeMap();

    cellAttr.put(cell, attr);

    m_jgAdapter.edit(cellAttr, null, null, null);
  }
  protected Vector<AbstractAction> createChangeViewActions(
      final DefaultGraphCell cell, final ModelJGraph graph) {
    Vector<AbstractAction> possibleViews = new Vector<AbstractAction>();
    final ingenias.editor.entities.Entity ent =
        ((ingenias.editor.entities.Entity) cell.getUserObject());

    if (ent.getClass().getName().equals("ingenias.editor.entities.TestingPackage")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.TestingPackage")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.DeploymentPackage")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.DeploymentPackage")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.SimulationPackage")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.SimulationPackage")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.INGENIASComponent")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.INGENIASComponent")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.Application")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.Application")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.EnvironmentApplication")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.EnvironmentApplication")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.InternalApplication")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.InternalApplication")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.UMLComment")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.UMLComment")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.DeploymentUnitByType")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.DeploymentUnitByType")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass()
        .getName()
        .equals("ingenias.editor.entities.DeploymentUnitByTypeEnumInitMS")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass()
        .getName()
        .equals("ingenias.editor.entities.DeploymentUnitByTypeEnumInitMS")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.DeploymentUnitByTypeMSEntity")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.UML;
      possibleViews.add(
          new AbstractAction("UML") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.UML);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.UML);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.DeploymentUnitByTypeMSEntity")) {
      final ViewPreferences.ViewType current1 = ViewPreferences.ViewType.INGENIAS;
      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ent.getPrefs().setView(ViewPreferences.ViewType.INGENIAS);
              // ingenias.editor.cell.TextUseCaseRenderer.setCurrent(ViewPreferences.ViewType.INGENIAS);
              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.UMLAnnotatedElement")) {

      possibleViews.add(
          new AbstractAction("NOICON") {
            public void actionPerformed(ActionEvent e) {
              ingenias.editor.cell.RenderComponentManager.setRelationshipView(
                  ViewPreferences.ViewType.NOICON, ent, cell, graph);

              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.UMLAnnotatedElement")) {

      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ingenias.editor.cell.RenderComponentManager.setRelationshipView(
                  ViewPreferences.ViewType.INGENIAS, ent, cell, graph);

              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.UMLAnnotatedElement")) {

      possibleViews.add(
          new AbstractAction("LABEL") {
            public void actionPerformed(ActionEvent e) {
              ingenias.editor.cell.RenderComponentManager.setRelationshipView(
                  ViewPreferences.ViewType.LABEL, ent, cell, graph);

              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.DefinesDeployment")) {

      possibleViews.add(
          new AbstractAction("NOICON") {
            public void actionPerformed(ActionEvent e) {
              ingenias.editor.cell.RenderComponentManager.setRelationshipView(
                  ViewPreferences.ViewType.NOICON, ent, cell, graph);

              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.DefinesDeployment")) {

      possibleViews.add(
          new AbstractAction("INGENIAS") {
            public void actionPerformed(ActionEvent e) {
              ingenias.editor.cell.RenderComponentManager.setRelationshipView(
                  ViewPreferences.ViewType.INGENIAS, ent, cell, graph);

              graph.repaint();
            }
          });
    }

    if (ent.getClass().getName().equals("ingenias.editor.entities.DefinesDeployment")) {

      possibleViews.add(
          new AbstractAction("LABEL") {
            public void actionPerformed(ActionEvent e) {
              ingenias.editor.cell.RenderComponentManager.setRelationshipView(
                  ViewPreferences.ViewType.LABEL, ent, cell, graph);

              graph.repaint();
            }
          });
    }

    return possibleViews;
  }