Author: mvw
Date: 2008-05-27 13:08:47-0700
New Revision: 14811
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java
Log:
Refactored the use of textEdited() and textEditStarted().
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java?view=diff&rev=14811&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java&r1=14810&r2=14811
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigClass.java 2008-05-27 13:08:47-0700
@@ -327,40 +327,6 @@
}
}
- ////////////////////////////////////////////////////////////////
- // internal methods
-
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEdited(org.tigris.gef.presentation.FigText)
- * TODO: Move this to superclass once TODO comments in
- * FigEnumeration.textEdited complete
- */
- protected void textEdited(FigText ft) throws PropertyVetoException {
- super.textEdited(ft);
- // TODO: Do we really need this?
- if (getOwner() == null) {
- return;
- }
- if (ft instanceof CompartmentFigText) {
- ((CompartmentFigText) ft).textEdited();
- }
- }
-
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEditStarted(org.tigris.gef.presentation.FigText)
- */
- protected void textEditStarted(FigText ft) {
- super.textEditStarted(ft);
- if (getAttributesFig().getFigs().contains(ft)) {
- showHelp(((CompartmentFigText) ft)
- .getNotationProvider().getParsingHelp());
- }
- if (getOperationsFig().getFigs().contains(ft)) {
- showHelp(((CompartmentFigText) ft)
- .getNotationProvider().getParsingHelp());
- }
- }
-
/**
* @param fgVec the FigGroup
* @param ft the Figtext
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java?view=diff&rev=14811&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java&r1=14810&r2=14811
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigDataType.java 2008-05-27 13:08:47-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -254,42 +254,6 @@
}
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEdited(org.tigris.gef.presentation.FigText)
- */
- protected void textEdited(FigText ft) throws PropertyVetoException {
- super.textEdited(ft);
- // TODO: Do we really need this?
- if (getOwner() == null) {
- return;
- }
- // TODO: Can we do same here as in FigClass and FigInterface?
- // FigEnumeration will need to be reworked first.
- // Then we can move all common functionality of textEdited to
- // superclass.
- int i = getOperationsFig().getFigs().indexOf(ft);
- if (i != -1) {
- final CompartmentFigText figText = (CompartmentFigText) ft;
- figText.setHighlighted(true);
- figText.getNotationProvider()
- .parse(figText.getOwner(), ft.getText());
- ft.setText(figText.getNotationProvider().toString(
- figText.getOwner(), null));
- }
- }
-
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEditStarted(org.tigris.gef.presentation.FigText)
- */
- protected void textEditStarted(FigText ft) {
- super.textEditStarted(ft);
- if (getOperationsFig().getFigs().contains(ft)) {
- showHelp(((CompartmentFigText) ft)
- .getNotationProvider().getParsingHelp());
- }
- }
-
-
/**
* USED BY PGML.tee.
* @return the class name and bounds together with compartment
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java?view=diff&rev=14811&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java&r1=14810&r2=14811
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigEnumeration.java 2008-05-27 13:08:47-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -192,30 +192,6 @@
// TODO: make setBounds, calcBounds and updateBounds consistent
setBounds(getBounds());
}
-
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEdited(org.tigris.gef.presentation.FigText)
- */
- @Override
- protected void textEdited(FigText ft) throws PropertyVetoException {
- super.textEdited(ft);
- Object cls = /*(Classifier)*/ getOwner();
- if (cls == null) {
- return;
- }
- // TODO: Can we do same here as in FigClass, FigInterface etc?
- // Does work need doing in notations to allow this?
- // Then we can move all common functionality of textEdited to
- // superclass.
- int i = literalsCompartment.getFigs().indexOf(ft);
- if (ft instanceof CompartmentFigText) {
- final CompartmentFigText figText = (CompartmentFigText) ft;
- figText.setHighlighted(true);
- Model.getCoreHelper().setName(figText.getOwner(),
- figText.getText().trim());
- return;
- }
- }
/*
* @see org.argouml.uml.diagram.static_structure.ui.FigDataType#getMinimumSize()
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java?view=diff&rev=14811&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java&r1=14810&r2=14811
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigInterface.java 2008-05-27 13:08:47-0700
@@ -289,38 +289,6 @@
}
}
- ////////////////////////////////////////////////////////////////
- // internal methods
-
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEdited(
- * org.tigris.gef.presentation.FigText)
- * TODO: Move this to superclass once TODO comments in
- * FigEnumeration.textEdited complete
- */
- protected void textEdited(FigText ft) throws PropertyVetoException {
- super.textEdited(ft);
- // TODO: Is this really needed?
- if (getOwner() == null) {
- return;
- }
- if (ft instanceof CompartmentFigText) {
- ((CompartmentFigText) ft).textEdited();
- }
- }
-
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEditStarted(
- * org.tigris.gef.presentation.FigText)
- */
- protected void textEditStarted(FigText ft) {
- super.textEditStarted(ft);
- if (getOperationsFig().getFigs().contains(ft)) {
- showHelp(((CompartmentFigText) ft)
- .getNotationProvider().getParsingHelp());
- }
- }
-
/**
* @param ft the figtext holding the feature
* @param i the index (?)
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java?view=diff&rev=14811&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java&r1=14810&r2=14811
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/static_structure/ui/FigPackage.java 2008-05-27 13:08:47-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -759,18 +759,6 @@
@Override
protected void textEditStarted(FigText ft) {
- /* The following 2 lines should be retained for reference.
- * They represent the better way of editing on the diagram, which
- * 1. would work for different notations, and
- * 2. would indicate to the user that he can edit more aspects
- * of the modelelement than the name alone.
- * But: it is different behaviour, which I (MVW)
- * do not know if it is acceptable.
- */
-
-// String s = GeneratorDisplay.getInstance().generate(getOwner());
-// ft.setText(s);
-
if (ft == getNameFig()) {
showHelp("parsing.help.fig-package");
}
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=14811&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=14810&r2=14811
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/FigNodeModelElement.java 2008-05-27 13:08:47-0700
@@ -1067,6 +1067,12 @@
showHelp(notationProviderName.getParsingHelp());
ft.setText(notationProviderName.toString(getOwner(), npArguments));
}
+ if (ft instanceof CompartmentFigText) {
+ final CompartmentFigText figText = (CompartmentFigText) ft;
+ showHelp(figText.getNotationProvider().getParsingHelp());
+ figText.setText(figText.getNotationProvider().toString(
+ figText.getOwner(), npArguments));
+ }
}
/**
@@ -1089,8 +1095,8 @@
* This method is called after the user finishes editing a text
* field that is in the FigNodeModelElement. Determine which
* field and update the model. This class handles the name,
- * and the stereotype,
- * subclasses should override to handle other text elements.
+ * the stereotype, and any CompartmentFigTexts.
+ * Subclasses should override to handle other text elements.
*
* @param ft the FigText that has been edited and contains the new text
* @throws PropertyVetoException thrown when new text represents
@@ -1105,6 +1111,12 @@
notationProviderName.parse(getOwner(), ft.getText());
ft.setText(notationProviderName.toString(getOwner(), npArguments));
}
+ if (ft instanceof CompartmentFigText) {
+ final CompartmentFigText figText = (CompartmentFigText) ft;
+ figText.getNotationProvider().parse(ft.getOwner(), ft.getText());
+ ft.setText(figText.getNotationProvider().toString(
+ ft.getOwner(), npArguments));
+ }
}
////////////////////////////////////////////////////////////////
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java?view=diff&rev=14811&p1=trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java&p2=trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java&r1=14810&r2=14811
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/use_case/ui/FigUseCase.java 2008-05-27 13:08:47-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -984,57 +984,6 @@
unhighlight();
}
- ///////////////////////////////////////////////////////////////////////////
- //
- // Internal methods
- //
- ///////////////////////////////////////////////////////////////////////////
-
- /**
- * Invoked when text has been edited.<p>
- *
- * We check that it is one of the extension point compartments and then
- * parse accordingly.<p>
- *
- * The parameter ft is the Fig with the text that has been edited.
- *
- * {@inheritDoc}
- */
- @Override
- protected void textEdited(FigText ft) throws PropertyVetoException {
- // Let the parent do anything it wants first (in casu: the usecase name)
- super.textEdited(ft);
-
- // Only works if we have an owner
- Object useCase = getOwner();
- if (useCase == null) {
- return;
- }
-
- // Give up if we are not one of the extension points
- if (!epVec.getFigs().contains(ft)) {
- return;
- }
-
- // Parse the text
- CompartmentFigText hlft = (CompartmentFigText) ft;
- hlft.getNotationProvider().parse(hlft.getOwner(), ft.getText());
- ft.setText(hlft.getNotationProvider().toString(hlft.getOwner(), null));
- }
-
- /*
- * @see org.argouml.uml.diagram.ui.FigNodeModelElement#textEditStarted(
- * org.tigris.gef.presentation.FigText)
- */
- @Override
- protected void textEditStarted(FigText ft) {
- super.textEditStarted(ft);
- if (epVec.getFigs().contains(ft)) {
- showHelp(((CompartmentFigText) ft)
- .getNotationProvider().getParsingHelp());
- }
- }
-
/**
* Create a new "feature" (extension point) in the use case fig.<p>
*
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.