Author: mvw
Date: 2007-12-10 10:22:11-0800
New Revision: 13897
Added:
branches/work_issue4925_mvw/org/argouml/profile/internal/InitProfileSubsystem.java
- copied, changed from r13896, /trunk/src_new/org/argouml/profile/internal/InitProfileSubsystem.java
branches/work_issue4925_mvw/org/argouml/uml/util/PathComparator.java
- copied unchanged from r13896, /trunk/src_new/org/argouml/uml/util/PathComparator.java
Removed:
branches/work_issue4925_mvw/org/argouml/profile/InitProfileSubsystem.java
Modified:
branches/work_issue4925_mvw/ (props changed)
branches/work_issue4925_mvw/META-INF/MANIFEST.MF
branches/work_issue4925_mvw/org/argouml/application/Main.java
branches/work_issue4925_mvw/org/argouml/profile/ProfileFacade.java
branches/work_issue4925_mvw/org/argouml/ui/cmd/SettingsTabShortcuts.java
branches/work_issue4925_mvw/org/argouml/uml/diagram/ui/StylePanelFigMessage.java
branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValues.java
branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValuesModel.java
branches/work_issue4925_mvw/org/argouml/uml/ui/UMLMultiplicityPanel.java
branches/work_issue4925_mvw/org/argouml/uml/ui/UMLTableCellRenderer.java
branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java
branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/ActionSetTagDefinitionType.java
branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/PropPanelTagDefinition.java
branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java
Log:
Update the branch to latest revision.
Modified: branches/work_issue4925_mvw/META-INF/MANIFEST.MF
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/META-INF/MANIFEST.MF?view=diff&rev=13897&p1=branches/work_issue4925_mvw/META-INF/MANIFEST.MF&p2=branches/work_issue4925_mvw/META-INF/MANIFEST.MF&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/META-INF/MANIFEST.MF (original)
+++ branches/work_issue4925_mvw/META-INF/MANIFEST.MF 2007-12-10 10:22:11-0800
@@ -36,6 +36,7 @@
org.argouml.pattern.cognitive.critics,
org.argouml.persistence,
org.argouml.profile,
+ org.argouml.profile.internal,
org.argouml.swingext,
org.argouml.taskmgmt,
org.argouml.ui,
Modified: branches/work_issue4925_mvw/org/argouml/application/Main.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/application/Main.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/application/Main.java&p2=branches/work_issue4925_mvw/org/argouml/application/Main.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/application/Main.java (original)
+++ branches/work_issue4925_mvw/org/argouml/application/Main.java 2007-12-10 10:22:11-0800
@@ -69,7 +69,7 @@
import org.argouml.notation.providers.uml.InitNotationUml;
import org.argouml.notation.ui.InitNotationUI;
import org.argouml.persistence.PersistenceManager;
-import org.argouml.profile.InitProfileSubsystem;
+import org.argouml.profile.internal.InitProfileSubsystem;
import org.argouml.ui.ArgoFrame;
import org.argouml.ui.LookAndFeelMgr;
import org.argouml.ui.ProjectBrowser;
@@ -878,7 +878,6 @@
LOG.debug("Module " + module + " not found");
}
}
- ModuleLoader2.doLoad(false);
}
/*
Removed: branches/work_issue4925_mvw/org/argouml/profile/InitProfileSubsystem.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/profile/InitProfileSubsystem.java?view=auto&rev=13896
Modified: branches/work_issue4925_mvw/org/argouml/profile/ProfileFacade.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/profile/ProfileFacade.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/profile/ProfileFacade.java&p2=branches/work_issue4925_mvw/org/argouml/profile/ProfileFacade.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/profile/ProfileFacade.java (original)
+++ branches/work_issue4925_mvw/org/argouml/profile/ProfileFacade.java 2007-12-10 10:22:11-0800
@@ -65,7 +65,10 @@
+ " isn't initialized!");
}
- static void setManager(ProfileManager profileManager) {
+ /**
+ * @param profileManager the manager of the profiles to be used
+ */
+ public static void setManager(ProfileManager profileManager) {
manager = profileManager;
}
Copied: branches/work_issue4925_mvw/org/argouml/profile/internal/InitProfileSubsystem.java (from r13896, /trunk/src_new/org/argouml/profile/internal/InitProfileSubsystem.java)
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/profile/internal/InitProfileSubsystem.java?view=diff&rev=13897&p1=/trunk/src_new/org/argouml/profile/internal/InitProfileSubsystem.java&p2=branches/work_issue4925_mvw/org/argouml/profile/internal/InitProfileSubsystem.java&r1=13896&r2=13897
==============================================================================
--- /trunk/src_new/org/argouml/profile/internal/InitProfileSubsystem.java (original)
+++ branches/work_issue4925_mvw/org/argouml/profile/internal/InitProfileSubsystem.java 2007-12-10 10:22:11-0800
@@ -25,8 +25,10 @@
package org.argouml.profile.internal;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
+import org.argouml.application.api.AbstractArgoJPanel;
import org.argouml.application.api.GUISettingsTabInterface;
import org.argouml.application.api.InitSubsystem;
import org.argouml.profile.ProfileFacade;
@@ -51,4 +53,8 @@
new org.argouml.profile.internal.ProfileManagerImpl());
}
+ public List<AbstractArgoJPanel> getDetailsTabs() {
+ return Collections.emptyList();
+ }
+
}
Modified: branches/work_issue4925_mvw/org/argouml/ui/cmd/SettingsTabShortcuts.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/ui/cmd/SettingsTabShortcuts.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/ui/cmd/SettingsTabShortcuts.java&p2=branches/work_issue4925_mvw/org/argouml/ui/cmd/SettingsTabShortcuts.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/ui/cmd/SettingsTabShortcuts.java (original)
+++ branches/work_issue4925_mvw/org/argouml/ui/cmd/SettingsTabShortcuts.java 2007-12-10 10:22:11-0800
@@ -502,6 +502,7 @@
/*
* @see javax.swing.table.TableModel#getColumnName(int)
*/
+ @Override
public String getColumnName(int col) {
return columnNames[col];
}
@@ -530,6 +531,7 @@
* @see javax.swing.table.TableModel#setValueAt( java.lang.Object, int,
* int)
*/
+ @Override
public void setValueAt(Object ob, int row, int col) {
// if the given object is a KeyStroke instance, then we ca
if (ob instanceof Action) {
@@ -574,6 +576,7 @@
/*
* @see javax.swing.table.TableModel#isCellEditable(int, int)
*/
+ @Override
public boolean isCellEditable(int row, int col) {
return false;
}
@@ -586,7 +589,7 @@
}
/**
- * Argo's renderer for a KeyStroke object
+ * TableCellRenderer for a KeyStroke object.
*
* @author [email protected]
*/
@@ -596,6 +599,9 @@
*/
private static final long serialVersionUID = -7086302679799095974L;
+ /**
+ * Construct a table cell rendered for key strokes.
+ */
public KeyStrokeCellRenderer() {
super();
setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
@@ -606,6 +612,7 @@
*
* @see javax.swing.table.DefaultTableCellRenderer#setValue(java.lang.Object)
*/
+ @Override
public void setValue(Object value) {
if (value != null && value instanceof KeyStroke) {
value = KeyEventUtils.formatKeyStroke((KeyStroke) value);
Modified: branches/work_issue4925_mvw/org/argouml/uml/diagram/ui/StylePanelFigMessage.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/uml/diagram/ui/StylePanelFigMessage.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/uml/diagram/ui/StylePanelFigMessage.java&p2=branches/work_issue4925_mvw/org/argouml/uml/diagram/ui/StylePanelFigMessage.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/uml/diagram/ui/StylePanelFigMessage.java (original)
+++ branches/work_issue4925_mvw/org/argouml/uml/diagram/ui/StylePanelFigMessage.java 2007-12-10 10:22:11-0800
@@ -31,7 +31,6 @@
import org.argouml.i18n.Translator;
import org.argouml.ui.StylePanelFigNodeModelElement;
-import org.tigris.gef.util.Converter;
/**
* Stylepanel which allows to set the arrow of a message.
@@ -42,8 +41,7 @@
private JLabel arrowLabel = new JLabel(Translator.localize("label.localize"));
- private JComboBox arrowField = new JComboBox(Converter
- .convert(FigMessage.getArrowDirections()));
+ private JComboBox arrowField = new JComboBox(FigMessage.getArrowDirections().toArray());
/**
Modified: branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValues.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValues.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValues.java&p2=branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValues.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValues.java (original)
+++ branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValues.java 2007-12-10 10:22:11-0800
@@ -29,7 +29,7 @@
import java.awt.event.ActionEvent;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
-import java.util.ArrayList;
+import java.util.Collection;
import javax.swing.Action;
import javax.swing.DefaultCellEditor;
@@ -217,12 +217,16 @@
/*
* @see org.argouml.ui.TabTarget#getTarget()
*/
- public Object getTarget() { return target; }
+ public Object getTarget() {
+ return target;
+ }
/*
* @see org.argouml.ui.TabTarget#refresh()
*/
- public void refresh() { setTarget(target); }
+ public void refresh() {
+ setTarget(target);
+ }
/*
* @see org.argouml.ui.TabTarget#shouldBeEnabled(java.lang.Object)
@@ -282,12 +286,12 @@
if (!e.getValueIsAdjusting()) {
DefaultListSelectionModel sel =
(DefaultListSelectionModel) e.getSource();
- ArrayList tvs = new ArrayList(Model.getFacade()
- .getTaggedValuesCollection(target));
+ Collection tvs =
+ Model.getFacade().getTaggedValuesCollection(target);
int index = sel.getLeadSelectionIndex();
if (index >= 0 && index < tvs.size()) {
Object tagDef = Model.getFacade().getTagDefinition(
- tvs.get(index));
+ TabTaggedValuesModel.getFromCollection(tvs, index));
tagDefinitionsComboBoxModel.setSelectedItem(tagDef);
}
}
@@ -350,6 +354,7 @@
/*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
TabTaggedValuesModel model = (TabTaggedValuesModel) table.getModel();
Modified: branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValuesModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValuesModel.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValuesModel.java&p2=branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValuesModel.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValuesModel.java (original)
+++ branches/work_issue4925_mvw/org/argouml/uml/ui/TabTaggedValuesModel.java 2007-12-10 10:22:11-0800
@@ -46,13 +46,13 @@
/**
* The model for the table with the tagged values. Implementation for UML 1.4
* and TagDefinitions.
+ *
+ * TODO: This currently only supports TaggedValues with a TagDefinition which
+ * has a type of String.
*/
public class TabTaggedValuesModel extends AbstractTableModel implements
VetoableChangeListener, DelayedVChangeListener, PropertyChangeListener {
- /**
- * Logger.
- */
private static final Logger LOG =
Logger.getLogger(TabTaggedValuesModel.class);
@@ -106,6 +106,7 @@
/*
* @see javax.swing.table.TableModel#getColumnName(int)
*/
+ @Override
public String getColumnName(int c) {
if (c == 0) {
return Translator.localize("label.taggedvaluespane.tag");
@@ -124,6 +125,7 @@
return (Class) Model.getMetaTypes().getTagDefinition();
}
if (c == 1) {
+ // TODO: This will vary based on the type of the TagDefinition
return String.class;
}
return null;
@@ -188,11 +190,13 @@
/*
* @see javax.swing.table.TableModel#setValueAt(java.lang.Object, int, int)
*/
+ @Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if (columnIndex != 0 && columnIndex != 1) {
return;
}
if (columnIndex == 1 && aValue == null) {
+ // TODO: Use default value of appropriate type here
aValue = "";
}
@@ -236,12 +240,14 @@
tagType = "";
}
if (tagValue == null) {
+ // TODO: Use default value of appropriate type for TD
tagValue = "";
+// tagValue = true;
}
Object tv = Model.getExtensionMechanismsFactory().createTaggedValue();
// We really shouldn't add it until after it is set up, but we
- // need it to have an owner for the following methods
+ // need it to have an owner for the following method calls
Model.getExtensionMechanismsHelper().addTaggedValue(target, tv);
Model.getExtensionMechanismsHelper().setTag(tv, tagType);
@@ -272,7 +278,7 @@
* @param index index of the element to be returned
* @return the object
*/
- private Object getFromCollection(Collection collection, int index) {
+ static Object getFromCollection(Collection collection, int index) {
if (collection instanceof List) {
return ((List) collection).get(index);
}
@@ -319,4 +325,4 @@
* The UID.
*/
private static final long serialVersionUID = -5711005901444956345L;
-} /* end class TableModelTaggedValues */
+}
\ No newline at end of file
Modified: branches/work_issue4925_mvw/org/argouml/uml/ui/UMLMultiplicityPanel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/uml/ui/UMLMultiplicityPanel.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/uml/ui/UMLMultiplicityPanel.java&p2=branches/work_issue4925_mvw/org/argouml/uml/ui/UMLMultiplicityPanel.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/uml/ui/UMLMultiplicityPanel.java (original)
+++ branches/work_issue4925_mvw/org/argouml/uml/ui/UMLMultiplicityPanel.java 2007-12-10 10:22:11-0800
@@ -181,7 +181,8 @@
public void targetSet(TargetEvent e) {
super.targetSet(e);
Object target = getTarget();
- boolean exists = Model.getFacade().getMultiplicity(target) != null;
+ boolean exists = target != null
+ && Model.getFacade().getMultiplicity(target) != null;
multiplicityComboBox.setEnabled(exists);
multiplicityComboBox.setEditable(exists);
checkBox.setSelected(exists);
Modified: branches/work_issue4925_mvw/org/argouml/uml/ui/UMLTableCellRenderer.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/uml/ui/UMLTableCellRenderer.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/uml/ui/UMLTableCellRenderer.java&p2=branches/work_issue4925_mvw/org/argouml/uml/ui/UMLTableCellRenderer.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/uml/ui/UMLTableCellRenderer.java (original)
+++ branches/work_issue4925_mvw/org/argouml/uml/ui/UMLTableCellRenderer.java 2007-12-10 10:22:11-0800
@@ -24,23 +24,22 @@
package org.argouml.uml.ui;
import javax.swing.table.DefaultTableCellRenderer;
-import javax.swing.table.TableCellRenderer;
import org.argouml.model.Model;
/**
- * Basic table cell render which uses the name of a model element as the text.
+ * Basic table cell renderer which uses the name of a model element as the text.
*/
-public class UMLTableCellRenderer extends DefaultTableCellRenderer implements
- TableCellRenderer {
+public class UMLTableCellRenderer extends DefaultTableCellRenderer {
/**
- * Constructor.
+ * Construct a TableCellRender which uses the name of a UML element.
*/
public UMLTableCellRenderer() {
super();
}
+ @Override
public void setValue(Object value) {
if (Model.getFacade().isAModelElement(value)) {
String name = Model.getFacade().getName(value);
Modified: branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java&p2=branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java (original)
+++ branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java 2007-12-10 10:22:11-0800
@@ -25,11 +25,6 @@
package org.argouml.uml.ui.foundation.core;
import java.beans.PropertyChangeEvent;
-import java.text.Collator;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@@ -37,6 +32,7 @@
import org.argouml.kernel.ProjectManager;
import org.argouml.model.Model;
import org.argouml.uml.ui.UMLComboBoxModel2;
+import org.argouml.uml.util.PathComparator;
/**
* The combobox model for the type belonging to some attribute.
@@ -73,22 +69,7 @@
* @see org.argouml.uml.ui.UMLComboBoxModel2#buildModelList()
*/
protected void buildModelList() {
- Set<Object> elements = new TreeSet<Object>(new Comparator<Object>() {
- public int compare(Object o1, Object o2) {
- if (o1.equals(o2)) {
- return 0;
- }
- // Elements are collated first by name and then by
- // their enclosing path to distinguish them
- List<String> path1 = Model.getModelManagementHelper()
- .getPathList(o1);
- Collections.reverse(path1);
- List<String> path2 = Model.getModelManagementHelper()
- .getPathList(o2);
- Collections.reverse(path2);
- return compareStringLists(path1, path2);
- }
- });
+ Set<Object> elements = new TreeSet<Object>(new PathComparator());
Project p = ProjectManager.getManager().getCurrentProject();
if (p == null) {
@@ -117,52 +98,6 @@
addAll(elements);
}
- /**
- * Compare two lists of strings using a primary strength text collator.
- * This will collate e, E, é, É together, but not eliminate non-identical
- * strings which collate in the same place.
- *
- * @return equivalent of list1.compareTo(list2)
- */
- private static int compareStringLists(List<String> list1,
- List<String> list2) {
- Collator collator = Collator.getInstance();
- collator.setStrength(Collator.PRIMARY);
- Iterator<String> i2 = list2.iterator();
- Iterator<String> i1 = list1.iterator();
- boolean caseDiffers = false;
- while (i2.hasNext()) {
- String name2 = i2.next();
- if (!i1.hasNext()) {
- return -1;
- }
- String name1 = i1.next();
- if (name1 == null) {
- return -1;
- }
- int comparison = collator.compare(name1, name2);
- if (comparison != 0) {
- return comparison;
- }
- caseDiffers = caseDiffers | !(name1.equals(name2));
- }
- if (i2.hasNext()) {
- return 1;
- }
- // If the strings differed only in non-primary characteristics at
- // some point (case, accent, etc) pick an arbitrary collating order.
- // We don't call them equal to keep them from being merged in the list.
- if (caseDiffers) {
- return 1;
- }
- // It's illegal in UML to have multiple elements in a namespace with
- // the same name, but if it happens, keep them distinct so the user
- // has a chance of catching the error. Pick an arbitrary collating
- // order.
- // Note: this may make the collating order unstable.
- return 1;
- }
-
/*
* @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
*/
@@ -191,3 +126,4 @@
}
}
+
Modified: branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/ActionSetTagDefinitionType.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/ActionSetTagDefinitionType.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/ActionSetTagDefinitionType.java&p2=branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/ActionSetTagDefinitionType.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/ActionSetTagDefinitionType.java (original)
+++ branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/ActionSetTagDefinitionType.java 2007-12-10 10:22:11-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 2006-2007 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
@@ -28,19 +28,24 @@
import javax.swing.Action;
+import org.apache.log4j.Logger;
import org.argouml.i18n.Translator;
import org.argouml.model.Model;
import org.argouml.uml.ui.UMLComboBox2;
import org.tigris.gef.undo.UndoableAction;
+
/**
- * @since Nov 3, 2002
- * @author [email protected]
+ * Action to set the type of a TagDefinition. The tagType attribute of a
+ * TagDefinition is a Name of a UML metaclass (ie String).
*/
public class ActionSetTagDefinitionType extends UndoableAction {
private static final ActionSetTagDefinitionType SINGLETON =
new ActionSetTagDefinitionType();
+ private static final Logger LOG =
+ Logger.getLogger(ActionSetTagDefinitionType.class);
+
/**
* Constructor for ActionSetTagDefinitionType.
*/
@@ -58,28 +63,29 @@
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
Object source = e.getSource();
- Object oldClassifier = null;
- Object newClassifier = null;
- Object attr = null;
+ LOG.debug("Receiving " + e + "/" + e.getID() + "/"
+ + e.getActionCommand());
+ String oldType = null;
+ String newType = null;
+ Object tagDef = null;
if (source instanceof UMLComboBox2) {
UMLComboBox2 box = (UMLComboBox2) source;
- Object o = box.getTarget();
- if (Model.getFacade().isATagDefinition(o)) {
- attr = o;
- oldClassifier = Model.getFacade().getType(attr);
- }
- o = box.getSelectedItem();
- if (Model.getFacade().isAClassifier(o)) {
- newClassifier = o;
+ Object t = box.getTarget();
+ if (Model.getFacade().isATagDefinition(t)) {
+ tagDef = t;
+ oldType = (String) Model.getFacade().getType(tagDef);
}
+ newType = (String) box.getSelectedItem();
+ LOG.debug("Selected item is " + newType);
}
- if (newClassifier != oldClassifier && attr != null) {
- Model.getCoreHelper().setType(attr, newClassifier);
+ if (newType != null && !newType.equals(oldType) && tagDef != null) {
+ LOG.debug("New type is " + newType);
+ Model.getExtensionMechanismsHelper().setTagType(tagDef, newType);
}
}
-
+
/**
- * @return Returns the sINGLETON.
+ * @return Returns the singleton instance.
*/
public static ActionSetTagDefinitionType getInstance() {
return SINGLETON;
Modified: branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/PropPanelTagDefinition.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/PropPanelTagDefinition.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/PropPanelTagDefinition.java&p2=branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/PropPanelTagDefinition.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/PropPanelTagDefinition.java (original)
+++ branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/PropPanelTagDefinition.java 2007-12-10 10:22:11-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 2005-2007 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
@@ -49,20 +49,16 @@
import org.argouml.uml.ui.UMLLinkedList;
import org.argouml.uml.ui.UMLMultiplicityPanel;
import org.argouml.uml.ui.UMLSearchableComboBox;
-import org.argouml.uml.ui.foundation.core.ActionSetStructuralFeatureType;
import org.argouml.uml.ui.foundation.core.PropPanelModelElement;
import org.argouml.uml.ui.foundation.core.UMLModelElementNamespaceComboBoxModel;
import org.argouml.uml.ui.foundation.core.UMLStructuralFeatureTypeComboBoxModel;
import org.tigris.gef.undo.UndoableAction;
/**
- * The properties panel for a Class.
+ * The properties panel for a TagDefinition.
*/
public class PropPanelTagDefinition extends PropPanelModelElement {
- /**
- *
- */
private static final long serialVersionUID = 3563940705352568635L;
private JComponent ownerSelector;
private JComponent tdNamespaceSelector;
@@ -75,8 +71,8 @@
new UMLTagDefinitionOwnerComboBoxModel();
private UMLComboBoxModel2 tdNamespaceComboBoxModel =
new UMLTagDefinitionNamespaceComboBoxModel();
- // Despite the misleading name the following class does the right thing
- private static UMLStructuralFeatureTypeComboBoxModel typeComboBoxModel;
+ private static UMLMetaClassComboBoxModel typeComboBoxModel;
+
private static UMLTagDefinitionTypedValuesListModel typedValuesListModel =
new UMLTagDefinitionTypedValuesListModel();
@@ -84,7 +80,7 @@
* The combobox for the multiplicity of this type.
*/
private JPanel multiplicityComboBox;
-
+
/**
* Construct a property panel for TagDefinition elements.
*/
@@ -167,18 +163,11 @@
public UMLComboBox2 getTypeComboBox() {
if (typeComboBox == null) {
if (typeComboBoxModel == null) {
- typeComboBoxModel =
- new UMLStructuralFeatureTypeComboBoxModel();
- // TODO: Replace by:
-// new UMLTagDefinitionTagTypeComboBoxModel();
- // or should it be a textField?
+ typeComboBoxModel = new UMLMetaClassComboBoxModel();
}
typeComboBox =
- new UMLComboBox2(
- typeComboBoxModel,
- ActionSetStructuralFeatureType.getInstance());
- // TODO: (?) Replace by:
-// new ActionSetTagDefinitionTagType();
+ new UMLComboBox2(typeComboBoxModel,
+ ActionSetTagDefinitionType.getInstance());
typeComboBox.setEnabled(false);
}
return typeComboBox;
@@ -211,6 +200,7 @@
/*
* @see org.argouml.uml.ui.UMLComboBoxModel2#isValidElement(Object)
*/
+ @Override
protected boolean isValidElement(Object o) {
return Model.getFacade().isANamespace(o);
}
@@ -218,19 +208,23 @@
/*
* @see org.argouml.uml.ui.foundation.core.UMLModelElementNamespaceComboBoxModel#buildModelList()
*/
+ @Override
protected void buildModelList() {
- Object model =
- ProjectManager.getManager().getCurrentProject().getRoot();
+ Collection roots =
+ ProjectManager.getManager().getCurrentProject().getRoots();
Collection c = new HashSet();
c.add(null);
- c.add(model);
- c.addAll(Model.getModelManagementHelper().getAllNamespaces(model));
+ for (Object root : roots) {
+ c.add(root);
+ c.addAll(Model.getModelManagementHelper().getAllNamespaces(root));
+ }
setElements(c);
}
/*
* @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
*/
+ @Override
public void propertyChange(PropertyChangeEvent evt) {
/*
* Rebuild the list from scratch to be sure it's correct.
@@ -265,6 +259,7 @@
/*
* @see org.tigris.gef.undo.UndoableAction#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent e) {
super.actionPerformed(e);
Object source = e.getSource();
Modified: branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java?view=diff&rev=13897&p1=branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java&p2=branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java&r1=13896&r2=13897
==============================================================================
--- branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java (original)
+++ branches/work_issue4925_mvw/org/argouml/uml/ui/foundation/extension_mechanisms/UMLMetaClassComboBoxModel.java 2007-12-10 10:22:11-0800
@@ -27,7 +27,6 @@
import java.util.Collection;
import java.util.Collections;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -35,11 +34,9 @@
import org.argouml.uml.ui.UMLComboBoxModel2;
/**
- * A model for stereotypes to handle their base class, or as it is a class from
- * the UML metamodel its metaclass.
- *
- * TODO: This class needs to be replaced with a mechanism that supports multiple
- * base classes as added in UML 1.4.
+ * 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
*/
@@ -48,11 +45,12 @@
private List<String> metaClasses;
/**
- * Constructor.
+ * Construct a default combo box model.
*/
public UMLMetaClassComboBoxModel() {
- super("baseClass", true);
- Collection<String> tmpMetaClasses = Model.getCoreHelper().getAllMetatypeNames();
+ super("tagType", true);
+ Collection<String> tmpMetaClasses =
+ Model.getCoreHelper().getAllMetatypeNames();
if (tmpMetaClasses instanceof List) {
metaClasses = (List<String>) tmpMetaClasses;
@@ -71,16 +69,10 @@
/*
* @see org.argouml.uml.ui.UMLComboBoxModel2#getSelectedModelElement()
*/
+ @Override
protected Object getSelectedModelElement() {
if (getTarget() != null) {
- Collection baseClasses =
- Model.getFacade().getBaseClasses(getTarget());
- if (baseClasses != null) {
- Iterator iter = baseClasses.iterator();
- if (iter.hasNext()) {
- return iter.next();
- }
- }
+ return Model.getFacade().getType(getTarget());
}
return null;
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.