ingenias.editor.models.SymptomEvolutionDiagramModelJGraph 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 and Juan Pavon
*
* 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.models;
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.Point;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Enumeration;
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.*;
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.rendererxml.*;
import ingenias.editor.events.*;
import ingenias.exception.InvalidEntity;
import ingenias.editor.*;
import java.util.concurrent.TimeUnit;
public class SymptomEvolutionDiagramModelJGraph extends ModelJGraph {
private Preferences prefs;
public SymptomEvolutionDiagramModelJGraph(SymptomEvolutionDiagramDataEntity mde,
String nombre, ObjectManager om, Model
m, BasicMarqueeHandler mh, Preferences prefs) {
super(mde, nombre, m, mh,om);
this.prefs=prefs;
ToolTipManager.sharedInstance().registerComponent(this);
this.getModel().addGraphModelListener(new ChangeNARYEdgeLocation(this));
this.getModel().addGraphModelListener(new ChangeEntityLocation(this));
this.getGraphLayoutCache().setFactory(new ingenias.editor.cellfactories.SymptomEvolutionDiagramCellViewFactory());
}
//
// Adding Tooltips
//
// Return Cell Label as a Tooltip
public String getToolTipText(MouseEvent e) {
if (e != null) {
// Fetch Cell under Mousepointer
Object c = getFirstCellForLocation(e.getX(), e.getY());
if (c != null) {
// Convert Cell to String and Return
return convertValueToString(c);
}
}
return null;
}
public JToolBar getPaleta() {
return toolbar;
}
protected void creaToolBar() {
if (toolbar==null){
toolbar = new FilteredJToolBar("SymptomEvolutionDiagram");
toolbar.setFloatable(false);
ImageIcon undoIcon = null;
JButton jb = null;
if (true){
Image img_MEDIUMSympLevelState =
ImageLoader.getImage("images/profiles/DiseaseProfile/MEDIUMSympLevelState.png");
undoIcon = new ImageIcon(img_MEDIUMSympLevelState);
Action MEDIUMSympLevelState=
new AbstractAction("MEDIUMSympLevelState", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "MEDIUMSympLevelState");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
MEDIUMSympLevelState.setEnabled(true);
jb = new JButton(MEDIUMSympLevelState){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("MEDIUMSympLevelState");
jb.setToolTipText("MEDIUMSympLevelState:"+new MEDIUMSympLevelState("").getHelpDesc()+"\n\n"+new MEDIUMSympLevelState("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_LOWSympLevelState =
ImageLoader.getImage("images/profiles/DiseaseProfile/LOWSympLevelState.png");
undoIcon = new ImageIcon(img_LOWSympLevelState);
Action LOWSympLevelState=
new AbstractAction("LOWSympLevelState", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "LOWSympLevelState");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
LOWSympLevelState.setEnabled(true);
jb = new JButton(LOWSympLevelState){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("LOWSympLevelState");
jb.setToolTipText("LOWSympLevelState:"+new LOWSympLevelState("").getHelpDesc()+"\n\n"+new LOWSympLevelState("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_CDayOfTheWeek =
ImageLoader.getImage("images/conditions/CDayOfTheDay.png");
undoIcon = new ImageIcon(img_CDayOfTheWeek);
Action CDayOfTheWeek=
new AbstractAction("CDayOfTheWeek", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "CDayOfTheWeek");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
CDayOfTheWeek.setEnabled(true);
jb = new JButton(CDayOfTheWeek){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("CDayOfTheWeek");
jb.setToolTipText("CDayOfTheWeek:"+new CDayOfTheWeek("").getHelpDesc()+"\n\n"+new CDayOfTheWeek("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_CInside =
ImageLoader.getImage("images/conditions/inside.png");
undoIcon = new ImageIcon(img_CInside);
Action CInside=
new AbstractAction("CInside", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "CInside");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
CInside.setEnabled(true);
jb = new JButton(CInside){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("CInside");
jb.setToolTipText("CInside:"+new CInside("").getHelpDesc()+"\n\n"+new CInside("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_CSymptom =
ImageLoader.getImage("images/profiles/DiseaseProfile/CSymptom.png");
undoIcon = new ImageIcon(img_CSymptom);
Action CSymptom=
new AbstractAction("CSymptom", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "CSymptom");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
CSymptom.setEnabled(true);
jb = new JButton(CSymptom){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("CSymptom");
jb.setToolTipText("CSymptom:"+new CSymptom("").getHelpDesc()+"\n\n"+new CSymptom("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_CTimer =
ImageLoader.getImage("images/conditions/CTimer.png");
undoIcon = new ImageIcon(img_CTimer);
Action CTimer=
new AbstractAction("CTimer", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "CTimer");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
CTimer.setEnabled(true);
jb = new JButton(CTimer){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("CTimer");
jb.setToolTipText("CTimer:"+new CTimer("").getHelpDesc()+"\n\n"+new CTimer("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_CEvent =
ImageLoader.getImage("images/conditions/CEvent.png");
undoIcon = new ImageIcon(img_CEvent);
Action CEvent=
new AbstractAction("CEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "CEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
CEvent.setEnabled(true);
jb = new JButton(CEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("CEvent");
jb.setToolTipText("CEvent:"+new CEvent("").getHelpDesc()+"\n\n"+new CEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_COutside =
ImageLoader.getImage("images/conditions/outside.png");
undoIcon = new ImageIcon(img_COutside);
Action COutside=
new AbstractAction("COutside", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "COutside");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
COutside.setEnabled(true);
jb = new JButton(COutside){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("COutside");
jb.setToolTipText("COutside:"+new COutside("").getHelpDesc()+"\n\n"+new COutside("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_CProb =
ImageLoader.getImage("images/conditions/CProb.png");
undoIcon = new ImageIcon(img_CProb);
Action CProb=
new AbstractAction("CProb", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "CProb");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
CProb.setEnabled(true);
jb = new JButton(CProb){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("CProb");
jb.setToolTipText("CProb:"+new CProb("").getHelpDesc()+"\n\n"+new CProb("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_NONESympLevelState =
ImageLoader.getImage("images/profiles/DiseaseProfile/NONESympLevelState.png");
undoIcon = new ImageIcon(img_NONESympLevelState);
Action NONESympLevelState=
new AbstractAction("NONESympLevelState", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "NONESympLevelState");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
NONESympLevelState.setEnabled(true);
jb = new JButton(NONESympLevelState){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("NONESympLevelState");
jb.setToolTipText("NONESympLevelState:"+new NONESympLevelState("").getHelpDesc()+"\n\n"+new NONESympLevelState("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_CAlways =
ImageLoader.getImage("images/conditions/CAlways.png");
undoIcon = new ImageIcon(img_CAlways);
Action CAlways=
new AbstractAction("CAlways", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "CAlways");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
CAlways.setEnabled(true);
jb = new JButton(CAlways){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("CAlways");
jb.setToolTipText("CAlways:"+new CAlways("").getHelpDesc()+"\n\n"+new CAlways("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_HIGHSympLevelState =
ImageLoader.getImage("images/profiles/DiseaseProfile/HIGHSympLevelState.png");
undoIcon = new ImageIcon(img_HIGHSympLevelState);
Action HIGHSympLevelState=
new AbstractAction("HIGHSympLevelState", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "HIGHSympLevelState");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
HIGHSympLevelState.setEnabled(true);
jb = new JButton(HIGHSympLevelState){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("HIGHSympLevelState");
jb.setToolTipText("HIGHSympLevelState:"+new HIGHSympLevelState("").getHelpDesc()+"\n\n"+new HIGHSympLevelState("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (true){
Image img_CTime =
ImageLoader.getImage("images/conditions/CTime.png");
undoIcon = new ImageIcon(img_CTime);
Action CTime=
new AbstractAction("CTime", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "CTime");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
CTime.setEnabled(true);
jb = new JButton(CTime){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("CTime");
jb.setToolTipText("CTime:"+new CTime("").getHelpDesc()+"\n\n"+new CTime("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_StartBehaviourEvent =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_StartBehaviourEvent);
Action StartBehaviourEvent=
new AbstractAction("StartBehaviourEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "StartBehaviourEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
StartBehaviourEvent.setEnabled(true);
jb = new JButton(StartBehaviourEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("StartBehaviourEvent");
jb.setToolTipText("StartBehaviourEvent:"+new StartBehaviourEvent("").getHelpDesc()+"\n\n"+new StartBehaviourEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_EPublicEvent =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_EPublicEvent);
Action EPublicEvent=
new AbstractAction("EPublicEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "EPublicEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
EPublicEvent.setEnabled(true);
jb = new JButton(EPublicEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("EPublicEvent");
jb.setToolTipText("EPublicEvent:"+new EPublicEvent("").getHelpDesc()+"\n\n"+new EPublicEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_StopBehaviourEvent =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_StopBehaviourEvent);
Action StopBehaviourEvent=
new AbstractAction("StopBehaviourEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "StopBehaviourEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
StopBehaviourEvent.setEnabled(true);
jb = new JButton(StopBehaviourEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("StopBehaviourEvent");
jb.setToolTipText("StopBehaviourEvent:"+new StopBehaviourEvent("").getHelpDesc()+"\n\n"+new StopBehaviourEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_Human =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_Human);
Action Human=
new AbstractAction("Human", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "Human");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
Human.setEnabled(true);
jb = new JButton(Human){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("Human");
jb.setToolTipText("Human:"+new Human("").getHelpDesc()+"\n\n"+new Human("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_SymptomChangedEvent =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_SymptomChangedEvent);
Action SymptomChangedEvent=
new AbstractAction("SymptomChangedEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "SymptomChangedEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
SymptomChangedEvent.setEnabled(true);
jb = new JButton(SymptomChangedEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("SymptomChangedEvent");
jb.setToolTipText("SymptomChangedEvent:"+new SymptomChangedEvent("").getHelpDesc()+"\n\n"+new SymptomChangedEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_FallingEvent =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_FallingEvent);
Action FallingEvent=
new AbstractAction("FallingEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "FallingEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
FallingEvent.setEnabled(true);
jb = new JButton(FallingEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("FallingEvent");
jb.setToolTipText("FallingEvent:"+new FallingEvent("").getHelpDesc()+"\n\n"+new FallingEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_MedsTakenEvent =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_MedsTakenEvent);
Action MedsTakenEvent=
new AbstractAction("MedsTakenEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "MedsTakenEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
MedsTakenEvent.setEnabled(true);
jb = new JButton(MedsTakenEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("MedsTakenEvent");
jb.setToolTipText("MedsTakenEvent:"+new MedsTakenEvent("").getHelpDesc()+"\n\n"+new MedsTakenEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_ObjDroppedEvent =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_ObjDroppedEvent);
Action ObjDroppedEvent=
new AbstractAction("ObjDroppedEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "ObjDroppedEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
ObjDroppedEvent.setEnabled(true);
jb = new JButton(ObjDroppedEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("ObjDroppedEvent");
jb.setToolTipText("ObjDroppedEvent:"+new ObjDroppedEvent("").getHelpDesc()+"\n\n"+new ObjDroppedEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_BEvent =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_BEvent);
Action BEvent=
new AbstractAction("BEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "BEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
BEvent.setEnabled(true);
jb = new JButton(BEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("BEvent");
jb.setToolTipText("BEvent:"+new BEvent("").getHelpDesc()+"\n\n"+new BEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
if (false){
Image img_EPrivateEvent =
ImageLoader.getImage("");
undoIcon = new ImageIcon(img_EPrivateEvent);
Action EPrivateEvent=
new AbstractAction("EPrivateEvent", undoIcon) {
public void actionPerformed(ActionEvent e) {
try{
insert(new Point(getVisibleRect().x,getVisibleRect().y), "EPrivateEvent");
} catch (InvalidEntity e1) {
e1.printStackTrace();
}
}
};
EPrivateEvent.setEnabled(true);
jb = new JButton(EPrivateEvent){
@Override
public JToolTip createToolTip() {
return new ingenias.editor.editiondialog.JMultiLineToolTip();
}
};
jb.setText("");
jb.setName("EPrivateEvent");
jb.setToolTipText("EPrivateEvent:"+new EPrivateEvent("").getHelpDesc()+"\n\n"+new EPrivateEvent("").getHelpRecom());
jb.addMouseListener(new MouseAdapter() {
final int defaultDismissTimeout = ToolTipManager.sharedInstance().getDismissDelay();
final int dismissDelayMinutes = (int) TimeUnit.MINUTES.toMillis(10); // 10 minutes
@Override
public void mouseEntered(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(dismissDelayMinutes);
}
@Override
public void mouseExited(MouseEvent me) {
ToolTipManager.sharedInstance().setDismissDelay(defaultDismissTimeout);
}
});
toolbar.add(jb);
}
}
}
public Vector getAllowedRelationships(){
Vector relationships=new Vector();
relationships.add("SymptomTransition");
relationships.add("ProducesEvent");
relationships.add("cond");
relationships.add("ProfileOf");
relationships.add("IntervalClockTime");
relationships.add("med");
relationships.add("LiveIn");
relationships.add("WorkAs");
relationships.add("socialRelations");
relationships.add("RelatedEvent");
relationships.add("ConditionNeeded");
relationships.add("ActivityAttached");
relationships.add("SBhasFloor");
relationships.add("Connects");
relationships.add("FPrecondition");
relationships.add("tool");
relationships.add("AllowedTask");
relationships.add("aeas_op1");
relationships.add("aeas_op2");
relationships.add("aeinv_op");
relationships.add("aemd_op1");
relationships.add("aemd_op2");
relationships.add("RelatedHuman");
relationships.add("InitialDate");
relationships.add("InitialLocation");
relationships.add("InitialActivity");
relationships.add("CameraFaceToHuman");
relationships.add("InitializesSymptom");
relationships.add("InitializedSymptom");
relationships.add("AffectedAction");
relationships.add("DeonticAssignement");
relationships.add("ActionHappeningAfterwards");
relationships.add("ActionResponsible");
relationships.add("Role");
return relationships;
}
public Vector getAllowedEntities(){
Vector entities=new Vector();
entities.add("MEDIUMSympLevelState");
entities.add("LOWSympLevelState");
entities.add("CDayOfTheWeek");
entities.add("CInside");
entities.add("CSymptom");
entities.add("CTimer");
entities.add("CEvent");
entities.add("COutside");
entities.add("CProb");
entities.add("NONESympLevelState");
entities.add("CAlways");
entities.add("HIGHSympLevelState");
entities.add("CTime");
entities.add("StartBehaviourEvent");
entities.add("EPublicEvent");
entities.add("StopBehaviourEvent");
entities.add("Human");
entities.add("SymptomChangedEvent");
entities.add("FallingEvent");
entities.add("MedsTakenEvent");
entities.add("ObjDroppedEvent");
entities.add("BEvent");
entities.add("EPrivateEvent");
return entities;
}
// Gets the name of the possible relationships for the selected GraphCells.
// A relationship can be binary (DefaultEdge) or n-ary (NAryEdge).
// The requested action is slightly different depending on selected items.
// According to the number of Edges in selected, the action can be:
// 0 => Propose a relationship between selected according included classes.
// 1 and it is NAryEdge => The class of that NAryEdge if it is possible according implements java.io.Serializable
// current cardinality and included classes..
// other cases => Error, no relationships are allowed.
public Object[] getPossibleRelationships(GraphCell[] selected) {
// Possible relationships initialization.
Vector v = new Vector();
// Search for NAryEdges in selected.
int nAryEdgesNum = 0;
int edgesNum = 0;
NAryEdge selectedEdge = null;
for (int i = 0; i < selected.length; i++) {
if (selected[i] instanceof NAryEdge) {
nAryEdgesNum++;
selectedEdge = (NAryEdge) selected[i];
}
else if (selected[i] instanceof DefaultEdge) {
edgesNum++;
// Connections are only possible with two or more elements and without binary edges.
}
}
if (selected.length >= 2 && edgesNum == 0) {
// The number of NAryEdges is considered.
if (nAryEdgesNum == 0) {
// acceptConnection methods only admits vertex parameters.
// Binary relationships.
// N-ary relationships. Sometimes they can be also binary.
if (SymptomTransitionEdge.acceptConnection(this.getModel(), selected)) {
v.add("SymptomTransition");
}
// N-ary relationships. Sometimes they can be also binary.
if (ProducesEventEdge.acceptConnection(this.getModel(), selected)) {
v.add("ProducesEvent");
}
// N-ary relationships. Sometimes they can be also binary.
if (condEdge.acceptConnection(this.getModel(), selected)) {
v.add("cond");
}
// N-ary relationships. Sometimes they can be also binary.
if (ProfileOfEdge.acceptConnection(this.getModel(), selected)) {
v.add("ProfileOf");
}
// N-ary relationships. Sometimes they can be also binary.
if (IntervalClockTimeEdge.acceptConnection(this.getModel(), selected)) {
v.add("IntervalClockTime");
}
// N-ary relationships. Sometimes they can be also binary.
if (medEdge.acceptConnection(this.getModel(), selected)) {
v.add("med");
}
// N-ary relationships. Sometimes they can be also binary.
if (LiveInEdge.acceptConnection(this.getModel(), selected)) {
v.add("LiveIn");
}
// N-ary relationships. Sometimes they can be also binary.
if (WorkAsEdge.acceptConnection(this.getModel(), selected)) {
v.add("WorkAs");
}
// N-ary relationships. Sometimes they can be also binary.
if (socialRelationsEdge.acceptConnection(this.getModel(), selected)) {
v.add("socialRelations");
}
// N-ary relationships. Sometimes they can be also binary.
if (RelatedEventEdge.acceptConnection(this.getModel(), selected)) {
v.add("RelatedEvent");
}
// N-ary relationships. Sometimes they can be also binary.
if (ConditionNeededEdge.acceptConnection(this.getModel(), selected)) {
v.add("ConditionNeeded");
}
// N-ary relationships. Sometimes they can be also binary.
if (ActivityAttachedEdge.acceptConnection(this.getModel(), selected)) {
v.add("ActivityAttached");
}
// N-ary relationships. Sometimes they can be also binary.
if (SBhasFloorEdge.acceptConnection(this.getModel(), selected)) {
v.add("SBhasFloor");
}
// N-ary relationships. Sometimes they can be also binary.
if (ConnectsEdge.acceptConnection(this.getModel(), selected)) {
v.add("Connects");
}
// N-ary relationships. Sometimes they can be also binary.
if (FPreconditionEdge.acceptConnection(this.getModel(), selected)) {
v.add("FPrecondition");
}
// N-ary relationships. Sometimes they can be also binary.
if (toolEdge.acceptConnection(this.getModel(), selected)) {
v.add("tool");
}
// N-ary relationships. Sometimes they can be also binary.
if (AllowedTaskEdge.acceptConnection(this.getModel(), selected)) {
v.add("AllowedTask");
}
// N-ary relationships. Sometimes they can be also binary.
if (aeas_op1Edge.acceptConnection(this.getModel(), selected)) {
v.add("aeas_op1");
}
// N-ary relationships. Sometimes they can be also binary.
if (aeas_op2Edge.acceptConnection(this.getModel(), selected)) {
v.add("aeas_op2");
}
// N-ary relationships. Sometimes they can be also binary.
if (aeinv_opEdge.acceptConnection(this.getModel(), selected)) {
v.add("aeinv_op");
}
// N-ary relationships. Sometimes they can be also binary.
if (aemd_op1Edge.acceptConnection(this.getModel(), selected)) {
v.add("aemd_op1");
}
// N-ary relationships. Sometimes they can be also binary.
if (aemd_op2Edge.acceptConnection(this.getModel(), selected)) {
v.add("aemd_op2");
}
// N-ary relationships. Sometimes they can be also binary.
if (RelatedHumanEdge.acceptConnection(this.getModel(), selected)) {
v.add("RelatedHuman");
}
// N-ary relationships. Sometimes they can be also binary.
if (InitialDateEdge.acceptConnection(this.getModel(), selected)) {
v.add("InitialDate");
}
// N-ary relationships. Sometimes they can be also binary.
if (InitialLocationEdge.acceptConnection(this.getModel(), selected)) {
v.add("InitialLocation");
}
// N-ary relationships. Sometimes they can be also binary.
if (InitialActivityEdge.acceptConnection(this.getModel(), selected)) {
v.add("InitialActivity");
}
// N-ary relationships. Sometimes they can be also binary.
if (CameraFaceToHumanEdge.acceptConnection(this.getModel(), selected)) {
v.add("CameraFaceToHuman");
}
// N-ary relationships. Sometimes they can be also binary.
if (InitializesSymptomEdge.acceptConnection(this.getModel(), selected)) {
v.add("InitializesSymptom");
}
// N-ary relationships. Sometimes they can be also binary.
if (InitializedSymptomEdge.acceptConnection(this.getModel(), selected)) {
v.add("InitializedSymptom");
}
// N-ary relationships. Sometimes they can be also binary.
if (AffectedActionEdge.acceptConnection(this.getModel(), selected)) {
v.add("AffectedAction");
}
// N-ary relationships. Sometimes they can be also binary.
if (DeonticAssignementEdge.acceptConnection(this.getModel(), selected)) {
v.add("DeonticAssignement");
}
// N-ary relationships. Sometimes they can be also binary.
if (ActionHappeningAfterwardsEdge.acceptConnection(this.getModel(), selected)) {
v.add("ActionHappeningAfterwards");
}
// N-ary relationships. Sometimes they can be also binary.
if (ActionResponsibleEdge.acceptConnection(this.getModel(), selected)) {
v.add("ActionResponsible");
}
// N-ary relationships. Sometimes they can be also binary.
if (RoleEdge.acceptConnection(this.getModel(), selected)) {
v.add("Role");
}
}
else if (nAryEdgesNum == 1) {
if (selectedEdge instanceof SymptomTransitionEdge &&
(SymptomTransitionEdge.acceptConnection(this.getModel(), selected))) {
v.add("SymptomTransition");
}
if (selectedEdge instanceof ProducesEventEdge &&
(ProducesEventEdge.acceptConnection(this.getModel(), selected))) {
v.add("ProducesEvent");
}
if (selectedEdge instanceof condEdge &&
(condEdge.acceptConnection(this.getModel(), selected))) {
v.add("cond");
}
if (selectedEdge instanceof ProfileOfEdge &&
(ProfileOfEdge.acceptConnection(this.getModel(), selected))) {
v.add("ProfileOf");
}
if (selectedEdge instanceof IntervalClockTimeEdge &&
(IntervalClockTimeEdge.acceptConnection(this.getModel(), selected))) {
v.add("IntervalClockTime");
}
if (selectedEdge instanceof medEdge &&
(medEdge.acceptConnection(this.getModel(), selected))) {
v.add("med");
}
if (selectedEdge instanceof LiveInEdge &&
(LiveInEdge.acceptConnection(this.getModel(), selected))) {
v.add("LiveIn");
}
if (selectedEdge instanceof WorkAsEdge &&
(WorkAsEdge.acceptConnection(this.getModel(), selected))) {
v.add("WorkAs");
}
if (selectedEdge instanceof socialRelationsEdge &&
(socialRelationsEdge.acceptConnection(this.getModel(), selected))) {
v.add("socialRelations");
}
if (selectedEdge instanceof RelatedEventEdge &&
(RelatedEventEdge.acceptConnection(this.getModel(), selected))) {
v.add("RelatedEvent");
}
if (selectedEdge instanceof ConditionNeededEdge &&
(ConditionNeededEdge.acceptConnection(this.getModel(), selected))) {
v.add("ConditionNeeded");
}
if (selectedEdge instanceof ActivityAttachedEdge &&
(ActivityAttachedEdge.acceptConnection(this.getModel(), selected))) {
v.add("ActivityAttached");
}
if (selectedEdge instanceof SBhasFloorEdge &&
(SBhasFloorEdge.acceptConnection(this.getModel(), selected))) {
v.add("SBhasFloor");
}
if (selectedEdge instanceof ConnectsEdge &&
(ConnectsEdge.acceptConnection(this.getModel(), selected))) {
v.add("Connects");
}
if (selectedEdge instanceof FPreconditionEdge &&
(FPreconditionEdge.acceptConnection(this.getModel(), selected))) {
v.add("FPrecondition");
}
if (selectedEdge instanceof toolEdge &&
(toolEdge.acceptConnection(this.getModel(), selected))) {
v.add("tool");
}
if (selectedEdge instanceof AllowedTaskEdge &&
(AllowedTaskEdge.acceptConnection(this.getModel(), selected))) {
v.add("AllowedTask");
}
if (selectedEdge instanceof aeas_op1Edge &&
(aeas_op1Edge.acceptConnection(this.getModel(), selected))) {
v.add("aeas_op1");
}
if (selectedEdge instanceof aeas_op2Edge &&
(aeas_op2Edge.acceptConnection(this.getModel(), selected))) {
v.add("aeas_op2");
}
if (selectedEdge instanceof aeinv_opEdge &&
(aeinv_opEdge.acceptConnection(this.getModel(), selected))) {
v.add("aeinv_op");
}
if (selectedEdge instanceof aemd_op1Edge &&
(aemd_op1Edge.acceptConnection(this.getModel(), selected))) {
v.add("aemd_op1");
}
if (selectedEdge instanceof aemd_op2Edge &&
(aemd_op2Edge.acceptConnection(this.getModel(), selected))) {
v.add("aemd_op2");
}
if (selectedEdge instanceof RelatedHumanEdge &&
(RelatedHumanEdge.acceptConnection(this.getModel(), selected))) {
v.add("RelatedHuman");
}
if (selectedEdge instanceof InitialDateEdge &&
(InitialDateEdge.acceptConnection(this.getModel(), selected))) {
v.add("InitialDate");
}
if (selectedEdge instanceof InitialLocationEdge &&
(InitialLocationEdge.acceptConnection(this.getModel(), selected))) {
v.add("InitialLocation");
}
if (selectedEdge instanceof InitialActivityEdge &&
(InitialActivityEdge.acceptConnection(this.getModel(), selected))) {
v.add("InitialActivity");
}
if (selectedEdge instanceof CameraFaceToHumanEdge &&
(CameraFaceToHumanEdge.acceptConnection(this.getModel(), selected))) {
v.add("CameraFaceToHuman");
}
if (selectedEdge instanceof InitializesSymptomEdge &&
(InitializesSymptomEdge.acceptConnection(this.getModel(), selected))) {
v.add("InitializesSymptom");
}
if (selectedEdge instanceof InitializedSymptomEdge &&
(InitializedSymptomEdge.acceptConnection(this.getModel(), selected))) {
v.add("InitializedSymptom");
}
if (selectedEdge instanceof AffectedActionEdge &&
(AffectedActionEdge.acceptConnection(this.getModel(), selected))) {
v.add("AffectedAction");
}
if (selectedEdge instanceof DeonticAssignementEdge &&
(DeonticAssignementEdge.acceptConnection(this.getModel(), selected))) {
v.add("DeonticAssignement");
}
if (selectedEdge instanceof ActionHappeningAfterwardsEdge &&
(ActionHappeningAfterwardsEdge.acceptConnection(this.getModel(), selected))) {
v.add("ActionHappeningAfterwards");
}
if (selectedEdge instanceof ActionResponsibleEdge &&
(ActionResponsibleEdge.acceptConnection(this.getModel(), selected))) {
v.add("ActionResponsible");
}
if (selectedEdge instanceof RoleEdge &&
(RoleEdge.acceptConnection(this.getModel(), selected))) {
v.add("Role");
}
}
}
return v.toArray();
}
public DefaultGraphCell getInstanciaNRelacion(String relacion,
GraphCell[] selected) {
// Search for NAryEdges in selected.
int nAryEdgesNum = 0;
int edgesNum = 0;
NAryEdge selectedEdge = null;
for (int i = 0; i < selected.length; i++) {
if (selected[i] instanceof NAryEdge) {
nAryEdgesNum++;
selectedEdge = (NAryEdge) selected[i];
}
else if (selected[i] instanceof DefaultEdge) {
edgesNum++;
}
}
if (nAryEdgesNum <= 1 && edgesNum == 0) {
if (relacion.equalsIgnoreCase("SymptomTransition")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof SymptomTransitionEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new SymptomTransitionEdge(new ingenias.editor.entities.SymptomTransition(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("ProducesEvent")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof ProducesEventEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new ProducesEventEdge(new ingenias.editor.entities.ProducesEvent(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("cond")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof condEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new condEdge(new ingenias.editor.entities.cond(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("ProfileOf")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof ProfileOfEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new ProfileOfEdge(new ingenias.editor.entities.ProfileOf(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("IntervalClockTime")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof IntervalClockTimeEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new IntervalClockTimeEdge(new ingenias.editor.entities.IntervalClockTime(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("med")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof medEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new medEdge(new ingenias.editor.entities.med(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("LiveIn")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof LiveInEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new LiveInEdge(new ingenias.editor.entities.LiveIn(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("WorkAs")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof WorkAsEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new WorkAsEdge(new ingenias.editor.entities.WorkAs(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("socialRelations")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof socialRelationsEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new socialRelationsEdge(new ingenias.editor.entities.socialRelations(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("RelatedEvent")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof RelatedEventEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new RelatedEventEdge(new ingenias.editor.entities.RelatedEvent(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("ConditionNeeded")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof ConditionNeededEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new ConditionNeededEdge(new ingenias.editor.entities.ConditionNeeded(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("ActivityAttached")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof ActivityAttachedEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new ActivityAttachedEdge(new ingenias.editor.entities.ActivityAttached(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("SBhasFloor")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof SBhasFloorEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new SBhasFloorEdge(new ingenias.editor.entities.SBhasFloor(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("Connects")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof ConnectsEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new ConnectsEdge(new ingenias.editor.entities.Connects(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("FPrecondition")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof FPreconditionEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new FPreconditionEdge(new ingenias.editor.entities.FPrecondition(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("tool")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof toolEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new toolEdge(new ingenias.editor.entities.tool(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("AllowedTask")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof AllowedTaskEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new AllowedTaskEdge(new ingenias.editor.entities.AllowedTask(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("aeas_op1")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof aeas_op1Edge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new aeas_op1Edge(new ingenias.editor.entities.aeas_op1(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("aeas_op2")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof aeas_op2Edge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new aeas_op2Edge(new ingenias.editor.entities.aeas_op2(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("aeinv_op")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof aeinv_opEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new aeinv_opEdge(new ingenias.editor.entities.aeinv_op(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("aemd_op1")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof aemd_op1Edge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new aemd_op1Edge(new ingenias.editor.entities.aemd_op1(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("aemd_op2")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof aemd_op2Edge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new aemd_op2Edge(new ingenias.editor.entities.aemd_op2(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("RelatedHuman")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof RelatedHumanEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new RelatedHumanEdge(new ingenias.editor.entities.RelatedHuman(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("InitialDate")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof InitialDateEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new InitialDateEdge(new ingenias.editor.entities.InitialDate(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("InitialLocation")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof InitialLocationEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new InitialLocationEdge(new ingenias.editor.entities.InitialLocation(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("InitialActivity")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof InitialActivityEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new InitialActivityEdge(new ingenias.editor.entities.InitialActivity(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("CameraFaceToHuman")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof CameraFaceToHumanEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new CameraFaceToHumanEdge(new ingenias.editor.entities.CameraFaceToHuman(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("InitializesSymptom")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof InitializesSymptomEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new InitializesSymptomEdge(new ingenias.editor.entities.InitializesSymptom(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("InitializedSymptom")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof InitializedSymptomEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new InitializedSymptomEdge(new ingenias.editor.entities.InitializedSymptom(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("AffectedAction")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof AffectedActionEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new AffectedActionEdge(new ingenias.editor.entities.AffectedAction(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("DeonticAssignement")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof DeonticAssignementEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new DeonticAssignementEdge(new ingenias.editor.entities.DeonticAssignement(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("ActionHappeningAfterwards")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof ActionHappeningAfterwardsEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new ActionHappeningAfterwardsEdge(new ingenias.editor.entities.ActionHappeningAfterwards(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("ActionResponsible")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof ActionResponsibleEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new ActionResponsibleEdge(new ingenias.editor.entities.ActionResponsible(getMJGraph().getNewId()));
}
}
if (relacion.equalsIgnoreCase("Role")) {
// ResponsibleNEdge already exists.
if (nAryEdgesNum == 1 && selectedEdge instanceof RoleEdge) {
return selectedEdge;
}
// There is no NAryEdges in selected.
else if (nAryEdgesNum == 0) {
return new RoleEdge(new ingenias.editor.entities.Role(getMJGraph().getNewId()));
}
}
}
return null;
}
public DefaultGraphCell createCell(String entity) throws InvalidEntity{
if (entity.equalsIgnoreCase("MEDIUMSympLevelState")) {
MEDIUMSympLevelState nentity=getOM().createMEDIUMSympLevelState(getMJGraph().getNewId("MEDIUMSympLevelState"));
DefaultGraphCell vertex = new
MEDIUMSympLevelStateCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("LOWSympLevelState")) {
LOWSympLevelState nentity=getOM().createLOWSympLevelState(getMJGraph().getNewId("LOWSympLevelState"));
DefaultGraphCell vertex = new
LOWSympLevelStateCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("CDayOfTheWeek")) {
CDayOfTheWeek nentity=getOM().createCDayOfTheWeek(getMJGraph().getNewId("CDayOfTheWeek"));
DefaultGraphCell vertex = new
CDayOfTheWeekCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("CInside")) {
CInside nentity=getOM().createCInside(getMJGraph().getNewId("CInside"));
DefaultGraphCell vertex = new
CInsideCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("CSymptom")) {
CSymptom nentity=getOM().createCSymptom(getMJGraph().getNewId("CSymptom"));
DefaultGraphCell vertex = new
CSymptomCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("CTimer")) {
CTimer nentity=getOM().createCTimer(getMJGraph().getNewId("CTimer"));
DefaultGraphCell vertex = new
CTimerCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("CEvent")) {
CEvent nentity=getOM().createCEvent(getMJGraph().getNewId("CEvent"));
DefaultGraphCell vertex = new
CEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("COutside")) {
COutside nentity=getOM().createCOutside(getMJGraph().getNewId("COutside"));
DefaultGraphCell vertex = new
COutsideCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("CProb")) {
CProb nentity=getOM().createCProb(getMJGraph().getNewId("CProb"));
DefaultGraphCell vertex = new
CProbCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("NONESympLevelState")) {
NONESympLevelState nentity=getOM().createNONESympLevelState(getMJGraph().getNewId("NONESympLevelState"));
DefaultGraphCell vertex = new
NONESympLevelStateCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("CAlways")) {
CAlways nentity=getOM().createCAlways(getMJGraph().getNewId("CAlways"));
DefaultGraphCell vertex = new
CAlwaysCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("HIGHSympLevelState")) {
HIGHSympLevelState nentity=getOM().createHIGHSympLevelState(getMJGraph().getNewId("HIGHSympLevelState"));
DefaultGraphCell vertex = new
HIGHSympLevelStateCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("CTime")) {
CTime nentity=getOM().createCTime(getMJGraph().getNewId("CTime"));
DefaultGraphCell vertex = new
CTimeCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("StartBehaviourEvent")) {
StartBehaviourEvent nentity=getOM().createStartBehaviourEvent(getMJGraph().getNewId("StartBehaviourEvent"));
DefaultGraphCell vertex = new
StartBehaviourEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("EPublicEvent")) {
EPublicEvent nentity=getOM().createEPublicEvent(getMJGraph().getNewId("EPublicEvent"));
DefaultGraphCell vertex = new
EPublicEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("StopBehaviourEvent")) {
StopBehaviourEvent nentity=getOM().createStopBehaviourEvent(getMJGraph().getNewId("StopBehaviourEvent"));
DefaultGraphCell vertex = new
StopBehaviourEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("Human")) {
Human nentity=getOM().createHuman(getMJGraph().getNewId("Human"));
DefaultGraphCell vertex = new
HumanCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("SymptomChangedEvent")) {
SymptomChangedEvent nentity=getOM().createSymptomChangedEvent(getMJGraph().getNewId("SymptomChangedEvent"));
DefaultGraphCell vertex = new
SymptomChangedEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("FallingEvent")) {
FallingEvent nentity=getOM().createFallingEvent(getMJGraph().getNewId("FallingEvent"));
DefaultGraphCell vertex = new
FallingEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("MedsTakenEvent")) {
MedsTakenEvent nentity=getOM().createMedsTakenEvent(getMJGraph().getNewId("MedsTakenEvent"));
DefaultGraphCell vertex = new
MedsTakenEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("ObjDroppedEvent")) {
ObjDroppedEvent nentity=getOM().createObjDroppedEvent(getMJGraph().getNewId("ObjDroppedEvent"));
DefaultGraphCell vertex = new
ObjDroppedEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("BEvent")) {
BEvent nentity=getOM().createBEvent(getMJGraph().getNewId("BEvent"));
DefaultGraphCell vertex = new
BEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
if (entity.equalsIgnoreCase("EPrivateEvent")) {
EPrivateEvent nentity=getOM().createEPrivateEvent(getMJGraph().getNewId("EPrivateEvent"));
DefaultGraphCell vertex = new
EPrivateEventCell(nentity);
// Default Size for the cell with the new entity
return vertex;
}
else
throw new ingenias.exception.InvalidEntity("Entity type "+entity+" is not allowed in this diagram");
}
public Dimension getDefaultSize(Entity entity) throws InvalidEntity{
if (entity.getType().equalsIgnoreCase("MEDIUMSympLevelState")) {
return MEDIUMSympLevelStateView.getSize((ingenias.editor.entities.MEDIUMSympLevelState)entity);
}
else
if (entity.getType().equalsIgnoreCase("LOWSympLevelState")) {
return LOWSympLevelStateView.getSize((ingenias.editor.entities.LOWSympLevelState)entity);
}
else
if (entity.getType().equalsIgnoreCase("CDayOfTheWeek")) {
return CDayOfTheWeekView.getSize((ingenias.editor.entities.CDayOfTheWeek)entity);
}
else
if (entity.getType().equalsIgnoreCase("CInside")) {
return CInsideView.getSize((ingenias.editor.entities.CInside)entity);
}
else
if (entity.getType().equalsIgnoreCase("CSymptom")) {
return CSymptomView.getSize((ingenias.editor.entities.CSymptom)entity);
}
else
if (entity.getType().equalsIgnoreCase("CTimer")) {
return CTimerView.getSize((ingenias.editor.entities.CTimer)entity);
}
else
if (entity.getType().equalsIgnoreCase("CEvent")) {
return CEventView.getSize((ingenias.editor.entities.CEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("COutside")) {
return COutsideView.getSize((ingenias.editor.entities.COutside)entity);
}
else
if (entity.getType().equalsIgnoreCase("CProb")) {
return CProbView.getSize((ingenias.editor.entities.CProb)entity);
}
else
if (entity.getType().equalsIgnoreCase("NONESympLevelState")) {
return NONESympLevelStateView.getSize((ingenias.editor.entities.NONESympLevelState)entity);
}
else
if (entity.getType().equalsIgnoreCase("CAlways")) {
return CAlwaysView.getSize((ingenias.editor.entities.CAlways)entity);
}
else
if (entity.getType().equalsIgnoreCase("HIGHSympLevelState")) {
return HIGHSympLevelStateView.getSize((ingenias.editor.entities.HIGHSympLevelState)entity);
}
else
if (entity.getType().equalsIgnoreCase("CTime")) {
return CTimeView.getSize((ingenias.editor.entities.CTime)entity);
}
else
if (entity.getType().equalsIgnoreCase("StartBehaviourEvent")) {
return StartBehaviourEventView.getSize((ingenias.editor.entities.StartBehaviourEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("EPublicEvent")) {
return EPublicEventView.getSize((ingenias.editor.entities.EPublicEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("StopBehaviourEvent")) {
return StopBehaviourEventView.getSize((ingenias.editor.entities.StopBehaviourEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("Human")) {
return HumanView.getSize((ingenias.editor.entities.Human)entity);
}
else
if (entity.getType().equalsIgnoreCase("SymptomChangedEvent")) {
return SymptomChangedEventView.getSize((ingenias.editor.entities.SymptomChangedEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("FallingEvent")) {
return FallingEventView.getSize((ingenias.editor.entities.FallingEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("MedsTakenEvent")) {
return MedsTakenEventView.getSize((ingenias.editor.entities.MedsTakenEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("ObjDroppedEvent")) {
return ObjDroppedEventView.getSize((ingenias.editor.entities.ObjDroppedEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("BEvent")) {
return BEventView.getSize((ingenias.editor.entities.BEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("EPrivateEvent")) {
return EPrivateEventView.getSize((ingenias.editor.entities.EPrivateEvent)entity);
}
else
if (entity.getType().equalsIgnoreCase("SymptomTransition")) {
return SymptomTransitionView.getSize((ingenias.editor.entities.SymptomTransition)entity);
}
if (entity.getType().equalsIgnoreCase("ProducesEvent")) {
return ProducesEventView.getSize((ingenias.editor.entities.ProducesEvent)entity);
}
if (entity.getType().equalsIgnoreCase("cond")) {
return condView.getSize((ingenias.editor.entities.cond)entity);
}
if (entity.getType().equalsIgnoreCase("ProfileOf")) {
return ProfileOfView.getSize((ingenias.editor.entities.ProfileOf)entity);
}
if (entity.getType().equalsIgnoreCase("IntervalClockTime")) {
return IntervalClockTimeView.getSize((ingenias.editor.entities.IntervalClockTime)entity);
}
if (entity.getType().equalsIgnoreCase("med")) {
return medView.getSize((ingenias.editor.entities.med)entity);
}
if (entity.getType().equalsIgnoreCase("LiveIn")) {
return LiveInView.getSize((ingenias.editor.entities.LiveIn)entity);
}
if (entity.getType().equalsIgnoreCase("WorkAs")) {
return WorkAsView.getSize((ingenias.editor.entities.WorkAs)entity);
}
if (entity.getType().equalsIgnoreCase("socialRelations")) {
return socialRelationsView.getSize((ingenias.editor.entities.socialRelations)entity);
}
if (entity.getType().equalsIgnoreCase("RelatedEvent")) {
return RelatedEventView.getSize((ingenias.editor.entities.RelatedEvent)entity);
}
if (entity.getType().equalsIgnoreCase("ConditionNeeded")) {
return ConditionNeededView.getSize((ingenias.editor.entities.ConditionNeeded)entity);
}
if (entity.getType().equalsIgnoreCase("ActivityAttached")) {
return ActivityAttachedView.getSize((ingenias.editor.entities.ActivityAttached)entity);
}
if (entity.getType().equalsIgnoreCase("SBhasFloor")) {
return SBhasFloorView.getSize((ingenias.editor.entities.SBhasFloor)entity);
}
if (entity.getType().equalsIgnoreCase("Connects")) {
return ConnectsView.getSize((ingenias.editor.entities.Connects)entity);
}
if (entity.getType().equalsIgnoreCase("FPrecondition")) {
return FPreconditionView.getSize((ingenias.editor.entities.FPrecondition)entity);
}
if (entity.getType().equalsIgnoreCase("tool")) {
return toolView.getSize((ingenias.editor.entities.tool)entity);
}
if (entity.getType().equalsIgnoreCase("AllowedTask")) {
return AllowedTaskView.getSize((ingenias.editor.entities.AllowedTask)entity);
}
if (entity.getType().equalsIgnoreCase("aeas_op1")) {
return aeas_op1View.getSize((ingenias.editor.entities.aeas_op1)entity);
}
if (entity.getType().equalsIgnoreCase("aeas_op2")) {
return aeas_op2View.getSize((ingenias.editor.entities.aeas_op2)entity);
}
if (entity.getType().equalsIgnoreCase("aeinv_op")) {
return aeinv_opView.getSize((ingenias.editor.entities.aeinv_op)entity);
}
if (entity.getType().equalsIgnoreCase("aemd_op1")) {
return aemd_op1View.getSize((ingenias.editor.entities.aemd_op1)entity);
}
if (entity.getType().equalsIgnoreCase("aemd_op2")) {
return aemd_op2View.getSize((ingenias.editor.entities.aemd_op2)entity);
}
if (entity.getType().equalsIgnoreCase("RelatedHuman")) {
return RelatedHumanView.getSize((ingenias.editor.entities.RelatedHuman)entity);
}
if (entity.getType().equalsIgnoreCase("InitialDate")) {
return InitialDateView.getSize((ingenias.editor.entities.InitialDate)entity);
}
if (entity.getType().equalsIgnoreCase("InitialLocation")) {
return InitialLocationView.getSize((ingenias.editor.entities.InitialLocation)entity);
}
if (entity.getType().equalsIgnoreCase("InitialActivity")) {
return InitialActivityView.getSize((ingenias.editor.entities.InitialActivity)entity);
}
if (entity.getType().equalsIgnoreCase("CameraFaceToHuman")) {
return CameraFaceToHumanView.getSize((ingenias.editor.entities.CameraFaceToHuman)entity);
}
if (entity.getType().equalsIgnoreCase("InitializesSymptom")) {
return InitializesSymptomView.getSize((ingenias.editor.entities.InitializesSymptom)entity);
}
if (entity.getType().equalsIgnoreCase("InitializedSymptom")) {
return InitializedSymptomView.getSize((ingenias.editor.entities.InitializedSymptom)entity);
}
if (entity.getType().equalsIgnoreCase("AffectedAction")) {
return AffectedActionView.getSize((ingenias.editor.entities.AffectedAction)entity);
}
if (entity.getType().equalsIgnoreCase("DeonticAssignement")) {
return DeonticAssignementView.getSize((ingenias.editor.entities.DeonticAssignement)entity);
}
if (entity.getType().equalsIgnoreCase("ActionHappeningAfterwards")) {
return ActionHappeningAfterwardsView.getSize((ingenias.editor.entities.ActionHappeningAfterwards)entity);
}
if (entity.getType().equalsIgnoreCase("ActionResponsible")) {
return ActionResponsibleView.getSize((ingenias.editor.entities.ActionResponsible)entity);
}
if (entity.getType().equalsIgnoreCase("Role")) {
return RoleView.getSize((ingenias.editor.entities.Role)entity);
}
throw new ingenias.exception.InvalidEntity("Entity type "+entity+" is not allowed in this diagram");
}
public DefaultGraphCell insert(Point point, String entity) throws InvalidEntity {
// CellView information is not available after creating the cell.
// Create a Map that holds the attributes for the Vertex
Map map = new Hashtable();
// Snap the Point to the Grid
point = convert(this.snap(new Point(point)));
// Construct Vertex with no Label
DefaultGraphCell vertex;
Dimension size;
vertex=this.createCell(entity);
size=this.getDefaultSize((Entity)vertex.getUserObject());
// Add a Bounds Attribute to the Map
GraphConstants.setBounds(map, new Rectangle(point, size));
// Construct a Map from cells to Maps (for insert)
Hashtable attributes = new Hashtable();
// Associate the Vertex with its Attributes
attributes.put(vertex, map);
// Insert the Vertex and its Attributes
this.getModel().insert(new Object[] {vertex},attributes
, null, null, null);
Entity newEntity=(Entity) vertex.getUserObject();
if (prefs.getModelingLanguage()==Preferences.ModelingLanguage.UML)
newEntity.getPrefs(null).setView(ViewPreferences.ViewType.UML);
if (prefs.getModelingLanguage()==Preferences.ModelingLanguage.INGENIAS)
newEntity.getPrefs(null).setView(ViewPreferences.ViewType.INGENIAS);
getGraphLayoutCache().setVisible(vertex,true);// makes the cell visible because
// the graphlayoutcache has partial set to true
return vertex;
}
public DefaultGraphCell insertDuplicated(Point point, ingenias.editor.entities.Entity
entity) {
// CellView information is not available after creating the cell.
// Create a Map that holds the attributes for the Vertex
Map map =new Hashtable();
// Snap the Point to the Grid
point = convert(this.snap(new Point(point)));
// Construct Vertex with no Label
DefaultGraphCell vertex = null;
Dimension size = null;
if (entity.getClass().equals(MEDIUMSympLevelState.class)) {
vertex = new MEDIUMSympLevelStateCell( (MEDIUMSympLevelState) entity);
// Default Size for the new Vertex with the new entity within
size = MEDIUMSympLevelStateView.getSize((MEDIUMSympLevelState) entity);
}
else
if (entity.getClass().equals(LOWSympLevelState.class)) {
vertex = new LOWSympLevelStateCell( (LOWSympLevelState) entity);
// Default Size for the new Vertex with the new entity within
size = LOWSympLevelStateView.getSize((LOWSympLevelState) entity);
}
else
if (entity.getClass().equals(CDayOfTheWeek.class)) {
vertex = new CDayOfTheWeekCell( (CDayOfTheWeek) entity);
// Default Size for the new Vertex with the new entity within
size = CDayOfTheWeekView.getSize((CDayOfTheWeek) entity);
}
else
if (entity.getClass().equals(CInside.class)) {
vertex = new CInsideCell( (CInside) entity);
// Default Size for the new Vertex with the new entity within
size = CInsideView.getSize((CInside) entity);
}
else
if (entity.getClass().equals(CSymptom.class)) {
vertex = new CSymptomCell( (CSymptom) entity);
// Default Size for the new Vertex with the new entity within
size = CSymptomView.getSize((CSymptom) entity);
}
else
if (entity.getClass().equals(CTimer.class)) {
vertex = new CTimerCell( (CTimer) entity);
// Default Size for the new Vertex with the new entity within
size = CTimerView.getSize((CTimer) entity);
}
else
if (entity.getClass().equals(CEvent.class)) {
vertex = new CEventCell( (CEvent) entity);
// Default Size for the new Vertex with the new entity within
size = CEventView.getSize((CEvent) entity);
}
else
if (entity.getClass().equals(COutside.class)) {
vertex = new COutsideCell( (COutside) entity);
// Default Size for the new Vertex with the new entity within
size = COutsideView.getSize((COutside) entity);
}
else
if (entity.getClass().equals(CProb.class)) {
vertex = new CProbCell( (CProb) entity);
// Default Size for the new Vertex with the new entity within
size = CProbView.getSize((CProb) entity);
}
else
if (entity.getClass().equals(NONESympLevelState.class)) {
vertex = new NONESympLevelStateCell( (NONESympLevelState) entity);
// Default Size for the new Vertex with the new entity within
size = NONESympLevelStateView.getSize((NONESympLevelState) entity);
}
else
if (entity.getClass().equals(CAlways.class)) {
vertex = new CAlwaysCell( (CAlways) entity);
// Default Size for the new Vertex with the new entity within
size = CAlwaysView.getSize((CAlways) entity);
}
else
if (entity.getClass().equals(HIGHSympLevelState.class)) {
vertex = new HIGHSympLevelStateCell( (HIGHSympLevelState) entity);
// Default Size for the new Vertex with the new entity within
size = HIGHSympLevelStateView.getSize((HIGHSympLevelState) entity);
}
else
if (entity.getClass().equals(CTime.class)) {
vertex = new CTimeCell( (CTime) entity);
// Default Size for the new Vertex with the new entity within
size = CTimeView.getSize((CTime) entity);
}
else
if (entity.getClass().equals(StartBehaviourEvent.class)) {
vertex = new StartBehaviourEventCell( (StartBehaviourEvent) entity);
// Default Size for the new Vertex with the new entity within
size = StartBehaviourEventView.getSize((StartBehaviourEvent) entity);
}
else
if (entity.getClass().equals(EPublicEvent.class)) {
vertex = new EPublicEventCell( (EPublicEvent) entity);
// Default Size for the new Vertex with the new entity within
size = EPublicEventView.getSize((EPublicEvent) entity);
}
else
if (entity.getClass().equals(StopBehaviourEvent.class)) {
vertex = new StopBehaviourEventCell( (StopBehaviourEvent) entity);
// Default Size for the new Vertex with the new entity within
size = StopBehaviourEventView.getSize((StopBehaviourEvent) entity);
}
else
if (entity.getClass().equals(Human.class)) {
vertex = new HumanCell( (Human) entity);
// Default Size for the new Vertex with the new entity within
size = HumanView.getSize((Human) entity);
}
else
if (entity.getClass().equals(SymptomChangedEvent.class)) {
vertex = new SymptomChangedEventCell( (SymptomChangedEvent) entity);
// Default Size for the new Vertex with the new entity within
size = SymptomChangedEventView.getSize((SymptomChangedEvent) entity);
}
else
if (entity.getClass().equals(FallingEvent.class)) {
vertex = new FallingEventCell( (FallingEvent) entity);
// Default Size for the new Vertex with the new entity within
size = FallingEventView.getSize((FallingEvent) entity);
}
else
if (entity.getClass().equals(MedsTakenEvent.class)) {
vertex = new MedsTakenEventCell( (MedsTakenEvent) entity);
// Default Size for the new Vertex with the new entity within
size = MedsTakenEventView.getSize((MedsTakenEvent) entity);
}
else
if (entity.getClass().equals(ObjDroppedEvent.class)) {
vertex = new ObjDroppedEventCell( (ObjDroppedEvent) entity);
// Default Size for the new Vertex with the new entity within
size = ObjDroppedEventView.getSize((ObjDroppedEvent) entity);
}
else
if (entity.getClass().equals(BEvent.class)) {
vertex = new BEventCell( (BEvent) entity);
// Default Size for the new Vertex with the new entity within
size = BEventView.getSize((BEvent) entity);
}
else
if (entity.getClass().equals(EPrivateEvent.class)) {
vertex = new EPrivateEventCell( (EPrivateEvent) entity);
// Default Size for the new Vertex with the new entity within
size = EPrivateEventView.getSize((EPrivateEvent) entity);
}
else
{}; // Just in case there is no allowed entity in the diagram
if (vertex == null) {
JOptionPane.showMessageDialog(this,
"Object not allowed in this diagram "+this.getID()+":"+
entity.getId()+":"+entity.getClass().getName()+
this.getClass().getName(),"Warning", JOptionPane.WARNING_MESSAGE); }
else {
// Add a Bounds Attribute to the Map
GraphConstants.setBounds(map, new Rectangle(point, size));
// Construct a Map from cells to Maps (for insert)
Hashtable attributes = new Hashtable();
// Associate the Vertex with its Attributes
attributes.put(vertex, map);
// Insert the Vertex and its Attributes
this.getModel().insert(new Object[] {vertex},attributes
, null, null, null);
getGraphLayoutCache().setVisible(vertex,true);// makes the cell visible because
// the graphlayoutcache has partial set to true
// waits for the cellview to be created
boolean created=false;
VertexView vv=null;
while (!created){
CellView[] cellviews = this.getGraphLayoutCache().getCellViews();
for (CellView cv:cellviews){
if (cv.getCell()==vertex){
// created!
created=true;
vv=(VertexView)cv;
}
}
try {
Thread.currentThread().sleep(10);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
// This should be used when the corresponding view for the entity has containers!
// It can be known by inspecting its renderer. To get it, a cellview is needed,
// but the cellview is created after a while via succesive callbacks to
// the view factories
if (!ListenerContainer.evaluate((CompositeRenderer) vv.getRenderer(),entity,null).isEmpty()){
// there are container renderers that need new cells corresponding to children to
// be inserted
Hashtable renderers = ListenerContainer.evaluate((CompositeRenderer) vv.getRenderer(),entity,null);
for (String field:renderers.keySet()){
Method obtainenumeration;
try {
obtainenumeration = entity.getClass().getMethod("get"+field+"Elements");
Enumeration enom=(Enumeration) obtainenumeration.invoke(entity,new Object[]{});
while (enom.hasMoreElements()){
DefaultGraphCell child=this.insertDuplicated(new Point(40,10), enom.nextElement());
try {
getListenerContainer().setParent(child,vertex);
} catch (WrongParent e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} catch (SecurityException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (NoSuchMethodException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalArgumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IllegalAccessException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (InvocationTargetException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
return vertex;
}
public synchronized JGraph cloneJGraph(IDEState ids){
SymptomEvolutionDiagramModelJGraph jg=new SymptomEvolutionDiagramModelJGraph(
(SymptomEvolutionDiagramDataEntity) this.mde,name, ids.om,
new Model(ids),new BasicMarqueeHandler(),ids.prefs);
this.setSelectionCells(getGraphLayoutCache().getCells(false,true,false,false));
Action copyaction =new EventRedirectorForGraphCopy(this,this.getTransferHandler().getCopyAction(),null );
Action pasteaction =new EventRedirectorPasteForGraphCopy(jg,jg.getTransferHandler().getPasteAction(),null );
copyaction.actionPerformed(new ActionEvent(this,0,"hello"));
pasteaction.actionPerformed(new ActionEvent(this,0,"hello"));
jg.invalidate();
jg.doLayout();
return jg;
}
public String toString() {
return this.getID();
}
}