svn commit: r17662 - trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui
Bob Tarling <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bobtarling
Date: 2009-12-17 15:50:58-0800
New Revision: 17662
Added:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationEndTypeComboBoxModel.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/UMLGeneralizationPowertypeComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMetaClassComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementNamespaceComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSearchableComboBox.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStateMachineContextComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStructuralFeatureTypeComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStubStateComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSubmachineStateComboBoxModel.java
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/UMLAssociationRoleBaseComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBox.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedClassifierComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedOperationComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLLinkAssociationComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBoxModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMultiplicityPanel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTemplateParameterDefaultElementComboBoxModel.java
Log:
Use our own local ComboxBox and model that doesn't listen for target change
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=17662&r1=17661&r2=17662
==============================================================================
--- 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-17 15:50:58-0800
@@ -39,20 +39,15 @@
import org.argouml.model.Model;
import org.argouml.uml.ui.UMLCheckBox2;
import org.argouml.uml.ui.UMLComboBox2;
-import org.argouml.uml.ui.UMLComboBoxModel2;
import org.argouml.uml.ui.UMLComboBoxNavigator;
import org.argouml.uml.ui.UMLDerivedCheckBox;
import org.argouml.uml.ui.UMLRadioButtonPanel;
-import org.argouml.uml.ui.UMLSearchableComboBox;
import org.argouml.uml.ui.behavior.activity_graphs.UMLActionSynchCheckBox;
import org.argouml.uml.ui.behavior.collaborations.ActionSetAssociationRoleBase;
import org.argouml.uml.ui.behavior.common_behavior.UMLActionAsynchronousCheckBox;
import org.argouml.uml.ui.behavior.state_machines.ActionSetContextStateMachine;
import org.argouml.uml.ui.behavior.state_machines.ActionSetStubStateReferenceState;
import org.argouml.uml.ui.behavior.state_machines.ActionSetSubmachineStateSubmachine;
-import org.argouml.uml.ui.behavior.state_machines.UMLStateMachineContextComboBoxModel;
-import org.argouml.uml.ui.behavior.state_machines.UMLStubStateComboBoxModel;
-import org.argouml.uml.ui.behavior.state_machines.UMLSubmachineStateComboBoxModel;
import org.argouml.uml.ui.foundation.core.ActionSetAssociationEndType;
import org.argouml.uml.ui.foundation.core.ActionSetGeneralizationPowertype;
import org.argouml.uml.ui.foundation.core.ActionSetModelElementNamespace;
@@ -62,22 +57,17 @@
import org.argouml.uml.ui.foundation.core.UMLAssociationEndNavigableCheckBox;
import org.argouml.uml.ui.foundation.core.UMLAssociationEndOrderingCheckBox;
import org.argouml.uml.ui.foundation.core.UMLAssociationEndTargetScopeCheckbox;
-import org.argouml.uml.ui.foundation.core.UMLAssociationEndTypeComboBoxModel;
import org.argouml.uml.ui.foundation.core.UMLBehavioralFeatureQueryCheckBox;
import org.argouml.uml.ui.foundation.core.UMLClassActiveCheckBox;
import org.argouml.uml.ui.foundation.core.UMLFeatureOwnerScopeCheckBox;
import org.argouml.uml.ui.foundation.core.UMLGeneralizableElementAbstractCheckBox;
import org.argouml.uml.ui.foundation.core.UMLGeneralizableElementLeafCheckBox;
import org.argouml.uml.ui.foundation.core.UMLGeneralizableElementRootCheckBox;
-import org.argouml.uml.ui.foundation.core.UMLGeneralizationPowertypeComboBoxModel;
-import org.argouml.uml.ui.foundation.core.UMLModelElementNamespaceComboBoxModel;
import org.argouml.uml.ui.foundation.core.UMLModelElementVisibilityRadioButtonPanel;
import org.argouml.uml.ui.foundation.core.UMLOperationConcurrencyRadioButtonPanel;
import org.argouml.uml.ui.foundation.core.UMLParameterDirectionKindRadioButtonPanel;
import org.argouml.uml.ui.foundation.core.UMLStructuralFeatureChangeabilityRadioButtonPanel;
-import org.argouml.uml.ui.foundation.core.UMLStructuralFeatureTypeComboBoxModel;
import org.argouml.uml.ui.foundation.extension_mechanisms.ActionSetTagDefinitionType;
-import org.argouml.uml.ui.foundation.extension_mechanisms.UMLMetaClassComboBoxModel;
import org.tigris.swidgets.GridLayout2;
/**
@@ -149,13 +139,11 @@
} else if ("specification".equals(prop.getName())) {
UMLPlainTextDocument document =
new UMLOperationSpecificationDocument(prop.getName(), target);
- document.setTarget(target);
UMLTextArea osta = new UMLTextArea(document);
osta.setRows(3);
control = new JScrollPane(osta);
} else if ("body".equals(prop.getName())) {
UMLPlainTextDocument document = new UMLCommentBodyDocument(prop.getName(), target);
- document.setTarget(target);
UMLTextArea text = new UMLTextArea(document);
text.setLineWrap(true);
text.setRows(5);
@@ -199,7 +187,6 @@
// if not, it is a control and must be labeled...
addControl(panel, prop.getName(), control);
}
-
}
}
@@ -355,12 +342,14 @@
private void buildComboPanel(
final JPanel panel,
final Object target,
- final PropertyMeta prop) {
+ final PropertyMeta prop) {
+
JComponent comp = null;
+
+ final String propertyName = prop.getName();
if ("namespace".equals(prop.getName())) {
- final UMLComboBoxModel2 model =
- new UMLModelElementNamespaceComboBoxModel();
- model.setTarget(target);
+ final UMLComboBoxModel model =
+ new UMLModelElementNamespaceComboBoxModel(propertyName, target);
final JComboBox combo = new UMLSearchableComboBox(
model,
new ActionSetModelElementNamespace(), true);
@@ -369,33 +358,26 @@
"label.namespace.navigate.tooltip"),
combo);
} else if ("type".equals(prop.getName())) {
+ final UMLComboBoxModel model;
if (Model.getFacade().isATemplateParameter(target)) {
- final UMLComboBoxModel2 model =
- new UMLConcreteModelElementComboBoxModel();
- Object parameter = Model.getFacade().getParameter(target);
- model.setTarget(parameter.getClass());
- final JComboBox combo = new UMLComboBox2(
- model,
- null, true);
- comp = new UMLComboBoxNavigator(Translator.localize(
- "label.classifierinstate.navigate.tooltip"),
- combo);
+ model = new UMLStructuralFeatureTypeComboBoxModel(
+ propertyName,
+ Model.getFacade().getParameter(target));
} else {
- final UMLComboBoxModel2 model =
- new UMLStructuralFeatureTypeComboBoxModel();
- model.setTarget(target);
- final JComboBox combo = new UMLComboBox2(
- model,
- // TODO: The action is different for
- // attributes and parameters. Issue #5222
- ActionSetStructuralFeatureType.getInstance());
- comp = combo;
+ model = new UMLStructuralFeatureTypeComboBoxModel(
+ propertyName,
+ target);
}
+ final JComboBox combo = new UMLComboBox(
+ model,
+ // TODO: The action is different for
+ // attributes and parameters. Issue #5222
+ ActionSetStructuralFeatureType.getInstance());
+ comp = combo;
} else if ("base".equals(prop.getName())) {
if (Model.getFacade().isAAssociationRole(target)) {
- final UMLComboBoxModel2 model =
- new UMLAssociationRoleBaseComboBoxModel();
- model.setTarget(target);
+ final UMLComboBoxModel model =
+ new UMLAssociationRoleBaseComboBoxModel(propertyName, target);
final JComboBox combo = new UMLSearchableComboBox(
model,
new ActionSetAssociationRoleBase(), true);
@@ -406,36 +388,31 @@
//
}
} else if ("powertype".equals(prop.getName())) {
- final UMLComboBoxModel2 model =
- new UMLGeneralizationPowertypeComboBoxModel();
- model.setTarget(target);
- final JComboBox combo = new UMLComboBox2(
+ final UMLComboBoxModel model =
+ new UMLGeneralizationPowertypeComboBoxModel(propertyName, target);
+ final JComboBox combo = new UMLComboBox(
model,
ActionSetGeneralizationPowertype.getInstance());
comp = combo;
} else if ("multiplicity".equals(prop.getName())) {
- final UMLMultiplicityPanel mPanel = new UMLMultiplicityPanel();
- mPanel.setTarget(target);
+ final UMLMultiplicityPanel mPanel = new UMLMultiplicityPanel(propertyName, target);
comp = mPanel;
} else if ("activator".equals(prop.getName())) {
final UMLComboBoxModel model =
- new UMLMessageActivatorComboBoxModel();
- model.setTarget(target);
+ new UMLMessageActivatorComboBoxModel(propertyName, target);
final JComboBox combo = new UMLMessageActivatorComboBox(model);
comp = combo;
} else if ("operation".equals(prop.getName())) {
if (Model.getFacade().isACallEvent(target)) {
- UMLComboBoxModel2 model =
- new UMLCallEventOperationComboBoxModel();
- model.setTarget(target);
+ UMLComboBoxModel model =
+ new UMLCallEventOperationComboBoxModel(propertyName, target);
JComboBox combo = new UMLCallEventOperationComboBox(model);
comp = new UMLComboBoxNavigator(Translator.localize(
"label.operation.navigate.tooltip"),
combo);
} else {
final UMLComboBoxModel model =
- new UMLCallActionOperationComboBoxModel();
- model.setTarget(target);
+ new UMLCallActionOperationComboBoxModel(propertyName, target);
UMLComboBox operationComboBox =
new UMLCallActionOperationComboBox(model);
comp = new UMLComboBoxNavigator(
@@ -443,69 +420,61 @@
operationComboBox);
}
} else if ("representedClassifier".equals(prop.getName())) {
- final UMLComboBoxModel2 model =
- new UMLCollaborationRepresentedClassifierComboBoxModel();
- model.setTarget(target);
- UMLComboBox2 combo =
- new UMLComboBox2(model,
+ final UMLComboBoxModel model =
+ new UMLCollaborationRepresentedClassifierComboBoxModel(propertyName, target);
+ UMLComboBox combo =
+ new UMLComboBox(model,
new ActionSetRepresentedClassifierCollaboration());
comp = new UMLComboBoxNavigator(Translator.localize(
"label.represented-classifier.navigate.tooltip"),
combo);
} else if ("representedOperation".equals(prop.getName())) {
- final UMLComboBoxModel2 model =
- new UMLCollaborationRepresentedOperationComboBoxModel();
- model.setTarget(target);
- UMLComboBox2 combo = new UMLComboBox2(model,
+ final UMLComboBoxModel model =
+ new UMLCollaborationRepresentedOperationComboBoxModel(propertyName, target);
+ UMLComboBox combo = new UMLComboBox(model,
new ActionSetRepresentedOperationCollaboration());
comp = new UMLComboBoxNavigator(Translator.localize(
"label.represented-operation.navigate.tooltip"),
combo);
} else if ("context".equals(prop.getName())) {
- final UMLComboBoxModel2 model =
- new UMLStateMachineContextComboBoxModel();
- model.setTarget(target);
- UMLComboBox2 combo = new UMLComboBox2(model,
+ final UMLComboBoxModel model =
+ new UMLStateMachineContextComboBoxModel(propertyName, target);
+ UMLComboBox combo = new UMLComboBox(model,
ActionSetContextStateMachine.getInstance());
comp = new UMLComboBoxNavigator(Translator.localize(
"label.context.navigate.tooltip"),
combo);
} else if ("association".equals(prop.getName())) {
- final UMLComboBoxModel2 model =
- new UMLLinkAssociationComboBoxModel();
- model.setTarget(target);
+ final UMLComboBoxModel model =
+ new UMLLinkAssociationComboBoxModel(propertyName, target);
comp = new UMLComboBoxNavigator(Translator.localize(
"label.association.navigate.tooltip"),
new UMLSearchableComboBox(model,
new ActionSetLinkAssociation(), true));
} else if ("participant".equals(prop.getName())) {
- final UMLComboBoxModel2 model =
- new UMLAssociationEndTypeComboBoxModel();
- model.setTarget(target);
- comp = new UMLComboBox2(model,
+ final UMLComboBoxModel model =
+ new UMLAssociationEndTypeComboBoxModel(propertyName, target);
+ comp = new UMLComboBox(model,
ActionSetAssociationEndType.getInstance(), true);
} else if ("submachine".equals(prop.getName())) {
- final UMLComboBoxModel2 model =
- new UMLSubmachineStateComboBoxModel();
- model.setTarget(target);
- final JComboBox submachineBox = new UMLComboBox2(model,
+ final UMLComboBoxModel model =
+ new UMLSubmachineStateComboBoxModel(propertyName, target);
+ final JComboBox submachineBox = new UMLComboBox(model,
ActionSetSubmachineStateSubmachine.getInstance());
comp = new UMLComboBoxNavigator(Translator.localize(
"tooltip.nav-submachine"), submachineBox);
} else if ("referenceState".equals(prop.getName())) {
- final UMLComboBoxModel2 model =
- new UMLStubStateComboBoxModel();
- model.setTarget(target);
+ final UMLComboBoxModel model =
+ new UMLStubStateComboBoxModel(propertyName, target);
final JComboBox referencestateBox =
- new UMLComboBox2(model,
+ new UMLComboBox(model,
ActionSetStubStateReferenceState.getInstance());
comp = new UMLComboBoxNavigator(Translator.localize(
"tooltip.nav-stubstate"), referencestateBox);
} else if ("tagType".equals(prop.getName())) {
- UMLComboBoxModel2 model = new UMLMetaClassComboBoxModel();
- model.setTarget(target);
- final JComboBox typeComboBox = new UMLComboBox2(model,
+ UMLComboBoxModel model = new UMLMetaClassComboBoxModel(propertyName, target);
+ final JComboBox typeComboBox = new UMLComboBox(model,
ActionSetTagDefinitionType.getInstance());
comp = new UMLComboBoxNavigator(
Translator.localize("label.type.navigate.tooltip"),
@@ -521,8 +490,7 @@
combo);
} else if ("defaultElement".equals(prop.getName())) {
final UMLComboBoxModel model =
- new UMLTemplateParameterDefaultElementComboBoxModel();
- model.setTarget(target);
+ new UMLTemplateParameterDefaultElementComboBoxModel(propertyName, target);
final JComboBox combo = new UMLComboBox(model, null);
comp = new UMLComboBoxNavigator(
Translator.localize("label.type.navigate.tooltip"),
@@ -546,10 +514,9 @@
UMLPlainTextDocument document = null;
if ("name".equals(prop.getName())) {
if (Model.getFacade().isATemplateParameter(target)) {
- document = new UMLModelElementNameDocument(prop.getName(), Model.getFacade().getParameter(target));
- } else {
- document = new UMLModelElementNameDocument(prop.getName(), target);
+ target = Model.getFacade().getParameter(target);
}
+ document = new UMLModelElementNameDocument(prop.getName(), target);
} else if ("discriminator".equals(prop.getName())) {
document = new UMLDiscriminatorNameDocument(prop.getName(), target);
} else if ("location".equals(prop.getName())) {
Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationEndTypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationEndTypeComboBoxModel.java?view=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationEndTypeComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,62 @@
+// $Id: UMLAssociationEndTypeComboBoxModel.java 11516 2006-11-25 04:30:15Z tfmorris $
+// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+// $header$
+package org.argouml.core.propertypanels.ui;
+
+import org.argouml.model.Model;
+
+/**
+ * @since Nov 2, 2002
+ * @author [email protected]
+ */
+public class UMLAssociationEndTypeComboBoxModel
+ extends UMLStructuralFeatureTypeComboBoxModel {
+
+ /**
+ * The class uid
+ */
+ private static final long serialVersionUID = 61755481049159333L;
+
+ /**
+ * Constructor for UMLAssociationEndTypeComboBoxModel.
+ */
+ public UMLAssociationEndTypeComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, target);
+ setTarget(target);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
+ */
+ protected Object getSelectedModelElement() {
+ if (getTarget() != null) {
+ return Model.getFacade().getType(getTarget());
+ }
+ return null;
+ }
+
+}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationRoleBaseComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationRoleBaseComboBoxModel.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationRoleBaseComboBoxModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLAssociationRoleBaseComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -28,7 +28,6 @@
import java.util.Collection;
import org.argouml.model.Model;
-import org.argouml.uml.ui.UMLComboBoxModel2;
/**
* The combo box model for the base of an association-role.
@@ -37,15 +36,18 @@
* @since Oct 4, 2002
* @author [email protected]
*/
-public class UMLAssociationRoleBaseComboBoxModel extends UMLComboBoxModel2 {
+public class UMLAssociationRoleBaseComboBoxModel extends UMLComboBoxModel {
private Collection others = new ArrayList();
/**
* Constructor for UMLAssociationRoleBaseComboBoxModel.
*/
- public UMLAssociationRoleBaseComboBoxModel() {
- super("base", true);
+ public UMLAssociationRoleBaseComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+ setTarget(target);
}
/*
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBoxModel.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBoxModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallActionOperationComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -37,8 +37,11 @@
/**
* The constructor.
*/
- public UMLCallActionOperationComboBoxModel() {
- super("operation", true);
+ public UMLCallActionOperationComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+ setTarget(target);
}
/**
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBox.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBox.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBox.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBox.java 2009-12-17 15:50:58-0800
@@ -27,9 +27,6 @@
import java.awt.event.ActionEvent;
import org.argouml.model.Model;
-import org.argouml.uml.ui.UMLComboBox2;
-import org.argouml.uml.ui.UMLComboBoxModel2;
-import org.argouml.uml.ui.UMLSearchableComboBox;
/**
@@ -41,7 +38,7 @@
*
* @param arg0 the model
*/
- public UMLCallEventOperationComboBox(UMLComboBoxModel2 arg0) {
+ public UMLCallEventOperationComboBox(UMLComboBoxModel arg0) {
super(arg0, null); // no external action; we do it ourselves
setEditable(false);
}
@@ -53,9 +50,9 @@
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
Object source = e.getSource();
- if (source instanceof UMLComboBox2) {
- Object selected = ((UMLComboBox2) source).getSelectedItem();
- Object target = ((UMLComboBox2) source).getTarget();
+ if (source instanceof UMLComboBox) {
+ Object selected = ((UMLComboBox) source).getSelectedItem();
+ Object target = ((UMLComboBox) source).getTarget();
if (Model.getFacade().isACallEvent(target)
&& Model.getFacade().isAOperation(selected)) {
if (Model.getFacade().getOperation(target) != selected) {
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBoxModel.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBoxModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCallEventOperationComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -28,26 +28,29 @@
import java.util.Collection;
import org.argouml.model.Model;
-import org.argouml.ui.targetmanager.TargetManager;
-import org.argouml.uml.ui.UMLComboBoxModel2;
-/**
- *
- * @author [email protected]
- */
-class UMLCallEventOperationComboBoxModel extends UMLComboBoxModel2 {
+class UMLCallEventOperationComboBoxModel extends UMLComboBoxModel {
+
+ /**
+ * The class uid
+ */
+ private static final long serialVersionUID = 2793208767387711088L;
+
/**
* The constructor.
*/
- public UMLCallEventOperationComboBoxModel() {
- super("operation", true);
+ public UMLCallEventOperationComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+ setTarget(target);
}
/*
* @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
*/
protected void buildModelList() {
- Object target = TargetManager.getInstance().getModelTarget();
+ Object target = getTarget();
Collection ops = new ArrayList();
if (Model.getFacade().isACallEvent(target)) {
Object ns = Model.getFacade().getNamespace(target);
@@ -78,7 +81,7 @@
* @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
*/
protected Object getSelectedModelElement() {
- Object target = TargetManager.getInstance().getModelTarget();
+ Object target = getTarget();
if (Model.getFacade().isACallEvent(target)) {
return Model.getFacade().getOperation(target);
}
@@ -89,7 +92,7 @@
* @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(java.lang.Object)
*/
protected boolean isValidElement(Object element) {
- Object target = TargetManager.getInstance().getModelTarget();
+ Object target = getTarget();
if (Model.getFacade().isACallEvent(target)) {
return element == Model.getFacade().getOperation(target);
}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedClassifierComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedClassifierComboBoxModel.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedClassifierComboBoxModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedClassifierComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -41,13 +41,16 @@
* @author michiel
*/
class UMLCollaborationRepresentedClassifierComboBoxModel
- extends UMLComboBoxModel2 {
+ extends UMLComboBoxModel {
/**
* Constructor for UMLCollaborationRepresentedClassifierComboBoxModel.
*/
- public UMLCollaborationRepresentedClassifierComboBoxModel() {
- super("representedClassifier", true);
+ public UMLCollaborationRepresentedClassifierComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+ setTarget(propertyName);
}
/*
@@ -86,13 +89,5 @@
protected Object getSelectedModelElement() {
return Model.getFacade().getRepresentedClassifier(getTarget());
}
-
- /*
- * @see org.argouml.uml.ui.UMLComboBoxModel2#modelChanged(org.argouml.model.UmlChangeEvent)
- */
- @Override
- public void modelChanged(UmlChangeEvent evt) {
- /* Do nothing by design. */
- }
}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedOperationComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedOperationComboBoxModel.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedOperationComboBoxModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLCollaborationRepresentedOperationComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -41,13 +41,21 @@
* @author michiel
*/
class UMLCollaborationRepresentedOperationComboBoxModel
- extends UMLComboBoxModel2 {
+ extends UMLComboBoxModel {
/**
+ *
+ */
+ private static final long serialVersionUID = -501052343770609804L;
+
+ /**
* Constructor for UMLCollaborationRepresentedOperationComboBoxModel.
*/
- public UMLCollaborationRepresentedOperationComboBoxModel() {
- super("representedOperation", true);
+ public UMLCollaborationRepresentedOperationComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+ setTarget(target);
}
/*
@@ -82,12 +90,4 @@
protected Object getSelectedModelElement() {
return Model.getFacade().getRepresentedOperation(getTarget());
}
-
- /*
- * @see org.argouml.uml.ui.UMLComboBoxModel2#modelChanged(org.argouml.model.UmlChangeEvent)
- */
- @Override
- public void modelChanged(UmlChangeEvent evt) {
- /* Do nothing by design. */
- }
}
Added: 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=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLEditableComboBox.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,308 @@
+// $Id: UMLEditableComboBox.java 11531 2006-11-27 17:40:06Z tfmorris $
+// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+
+import javax.swing.Action;
+import javax.swing.BorderFactory;
+import javax.swing.ComboBoxEditor;
+import javax.swing.Icon;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTextField;
+import javax.swing.border.BevelBorder;
+import javax.swing.plaf.basic.BasicComboBoxEditor;
+
+import org.argouml.application.helpers.ResourceLoaderWrapper;
+import org.argouml.uml.ui.UMLListCellRenderer2;
+
+/**
+ * An editable combobox. Upon pressing enter the text entered by the user is
+ * sent as an actioncommand to the actionlistener (this). The item that's being
+ * edited is sent to the method doIt after that. The developer should implement
+ * this method
+ * @author [email protected]
+ * @since Jan 4, 2003
+ */
+public abstract class UMLEditableComboBox extends UMLComboBox implements
+ FocusListener {
+
+ /**
+ * The comboboxeditor for editable uml comboboxes. This has to be changed
+ * since it controls the rendering of the textfield where the user can edit
+ * the list elements. Setitem has to give the correct value. Furthermore,
+ * the standard comboboxeditor (BasicComboBoxEditor) does not support
+ * showing icons.
+ *
+ * @author [email protected]
+ * @since Jan 5, 2003
+ */
+ protected class UMLComboBoxEditor extends BasicComboBoxEditor {
+
+ /**
+ * A panel which helps us to show the editable textfield for this
+ * combobox (including the Icon).
+ *
+ * @author [email protected]
+ * @since Jan 5, 2003
+ */
+ private class UMLImagePanel extends JPanel {
+
+ /**
+ * The label that shows the icon.
+ */
+ private JLabel imageIconLabel = new JLabel();
+ /**
+ * The textfield the user can edit.
+ */
+ private JTextField theTextField;
+
+ /**
+ * Constructs a UMLImagePanel
+ * @param textField The textfield the user can edit
+ * @param showIcon boolean which must be true if an icon is to be
+ * shown.
+ */
+ public UMLImagePanel(JTextField textField, boolean showIcon) {
+ setLayout(new BorderLayout());
+ theTextField = textField;
+ setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));
+ if (showIcon) {
+ // we don't want to show some nasty gray background
+ // color, now do we?
+ imageIconLabel.setOpaque(true);
+ imageIconLabel.setBackground(theTextField.getBackground());
+ add(imageIconLabel, BorderLayout.WEST);
+ }
+ add(theTextField, BorderLayout.CENTER);
+ theTextField.addFocusListener(UMLEditableComboBox.this);
+ }
+
+ public void setText(String text) {
+ theTextField.setText(text);
+ }
+
+ public String getText() {
+ return theTextField.getText();
+ }
+
+ /**
+ * Sets the icon. Calls repaint to redraw the panel
+ * @param i The icon to be shown.
+ */
+ public void setIcon(Icon i) {
+ if (i != null) {
+ imageIconLabel.setIcon(i);
+ // necessary to create distance between
+ // the textfield and the icon.
+ imageIconLabel.setBorder(BorderFactory
+ .createEmptyBorder(0, 2, 0, 2));
+
+ } else {
+ imageIconLabel.setIcon(null);
+ imageIconLabel.setBorder(null);
+ }
+ imageIconLabel.invalidate();
+ validate();
+ repaint();
+ }
+
+ public void selectAll() {
+ theTextField.selectAll();
+ }
+
+ public void addActionListener(ActionListener l) {
+ theTextField.addActionListener(l);
+ }
+
+ public void removeActionListener(ActionListener l) {
+ theTextField.removeActionListener(l);
+ }
+
+ }
+
+ private UMLImagePanel panel;
+
+ /**
+ * True if an icon should be shown.
+ */
+ private boolean theShowIcon;
+
+
+ /**
+ * Constructor for UMLComboBoxEditor.
+ *
+ * @param showIcon true if an icon is to be shown
+ */
+ public UMLComboBoxEditor(boolean showIcon) {
+ super();
+ panel = new UMLImagePanel(editor, showIcon);
+ setShowIcon(showIcon);
+ }
+
+ /*
+ * @see javax.swing.ComboBoxEditor#setItem(java.lang.Object)
+ */
+ public void setItem(Object anObject) {
+ if (((UMLComboBoxModel) getModel()).contains(anObject)) {
+ editor.setText(((UMLListCellRenderer2) getRenderer())
+ .makeText(anObject));
+ if (theShowIcon && (anObject != null))
+ panel.setIcon(ResourceLoaderWrapper.getInstance()
+ .lookupIcon(anObject));
+ } else
+ super.setItem(anObject);
+
+ }
+
+ /**
+ * Returns the showIcon.
+ * @return boolean
+ */
+ public boolean isShowIcon() {
+ return theShowIcon;
+ }
+
+ /**
+ * Sets the showIcon.
+ * @param showIcon The showIcon to set
+ */
+ public void setShowIcon(boolean showIcon) {
+ theShowIcon = showIcon;
+ }
+
+ /*
+ * @see javax.swing.ComboBoxEditor#getEditorComponent()
+ */
+ public Component getEditorComponent() {
+ return panel;
+ }
+
+ /*
+ * @see javax.swing.ComboBoxEditor#addActionListener(java.awt.event.ActionListener)
+ */
+ public void addActionListener(ActionListener l) {
+ panel.addActionListener(l);
+ }
+
+
+
+ /*
+ * @see javax.swing.ComboBoxEditor#removeActionListener(java.awt.event.ActionListener)
+ */
+ public void removeActionListener(ActionListener l) {
+ panel.removeActionListener(l);
+ }
+
+ /*
+ * @see javax.swing.ComboBoxEditor#selectAll()
+ */
+ public void selectAll() {
+ super.selectAll();
+ }
+
+ /*
+ * @see javax.swing.ComboBoxEditor#getItem()
+ */
+ public Object getItem() {
+ return panel.getText();
+ }
+
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBox2#UMLComboBox2( UMLComboBoxModel2,
+ * Action, boolean)
+ */
+ public UMLEditableComboBox(UMLComboBoxModel model, Action selectAction,
+ boolean showIcon) {
+ super(model, selectAction, showIcon);
+ setEditable(true);
+ setEditor(new UMLComboBoxEditor(showIcon));
+ getEditor().addActionListener(this);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBox2#UMLComboBox2( UMLComboBoxModel2,
+ * Action)
+ */
+ public UMLEditableComboBox(UMLComboBoxModel arg0, Action selectAction) {
+ this(arg0, selectAction, true);
+ }
+
+ /*
+ * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+ * TODO: From ComboBox javadoc - "This method is public as an
+ * implementation side effect. do not call or override."
+ * We should find some other way to implement this.
+ */
+ public void actionPerformed(ActionEvent e) {
+ super.actionPerformed(e);
+ if (e.getSource() instanceof JTextField) {
+ Object oldValue = getSelectedItem();
+ ComboBoxEditor editor = getEditor();
+ Object item = editor.getItem();
+ doOnEdit(item);
+ // next statement is necessary to update the textfield
+ // if the selection is equal to what was allready
+ // selected
+ if (oldValue == getSelectedItem())
+ getEditor().setItem(getSelectedItem());
+ }
+ }
+
+ /**
+ * This method is called after the user has edited the editable textfield
+ * and has press enter. ActionPerformed determines that the action is about
+ * editing the textfield and calls this method afterwards.
+ * @param item The item in the comboboxeditor. In this case it's the text of
+ * the editable textfield.
+ */
+ protected abstract void doOnEdit(Object item);
+
+ /*
+ * @see java.awt.event.FocusListener#focusGained(java.awt.event.FocusEvent)
+ */
+ public final void focusGained(FocusEvent arg0) {
+ // ignored
+ }
+
+ /*
+ * TODO: This is a temporary method of making sure the model is updated
+ * on loss of focus of a combo box. In the long term we should attempt to
+ * update the model on each keypress.
+ *
+ * @see java.awt.event.FocusListener#focusLost(java.awt.event.FocusEvent)
+ */
+ public final void focusLost(FocusEvent arg0) {
+ doOnEdit(getEditor().getItem());
+ }
+}
Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLGeneralizationPowertypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLGeneralizationPowertypeComboBoxModel.java?view=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLGeneralizationPowertypeComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,116 @@
+// $Id: UMLGeneralizationPowertypeComboBoxModel.java 16961 2009-03-26 18:26:21Z tfmorris $
+// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+// $header$
+package org.argouml.core.propertypanels.ui;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.argouml.kernel.Project;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.Model;
+import org.argouml.uml.util.PathComparator;
+
+/**
+ * TODO: For UML 2.x, powertypes are accessed indirectly through the
+ * GeneralizationSets that contain a Generalization.
+ *
+ * @since Nov 3, 2002
+ * @author [email protected]
+ */
+public class UMLGeneralizationPowertypeComboBoxModel
+ extends UMLComboBoxModel {
+
+ /**
+ * The class uid
+ */
+ private static final long serialVersionUID = -7164447610238810497L;
+
+ /**
+ * Constructor for UMLGeneralizationPowertypeComboBoxModel.
+ */
+ public UMLGeneralizationPowertypeComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+ Model.getPump().addClassModelEventListener(this,
+ Model.getMetaTypes().getNamespace(), "ownedElement");
+ setTarget(target);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
+ */
+ protected Object getSelectedModelElement() {
+ if (getTarget() != null) {
+ return Model.getFacade().getPowertype(getTarget());
+ }
+ return null;
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
+ */
+ protected void buildModelList() {
+ Set<Object> elements = new TreeSet<Object>(new PathComparator());
+ Project p = ProjectManager.getManager().getCurrentProject();
+ for (Object model : p.getUserDefinedModelList()) {
+ elements.addAll(Model.getModelManagementHelper()
+ .getAllModelElementsOfKind(model,
+ Model.getMetaTypes().getClassifier()));
+ }
+
+ elements.addAll(p.getProfileConfiguration().findByMetaType(
+ Model.getMetaTypes().getClassifier()));
+ removeAllElements();
+ addAll(elements);
+ }
+
+ @Override
+ protected void buildMinimalModelList() {
+ Collection list = new ArrayList(1);
+ Object element = getSelectedModelElement();
+ if (element == null) {
+ element = " ";
+ }
+ list.add(element);
+ setElements(list);
+ }
+
+ @Override
+ protected boolean isLazy() {
+ return true;
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
+ */
+ protected boolean isValidElement(Object element) {
+ return Model.getFacade().isAClassifier(element);
+ }
+
+}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLLinkAssociationComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLLinkAssociationComboBoxModel.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLLinkAssociationComboBoxModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLLinkAssociationComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -24,27 +24,32 @@
package org.argouml.core.propertypanels.ui;
-import java.beans.PropertyChangeEvent;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import org.argouml.model.Model;
-import org.argouml.model.UmlChangeEvent;
-import org.argouml.uml.ui.UMLComboBoxModel2;
/**
* The model for the combobox to show the Association of the Link.
*
* @author Michiel
*/
-class UMLLinkAssociationComboBoxModel extends UMLComboBoxModel2 {
+class UMLLinkAssociationComboBoxModel extends UMLComboBoxModel {
+
+ /**
+ * The UID.
+ */
+ private static final long serialVersionUID = 3232437122889409351L;
/**
* Constructor for UMLModelElementNamespaceComboBoxModel.
*/
- public UMLLinkAssociationComboBoxModel() {
- super("assocation", true);
+ public UMLLinkAssociationComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+ setTarget(target);
}
/*
@@ -103,30 +108,4 @@
}
return null;
}
-
- /*
- * @see org.argouml.uml.ui.UMLComboBoxModel2#modelChanged(org.argouml.model.UmlChangeEvent)
- */
- @Override
- public void modelChanged(UmlChangeEvent evt) {
- /*
- * Rebuild the list from scratch to be sure it's correct.
- */
- Object t = getTarget();
- if (t != null
- && evt.getSource() == t
- && evt.getNewValue() != null) {
- buildModelList();
- /* In some cases (se issue 3780) the list remains the same, but
- * the selected item differs. Without the next step,
- * the combo would not be refreshed.
- */
- setSelectedItem(getSelectedModelElement());
- }
- }
-
- /**
- * The UID.
- */
- private static final long serialVersionUID = 3232437122889409351L;
}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBoxModel.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBoxModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMessageActivatorComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -37,8 +37,11 @@
/**
* Constructor for UMLMessageActivatorComboBoxModel.
*/
- public UMLMessageActivatorComboBoxModel() {
- super("activator", false);
+ public UMLMessageActivatorComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, false);
+ setTarget(target);
}
/*
Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMetaClassComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMetaClassComboBoxModel.java?view=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMetaClassComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,103 @@
+// $Id: UMLMetaClassComboBoxModel.java 14238 2008-03-27 16:03:28Z tfmorris $
+// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+// $header$
+package org.argouml.core.propertypanels.ui;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.argouml.model.Model;
+
+/**
+ * A model for selecting a UML metaclass. Originally designed for use in
+ * selecting the base class of stereotypes in UML 1.3, but now used to select
+ * the type of a TagDefinition.
+ *
+ * @author mkl
+ */
+public class UMLMetaClassComboBoxModel extends UMLComboBoxModel {
+
+ /**
+ * The class uid
+ */
+ private static final long serialVersionUID = 5941365798992694830L;
+
+ private List<String> metaClasses;
+
+ /**
+ * Construct a default combo box model.
+ */
+ public UMLMetaClassComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+
+ Collection<String> tmpMetaClasses =
+ Model.getCoreHelper().getAllMetatypeNames();
+
+ if (tmpMetaClasses instanceof List) {
+ metaClasses = (List<String>) tmpMetaClasses;
+ } else {
+ metaClasses = new LinkedList<String>(tmpMetaClasses);
+ }
+ tmpMetaClasses.addAll(Model.getCoreHelper().getAllMetaDatatypeNames());
+ try {
+ Collections.sort(metaClasses);
+ } catch (UnsupportedOperationException e) {
+ // We got passed an unmodifiable List. Copy it and sort the result
+ metaClasses = new LinkedList<String>(tmpMetaClasses);
+ Collections.sort(metaClasses);
+ }
+ setTarget(target);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
+ */
+ @Override
+ protected Object getSelectedModelElement() {
+ if (getTarget() != null) {
+ return Model.getFacade().getType(getTarget());
+ }
+ return null;
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
+ */
+ protected void buildModelList() {
+ setElements(metaClasses);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
+ */
+ protected boolean isValidElement(Object element) {
+ return metaClasses.contains(element);
+ }
+
+}
Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementNamespaceComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementNamespaceComboBoxModel.java?view=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementNamespaceComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,143 @@
+// $Id: UMLModelElementNamespaceComboBoxModel.java 15943 2008-10-26 20:53:28Z mvw $
+// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.apache.log4j.Logger;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.Model;
+import org.argouml.model.UmlChangeEvent;
+import org.argouml.uml.ui.UMLComboBoxModel2;
+import org.argouml.uml.util.PathComparator;
+
+/**
+ * A model for a namespace combo box.
+ *
+ * @since Oct 10, 2002
+ * @author [email protected], alexb
+ */
+class UMLModelElementNamespaceComboBoxModel extends UMLComboBoxModel {
+
+ /**
+ * Logger.
+ */
+ private static final Logger LOG =
+ Logger.getLogger(UMLModelElementNamespaceComboBoxModel.class);
+
+ /**
+ * The UID.
+ */
+ private static final long serialVersionUID = -775116993155949065L;
+
+ /**
+ * Constructor for UMLModelElementNamespaceComboBoxModel.
+ */
+ public UMLModelElementNamespaceComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super("namespace", true);
+ Model.getPump().addClassModelEventListener(this,
+ Model.getMetaTypes().getNamespace(), "ownedElement");
+ setTarget(target);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
+ */
+ protected boolean isValidElement(Object o) {
+ return Model.getFacade().isANamespace(o)
+ && Model.getCoreHelper().isValidNamespace(getTarget(), o);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
+ */
+ @Override
+ protected void buildMinimalModelList() {
+ Object target = getTarget();
+ Collection c = new ArrayList(1);
+
+ if (target != null) {
+ Object namespace = Model.getFacade().getNamespace(target);
+ if (namespace != null && !c.contains(namespace)) {
+ c.add(namespace);
+ }
+ }
+ setElements(c);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
+ */
+ protected void buildModelList() {
+ Set<Object> elements = new TreeSet<Object>(new PathComparator());
+
+ Object model =
+ ProjectManager.getManager().getCurrentProject().getRoot();
+ Object target = getTarget();
+ elements.addAll(
+ Model.getCoreHelper().getAllPossibleNamespaces(target, model));
+
+ /* These next lines for the case that the current namespace
+ * is not a valid one... Which of course should not happen,
+ * but it does - see the project attached to issue 3772.
+ */
+ /* TODO: Enhance the isValidNamespace function so
+ * that this never happens.
+ */
+ if (target != null) {
+ Object namespace = Model.getFacade().getNamespace(target);
+ if (namespace != null && !elements.contains(namespace)) {
+ elements.add(namespace);
+ LOG.warn("The current namespace is not a valid one!");
+ }
+ }
+
+ // Our comparator will throw an InvalidElementException if the old
+ // list contains deleted elements (eg after a new project is loaded)
+ // so remove all the old contents first
+ removeAllElements();
+ addAll(elements);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
+ */
+ protected Object getSelectedModelElement() {
+ if (getTarget() != null) {
+ return Model.getFacade().getNamespace(getTarget());
+ }
+ return null;
+ }
+
+ @Override
+ protected boolean isLazy() {
+ return true;
+ }
+}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMultiplicityPanel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMultiplicityPanel.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMultiplicityPanel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMultiplicityPanel.java 2009-12-17 15:50:58-0800
@@ -66,11 +66,13 @@
/**
* Constructor
*/
- public UMLMultiplicityPanel() {
+ public UMLMultiplicityPanel(
+ final String propertyName,
+ final Object target) {
super(new BorderLayout());
multiplicityComboBoxModel =
- new MultiplicityComboBoxModel("multiplicity");
+ new MultiplicityComboBoxModel(propertyName);
checkBox = new MultiplicityCheckBox();
multiplicityComboBox =
@@ -81,6 +83,7 @@
multiplicityComboBox.addItemListener(this);
add(checkBox, BorderLayout.WEST);
add(multiplicityComboBox, BorderLayout.CENTER);
+ setTarget(target);
}
/**
Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSearchableComboBox.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSearchableComboBox.java?view=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSearchableComboBox.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,111 @@
+// $Id: UMLSearchableComboBox.java 11516 2006-11-25 04:30:15Z tfmorris $
+// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import javax.swing.Action;
+import javax.swing.ComboBoxModel;
+
+import org.argouml.model.Model;
+import org.argouml.uml.ui.UMLListCellRenderer2;
+
+/**
+ * A searchable combobox. Searchable means that the user only has to type the
+ * starting of a modelelement name to select that modelelement. The first
+ * modelelement that conforms to the typed text is selected.
+ * @author [email protected]
+ * @since Jan 5, 2003
+ */
+public class UMLSearchableComboBox extends UMLEditableComboBox {
+
+ /**
+ * Constructor for UMLSearchableComboBox.
+ * @param model the model
+ * @param selectAction the action for selection
+ * @param showIcon true if we show an icon in the list
+ */
+ public UMLSearchableComboBox(UMLComboBoxModel model,
+ Action selectAction, boolean showIcon) {
+ super(model, selectAction, showIcon);
+ }
+
+ /**
+ * Constructor for UMLSearchableComboBox.
+ * @param arg0 the model
+ * @param selectAction the action for selection
+ */
+ public UMLSearchableComboBox(UMLComboBoxModel arg0,
+ Action selectAction) {
+ this(arg0, selectAction, true);
+ }
+
+ /**
+ * Searches amongst the modelelements (the elements in the listmodel) for an
+ * item that conforms to the parameter item. If such an element is a
+ * ModelElement, the name should start with the item (which is a String).
+ * Otherwise the text that is shown in the combobox should start with the
+ * text. As the element is found, this is made to the selected item.
+ *
+ * {@inheritDoc}
+ */
+ protected void doOnEdit(Object item) {
+ Object element = search(item);
+ if (element != null) {
+ setSelectedItem(element);
+ }
+ }
+
+ /**
+ * Does the actual searching. Returns the item found or null if there is no
+ * item found.
+ * @param item the string entered by the user
+ * @return Object the found object from the list, or null if none found
+ */
+ protected Object search(Object item) {
+ String text = (String) item;
+ ComboBoxModel model = getModel();
+ for (int i = 0; i < model.getSize(); i++) {
+ Object element = model.getElementAt(i);
+ if (Model.getFacade().isAModelElement(element)) {
+ if (getRenderer() instanceof UMLListCellRenderer2) {
+ String labelText = ((UMLListCellRenderer2) getRenderer())
+ .makeText(element);
+ if (labelText != null && labelText.startsWith(text)) {
+ return element;
+ }
+ }
+ if (Model.getFacade().isAModelElement(element)) {
+ Object/*MModelElement*/ elem = element;
+ String name = Model.getFacade().getName(elem);
+ if (name != null && name.startsWith(text)) {
+ return element;
+ }
+ }
+ }
+
+ }
+ return null;
+ }
+
+}
Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStateMachineContextComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStateMachineContextComboBoxModel.java?view=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStateMachineContextComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,94 @@
+// $Id: UMLStateMachineContextComboBoxModel.java 15837 2008-09-30 23:53:25Z bobtarling $
+// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.argouml.kernel.Project;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.Model;
+import org.argouml.model.UmlChangeEvent;
+
+/**
+ * Listmodel for the context of a statemachine.
+ *
+ * @since Dec 6, 2002
+ * @author [email protected]
+ */
+public class UMLStateMachineContextComboBoxModel
+ extends UMLComboBoxModel {
+
+ /**
+ * The class uid
+ */
+ private static final long serialVersionUID = 7260158369581330096L;
+
+ /**
+ * Constructor for UMLStateMachineContextListModel.
+ */
+ public UMLStateMachineContextComboBoxModel(String propertyName, final Object target) {
+ super(propertyName, false);
+ setTarget(target);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLModelElementListModel2#buildModelList()
+ */
+ protected void buildModelList() {
+ Collection elements = new ArrayList();
+ Project p = ProjectManager.getManager().getCurrentProject();
+ for (Object model : p.getUserDefinedModelList()) {
+ elements.addAll(Model
+ .getModelManagementHelper().getAllModelElementsOfKind(
+ model, Model.getMetaTypes().getClassifier()));
+ elements.addAll(Model
+ .getModelManagementHelper().getAllModelElementsOfKind(
+ model,
+ Model.getMetaTypes().getBehavioralFeature()));
+ }
+
+ setElements(elements);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
+ */
+ protected boolean isValidElement(Object element) {
+ return Model.getFacade().isAClassifier(element)
+ || Model.getFacade().isABehavioralFeature(element);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
+ */
+ protected Object getSelectedModelElement() {
+ return Model.getFacade().getContext(getTarget());
+ }
+
+ public void modelChanged(UmlChangeEvent evt) {
+ /* Do nothing by design. */
+ }
+}
Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStructuralFeatureTypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStructuralFeatureTypeComboBoxModel.java?view=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStructuralFeatureTypeComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,153 @@
+// $Id: UMLStructuralFeatureTypeComboBoxModel.java 16339 2008-12-11 23:31:22Z tfmorris $
+// Copyright (c) 1996-2008 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.argouml.kernel.Project;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.Model;
+import org.argouml.model.UmlChangeEvent;
+import org.argouml.uml.util.PathComparator;
+
+/**
+ * The combobox model for the type belonging to some attribute.
+ *
+ * @since Nov 2, 2002
+ * @author [email protected]
+ */
+public class UMLStructuralFeatureTypeComboBoxModel extends UMLComboBoxModel {
+
+
+ /**
+ * Constructor for UMLStructuralFeatureTypeComboBoxModel.
+ */
+ public UMLStructuralFeatureTypeComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true); // Allow null
+ setTarget(target);
+ }
+
+ /*
+ * This is explained by WFR 2 of a StructuralFeature:
+ * The type of a StructuralFeature must be a Class, DataType, or Interface.
+ *
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
+ */
+ protected boolean isValidElement(Object element) {
+ return Model.getFacade().isAClass(element)
+ || Model.getFacade().isAInterface(element)
+ || Model.getFacade().isADataType(element);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
+ */
+ @SuppressWarnings("unchecked")
+ protected void buildModelList() {
+ Set<Object> elements = new TreeSet<Object>(new PathComparator());
+
+ Project p = ProjectManager.getManager().getCurrentProject();
+ if (p == null) {
+ return;
+ }
+
+ for (Object model : p.getUserDefinedModelList()) {
+ elements.addAll(Model.getModelManagementHelper()
+ .getAllModelElementsOfKind(
+ model, Model.getMetaTypes().getUMLClass()));
+ elements.addAll(Model.getModelManagementHelper()
+ .getAllModelElementsOfKind(
+ model, Model.getMetaTypes().getInterface()));
+ elements.addAll(Model.getModelManagementHelper()
+ .getAllModelElementsOfKind(
+ model, Model.getMetaTypes().getDataType()));
+ }
+
+ elements.addAll(p.getProfileConfiguration().findByMetaType(
+ Model.getMetaTypes().getClassifier()));
+
+ setElements(elements);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ protected void buildMinimalModelList() {
+ Collection list = new ArrayList(1);
+ Object element = getSelectedModelElement();
+ if (element != null) {
+ list.add(element);
+ }
+ setElements(list);
+ }
+
+ @Override
+ protected boolean isLazy() {
+ return true;
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
+ */
+ protected Object getSelectedModelElement() {
+ Object o = null;
+ if (getTarget() != null) {
+ o = Model.getFacade().getType(getTarget());
+ }
+ return o;
+ }
+
+ @Override
+ protected void addOtherModelEventListeners(Object newTarget) {
+ super.addOtherModelEventListeners(newTarget);
+
+ Model.getPump().addClassModelEventListener(this,
+ Model.getMetaTypes().getNamespace(), "ownedElement");
+ Model.getPump().addClassModelEventListener(this,
+ Model.getMetaTypes().getUMLClass(), "name");
+ Model.getPump().addClassModelEventListener(this,
+ Model.getMetaTypes().getInterface(), "name");
+ Model.getPump().addClassModelEventListener(this,
+ Model.getMetaTypes().getDataType(), "name");
+ }
+
+ @Override
+ protected void removeOtherModelEventListeners(Object oldTarget) {
+ super.removeOtherModelEventListeners(oldTarget);
+
+ Model.getPump().removeClassModelEventListener(this,
+ Model.getMetaTypes().getNamespace(), "ownedElement");
+ Model.getPump().removeClassModelEventListener(this,
+ Model.getMetaTypes().getUMLClass(), "name");
+ Model.getPump().removeClassModelEventListener(this,
+ Model.getMetaTypes().getInterface(), "name");
+ Model.getPump().removeClassModelEventListener(this,
+ Model.getMetaTypes().getDataType(), "name");
+ }
+}
Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStubStateComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStubStateComboBoxModel.java?view=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLStubStateComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,109 @@
+// $Id: UMLStubStateComboBoxModel.java 16325 2008-12-11 17:30:41Z tfmorris $
+// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import org.argouml.model.Model;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+/**
+ * @author [email protected]
+ */
+class UMLStubStateComboBoxModel extends UMLComboBoxModel {
+
+ /**
+ * The class uid
+ */
+ private static final long serialVersionUID = -3567856233571414072L;
+
+ /**
+ * Constructor for UMLStubStateComboBoxModel.
+ */
+ public UMLStubStateComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+ setTarget(target);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
+ */
+ protected boolean isValidElement(Object element) {
+ return (Model.getFacade().isAStateVertex(element)
+ && !Model.getFacade().isAConcurrentRegion(element)
+ && Model.getFacade().getName(element) != null);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
+ */
+ protected void buildModelList() {
+ removeAllElements();
+ Object stateMachine = null;
+ if (Model.getFacade().isASubmachineState(
+ Model.getFacade().getContainer(getTarget()))) {
+ stateMachine = Model.getFacade().getSubmachine(
+ Model.getFacade().getContainer(getTarget()));
+ }
+ if (stateMachine != null) {
+ ArrayList v = (ArrayList) Model.getStateMachinesHelper()
+ .getAllPossibleSubvertices(
+ Model.getFacade().getTop(stateMachine));
+ ArrayList v2 = (ArrayList) v.clone();
+ Iterator it = v2.iterator();
+ while (it.hasNext()) {
+ Object o = it.next();
+ if (!isValidElement(o)) {
+ v.remove(o);
+ }
+ }
+ setElements(v);
+ }
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
+ */
+ protected Object getSelectedModelElement() {
+ String objectName = null;
+ Object container = null;
+ if (getTarget() != null) {
+ objectName = Model.getFacade().getReferenceState(getTarget());
+ container = Model.getFacade().getContainer(getTarget());
+ if (container != null
+ && Model.getFacade().isASubmachineState(container)
+ && Model.getFacade().getSubmachine(container) != null) {
+
+ return Model.getStateMachinesHelper()
+ .getStatebyName(objectName,
+ Model.getFacade().getTop(Model.getFacade()
+ .getSubmachine(container)));
+ }
+ }
+ return null;
+ }
+
+}
Added: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSubmachineStateComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSubmachineStateComboBoxModel.java?view=markup&pathrev=17662
==============================================================================
--- (empty file)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSubmachineStateComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -0,0 +1,82 @@
+// $Id: UMLSubmachineStateComboBoxModel.java 11516 2006-11-25 04:30:15Z tfmorris $
+// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Rights Reserved. Permission to use, copy, modify, and distribute this
+// software and its documentation without fee, and without a written
+// agreement is hereby granted, provided that the above copyright notice
+// and this paragraph appear in all copies. This software program and
+// documentation are copyrighted by The Regents of the University of
+// California. The software program and documentation are supplied "AS
+// IS", without any accompanying services from The Regents. The Regents
+// does not warrant that the operation of the program will be
+// uninterrupted or error-free. The end-user understands that the program
+// was developed for research purposes and is advised not to rely
+// exclusively on the program for any reason. IN NO EVENT SHALL THE
+// UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,
+// SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS,
+// ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
+// THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY
+// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
+// PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
+// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
+// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+
+package org.argouml.core.propertypanels.ui;
+
+import org.argouml.kernel.Project;
+import org.argouml.kernel.ProjectManager;
+import org.argouml.model.Model;
+
+/**
+ * @since Dec 15, 2002
+ * @author [email protected]
+ */
+class UMLSubmachineStateComboBoxModel extends UMLComboBoxModel {
+
+ /**
+ * The class uid
+ */
+ private static final long serialVersionUID = -8661322478068344016L;
+
+ /**
+ * Constructor for UMLSubmachineStateComboBoxModel.
+ */
+ public UMLSubmachineStateComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true);
+ setTarget(target);
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
+ */
+ protected boolean isValidElement(Object element) {
+ return (Model.getFacade().isAStateMachine(element)
+ && element != Model.getStateMachinesHelper()
+ .getStateMachine(getTarget()));
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
+ */
+ protected void buildModelList() {
+ removeAllElements();
+ Project p = ProjectManager.getManager().getCurrentProject();
+ Object model = p.getModel();
+ setElements(Model.getStateMachinesHelper()
+ .getAllPossibleStatemachines(model, getTarget()));
+ }
+
+ /*
+ * @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
+ */
+ protected Object getSelectedModelElement() {
+ if (getTarget() != null) {
+ return Model.getFacade().getSubmachine(getTarget());
+ }
+ return null;
+ }
+
+}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTemplateParameterDefaultElementComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTemplateParameterDefaultElementComboBoxModel.java?view=diff&pathrev=17662&r1=17661&r2=17662
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTemplateParameterDefaultElementComboBoxModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLTemplateParameterDefaultElementComboBoxModel.java 2009-12-17 15:50:58-0800
@@ -41,12 +41,19 @@
*/
public class UMLTemplateParameterDefaultElementComboBoxModel extends UMLComboBoxModel {
+ /**
+ * The class uid
+ */
+ private static final long serialVersionUID = -4042236776070635624L;
/**
* Constructor for UMLStructuralFeatureTypeComboBoxModel.
*/
- public UMLTemplateParameterDefaultElementComboBoxModel() {
- super("parameter", true); // Allow null
+ public UMLTemplateParameterDefaultElementComboBoxModel(
+ final String propertyName,
+ final Object target) {
+ super(propertyName, true); // Allow null
+ setTarget(target);
}
/*
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=2431343
To unsubscribe from this discussion, e-mail: [[email protected]].