summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2009-05-05 05:33:44 (EDT)
committerCarsten Drossel2009-05-05 05:33:44 (EDT)
commitf9987f11b8cf19019c5bef3626255c1dd09566cb (patch)
tree4860bbe74ccef38e71727c06afec1f03a563ff77
parent483d2bada27b1eadd81b0ab2043a39e47ed75a80 (diff)
downloadorg.eclipse.riena-f9987f11b8cf19019c5bef3626255c1dd09566cb.zip
org.eclipse.riena-f9987f11b8cf19019c5bef3626255c1dd09566cb.tar.gz
org.eclipse.riena-f9987f11b8cf19019c5bef3626255c1dd09566cb.tar.bz2
simplified fix for #274916
-rw-r--r--org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/SubModuleController.java23
-rw-r--r--org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/SubModuleControllerTest.java22
2 files changed, 21 insertions, 24 deletions
diff --git a/org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/SubModuleController.java b/org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/SubModuleController.java
index 83ee452..baa3736 100644
--- a/org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/SubModuleController.java
+++ b/org.eclipse.riena.navigation.ui/src/org/eclipse/riena/navigation/ui/controllers/SubModuleController.java
@@ -143,7 +143,7 @@ public class SubModuleController extends NavigationNodeController<ISubModuleNode
String title = getNavigationNode().getLabel();
- if (!isVisibleInTree()) {
+ if (isHiddenInTree()) {
IModuleNode moduleNode = getModuleController().getNavigationNode();
title = moduleNode.getLabel();
} else {
@@ -159,20 +159,17 @@ public class SubModuleController extends NavigationNodeController<ISubModuleNode
}
/**
- * Returns whether the sub-module is visible in the navigation tree.
+ * Returns whether the sub-module is hidden in the navigation tree. A
+ * sub-module is hidden if it is the only child of a module unless its
+ * parent is configured to show a single child.
*
- * @return {@code true} if sub-module is visible; otherwise {@code false}
+ * @return {@code true} if there is a navigation tree but the sub-module is
+ * not shown; otherwise {@code false}
*/
- private boolean isVisibleInTree() {
+ private boolean isHiddenInTree() {
- if (getModuleController() == null) {
- return true;
- }
- if (!getModuleController().hasSingleLeafChild()) {
- return true;
- }
- if (getModuleController().getNavigationNode().isPresentSingleSubModule()) {
- return true;
+ if (getModuleController() != null && getModuleController().hasSingleLeafChild()) {
+ return !getModuleController().getNavigationNode().isPresentSingleSubModule();
}
return false;
@@ -181,7 +178,7 @@ public class SubModuleController extends NavigationNodeController<ISubModuleNode
@Override
protected void updateIcon(IWindowRidget windowRidget) {
- if (!isVisibleInTree()) {
+ if (isHiddenInTree()) {
if (windowRidget == null) {
return;
}
diff --git a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/SubModuleControllerTest.java b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/SubModuleControllerTest.java
index 398fe77..4d20544 100644
--- a/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/SubModuleControllerTest.java
+++ b/org.eclipse.riena.tests/src/org/eclipse/riena/navigation/ui/controllers/SubModuleControllerTest.java
@@ -103,23 +103,23 @@ public class SubModuleControllerTest extends TestCase {
/**
* Tests the <i>private</i> method {@code isVisibleInTree()}.
*/
- public void testIsVisibleInTree() {
+ public void testIsHiddenInTree() {
SubModuleNode subModule1 = new SubModuleNode("sm1");
SubModuleController smController1 = new SubModuleController(subModule1);
- boolean ret = ReflectionUtils.invokeHidden(smController1, "isVisibleInTree");
- assertTrue(ret);
+ boolean ret = ReflectionUtils.invokeHidden(smController1, "isHiddenInTree");
+ assertFalse(ret);
ModuleNode module = new ModuleNode("m");
new ModuleController(module);
subModule1.setParent(module);
module.addChild(subModule1);
- ret = ReflectionUtils.invokeHidden(smController1, "isVisibleInTree");
- assertFalse(ret);
+ ret = ReflectionUtils.invokeHidden(smController1, "isHiddenInTree");
+ assertTrue(ret);
module.setPresentSingleSubModule(true);
- ret = ReflectionUtils.invokeHidden(smController1, "isVisibleInTree");
- assertTrue(ret);
+ ret = ReflectionUtils.invokeHidden(smController1, "isHiddenInTree");
+ assertFalse(ret);
module.setPresentSingleSubModule(false);
SubModuleNode subModule2 = new SubModuleNode("sm2");
@@ -127,10 +127,10 @@ public class SubModuleControllerTest extends TestCase {
SubModuleController smController2 = new SubModuleController(subModule2);
subModule2.setParent(module);
module.addChild(subModule2);
- ret = ReflectionUtils.invokeHidden(smController1, "isVisibleInTree");
- assertTrue(ret);
- ret = ReflectionUtils.invokeHidden(smController2, "isVisibleInTree");
- assertTrue(ret);
+ ret = ReflectionUtils.invokeHidden(smController1, "isHiddenInTree");
+ assertFalse(ret);
+ ret = ReflectionUtils.invokeHidden(smController2, "isHiddenInTree");
+ assertFalse(ret);
}