ingenias.editor.cellfactories.InteractionDiagramCellViewFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sociaalmled Show documentation
Show all versions of sociaalmled Show documentation
A editor for modelling scenarios for PHAT simulator
/**
* 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 InteractionDiagramCellViewFactory implements CellViewFactory {
public InteractionDiagramCellViewFactory() {}
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(BodyStateCondition.class)){
return new ingenias.editor.cell.BodyStateConditionView(v);
}
if (userObject.getClass().equals(CDayOfTheWeek.class)){
return new ingenias.editor.cell.CDayOfTheWeekView(v);
}
if (userObject.getClass().equals(CInside.class)){
return new ingenias.editor.cell.CInsideView(v);
}
if (userObject.getClass().equals(EventProcessor.class)){
return new ingenias.editor.cell.EventProcessorView(v);
}
if (userObject.getClass().equals(CObjWeight.class)){
return new ingenias.editor.cell.CObjWeightView(v);
}
if (userObject.getClass().equals(CTimer.class)){
return new ingenias.editor.cell.CTimerView(v);
}
if (userObject.getClass().equals(CReceiveHelp.class)){
return new ingenias.editor.cell.CReceiveHelpView(v);
}
if (userObject.getClass().equals(CallStateEvent.class)){
return new ingenias.editor.cell.CallStateEventView(v);
}
if (userObject.getClass().equals(BEvent.class)){
return new ingenias.editor.cell.BEventView(v);
}
if (userObject.getClass().equals(MessageListenedEvent.class)){
return new ingenias.editor.cell.MessageListenedEventView(v);
}
if (userObject.getClass().equals(CEvent.class)){
return new ingenias.editor.cell.CEventView(v);
}
if (userObject.getClass().equals(CProb.class)){
return new ingenias.editor.cell.CProbView(v);
}
if (userObject.getClass().equals(COutside.class)){
return new ingenias.editor.cell.COutsideView(v);
}
if (userObject.getClass().equals(VibrateEvent.class)){
return new ingenias.editor.cell.VibrateEventView(v);
}
if (userObject.getClass().equals(BActivity.class)){
return new ingenias.editor.cell.BActivityView(v);
}
if (userObject.getClass().equals(CTime.class)){
return new ingenias.editor.cell.CTimeView(v);
}
if (userObject.getClass().equals(StartBehaviourEvent.class)){
return new ingenias.editor.cell.StartBehaviourEventView(v);
}
if (userObject.getClass().equals(StopBehaviourEvent.class)){
return new ingenias.editor.cell.StopBehaviourEventView(v);
}
if (userObject.getClass().equals(Human.class)){
return new ingenias.editor.cell.HumanView(v);
}
if (userObject.getClass().equals(SymptomChangedEvent.class)){
return new ingenias.editor.cell.SymptomChangedEventView(v);
}
if (userObject.getClass().equals(FallingEvent.class)){
return new ingenias.editor.cell.FallingEventView(v);
}
if (userObject.getClass().equals(MedsTakenEvent.class)){
return new ingenias.editor.cell.MedsTakenEventView(v);
}
if (userObject.getClass().equals(ObjDroppedEvent.class)){
return new ingenias.editor.cell.ObjDroppedEventView(v);
}
if (userObject.getClass().equals(EPrivateEvent.class)){
return new ingenias.editor.cell.EPrivateEventView(v);
}
// Diagram Relationships start here
if (v.getClass().equals(ProducesEventEdge.class)){
return new ingenias.editor.cell.ProducesEventView(v);
}
if (v.getClass().equals(condEdge.class)){
return new ingenias.editor.cell.condView(v);
}
if (v.getClass().equals(ProfileOfEdge.class)){
return new ingenias.editor.cell.ProfileOfView(v);
}
if (v.getClass().equals(TIStartTimeEdge.class)){
return new ingenias.editor.cell.TIStartTimeView(v);
}
if (v.getClass().equals(medEdge.class)){
return new ingenias.editor.cell.medView(v);
}
if (v.getClass().equals(LiveInEdge.class)){
return new ingenias.editor.cell.LiveInView(v);
}
if (v.getClass().equals(socialRelationsEdge.class)){
return new ingenias.editor.cell.socialRelationsView(v);
}
if (v.getClass().equals(WorkAsEdge.class)){
return new ingenias.editor.cell.WorkAsView(v);
}
if (v.getClass().equals(RelatedEventEdge.class)){
return new ingenias.editor.cell.RelatedEventView(v);
}
if (v.getClass().equals(ConditionNeededEdge.class)){
return new ingenias.editor.cell.ConditionNeededView(v);
}
if (v.getClass().equals(ActivityAttachedEdge.class)){
return new ingenias.editor.cell.ActivityAttachedView(v);
}
if (v.getClass().equals(ConnectsEdge.class)){
return new ingenias.editor.cell.ConnectsView(v);
}
if (v.getClass().equals(SBhasFloorEdge.class)){
return new ingenias.editor.cell.SBhasFloorView(v);
}
if (v.getClass().equals(toolEdge.class)){
return new ingenias.editor.cell.toolView(v);
}
if (v.getClass().equals(AllowedTaskEdge.class)){
return new ingenias.editor.cell.AllowedTaskView(v);
}
if (v.getClass().equals(FPreconditionEdge.class)){
return new ingenias.editor.cell.FPreconditionView(v);
}
if (v.getClass().equals(aemd_op1Edge.class)){
return new ingenias.editor.cell.aemd_op1View(v);
}
if (v.getClass().equals(aemd_op2Edge.class)){
return new ingenias.editor.cell.aemd_op2View(v);
}
if (v.getClass().equals(aeinv_opEdge.class)){
return new ingenias.editor.cell.aeinv_opView(v);
}
if (v.getClass().equals(aeas_op1Edge.class)){
return new ingenias.editor.cell.aeas_op1View(v);
}
if (v.getClass().equals(aeas_op2Edge.class)){
return new ingenias.editor.cell.aeas_op2View(v);
}
if (v.getClass().equals(InitialLocationEdge.class)){
return new ingenias.editor.cell.InitialLocationView(v);
}
if (v.getClass().equals(InitialActivityEdge.class)){
return new ingenias.editor.cell.InitialActivityView(v);
}
if (v.getClass().equals(InitialDateEdge.class)){
return new ingenias.editor.cell.InitialDateView(v);
}
if (v.getClass().equals(CameraFaceToHumanEdge.class)){
return new ingenias.editor.cell.CameraFaceToHumanView(v);
}
if (v.getClass().equals(RelatedHumanEdge.class)){
return new ingenias.editor.cell.RelatedHumanView(v);
}
if (v.getClass().equals(InitializesSymptomEdge.class)){
return new ingenias.editor.cell.InitializesSymptomView(v);
}
if (v.getClass().equals(InitializedSymptomEdge.class)){
return new ingenias.editor.cell.InitializedSymptomView(v);
}
if (v.getClass().equals(ActionResponsibleEdge.class)){
return new ingenias.editor.cell.ActionResponsibleView(v);
}
if (v.getClass().equals(ActionHappeningAfterwardsEdge.class)){
return new ingenias.editor.cell.ActionHappeningAfterwardsView(v);
}
if (v.getClass().equals(AffectedActionEdge.class)){
return new ingenias.editor.cell.AffectedActionView(v);
}
if (v.getClass().equals(DeonticAssignementEdge.class)){
return new ingenias.editor.cell.DeonticAssignementView(v);
}
if (v.getClass().equals(RoleEdge.class)){
return new ingenias.editor.cell.RoleView(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);
// }
}
}