Author: bobtarling Date: 2009-12-18 10:12:21-0800 New Revision: 17671 Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBox.java trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBox.java trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLEditableComboBox.java trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBox.java
Log: Refactor UMLComboBox to remove action arg to constructor (we get action from the model) Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java?view=diff&pathrev=17671&r1=17670&r2=17671 ============================================================================== --- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java (original) +++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/SwingUIFactory.java 2009-12-18 10:12:21-0800 @@ -358,7 +358,7 @@ propertyName, target); } - comp = new UMLComboBox(model, model.getAction()); + comp = new UMLComboBox(model); } else if ("base".equals(prop.getName())) { if (Model.getFacade().isAAssociationRole(target)) { final UMLComboBoxModel model = @@ -376,8 +376,7 @@ final UMLComboBoxModel model = new UMLGeneralizationPowertypeComboBoxModel(propertyName, target); final JComboBox combo = new UMLComboBox( - model, - model.getAction()); + model); comp = combo; } else if ("multiplicity".equals(prop.getName())) { final UMLMultiplicityPanel mPanel = new UMLMultiplicityPanel(propertyName, target); @@ -409,22 +408,21 @@ } else if ("representedClassifier".equals(prop.getName())) { final UMLComboBoxModel model = new UMLCollaborationRepresentedClassifierComboBoxModel(propertyName, target); - UMLComboBox combo = new UMLComboBox(model, model.getAction()); + UMLComboBox combo = new UMLComboBox(model); comp = new UMLComboBoxNavigator(Translator.localize( "label.represented-classifier.navigate.tooltip"), combo); } else if ("representedOperation".equals(prop.getName())) { final UMLComboBoxModel model = new UMLCollaborationRepresentedOperationComboBoxModel(propertyName, target); - UMLComboBox combo = new UMLComboBox(model, model.getAction()); + UMLComboBox combo = new UMLComboBox(model); comp = new UMLComboBoxNavigator(Translator.localize( "label.represented-operation.navigate.tooltip"), combo); } else if ("context".equals(prop.getName())) { final UMLComboBoxModel model = new UMLStateMachineContextComboBoxModel(propertyName, target); - UMLComboBox combo = new UMLComboBox(model, - model.getAction()); + UMLComboBox combo = new UMLComboBox(model); comp = new UMLComboBoxNavigator(Translator.localize( "label.context.navigate.tooltip"), combo); @@ -440,26 +438,23 @@ final UMLComboBoxModel model = new UMLAssociationEndTypeComboBoxModel(propertyName, target); comp = new UMLComboBox(model, - model.getAction(), true); + true); } else if ("submachine".equals(prop.getName())) { final UMLComboBoxModel model = new UMLSubmachineStateComboBoxModel(propertyName, target); - final JComboBox submachineBox = new UMLComboBox(model, - model.getAction()); + final JComboBox submachineBox = new UMLComboBox(model); comp = new UMLComboBoxNavigator(Translator.localize( "tooltip.nav-submachine"), submachineBox); } else if ("referenceState".equals(prop.getName())) { final UMLComboBoxModel model = new UMLStubStateComboBoxModel(propertyName, target); final JComboBox referencestateBox = - new UMLComboBox(model, - model.getAction()); + new UMLComboBox(model); comp = new UMLComboBoxNavigator(Translator.localize( "tooltip.nav-stubstate"), referencestateBox); } else if ("tagType".equals(prop.getName())) { UMLComboBoxModel model = new UMLMetaClassComboBoxModel(propertyName, target); - final JComboBox typeComboBox = new UMLComboBox(model, - model.getAction()); + final JComboBox typeComboBox = new UMLComboBox(model); comp = new UMLComboBoxNavigator( Translator.localize("label.type.navigate.tooltip"), typeComboBox); @@ -468,14 +463,14 @@ } else if ("parameter".equals(prop.getName())) { final UMLComboBoxModel model = new UMLTemplateParameterParameterComboBoxModel(target); - final JComboBox combo = new UMLComboBox(model, model.getAction()); + final JComboBox combo = new UMLComboBox(model); comp = new UMLComboBoxNavigator( Translator.localize("label.type.navigate.tooltip"), combo); } else if ("defaultElement".equals(prop.getName())) { final UMLComboBoxModel model = new UMLTemplateParameterDefaultElementComboBoxModel(propertyName, target); - final JComboBox combo = new UMLComboBox(model, model.getAction()); + final JComboBox combo = new UMLComboBox(model); comp = new UMLComboBoxNavigator( Translator.localize("label.type.navigate.tooltip"), combo); Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBox.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBox.java?view=diff&pathrev=17671&r1=17670&r2=17671 ============================================================================== --- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBox.java (original) +++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBox.java 2009-12-18 10:12:21-0800 @@ -35,7 +35,7 @@ * @param arg0 the model */ public UMLCallActionOperationComboBox(UMLComboBoxModel arg0, Action action) { - super(arg0, action); + super(arg0); setEditable(false); } Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBox.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBox.java?view=diff&pathrev=17671&r1=17670&r2=17671 ============================================================================== --- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBox.java (original) +++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLComboBox.java 2009-12-18 10:12:21-0800 @@ -49,15 +49,13 @@ * Constructor for UMLComboBox. Via the given action, the * action for this combobox is done. * @param model the ComboBoxModel - * @param action the action // TODO used for what/when? * @param showIcon true if an icon should be shown in front of the items */ - public UMLComboBox(UMLComboBoxModel model, Action action, - boolean showIcon) { + public UMLComboBox(UMLComboBoxModel model, boolean showIcon) { super(model); - this.action = action; - if (action != null) { - addActionListener(action); + this.action = model.getAction(); + if (this.action != null) { + addActionListener(this.action); } setRenderer(new UMLListCellRenderer2(showIcon)); addPopupMenuListener(model); @@ -67,11 +65,9 @@ * The constructor. * * @param model the ComboBoxModel - * @param action the action that is called whenever the - * combo selection changes */ - public UMLComboBox(UMLComboBoxModel model, Action action) { - this(model, action, true); + public UMLComboBox(UMLComboBoxModel model) { + this(model, true); } @Override Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLEditableComboBox.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLEditableComboBox.java?view=diff&pathrev=17671&r1=17670&r2=17671 ============================================================================== --- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLEditableComboBox.java (original) +++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLEditableComboBox.java 2009-12-18 10:12:21-0800 @@ -244,7 +244,7 @@ */ public UMLEditableComboBox(UMLComboBoxModel model, Action selectAction, boolean showIcon) { - super(model, selectAction, showIcon); + super(model, showIcon); setEditable(true); setEditor(new UMLComboBoxEditor(showIcon)); getEditor().addActionListener(this); Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBox.java Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBox.java?view=diff&pathrev=17671&r1=17670&r2=17671 ============================================================================== --- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBox.java (original) +++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBox.java 2009-12-18 10:12:21-0800 @@ -50,7 +50,7 @@ */ public UMLMessageActivatorComboBox( final UMLComboBoxModel model, Action action) { - super(model, action, false); + super(model, false); setRenderer(new UMLListCellRenderer2(true)); } ------------------------------------------------------ http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2431545 To unsubscribe from this discussion, e-mail: [[email protected]].
