Hi Bogdan,
It would have been better to discuss this on the dev list, to sollicit more
design ideas.
Can you please point what interface/abstract class I should modify in
order to have a public int getVisibilityOffset() method in every notation
?
That would be the NotationName interface, and then you can implement it in
NotationNameImpl. You will also need a setter - so that all notations (e.g.
C++) can set this value, and a reasonable default value.
Maybe each notation should be able to switch this feature off?
But I do have another problem with this value! What is it exactly used for?
(I did not read all the code.) Did you take into account the font size? If
your values work for the default size 10, then it won't on my PC, where I
use size 16.
Why not make it a separate UI widget, then you will be able to detect hits
easily, and size independently.
This will then work a bit like entering stereotypes on class names: You can
enter them in fronnt of the name, but they will appear above them. Double
clicking on the name allows you to add another...
I would consider showing the visibility in a separate widget.
Maybe Bob has an opinion on this.
Regards,
Michiel
----- Original Message -----
From: "Bogdan Szanto" <[EMAIL PROTECTED]>
To: "Michiel van der Wulp" <[EMAIL PROTECTED]>
Sent: Saturday, July 26, 2008 11:03 AM
Subject: Re: svn commit: r15373 -
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram:
static_structure/ui ui
Hi Michiel,
I agree it's a little messy, but this is why I need feedback from you
guys :D
Can you please point what interface/abstract class I should modify in
order to have a public int getVisibilityOffset() method in every notation ?
Regards,
Bogdan
Michiel van der Wulp wrote:
Hi Bogdan,
Hmm... this part I do not like at all:
+ // The hit zone is different for the different notations.
+ // Java uses words (public, protected, private) while UML 1.4
uses
+ // signs (+, -, ~, #).
+ int offset = 0;
+ if (notation.equals("Java")) {
+ offset = 50;
+ } else if (notation.equals("UML 1.4")) {
+ offset = 10;
+ }
If needed, you could ask the notation itself how big the offset is you
need to use, or if possible, measure the length of the returned string.
Regards,
Michiel
----- Original Message ----- From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 26, 2008 10:24 AM
Subject: svn commit: r15373 -
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram:
static_structure/ui ui
Author: bszanto
Date: 2008-07-26 01:24:10-0700
New Revision: 15373
Modified:
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/static_structure/ui/FigOperation.java
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
Log:
Clicking (roughly) the +/-/~/# signs or the public/package/private words
now cycles through the visibilities of the operation.
Modified:
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/static_structure/ui/FigOperation.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/static_structure/ui/FigOperation.java?view=diff&rev=15373&p1=branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/static_structure/ui/FigOperation.java&p2=branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/static_structure/ui/FigOperation.java&r1=15372&r2=15373
==============================================================================
---
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/static_structure/ui/FigOperation.java
(original)
+++
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/static_structure/ui/FigOperation.java
2008-07-26 01:24:10-0700
@@ -25,8 +25,10 @@
package org.argouml.uml.diagram.static_structure.ui;
import java.awt.Font;
+import java.awt.Rectangle;
import java.beans.PropertyChangeEvent;
+import org.argouml.kernel.ProjectManager;
import org.argouml.model.Model;
import org.argouml.notation.NotationProvider;
import org.tigris.gef.presentation.Fig;
@@ -94,5 +96,51 @@
return Model.getFacade().isAbstract(getOwner())
? Font.ITALIC : Font.PLAIN;
}
+
+ /**
+ * Cyclies the visibility of an operation when clicking in the
beggining
+ * part of the FigOperation.
+ * @param r Hit rectangle.
+ * @author bszanto
+ */
+ public void changeVisibility(Rectangle r) {
+ if (super.hit(r)) {
+ String notation =
ProjectManager.getManager().getCurrentProject()
+ .getProjectSettings().getNotationLanguage();
+
+ // The hit zone is different for the different notations.
+ // Java uses words (public, protected, private) while UML
1.4 uses
+ // signs (+, -, ~, #).
+ int offset = 0;
+ if (notation.equals("Java")) {
+ offset = 50;
+ } else if (notation.equals("UML 1.4")) {
+ offset = 10;
+ }
+
+ if (r.x < (_x + offset)) {
+ Object operation = getOwner();
+ Object visibity =
Model.getFacade().getVisibility(operation);
+
+ // visibility is chandes according to prop panel order
which is:
+ // public, package, protected, private
+ if
(Model.getVisibilityKind().getPrivate().equals(visibity)) {
+ Model.getCoreHelper().setVisibility(operation,
+ Model.getVisibilityKind().getPublic());
+ } else if (Model.getVisibilityKind().getPublic().equals(
+ visibity)) {
+ Model.getCoreHelper().setVisibility(operation,
+ Model.getVisibilityKind().getPackage());
+ } else if
(Model.getVisibilityKind().getPackage().equals(
+ visibity)) {
+ Model.getCoreHelper().setVisibility(operation,
+ Model.getVisibilityKind().getProtected());
+ } else {
+ Model.getCoreHelper().setVisibility(operation,
+ Model.getVisibilityKind().getPrivate());
+ }
+ }
+ }
+ }
}
Modified:
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
Url:
http://argouml.tigris.org/source/browse/argouml/branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java?view=diff&rev=15373&p1=branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java&p2=branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java&r1=15372&r2=15373
==============================================================================
---
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
(original)
+++
branches/gsoc2008/feature3_5140_bszanto/src/org/argouml/uml/diagram/ui/FigCompartmentBox.java
2008-07-26 01:24:10-0700
@@ -32,6 +32,7 @@
import org.argouml.ui.targetmanager.TargetManager;
import org.argouml.uml.diagram.static_structure.ui.FigAttribute;
+import org.argouml.uml.diagram.static_structure.ui.FigOperation;
import org.argouml.uml.diagram.static_structure.ui.SelectionClass;
import org.tigris.gef.base.Editor;
import org.tigris.gef.base.Globals;
@@ -116,9 +117,11 @@
2,
2);
- if (highlightedFigText instanceof FigAttribute) {
- // try to change visibility
+ // try to change visibility
+ if (highlightedFigText instanceof FigAttribute) {
((FigAttribute) highlightedFigText).changeVisibility(r);
+ } else if (highlightedFigText instanceof FigOperation) {
+ ((FigOperation) highlightedFigText).changeVisibility(r);
}
unhighlight();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.5.6/1574 - Release Date: 7/25/2008
4:27 PM
--
Bogdan SZANTO
address:
15e étage
1, Allée Athéna
69100 Villeurbanne
FRANCE
tel: +33 (0)6 37 45 98 55
+33 (0)4 69 16 08 73
mail: [EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]
-----------------------------------------------
Impossible is nothing ~ Nothing is impossible !
-----------------------------------------------
No virus found in this incoming message.
Checked by AVG - http://www.avg.com
Version: 8.0.138 / Virus Database: 270.5.6/1574 - Release Date: 7/25/2008
4:27 PM
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]