summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-07-10 11:01:12 (EDT)
committerCarsten Drossel2008-07-10 11:01:12 (EDT)
commit7ce3ed1307510acb048466947abdac0596851716 (patch)
tree0e795f8e3069df2c366533fa471d689d618fa867
parent1d3664d84d50833bfbe5d1f6c6333fa7fb82abb7 (diff)
downloadorg.eclipse.riena-7ce3ed1307510acb048466947abdac0596851716.zip
org.eclipse.riena-7ce3ed1307510acb048466947abdac0596851716.tar.gz
org.eclipse.riena-7ce3ed1307510acb048466947abdac0596851716.tar.bz2
added some example navigationNodePresentation configurations
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeProvider.java2
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java52
2 files changed, 12 insertions, 42 deletions
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeProvider.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeProvider.java
index 2bc33a5..0aa197b 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeProvider.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeProvider.java
@@ -18,6 +18,6 @@ package org.eclipse.riena.navigation;
*/
public interface INavigationNodeProvider {
- INavigationNode<?> buildNode();
+ INavigationNode<?> buildNode(String presentationId);
}
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 ad79c63..65ebaa1 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
@@ -12,13 +12,10 @@ package org.eclipse.riena.navigation.model;
import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.navigation.Activator;
-import org.eclipse.riena.navigation.IApplicationModel;
-import org.eclipse.riena.navigation.IModuleNode;
import org.eclipse.riena.navigation.INavigationNode;
import org.eclipse.riena.navigation.INavigationNodePresentationDefiniton;
import org.eclipse.riena.navigation.INavigationNodePresentationFactory;
import org.eclipse.riena.navigation.INavigationNodeProvider;
-import org.eclipse.riena.navigation.ISubModuleNode;
/**
*
@@ -32,51 +29,24 @@ public class NavigationNodePresentationFactory implements INavigationNodePresent
private NodePresentationData target = null;
public NavigationNodePresentationFactory() {
- // TODO Auto-generated constructor stub
-
- // instantiation of this class would populate instance variable
- // <code>webBrowserCreator</code>
-
target = new NodePresentationData();
Inject.extension(ID).into(target).andStart(Activator.getDefault().getContext());
}
public INavigationNode<?> createNode(INavigationNode<?> sourceNode, String targetId) {
+ INavigationNode<?> targetNode = findNode(getRootNode(sourceNode), targetId);
- INavigationNode targetNode = findNode(getRootNode(sourceNode), targetId);
-
- // TODO: einkommentieren wenn Methoden da
- // if (targetNode == null) {
- // INavigationNodePresentationDefiniton presentationDefinition =
- // getPresentationDefinition(targetId);
- // INavigationNodeProvider provider =
- // presentationDefinition.getProvider();
- // targetNode = provider.provide();
- //
- // INavigationNode parentNode = createNode(sourceNode,
- // presentationDefinition.getParent());
- // parentNode.addChild(targetNode);
- // }
-
- // TODO: ... und dann diese Dummy nodes entfernen:
if (targetNode == null) {
- INavigationNodeProvider nodeProvider = new INavigationNodeProvider() {
- public INavigationNode<?> buildNode() {
- INavigationNode node = new ModuleGroupNode("New Group");
- IModuleNode module = new ModuleNode("New Module");
- node.addChild(module);
- ISubModuleNode messageBoxSubModule = new SubModuleNode("New SubModule 1");
- module.addChild(messageBoxSubModule);
- ISubModuleNode messageMarkerSubModule = new SubModuleNode("New SubModule 2");
- module.addChild(messageMarkerSubModule);
- return node;
- }
- };
- // add to app1
- INavigationNode parentNode = sourceNode.getParentOfType(IApplicationModel.class).getChild(0);
-
- targetNode = nodeProvider.buildNode();
- parentNode.addChild(targetNode);
+ INavigationNodePresentationDefiniton presentationDefinition = getPresentationDefinition(targetId);
+ if (presentationDefinition != null) {
+ INavigationNodeProvider builder = presentationDefinition.createNodeProvider();
+ targetNode = builder.buildNode(targetId);
+
+ INavigationNode parentNode = createNode(sourceNode, presentationDefinition.getParentPresentationId());
+ parentNode.addChild(targetNode);
+ } else {
+ // TODO throw some new type of failure
+ }
}
return targetNode;