summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-08-21 07:31:16 (EDT)
committerCarsten Drossel2008-08-21 07:31:16 (EDT)
commit59157ad4b0854762c365b61399fce176e3718092 (patch)
tree45e0368b573b7494c52ee9f8738e731bcff84d86
parentcd4154a196833c383b793c439e4e9e1488927c2b (diff)
downloadorg.eclipse.riena-59157ad4b0854762c365b61399fce176e3718092.zip
org.eclipse.riena-59157ad4b0854762c365b61399fce176e3718092.tar.gz
org.eclipse.riena-59157ad4b0854762c365b61399fce176e3718092.tar.bz2
fixed and applied patch for Bugzilla entry 244575 - add possibility to navigate to a specific node
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNode.java11
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNode.java18
2 files changed, 29 insertions, 0 deletions
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNode.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNode.java
index 41aefd7..80b5b0d 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNode.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNode.java
@@ -195,6 +195,17 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
C getChild(int pIndex);
/**
+ * Searches for a node with the specified ID in the application model tree
+ * tree from this node on downwards including this node.
+ *
+ * @param nodeId
+ * ID of the requested node
+ * @return A node with the specified ID that is either this node or a
+ * descendant of this node or null if no such node exists
+ */
+ INavigationNode<?> findNode(INavigationNodeId nodeId);
+
+ /**
* @param pChild
* - the child to find
* @return the index of the child starting at 0 or -1 if the passed child is
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNode.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNode.java
index 98822bc..180824f 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNode.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNode.java
@@ -271,6 +271,9 @@ public abstract class NavigationNode<S extends INavigationNode<C>, C extends INa
// TODO do something if the node cannot be removed
}
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNode#getChild(int)
+ */
public C getChild(int index) {
if (children != null && children.size() > index) {
return children.get(index);
@@ -280,6 +283,21 @@ public abstract class NavigationNode<S extends INavigationNode<C>, C extends INa
}
/**
+ * @see org.eclipse.riena.navigation.INavigationNode#findNode(org.eclipse.riena.navigation.INavigationNodeId)
+ */
+ public INavigationNode<?> findNode(INavigationNodeId nodeId) {
+ if (getNodeId() != null && getNodeId().equals(nodeId)) {
+ return this;
+ }
+ for (C child : children) {
+ if (child.findNode(nodeId) != null) {
+ return child.findNode(nodeId);
+ }
+ }
+ return null;
+ }
+
+ /**
* @see org.eclipse.riena.navigation.IActivateable#activate()
*/
public void activate() {