summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2009-04-08 09:06:18 (EDT)
committerCarsten Drossel2009-04-08 09:06:18 (EDT)
commit5fe2c0b32a6e0055b2f4058ff6447ff6b0a844a1 (patch)
tree2185911c3a71150f28e241be58a89b99937f9113
parentf10b2aa4c81259ab047d45eb2b6e95cbfdc9bf6a (diff)
downloadorg.eclipse.riena-5fe2c0b32a6e0055b2f4058ff6447ff6b0a844a1.zip
org.eclipse.riena-5fe2c0b32a6e0055b2f4058ff6447ff6b0a844a1.tar.gz
org.eclipse.riena-5fe2c0b32a6e0055b2f4058ff6447ff6b0a844a1.tar.bz2
bug 269131
-rw-r--r--org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeController.java3
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeControllerTest.java72
2 files changed, 64 insertions, 11 deletions
diff --git a/org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeController.java b/org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeController.java
index 25e7dd1..016b5e3 100644
--- a/org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeController.java
+++ b/org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeController.java
@@ -185,7 +185,8 @@ public abstract class NavigationNodeController<N extends INavigationNode<?>> ext
private void addRidgetMarkers(IRidget ridget, List<IMarker> combinedMarkers) {
- if (ridget instanceof IMarkableRidget && ((IMarkableRidget) ridget).isVisible()) {
+ if (ridget instanceof IMarkableRidget && ((IMarkableRidget) ridget).isVisible()
+ && ((IMarkableRidget) ridget).isEnabled()) {
addRidgetMarkers((IMarkableRidget) ridget, combinedMarkers);
} else if (ridget instanceof IRidgetContainer) {
addRidgetMarkers((IRidgetContainer) ridget, combinedMarkers);
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeControllerTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeControllerTest.java
index 4279b52..6eb33c3 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeControllerTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/NavigationNodeControllerTest.java
@@ -17,6 +17,10 @@ import junit.framework.TestCase;
import org.eclipse.core.databinding.observable.Realm;
import org.eclipse.jface.databinding.swt.SWTObservables;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
import org.eclipse.riena.core.marker.IMarker;
import org.eclipse.riena.core.util.ReflectionUtils;
import org.eclipse.riena.internal.ui.ridgets.swt.LabelRidget;
@@ -25,16 +29,13 @@ import org.eclipse.riena.navigation.ISubModuleNode;
import org.eclipse.riena.navigation.model.NavigationProcessor;
import org.eclipse.riena.navigation.model.SubModuleNode;
import org.eclipse.riena.tests.collect.UITestCase;
+import org.eclipse.riena.ui.core.marker.DisabledMarker;
import org.eclipse.riena.ui.core.marker.ErrorMarker;
import org.eclipse.riena.ui.core.marker.HiddenMarker;
import org.eclipse.riena.ui.core.marker.MandatoryMarker;
import org.eclipse.riena.ui.core.marker.OutputMarker;
import org.eclipse.riena.ui.ridgets.AbstractCompositeRidget;
import org.eclipse.riena.ui.swt.utils.SwtUtilities;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
/**
* Tests of the class {@link NavigationNodeController}.
@@ -122,11 +123,11 @@ public class NavigationNodeControllerTest extends TestCase {
*/
public void testGetRidgetMarkers() {
- LabelRidget ridget = new LabelRidget();
- ridget.setUIControl(new Label(shell, 0));
+ TextRidget ridget = new TextRidget();
+ ridget.setUIControl(new Text(shell, 0));
controller.addRidget("4711", ridget);
- LabelRidget ridget2 = new LabelRidget();
- ridget2.setUIControl(new Label(shell, 0));
+ TextRidget ridget2 = new TextRidget();
+ ridget2.setUIControl(new Text(shell, 0));
controller.addRidget("0815", ridget2);
Collection<IMarker> markers = ReflectionUtils.invokeHidden(controller, "getRidgetMarkers", (Object[]) null);
@@ -143,8 +144,8 @@ public class NavigationNodeControllerTest extends TestCase {
assertTrue(markers.contains(outputMarker));
CompositeRidget compositeRidget = new CompositeRidget();
- LabelRidget ridget3 = new LabelRidget();
- ridget3.setUIControl(new Label(shell, 0));
+ TextRidget ridget3 = new TextRidget();
+ ridget3.setUIControl(new Text(shell, 0));
compositeRidget.addRidget("label3", ridget3);
controller.addRidget("comp", compositeRidget);
MandatoryMarker mandatoryMarker = new MandatoryMarker();
@@ -156,6 +157,57 @@ public class NavigationNodeControllerTest extends TestCase {
}
+ /**
+ * Test for bug 269131.
+ */
+ public void testHiddenAndDisabledMarkersBlockAllRidgetMarkers() throws Exception {
+
+ TextRidget ridget = new TextRidget();
+ ridget.setUIControl(new Text(shell, 0));
+ controller.addRidget("4711", ridget);
+ TextRidget ridget2 = new TextRidget();
+ ridget2.setUIControl(new Text(shell, 0));
+ controller.addRidget("0815", ridget2);
+
+ IMarker errorMarker = new ErrorMarker();
+ IMarker mandatoryMarker = new MandatoryMarker();
+ IMarker hiddenMarker = new HiddenMarker();
+ IMarker disabledMarker = new DisabledMarker();
+
+ ridget.addMarker(errorMarker);
+ ridget.addMarker(mandatoryMarker);
+
+ Collection<IMarker> markers = ReflectionUtils.invokeHidden(controller, "getRidgetMarkers", (Object[]) null);
+ assertEquals(2, markers.size());
+ assertTrue(markers.contains(errorMarker));
+ assertTrue(markers.contains(mandatoryMarker));
+
+ ridget.addMarker(hiddenMarker);
+
+ markers = ReflectionUtils.invokeHidden(controller, "getRidgetMarkers", (Object[]) null);
+ assertTrue(markers.isEmpty());
+
+ ridget2.addMarker(errorMarker);
+ ridget2.addMarker(mandatoryMarker);
+
+ markers = ReflectionUtils.invokeHidden(controller, "getRidgetMarkers", (Object[]) null);
+ assertEquals(2, markers.size());
+ assertTrue(markers.contains(errorMarker));
+ assertTrue(markers.contains(mandatoryMarker));
+
+ ridget2.addMarker(disabledMarker);
+
+ markers = ReflectionUtils.invokeHidden(controller, "getRidgetMarkers", (Object[]) null);
+ assertTrue(markers.isEmpty());
+
+ ridget.removeMarker(hiddenMarker);
+
+ markers = ReflectionUtils.invokeHidden(controller, "getRidgetMarkers", (Object[]) null);
+ assertEquals(2, markers.size());
+ assertTrue(markers.contains(errorMarker));
+ assertTrue(markers.contains(mandatoryMarker));
+ }
+
private static class MyNavigationNodeController extends SubModuleController {
public MyNavigationNodeController(ISubModuleNode navigationNode) {