svn commit: r16532 - trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/CompartmentFigText.java
Bob Tarling <[email protected]>
| Newsgroups | gmane.comp.lang.uml.argouml.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: bobtarling
Date: 2009-01-06 09:41:35-0800
New Revision: 16532
Modified:
trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/CompartmentFigText.java
Log:
Issue 5577: Highlight the Fig if the owner is in the target list
Modified: trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/CompartmentFigText.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/CompartmentFigText.java?view=diff&pathrev=16532&r1=16531&r2=16532
==============================================================================
--- trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/CompartmentFigText.java (original)
+++ trunk/src/argouml-app/src/org/argouml/uml/diagram/ui/CompartmentFigText.java 2009-01-06 09:41:35-0800
@@ -27,12 +27,15 @@
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Rectangle;
+import java.util.Arrays;
import org.apache.log4j.Logger;
import org.argouml.notation.NotationProvider;
+import org.argouml.ui.targetmanager.TargetEvent;
+import org.argouml.ui.targetmanager.TargetListener;
+import org.argouml.ui.targetmanager.TargetManager;
import org.argouml.uml.diagram.DiagramSettings;
import org.tigris.gef.base.Globals;
-import org.tigris.gef.base.Selection;
import org.tigris.gef.presentation.Fig;
import org.tigris.gef.presentation.FigGroup;
import org.tigris.gef.presentation.FigText;
@@ -48,7 +51,8 @@
*
* @author thn
*/
-public class CompartmentFigText extends FigSingleLineTextWithNotation {
+public class CompartmentFigText extends FigSingleLineTextWithNotation
+ implements TargetListener {
private static final int MARGIN = 3;
@@ -154,6 +158,7 @@
public CompartmentFigText(Object element, Rectangle bounds,
DiagramSettings settings) {
super(element, bounds, settings, true);
+ TargetManager.getInstance().addTargetListener(this);
setJustification(FigText.JUSTIFY_LEFT);
setRightMargin(MARGIN);
@@ -263,6 +268,7 @@
public CompartmentFigText(Object owner, Rectangle bounds,
DiagramSettings settings, String[] properties) {
super(owner, bounds, settings, true, properties);
+ TargetManager.getInstance().addTargetListener(this);
}
/*
@@ -276,6 +282,7 @@
((FigGroup) fg).removeFig(this);
setGroup(null);
}
+ TargetManager.getInstance().removeTargetListener(this);
}
/**
@@ -353,4 +360,24 @@
setHighlighted(true);
super.textEdited();
}
+
+ public void targetAdded(TargetEvent e) {
+ LOG.info("Target added " + e);
+ if (Arrays.asList(e.getNewTargets()).contains(getOwner())) {
+ setHighlighted(true);
+ this.damage();
+ }
+ }
+
+ public void targetRemoved(TargetEvent e) {
+ LOG.info("Target removed " + e);
+ if (e.getRemovedTargetCollection().contains(getOwner())) {
+ setHighlighted(false);
+ this.damage();
+ }
+ }
+
+ public void targetSet(TargetEvent e) {
+ // Nothing required here
+ }
}
------------------------------------------------------
http://argouml.tigris.org/ds/viewMessage.do?dsForumId=5905&dsMessageId=1008084
To unsubscribe from this discussion, e-mail: [[email protected]].