ingenias.editor.cellfactories.NRGraphCellViewFactory Maven / Gradle / Ivy
/**
* Copyright (C) 2010 Jorge J. Gomez-Sanz over original code from Ruben Fuentes
*
* Modifications over original code from jgraph.sourceforge.net
*
* This file is part of the INGENME tool. INGENME is an open source meta-editor
* which produces customized editors for user-defined modeling languages
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 3 of the License
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
**/
package ingenias.editor.cellfactories;
import java.awt.*;
import javax.swing.*;
import javax.swing.event.*;
import java.awt.event.*;
import java.util.Map;
import java.util.Hashtable;
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
import java.awt.event.*;
import java.net.URL;
import java.util.Map;
import java.util.Hashtable;
import java.util.ArrayList;
import javax.swing.event.UndoableEditEvent;
import org.jgraph.JGraph;
import org.jgraph.graph.*;
import org.jgraph.event.*;
import java.util.Vector;
import org.jgraph.JGraph;
import org.jgraph.graph.*;
import org.jgraph.event.*;
import org.jgraph.plaf.basic.*;
import ingenias.editor.entities.*;
import ingenias.editor.cell.*;
import ingenias.editor.events.*;
public class NRGraphCellViewFactory implements CellViewFactory {
public NRGraphCellViewFactory() {}
public org.jgraph.graph.CellView createView(GraphModel model, Object cell) {
org.jgraph.graph.CellView view = null;
if (model.isPort(cell))
view = new PortView(cell);
else if (model.isEdge(cell))
view = createEdgeView(cell);
else
view = createVertexView(cell);
return view;
}
// Modificar agregando nuevas clases VIEW segun se vayan a?endo
protected org.jgraph.graph.VertexView createVertexView(Object v) {
Object userObject = ( (DefaultGraphCell) v).getUserObject();
// Diagram Objects start here
if (userObject.getClass().equals(NRNode.class)){
return new ingenias.editor.cell.NRNodeView(v);
}
// Diagram Relationships start here
if (v.getClass().equals(NREdgeEdge.class)){
return new ingenias.editor.cell.NREdgeView(v);
}
return null;
}
protected org.jgraph.graph.EdgeView createEdgeView(Object v) {
return new org.jgraph.graph.EdgeView(v);
// if (v instanceof ExecuteEdge){
// return new ExecuteView(v,this,cm);
// }
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy