protected JToolBar createToolbox() {
String toolbarName = "toolbox";
String actionOrder = controller.getSettings().getToolbarActionOrder(toolbarName);
JaWETypes jts = JaWEManager.getInstance().getJaWEController().getJaWETypes();
// set tooltip delay to 100ms
ToolTipManager.sharedInstance().setInitialDelay(100);
JToolBar toolbar = new JToolBar();
toolbar.setRollover(true);
String[] act = Utils.tokenize(actionOrder, BarFactory.ACTION_DELIMITER);
for (int j = 0; j < act.length; j++) {
if (act[j].equals(BarFactory.ACTION_SEPARATOR)) {
toolbar.addSeparator();
} else if (act[j].equals("SetSelectMode")) {
JaWEAction ja = new JaWEAction();
ja.setAction(new SetSelectMode(controller));
ja.setIcon(((GraphSettings) controller.getSettings()).getSelectionIcon());
ja.setLangDepName(controller.getSettings().getLanguageDependentString("SelectionKey"));
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction("SetSelectMode", ja);
} else if (act[j].equals("SetParticipantModeCommonExpression")) {
JaWEAction ja = new JaWEAction();
try {
String clsName = "org.enhydra.jawe.components.graph.actions.SetParticipantModeCommonExpression";
ActionBase action = (ActionBase) Class.forName(clsName).getConstructor(new Class[]{
GraphController.class
}).newInstance(new Object[]{
controller
});
ja.setAction(action);
} catch (Exception ex) {
}
ja.setIcon(((GraphSettings) controller.getSettings()).getCommonExpresionParticipantIcon());
ja.setLangDepName(controller.getSettings().getLanguageDependentString("CommonExpressionParticipantKey"));
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction("SetParticipantModeCommonExpression", ja);
} else if (act[j].equals("SetParticipantModeFreeTextExpression")) {
JaWEAction ja = new JaWEAction();
ja.setAction(new SetParticipantModeFreeTextExpression(controller));
ja.setIcon(((GraphSettings) controller.getSettings()).getFreeTextParticipantIcon());
ja.setLangDepName(controller.getSettings().getLanguageDependentString("FreeTextExpressionParticipantKey"));
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction("SetParticipantModeFreeTextExpression", ja);
} //CUSTOM
else if (act[j].equals("SetStartMode")) {
JaWEAction ja = new JaWEAction();
ja.setAction(new SetStartMode(controller));
ja.setIcon(((GraphSettings) controller.getSettings()).getBubbleStartIcon());
ja.setLangDepName(controller.getSettings().getLanguageDependentString("StartBubbleKey"));
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction("SetStartMode", ja);
} else if (act[j].equals("SetEndMode")) {
JaWEAction ja = new JaWEAction();
ja.setAction(new SetEndMode(controller));
ja.setIcon(((GraphSettings) controller.getSettings()).getBubbleEndIcon());
ja.setLangDepName(controller.getSettings().getLanguageDependentString("EndBubbleKey"));
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction("SetEndMode", ja);
//END CUSTOM
} else if (act[j].startsWith("SetParticipantMode")) {
String type = act[j].substring("SetParticipantMode".length());
if (type.equals("*")) {
List parTypes = jts.getTypes(Participant.class);
for (int i = 0; i < parTypes.size(); i++) {
JaWEType jt = (JaWEType) parTypes.get(i);
JaWEAction ja = new JaWEAction();
ja.setAction(new SetParticipantMode(controller, jt.getTypeId()));
ja.setIcon(jt.getIcon());
ja.setLangDepName(jt.getDisplayName());
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction(jt.getTypeId(), ja);
}
} else if (!(type.equals("SetParticipantModeCommonExpression") || type.equals("SetParticipantModeFreeTextExpression"))) {
JaWEType jt = jts.getType(type);
if (jt == null) {
continue;
}
JaWEAction ja = new JaWEAction();
ja.setAction(new SetParticipantMode(controller, jt.getTypeId()));
ja.setIcon(jt.getIcon());
ja.setLangDepName(jt.getDisplayName());
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction(jt.getTypeId(), ja);
}
} else if (act[j].startsWith("SetActivityMode")) {
String type = act[j].substring("SetActivityMode".length());
if (type.equals("*")) {
List actTypes = jts.getTypes(Activity.class);
for (int i = 0; i < actTypes.size(); i++) {
JaWEType jt = (JaWEType) actTypes.get(i);
JaWEAction ja = new JaWEAction();
ja.setAction(new SetActivityMode(controller, jt.getTypeId()));
ja.setIcon(jt.getIcon());
ja.setLangDepName(jt.getDisplayName());
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction(jt.getTypeId(), ja);
}
} else {
JaWEType jt = jts.getType(type);
if (jt == null) {
continue;
}
JaWEAction ja = new JaWEAction();
ja.setAction(new SetActivityMode(controller, jt.getTypeId()));
ja.setIcon(jt.getIcon());
ja.setLangDepName(jt.getDisplayName());
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction(jt.getTypeId(), ja);
}
} else if (act[j].startsWith("SetTransitionMode")) {
String type = act[j].substring("SetTransitionMode".length());
if (type.equals("*")) {
List traTypes = jts.getTypes(Transition.class);
for (int i = 0; i < traTypes.size(); i++) {
JaWEType jt = (JaWEType) traTypes.get(i);
JaWEAction ja = new JaWEAction();
ja.setAction(new SetTransitionMode(controller, jt.getTypeId()));
ja.setIcon(jt.getIcon());
ja.setLangDepName(jt.getDisplayName());
JButton b = BarFactory.createToolbarButton(ja, controller);
decorateToolboxButton(b, ja);
toolbar.add(b);
controller.getSettings().addAction(jt.getTypeId(), ja);
}
} else {
JaWEType jt = jts.getType(type);
if (jt == null) {
continue;
}
JaWEAction ja = new JaWEAction();
ja.setAction(new SetTransitionMode(controller, jt.getTypeId()));