package de.FeatureModellingTool.GraphicalEditor;
import java.awt.event.ActionEvent;
import research.*;
import research.figure.ArrowTip;
import de.FeatureModellingTool.FeatureModel.*;
import de.FeatureModellingTool.GraphicalEditor.RefinementCreationTool.Refinement;
import de.reuse.Context;
import de.reuse.ContextImplementation;
import de.reuse.GroupMap;
import java.awt.Color;
import java.awt.event.ActionListener;
import research.toolAction.ToolAction;
import research.toolAction.CreationToolAction;
import research.toolAction.ConnectionToolAction;
import javax.swing.*;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
import java.net.URL;
import java.awt.event.ItemListener;
import java.awt.event.ItemEvent;
import org.jdesktop.swingx.border.DropShadowBorder;
import applet.WebConstantDefinition;
/**
* author: zhangwei
* Date: 2003-5-28
* Time: 20:09:04
*/
class ToolBar extends JToolBar {
protected final ToolActionController controller = new ToolActionController();
private DrawingEditor drawingEditor = null;
private FeatureModel featureModel = null;
private FeatureEditor featureEditor = null;
private FeatureModelEditor featureModelEditor = null;
private ConstraintModel constraintModel = null;
private ConstraintModelEditor constraintModelEditor = null;
private CompositeConstraintEditor plConstraintEditor = null;
private GroupConstraintEditor gConstraintEditor = null;
private VPConstraintEditor vpConstraintEditor = null;
private ResourceComponentEditor resourceComponentEditor = null;
private InteractionModel interactionModel = null;
private InteractionModelEditor interactionModelEditor = null;
private ModelValidation modelValidation = null;
private FeatureModelSelectionTool fmsTool = null;
private FeatureModelTraceTool fmtTool = null;
private FeatureCreationTool ffcTool = null;
private ResourceComponentCreationTool rccTool = null;
private FeatureRelationCreationTool iccTool = null;
private FeatureRelationCreationTool dvccTool = null;
private FeatureRelationCreationTool rcTool = null;
private FeatureRelationCreationTool mcTool = null;
private PLConstraintCreationTool plcTool = null;
private GroupConstraintCreationTool gcTool = null;
private VPConstraintCreationTool vpcTool = null;
private PLConnectionCreationTool plccTool = null;
private InteractionCreationTool icTool = null;
private JButton refinementCount = null;
private RefinementCreationTool decomposeTool = null;
private RefinementCreationTool attributeTool = null;
private RefinementCreationTool specializeTool = null;
private GroupMap idToFigureMap = null;
protected final Context context = new ContextImplementation();
public ToolBar() throws Exception {
context.addContextChangeListener(new ContextChangeListener());
fmsTool = new FeatureModelSelectionTool();
fmtTool = new FeatureModelTraceTool();
ffcTool = new FeatureCreationTool();
rccTool = new ResourceComponentCreationTool();
iccTool = new FeatureRelationCreationTool();
dvccTool = new FeatureRelationCreationTool();
rcTool = new FeatureRelationCreationTool();
mcTool = new FeatureRelationCreationTool();
plcTool = new PLConstraintCreationTool();
gcTool = new GroupConstraintCreationTool();
vpcTool = new VPConstraintCreationTool();
plccTool = new PLConnectionCreationTool();
icTool = new InteractionCreationTool();
decomposeTool = new RefinementCreationTool(Refinement.Decompose);
attributeTool = new RefinementCreationTool(Refinement.Attribute);
specializeTool = new RefinementCreationTool(Refinement.Specialize);
iccTool.getContext().putValue(FeatureRelationCreationTool.RELATION_NAME, FeatureRelation.DECOMPOSE);
dvccTool.getContext().putValue(FeatureRelationCreationTool.RELATION_NAME, FeatureRelation.ATTRIBUTE);
rcTool.getContext().putValue(FeatureRelationCreationTool.RELATION_NAME, FeatureRelation.REQUIRE);
mcTool.getContext().putValue(FeatureRelationCreationTool.RELATION_NAME, FeatureRelation.EXCLUDE);
ToolAction toolAction = null;
ImageIcon toolIcon = null;
ToolButton tooButton = null;
toolAction = new ToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"select.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Select and Move Figures");
toolAction.putValue(ToolAction.TOOL, fmsTool);
controller.addToolAction(toolAction);
controller.setDefaultToolAction(toolAction);
toolAction.setSelected(true);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
this.addSeparator();
toolAction = new CreationToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"feature.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create or Modify Feature Figures");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new FeatureFigure());
toolAction.putValue(ToolAction.TOOL, ffcTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolAction = new CreationToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"resource.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create or Modify Resource-Container Figures");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new ResourceComponentFigure());
toolAction.putValue(ToolAction.TOOL, rccTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
this.addSeparator();
toolAction = new ToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"decomposeS.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Decompose Structure");
toolAction.putValue(ToolAction.TOOL, decomposeTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolAction = new ToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"attributeS.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Attribute Structure");
toolAction.putValue(ToolAction.TOOL, attributeTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolAction = new ToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"specializeS.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Specialize Structure");
toolAction.putValue(ToolAction.TOOL, specializeTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"empty_16_12.png"));
refinementCount = new JButton();
refinementCount.setText("3");
refinementCount.setIcon(toolIcon);
refinementCount.setVerticalTextPosition(AbstractButton.CENTER);
refinementCount.setHorizontalTextPosition(AbstractButton.CENTER);
refinementCount.setFocusable(false);
decomposeTool.setChildCount(3);
attributeTool.setChildCount(3);
specializeTool.setChildCount(3);
this.add(refinementCount);
refinementCount.addActionListener(new RefinementCountListener());
this.addSeparator();
toolAction = new ConnectionToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"decompose.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create an Decompose-Relation Figure");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new DecomposeConnection());
toolAction.putValue(ToolAction.TOOL, iccTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolAction = new ConnectionToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"attribute.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create an Attribute-Relation Figure");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new AttributeConnection());
toolAction.putValue(ToolAction.TOOL, dvccTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
this.addSeparator();
toolAction = new ConnectionToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"require_connection.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Require-Relation Figure");
ConstraintConnection prototype = new ConstraintConnection(FeatureRelation.REQUIRE);
prototype.setEndDecoration(new ArrowTip());
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, prototype);
toolAction.putValue(ToolAction.TOOL, rcTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolAction = new ConnectionToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"mutex_connection.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Exclude-Relation Figure");
prototype = new ConstraintConnection(FeatureRelation.EXCLUDE);
prototype.setMidDecoration(new CrossDecoration(5));
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, prototype);
toolAction.putValue(ToolAction.TOOL, mcTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
this.addSeparator();
toolAction = new CreationToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"vp_contraint.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a VP Constraint Figure");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new VPConstraintFigure());
toolAction.putValue(ToolAction.TOOL, vpcTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolAction = new CreationToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"group_contraint.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Group Constraint Figure");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new GroupConstraintFigure());
toolAction.putValue(ToolAction.TOOL, gcTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolAction = new CreationToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"composite_contraint.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Composite Constraint Figure");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new PLFigure());
toolAction.putValue(ToolAction.TOOL, plcTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolAction = new ConnectionToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"c2f.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Constraint Relation Figure");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new PLConnection());
toolAction.putValue(ToolAction.TOOL, plccTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
toolAction = new ConnectionToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"c2fn.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Negation Constraint Relation Figure");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new PLConnection(true));
toolAction.putValue(ToolAction.TOOL, plccTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
/**
toolAction = new TextAreaToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"comment.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create a Comment Figure");
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, new TextAreaFigure());
toolAction.putValue(ToolAction.TOOL, new ConnectedTextAreaTool());
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
**/
this.addSeparator();
toolAction = new ConnectionToolAction();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"interaction_connection.png"));
toolAction.putValue(Action.SMALL_ICON, toolIcon);
toolAction.putValue(Action.SHORT_DESCRIPTION, "Create an Interaction Figure");
InteractionConnection proto = new InteractionConnection();
toolAction.putValue(CreationToolAction.PROTOTYPE_FIGURE, proto);
proto.setEndDecoration(new ArrowTip());
toolAction.putValue(ToolAction.TOOL, icTool);
controller.addToolAction(toolAction);
toolAction.setSelected(false);
tooButton = new ToolButton(toolAction);
this.add(tooButton);
this.addSeparator();
toolIcon = new ImageIcon(new URL(WebConstantDefinition.RES_HOST+"lock.png"));
JToggleButton stickButton = new JToggleButton(toolIcon);
stickButton.setFocusable(false);
this.add(stickButton);
if (controller.getPolicy().equals(ToolActionController.CONTINUE_POLICY)) {
stickButton.setSelected(true);
} else {
stickButton.setSelected(false);
}
stickButton.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
int state = e.getStateChange();
if (state == ItemEvent.SELECTED) {
controller.setPolicy(ToolActionController.CONTINUE_POLICY);
} else {
controller.setPolicy(ToolActionController.DEFAULT_POLICY);
}
}
});
}
public Context getContext() {
return context;
}
protected class ContextChangeListener implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent e) {
contextChange(e);
}
}
protected void contextChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if (ConstantDefinition.DRAWING_EDITOR.equals(propertyName)) {
drawingEditor = (DrawingEditor) e.getNewValue();
controller.setDrawingEditor(drawingEditor);
} else if (ConstantDefinition.FEATURE_MODEL.equals(propertyName)) {
featureModel = (FeatureModel) e.getNewValue();
fmsTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
ffcTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
iccTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
dvccTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
rcTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
mcTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
plcTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
gcTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
vpcTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
plccTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
icTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
decomposeTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
attributeTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
specializeTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL, featureModel);
} else if (ConstantDefinition.FEATURE_EDITOR.equals(propertyName)) {
featureEditor = (FeatureEditor) e.getNewValue();
ffcTool.getContext().putValue(ConstantDefinition.FEATURE_EDITOR, featureEditor);
decomposeTool.getContext().putValue(ConstantDefinition.FEATURE_EDITOR, featureEditor);
attributeTool.getContext().putValue(ConstantDefinition.FEATURE_EDITOR, featureEditor);
specializeTool.getContext().putValue(ConstantDefinition.FEATURE_EDITOR, featureEditor);
} else if (ConstantDefinition.RESOURCE_COMPONENT_EDITOR.equals(propertyName)) {
resourceComponentEditor = (ResourceComponentEditor) e.getNewValue();
rccTool.getContext().putValue(ConstantDefinition.RESOURCE_COMPONENT_EDITOR, resourceComponentEditor);
} else if (ConstantDefinition.FEATURE_MODEL_EDITOR.equals(propertyName)) {
featureModelEditor = (FeatureModelEditor) e.getNewValue();
fmsTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
ffcTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
iccTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
dvccTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
rcTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
mcTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
decomposeTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
attributeTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
specializeTool.getContext().putValue(ConstantDefinition.FEATURE_MODEL_EDITOR, featureModelEditor);
} else if (ConstantDefinition.ID_TO_FIGURE_MAP.equals(propertyName)) {
idToFigureMap = (GroupMap) e.getNewValue();
fmsTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
ffcTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
rccTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
iccTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
dvccTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
rcTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
mcTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
plcTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
gcTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
vpcTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
plccTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
icTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
decomposeTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
attributeTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
specializeTool.getContext().putValue(ConstantDefinition.ID_TO_FIGURE_MAP, idToFigureMap);
} else if (ConstantDefinition.CONSTRAINT_MODEL.equals(propertyName)) {
constraintModel = (ConstraintModel) e.getNewValue();
plcTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
gcTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
vpcTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
plccTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
fmsTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
specializeTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL, constraintModel);
} else if (ConstantDefinition.CONSTRAINT_MODEL_EDITOR.equals(propertyName)) {
constraintModelEditor = (ConstraintModelEditor) e.getNewValue();
plcTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
gcTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
vpcTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
plccTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
fmsTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
specializeTool.getContext().putValue(ConstantDefinition.CONSTRAINT_MODEL_EDITOR, constraintModelEditor);
} else if (ConstantDefinition.PL_CONSTRAINT_EDITOR.equals(propertyName)) {
plConstraintEditor = (CompositeConstraintEditor) e.getNewValue();
plcTool.getContext().putValue(ConstantDefinition.PL_CONSTRAINT_EDITOR, plConstraintEditor);
} else if (ConstantDefinition.GROUP_CONSTRAINT_EDITOR.equals(propertyName)) {
gConstraintEditor = (GroupConstraintEditor) e.getNewValue();
gcTool.getContext().putValue(ConstantDefinition.GROUP_CONSTRAINT_EDITOR, gConstraintEditor);
} else if (ConstantDefinition.VP_CONSTRAINT_EDITOR.equals(propertyName)) {
vpConstraintEditor = (VPConstraintEditor) e.getNewValue();
vpcTool.getContext().putValue(ConstantDefinition.VP_CONSTRAINT_EDITOR, vpConstraintEditor);
specializeTool.getContext().putValue(ConstantDefinition.VP_CONSTRAINT_EDITOR, vpConstraintEditor);
} else if (ConstantDefinition.INTERACTION_MODEL.equals(propertyName)) {
interactionModel = (InteractionModel) e.getNewValue();
rccTool.getContext().putValue(ConstantDefinition.INTERACTION_MODEL, interactionModel);
icTool.getContext().putValue(ConstantDefinition.INTERACTION_MODEL, interactionModel);
fmsTool.getContext().putValue(ConstantDefinition.INTERACTION_MODEL, interactionModel);
} else if (ConstantDefinition.INTERACTION_MODEL_EDITOR.equals(propertyName)) {
interactionModelEditor = (InteractionModelEditor) e.getNewValue();
rccTool.getContext().putValue(ConstantDefinition.INTERACTION_MODEL_EDITOR, interactionModelEditor);
icTool.getContext().putValue(ConstantDefinition.INTERACTION_MODEL_EDITOR, interactionModelEditor);
fmsTool.getContext().putValue(ConstantDefinition.INTERACTION_MODEL_EDITOR, interactionModelEditor);
} else if (GraphicalEditor.MODEL_VALIDATION.equals(propertyName)) {
modelValidation = (ModelValidation) e.getNewValue();
iccTool.getContext().putValue(GraphicalEditor.MODEL_VALIDATION, modelValidation);
dvccTool.getContext().putValue(GraphicalEditor.MODEL_VALIDATION, modelValidation);
rcTool.getContext().putValue(GraphicalEditor.MODEL_VALIDATION, modelValidation);
mcTool.getContext().putValue(GraphicalEditor.MODEL_VALIDATION, modelValidation);
plccTool.getContext().putValue(GraphicalEditor.MODEL_VALIDATION, modelValidation);
fmsTool.getContext().putValue(GraphicalEditor.MODEL_VALIDATION, modelValidation);
fmtTool.getContext().putValue(GraphicalEditor.MODEL_VALIDATION, modelValidation);
}
}
protected class RefinementCountListener implements ActionListener {
final JPopupMenu popupMenu = new JPopupMenu();
final ButtonGroup buttonGroup = new ButtonGroup();
public RefinementCountListener() {
for (int i = 1; i < 10; i++) {
final int childCount = i;
final String num = new Integer(childCount).toString();
JRadioButtonMenuItem menuItem = new JRadioButtonMenuItem();
menuItem.setAction(new AbstractAction(num) {
@Override
public void actionPerformed(ActionEvent e) {
refinementCount.setText(num);
decomposeTool.setChildCount(childCount);
attributeTool.setChildCount(childCount);
specializeTool.setChildCount(childCount);
}
});
buttonGroup.add(menuItem);
if (refinementCount.getText().equals(num)) {
menuItem.setSelected(true);
}
popupMenu.add(menuItem);
}
}
@Override
public void actionPerformed(ActionEvent e) {
popupMenu.show(refinementCount, 0, 0);
}
}
}