summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-07-09 10:08:20 (EDT)
committerCarsten Drossel2008-07-09 10:08:20 (EDT)
commita8f222d6abfaea533faedf2fd215ed040b4cd052 (patch)
tree47b1ff0a66ee8bd3a99932bff303e29557a907fe
parentf9324323ca1e6704f2bd8777a9b29ffd078cbdb7 (diff)
downloadorg.eclipse.riena-a8f222d6abfaea533faedf2fd215ed040b4cd052.zip
org.eclipse.riena-a8f222d6abfaea533faedf2fd215ed040b4cd052.tar.gz
org.eclipse.riena-a8f222d6abfaea533faedf2fd215ed040b4cd052.tar.bz2
implemented search
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java21
1 files changed, 17 insertions, 4 deletions
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java
index 377be3d..28c9eda 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java
@@ -39,7 +39,7 @@ public class NavigationNodePresentationFactory implements INavigationNodePresent
public INavigationNode<?> createNode(INavigationNode<?> sourceNode, String targetId) {
- INavigationNode targetNode = findNode(sourceNode, targetId);
+ INavigationNode targetNode = findNode(getRootNode(sourceNode), targetId);
if (targetNode == null) {
INavigationNodePresentationDefiniton presentationDefinition = getPresentationDefinition(targetId);
@@ -66,11 +66,24 @@ public class NavigationNodePresentationFactory implements INavigationNodePresent
return null;
}
- private INavigationNode<?> findNode(INavigationNode<?> sourceNode, String targetId) {
+ private INavigationNode<?> getRootNode(INavigationNode<?> node) {
+ if (node.getParent() == null) {
+ return node;
+ }
+ return getRootNode(node.getParent());
+ }
- // search the tree that contains the sourceNode for a node with
- // the presentationId targetId...
+ private INavigationNode<?> findNode(INavigationNode<?> node, String targetId) {
+ if (targetId.equals(node.getPresentationId())) {
+ return node;
+ }
+ for (INavigationNode<?> child : node.getChildren()) {
+ INavigationNode<?> foundNode = findNode(child, targetId);
+ if (foundNode != null) {
+ return findNode(child, targetId);
+ }
+ }
return null;
}