svn commit: r17029 - 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-04-02 17:20:31-0700
New Revision: 17029
Modified:
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ScrollList.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementClientDependencyListModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementSupplierDependencyListModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMutableLinkedList.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLObjectFlowStateParameterListModel.java
trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSignalEventSignalList.java
Log:
Continue moving behavioural data to ListModels and simplify JLists
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java?view=diff&pathrev=17029&r1=17028&r2=17029
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ListFactory.java 2009-04-02 17:20:31-0700
@@ -55,24 +55,13 @@
final String propName) {
ScrollList list = null;
UMLModelElementListModel model = null;
+
+ Object metaType = modelElement.getClass();
+
if ("clientDependency".equals(propName)) {
- model = new UMLModelElementClientDependencyListModel();
- model.setTarget(modelElement);
- list = new ScrollList(new UMLMutableLinkedList(
- model,
- new ActionAddClientDependencyAction(),
- null,
- null,
- true));
+ model = new UMLModelElementClientDependencyListModel(metaType);
} else if ("supplierDependency".equals(propName)) {
- model = new UMLModelElementSupplierDependencyListModel();
- model.setTarget(modelElement);
- list = new ScrollList(new UMLMutableLinkedList(
- model,
- new ActionAddSupplierDependencyAction(),
- null,
- null,
- true));
+ model = new UMLModelElementSupplierDependencyListModel(metaType);
} else if ("generalization".equals(propName)) {
model = new UMLGeneralizableElementGeneralizationListModel();
} else if ("specialization".equals(propName)) {
@@ -94,19 +83,10 @@
// TODO: It's OK to change the visibility of this actions?
null, // new ActionAddPackageImport(),
null,
- null, //new ActionRemovePackageImport(),
- true));
+ null));
} else if ("parameter".equals(propName)) {
if (Model.getFacade().isAObjectFlowState(modelElement)) {
- model = new UMLObjectFlowStateParameterListModel();
- model.setTarget(modelElement);
- JList l = new UMLMutableLinkedList(model,
- new ActionAddOFSParameter(),
- new ActionNewOFSParameter(),
- new ActionRemoveOFSParameter(),
- true);
- list = new ScrollList(l);
-
+ model = new UMLObjectFlowStateParameterListModel(metaType);
} else {
model = new UMLClassifierParameterListModel();
model.setTarget(modelElement);
@@ -126,8 +106,7 @@
new UMLStereotypeBaseClassListModel(),
new ActionAddStereotypeBaseClass(),
null,
- new ActionDeleteStereotypeBaseClass(),
- true);
+ new ActionDeleteStereotypeBaseClass());
l.setCellRenderer(new DefaultListCellRenderer());
list = new ScrollList(l);
} else if ("extended_elements".equals(propName)) {
@@ -150,14 +129,14 @@
list = new ScrollList(new UMLMutableLinkedList(
model,
ActionAddAssociationSpecification.getInstance(),
- null, null, true));
+ null, null));
} else if ("qualifier".equals(propName)) {
model = new UMLAssociationEndQualifiersListModel();
} else if ("annotatedElement".equals(propName)) {
model = new UMLCommentAnnotatedElementListModel();
model.setTarget(modelElement);
UMLMutableLinkedList l = new UMLMutableLinkedList(
- model, null, null, null, true);
+ model, null, null, null);
list = new ScrollList(l);
} else if ("context".equals(propName)) {
model = new UMLSignalContextListModel();
@@ -165,7 +144,7 @@
UMLMutableLinkedList l = new UMLMutableLinkedList(
model,
new ActionAddContextSignal(), null,
- new ActionRemoveContextSignal(), true);
+ new ActionRemoveContextSignal());
list = new ScrollList(l);
} else if ("reception".equals(propName)) {
model = new UMLSignalReceptionListModel();
@@ -173,7 +152,7 @@
UMLMutableLinkedList l = new UMLMutableLinkedList(
model,
new ActionAddReceptionSignal(), null,
- new ActionRemoveReceptionSignal(), true);
+ new ActionRemoveReceptionSignal());
list = new ScrollList(l);
} else if ("extend".equals(propName)) {
model = new UMLUseCaseExtendListModel();
@@ -203,8 +182,7 @@
new UMLMutableLinkedList(model,
ActionAddClassifierRoleBase.SINGLETON,
null,
- ActionRemoveClassifierRoleBase.getInstance(),
- true);
+ ActionRemoveClassifierRoleBase.getInstance());
list = new ScrollList(l);
} else if ("availableFeature".equals(propName)) {
model = new UMLClassifierRoleAvailableFeaturesListModel();
@@ -224,7 +202,7 @@
model.setTarget(modelElement);
JList l = new UMLMutableLinkedList(model,
new ActionAddCreateActionInstantiation(),
- null, null, true);
+ null, null);
list = new ScrollList(l);
} else if ("constrainingElement".equals(propName)) {
model = new UMLCollaborationConstrainingElementListModel();
@@ -248,7 +226,7 @@
JList l = new UMLMutableLinkedList(model,
new ActionAddInstanceClassifier(
Model.getMetaTypes().getClassifier()),
- null, null, true);
+ null, null);
list = new ScrollList(l);
} else if ("resident".equals(propName)) {
model = new UMLContainerResidentListModel();
@@ -282,8 +260,7 @@
JList l = new UMLMutableLinkedList(model,
new ActionAddOFSState(),
null,
- new ActionRemoveOFSState(),
- true);
+ new ActionRemoveOFSState());
list = new ScrollList(l);
} else if ("internalTransition".equals(propName)) {
model = new UMLStateInternalTransitionListModel();
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ScrollList.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ScrollList.java?view=diff&pathrev=17029&r1=17028&r2=17029
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ScrollList.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/ScrollList.java 2009-04-02 17:20:31-0700
@@ -56,10 +56,21 @@
* in a scrollable view.
* @param listModel The model from which to build the list
*/
- public ScrollList(UMLModelElementListModel listModel) {
+ public ScrollList(final UMLModelElementListModel listModel) {
setHorizontalScrollBarPolicy(
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
- list = new UMLLinkedList(listModel, listModel.isShowIcon(), listModel.isShowPath());
+ if (listModel.getAddAction() == null && listModel.getNewAction() == null && listModel.getRemoveAction() == null) {
+ list = new UMLLinkedList(
+ listModel,
+ listModel.isShowIcon(),
+ listModel.isShowPath());
+ } else {
+ list = new UMLMutableLinkedList(
+ listModel,
+ listModel.getAddAction(),
+ listModel.getNewAction(),
+ listModel.getRemoveAction());
+ }
setViewportView(list);
}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementClientDependencyListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementClientDependencyListModel.java?view=diff&pathrev=17029&r1=17028&r2=17029
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementClientDependencyListModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementClientDependencyListModel.java 2009-04-02 17:20:31-0700
@@ -26,6 +26,7 @@
import org.argouml.model.Model;
import org.argouml.uml.ui.UMLModelElementListModel2;
+import org.argouml.uml.ui.foundation.core.ActionAddClientDependencyAction;
/**
* The listmodel of the client dependencies for some modelelement.
@@ -39,8 +40,12 @@
/**
* Constructor for UMLModelElementClientDependencyListModel.
*/
- public UMLModelElementClientDependencyListModel() {
- super("clientDependency", Model.getMetaTypes().getDependency());
+ public UMLModelElementClientDependencyListModel(Object metaType) {
+ super("clientDependency",
+ metaType,
+ new ActionAddClientDependencyAction(),
+ null,
+ null);
}
/*
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java?view=diff&pathrev=17029&r1=17028&r2=17029
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementListModel.java 2009-04-02 17:20:31-0700
@@ -30,6 +30,7 @@
import java.util.Collection;
import java.util.Iterator;
+import javax.swing.Action;
import javax.swing.DefaultListModel;
import javax.swing.JPopupMenu;
@@ -42,6 +43,9 @@
import org.argouml.model.RemoveAssociationEvent;
import org.argouml.ui.targetmanager.TargetEvent;
import org.argouml.ui.targetmanager.TargetListener;
+import org.argouml.uml.ui.AbstractActionAddModelElement2;
+import org.argouml.uml.ui.AbstractActionNewModelElement;
+import org.argouml.uml.ui.AbstractActionRemoveElement;
import org.tigris.gef.base.Diagram;
import org.tigris.gef.presentation.Fig;
@@ -62,6 +66,11 @@
private String eventName = null;
private Object listTarget = null;
+ private AbstractActionAddModelElement2 addAction = null;
+ private AbstractActionNewModelElement newAction = null;
+ private AbstractActionRemoveElement removeAction = null;
+
+
/**
* Flag to indicate wether list events should be fired
*/
@@ -153,6 +162,30 @@
* to update the list model from the UML data
* @param theMetaType the type of model element that the list model
* is designed to contain.
+ */
+ public UMLModelElementListModel(
+ final String name,
+ final Object theMetaType,
+ final AbstractActionAddModelElement2 addAction,
+ final AbstractActionNewModelElement newAction,
+ final AbstractActionRemoveElement removeAction) {
+ super();
+ this.metaType = theMetaType;
+ eventName = name;
+ showIcon = true;
+ showPath = true;
+ this.addAction = addAction;
+ this.newAction = newAction;
+ this.removeAction = removeAction;
+ }
+
+ /**
+ * Constructor for UMLModelElementListModel2.
+ *
+ * @param name the name of the event to listen to, which triggers us
+ * to update the list model from the UML data
+ * @param theMetaType the type of model element that the list model
+ * is designed to contain.
* @param reverseTheDropConnection tells the JList to reverse the
* connection made and drop during dnd.
*/
@@ -557,4 +590,16 @@
boolean isShowPath() {
return showPath;
}
+
+ public AbstractActionAddModelElement2 getAddAction() {
+ return addAction;
+ }
+
+ public AbstractActionNewModelElement getNewAction() {
+ return newAction;
+ }
+
+ public AbstractActionRemoveElement getRemoveAction() {
+ return removeAction;
+ }
}
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementSupplierDependencyListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementSupplierDependencyListModel.java?view=diff&pathrev=17029&r1=17028&r2=17029
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementSupplierDependencyListModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLModelElementSupplierDependencyListModel.java 2009-04-02 17:20:31-0700
@@ -25,6 +25,7 @@
package org.argouml.core.propertypanels.ui;
import org.argouml.model.Model;
+import org.argouml.uml.ui.foundation.core.ActionAddSupplierDependencyAction;
/**
* @since Oct 12, 2002
@@ -36,8 +37,8 @@
/**
* Constructor for UMLModelElementSupplierDependencyListModel.
*/
- public UMLModelElementSupplierDependencyListModel() {
- super("supplierDependency", Model.getMetaTypes().getDependency(), true);
+ public UMLModelElementSupplierDependencyListModel(Object metaType) {
+ super("supplierDependency", metaType, new ActionAddSupplierDependencyAction(), null, null);
}
/*
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMutableLinkedList.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMutableLinkedList.java?view=diff&pathrev=17029&r1=17028&r2=17029
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMutableLinkedList.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLMutableLinkedList.java 2009-04-02 17:20:31-0700
@@ -118,12 +118,11 @@
public UMLMutableLinkedList(UMLModelElementListModel dataModel,
AbstractActionAddModelElement2 theAddAction,
AbstractActionNewModelElement theNewAction,
- AbstractActionRemoveElement theDeleteAction, boolean showIcon) {
- super(dataModel, showIcon);
+ AbstractActionRemoveElement theDeleteAction) {
+ super(dataModel, true);
setAddAction(theAddAction);
setNewAction(theNewAction);
- if (theDeleteAction != null)
- deleteAction = null;
+ deleteAction = theDeleteAction;
addMouseListener(this);
}
@@ -137,7 +136,7 @@
public UMLMutableLinkedList(UMLModelElementListModel dataModel,
AbstractActionAddModelElement2 theAddAction,
AbstractActionNewModelElement theNewAction) {
- this(dataModel, theAddAction, theNewAction, null, true);
+ this(dataModel, theAddAction, theNewAction, null);
}
/**
@@ -148,7 +147,7 @@
*/
public UMLMutableLinkedList(UMLModelElementListModel dataModel,
AbstractActionAddModelElement2 theAddAction) {
- this(dataModel, theAddAction, null, null, true);
+ this(dataModel, theAddAction, null, null);
}
/**
@@ -159,7 +158,7 @@
*/
public UMLMutableLinkedList(UMLModelElementListModel dataModel,
AbstractActionNewModelElement theNewAction) {
- this(dataModel, null, theNewAction, null, true);
+ this(dataModel, null, theNewAction, null);
}
/**
@@ -168,9 +167,10 @@
* @param dataModel the data model
*/
protected UMLMutableLinkedList(UMLModelElementListModel dataModel) {
- this(dataModel, null, null, null, true);
- setDelete(false);
- deleteAction = null;
+ this(dataModel,
+ dataModel.getAddAction(),
+ dataModel.getNewAction(),
+ dataModel.getRemoveAction());
}
/**
@@ -232,9 +232,9 @@
* @param delete
* The delete to set
*/
- public void setDelete(boolean delete) {
- deletePossible = delete;
- }
+// public void setDelete(boolean delete) {
+// deletePossible = delete;
+// }
/**
* Returns the addAction.
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLObjectFlowStateParameterListModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLObjectFlowStateParameterListModel.java?view=diff&pathrev=17029&r1=17028&r2=17029
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLObjectFlowStateParameterListModel.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLObjectFlowStateParameterListModel.java 2009-04-02 17:20:31-0700
@@ -25,7 +25,6 @@
package org.argouml.core.propertypanels.ui;
import org.argouml.model.Model;
-import org.argouml.uml.ui.UMLModelElementListModel2;
/**
* @author mkl
@@ -35,8 +34,11 @@
/**
* Constructor for UMLObjectFlowStateParameterListModel.
*/
- public UMLObjectFlowStateParameterListModel() {
- super("parameter");
+ public UMLObjectFlowStateParameterListModel(Object metaType) {
+ super("parameter", metaType,
+ new ActionAddOFSParameter(),
+ new ActionNewOFSParameter(),
+ new ActionRemoveOFSParameter());
}
/*
Modified: trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSignalEventSignalList.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSignalEventSignalList.java?view=diff&pathrev=17029&r1=17028&r2=17029
==============================================================================
--- trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSignalEventSignalList.java (original)
+++ trunk/src/argouml-core-umlpropertypanels/src/org/argouml/core/propertypanels/ui/UMLSignalEventSignalList.java 2009-04-02 17:20:31-0700
@@ -41,9 +41,7 @@
* @param dataModel the model
*/
public UMLSignalEventSignalList(UMLModelElementListModel dataModel) {
- super(dataModel, (AbstractActionAddModelElement2) null, null, null,
- true);
- setDelete(false);
+ super(dataModel, (AbstractActionAddModelElement2) null, null, null);
}
/*
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1526643
To unsubscribe from this discussion, e-mail: [[email protected]].