svn commit: r13614 - trunk/src_new/org/argouml: application i18n kernel persistence ui ui/explorer ui/explorer/rules uml uml/cognitive/critics uml/diagram/activity/ui uml/diagram/collaboration/ui uml/diagram/deployment/ui uml/diagram/sequence/ui uml/diagram/state/ui uml/diagram/static_structure/ui uml/diagram/ui uml/profile uml/ui uml/ui/foundation/core uml/ui/foundation/extension_mechanisms
[email protected] 27 Sep 2007 06:27:31 -0000
Newsgroups
gmane.comp.lang.uml.argouml.cvs
Message-ID
<[email protected] >
Author: tfmorris
Date: 2007-09-26 23:27:31-0700
New Revision: 13614
Added:
trunk/src_new/org/argouml/ui/ProfileSelectionTab.java
- copied, changed from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProfileSelectionTab.java
trunk/src_new/org/argouml/ui/explorer/rules/GoProfileConfigurationToProfile.java
- copied, changed from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProfileConfigurationToProfile.java
trunk/src_new/org/argouml/ui/explorer/rules/GoProfileToModel.java
- copied, changed from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProfileToModel.java
trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToProfileConfiguration.java
- copied, changed from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProjectToProfileConfiguration.java
trunk/src_new/org/argouml/uml/cognitive/critics/CrProfile.java
- copied, changed from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/cognitive/critics/CrProfile.java
trunk/src_new/org/argouml/uml/diagram/ui/ActionAddStereotype.java
- copied, changed from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/ActionAddStereotype.java
Removed:
trunk/src_new/org/argouml/uml/Profile.java
trunk/src_new/org/argouml/uml/ProfileException.java
trunk/src_new/org/argouml/uml/ProfileJava.java
Modified:
trunk/src_new/org/argouml/application/Main.java
trunk/src_new/org/argouml/i18n/action.properties
trunk/src_new/org/argouml/i18n/menu.properties
trunk/src_new/org/argouml/i18n/misc.properties
trunk/src_new/org/argouml/i18n/tab.properties
trunk/src_new/org/argouml/kernel/MemberList.java
trunk/src_new/org/argouml/kernel/Project.java
trunk/src_new/org/argouml/kernel/ProjectImpl.java
trunk/src_new/org/argouml/kernel/ProjectSettings.java
trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java
trunk/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java
trunk/src_new/org/argouml/persistence/UmlFilePersister.java
trunk/src_new/org/argouml/persistence/ZargoFilePersister.java
trunk/src_new/org/argouml/persistence/ZipFilePersister.java
trunk/src_new/org/argouml/persistence/argo.tee
trunk/src_new/org/argouml/ui/GUI.java
trunk/src_new/org/argouml/ui/ProjectSettingsTabProfile.java
trunk/src_new/org/argouml/ui/SettingsTabPreferences.java
trunk/src_new/org/argouml/ui/SettingsTabProfile.java
trunk/src_new/org/argouml/ui/StylePanelFig.java
trunk/src_new/org/argouml/ui/explorer/ExplorerPopup.java
trunk/src_new/org/argouml/ui/explorer/NameOrder.java
trunk/src_new/org/argouml/ui/explorer/PerspectiveManager.java
trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToRoots.java
trunk/src_new/org/argouml/uml/StereotypeUtility.java
trunk/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java
trunk/src_new/org/argouml/uml/diagram/activity/ui/FigActionState.java
trunk/src_new/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java
trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java
trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPool.java
trunk/src_new/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java
trunk/src_new/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponent.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigMNode.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigObject.java
trunk/src_new/org/argouml/uml/diagram/sequence/ui/FigClassifierRole.java
trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java
trunk/src_new/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java
trunk/src_new/org/argouml/uml/diagram/state/ui/FigForkState.java
trunk/src_new/org/argouml/uml/diagram/state/ui/FigJoinState.java
trunk/src_new/org/argouml/uml/diagram/state/ui/FigSimpleState.java
trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java
trunk/src_new/org/argouml/uml/diagram/state/ui/FigSubmachineState.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigComment.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigModel.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSubsystem.java
trunk/src_new/org/argouml/uml/diagram/ui/FigMessage.java
trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java
trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
trunk/src_new/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java
trunk/src_new/org/argouml/uml/profile/Profile.java
trunk/src_new/org/argouml/uml/profile/ProfileConfiguration.java
trunk/src_new/org/argouml/uml/profile/ProfileCpp.java
trunk/src_new/org/argouml/uml/profile/ProfileJava.java
trunk/src_new/org/argouml/uml/profile/ProfileManager.java
trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java
trunk/src_new/org/argouml/uml/profile/ProfileUML.java
trunk/src_new/org/argouml/uml/ui/PropPanel.java
trunk/src_new/org/argouml/uml/ui/UMLComboBoxEntry.java
trunk/src_new/org/argouml/uml/ui/UMLUserInterfaceContainer.java
trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java
trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java
trunk/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java
Log:
Complete merge of profile work from Marcus Aurelio's GSoC branch.
Modified: trunk/src_new/org/argouml/application/Main.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/application/Main.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/application/Main.java&p2=trunk/src_new/org/argouml/application/Main.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/application/Main.java (original)
+++ trunk/src_new/org/argouml/application/Main.java 2007-09-26 23:27:31-0700
@@ -256,6 +256,18 @@
updateProgress(splash, 5, "statusmsg.bar.model-subsystem");
+ /*
+ * Initialize the module loader. At least the plug-ins that provide
+ * profiles need to be initialized before the project is loaded, because
+ * some of these profile may have been set as default profiles and need
+ * to be applied to the project as soon as it has been created or
+ * loaded. the first instance of a Project is needed during the gui
+ * initialization
+ */
+ st.mark("modules");
+
+ SubsystemUtility.initSubsystem(new InitModuleLoader());
+
// Initialize the Java code generator.
GeneratorJava.getInstance();
@@ -360,11 +372,6 @@
splash.getStatusBar().showProgress(75);
}
- // Initialize the module loader.
- st.mark("modules");
-
- SubsystemUtility.initSubsystem(new InitModuleLoader());
-
st.mark("open window");
updateProgress(splash, 95, "statusmsg.bar.open-project-browser");
Modified: trunk/src_new/org/argouml/i18n/action.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/i18n/action.properties?view=diff&rev=13614&p1=trunk/src_new/org/argouml/i18n/action.properties&p2=trunk/src_new/org/argouml/i18n/action.properties&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/i18n/action.properties (original)
+++ trunk/src_new/org/argouml/i18n/action.properties 2007-09-26 23:27:31-0700
@@ -77,6 +77,7 @@
action.empty-trash = Empty Trash
action.exit = Exit
action.export-project-as-xmi = Export XMI...
+action.export-profile-as-xmi = Export profile model as XMI...
action.find = Find...
action.generate-all-classes = Generate All Classes...
action.generate-code-for-project = Generate Code for Project...
Modified: trunk/src_new/org/argouml/i18n/menu.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/i18n/menu.properties?view=diff&rev=13614&p1=trunk/src_new/org/argouml/i18n/menu.properties&p2=trunk/src_new/org/argouml/i18n/menu.properties&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/i18n/menu.properties (original)
+++ trunk/src_new/org/argouml/i18n/menu.properties 2007-09-26 23:27:31-0700
@@ -276,4 +276,12 @@
menu.popup.uses = {0} Uses {1}
menu.popup.visibility = Visibility
menu.popup.visibility.mnemonic = V
+menu.popup.stereotype-view = Stereotype Visualization
+menu.popup.stereotype-view.mnemonic = S
+menu.popup.stereotype-view.textual = Textual
+menu.popup.stereotype-view.textual.mnemonic = T
+menu.popup.stereotype-view.big-icon = Big Icon
+menu.popup.stereotype-view.big-icon.mnemonic = B
+menu.popup.stereotype-view.small-icon = Small Icons
+menu.popup.stereotype-view.small-icon.mnemonic = S
Modified: trunk/src_new/org/argouml/i18n/misc.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/i18n/misc.properties?view=diff&rev=13614&p1=trunk/src_new/org/argouml/i18n/misc.properties&p2=trunk/src_new/org/argouml/i18n/misc.properties&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/i18n/misc.properties (original)
+++ trunk/src_new/org/argouml/i18n/misc.properties 2007-09-26 23:27:31-0700
@@ -147,9 +147,12 @@
misc.primitive.rounded-rectangle = Rounded Rectangle
misc.primitive.spline = Spline
misc.primitive.text = Text
+misc.profile.model = Profile->Model
+misc.profileconfiguration.profile = Profile Configuration->Profile
misc.project.collaboration = Project->Collaboration
misc.project.diagram = Project->Diagram
misc.project.model = Project->Model
+misc.project.profileconfiguration = Project->Profile Configuration
misc.project.roots = Project->Root Elements
misc.project.state-machine = Project->State Machine
misc.properties = Properties
Modified: trunk/src_new/org/argouml/i18n/tab.properties
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/i18n/tab.properties?view=diff&rev=13614&p1=trunk/src_new/org/argouml/i18n/tab.properties&p2=trunk/src_new/org/argouml/i18n/tab.properties&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/i18n/tab.properties (original)
+++ trunk/src_new/org/argouml/i18n/tab.properties 2007-09-26 23:27:31-0700
@@ -49,3 +49,31 @@
tab.user = User
tab.modules = Modules
+tab.profiles = Profiles
+tab.profiles.userdefined.load = Load profile from file...
+tab.profiles.userdefined.unload = Unload
+tab.profiles.userdefined.available = Available Profiles:
+tab.profiles.userdefined.active = Active Profiles:
+tab.profiles.userdefined.default = Default Profiles:
+tab.profiles.userdefined.errorloading = Error opening profile!
+
+tab.profiles.directories.desc = Default XMI directories:
+tab.profiles.directories.add = Add
+tab.profiles.directories.remove = Remove
+tab.profiles.directories.refresh = Refresh
+
+tab.profiles.cannotdelete = Only user defined profiles can be unregistered!
+tab.profiles.confirmdeleteunregistered = The selected profile is only available \
+ in this project, after removed there is no way to add it again. \
+ Are you sure you want to remove it?
+tab.profiles.confirmdeleteunregistered.title = Confirm
+
+tab.profiles.confirmdeletewithdependencies = The following profiles depend on \
+ the selected profile and are also going to be removed: {0}. Are you sure you \
+ want to remove these profiles?
+tab.profiles.confirmdeletewithdependencies.title = Profile dependencies
+
+tab.profiles.confirmrefresh = The changes you've made need to be applied \
+ before the available profiles list is refreshed. Are you sure you want to \
+ go ahead?
+tab.profiles.confirmrefresh.title = Confirm refresh
Modified: trunk/src_new/org/argouml/kernel/MemberList.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/MemberList.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/kernel/MemberList.java&p2=trunk/src_new/org/argouml/kernel/MemberList.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/kernel/MemberList.java (original)
+++ trunk/src_new/org/argouml/kernel/MemberList.java 2007-09-26 23:27:31-0700
@@ -34,6 +34,7 @@
import org.argouml.uml.ProjectMemberModel;
import org.argouml.uml.cognitive.ProjectMemberTodoList;
import org.argouml.uml.diagram.ProjectMemberDiagram;
+import org.argouml.uml.profile.ProfileConfiguration;
import org.tigris.gef.base.Diagram;
/**
@@ -64,6 +65,7 @@
new ArrayList<ProjectMemberDiagram>(10);
private AbstractProjectMember todoList;
+ private AbstractProjectMember profileConfiguration;
/**
* The constructor.
@@ -82,6 +84,9 @@
// otherwise add the diagram at the start
setTodoList((AbstractProjectMember) member);
return true;
+ } else if (member instanceof ProfileConfiguration) {
+ setProfileConfiguration((AbstractProjectMember) member);
+ return true;
} else if (member instanceof ProjectMemberDiagram) {
// otherwise add the diagram at the start
return diagramMembers.add((ProjectMemberDiagram) member);
@@ -102,6 +107,10 @@
LOG.info("Removing todo list");
setTodoList(null);
return true;
+ } else if (profileConfiguration == member) {
+ LOG.info("Removing profile configuration");
+ setProfileConfiguration(null);
+ return true;
} else {
final boolean removed = diagramMembers.remove(member);
if (!removed) {
@@ -123,8 +132,9 @@
return buildTempList().listIterator(arg0);
}
- private List buildTempList() {
- List temp = new ArrayList(size());
+ private List<ProjectMember> buildTempList() {
+ List<ProjectMember> temp =
+ new ArrayList<ProjectMember>(size());
if (model != null) {
temp.add(model);
}
@@ -132,6 +142,12 @@
if (todoList != null) {
temp.add(todoList);
}
+ if (profileConfiguration != null) {
+ temp.add(profileConfiguration);
+ }
+ if (profileConfiguration != null) {
+ temp.add(profileConfiguration);
+ }
return temp;
}
@@ -155,6 +171,9 @@
if (todoList != null) {
++size;
}
+ if (profileConfiguration != null) {
+ ++size;
+ }
return size;
}
@@ -165,6 +184,9 @@
if (model == member) {
return true;
}
+ if (profileConfiguration == member) {
+ return true;
+ }
return diagramMembers.contains(member);
}
@@ -176,6 +198,9 @@
if (todoList != null) {
todoList.remove();
}
+ if (profileConfiguration != null) {
+ profileConfiguration.remove();
+ }
Iterator membersIt = diagramMembers.iterator();
while (membersIt.hasNext()) {
((AbstractProjectMember) membersIt.next()).remove();
@@ -194,6 +219,9 @@
if (type == ProjectMemberTodoList.class) {
return todoList;
}
+ if (type == ProfileConfiguration.class) {
+ return profileConfiguration;
+ }
throw new IllegalArgumentException(
"There is no single instance of a " + type.getName() + " member");
}
@@ -204,18 +232,23 @@
*/
public synchronized List getMembers(Class type) {
if (type == ProjectMemberModel.class) {
- List temp = new ArrayList(1);
+ List<ProjectMember> temp = new ArrayList<ProjectMember>(1);
temp.add(model);
return temp;
}
if (type == ProjectMemberTodoList.class) {
- List temp = new ArrayList(1);
+ List<ProjectMember> temp = new ArrayList<ProjectMember>(1);
temp.add(todoList);
return temp;
}
if (type == ProjectMemberDiagram.class) {
return diagramMembers;
}
+ if (type == ProfileConfiguration.class) {
+ List<ProjectMember> temp = new ArrayList<ProjectMember>(1);
+ temp.add(profileConfiguration);
+ return temp;
+ }
throw new IllegalArgumentException(
"There is no single instance of a " + type.getName() + " member");
}
@@ -231,6 +264,9 @@
if (i == diagramMembers.size()) {
return todoList;
}
+ if (i == diagramMembers.size() + 1) {
+ return profileConfiguration;
+ }
return diagramMembers.get(i);
}
@@ -251,6 +287,9 @@
if (todoList != null) {
temp[pos++] = todoList;
}
+ if (profileConfiguration != null) {
+ temp[pos++] = profileConfiguration;
+ }
return temp;
}
@@ -306,4 +345,12 @@
public List subList(int arg0, int arg1) {
throw new UnsupportedOperationException();
}
+
+ public AbstractProjectMember getProfileConfiguration() {
+ return profileConfiguration;
+ }
+
+ public void setProfileConfiguration(AbstractProjectMember profileConfig) {
+ profileConfiguration = profileConfig;
+ }
}
Modified: trunk/src_new/org/argouml/kernel/Project.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/Project.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/kernel/Project.java&p2=trunk/src_new/org/argouml/kernel/Project.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/kernel/Project.java (original)
+++ trunk/src_new/org/argouml/kernel/Project.java 2007-09-26 23:27:31-0700
@@ -33,8 +33,9 @@
import java.util.Map;
import java.util.Vector;
-import org.argouml.uml.Profile;
import org.argouml.uml.diagram.ArgoDiagram;
+import org.argouml.uml.profile.Profile;
+import org.argouml.uml.profile.ProfileConfiguration;
import org.tigris.gef.presentation.Fig;
/**
@@ -452,8 +453,12 @@
public void setDefaultModel(Object theDefaultModel);
/**
- * @param packages a Collection of packages containing profiles.
+ * @param packages
+ * a Collection of packages containing profiles.
+ * @deprecated by maurelio1234 for 0.25.4. Use
+ * {@link #getProfileConfiguration()} instead.
*/
+ @Deprecated
public void setProfiles(Collection packages);
/**
@@ -467,9 +472,12 @@
/**
* Get the collection of profile packages.
- *
+ *
* @return collection of Packages containing profiles.
+ * @deprecated by maurelio1234 for 0.25.4. Use
+ * {@link #getProfileConfiguration()} instead.
*/
+ @Deprecated
public Object getProfiles();
/**
@@ -597,7 +605,10 @@
/**
* @return Returns the profile.
+ * @deprecated for 0.25.4 by maurelio1234. Use {@link #getProfiles()}
+ * instead.
*/
+ @Deprecated
public Profile getProfile();
/**
@@ -614,6 +625,19 @@
public ProjectSettings getProjectSettings();
/**
+ * @return Returns the profile configuration.
+ */
+ public ProfileConfiguration getProfileConfiguration();
+
+
+ /**
+ * Set the profile configuration.
+ *
+ * @param pc the profile configuration
+ */
+ public void setProfileConfiguration(ProfileConfiguration pc);
+
+ /**
* Return the UndoManager for this project. Undo is managed on a
* per-project basis.
*
Modified: trunk/src_new/org/argouml/kernel/ProjectImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/ProjectImpl.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/kernel/ProjectImpl.java&p2=trunk/src_new/org/argouml/kernel/ProjectImpl.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/kernel/ProjectImpl.java (original)
+++ trunk/src_new/org/argouml/kernel/ProjectImpl.java 2007-09-26 23:27:31-0700
@@ -51,14 +51,13 @@
import org.argouml.model.Model;
import org.argouml.persistence.PersistenceManager;
import org.argouml.uml.CommentEdge;
-import org.argouml.uml.Profile;
-import org.argouml.uml.ProfileException;
-import org.argouml.uml.ProfileJava;
import org.argouml.uml.ProjectMemberModel;
import org.argouml.uml.cognitive.ProjectMemberTodoList;
import org.argouml.uml.diagram.ArgoDiagram;
import org.argouml.uml.diagram.DiagramFactory;
import org.argouml.uml.diagram.ProjectMemberDiagram;
+import org.argouml.uml.profile.Profile;
+import org.argouml.uml.profile.ProfileConfiguration;
import org.tigris.gef.presentation.Fig;
/**
@@ -128,12 +127,11 @@
*/
private final List<ArgoDiagram> diagrams = new ArrayList<ArgoDiagram>();
- private Collection<Object> profilePackages = new HashSet<Object>();
private Object currentNamespace;
private Map<String, Object> uuidRefs;
private transient VetoableChangeSupport vetoSupport;
- private Profile profile;
+ private ProfileConfiguration profileConfiguration;
/**
* The active diagram, pointer to a diagram in the list with diagrams.
@@ -166,7 +164,8 @@
* Constructor.
*/
public ProjectImpl() {
- profile = new ProfileJava();
+ setProfileConfiguration(new ProfileConfiguration(this));
+
projectSettings = new ProjectSettings();
Model.getModelManagementFactory().setRootModel(null);
@@ -182,17 +181,6 @@
defaultModelTypeCache = new HashMap<String, Object>();
LOG.info("making empty project with empty model");
- try {
- // Jaap Branderhorst 2002-12-09
- // load the default model
- // this is NOT the way how it should be since this makes argo
- // depend on Java even more.
- setProfiles(profile.getProfilePackages());
- } catch (ProfileException e) {
- // TODO: how are we going to handle exceptions here?
- // I think we need a ProjectException.
- LOG.error("Exception setting the default profile", e);
- }
addSearchPath("PROJECT_DIR");
}
@@ -503,7 +491,7 @@
}
- @SuppressWarnings("deprecation")
+ @SuppressWarnings({ "deprecation", "unchecked" })
public Vector getUserDefinedModels() {
return new Vector(models);
}
@@ -517,7 +505,8 @@
public Collection getModels() {
Set ret = new HashSet();
ret.addAll(models);
- ret.addAll(profilePackages);
+ // TODO are the profiles part of the getModels()???
+// ret.addAll(profilePackages);
return ret;
}
@@ -536,20 +525,29 @@
public Object getDefaultAttributeType() {
- // TODO: Move this to a profile - tfm - 20070307
- return findType("int");
+ if (profileConfiguration.getDefaultTypeStrategy() != null) {
+ return profileConfiguration.getDefaultTypeStrategy()
+ .getDefaultAttributeType();
+ }
+ return null;
}
public Object getDefaultParameterType() {
- // TODO: Move this to a profile - tfm - 20070307
- return findType("int");
+ if (profileConfiguration.getDefaultTypeStrategy() != null) {
+ return profileConfiguration.getDefaultTypeStrategy()
+ .getDefaultParameterType();
+ }
+ return null;
}
public Object getDefaultReturnType() {
- // TODO: Move this to a profile - tfm - 20070307
- return findType("void");
+ if (profileConfiguration.getDefaultTypeStrategy() != null) {
+ return profileConfiguration.getDefaultTypeStrategy()
+ .getDefaultReturnType();
+ }
+ return null;
}
@@ -608,16 +606,6 @@
return figs;
}
- private Object findTypeInPackages(String name, Collection namespaces) {
- for (Object namespace : namespaces) {
- Object type = findTypeInModel(name, namespace);
- if (type != null) {
- return type;
- }
- }
- return null;
- }
-
public Object findTypeInModel(String typeName, Object namespace) {
if (typeName == null) {
throw new IllegalArgumentException("typeName must be non-null");
@@ -882,7 +870,8 @@
removeProjectMemberDiagram((ArgoDiagram) obj);
// Need to manually delete diagrams from explorer because they
// don't have a decent event system set up:
- ProjectManager.getManager().firePropertyChanged("remove", obj, null);
+ ProjectManager.getManager()
+ .firePropertyChanged("remove", obj, null);
} else if (obj instanceof Fig) {
((Fig) obj).deleteFromModel();
// TODO: Bob says - I've never seen this appear in the log.
@@ -908,62 +897,81 @@
@SuppressWarnings("deprecation")
public void setDefaultModel(Object theDefaultModel) {
-
- if (!Model.getFacade().isAModel(theDefaultModel)) {
- throw new IllegalArgumentException(
- "The default model must be a Model type. Received a "
- + theDefaultModel.getClass().getName());
- }
-
- profilePackages.clear();
- profilePackages.add(theDefaultModel);
- defaultModelTypeCache = new HashMap<String, Object>();
+ // TODO: Marcus Aurelio deprecated this, but also changed the
+ // implementation to just throw an exception. If it's no longer
+ // functional, we probably need to just remove it altogether.
+ throw new UnsupportedOperationException();
+// if (!Model.getFacade().isAModel(theDefaultModel)) {
+// throw new IllegalArgumentException(
+// "The default model must be a Model type. Received a "
+// + theDefaultModel.getClass().getName());
+// }
+//
+// profilePackages.clear();
+// profilePackages.add(theDefaultModel);
+// defaultModelTypeCache = new HashMap<String, Object>();
}
-
+ @Deprecated
public void setProfiles(Collection packages) {
-
- for (Object pkg : packages) {
- if (!Model.getFacade().isAPackage(pkg)) {
- throw new IllegalArgumentException(
- "Profiles must be of type Package. Received a "
- + pkg.getClass().getName());
- }
- }
-
- profilePackages.clear();
- profilePackages.addAll(packages);
- defaultModelTypeCache = new HashMap<String, Object>();
+ // TODO: Marcus Aurelio deprecated this, but also changed the
+ // implementation to just throw an exception. If it's no longer
+ // functional, we probably need to just remove it altogether.
+ throw new UnsupportedOperationException();
+// for (Object pkg : packages) {
+// if (!Model.getFacade().isAPackage(pkg)) {
+// throw new IllegalArgumentException(
+// "Profiles must be of type Package. Received a "
+// + pkg.getClass().getName());
+// }
+// }
+//
+// profilePackages.clear();
+// profilePackages.addAll(packages);
+// defaultModelTypeCache = new HashMap<String, Object>();
}
+
@SuppressWarnings("deprecation")
public Object getDefaultModel() {
+ // TODO: Marcus Aurelio deprecated this, but also changed the
+ // implementation to just throw an exception. If it's no longer
+ // functional, we probably need to just remove it altogether.
+ throw new UnsupportedOperationException();
// First priority is Model for best backward compatibility
- for (Object pkg : profilePackages) {
- if (Model.getFacade().isAModel(pkg)) {
- return pkg;
- }
- }
- // then a Package
- for (Object pkg : profilePackages) {
- if (Model.getFacade().isAPackage(pkg)) {
- return pkg;
- }
- }
- // if all else fails, just the first element
- return profilePackages.iterator().next();
+// for (Object pkg : profilePackages) {
+// if (Model.getFacade().isAModel(pkg)) {
+// return pkg;
+// }
+// }
+// // then a Package
+// for (Object pkg : profilePackages) {
+// if (Model.getFacade().isAPackage(pkg)) {
+// return pkg;
+// }
+// }
+// // if all else fails, just the first element
+// return profilePackages.iterator().next();
}
+
+ @SuppressWarnings("deprecation")
+ @Deprecated
public Collection getProfiles() {
- return profilePackages;
+ throw new UnsupportedOperationException();
+ // TODO: Marcus Aurelio deprecated this, but also changed the
+ // implementation to just throw an exception. If it's no longer
+ // functional, we probably need to just remove it altogether.
+// return profilePackages;
}
public Object findTypeInDefaultModel(String name) {
if (defaultModelTypeCache.containsKey(name)) {
return defaultModelTypeCache.get(name);
}
-
- Object result = findTypeInPackages(name, profilePackages);
+
+ Object result = profileConfiguration.findType(name);
+
defaultModelTypeCache.put(name, result);
return result;
}
@@ -1094,15 +1102,6 @@
roots.clear();
models.clear();
- if (profilePackages != null) {
- for (Object pkg : profilePackages) {
- LOG.debug("Deleting profile element "
- + Model.getFacade().getName(pkg));
- Model.getUmlFactory().delete(pkg);
- }
- profilePackages.clear();
- }
-
diagrams.clear();
if (uuidRefs != null) {
@@ -1141,8 +1140,14 @@
}
+ @SuppressWarnings("deprecation")
+ @Deprecated
public Profile getProfile() {
- return profile;
+ throw new UnsupportedOperationException();
+ // TODO: Marcus Aurelio deprecated this, but also changed the
+ // implementation to just throw an exception. If it's no longer
+ // functional, we probably need to just remove it altogether.
+// return profile;
}
@@ -1160,8 +1165,24 @@
public ProjectSettings getProjectSettings() {
return projectSettings;
}
-
public UndoManager getUndoManager() {
return undoManager;
}
+
+ public ProfileConfiguration getProfileConfiguration() {
+ return profileConfiguration;
+ }
+
+ public void setProfileConfiguration(ProfileConfiguration pc) {
+ if (this.profileConfiguration != null) {
+ this.members.remove(this.profileConfiguration);
+ }
+
+ this.profileConfiguration = pc;
+
+ // there's just one ProfileConfiguration in a project
+ // and there's no other way to add another one
+ members.add(pc);
+ }
+
}
Modified: trunk/src_new/org/argouml/kernel/ProjectSettings.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/kernel/ProjectSettings.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/kernel/ProjectSettings.java&p2=trunk/src_new/org/argouml/kernel/ProjectSettings.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/kernel/ProjectSettings.java (original)
+++ trunk/src_new/org/argouml/kernel/ProjectSettings.java 2007-09-26 23:27:31-0700
@@ -38,6 +38,8 @@
import org.argouml.notation.NotationName;
import org.argouml.notation.NotationProviderFactory2;
import org.argouml.uml.diagram.ui.DiagramAppearance;
+import org.argouml.ui.SettingsTabProfile;
+import org.argouml.uml.diagram.ui.FigNodeModelElement;
import org.tigris.gef.undo.Memento;
import org.tigris.gef.undo.UndoManager;
@@ -68,6 +70,7 @@
private boolean showStereotypes;
private boolean showSingularMultiplicities;
private int defaultShadowWidth;
+ private int defaultStereotypeView;
/* Diagram appearance settings with project scope: */
private String fontName;
@@ -126,6 +129,9 @@
Notation.KEY_SHOW_SINGULAR_MULTIPLICITIES, true);
defaultShadowWidth = Configuration.getInteger(
Notation.KEY_DEFAULT_SHADOW_WIDTH, 1);
+ defaultStereotypeView = Configuration.getInteger(
+ SettingsTabProfile.KEY_DEFAULT_STEREOTYPE_VIEW,
+ FigNodeModelElement.STEREOTYPE_VIEW_TEXTUAL);
/*
* Diagram appearance settings:
@@ -139,8 +145,6 @@
if (System.getProperty("file.separator").equals("/")) {
generationOutputDir = "/tmp";
} else {
- //This does not even exist on many systems:
- //_outputDir = "c:\\temp";
generationOutputDir = System.getProperty("java.io.tmpdir");
}
generationOutputDir = Configuration.getString(
@@ -734,6 +738,23 @@
/**
* Used by "argo.tee".
*
+ * @return Returns the default stereotype view
+ */
+ public String getDefaultStereotypeView() {
+ return new Integer(defaultStereotypeView).toString();
+ }
+
+ /**
+ * @return Returns the default stereotype view
+ */
+ public int getDefaultStereotypeViewValue() {
+ return defaultStereotypeView;
+ }
+
+
+ /**
+ * Used by "argo.tee".
+ *
* @return the output directory name
*/
public String getGenerationOutputDir() {
@@ -751,7 +772,41 @@
/**
* @return the header comment string
*/
- public String getHeaderComment() { return headerComment; }
+ public String getHeaderComment() {
+ return headerComment;
+ }
+
+ /**
+ * @param newView the default stereotype view
+ */
+ public void setDefaultStereotypeView(final int newView) {
+
+ if (defaultStereotypeView == newView) {
+ return;
+ }
+
+ final int oldValue = defaultStereotypeView;
+
+ Memento memento = new Memento() {
+ private final ConfigurationKey key =
+ SettingsTabProfile.KEY_DEFAULT_STEREOTYPE_VIEW;
+
+ public void redo() {
+ defaultStereotypeView = newView;
+ fireNotationEvent(key, oldValue, newView);
+ }
+
+ public void undo() {
+ defaultStereotypeView = oldValue;
+ fireNotationEvent(key, newView, oldValue);
+ }
+ };
+ if (UndoManager.getInstance().isGenerateMementos()) {
+ UndoManager.getInstance().addMemento(memento);
+ }
+ memento.redo();
+ ProjectManager.getManager().setSaveEnabled(true);
+ }
/**
* @param c the header comment string
@@ -813,19 +868,6 @@
.toString(newValue));
}
- /**
- * Convenience methods to fire diagram appearance
- * configuration change events.
- *
- * @param key the ConfigurationKey that is related to the change
- * @param oldValue the old value
- * @param newValue the new value
- */
- private void fireDiagramAppearanceEvent(ConfigurationKey key,
- boolean oldValue, boolean newValue) {
- fireDiagramAppearanceEvent(key, Boolean.toString(oldValue), Boolean
- .toString(newValue));
- }
/**
* Convenience methods to fire diagram appearance
Modified: trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java&p2=trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java (original)
+++ trunk/src_new/org/argouml/persistence/ModelMemberFilePersister.java 2007-09-26 23:27:31-0700
@@ -58,6 +58,7 @@
import org.argouml.uml.diagram.activity.ui.UMLActivityDiagram;
import org.argouml.uml.diagram.state.ui.UMLStateDiagram;
import org.argouml.uml.diagram.static_structure.ui.UMLClassDiagram;
+import org.argouml.uml.profile.ProfileConfiguration;
import org.xml.sax.InputSource;
/**
@@ -85,7 +86,8 @@
* java.io.InputStream)
*/
public void load(Project project, URL url)
- throws OpenException {
+ throws OpenException {
+
load(project, new InputSource(url.toExternalForm()));
}
@@ -101,7 +103,8 @@
* java.io.InputStream)
*/
public void load(Project project, InputStream inputStream)
- throws OpenException {
+ throws OpenException {
+
load(project, new InputSource(inputStream));
}
@@ -137,7 +140,7 @@
project.addMember(mmodel);
- project.setUUIDRefs(new HashMap(getUUIDRefs()));
+ project.setUUIDRefs(new HashMap<String, Object>(getUUIDRefs()));
}
/*
@@ -242,6 +245,8 @@
persister =
PersistenceManager.getInstance()
.getDiagramMemberFilePersister();
+ } else if (pm instanceof ProfileConfiguration) {
+ persister = new ProfileConfigurationFilePersister();
} else if (pm instanceof ProjectMemberTodoList) {
persister = new TodoListMemberFilePersister();
}
@@ -253,7 +258,7 @@
}
private Object curModel;
- private HashMap uUIDRefs;
+ private HashMap<String, Object> uUIDRefs;
private Collection elementsRead;
@@ -272,7 +277,7 @@
*
* @return the UUID
*/
- public HashMap getUUIDRefs() {
+ public HashMap<String, Object> getUUIDRefs() {
return uUIDRefs;
}
@@ -356,7 +361,8 @@
}
}
}
- uUIDRefs = new HashMap(reader.getXMIUUIDToObjectMap());
+ uUIDRefs =
+ new HashMap<String, Object>(reader.getXMIUUIDToObjectMap());
} catch (XmiException ex) {
throw new XmiFormatException(ex);
} catch (UmlException ex) {
Modified: trunk/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java&p2=trunk/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java (original)
+++ trunk/src_new/org/argouml/persistence/ProfileConfigurationFilePersister.java 2007-09-26 23:27:31-0700
@@ -32,13 +32,14 @@
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
-import java.io.StringReader;
import java.io.StringWriter;
import java.io.Writer;
import java.net.URL;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
+
+import org.xml.sax.InputSource;
import org.argouml.application.helpers.ApplicationVersion;
import org.argouml.kernel.Project;
@@ -50,9 +51,7 @@
import org.argouml.uml.profile.Profile;
import org.argouml.uml.profile.ProfileConfiguration;
import org.argouml.uml.profile.ProfileManagerImpl;
-import org.argouml.uml.profile.StreamModelLoader;
import org.argouml.uml.profile.UserDefinedProfile;
-import org.xml.sax.InputSource;
/**
* Persister for Project's Profile Configuration
@@ -61,24 +60,19 @@
*/
public class ProfileConfigurationFilePersister extends MemberFilePersister {
- /**
- * @return the tag used to store this content on the uml file
- *
+ /*
* @see org.argouml.persistence.MemberFilePersister#getMainTag()
*/
public String getMainTag() {
return "profile";
}
- /**
- * @param project
- * @param inputStream
- * @throws OpenException
- *
+ /*
* @see org.argouml.persistence.MemberFilePersister#load(org.argouml.kernel.Project, java.io.InputStream)
*/
public void load(Project project, InputStream inputStream)
- throws OpenException {
+ throws OpenException {
+
try {
ProfileConfiguration pc = new ProfileConfiguration(project);
@@ -101,12 +95,13 @@
}
Profile profile = null;
- Vector profiles = ProfileManagerImpl.getInstance()
+ List<Profile> profiles = ProfileManagerImpl.getInstance()
.getRegisteredProfiles();
if (line.equals("<userDefined>")) {
line = br.readLine().trim();
- String fileName = line.substring(line.indexOf(">")+1, line.indexOf("</")).trim();
+ String fileName = line.substring(line.indexOf(">") + 1,
+ line.indexOf("</")).trim();
// consumes the <model> tag
br.readLine();
@@ -149,38 +144,31 @@
}
}
- /**
- * @param member
- * @param writer
- * @param xmlFragment
- * @throws SaveException
- * @deprecated
- *
+ /*
* @see org.argouml.persistence.MemberFilePersister#save(org.argouml.kernel.ProjectMember, java.io.Writer, boolean)
*/
public void save(ProjectMember member, Writer writer, boolean xmlFragment)
- throws SaveException {
- PrintWriter w = new PrintWriter(writer);
+ throws SaveException {
+
+ PrintWriter w = new PrintWriter(writer);
saveProjectMember(member, w);
}
- /**
- * @param member
- * @param stream
- * @throws SaveException
- *
+ /*
* @see org.argouml.persistence.MemberFilePersister#save(org.argouml.kernel.ProjectMember, java.io.OutputStream)
*/
public void save(ProjectMember member, OutputStream stream)
- throws SaveException {
- PrintWriter w = new PrintWriter(stream);
+ throws SaveException {
+
+ PrintWriter w = new PrintWriter(stream);
saveProjectMember(member, w);
w.flush();
}
private void saveProjectMember(ProjectMember member, PrintWriter w)
- throws SaveException {
- try {
+ throws SaveException {
+
+ try {
if (member instanceof ProfileConfiguration) {
ProfileConfiguration pc = (ProfileConfiguration) member;
@@ -193,7 +181,8 @@
Profile profile = (Profile) it.next();
if (profile instanceof UserDefinedProfile) {
- UserDefinedProfile uprofile = (UserDefinedProfile) profile;
+ UserDefinedProfile uprofile =
+ (UserDefinedProfile) profile;
w.println("\t\t<userDefined>");
w.println("\t\t\t<filename>"
+ uprofile.getModelFile().getName()
@@ -232,7 +221,8 @@
private Collection readModelXMI(String xmi) throws UmlException {
XmiReader xmiReader = Model.getXmiReader();
- InputSource inputSource = new InputSource(new ByteArrayInputStream(xmi.getBytes()));
+ InputSource inputSource =
+ new InputSource(new ByteArrayInputStream(xmi.getBytes()));
Collection elements = xmiReader.parse(inputSource, true);
return elements;
}
Modified: trunk/src_new/org/argouml/persistence/UmlFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/UmlFilePersister.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/persistence/UmlFilePersister.java&p2=trunk/src_new/org/argouml/persistence/UmlFilePersister.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/persistence/UmlFilePersister.java (original)
+++ trunk/src_new/org/argouml/persistence/UmlFilePersister.java 2007-09-26 23:27:31-0700
@@ -70,6 +70,7 @@
import org.argouml.uml.ProjectMemberModel;
import org.argouml.uml.cognitive.ProjectMemberTodoList;
import org.argouml.uml.diagram.ProjectMemberDiagram;
+import org.argouml.uml.profile.ProfileConfiguration;
import org.argouml.util.ThreadUtils;
import org.tigris.gef.ocl.ExpansionException;
import org.tigris.gef.ocl.OCLExpander;
@@ -82,7 +83,7 @@
*
* @author Bob Tarling
*/
-class UmlFilePersister extends AbstractFilePersister {
+public class UmlFilePersister extends AbstractFilePersister {
/**
* The PERSISTENCE_VERSION is increased every time the persistence format
@@ -90,7 +91,7 @@
* This controls conversion of old persistence version files to be
* converted to the current one, keeping ArgoUML backwards compatible.
*/
- protected static final int PERSISTENCE_VERSION = 5;
+ public static final int PERSISTENCE_VERSION = 5;
/**
* The TOTAL_PHASES_LOAD constant is the number of phases used by the load
@@ -212,8 +213,9 @@
}
/**
- * The .uml save format is no longer available to save
- * @see org.argouml.persistence.AbstractFilePersister#isSaveEnabled()
+ * The .uml save format is no longer available to save.
+ *
+ * {@inheritDoc}
*/
public boolean isSaveEnabled() {
return true;
@@ -342,7 +344,8 @@
XmlInputStream inputStream = null;
try {
- Project p = ProjectFactory.getInstance().createProject(file.toURI());
+ Project p = ProjectFactory.getInstance()
+ .createProject(file.toURI());
// Run through any stylesheet upgrades
int fileVersion = getPersistenceVersionFromFile(file);
@@ -535,11 +538,12 @@
* Reads an XML file of uml format and extracts the
* persistence version number from the root tag.
*
- * @param file the XML file
+ * @param inputStream stream pointing to file to read.
* @return The version number
* @throws OpenException on any error
*/
- protected int getPersistenceVersion(InputStream inputStream) throws OpenException {
+ protected int getPersistenceVersion(InputStream inputStream)
+ throws OpenException {
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(inputStream,
@@ -601,11 +605,12 @@
* Reads an XML file of uml format and extracts the
* persistence version number from the root tag.
*
- * @param file the XML file
+ * @param inputStream the stream point to the XML file
* @return The ArgoUML release number
* @throws OpenException on any error
*/
- protected String getReleaseVersion(InputStream inputStream) throws OpenException {
+ protected String getReleaseVersion(InputStream inputStream)
+ throws OpenException {
BufferedReader reader = null;
try {
reader = new BufferedReader(new InputStreamReader(inputStream,
@@ -671,6 +676,8 @@
.getDiagramMemberFilePersister();
} else if (pm instanceof ProjectMemberTodoList) {
persister = new TodoListMemberFilePersister();
+ } else if (pm instanceof ProfileConfiguration) {
+ persister = new ProfileConfigurationFilePersister();
} else if (pm instanceof ProjectMemberModel) {
persister = new ModelMemberFilePersister();
}
@@ -691,6 +698,8 @@
.getDiagramMemberFilePersister();
} else if (tag.equals("todo")) {
persister = new TodoListMemberFilePersister();
+ } else if (tag.equals("profile")) {
+ persister = new ProfileConfigurationFilePersister();
} else if (tag.equals("xmi")) {
persister = new ModelMemberFilePersister();
}
@@ -700,7 +709,7 @@
/**
* Returns true. All Argo specific files have an icon.
*
- * @see org.argouml.persistence.AbstractFilePersister#hasAnIcon()
+ * {@inheritDoc}
*/
public boolean hasAnIcon() {
return true;
Modified: trunk/src_new/org/argouml/persistence/ZargoFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ZargoFilePersister.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/persistence/ZargoFilePersister.java&p2=trunk/src_new/org/argouml/persistence/ZargoFilePersister.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/persistence/ZargoFilePersister.java (original)
+++ trunk/src_new/org/argouml/persistence/ZargoFilePersister.java 2007-09-26 23:27:31-0700
@@ -52,6 +52,7 @@
import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectFactory;
import org.argouml.kernel.ProjectMember;
+import org.argouml.uml.profile.ProfileConfiguration;
import org.argouml.util.FileConstants;
import org.argouml.util.ThreadUtils;
import org.xml.sax.InputSource;
@@ -324,6 +325,7 @@
int pgmlCount = getPgmlCount(file);
boolean containsToDo = containsTodo(file);
+ boolean containsProfile = containsProfile(file);
// first read the .argo file from Zip
ZipInputStream zis =
@@ -368,6 +370,11 @@
if (containsToDo) {
writer.println("<member type='todo' name='.todo' />");
}
+ if (containsProfile) {
+ String type = ProfileConfiguration.EXTENSION;
+ writer.println("<member type='" + type + "' name='."
+ + type + "' />");
+ }
}
writer.println(line);
}
@@ -560,6 +567,10 @@
return !getEntryNames(file, ".todo").isEmpty();
}
+ private boolean containsProfile(File file) throws IOException {
+ return !getEntryNames(file, "." + ProfileConfiguration.EXTENSION).isEmpty();
+ }
+
/**
* Get a list of zip file entries which end with the given extension.
* If the extension is null, all entries are returned.
Modified: trunk/src_new/org/argouml/persistence/ZipFilePersister.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/ZipFilePersister.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/persistence/ZipFilePersister.java&p2=trunk/src_new/org/argouml/persistence/ZipFilePersister.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/persistence/ZipFilePersister.java (original)
+++ trunk/src_new/org/argouml/persistence/ZipFilePersister.java 2007-09-26 23:27:31-0700
@@ -46,6 +46,7 @@
import org.argouml.uml.ProjectMemberModel;
import org.argouml.uml.cognitive.ProjectMemberTodoList;
import org.argouml.uml.diagram.ProjectMemberDiagram;
+import org.argouml.uml.profile.ProfileConfiguration;
import org.xml.sax.InputSource;
/**
@@ -195,6 +196,8 @@
persister =
PersistenceManager.getInstance()
.getDiagramMemberFilePersister();
+ } else if (pm instanceof ProfileConfiguration) {
+ persister = new ProfileConfigurationFilePersister();
} else if (pm instanceof ProjectMemberTodoList) {
persister = new TodoListMemberFilePersister();
} else if (pm instanceof ProjectMemberModel) {
Modified: trunk/src_new/org/argouml/persistence/argo.tee
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/persistence/argo.tee?view=diff&rev=13614&p1=trunk/src_new/org/argouml/persistence/argo.tee&p2=trunk/src_new/org/argouml/persistence/argo.tee&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/persistence/argo.tee (original)
+++ trunk/src_new/org/argouml/persistence/argo.tee 2007-09-26 23:27:31-0700
@@ -43,6 +43,7 @@
<defaultshadowwidth><ocl>self.projectSettings.defaultShadowWidth</ocl></defaultshadowwidth>
<fontname><ocl>self.projectSettings.fontName</ocl></fontname>
<fontsize><ocl>self.projectSettings.fontSize</ocl></fontsize>
+ <defaultstereotypeview><ocl>self.projectSettings.defaultStereotypeView</ocl></defaultstereotypeview>
<generationoutputdir><ocl>self.projectSettings.generationOutputDir</ocl></generationoutputdir>
</settings>
Modified: trunk/src_new/org/argouml/ui/GUI.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/GUI.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/ui/GUI.java&p2=trunk/src_new/org/argouml/ui/GUI.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/ui/GUI.java (original)
+++ trunk/src_new/org/argouml/ui/GUI.java 2007-09-26 23:27:31-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2006 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
@@ -59,8 +59,10 @@
addSettingsTab(new SettingsTabEnvironment());
addSettingsTab(new SettingsTabUser());
addSettingsTab(new SettingsTabAppearance());
+ addSettingsTab(new SettingsTabProfile());
addProjectSettingsTab(new ProjectSettingsTabProperties());
+ addProjectSettingsTab(new ProjectSettingsTabProfile());
}
/**
@@ -86,7 +88,7 @@
*
* @param panel The GUISettingsTabInterface to add.
*/
- public void addSettingsTab(GUISettingsTabInterface panel) {
+ public void addSettingsTab(final GUISettingsTabInterface panel) {
settingsTabs.add(panel);
}
@@ -95,7 +97,7 @@
*
* @return A List of {@link GUISettingsTabInterface}.
*/
- public List getSettingsTabs() {
+ public final List<GUISettingsTabInterface> getSettingsTabs() {
return Collections.unmodifiableList(settingsTabs);
}
@@ -110,7 +112,7 @@
*
* @param panel The GUISettingsTabInterface to add.
*/
- public void addProjectSettingsTab(GUISettingsTabInterface panel) {
+ public void addProjectSettingsTab(final GUISettingsTabInterface panel) {
projectSettingsTabs.add(panel);
}
@@ -119,7 +121,7 @@
*
* @return A List of {@link GUISettingsTabInterface}.
*/
- public List getProjectSettingsTabs() {
+ public final List<GUISettingsTabInterface> getProjectSettingsTabs() {
return Collections.unmodifiableList(projectSettingsTabs);
}
}
Copied: trunk/src_new/org/argouml/ui/ProfileSelectionTab.java (from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProfileSelectionTab.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/ProfileSelectionTab.java?view=diff&rev=13614&p1=/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProfileSelectionTab.java&p2=trunk/src_new/org/argouml/ui/ProfileSelectionTab.java&r1=13355&r2=13614
==============================================================================
--- /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/ProfileSelectionTab.java (original)
+++ trunk/src_new/org/argouml/ui/ProfileSelectionTab.java 2007-09-26 23:27:31-0700
@@ -30,7 +30,8 @@
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
import javax.swing.BoxLayout;
import javax.swing.JButton;
@@ -87,7 +88,8 @@
private ProfileManager profileManager = ProfileManagerImpl
.getInstance();
- private Vector<ListDataListener> listeners = new Vector<ListDataListener>();
+ private List<ListDataListener> listeners =
+ new ArrayList<ListDataListener>();
/**
* @param arg0
@@ -104,7 +106,7 @@
ListDataEvent evt = new ListDataEvent(this,
ListDataEvent.CONTENTS_CHANGED, 0, getSize());
for (int i = 0; i < listeners.size(); ++i) {
- listeners.elementAt(i).contentsChanged(evt);
+ listeners.get(i).contentsChanged(evt);
}
}
@@ -115,14 +117,14 @@
public Profile getProfileAt(int n) {
ProfileConfiguration config = ProjectManager.getManager()
.getCurrentProject().getProfileConfiguration();
- Vector registeredProfiles = profileManager.getRegisteredProfiles();
+ List registeredProfiles = profileManager.getRegisteredProfiles();
int count = 0;
for (int i = 0; i < registeredProfiles.size(); ++i) {
if (!config.getProfiles().contains(
- registeredProfiles.elementAt(i))) {
+ registeredProfiles.get(i))) {
if (count == n) {
- return ((Profile) registeredProfiles.elementAt(i));
+ return ((Profile) registeredProfiles.get(i));
}
++count;
}
@@ -152,21 +154,20 @@
public int getSize() {
ProfileConfiguration config = ProjectManager.getManager()
.getCurrentProject().getProfileConfiguration();
- Vector registeredProfiles = profileManager.getRegisteredProfiles();
+ List registeredProfiles = profileManager.getRegisteredProfiles();
int count = 0;
for (int i = 0; i < registeredProfiles.size(); ++i) {
if (!config.getProfiles().contains(
- registeredProfiles.elementAt(i))) {
+ registeredProfiles.get(i))) {
++count;
}
}
return count;
}
- /**
- * @param arg0
- * @see javax.swing.ListModel#removeListDataListener(javax.swing.event.ListDataListener)
- */
+ /*
+ * @see javax.swing.ListModel#removeListDataListener(javax.swing.event.ListDataListener)
+ */
public void removeListDataListener(ListDataListener arg0) {
listeners.remove(arg0);
}
@@ -178,12 +179,12 @@
* @author maurelio1234
*/
private class UsedProfilesListModel implements ListModel {
- private Vector<ListDataListener> listeners = new Vector<ListDataListener>();
+ private List<ListDataListener> listeners =
+ new ArrayList<ListDataListener>();
- /**
- * @param arg0
- * @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener)
- */
+ /*
+ * @see javax.swing.ListModel#addListDataListener(javax.swing.event.ListDataListener)
+ */
public void addListDataListener(ListDataListener arg0) {
listeners.add(arg0);
}
@@ -195,7 +196,7 @@
ListDataEvent evt = new ListDataEvent(this,
ListDataEvent.CONTENTS_CHANGED, 0, getSize());
for (int i = 0; i < listeners.size(); ++i) {
- listeners.elementAt(i).contentsChanged(evt);
+ listeners.get(i).contentsChanged(evt);
}
}
@@ -206,7 +207,7 @@
public Profile getProfileAt(int n) {
ProfileConfiguration config = ProjectManager.getManager()
.getCurrentProject().getProfileConfiguration();
- return ((Profile) config.getProfiles().elementAt(n));
+ return config.getProfiles().get(n);
}
/**
@@ -218,8 +219,7 @@
ProfileConfiguration config = ProjectManager.getManager()
.getCurrentProject().getProfileConfiguration();
if (n >= 0 && n < config.getProfiles().size()) {
- return ((Profile) config.getProfiles().elementAt(n))
- .getDisplayName();
+ return config.getProfiles().get(n).getDisplayName();
} else {
return null;
}
@@ -235,10 +235,9 @@
return config.getProfiles().size();
}
- /**
- * @param arg0
- * @see javax.swing.ListModel#removeListDataListener(javax.swing.event.ListDataListener)
- */
+ /*
+ * @see javax.swing.ListModel#removeListDataListener(javax.swing.event.ListDataListener)
+ */
public void removeListDataListener(ListDataListener arg0) {
listeners.remove(arg0);
}
@@ -297,13 +296,12 @@
add(lffPanel);
}
- /**
- * @param arg0
+ /*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
- AvailableProfilesListModel modelAvl = ((AvailableProfilesListModel) availableList
- .getModel());
+ AvailableProfilesListModel modelAvl =
+ ((AvailableProfilesListModel) availableList.getModel());
UsedProfilesListModel modelUsd = ((UsedProfilesListModel) usedList
.getModel());
@@ -347,9 +345,10 @@
public boolean accept(File file) {
return file.isDirectory()
- || (file.isFile()
- && (file.getName().toLowerCase().endsWith(".xml")
- || file.getName().toLowerCase().endsWith(".xmi")));
+ || (file.isFile() && (file.getName().toLowerCase()
+ .endsWith(".xml")
+ || file.getName()
+ .toLowerCase().endsWith(".xmi")));
}
public String getDescription() {
@@ -369,8 +368,9 @@
ProjectManager.getManager().getCurrentProject()
.getProfileConfiguration().addProfile(profile);
- UsedProfilesListModel model = ((UsedProfilesListModel) usedList
- .getModel());
+ UsedProfilesListModel model =
+ (UsedProfilesListModel) usedList.getModel();
+
model.fireListeners();
} catch (ProfileException e) {
JOptionPane.showMessageDialog(this, Translator
Modified: trunk/src_new/org/argouml/ui/ProjectSettingsTabProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/ProjectSettingsTabProfile.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/ui/ProjectSettingsTabProfile.java&p2=trunk/src_new/org/argouml/ui/ProjectSettingsTabProfile.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/ui/ProjectSettingsTabProfile.java (original)
+++ trunk/src_new/org/argouml/ui/ProjectSettingsTabProfile.java 2007-09-26 23:27:31-0700
@@ -1,4 +1,4 @@
- // $Id: ProfileSelectionTab.java 13040 2007-07-10 20:00:25Z linus $
+// $Id: ProfileSelectionTab.java 13040 2007-07-10 20:00:25Z linus $
// Copyright (c) 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
@@ -32,7 +32,8 @@
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
import javax.swing.BoxLayout;
import javax.swing.DefaultComboBoxModel;
@@ -107,31 +108,38 @@
DefaultComboBoxModel cmodel = new DefaultComboBoxModel();
stereoField.setModel(cmodel);
- cmodel.addElement(Translator.localize("menu.popup.stereotype-view.textual"));
- cmodel.addElement(Translator.localize("menu.popup.stereotype-view.big-icon"));
- cmodel.addElement(Translator.localize("menu.popup.stereotype-view.small-icon"));
+ cmodel.addElement(Translator
+ .localize("menu.popup.stereotype-view.textual"));
+ cmodel.addElement(Translator
+ .localize("menu.popup.stereotype-view.big-icon"));
+ cmodel.addElement(Translator
+ .localize("menu.popup.stereotype-view.small-icon"));
stereoField.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
- ProjectSettings ps = ProjectManager.getManager().getCurrentProject().getProjectSettings();
+ ProjectSettings ps = ProjectManager.getManager()
+ .getCurrentProject().getProjectSettings();
Object src = e.getSource();
if (src == stereoField) {
Object item = e.getItem();
- DefaultComboBoxModel model = (DefaultComboBoxModel) stereoField
- .getModel();
+ DefaultComboBoxModel model =
+ (DefaultComboBoxModel) stereoField.getModel();
int idx = model.getIndexOf(item);
switch (idx) {
case 0:
- ps.setDefaultStereotypeView(FigNodeModelElement.STEREOTYPE_VIEW_TEXTUAL);
+ ps.setDefaultStereotypeView(
+ FigNodeModelElement.STEREOTYPE_VIEW_TEXTUAL);
break;
case 1:
- ps.setDefaultStereotypeView(FigNodeModelElement.STEREOTYPE_VIEW_BIG_ICON);
+ ps.setDefaultStereotypeView(
+ FigNodeModelElement.STEREOTYPE_VIEW_BIG_ICON);
break;
case 2:
- ps.setDefaultStereotypeView(FigNodeModelElement.STEREOTYPE_VIEW_SMALL_ICON);
+ ps.setDefaultStereotypeView(
+ FigNodeModelElement.STEREOTYPE_VIEW_SMALL_ICON);
break;
}
}
@@ -194,20 +202,23 @@
}
private void refreshLists() {
- availableList.setModel(new DefaultComboBoxModel(getAvailableProfiles()));
- usedList.setModel(new DefaultComboBoxModel(getUsedProfiles()));
+ availableList.setModel(
+ new DefaultComboBoxModel(getAvailableProfiles().toArray()));
+ usedList.setModel(
+ new DefaultComboBoxModel(getUsedProfiles().toArray()));
}
- private Vector<Profile> getUsedProfiles() {
- return new Vector<Profile>(ProjectManager.getManager()
+ private List<Profile> getUsedProfiles() {
+ return new ArrayList<Profile>(ProjectManager.getManager()
.getCurrentProject().getProfileConfiguration().getProfiles());
}
- private Vector<Profile> getAvailableProfiles() {
- Vector<Profile> used = getUsedProfiles();
- Vector<Profile> ret = new Vector<Profile>();
+ private List<Profile> getAvailableProfiles() {
+ List<Profile> used = getUsedProfiles();
+ List<Profile> ret = new ArrayList<Profile>();
- for (Profile profile : ProfileManagerImpl.getInstance().getRegisteredProfiles()) {
+ for (Profile profile : ProfileManagerImpl.getInstance()
+ .getRegisteredProfiles()) {
if (!used.contains(profile)) {
ret.add(profile);
}
@@ -216,50 +227,47 @@
return ret;
}
- /**
- * @param arg0
+ /*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
- MutableComboBoxModel modelAvl = ((MutableComboBoxModel) availableList
- .getModel());
- MutableComboBoxModel modelUsd = ((MutableComboBoxModel) usedList
- .getModel());
+ MutableComboBoxModel modelAvailable =
+ ((MutableComboBoxModel) availableList.getModel());
+ MutableComboBoxModel modelUsed =
+ ((MutableComboBoxModel) usedList.getModel());
if (arg0.getSource() == addButton) {
if (availableList.getSelectedIndex() != -1) {
- Profile selected = (Profile) modelAvl.getElementAt(availableList
- .getSelectedIndex());
- modelUsd.addElement(selected);
- modelAvl.removeElement(selected);
+ Profile selected = (Profile) modelAvailable
+ .getElementAt(availableList.getSelectedIndex());
+ modelUsed.addElement(selected);
+ modelAvailable.removeElement(selected);
for (Profile profile : getAvailableDependents(selected)) {
- modelUsd.addElement(profile);
- modelAvl.removeElement(profile);
+ modelUsed.addElement(profile);
+ modelAvailable.removeElement(profile);
}
}
} else if (arg0.getSource() == removeButton) {
if (usedList.getSelectedIndex() != -1) {
- Profile selected = (Profile) modelUsd.getElementAt(usedList
+ Profile selected = (Profile) modelUsed.getElementAt(usedList
.getSelectedIndex());
- Vector<Profile> dependents = getActiveDependents(selected);
+ List<Profile> dependents = getActiveDependents(selected);
boolean remove = true;
if (!dependents.isEmpty()) {
+ String message = Translator.localize(
+ "tab.profiles.confirmdeletewithdependencies",
+ new Object[] {dependents});
+ String title = Translator.localize(
+ "tab.profiles.confirmdeletewithdependencies.title");
remove = (JOptionPane
.showConfirmDialog(
this,
- Translator
- .localize("tab.profiles.confirmdeletewithdependencies")
- + dependents +
- Translator
- .localize("tab.profiles.confirmdeletewithdependencies.question")
- ,
- Translator
- .localize("tab.profiles.confirmdeletewithdependencies.title"),
-
- JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION);
+ message,
+ title,
+ JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION);
}
if (remove) {
@@ -278,25 +286,26 @@
}
if (remove) {
- modelUsd.removeElement(selected);
- modelAvl.addElement(selected);
-
+ modelUsed.removeElement(selected);
+ modelAvailable.addElement(selected);
+
for (Profile profile : dependents) {
- modelUsd.removeElement(profile);
- modelAvl.addElement(profile);
+ modelUsed.removeElement(profile);
+ modelAvailable.addElement(profile);
}
}
}
}
} else if (arg0.getSource() == unregisterProfile) {
if (availableList.getSelectedIndex() != -1) {
- Profile selected = (Profile) modelAvl.getElementAt(availableList
- .getSelectedIndex());
+ Profile selected = (Profile) modelAvailable
+ .getElementAt(availableList.getSelectedIndex());
if (selected instanceof UserDefinedProfile) {
- ProfileManagerImpl.getInstance().removeProfile(selected);
- modelAvl.removeElement(selected);
+ ProfileManagerImpl.getInstance().removeProfile(selected);
+ modelAvailable.removeElement(selected);
} else {
- JOptionPane.showMessageDialog(this,Translator.localize("tab.profiles.cannotdelete"));
+ JOptionPane.showMessageDialog(this, Translator
+ .localize("tab.profiles.cannotdelete"));
}
}
} else if (arg0.getSource() == loadFromFile) {
@@ -324,7 +333,7 @@
UserDefinedProfile profile = new UserDefinedProfile(file);
ProfileManagerImpl.getInstance().registerProfile(profile);
- modelAvl.addElement(profile);
+ modelAvailable.addElement(profile);
} catch (ProfileException e) {
JOptionPane.showMessageDialog(this, Translator
.localize("tab.profiles.userdefined.errorloading"));
@@ -336,12 +345,12 @@
usedList.validate();
}
- private Vector<Profile> getAvailableDependents(Profile selected) {
+ private List<Profile> getAvailableDependents(Profile selected) {
MutableComboBoxModel modelAvl = ((MutableComboBoxModel) availableList
.getModel());
- Vector<Profile> ret = new Vector<Profile>();
- for(int i=0;i<modelAvl.getSize();++i) {
+ List<Profile> ret = new ArrayList<Profile>();
+ for (int i = 0; i < modelAvl.getSize(); ++i) {
Profile p = (Profile) modelAvl.getElementAt(i);
if (!p.equals(selected) && selected.getDependencies().contains(p)) {
@@ -352,12 +361,12 @@
return ret;
}
- private Vector<Profile> getActiveDependents(Profile selected) {
+ private List<Profile> getActiveDependents(Profile selected) {
MutableComboBoxModel modelUsd = ((MutableComboBoxModel) usedList
.getModel());
- Vector<Profile> ret = new Vector<Profile>();
- for(int i=0;i<modelUsd.getSize();++i) {
+ List<Profile> ret = new ArrayList<Profile>();
+ for (int i = 0; i < modelUsd.getSize(); ++i) {
Profile p = (Profile) modelUsd.getElementAt(i);
if (!p.equals(selected) && p.getDependencies().contains(selected)) {
@@ -393,7 +402,8 @@
}
public void handleSettingsTabRefresh() {
- ProjectSettings ps = ProjectManager.getManager().getCurrentProject().getProjectSettings();
+ ProjectSettings ps = ProjectManager.getManager().getCurrentProject()
+ .getProjectSettings();
switch (ps.getDefaultStereotypeViewValue()) {
case FigNodeModelElement.STEREOTYPE_VIEW_TEXTUAL:
@@ -411,15 +421,16 @@
}
public void handleSettingsTabSave() {
- Vector<Profile> toRemove = new Vector<Profile>();
- ProfileConfiguration pc = ProjectManager.getManager().getCurrentProject().getProfileConfiguration();
+ List<Profile> toRemove = new ArrayList<Profile>();
+ ProfileConfiguration pc = ProjectManager.getManager()
+ .getCurrentProject().getProfileConfiguration();
- Vector<Profile> usedItens = new Vector<Profile>();
+ List<Profile> usedItens = new ArrayList<Profile>();
MutableComboBoxModel modelUsd = ((MutableComboBoxModel) usedList
.getModel());
- for(int i=0;i<modelUsd.getSize();++i) {
+ for (int i = 0; i < modelUsd.getSize(); ++i) {
usedItens.add((Profile) modelUsd.getElementAt(i));
}
Modified: trunk/src_new/org/argouml/ui/SettingsTabPreferences.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/SettingsTabPreferences.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/ui/SettingsTabPreferences.java&p2=trunk/src_new/org/argouml/ui/SettingsTabPreferences.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/ui/SettingsTabPreferences.java (original)
+++ trunk/src_new/org/argouml/ui/SettingsTabPreferences.java 2007-09-26 23:27:31-0700
@@ -30,17 +30,12 @@
import java.awt.Insets;
import javax.swing.JCheckBox;
-import javax.swing.JLabel;
-import javax.swing.JOptionPane;
import javax.swing.JPanel;
-import javax.swing.JTextField;
import org.argouml.application.api.Argo;
import org.argouml.application.api.GUISettingsTabInterface;
import org.argouml.configuration.Configuration;
import org.argouml.i18n.Translator;
-import org.argouml.kernel.ProjectManager;
-import org.argouml.uml.ProfileException;
/**
* Settings tab panel for handling ArgoUML application related settings.
@@ -54,7 +49,6 @@
private JCheckBox chkSplash;
private JCheckBox chkReloadRecent;
private JCheckBox chkStripDiagrams;
- private JTextField defaultProfile;
/**
* The constructor.
@@ -90,15 +84,7 @@
chkStripDiagrams = j3;
top.add(chkStripDiagrams, checkConstraints);
- // TODO: Profile field is currently read-only, need a selector
- checkConstraints.gridy++;
- top.add(new JLabel(Translator.localize("label.default-profile")),
- checkConstraints);
- defaultProfile = new JTextField();
- checkConstraints.gridy++;
checkConstraints.fill = GridBagConstraints.HORIZONTAL;
- top.add(defaultProfile, checkConstraints);
- //defaultProfile.setEnabled(false);
add(top, BorderLayout.NORTH);
}
@@ -114,8 +100,6 @@
chkStripDiagrams.setSelected(
Configuration.getBoolean(Argo.KEY_XMI_STRIP_DIAGRAMS,
false));
- defaultProfile.setText(ProjectManager.getManager().getCurrentProject()
- .getProfile().getProfileModelFilename());
}
/*
@@ -127,14 +111,6 @@
chkReloadRecent.isSelected());
Configuration.setBoolean(Argo.KEY_XMI_STRIP_DIAGRAMS,
chkStripDiagrams.isSelected());
- try {
- ProjectManager.getManager().getCurrentProject().getProfile()
- .setProfileModelFilename(defaultProfile.getText());
- } catch (ProfileException e) {
- // shouldn't happen if profile was validated when selected
- JOptionPane.showMessageDialog(this, "Setting UML profile failed",
- "Profile save error", JOptionPane.ERROR_MESSAGE);
- }
}
/*
Modified: trunk/src_new/org/argouml/ui/SettingsTabProfile.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/SettingsTabProfile.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/ui/SettingsTabProfile.java&p2=trunk/src_new/org/argouml/ui/SettingsTabProfile.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/ui/SettingsTabProfile.java (original)
+++ trunk/src_new/org/argouml/ui/SettingsTabProfile.java 2007-09-26 23:27:31-0700
@@ -32,12 +32,11 @@
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.File;
-import java.util.Iterator;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
import javax.swing.BoxLayout;
import javax.swing.DefaultComboBoxModel;
-import javax.swing.DefaultListModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JFileChooser;
@@ -46,28 +45,21 @@
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
-import javax.swing.ListModel;
import javax.swing.MutableComboBoxModel;
-import javax.swing.event.ListDataEvent;
-import javax.swing.event.ListDataListener;
import javax.swing.filechooser.FileFilter;
import org.argouml.application.api.GUISettingsTabInterface;
import org.argouml.configuration.Configuration;
import org.argouml.configuration.ConfigurationKey;
import org.argouml.i18n.Translator;
-import org.argouml.kernel.ProjectManager;
-import org.argouml.ui.explorer.ExplorerEventAdaptor;
import org.argouml.uml.diagram.ui.FigNodeModelElement;
import org.argouml.uml.profile.Profile;
-import org.argouml.uml.profile.ProfileConfiguration;
import org.argouml.uml.profile.ProfileException;
-import org.argouml.uml.profile.ProfileManager;
import org.argouml.uml.profile.ProfileManagerImpl;
import org.argouml.uml.profile.UserDefinedProfile;
/**
- * The Tab containing the global settings for proifiles
+ * The Tab containing the global settings for profiles
*
* @author Marcos Aurélio
*/
@@ -106,8 +98,8 @@
/**
* The configuration key for the default stereotype view.
*/
- public static final ConfigurationKey KEY_DEFAULT_STEREOTYPE_VIEW = Configuration
- .makeKey("profiles", "stereotypeView");
+ public static final ConfigurationKey KEY_DEFAULT_STEREOTYPE_VIEW =
+ Configuration.makeKey("profiles", "stereotypeView");
private JLabel stereoLabel =
new JLabel(Translator.localize("menu.popup.stereotype-view") + ": ");
@@ -132,9 +124,12 @@
DefaultComboBoxModel cmodel = new DefaultComboBoxModel();
stereoField.setModel(cmodel);
- cmodel.addElement(Translator.localize("menu.popup.stereotype-view.textual"));
- cmodel.addElement(Translator.localize("menu.popup.stereotype-view.big-icon"));
- cmodel.addElement(Translator.localize("menu.popup.stereotype-view.small-icon"));
+ cmodel.addElement(Translator
+ .localize("menu.popup.stereotype-view.textual"));
+ cmodel.addElement(Translator
+ .localize("menu.popup.stereotype-view.big-icon"));
+ cmodel.addElement(Translator
+ .localize("menu.popup.stereotype-view.small-icon"));
stereoField.addItemListener(new ItemListener() {
@@ -143,8 +138,8 @@
if (src == stereoField) {
Object item = e.getItem();
- DefaultComboBoxModel model = (DefaultComboBoxModel) stereoField
- .getModel();
+ DefaultComboBoxModel model =
+ (DefaultComboBoxModel) stereoField.getModel();
int idx = model.getIndexOf(item);
switch (idx) {
@@ -170,7 +165,8 @@
////////////
- directoryList.setPrototypeCellValue("123456789012345678901234567890123456789012345678901234567890");
+ directoryList.setPrototypeCellValue(
+ "123456789012345678901234567890123456789012345678901234567890");
directoryList.setMinimumSize(new Dimension(50, 50));
JPanel sdirPanel = new JPanel();
@@ -252,21 +248,25 @@
}
private void refreshLists() {
- availableList.setModel(new DefaultComboBoxModel(getAvailableProfiles()));
- defaultList.setModel(new DefaultComboBoxModel(getUsedProfiles()));
- directoryList.setModel(new DefaultComboBoxModel(new Vector<String>(
- ProfileManagerImpl.getInstance().getSearchPathDirectories())));
+ availableList.setModel(new DefaultComboBoxModel(getAvailableProfiles()
+ .toArray()));
+ defaultList.setModel(new DefaultComboBoxModel(getUsedProfiles()
+ .toArray()));
+ directoryList.setModel(new DefaultComboBoxModel(ProfileManagerImpl
+ .getInstance().getSearchPathDirectories().toArray()));
}
- private Vector<Profile> getUsedProfiles() {
- return new Vector<Profile>(ProfileManagerImpl.getInstance().getDefaultProfiles());
+ private List<Profile> getUsedProfiles() {
+ return new ArrayList<Profile>(ProfileManagerImpl.getInstance()
+ .getDefaultProfiles());
}
- private Vector<Profile> getAvailableProfiles() {
- Vector<Profile> used = getUsedProfiles();
- Vector<Profile> ret = new Vector<Profile>();
+ private List<Profile> getAvailableProfiles() {
+ List<Profile> used = getUsedProfiles();
+ List<Profile> ret = new ArrayList<Profile>();
- for (Profile profile : ProfileManagerImpl.getInstance().getRegisteredProfiles()) {
+ for (Profile profile : ProfileManagerImpl.getInstance()
+ .getRegisteredProfiles()) {
if (!used.contains(profile)) {
ret.add(profile);
}
@@ -275,8 +275,7 @@
return ret;
}
- /**
- * @param arg0
+ /*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent arg0) {
@@ -316,11 +315,11 @@
fileChooser.setFileFilter(new FileFilter() {
public boolean accept(File file) {
- return file.isDirectory()
- || (file.isFile()
- && (file.getName().toLowerCase().endsWith(".xml")
- || file.getName().toLowerCase().endsWith(".xmi")));
- }
+ return file.isDirectory()
+ || (file.isFile() && (file.getName().toLowerCase()
+ .endsWith(".xml") || file.getName()
+ .toLowerCase().endsWith(".xmi")));
+ }
public String getDescription() {
return "*.XMI";
@@ -347,7 +346,8 @@
} else if (arg0.getSource() == removeDirectory) {
if (directoryList.getSelectedIndex() != -1) {
int idx = directoryList.getSelectedIndex();
- ((MutableComboBoxModel)directoryList.getModel()).removeElementAt(idx);
+ ((MutableComboBoxModel) directoryList.getModel())
+ .removeElementAt(idx);
}
} else if (arg0.getSource() == refreshProfiles) {
boolean refresh = (JOptionPane
@@ -386,7 +386,8 @@
String path = file.getAbsolutePath();
- ((MutableComboBoxModel)directoryList.getModel()).addElement(path);
+ ((MutableComboBoxModel) directoryList.getModel())
+ .addElement(path);
}
}
@@ -437,19 +438,20 @@
}
public void handleSettingsTabSave() {
- Vector<Profile> toRemove = new Vector<Profile>();
- Vector<Profile> usedItens = new Vector<Profile>();
+ List<Profile> toRemove = new ArrayList<Profile>();
+ List<Profile> usedItens = new ArrayList<Profile>();
MutableComboBoxModel modelUsd = ((MutableComboBoxModel) defaultList
.getModel());
MutableComboBoxModel modelDir = ((MutableComboBoxModel) directoryList
.getModel());
- for(int i=0;i<modelUsd.getSize();++i) {
+ for (int i = 0; i < modelUsd.getSize(); ++i) {
usedItens.add((Profile) modelUsd.getElementAt(i));
}
-
- for (Profile profile : ProfileManagerImpl.getInstance().getDefaultProfiles()) {
+
+ for (Profile profile : ProfileManagerImpl.getInstance()
+ .getDefaultProfiles()) {
if (!usedItens.contains(profile)) {
toRemove.add(profile);
}
@@ -458,38 +460,41 @@
for (Profile profile : toRemove) {
ProfileManagerImpl.getInstance().removeFromDefaultProfiles(profile);
}
-
+
for (Profile profile : usedItens) {
- if (!ProfileManagerImpl.getInstance().getDefaultProfiles().contains(profile)) {
+ if (!ProfileManagerImpl.getInstance().getDefaultProfiles()
+ .contains(profile)) {
ProfileManagerImpl.getInstance().addToDefaultProfiles(profile);
}
}
-
- ///////////
-
- Vector<String> toRemoveDir = new Vector<String>();
- Vector<String> usedItensDir = new Vector<String>();
+
+ List<String> toRemoveDir = new ArrayList<String>();
+ List<String> usedItensDir = new ArrayList<String>();
- for(int i=0;i<modelDir.getSize();++i) {
+ for (int i = 0; i < modelDir.getSize(); ++i) {
usedItensDir.add((String) modelDir.getElementAt(i));
}
- for (String dirEntry : ProfileManagerImpl.getInstance().getSearchPathDirectories()) {
+ for (String dirEntry : ProfileManagerImpl.getInstance()
+ .getSearchPathDirectories()) {
if (!usedItensDir.contains(dirEntry)) {
toRemoveDir.add(dirEntry);
}
}
for (String dirEntry : toRemoveDir) {
- ProfileManagerImpl.getInstance().removeSearchPathDirectory(dirEntry);
+ ProfileManagerImpl.getInstance()
+ .removeSearchPathDirectory(dirEntry);
}
-
+
for (String dirEntry : usedItensDir) {
- if (!ProfileManagerImpl.getInstance().getSearchPathDirectories().contains(dirEntry)) {
- ProfileManagerImpl.getInstance().addSearchPathDirectory(dirEntry);
+ if (!ProfileManagerImpl.getInstance().getSearchPathDirectories()
+ .contains(dirEntry)) {
+ ProfileManagerImpl.getInstance().addSearchPathDirectory(
+ dirEntry);
}
}
-
+
}
}
Modified: trunk/src_new/org/argouml/ui/StylePanelFig.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/StylePanelFig.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/ui/StylePanelFig.java&p2=trunk/src_new/org/argouml/ui/StylePanelFig.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/ui/StylePanelFig.java (original)
+++ trunk/src_new/org/argouml/ui/StylePanelFig.java 2007-09-26 23:27:31-0700
@@ -33,21 +33,24 @@
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
+import javax.swing.DefaultComboBoxModel;
import javax.swing.JColorChooser;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JTextField;
import javax.swing.text.Document;
+import org.tigris.gef.presentation.Fig;
+import org.tigris.gef.ui.ColorRenderer;
+
import org.argouml.i18n.Translator;
import org.argouml.swingext.SpacerPanel;
import org.argouml.uml.diagram.ui.FigEdgeModelElement;
-import org.tigris.gef.presentation.Fig;
-import org.tigris.gef.ui.ColorRenderer;
+import org.argouml.uml.diagram.ui.FigNodeModelElement;
/**
* The basic stylepanel which provides the boundaries box,
- * line and fill color information.
+ * line and fill color information and the stereotype view combo box.
*
*/
public class StylePanelFig
@@ -72,6 +75,11 @@
private JComboBox lineField = new JComboBox();
+ private JLabel stereoLabel =
+ new JLabel(Translator.localize("menu.popup.stereotype-view") + ": ");
+
+ private JComboBox stereoField = new JComboBox();
+
private SpacerPanel spacer = new SpacerPanel();
private SpacerPanel spacer2 = new SpacerPanel();
@@ -102,6 +110,7 @@
bboxField.addFocusListener(this);
fillField.addItemListener(this);
lineField.addItemListener(this);
+ stereoField.addItemListener(this);
fillField.setRenderer(new ColorRenderer());
lineField.setRenderer(new ColorRenderer());
@@ -117,6 +126,10 @@
lineLabel.setLabelFor(lineField);
add(lineLabel);
add(lineField);
+
+ stereoLabel.setLabelFor(stereoField);
+ add(stereoLabel);
+ add(stereoField);
}
/**
@@ -164,6 +177,16 @@
lineField.addItem(Color.orange);
lineField.addItem(Color.pink);
lineField.addItem(CUSTOM_ITEM);
+
+ DefaultComboBoxModel model = new DefaultComboBoxModel();
+ stereoField.setModel(model);
+
+ model.addElement(Translator
+ .localize("menu.popup.stereotype-view.textual"));
+ model.addElement(Translator
+ .localize("menu.popup.stereotype-view.big-icon"));
+ model.addElement(Translator
+ .localize("menu.popup.stereotype-view.small-icon"));
}
/**
@@ -248,6 +271,24 @@
lineField.setSelectedIndex(0);
}
+ stereoField.setEnabled(target instanceof FigNodeModelElement);
+ stereoLabel.setEnabled(target instanceof FigNodeModelElement);
+
+ if (target instanceof FigNodeModelElement) {
+ FigNodeModelElement fig = (FigNodeModelElement) target;
+
+ switch (fig.getStereotypeView()) {
+ case FigNodeModelElement.STEREOTYPE_VIEW_TEXTUAL:
+ stereoField.setSelectedIndex(0);
+ break;
+ case FigNodeModelElement.STEREOTYPE_VIEW_BIG_ICON:
+ stereoField.setSelectedIndex(1);
+ break;
+ case FigNodeModelElement.STEREOTYPE_VIEW_SMALL_ICON:
+ stereoField.setSelectedIndex(2);
+ break;
+ }
+ }
}
/**
@@ -441,6 +482,29 @@
target.getLineColor());
}
setTargetLine();
+ } else if (src == stereoField) {
+ if (target instanceof FigNodeModelElement) {
+ Object item = e.getItem();
+ DefaultComboBoxModel model =
+ (DefaultComboBoxModel) stereoField.getModel();
+ int idx = model.getIndexOf(item);
+ FigNodeModelElement fig = (FigNodeModelElement) target;
+
+ switch (idx) {
+ case 0:
+ fig.setStereotypeView(
+ FigNodeModelElement.STEREOTYPE_VIEW_TEXTUAL);
+ break;
+ case 1:
+ fig.setStereotypeView(
+ FigNodeModelElement.STEREOTYPE_VIEW_BIG_ICON);
+ break;
+ case 2:
+ fig.setStereotypeView(
+ FigNodeModelElement.STEREOTYPE_VIEW_SMALL_ICON);
+ break;
+ }
+ }
}
}
}
@@ -476,7 +540,7 @@
// Empty implementation - we only care about keyTyped
}
- /**
+ /*
* Tests if enter is pressed in the _bbodField so we need to set the target
* bounds.
*
Modified: trunk/src_new/org/argouml/ui/explorer/ExplorerPopup.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/ExplorerPopup.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/ui/explorer/ExplorerPopup.java&p2=trunk/src_new/org/argouml/ui/explorer/ExplorerPopup.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/ExplorerPopup.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/ExplorerPopup.java 2007-09-26 23:27:31-0700
@@ -56,6 +56,9 @@
import org.argouml.uml.diagram.ui.ActionAddExistingNode;
import org.argouml.uml.diagram.ui.ActionAddExistingNodes;
import org.argouml.uml.diagram.ui.ActionSaveDiagramToClipboard;
+import org.argouml.uml.profile.Profile;
+import org.argouml.uml.profile.ProfileConfiguration;
+import org.argouml.uml.profile.ProfileException;
import org.argouml.uml.ui.ActionActivityDiagram;
import org.argouml.uml.ui.ActionAddPackage;
import org.argouml.uml.ui.ActionClassDiagram;
@@ -92,6 +95,9 @@
public ExplorerPopup(Object selectedItem, MouseEvent me) {
super("Explorer popup menu");
+ final Project currentProject =
+ ProjectManager.getManager().getCurrentProject();
+
/* Check if multiple items are selected. */
boolean multiSelect =
TargetManager.getInstance().getTargets().size() > 1;
@@ -99,13 +105,14 @@
boolean modelElementsOnly = true;
for (Iterator it = TargetManager.getInstance().getTargets().iterator();
it.hasNext() && modelElementsOnly; ) {
- if (!Model.getFacade().isAUMLElement(it.next())) {
+ Object element = it.next();
+ if (!Model.getFacade().isAUMLElement(element)
+ // profile elements are NOT model elements
+ || isRelatedToProfiles(currentProject, element)) {
modelElementsOnly = false;
}
}
- final Project currentProject =
- ProjectManager.getManager().getCurrentProject();
final ArgoDiagram activeDiagram = currentProject.getActiveDiagram();
// TODO: I've made some attempt to rationalize the conditions here
@@ -126,18 +133,27 @@
// this.add(action);
// }
- if (!multiSelect) {
+ if (!multiSelect
+ // a profile element is not considered a selection
+ && !isRelatedToProfiles(currentProject, selectedItem)) {
initMenuCreateDiagrams();
this.add(createDiagrams);
}
+ if (!multiSelect && selectedItem instanceof Profile) {
+ this.add(new ActionExportProfileXMI((Profile) selectedItem));
+ }
+
if (modelElementsOnly) {
initMenuCreateModelElements();
}
final Object projectModel = currentProject.getModel();
- final boolean modelElementSelected =
- Model.getFacade().isAUMLElement(selectedItem);
+ final boolean modelElementSelected = Model.getFacade().isAUMLElement(
+ selectedItem)
+ // avoids modifications on profile models
+ && !isRelatedToProfiles(currentProject, selectedItem);
+
if (modelElementSelected) {
final boolean nAryAssociationSelected =
@@ -253,7 +269,10 @@
while (iter != null && iter.hasNext()) {
Object o = iter.next();
if (Model.getFacade().isAClassifier(o)
- && !Model.getFacade().isARelationship(o)) {
+ && !Model.getFacade().isARelationship(o)
+
+ // avoids modifications on profile models
+ && !isRelatedToProfiles(currentProject, o)) {
classifiers.add(o);
}
}
@@ -626,45 +645,71 @@
* @author Bob Tarling
*/
private class ActionCreateAssociationRole extends AbstractAction {
-
- private Object metaType;
- private List classifierRoles;
-
- private final Logger LOG =
- Logger.getLogger(ActionCreateModelElement.class);
-
- public ActionCreateAssociationRole(
- Object metaType,
- List classifierRoles) {
- super(menuLocalize("menu.popup.create") + " "
- + Model.getMetaTypes().getName(metaType));
- this.metaType = metaType;
- this.classifierRoles = classifierRoles;
- }
- public void actionPerformed(ActionEvent e) {
+ private Object metaType;
+ private List classifierRoles;
+
+ private final Logger LOG =
+ Logger.getLogger(ActionCreateModelElement.class);
+
+ public ActionCreateAssociationRole(
+ Object metaType,
+ List classifierRoles) {
+ super(menuLocalize("menu.popup.create") + " "
+ + Model.getMetaTypes().getName(metaType));
+ this.metaType = metaType;
+ this.classifierRoles = classifierRoles;
+ }
+
+ public void actionPerformed(ActionEvent e) {
try {
- Object newElement = Model.getUmlFactory().buildConnection(
- metaType,
- classifierRoles.get(0),
- null,
- classifierRoles.get(1),
- null,
- null,
- null);
- for (int i = 2; i < classifierRoles.size(); ++i) {
+ Object newElement = Model.getUmlFactory().buildConnection(
+ metaType,
+ classifierRoles.get(0),
+ null,
+ classifierRoles.get(1),
+ null,
+ null,
+ null);
+ for (int i = 2; i < classifierRoles.size(); ++i) {
Model.getUmlFactory().buildConnection(
- Model.getMetaTypes().getAssociationEndRole(),
- newElement,
- null,
- classifierRoles.get(i),
- null,
- null,
- null);
- }
- } catch (IllegalModelElementConnectionException e1) {
- LOG.error("Exception", e1);
- }
- }
+ Model.getMetaTypes().getAssociationEndRole(),
+ newElement,
+ null,
+ classifierRoles.get(i),
+ null,
+ null,
+ null);
+ }
+ } catch (IllegalModelElementConnectionException e1) {
+ LOG.error("Exception", e1);
+ }
+ }
+ }
+
+ private boolean isRelatedToProfiles(Project currentProject,
+ Object selectedItem) {
+ boolean found = selectedItem instanceof ProfileConfiguration
+ || selectedItem instanceof Profile
+ || selectedItem instanceof ArgoDiagram;
+
+ if (!found) {
+ for (Profile profile : currentProject.getProfileConfiguration()
+ .getProfiles()) {
+ Collection models;
+ try {
+ models = profile.getProfilePackages();
+ for (Object model : models) {
+ if ((Model.getFacade().getModel(selectedItem)
+ .equals(model))) {
+ found = true;
+ break;
+ }
+ }
+ } catch (ProfileException e) {
+ }
+ }
+ }
+ return found;
}
}
Modified: trunk/src_new/org/argouml/ui/explorer/NameOrder.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/NameOrder.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/ui/explorer/NameOrder.java&p2=trunk/src_new/org/argouml/ui/explorer/NameOrder.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/NameOrder.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/NameOrder.java 2007-09-26 23:27:31-0700
@@ -28,9 +28,11 @@
import javax.swing.tree.DefaultMutableTreeNode;
+import org.argouml.i18n.Translator;
import org.argouml.model.InvalidElementException;
import org.argouml.model.Model;
-import org.argouml.i18n.Translator;
+import org.argouml.uml.profile.Profile;
+import org.argouml.uml.profile.ProfileConfiguration;
import org.tigris.gef.base.Diagram;
/**
@@ -97,6 +99,10 @@
String name;
if (obj instanceof Diagram) {
name = ((Diagram) obj).getName();
+ } else if (obj instanceof ProfileConfiguration) {
+ name = "Profile Configuration";
+ } else if (obj instanceof Profile) {
+ name = ((Profile) obj).getDisplayName();
} else {
if (Model.getFacade().isAModelElement(obj)) {
try {
Modified: trunk/src_new/org/argouml/ui/explorer/PerspectiveManager.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/PerspectiveManager.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/ui/explorer/PerspectiveManager.java&p2=trunk/src_new/org/argouml/ui/explorer/PerspectiveManager.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/PerspectiveManager.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/PerspectiveManager.java 2007-09-26 23:27:31-0700
@@ -76,9 +76,12 @@
import org.argouml.ui.explorer.rules.GoOperationToSequenceDiagram;
import org.argouml.ui.explorer.rules.GoPackageToClass;
import org.argouml.ui.explorer.rules.GoPackageToElementImport;
+import org.argouml.ui.explorer.rules.GoProfileConfigurationToProfile;
+import org.argouml.ui.explorer.rules.GoProfileToModel;
import org.argouml.ui.explorer.rules.GoProjectToCollaboration;
import org.argouml.ui.explorer.rules.GoProjectToDiagram;
import org.argouml.ui.explorer.rules.GoProjectToModel;
+import org.argouml.ui.explorer.rules.GoProjectToProfileConfiguration;
import org.argouml.ui.explorer.rules.GoProjectToRoots;
import org.argouml.ui.explorer.rules.GoProjectToStateMachine;
import org.argouml.ui.explorer.rules.GoSignalToReception;
@@ -325,6 +328,10 @@
ExplorerPerspective classPerspective =
new ExplorerPerspective(
"combobox.item.class-centric");
+ classPerspective.addRule(new GoProjectToModel());
+ classPerspective.addRule(new GoProjectToProfileConfiguration());
+ classPerspective.addRule(new GoProfileConfigurationToProfile());
+ classPerspective.addRule(new GoProfileToModel());
classPerspective.addRule(new GoProjectToRoots());
classPerspective.addRule(new GoNamespaceToClassifierAndPackage());
classPerspective.addRule(new GoNamespaceToDiagram());
@@ -339,6 +346,10 @@
ExplorerPerspective packagePerspective =
new ExplorerPerspective(
"combobox.item.package-centric");
+ packagePerspective.addRule(new GoProjectToModel());
+ packagePerspective.addRule(new GoProjectToProfileConfiguration());
+ packagePerspective.addRule(new GoProfileConfigurationToProfile());
+ packagePerspective.addRule(new GoProfileToModel());
packagePerspective.addRule(new GoProjectToRoots());
packagePerspective.addRule(new GoNamespaceToOwnedElements());
packagePerspective.addRule(new GoPackageToElementImport());
@@ -384,6 +395,9 @@
new ExplorerPerspective(
"combobox.item.diagram-centric");
diagramPerspective.addRule(new GoProjectToModel());
+ diagramPerspective.addRule(new GoProjectToProfileConfiguration());
+ diagramPerspective.addRule(new GoProfileConfigurationToProfile());
+ diagramPerspective.addRule(new GoProfileToModel());
diagramPerspective.addRule(new GoModelToDiagrams());
diagramPerspective.addRule(new GoDiagramToNode());
diagramPerspective.addRule(new GoDiagramToEdge());
@@ -395,6 +409,9 @@
new ExplorerPerspective(
"combobox.item.inheritance-centric");
inheritancePerspective.addRule(new GoProjectToModel());
+ inheritancePerspective.addRule(new GoProjectToProfileConfiguration());
+ classPerspective.addRule(new GoProfileConfigurationToProfile());
+ classPerspective.addRule(new GoProfileToModel());
inheritancePerspective.addRule(new GoModelToBaseElements());
inheritancePerspective
.addRule(new GoGeneralizableElementToSpecialized());
@@ -403,6 +420,9 @@
new ExplorerPerspective(
"combobox.item.class-associations");
associationsPerspective.addRule(new GoProjectToModel());
+ associationsPerspective.addRule(new GoProjectToProfileConfiguration());
+ associationsPerspective.addRule(new GoProfileConfigurationToProfile());
+ associationsPerspective.addRule(new GoProfileToModel());
associationsPerspective.addRule(new GoNamespaceToDiagram());
associationsPerspective.addRule(new GoPackageToClass());
associationsPerspective.addRule(new GoClassToAssociatedClass());
@@ -411,6 +431,9 @@
new ExplorerPerspective(
"combobox.item.residence-centric");
residencePerspective.addRule(new GoProjectToModel());
+ residencePerspective.addRule(new GoProjectToProfileConfiguration());
+ residencePerspective.addRule(new GoProfileConfigurationToProfile());
+ residencePerspective.addRule(new GoProfileToModel());
residencePerspective.addRule(new GoModelToNode());
residencePerspective.addRule(new GoNodeToResidentComponent());
residencePerspective.addRule(new GoComponentToResidentModelElement());
@@ -441,11 +464,16 @@
ExplorerPerspective compositionPerspective =
new ExplorerPerspective(
"combobox.item.composite-centric");
+ compositionPerspective.addRule(new GoProjectToModel());
+ compositionPerspective.addRule(new GoProjectToProfileConfiguration());
+ compositionPerspective.addRule(new GoProfileConfigurationToProfile());
+ compositionPerspective.addRule(new GoProfileToModel());
compositionPerspective.addRule(new GoProjectToRoots());
compositionPerspective.addRule(new GoModelElementToContents());
compositionPerspective.addRule(new GoModelElementToContainedDiagrams());
- Collection<ExplorerPerspective> c = new ArrayList<ExplorerPerspective>();
+ Collection<ExplorerPerspective> c =
+ new ArrayList<ExplorerPerspective>();
c.add(packagePerspective);
c.add(classPerspective);
c.add(diagramPerspective);
@@ -501,7 +529,10 @@
new GoOperationToSequenceDiagram(), new GoPackageToClass(),
new GoPackageToElementImport(),
new GoProjectToCollaboration(), new GoProjectToDiagram(),
- new GoProjectToModel(), new GoProjectToStateMachine(),
+ new GoProjectToModel(), new GoProjectToStateMachine(),
+ new GoProjectToProfileConfiguration(),
+ new GoProfileConfigurationToProfile(),
+ new GoProfileToModel(),
new GoProjectToRoots(),
new GoSignalToReception(), new GoStateMachineToTop(),
new GoStatemachineToDiagram(), new GoStateMachineToState(),
Copied: trunk/src_new/org/argouml/ui/explorer/rules/GoProfileConfigurationToProfile.java (from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProfileConfigurationToProfile.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoProfileConfigurationToProfile.java?view=diff&rev=13614&p1=/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProfileConfigurationToProfile.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoProfileConfigurationToProfile.java&r1=13355&r2=13614
==============================================================================
--- /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProfileConfigurationToProfile.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoProfileConfigurationToProfile.java 2007-09-26 23:27:31-0700
@@ -26,10 +26,8 @@
import java.util.Collection;
import java.util.Set;
-import java.util.Vector;
import org.argouml.i18n.Translator;
-import org.argouml.kernel.Project;
import org.argouml.uml.profile.ProfileConfiguration;
/**
@@ -50,7 +48,7 @@
*/
public Collection getChildren(Object parent) {
if (parent instanceof ProfileConfiguration) {
- return ((ProfileConfiguration)parent).getProfiles();
+ return ((ProfileConfiguration) parent).getProfiles();
}
return null;
}
Copied: trunk/src_new/org/argouml/ui/explorer/rules/GoProfileToModel.java (from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProfileToModel.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoProfileToModel.java?view=diff&rev=13614&p1=/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProfileToModel.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoProfileToModel.java&r1=13355&r2=13614
==============================================================================
--- /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProfileToModel.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoProfileToModel.java 2007-09-26 23:27:31-0700
@@ -26,10 +26,8 @@
import java.util.Collection;
import java.util.Set;
-import java.util.Vector;
import org.argouml.i18n.Translator;
-import org.argouml.model.Model;
import org.argouml.uml.profile.Profile;
import org.argouml.uml.profile.ProfileException;
Copied: trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToProfileConfiguration.java (from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProjectToProfileConfiguration.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToProfileConfiguration.java?view=diff&rev=13614&p1=/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProjectToProfileConfiguration.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToProfileConfiguration.java&r1=13355&r2=13614
==============================================================================
--- /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/ui/explorer/rules/GoProjectToProfileConfiguration.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToProfileConfiguration.java 2007-09-26 23:27:31-0700
@@ -24,9 +24,9 @@
package org.argouml.ui.explorer.rules;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
-import java.util.Vector;
import org.argouml.i18n.Translator;
import org.argouml.kernel.Project;
@@ -49,7 +49,7 @@
*/
public Collection getChildren(Object parent) {
if (parent instanceof Project) {
- Vector l = new Vector();
+ Collection l = new ArrayList();
l.add(((Project) parent).getProfileConfiguration());
return l;
}
Modified: trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToRoots.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToRoots.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToRoots.java&p2=trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToRoots.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToRoots.java (original)
+++ trunk/src_new/org/argouml/ui/explorer/rules/GoProjectToRoots.java 2007-09-26 23:27:31-0700
@@ -29,7 +29,6 @@
import org.argouml.i18n.Translator;
import org.argouml.kernel.Project;
-import org.argouml.model.Model;
/**
* Rule for Project->Root (Top level) Elements.
@@ -40,6 +39,10 @@
* but this will need to be enhanced with additional bookkeeping in
* Project when we support multiple open projects - tfm.
*
+ * TODO: I changed it to get the roots from the project. It was showing
+ * the profiles that were loaded but were not applied to the current project
+ * - maurelio1234.
+ *
* @author Tom Morris <[email protected] >
*/
public class GoProjectToRoots extends AbstractPerspectiveRule {
@@ -52,7 +55,7 @@
public Collection getChildren(Object parent) {
if (parent instanceof Project) {
- return Model.getFacade().getRootElements();
+ return ((Project)parent).getRoots();
}
return null;
}
Removed: trunk/src_new/org/argouml/uml/Profile.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/Profile.java?view=auto&rev=13613
Removed: trunk/src_new/org/argouml/uml/ProfileException.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ProfileException.java?view=auto&rev=13613
Removed: trunk/src_new/org/argouml/uml/ProfileJava.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ProfileJava.java?view=auto&rev=13613
Modified: trunk/src_new/org/argouml/uml/StereotypeUtility.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/StereotypeUtility.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/StereotypeUtility.java&p2=trunk/src_new/org/argouml/uml/StereotypeUtility.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/StereotypeUtility.java (original)
+++ trunk/src_new/org/argouml/uml/StereotypeUtility.java 2007-09-26 23:27:31-0700
@@ -76,6 +76,7 @@
* @param modelElement the given modelelement
* @return the set with stereotype UML objects
*/
+ @SuppressWarnings("unchecked")
public static Set getAvailableStereotypes(Object modelElement) {
Set paths = new HashSet();
Set availableStereotypes = new TreeSet(new Comparator() {
@@ -94,13 +95,126 @@
});
Collection models =
ProjectManager.getManager().getCurrentProject().getModels();
+
+ Collection topLevelModels =
+ ProjectManager.getManager().getCurrentProject().getModels();
+
+ // adds all stereotypes defined at the top level namespaces
+ Collection topLevelStereotypes = getTopLevelStereotypes(topLevelModels);
+
+ Collection validTopLevelStereotypes = new ArrayList();
addAllUniqueModelElementsFrom(availableStereotypes, paths, Model
.getExtensionMechanismsHelper().getAllPossibleStereotypes(
models, modelElement));
+ for (Object stereotype : topLevelStereotypes) {
+ if (Model.getExtensionMechanismsHelper().isValidStereotype(
+ modelElement, stereotype)) {
+ validTopLevelStereotypes.add(stereotype);
+ }
+ }
+
+ addAllUniqueModelElementsFrom(availableStereotypes, paths,
+ validTopLevelStereotypes);
+
+ // adds all stereotypes defined at the profiles applied to the
+ // current namespace
+ Object namespace = Model.getFacade().getNamespace(modelElement);
+ if (namespace != null) {
+ while (true) {
+ getApplicableStereotypesInNamespace(modelElement, paths,
+ availableStereotypes, namespace);
+ Object newNamespace = Model.getFacade().getNamespace(namespace);
+
+ if (newNamespace == null) {
+ break;
+ }
+
+ namespace = newNamespace;
+ }
+ }
+
+ // adds all stereotypes defined at the profiles applied
+ // to the current project
+ addAllUniqueModelElementsFrom(availableStereotypes, paths,
+ ProjectManager.getManager().getCurrentProject()
+ .getProfileConfiguration()
+ .findAllStereotypesForModelElement(modelElement));
+
return availableStereotypes;
}
+
+ @SuppressWarnings("unchecked")
+ private static Collection getTopLevelStereotypes(Collection topLevelModels) {
+ Collection ret = new ArrayList();
+ for (Object model : topLevelModels) {
+ for (Object stereotype : Model.getExtensionMechanismsHelper()
+ .getStereotypes(model)) {
+ Object namespace = Model.getFacade().getNamespace(stereotype);
+ if (Model.getFacade().getNamespace(namespace) == null) {
+ ret.add(stereotype);
+ }
+ }
+ }
+ return ret;
+ }
+
+ private static void getApplicableStereotypesInNamespace(
+ Object modelElement, Set paths, Set availableStereotypes,
+ Object namespace) {
+ Collection allProfiles = getAllProfilePackages(Model.getFacade()
+ .getModel(modelElement));
+ Collection<Object> allAppliedProfiles = new ArrayList<Object>();
+
+ for (Object profilePackage : allProfiles) {
+ Collection allDependencies = Model.getCoreHelper().getDependencies(
+ profilePackage, namespace);
+
+ for (Object dependency : allDependencies) {
+ if (Model.getExtensionMechanismsHelper().hasStereotype(
+ dependency, "appliedProfile")) {
+ allAppliedProfiles.add(profilePackage);
+ break;
+ }
+ }
+ }
+
+ addAllUniqueModelElementsFrom(availableStereotypes, paths,
+ getAppliableStereotypes(modelElement, allAppliedProfiles));
+ }
+ private static Collection getAppliableStereotypes(Object modelElement,
+ Collection<Object> allAppliedProfiles) {
+ Collection ret = new ArrayList();
+ for (Object profile : allAppliedProfiles) {
+ for (Object stereotype : Model.getExtensionMechanismsHelper()
+ .getStereotypes(profile)) {
+ if (Model.getExtensionMechanismsHelper().isValidStereotype(
+ modelElement, stereotype)) {
+ ret.add(stereotype);
+ }
+ }
+ }
+
+ return ret;
+ }
+
+ private static Collection getAllProfilePackages(Object model) {
+ Collection col = Model.getModelManagementHelper()
+ .getAllModelElementsOfKind(model,
+ Model.getMetaTypes().getPackage());
+ Collection<Object> ret = new ArrayList<Object>();
+
+ for (Object element : col) {
+ if (Model.getFacade().isAPackage(element)
+ && Model.getExtensionMechanismsHelper().hasStereotype(
+ element, "profile")) {
+ ret.add(element);
+ }
+ }
+ return ret;
+ }
+
/**
* Helper method for buildModelList.
* <p>
@@ -203,15 +317,9 @@
return stereo;
}
- try {
- Project project = ProjectManager.getManager().getCurrentProject();
- Profile profile = project.getProfile();
- stereo = recFindStereotype(obj, profile.getProfileModel(), name);
- } catch (ProfileException e) {
- // TODO: How are we going to handle exceptions here?
- // I suspect the profile should be part of the project
- // and not a singleton.
- }
+ Project project = ProjectManager.getManager().getCurrentProject();
+ stereo = project.getProfileConfiguration().findStereotypeForObject(
+ name, obj);
if (stereo != null) {
return Model.getModelManagementHelper().getCorrespondingElement(
Copied: trunk/src_new/org/argouml/uml/cognitive/critics/CrProfile.java (from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/cognitive/critics/CrProfile.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/critics/CrProfile.java?view=diff&rev=13614&p1=/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/cognitive/critics/CrProfile.java&p2=trunk/src_new/org/argouml/uml/cognitive/critics/CrProfile.java&r1=13355&r2=13614
==============================================================================
--- /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/cognitive/critics/CrProfile.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/critics/CrProfile.java 2007-09-26 23:27:31-0700
@@ -30,7 +30,7 @@
* "Abstract" Critic subclass that captures commonalities among all
* critics defined by profiles. This class also defines and registers
* the categories of design decisions that the critics can
- * address. IT also deals with particular UMLToDoItems.
+ * address.
*
* @see org.argouml.cognitive.Designer
* @see org.argouml.cognitive.DecisionModel
@@ -63,15 +63,7 @@
setupHeadAndDesc();
}
- /**
- * Returns a localized string for the given key and suffix.
- *
- * @param key the main key
- * @param suffix the suffix of the key
- * @return the localized string
- *
- * @see CrUML#getLocalizedString(String, String)
- */
+ @Override
protected String getLocalizedString(String key, String suffix) {
return Translator.localize(localizationPrefix + "." + key + suffix);
}
@@ -80,4 +72,4 @@
* The UID.
*/
private static final long serialVersionUID = 1785043010468681602L;
-} /* end class CrUML */
+}
Modified: trunk/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java&p2=trunk/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/critics/WizAddConstructor.java 2007-09-26 23:27:31-0700
@@ -25,19 +25,14 @@
package org.argouml.uml.cognitive.critics;
import java.util.Collection;
-import java.util.Iterator;
import javax.swing.JPanel;
-import org.apache.log4j.Logger;
import org.argouml.cognitive.ui.WizStepTextField;
import org.argouml.i18n.Translator;
-import org.argouml.kernel.Project;
import org.argouml.kernel.ProjectManager;
import org.argouml.model.Model;
import org.argouml.ui.targetmanager.TargetManager;
-import org.argouml.uml.Profile;
-import org.argouml.uml.ProfileException;
/**
* A wizard to add a constructor to a classifier.
@@ -46,11 +41,6 @@
* @since February 7, 2004, 12:35 AM
*/
public class WizAddConstructor extends UMLWizard {
- /**
- * Logger.
- */
- private static final Logger LOG =
- Logger.getLogger(WizAddConstructor.class);
private WizStepTextField step1;
private String label = Translator.localize("label.name");
@@ -92,44 +82,15 @@
}
/**
- * Finds the create stereotype for an object. It is assumed to be
- * available from the java profile.
- * <p>
- * TODO: This needs to be recoded to handle multiple profile packages.
- * It also seems Java specific (at least the above comment does) - tfm
+ * Finds the create stereotype for an object.
*
* @param obj is the object the stereotype should be applicable to.
* @return a suitable stereotype, or null.
*/
private Object getCreateStereotype(Object obj) {
- Iterator iter = null;
- try {
- Project project = ProjectManager.getManager().getCurrentProject();
- Profile profile = project.getProfile();
- Object profileModel = profile.getProfileModel();
- iter = Model.getFacade().getOwnedElements(profileModel).iterator();
- } catch (ProfileException e) {
- // TODO: How are we going to handle exceptions here?
- // I suspect the profile should be part of the project
- // and not a singleton.
- LOG.error("Failed to get profile", e);
- }
- while (iter.hasNext()) {
- Object stereo = iter.next();
- if (!Model.getFacade().isAStereotype(stereo)
- || !"create".equals(Model.getFacade().getName(stereo))) {
- continue;
- }
-
- if (Model.getExtensionMechanismsHelper()
- .isValidStereotype(obj, stereo)) {
- return Model.getModelManagementHelper()
- .getCorrespondingElement(stereo,
- Model.getFacade().getModel(obj));
- }
- }
-
- return null;
+ return ProjectManager.getManager().getCurrentProject()
+ .getProfileConfiguration().findStereotypeForObject("create",
+ obj);
}
/**
Modified: trunk/src_new/org/argouml/uml/diagram/activity/ui/FigActionState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/activity/ui/FigActionState.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigActionState.java&p2=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigActionState.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/activity/ui/FigActionState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/activity/ui/FigActionState.java 2007-09-26 23:27:31-0700
@@ -170,7 +170,7 @@
*
* Override setBounds to keep shapes looking right.
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java&p2=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/activity/ui/FigObjectFlowState.java 2007-09-26 23:27:31-0700
@@ -246,7 +246,7 @@
*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
//if (getNameFig() == null) return;
Rectangle oldBounds = getBounds();
Modified: trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java&p2=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPartition.java 2007-09-26 23:27:31-0700
@@ -209,7 +209,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
Modified: trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPool.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPool.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPool.java&p2=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPool.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPool.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/activity/ui/FigPool.java 2007-09-26 23:27:31-0700
@@ -161,7 +161,7 @@
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
@Override
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
Rectangle oldBounds = getBounds();
getBigPort().setBounds(x, y, w, h);
Modified: trunk/src_new/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java&p2=trunk/src_new/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/activity/ui/FigSubactivityState.java 2007-09-26 23:27:31-0700
@@ -175,7 +175,7 @@
*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java&p2=trunk/src_new/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/collaboration/ui/FigClassifierRole.java 2007-09-26 23:27:31-0700
@@ -232,42 +232,66 @@
/*
* @see org.tigris.gef.presentation.Fig#setLineColor(java.awt.Color)
*/
- public void setLineColor(Color col) { cover.setLineColor(col); }
+ @Override
+ public void setLineColor(Color col) {
+ cover.setLineColor(col);
+ }
/*
* @see org.tigris.gef.presentation.Fig#getLineColor()
*/
- public Color getLineColor() { return cover.getLineColor(); }
+ @Override
+ public Color getLineColor() {
+ return cover.getLineColor();
+ }
/*
* @see org.tigris.gef.presentation.Fig#setFillColor(java.awt.Color)
*/
- public void setFillColor(Color col) { cover.setFillColor(col); }
+ @Override
+ public void setFillColor(Color col) {
+ cover.setFillColor(col);
+ }
/*
* @see org.tigris.gef.presentation.Fig#getFillColor()
*/
- public Color getFillColor() { return cover.getFillColor(); }
+ @Override
+ public Color getFillColor() {
+ return cover.getFillColor();
+ }
/*
* @see org.tigris.gef.presentation.Fig#setFilled(boolean)
*/
- public void setFilled(boolean f) { cover.setFilled(f); }
+ @Override
+ public void setFilled(boolean f) {
+ cover.setFilled(f);
+ }
/*
* @see org.tigris.gef.presentation.Fig#getFilled()
*/
- public boolean getFilled() { return cover.getFilled(); }
+ @Override
+ public boolean getFilled() {
+ return cover.getFilled();
+ }
/*
* @see org.tigris.gef.presentation.Fig#setLineWidth(int)
*/
- public void setLineWidth(int w) { cover.setLineWidth(w); }
+ @Override
+ public void setLineWidth(int w) {
+ cover.setLineWidth(w);
+ }
/*
* @see org.tigris.gef.presentation.Fig#getLineWidth()
*/
- public int getLineWidth() { return cover.getLineWidth(); }
+ @Override
+ public int getLineWidth() {
+ return cover.getLineWidth();
+ }
/**
@@ -279,7 +303,7 @@
*
* @return The minimum size of this fig.
*/
-
+ @Override
public Dimension getMinimumSize() {
Dimension stereoMin = getStereotypeFig().getMinimumSize();
@@ -318,7 +342,8 @@
* @author 10 Apr 2002. Jeremy Bennett ([email protected] ). Patch to
* allow for stereotype as well.
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ @Override
+ protected void setStandardBounds(int x, int y, int w, int h) {
// In the rather unlikely case that we have no name, we give up.
@@ -377,6 +402,7 @@
* @throws PropertyVetoException by the parser
* @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEdited(org.tigris.gef.presentation.FigText)
*/
+ @Override
protected void textEdited(FigText ft) throws PropertyVetoException {
if (ft == getNameFig()) {
notationProvider.parse(getOwner(), ft.getText());
@@ -387,6 +413,7 @@
/*
* @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEditStarted(org.tigris.gef.presentation.FigText)
*/
+ @Override
protected void textEditStarted(FigText ft) {
if (ft == getNameFig()) {
showHelp(notationProvider.getParsingHelp());
@@ -398,6 +425,7 @@
*
* @see org.argouml.uml.diagram.ui.FigNodeModelElement#updateNameText()
*/
+ @Override
protected void updateNameText() {
if (notationProvider != null) {
getNameFig().setText(notationProvider.toString(getOwner(), null));
@@ -407,6 +435,7 @@
/*
* @see org.argouml.uml.diagram.ui.FigNodeModelElement#modelChanged(java.beans.PropertyChangeEvent)
*/
+ @Override
protected void modelChanged(PropertyChangeEvent mee) {
super.modelChanged(mee);
if (mee instanceof AddAssociationEvent
@@ -421,6 +450,7 @@
/*
* @see org.tigris.gef.presentation.Fig#makeSelection()
*/
+ @Override
public Selection makeSelection() {
return new SelectionClassifierRole(this);
}
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponent.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponent.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponent.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponent.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponent.java 2007-09-26 23:27:31-0700
@@ -218,7 +218,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
Rectangle oldBounds = getBounds();
getBigPort().setBounds(x + BX, y, w - BX, h);
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigComponentInstance.java 2007-09-26 23:27:31-0700
@@ -219,7 +219,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
@@ -316,8 +316,8 @@
}
} else if (isVisible()
// If we are not visible most likely we're being deleted.
- // TODO: This indicates a more fundamental problem that should
- // be investigated - tfm - 20061230
+ // TODO: This indicates a more fundamental problem that
+ // should be investigated - tfm - 20061230
&& encloser == null && getEnclosingFig() != null) {
if (Model.getFacade().getNodeInstance(comp) != null) {
Model.getCommonBehaviorHelper()
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigMNode.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigMNode.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigMNode.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigMNode.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigMNode.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigMNode.java 2007-09-26 23:27:31-0700
@@ -224,7 +224,7 @@
/*
* @see org.tigris.gef.presentation.FigNode#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigNodeInstance.java 2007-09-26 23:27:31-0700
@@ -196,7 +196,7 @@
/*
* @see org.tigris.gef.presentation.FigNode#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
@@ -256,13 +256,12 @@
super.setEnclosingFig(encloser);
}
} else if (encloser == null) {
- if (isVisible()
- // If we are not visible most likely
+ if (isVisible()
+ // If we are not visible most likely
// we're being deleted.
- // TODO: This indicates a more fundamental problem that should
- // be investigated - tfm - 20061230
- && Model.getFacade().getComponentInstance(nod)
- != null) {
+ // TODO: This indicates a more fundamental problem that
+ // should be investigated - tfm - 20061230
+ && Model.getFacade().getComponentInstance(nod) != null) {
Model.getCommonBehaviorHelper()
.setComponentInstance(nod, null);
super.setEnclosingFig(encloser);
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigObject.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigObject.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigObject.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigObject.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigObject.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/FigObject.java 2007-09-26 23:27:31-0700
@@ -170,7 +170,7 @@
*
* @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/sequence/ui/FigClassifierRole.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/sequence/ui/FigClassifierRole.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/sequence/ui/FigClassifierRole.java&p2=trunk/src_new/org/argouml/uml/diagram/sequence/ui/FigClassifierRole.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/sequence/ui/FigClassifierRole.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/sequence/ui/FigClassifierRole.java 2007-09-26 23:27:31-0700
@@ -265,7 +265,7 @@
*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- public void setBoundsImpl(int x, int y, int w, int h) {
+ public void setStandardBounds(int x, int y, int w, int h) {
y = 50;
Rectangle oldBounds = getBounds();
w = headFig.getMinimumSize().width;
Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java 2007-09-26 23:27:31-0700
@@ -146,7 +146,7 @@
*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigConcurrentRegion.java 2007-09-26 23:27:31-0700
@@ -181,7 +181,7 @@
*
* {@inheritDoc}
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigForkState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigForkState.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigForkState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigForkState.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigForkState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigForkState.java 2007-09-26 23:27:31-0700
@@ -97,7 +97,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
Rectangle oldBounds = getBounds();
if (w > h) {
h = HEIGHT;
Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigJoinState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigJoinState.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigJoinState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigJoinState.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigJoinState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigJoinState.java 2007-09-26 23:27:31-0700
@@ -97,7 +97,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
Rectangle oldBounds = getBounds();
if (w > h) {
h = HEIGHT;
Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigSimpleState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigSimpleState.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigSimpleState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigSimpleState.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigSimpleState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigSimpleState.java 2007-09-26 23:27:31-0700
@@ -119,7 +119,7 @@
* {@inheritDoc}
*/
@Override
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigStubState.java 2007-09-26 23:27:31-0700
@@ -216,7 +216,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(int theX, int theY, int theW, int theH) {
+ protected void setStandardBounds(int theX, int theY, int theW, int theH) {
Rectangle oldBounds = getBounds();
theW = 60;
Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigSubmachineState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigSubmachineState.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigSubmachineState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigSubmachineState.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigSubmachineState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigSubmachineState.java 2007-09-26 23:27:31-0700
@@ -197,7 +197,7 @@
*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java 2007-09-26 23:27:31-0700
@@ -581,7 +581,7 @@
*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(final int x, final int y,
+ protected void setStandardBounds(final int x, final int y,
final int w, final int h) {
Rectangle oldBounds = getBounds();
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigComment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigComment.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigComment.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigComment.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigComment.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigComment.java 2007-09-26 23:27:31-0700
@@ -537,7 +537,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
*/
- protected void setBoundsImpl(int px, int py, int w, int h) {
+ protected void setStandardBounds(int px, int py, int w, int h) {
if (bodyTextFig == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigDataType.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigDataType.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigDataType.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigDataType.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigDataType.java 2007-09-26 23:27:31-0700
@@ -318,7 +318,7 @@
* @param h Desired height of the figure
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(final int x, final int y, final int w,
+ protected void setStandardBounds(final int x, final int y, final int w,
final int h) {
Rectangle oldBounds = getBounds();
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java 2007-09-26 23:27:31-0700
@@ -237,7 +237,7 @@
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
@Override
- protected void setBoundsImpl(final int x, final int y, final int w,
+ protected void setStandardBounds(final int x, final int y, final int w,
final int h) {
// Save our old boundaries so it can be used in property message later
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInterface.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInterface.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInterface.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInterface.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigInterface.java 2007-09-26 23:27:31-0700
@@ -476,7 +476,7 @@
*
* @param h Desired height of the FigInterface
*/
- protected void setBoundsImpl(final int x, final int y, final int w,
+ protected void setStandardBounds(final int x, final int y, final int w,
final int h) {
Rectangle oldBounds = getBounds();
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigModel.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigModel.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigModel.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigModel.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigModel.java 2007-09-26 23:27:31-0700
@@ -73,7 +73,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (figPoly != null) {
Rectangle oldBounds = getBounds();
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java 2007-09-26 23:27:31-0700
@@ -416,7 +416,7 @@
*
* @param h Desired height of the FigClass
*/
- protected void setBoundsImpl(int xa, int ya, int w, int h) {
+ protected void setStandardBounds(int xa, int ya, int w, int h) {
// Save our old boundaries (needed later), and get minimum size
// info. "aSize" will be used to maintain a running calculation of our
// size at various points.
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSignal.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSignal.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSignal.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSignal.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSignal.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSignal.java 2007-09-26 23:27:31-0700
@@ -196,7 +196,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(final int x, final int y, final int w,
+ protected void setStandardBounds(final int x, final int y, final int w,
final int h) {
// Save our old boundaries so it can be used in property message later
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigStereotypeDeclaration.java 2007-09-26 23:27:31-0700
@@ -195,7 +195,7 @@
*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
- protected void setBoundsImpl(final int x, final int y,
+ protected void setStandardBounds(final int x, final int y,
final int w, final int h) {
Rectangle oldBounds = getBounds();
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSubsystem.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSubsystem.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSubsystem.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSubsystem.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSubsystem.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigSubsystem.java 2007-09-26 23:27:31-0700
@@ -67,7 +67,7 @@
/*
* @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
*/
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (figPoly != null) {
Rectangle oldBounds = getBounds();
Copied: trunk/src_new/org/argouml/uml/diagram/ui/ActionAddStereotype.java (from r13355, /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/ActionAddStereotype.java)
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ActionAddStereotype.java?view=diff&rev=13614&p1=/branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/ActionAddStereotype.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ActionAddStereotype.java&r1=13355&r2=13614
==============================================================================
--- /branches/gsoc2007/maurelio1234/branch2/src_new/org/argouml/uml/diagram/ui/ActionAddStereotype.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ActionAddStereotype.java 2007-09-26 23:27:31-0700
@@ -37,7 +37,7 @@
/**
- * Action to add a sterotype to a model element.
+ * Action to add a stereotype to a model element.
* @author Bob Tarling
*/
class ActionAddStereotype extends UndoableAction {
@@ -71,6 +71,7 @@
/*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent ae) {
super.actionPerformed(ae);
if (Model.getFacade().getStereotypes(modelElement)
@@ -88,6 +89,7 @@
/*
* @see javax.swing.Action#getValue(java.lang.String)
*/
+ @Override
public Object getValue(String key) {
if ("SELECTED".equals(key)) {
if (Model.getFacade().getStereotypes(modelElement).contains(
Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigMessage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigMessage.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigMessage.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigMessage.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigMessage.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigMessage.java 2007-09-26 23:27:31-0700
@@ -289,7 +289,7 @@
* @see org.tigris.gef.presentation.Fig#setBounds(int, int, int, int)
*/
@Override
- protected void setBoundsImpl(int x, int y, int w, int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
if (getNameFig() == null) {
return;
}
Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigNodeAssociation.java 2007-09-26 23:27:31-0700
@@ -238,11 +238,7 @@
return head.getLineWidth();
}
- /*
- * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
- */
- protected void setBoundsImpl(final int x, final int y,
- final int w, final int h) {
+ protected void setStandardBounds(int x, int y, int w, int h) {
Rectangle oldBounds = getBounds();
Rectangle nm = getNameFig().getBounds();
Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java 2007-09-26 23:27:31-0700
@@ -28,6 +28,7 @@
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Graphics;
+import java.awt.Image;
import java.awt.Rectangle;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
@@ -98,6 +99,7 @@
import org.tigris.gef.graph.MutableGraphSupport;
import org.tigris.gef.presentation.Fig;
import org.tigris.gef.presentation.FigGroup;
+import org.tigris.gef.presentation.FigImage;
import org.tigris.gef.presentation.FigNode;
import org.tigris.gef.presentation.FigRect;
import org.tigris.gef.presentation.FigText;
@@ -187,6 +189,32 @@
*/
protected static final int ACTIVE = 8;
+ /**
+ * Used for #setStereotypeView(). Represents the default view for
+ * stereotypes applied to this node.
+ *
+ * @see ActionStereotypeViewTextual
+ */
+ public static final int STEREOTYPE_VIEW_TEXTUAL = 0;
+
+ /**
+ * Used for #setStereotypeView(). Represents the view for
+ * stereotypes where the default representation is replaced by a provided
+ * icon.
+ *
+ * @see ActionStereotypeViewBigIcon
+ */
+ public static final int STEREOTYPE_VIEW_BIG_ICON = 1;
+
+ /**
+ * Used for #setStereotypeView(). Represents the view for
+ * stereotypes where the default view is adorned with a small version of the
+ * provided icon.
+ *
+ * @see ActionStereotypeViewSmallIcon
+ */
+ public static final int STEREOTYPE_VIEW_SMALL_ICON = 2;
+
////////////////////////////////////////////////////////////////
// instance variables
@@ -207,6 +235,43 @@
private Fig stereotypeFig;
/**
+ * The <code>FigProfileIcon</code> being currently displayed
+ */
+ private FigProfileIcon stereotypeFigProfileIcon;
+
+ /**
+ * Contains the figs of the floating stereotypes when viewed in
+ * <code>SmallIcon</code> mode.
+ */
+ private Vector floatingStereotypes = new Vector();
+
+ /**
+ * The current stereotype view
+ *
+ * @see #STEREOTYPE_VIEW_TEXTUAL
+ * @see #STEREOTYPE_VIEW_SMALL_ICON
+ * @see #STEREOTYPE_VIEW_BIG_ICON
+ */
+ private int stereotypeView = STEREOTYPE_VIEW_TEXTUAL;
+
+ /**
+ * The width of the profile icons when viewed at the small icon mode.
+ * The icon width is resized to <code>ICON_WIDTH</code> and the height is
+ * set to a value that attempts to keep the original width/height
+ * proportion.
+ */
+ private static final int ICON_WIDTH = 16;
+
+ /**
+ * When stereotypes are shown in <code>BigIcon</code> mode the
+ * <code>nameFig</code> is replaced by the one provided by the
+ * <code>FigProfileIcon</code>
+ *
+ * @see FigProfileIcon
+ */
+ private FigText originalNameFig;
+
+ /**
* EnclosedFigs are the Figs that are enclosed by this figure. Say that
* it is a Package then these are the Classes, Interfaces, Packages etc
* that are on this figure. This is not the same as the figures in the
@@ -279,6 +344,8 @@
setShadowSize(ps.getDefaultShadowWidthValue());
/* TODO: how to handle changes in shadowsize
* from the project properties? */
+
+ stereotypeView = ps.getDefaultStereotypeViewValue();
}
/**
@@ -497,6 +564,16 @@
}
popUpActions.insertElementAt(stereotypes, 0);
}
+
+ // add stereotype view submenu
+ ArgoJMenu stereotypesView =
+ new ArgoJMenu("menu.popup.stereotype-view");
+
+ stereotypesView.addRadioItem(new ActionStereotypeViewTextual(this));
+ stereotypesView.addRadioItem(new ActionStereotypeViewBigIcon(this));
+ stereotypesView.addRadioItem(new ActionStereotypeViewSmallIcon(this));
+
+ popUpActions.insertElementAt(stereotypesView, 0);
}
return popUpActions;
@@ -1116,6 +1193,7 @@
addElementListener(mee.getNewValue(), "name");
}
updateStereotypeText();
+ updateStereotypeIcon();
damage();
}
}
@@ -1368,7 +1446,8 @@
return getClass().getName()
+ "[" + getX() + ", " + getY() + ", "
+ getWidth() + ", " + getHeight() + "]"
- + "pathVisible=" + isPathVisible() + ";";
+ + "pathVisible=" + isPathVisible() + ";"
+ + "stereotypeView=" + getStereotypeView() + ";";
}
/**
@@ -1466,10 +1545,126 @@
public void renderingChanged() {
updateNameText();
updateStereotypeText();
+ updateStereotypeIcon();
updateBounds();
damage();
}
+ protected void updateStereotypeIcon() {
+ if (getOwner() == null) {
+ LOG.warn("Owner of [" + this.toString() + "/" + this.getClass()
+ + "] is null.");
+ LOG.warn("I return...");
+ return;
+ }
+
+ if (stereotypeFigProfileIcon != null) {
+ Iterator it = getFigs().iterator();
+ while (it.hasNext()) {
+ Object fig = it.next();
+ ((Fig) fig).setVisible(fig != stereotypeFigProfileIcon);
+ }
+
+ this.removeFig(stereotypeFigProfileIcon);
+ stereotypeFigProfileIcon = null;
+ }
+
+ if (originalNameFig != null) {
+ this.setNameFig(originalNameFig);
+ originalNameFig = null;
+ }
+
+ if (!floatingStereotypes.isEmpty()) {
+ Iterator it = floatingStereotypes.iterator();
+ while (it.hasNext()) {
+ Object icon = it.next();
+ this.removeFig((Fig) icon);
+ }
+ floatingStereotypes.clear();
+ }
+
+ int practicalView = getPracticalView();
+ Object modelElement = getOwner();
+ Collection stereos = Model.getFacade().getStereotypes(modelElement);
+
+ Fig stereoFig = getStereotypeFig();
+ if (stereoFig instanceof FigStereotypesCompartment) {
+ ((FigStereotypesCompartment) stereoFig)
+ .setHidingStereotypesWithIcon(practicalView == STEREOTYPE_VIEW_SMALL_ICON);
+ }
+
+ if (practicalView == STEREOTYPE_VIEW_BIG_ICON) {
+
+ if (stereos != null) {
+ Image replaceIcon = null;
+
+ if (stereos.size() == 1) {
+ Object stereo = stereos.iterator().next();
+ replaceIcon = ProjectManager.getManager()
+ .getCurrentProject().getProfileConfiguration()
+ .getFigNodeStrategy().getIconForStereotype(stereo);
+ }
+
+ if (replaceIcon != null) {
+ stereotypeFigProfileIcon = new FigProfileIcon(replaceIcon,
+ getName());
+ stereotypeFigProfileIcon.setOwner(getOwner());
+
+ stereotypeFigProfileIcon.setLocation(getBigPort()
+ .getLocation());
+ this.addFig(stereotypeFigProfileIcon);
+
+ originalNameFig = this.getNameFig();
+ this.setNameFig(stereotypeFigProfileIcon.getLabelFig());
+
+ stereotypeFigProfileIcon.getLabelFig().addPropertyChangeListener(this);
+
+ getBigPort().
+ setBounds(stereotypeFigProfileIcon.getBounds());
+
+ Iterator it = getFigs().iterator();
+ while (it.hasNext()) {
+ Object fig = it.next();
+ ((Fig) fig).setVisible(fig == stereotypeFigProfileIcon);
+ }
+
+ }
+ }
+ } else if (practicalView == STEREOTYPE_VIEW_SMALL_ICON) {
+ int i = this.getX() + this.getWidth() - ICON_WIDTH - 2;
+
+ Iterator it = stereos.iterator();
+ while (it.hasNext()) {
+ Object stereo = it.next();
+ Image icon = ProjectManager.getManager().getCurrentProject()
+ .getProfileConfiguration().getFigNodeStrategy()
+ .getIconForStereotype(stereo);
+ if (icon != null) {
+ FigImage fimg = new FigImage(i,
+ this.getBigPort().getY() + 2, icon);
+ fimg.setSize(ICON_WIDTH,
+ (icon.getHeight(null) * ICON_WIDTH)
+ / icon.getWidth(null));
+
+ addFig(fimg);
+ floatingStereotypes.add(fimg);
+
+ i -= ICON_WIDTH - 2;
+ }
+ }
+
+ updateSmallIcons(this.getWidth());
+ }
+
+ updateStereotypeText();
+
+ damage();
+ calcBounds();
+ updateEdges();
+ this.updateBounds();
+ this.redraw();
+ }
+
/*
* @see org.tigris.gef.presentation.Fig#calcBounds()
*/
@@ -1863,6 +2058,108 @@
== getOwner();
}
+
+ /**
+ * @return current stereotype view
+ */
+ public int getStereotypeView() {
+ return stereotypeView;
+ }
+
+ /**
+ * When using <code>BigIcon</code> mode and zero or more than one stereotype
+ * the practical view should be the default one.
+ *
+ * @return current practical stereotype view
+ */
+ public int getPracticalView() {
+ int practicalView = getStereotypeView();
+ Object modelElement = getOwner();
+
+ if (modelElement != null) {
+ Collection stereos = Model.getFacade().getStereotypes(modelElement);
+
+ if (getStereotypeView() == STEREOTYPE_VIEW_BIG_ICON
+ && (stereos == null || stereos.size() != 1 ||
+ (stereos
+ .size() == 1 && getProject()
+ .getProfileConfiguration().getFigNodeStrategy()
+ .getIconForStereotype(stereos.iterator().next()) == null))) {
+ practicalView = STEREOTYPE_VIEW_TEXTUAL;
+ }
+ return practicalView;
+ } else {
+ return practicalView;
+ }
+ }
+
+ /**
+ * Sets the stereotype view
+ * @param s the stereotype view to be set
+ */
+ public void setStereotypeView(int s) {
+ this.stereotypeView = s;
+ try {
+ renderingChanged();
+ } catch (Exception e) {
+ }
+ }
+
+ /**
+ * Sets the bounds of this classifier. Takes the stereotype view into
+ * consideration.<br>
+ *
+ * Do not override this method, override
+ * {@link #setStandardBounds(int, int, int, int)} instead.
+ *
+ * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
+ */
+ protected void setBoundsImpl(final int x, final int y, final int w,
+ final int h) {
+
+ if (getPracticalView() == STEREOTYPE_VIEW_BIG_ICON) {
+ if (stereotypeFigProfileIcon != null) {
+ stereotypeFigProfileIcon.setBounds(stereotypeFigProfileIcon
+ .getX(), stereotypeFigProfileIcon.getY(), w, h);
+ // FigClass calls setBoundsImpl before we set
+ // the stereotypeFigProfileIcon
+ }
+ } else {
+ setStandardBounds(x, y, w, h);
+ if (getStereotypeView() == STEREOTYPE_VIEW_SMALL_ICON) {
+ updateSmallIcons(w);
+ }
+ }
+ }
+
+ private void updateSmallIcons(int wid) {
+ int i = this.getX() + wid - ICON_WIDTH - 2;
+
+ Iterator it = floatingStereotypes.iterator();
+ while (it.hasNext()) {
+ FigImage ficon = (FigImage) it.next();
+ ficon.setLocation(i, this.getBigPort().getY() + 2);
+ i -= ICON_WIDTH - 2;
+ }
+
+ getNameFig().setRightMargin(
+ floatingStereotypes.size() * (ICON_WIDTH + 5));
+ }
+
+ /**
+ * Replaces {@link #setBoundsImpl(int, int, int, int)}.
+ *
+ * @param x Desired X coordinate of upper left corner
+ * @param y Desired Y coordinate of upper left corner
+ * @param w Desired width of the FigClass
+ * @param h Desired height of the FigClass
+ * @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
+ */
+ protected void setStandardBounds(final int x, final int y,
+ final int w, final int h) {
+
+ }
+
/**
* Handles diagram font changing.
* @param e the event or null
Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigStereotypesCompartment.java 2007-09-26 23:27:31-0700
@@ -24,7 +24,9 @@
package org.argouml.uml.diagram.ui;
+import java.awt.Image;
import java.beans.PropertyChangeEvent;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -75,6 +77,8 @@
private int stereotypeCount = 0;
+ private boolean hidingStereotypesWithIcon = false;
+
/**
* The constructor.
*
@@ -130,6 +134,7 @@
Model.getFacade().getName(stereotype));
stereotypeTextFig.setOwner(stereotype);
addFig(stereotypeTextFig);
+ reorderStereotypeFigs();
damage();
}
} else {
@@ -151,6 +156,37 @@
}
}
+ /**
+ * Keep the Figs which are likely invisible at the end of the list.
+ */
+ private void reorderStereotypeFigs() {
+ List<Fig> allFigs = getFigs();
+ List<Fig> figsWithIcon = new ArrayList<Fig>();
+ List<Fig> figsWithOutIcon = new ArrayList<Fig>();
+ List<Fig> others = new ArrayList<Fig>();
+
+ for (Fig f : allFigs) {
+ if (f instanceof FigStereotype) {
+ FigStereotype s = (FigStereotype) f;
+ if (getIconForStereotype(s) != null) {
+ figsWithIcon.add(s);
+ } else {
+ figsWithOutIcon.add(s);
+ }
+ } else {
+ others.add(f);
+ }
+ }
+
+ List<Fig> n = new ArrayList<Fig>();
+
+ n.addAll(others);
+ n.addAll(figsWithOutIcon);
+ n.addAll(figsWithIcon);
+
+ setFigs(n);
+ }
+
private Fig findFig(Object stereotype) {
for (Iterator it = getFigs().iterator(); it.hasNext(); ) {
Fig f = (Fig) it.next();
@@ -250,9 +286,30 @@
removeFig((Fig) figs.get(i));
}
}
+
+ reorderStereotypeFigs();
+
+ // remove all stereotypes that have a graphical icon
+ updateHiddenStereotypes();
+ }
+ }
+
+ private void updateHiddenStereotypes() {
+ List<Fig> figs = getFigs();
+ for (Fig f : figs) {
+ if (f instanceof FigStereotype) {
+ FigStereotype fs = (FigStereotype) f;
+ fs.setVisible(getIconForStereotype(fs) == null
+ || !isHidingStereotypesWithIcon());
+ }
}
}
+ private Image getIconForStereotype(FigStereotype fs) {
+ return getProject().getProfileConfiguration().getFigNodeStrategy()
+ .getIconForStereotype(fs.getOwner());
+ }
+
/*
* @see org.tigris.gef.presentation.Fig#setBoundsImpl(int, int, int, int)
*/
@@ -285,4 +342,13 @@
protected void createModelElement() {
}
+
+ public boolean isHidingStereotypesWithIcon() {
+ return hidingStereotypesWithIcon;
+ }
+
+ public void setHidingStereotypesWithIcon(boolean hidingStereotypesWithIcon) {
+ this.hidingStereotypesWithIcon = hidingStereotypesWithIcon;
+ updateHiddenStereotypes();
+ }
}
Modified: trunk/src_new/org/argouml/uml/profile/Profile.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/profile/Profile.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/profile/Profile.java&p2=trunk/src_new/org/argouml/uml/profile/Profile.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/profile/Profile.java (original)
+++ trunk/src_new/org/argouml/uml/profile/Profile.java 2007-09-26 23:27:31-0700
@@ -43,15 +43,19 @@
private Set<Profile> importingProfiles = new HashSet<Profile>();
/**
- * A profile should call this method to state that it depends of <code>p</code>
+ * Add a dependency on the given profile from this profile.
*
- * @param p the profile
- * @throws IllegalArgumentException if there is some cycle on the dependency graph
+ * @param p
+ * the profile
+ * @throws IllegalArgumentException
+ * if there is some cycle on the dependency graph
*/
- protected final void addProfileDependency(Profile p) throws IllegalArgumentException {
+ protected final void addProfileDependency(Profile p)
+ throws IllegalArgumentException {
+
if (importingProfiles.contains(p)) {
- throw new IllegalArgumentException(
- "This profile causes a cycle in the profile dependency graph!");
+ throw new IllegalArgumentException("This profile causes a cycle "
+ + "in the profile dependency graph!");
} else {
importedProfiles.add(p);
importedProfiles.addAll(p.importedProfiles);
@@ -118,13 +122,17 @@
}
/**
- * This method produces a string that represents the specific
- * model element in the context of the specified namespace.
- * @param element element to represent.
- * @param namespace context namespace (may be null).
- * @return a string representing the model element
- *
- * @deprecated by maurelio1234. Use {@link #getFormatingStrategy()} instead.
+ * This method produces a string that represents the specific model element
+ * in the context of the specified namespace.
+ *
+ * @param element
+ * element to represent.
+ * @param namespace
+ * context namespace (may be null).
+ * @return a string representing the model element
+ *
+ * @deprecated for 0.25.4 by maurelio1234. Use
+ * {@link #getFormatingStrategy()} instead.
*/
@Deprecated
public String formatElement(Object element,
@@ -138,13 +146,17 @@
}
/**
- * This method produces a string the represents the collection
- * of model elements in the context of the specified namespace.
- * @param iter iterator over collection
- * @param namespace context namespace (may be null).
- * @return a string representing the collection
- *
- * @deprecated by maurelio1234. Use {@link #getFormatingStrategy()} instead.
+ * This method produces a string the represents the collection of model
+ * elements in the context of the specified namespace.
+ *
+ * @param iter
+ * iterator over collection
+ * @param namespace
+ * context namespace (may be null).
+ * @return a string representing the collection
+ *
+ * @deprecated for 0.25.4 by maurelio1234. Use
+ * {@link #getFormatingStrategy()} instead.
*/
@Deprecated
public String formatCollection(Iterator iter,
Modified: trunk/src_new/org/argouml/uml/profile/ProfileConfiguration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/profile/ProfileConfiguration.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/profile/ProfileConfiguration.java&p2=trunk/src_new/org/argouml/uml/profile/ProfileConfiguration.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/profile/ProfileConfiguration.java (original)
+++ trunk/src_new/org/argouml/uml/profile/ProfileConfiguration.java 2007-09-26 23:27:31-0700
@@ -22,21 +22,22 @@
// CALIFORNIA HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
// UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-
package org.argouml.uml.profile;
import java.awt.Image;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
+import java.util.List;
import java.util.Set;
-import java.util.Vector;
+import java.util.ArrayList;
import org.apache.log4j.Logger;
import org.argouml.kernel.AbstractProjectMember;
import org.argouml.kernel.Project;
import org.argouml.model.Model;
import org.argouml.ui.explorer.ExplorerEventAdaptor;
+
/**
* This class captures represents the unique access point for the
* configurability allowed by the use of profiles.
@@ -51,11 +52,14 @@
.getLogger(ProfileConfiguration.class);
private FormatingStrategy formatingStrategy;
+
private DefaultTypeStrategy defaultTypeStrategy;
- private Vector figNodeStrategies = new Vector();
-
- private Vector<Profile> profiles = new Vector<Profile>();
- private Vector<Object> profileModels = new Vector<Object>();
+
+ private List figNodeStrategies = new ArrayList();
+
+ private List<Profile> profiles = new ArrayList<Profile>();
+
+ private List<Object> profileModels = new ArrayList<Object>();
/**
* The extension used in serialization and returned by {@link #getType()}
@@ -71,10 +75,8 @@
public ProfileConfiguration(Project project) {
super(EXTENSION, project);
- Iterator it = ProfileManagerImpl.getInstance().getDefaultProfiles().iterator();
-
- while (it.hasNext()) {
- Profile p = (Profile) it.next();
+ for (Profile p
+ : ProfileManagerImpl.getInstance().getDefaultProfiles()) {
addProfile(p);
}
@@ -108,10 +110,10 @@
*
* @param profile the profile providing the current default type strategy
*/
- public void activateDefaultTypeStrategy(Profile p) {
- if (p != null && p.getDefaultTypeStrategy() != null
- && getProfiles().contains(p)) {
- this.defaultTypeStrategy = p.getDefaultTypeStrategy();
+ public void activateDefaultTypeStrategy(Profile profile) {
+ if (profile != null && profile.getDefaultTypeStrategy() != null
+ && getProfiles().contains(profile)) {
+ this.defaultTypeStrategy = profile.getDefaultTypeStrategy();
}
}
@@ -131,7 +133,7 @@
/**
* @return the list of applied profiles
*/
- public Vector<Profile> getProfiles() {
+ public List<Profile> getProfiles() {
return profiles;
}
@@ -166,7 +168,7 @@
/**
* @return the list of models of the currently applied profile.
*/
- private Vector getProfileModels() {
+ private List getProfileModels() {
return profileModels;
}
@@ -192,7 +194,7 @@
formatingStrategy = null;
}
- Vector<Profile> markForRemoval = new Vector<Profile>();
+ List<Profile> markForRemoval = new ArrayList<Profile>();
for (Profile profile : profiles) {
if (profile.getDependencies().contains(p)) {
markForRemoval.add(profile);
@@ -255,17 +257,19 @@
* @return the "Profile Configuration" string
* @see java.lang.Object#toString()
*/
+ @Override
public String toString() {
return "Profile Configuration";
}
+
/**
- * @param string
- * @param obj
- * @return
+ * Find a stereotype with the given name which is applicable to the given element.
+ * @param name name of stereotype to look for
+ * @param element model element to which the stereotype must be applicable
+ * @return the stereotype or null if none found
*/
- @SuppressWarnings("deprecation")
- public Object findStereotypeForObject(String string, Object obj) {
+ public Object findStereotypeForObject(String name, Object element) {
Iterator iter = null;
for (Object model : profileModels) {
@@ -274,15 +278,15 @@
while (iter.hasNext()) {
Object stereo = iter.next();
if (!Model.getFacade().isAStereotype(stereo)
- || !string.equals(Model.getFacade().getName(stereo))) {
+ || !name.equals(Model.getFacade().getName(stereo))) {
continue;
}
- if (Model.getExtensionMechanismsHelper().isValidStereoType(obj,
+ if (Model.getExtensionMechanismsHelper().isValidStereoType(element,
stereo)) {
return Model.getModelManagementHelper()
.getCorrespondingElement(stereo,
- Model.getFacade().getModel(obj));
+ Model.getFacade().getModel(element));
}
}
}
@@ -291,23 +295,22 @@
}
/**
- * @param name
- * @return
+ * Search for the given type in all of the profile models.
+ *
+ * @param name name of type to be found
+ * @return the type or null
*/
public Object findType(String name) {
- Object result = null;
- Iterator it = getProfileModels().iterator();
- while (result == null && it.hasNext()) {
- result = ModelUtils.findTypeInModel(name, it.next());
+ for (Object model : getProfileModels()) {
+ Object result = ModelUtils.findTypeInModel(name, model);
+ if (result != null) {
+ return result;
+ }
}
-
- return result;
+ return null;
}
- /**
- * @param metaType
- * @return
- */
+
@SuppressWarnings("unchecked")
public Collection findByMetaType(Object metaType) {
Set elements = new HashSet();
@@ -323,7 +326,9 @@
/**
* @param modelElement
- * @return
+ * ModelElement for which find possible stereotypes
+ * @return collection of stereotypes which are valid for the given model
+ * element.
*/
public Collection findAllStereotypesForModelElement(Object modelElement) {
return Model.getExtensionMechanismsHelper().getAllPossibleStereotypes(
Modified: trunk/src_new/org/argouml/uml/profile/ProfileCpp.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/profile/ProfileCpp.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/profile/ProfileCpp.java&p2=trunk/src_new/org/argouml/uml/profile/ProfileCpp.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/profile/ProfileCpp.java (original)
+++ trunk/src_new/org/argouml/uml/profile/ProfileCpp.java 2007-09-26 23:27:31-0700
@@ -40,6 +40,8 @@
* Logger.
*/
private static final Logger LOG = Logger.getLogger(ProfileCpp.class);
+
+ private static final String PROFILE_FILE = "/org/argouml/default-cpp.xmi";
private ProfileModelLoader profileModelLoader;
private Collection model;
@@ -69,7 +71,7 @@
private ProfileCpp() throws ProfileException {
profileModelLoader = new ResourceModelLoader();
model = profileModelLoader
- .loadModel("/org/argouml/default-cpp.xmi");
+ .loadModel(PROFILE_FILE);
if (model == null) {
model = new ArrayList();
@@ -79,7 +81,7 @@
addProfileDependency(ProfileUML.getInstance());
}
- /**
+ /*
* @return "C++"
* @see org.argouml.uml.profile.Profile#getDisplayName()
*/
@@ -87,7 +89,7 @@
return "C++";
}
- /**
+ /*
* @see org.argouml.uml.profile.Profile#getProfilePackages()
*/
@Override
@@ -95,23 +97,26 @@
return model;
}
- /**
+ /*
* @see org.argouml.uml.profile.Profile#getDefaultTypeStrategy()
*/
public DefaultTypeStrategy getDefaultTypeStrategy() {
return new DefaultTypeStrategy() {
public Object getDefaultAttributeType() {
- return ModelUtils.findTypeInModel("int", model.iterator().next());
+ return ModelUtils.findTypeInModel("int", model.iterator()
+ .next());
}
public Object getDefaultParameterType() {
- return ModelUtils.findTypeInModel("int", model.iterator().next());
+ return ModelUtils.findTypeInModel("int", model.iterator()
+ .next());
}
public Object getDefaultReturnType() {
- return ModelUtils.findTypeInModel("void", model.iterator().next());
+ return ModelUtils.findTypeInModel("void", model.iterator()
+ .next());
}
-
+
};
}
}
Modified: trunk/src_new/org/argouml/uml/profile/ProfileJava.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/profile/ProfileJava.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/profile/ProfileJava.java&p2=trunk/src_new/org/argouml/uml/profile/ProfileJava.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/profile/ProfileJava.java (original)
+++ trunk/src_new/org/argouml/uml/profile/ProfileJava.java 2007-09-26 23:27:31-0700
@@ -79,7 +79,7 @@
addProfileDependency(ProfileUML.getInstance());
}
- /**
+ /*
* @return "Java"
* @see org.argouml.uml.profile.Profile#getDisplayName()
*/
@@ -87,7 +87,7 @@
return "Java";
}
- /**
+ /*
* @see org.argouml.uml.profile.Profile#getProfilePackages()
*/
@Override
@@ -95,21 +95,25 @@
return model;
}
- /**
+ /*
* @see org.argouml.uml.profile.Profile#getDefaultTypeStrategy()
*/
+ @Override
public DefaultTypeStrategy getDefaultTypeStrategy() {
return new DefaultTypeStrategy() {
public Object getDefaultAttributeType() {
- return ModelUtils.findTypeInModel("int", model.iterator().next());
+ return ModelUtils.findTypeInModel("int", model.iterator()
+ .next());
}
public Object getDefaultParameterType() {
- return ModelUtils.findTypeInModel("int", model.iterator().next());
+ return ModelUtils.findTypeInModel("int", model.iterator()
+ .next());
}
public Object getDefaultReturnType() {
- return ModelUtils.findTypeInModel("void", model.iterator().next());
+ return ModelUtils.findTypeInModel("void", model.iterator()
+ .next());
}
};
Modified: trunk/src_new/org/argouml/uml/profile/ProfileManager.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/profile/ProfileManager.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/profile/ProfileManager.java&p2=trunk/src_new/org/argouml/uml/profile/ProfileManager.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/profile/ProfileManager.java (original)
+++ trunk/src_new/org/argouml/uml/profile/ProfileManager.java 2007-09-26 23:27:31-0700
@@ -24,7 +24,7 @@
package org.argouml.uml.profile;
-import java.util.Vector;
+import java.util.List;
/**
* Manages the global set of registered profiles.
@@ -32,14 +32,16 @@
* @author maurelio1234
*/
public interface ProfileManager {
+
/**
- * Register a new profile
+ * Register a new profile.
*
* @param p the profile
*/
void registerProfile(Profile p);
+
/**
- * Remove a profile from the list
+ * Remove a profile from the list.
*
* @param p the profile
*/
@@ -48,53 +50,56 @@
/**
* @return the list of registered profiles
*/
- Vector<Profile> getRegisteredProfiles();
+ List<Profile> getRegisteredProfiles();
/**
- * @return the profile instance for the class
+ * TODO: Add better Javadoc here.
+ *
+ * @return the profile instance for the class or null if there is none.
+ * @param className the name of the class for which to get the profile
*/
Profile getProfileForClass(String className);
/**
* @return the default set of profiles
*/
- Vector<Profile> getDefaultProfiles();
+ List<Profile> getDefaultProfiles();
/**
- * Adds a profile to the default list.
+ * Add a profile to the default list.
*
* @param p profile to add
*/
void addToDefaultProfiles(Profile p);
/**
- * Remove a profile from the default list
+ * Remove a profile from the default list.
*
* @param p the profile to be removed
*/
void removeFromDefaultProfiles(Profile p);
/**
- * Adds a new directory to the directory list
+ * Add a new directory to the directory list.
*
* @param path user defined directory
*/
void addSearchPathDirectory(String path);
/**
- * Removes a directory from the directory list
+ * Remove a directory from the directory list.
*
- * @param path
+ * @param path the directory path to be removed.
*/
void removeSearchPathDirectory(String path);
/**
* @return the current directory list
*/
- Vector<String> getSearchPathDirectories();
+ List<String> getSearchPathDirectories();
/**
- * Looks for XMI files at the current directory list and registers
+ * Look for XMI files at the current directory list and registers
* them as user defined profiles.
*/
void refreshRegisteredProfiles();
Modified: trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java&p2=trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java (original)
+++ trunk/src_new/org/argouml/uml/profile/ProfileManagerImpl.java 2007-09-26 23:27:31-0700
@@ -25,9 +25,11 @@
package org.argouml.uml.profile;
import java.io.File;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import java.util.StringTokenizer;
-import java.util.Vector;
+
import org.argouml.configuration.Configuration;
import org.argouml.configuration.ConfigurationKey;
@@ -58,11 +60,11 @@
*/
private boolean disableConfigurationUpdate = false;
- private Vector<Profile> profiles = new Vector<Profile>();
+ private List<Profile> profiles = new ArrayList<Profile>();
- private Vector<Profile> defaultProfiles = new Vector<Profile>();
+ private List<Profile> defaultProfiles = new ArrayList<Profile>();
- private Vector<String> searchDirectories = new Vector<String>();
+ private List<String> searchDirectories = new ArrayList<String>();
private ProfileManagerImpl() {
defaultProfiles.add(ProfileUML.getInstance());
@@ -93,7 +95,7 @@
p = findUserDefinedProfile(new File(fileName));
} else if (desc.charAt(0) == 'C') {
String className = desc.substring(1);
- p = getProfileForClass(className);
+ p = getProfileForClass(className);
}
if (p != null) {
@@ -107,11 +109,8 @@
private void updateDefaultProfilesConfiguration() {
if (!disableConfigurationUpdate) {
StringBuffer buf = new StringBuffer();
-
- Iterator it = defaultProfiles.iterator();
-
- while (it.hasNext()) {
- Profile p = (Profile) it.next();
+
+ for (Profile p : defaultProfiles) {
if (p instanceof UserDefinedProfile) {
buf.append("U"
@@ -145,10 +144,7 @@
if (!disableConfigurationUpdate) {
StringBuffer buf = new StringBuffer();
- Iterator it = searchDirectories.iterator();
-
- while (it.hasNext()) {
- String s = (String) it.next();
+ for (String s : searchDirectories) {
buf.append(s + "*");
}
@@ -166,35 +162,27 @@
return instance;
}
- /**
- * @return the list of profiles
- * @see org.argouml.uml.profile.ProfileManager#getRegisteredProfiles()
- */
- public Vector<Profile> getRegisteredProfiles() {
+
+ public List<Profile> getRegisteredProfiles() {
return profiles;
}
- /**
- * @param p the profile
- * @see org.argouml.uml.profile.ProfileManager#registerProfile(org.argouml.uml.profile.Profile)
- */
+
public void registerProfile(Profile p) {
if (p != null && !profiles.contains(p)) {
if (p instanceof UserDefinedProfile
|| getProfileForClass(p.getClass().getName()) == null) {
profiles.add(p);
- // this profile could have not been loaded when the default profile configuration
+ // this profile could have not been loaded when
+ // the default profile configuration
// was loaded at first, so we need to do it again
loadDefaultProfilesfromConfiguration();
}
}
}
- /**
- * @param p the profile
- * @see org.argouml.uml.profile.ProfileManager#removeProfile(org.argouml.uml.profile.Profile)
- */
+
public void removeProfile(Profile p) {
if (p != null) {
profiles.remove(p);
@@ -202,11 +190,7 @@
}
}
- /**
- * @param profileClass the profile class
- * @return the profile object or null if there is no one
- * @see org.argouml.uml.profile.ProfileManager#getProfileForClass(java.lang.Class)
- */
+
public Profile getProfileForClass(String profileClass) {
Iterator it = profiles.iterator();
Profile found = null;
@@ -222,10 +206,7 @@
return found;
}
- /**
- * @param p th profile
- * @see org.argouml.uml.profile.ProfileManager#addToDefaultProfiles(org.argouml.uml.profile.Profile)
- */
+
public void addToDefaultProfiles(Profile p) {
if (p != null && profiles.contains(p) && !defaultProfiles.contains(p)) {
defaultProfiles.add(p);
@@ -233,18 +214,12 @@
}
}
- /**
- * @return the list
- * @see org.argouml.uml.profile.ProfileManager#getDefaultProfiles()
- */
- public Vector<Profile> getDefaultProfiles() {
+
+ public List<Profile> getDefaultProfiles() {
return defaultProfiles;
}
- /**
- * @param p the profile
- * @see org.argouml.uml.profile.ProfileManager#removeFromDefaultProfiles(org.argouml.uml.profile.Profile)
- */
+
public void removeFromDefaultProfiles(Profile p) {
if (p != null && profiles.contains(p)) {
defaultProfiles.remove(p);
@@ -259,18 +234,12 @@
}
}
- /**
- * @return the directory list
- * @see org.argouml.uml.profile.ProfileManager#getSearchPathDirectories()
- */
- public Vector<String> getSearchPathDirectories() {
+
+ public List<String> getSearchPathDirectories() {
return searchDirectories;
}
- /**
- * @param path the directory to remove
- * @see org.argouml.uml.profile.ProfileManager#removeSearchPathDirectory(java.lang.String)
- */
+
public void removeSearchPathDirectory(String path) {
if (path != null) {
searchDirectories.remove(path);
@@ -278,30 +247,27 @@
}
}
- /**
- * @see org.argouml.uml.profile.ProfileManager#refreshRegisteredProfiles()
- */
+
public void refreshRegisteredProfiles() {
- Iterator it = searchDirectories.iterator();
- while (it.hasNext()) {
- File dir = new File((String) it.next());
+ for (String dirName : searchDirectories) {
+ File dir = new File(dirName);
if (dir.exists()) {
- File[] files = dir.listFiles();
-
- for (int i = 0; i < files.length; ++i) {
- if (files[i].getName().toLowerCase().endsWith(".xmi")) {
+ for (File file : dir.listFiles()) {
+ // TODO: Allow .zargo as profile as well?
+ if (file.getName().toLowerCase().endsWith(".xmi")) {
- boolean found = findUserDefinedProfile(files[i]) != null;
+ boolean found =
+ findUserDefinedProfile(file) != null;
if (!found) {
UserDefinedProfile udp = null;
try {
- udp = new UserDefinedProfile(files[i]);
+ udp = new UserDefinedProfile(file);
registerProfile(udp);
} catch (ProfileException e) {
- // if an exception is raised this file is not useful
+ // if an exception is raised file is unusable
}
}
}
@@ -311,11 +277,8 @@
}
private Profile findUserDefinedProfile(File file) {
- Iterator it2 = profiles.iterator();
-
- while (it2.hasNext()) {
- Profile p = (Profile) it2.next();
-
+
+ for (Profile p : profiles) {
if (p instanceof UserDefinedProfile) {
UserDefinedProfile udp = (UserDefinedProfile) p;
Modified: trunk/src_new/org/argouml/uml/profile/ProfileUML.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/profile/ProfileUML.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/profile/ProfileUML.java&p2=trunk/src_new/org/argouml/uml/profile/ProfileUML.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/profile/ProfileUML.java (original)
+++ trunk/src_new/org/argouml/uml/profile/ProfileUML.java 2007-09-26 23:27:31-0700
@@ -42,6 +42,8 @@
*/
private static final Logger LOG = Logger.getLogger(ProfileUML.class);
+ private static final String PROFILE_FILE = "/org/argouml/default-uml14.xmi";
+
private FormatingStrategy formatingStrategy;
private ProfileModelLoader profileModelLoader;
private Collection model;
@@ -71,7 +73,7 @@
formatingStrategy = new JavaFormatingStrategy();
profileModelLoader = new ResourceModelLoader();
model = profileModelLoader
- .loadModel("/org/argouml/default-uml14.xmi");
+ .loadModel(PROFILE_FILE);
if (model == null) {
model = new ArrayList();
@@ -88,7 +90,7 @@
return formatingStrategy;
}
- /**
+ /*
* @return "UML 1.4"
* @see org.argouml.uml.profile.Profile#getDisplayName()
*/
@@ -96,7 +98,7 @@
return "UML 1.4";
}
- /**
+ /*
* @see org.argouml.uml.profile.Profile#getProfilePackages()
*/
@Override
@@ -104,23 +106,26 @@
return model;
}
- /**
+ /*
* @see org.argouml.uml.profile.Profile#getDefaultTypeStrategy()
*/
+ @Override
public DefaultTypeStrategy getDefaultTypeStrategy() {
return new DefaultTypeStrategy() {
public Object getDefaultAttributeType() {
- return ModelUtils.findTypeInModel("Integer", model.iterator().next());
+ return ModelUtils.findTypeInModel("Integer", model.iterator()
+ .next());
}
public Object getDefaultParameterType() {
- return ModelUtils.findTypeInModel("Integer", model.iterator().next());
+ return ModelUtils.findTypeInModel("Integer", model.iterator()
+ .next());
}
public Object getDefaultReturnType() {
return null;
}
-
+
};
- }
+ }
}
Modified: trunk/src_new/org/argouml/uml/ui/PropPanel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/PropPanel.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/ui/PropPanel.java&p2=trunk/src_new/org/argouml/uml/ui/PropPanel.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/PropPanel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/PropPanel.java 2007-09-26 23:27:31-0700
@@ -61,7 +61,7 @@
import org.argouml.ui.targetmanager.TargetEvent;
import org.argouml.ui.targetmanager.TargetListener;
import org.argouml.ui.targetmanager.TargettableModelView;
-import org.argouml.uml.Profile;
+import org.argouml.uml.profile.ProfileConfiguration;
import org.tigris.gef.presentation.Fig;
import org.tigris.swidgets.GridLayout2;
import org.tigris.swidgets.LabelledLayout;
@@ -114,7 +114,7 @@
* <li> {@link Object}[]
* </ul>
*/
- private List actions = new ArrayList<Action>();
+ private List actions = new ArrayList();
private static Font stdFont =
LookAndFeelMgr.getInstance().getStandardFont();
@@ -139,7 +139,8 @@
setLayout(layout);
if (icon != null) {
- setTitleLabel(new JLabel(Translator.localize(label), icon, SwingConstants.LEFT));
+ setTitleLabel(new JLabel(Translator.localize(label), icon,
+ SwingConstants.LEFT));
} else {
setTitleLabel(new JLabel(Translator.localize(label)));
}
@@ -456,8 +457,9 @@
/*
* @see org.argouml.uml.ui.UMLUserInterfaceContainer#getProfile()
*/
- public Profile getProfile() {
- return ProjectManager.getManager().getCurrentProject().getProfile();
+ public ProfileConfiguration getProfile() {
+ return ProjectManager.getManager().getCurrentProject()
+ .getProfileConfiguration();
}
/*
@@ -470,15 +472,17 @@
/*
* @see org.argouml.uml.ui.UMLUserInterfaceContainer#formatElement(java.lang.Object)
*/
- public String formatElement(/* MModelElement */Object element) {
- return getProfile().formatElement(element, getDisplayNamespace());
+ public String formatElement(Object element) {
+ return getProfile().getFormatingStrategy().formatElement(element,
+ getDisplayNamespace());
}
/*
* @see org.argouml.uml.ui.UMLUserInterfaceContainer#formatNamespace(java.lang.Object)
*/
- public String formatNamespace(/* MNamespace */Object namespace) {
- return getProfile().formatElement(namespace, null);
+ public String formatNamespace(Object namespace) {
+ return getProfile().getFormatingStrategy().formatElement(namespace,
+ null);
}
/*
@@ -486,7 +490,8 @@
*/
public String formatCollection(Iterator iter) {
Object namespace = getDisplayNamespace();
- return getProfile().formatCollection(iter, namespace);
+ return getProfile().getFormatingStrategy().formatCollection(iter,
+ namespace);
}
Modified: trunk/src_new/org/argouml/uml/ui/UMLComboBoxEntry.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/UMLComboBoxEntry.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/ui/UMLComboBoxEntry.java&p2=trunk/src_new/org/argouml/uml/ui/UMLComboBoxEntry.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/UMLComboBoxEntry.java (original)
+++ trunk/src_new/org/argouml/uml/ui/UMLComboBoxEntry.java 2007-09-26 23:27:31-0700
@@ -28,7 +28,8 @@
import org.apache.log4j.Logger;
import org.argouml.model.Model;
-import org.argouml.uml.Profile;
+import org.argouml.uml.profile.FormatingStrategy;
+import org.argouml.uml.profile.Profile;
/**
* A combobox entry. <p>
@@ -52,7 +53,7 @@
/** longName is composed of an identifier and a name as in Class: String */
private String longName;
- private Profile profile;
+ private FormatingStrategy formater;
/** display name will be the same as shortName unless there
* is a name collision */
@@ -75,7 +76,12 @@
element = modelElement;
if (modelElement != null) {
Object ns = Model.getFacade().getNamespace(modelElement);
- shortName = theProfile.formatElement(modelElement, ns);
+ if (theProfile.getFormatingStrategy() != null) {
+ shortName = theProfile.getFormatingStrategy().formatElement(
+ modelElement, ns);
+ } else {
+ // TODO What should we do here?
+ }
} else {
shortName = "";
}
@@ -83,7 +89,7 @@
//
// format the element in its own namespace
// should result in an name without packages
- profile = theProfile;
+ formater = theProfile.getFormatingStrategy();
longName = null;
displayName = shortName;
thisIsAPhantom = isPhantom;
@@ -103,7 +109,11 @@
public void updateName() {
if (element != null) {
Object ns = Model.getFacade().getNamespace(element);
- shortName = profile.formatElement(element, ns);
+ if (formater != null) {
+ shortName = formater.formatElement(element, ns);
+ } else {
+ // TODO what should we do here?
+ }
}
}
@@ -138,7 +148,11 @@
public String getLongName() {
if (longName == null) {
if (element != null) {
- longName = profile.formatElement(element, null);
+ if (formater != null) {
+ longName = formater.formatElement(element, null);
+ } else {
+ // TODO what should we do here?
+ }
}
else {
longName = "(unspecified)"; // TODO: I18N
@@ -294,7 +308,11 @@
public void nameChanged(Object modelElement) {
if (modelElement == element && element != null) {
Object ns = Model.getFacade().getNamespace(element);
- shortName = profile.formatElement(element, ns);
+ if (formater != null) {
+ shortName = formater.formatElement(element, ns);
+ } else {
+ // TODO what should we do here?
+ }
displayName = shortName;
longName = null;
}
Modified: trunk/src_new/org/argouml/uml/ui/UMLUserInterfaceContainer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/UMLUserInterfaceContainer.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/ui/UMLUserInterfaceContainer.java&p2=trunk/src_new/org/argouml/uml/ui/UMLUserInterfaceContainer.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/UMLUserInterfaceContainer.java (original)
+++ trunk/src_new/org/argouml/uml/ui/UMLUserInterfaceContainer.java 2007-09-26 23:27:31-0700
@@ -26,7 +26,7 @@
package org.argouml.uml.ui;
import java.util.Iterator;
-import org.argouml.uml.Profile;
+import org.argouml.uml.profile.ProfileConfiguration;
/**
* Interface supported by any container of UML user interface components.
@@ -46,23 +46,28 @@
/**
* @return the current target for the container if the target is a
- * MModelElement, otherwise null
+ * ModelElement, otherwise null
*/
public Object getModelElement();
/**
+ * Return the current profile.
+ * <p>
+ * NOTE: An incompatible change was made to this API for 0.25.4. The return
+ * type was changed from Profile to ProfileConfiguration.
+ *
* @return the current profile, may not be null
*/
- public Profile getProfile();
+ public ProfileConfiguration getProfile();
/**
* Formats the specified model element. Typically, deferred to the
* profile.
*
- * @param element the given element
+ * @param element the given ModelElement
* @return the formatted string
*/
- public String formatElement(/*MModelElement*/Object element);
+ public String formatElement(Object element);
/**
* Formats a collection of model elements. Typically, deferred to the
@@ -79,6 +84,6 @@
* @param ns the namespace
* @return the formatted string
*/
- public String formatNamespace(/*MNamespace*/Object ns);
+ public String formatNamespace(Object ns);
}
Modified: trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/foundation/core/UMLGeneralizationPowertypeComboBoxModel.java 2007-09-26 23:27:31-0700
@@ -70,9 +70,9 @@
.getAllModelElementsOfKind(model,
Model.getMetaTypes().getClassifier()));
}
- elements.addAll(Model.getModelManagementHelper()
- .getAllModelElementsOfKind(p.getDefaultModel(),
- Model.getMetaTypes().getClassifier()));
+
+ elements.addAll(p.getProfileConfiguration().findByMetaType(
+ Model.getMetaTypes().getClassifier()));
setElements(elements);
}
Modified: trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/foundation/core/UMLStructuralFeatureTypeComboBoxModel.java 2007-09-26 23:27:31-0700
@@ -99,9 +99,7 @@
model, Model.getMetaTypes().getDataType()));
}
- elements.addAll(Model.getModelManagementHelper()
- .getAllModelElementsOfKind(
- p.getDefaultModel(),
+ elements.addAll(p.getProfileConfiguration().findByMetaType(
Model.getMetaTypes().getClassifier()));
// Our comparator will throw an InvalidElementException if the old
Modified: trunk/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java?view=diff&rev=13614&p1=trunk/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java&p2=trunk/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java&r1=13613&r2=13614
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java (original)
+++ trunk/src_new/org/argouml/uml/ui/foundation/extension_mechanisms/UMLTagDefinitionComboBoxModel.java 2007-09-26 23:27:31-0700
@@ -114,10 +114,10 @@
model,
Model.getMetaTypes().getTagDefinition()));
}
- addAllUniqueModelElementsFrom(availableTagDefs, paths,
- Model.getModelManagementHelper().getAllModelElementsOfKind(
- project.getDefaultModel(),
+ addAllUniqueModelElementsFrom(availableTagDefs, paths, project
+ .getProfileConfiguration().findByMetaType(
Model.getMetaTypes().getTagDefinition()));
+
List notValids = new ArrayList();
for (Object tagDef : availableTagDefs) {
Object owner = Model.getFacade().getOwner(tagDef);