summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-07-09 09:28:41 (EDT)
committerCarsten Drossel2008-07-09 09:28:41 (EDT)
commit560cc9c9ac85556b80c72d087faa9906e26d7b6b (patch)
tree38921cb7ff645035c075fdc89bf358b72929710b
parent3f3690f4029ddd6c17400847ed85df2d61b4d29a (diff)
downloadorg.eclipse.riena-560cc9c9ac85556b80c72d087faa9906e26d7b6b.zip
org.eclipse.riena-560cc9c9ac85556b80c72d087faa9906e26d7b6b.tar.gz
org.eclipse.riena-560cc9c9ac85556b80c72d087faa9906e26d7b6b.tar.bz2
attempt to implement navigate with the NavigationProcessor
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNode.java81
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationFactory.java20
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationProcessor.java2
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/ApplicationModel.java5
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNode.java20
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java52
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java39
7 files changed, 167 insertions, 52 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 1d9c952..e7cffee 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
@@ -58,8 +58,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor to activate the node within an
* INavigationContext.
*
- * @param pContext -
- * the Context to activate within
+ * @param pContext
+ * - the Context to activate within
*/
void activate(INavigationContext pContext);
@@ -67,8 +67,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor before activating the node within an
* INavigationContext.
*
- * @param pContext -
- * the Context to activate within
+ * @param pContext
+ * - the Context to activate within
*/
void onBeforeActivate(INavigationContext pContext);
@@ -76,8 +76,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor after activating the node within an
* INavigationContext.
*
- * @param pContext -
- * the Context to activate within
+ * @param pContext
+ * - the Context to activate within
*/
void onAfterActivate(INavigationContext pContext);
@@ -85,8 +85,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor to dispose the node within an
* INavigationContext.
*
- * @param pContext -
- * the Context to activate within
+ * @param pContext
+ * - the Context to activate within
*/
void dispose(INavigationContext pContext);
@@ -94,8 +94,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor before disposing the node within an
* INavigationContext.
*
- * @param pContext -
- * the Context to activate within
+ * @param pContext
+ * - the Context to activate within
*/
void onBeforeDispose(INavigationContext pContext);
@@ -103,8 +103,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor after disposing the node within an
* INavigationContext.
*
- * @param pContext -
- * the Context to activate within
+ * @param pContext
+ * - the Context to activate within
*/
void onAfterDispose(INavigationContext pContext);
@@ -112,8 +112,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor to deactivate the node within an
* INavigationContext.
*
- * @param pContext -
- * the Context to deactivate within
+ * @param pContext
+ * - the Context to deactivate within
*/
void deactivate(INavigationContext pContext);
@@ -121,8 +121,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor before deactivating the node within an
* INavigationContext.
*
- * @param pContext -
- * the Context to activate within
+ * @param pContext
+ * - the Context to activate within
*/
void onBeforeDeactivate(INavigationContext pContext);
@@ -130,8 +130,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor after deactivating the node within an
* INavigationContext.
*
- * @param pContext -
- * the Context to activate within
+ * @param pContext
+ * - the Context to activate within
*/
void onAfterDeactivate(INavigationContext pContext);
@@ -139,8 +139,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor to check if a node can be activated
* within an INavigationContext.
*
- * @param pContext -
- * the Context to check within
+ * @param pContext
+ * - the Context to check within
*/
boolean allowsActivate(INavigationContext pContext);
@@ -148,8 +148,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor to check if a node can be deactivated
* within an INavigationContext.
*
- * @param pContext -
- * the Context to check within
+ * @param pContext
+ * - the Context to check within
*/
boolean allowsDeactivate(INavigationContext pContext);
@@ -157,8 +157,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called by a NavigationProcessor to check if a node can be disposed within
* an INavigationContext.
*
- * @param pContext -
- * the Context to check within
+ * @param pContext
+ * - the Context to check within
*/
boolean allowsDispose(INavigationContext pContext);
@@ -166,10 +166,10 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Called from the navigation processor to remove a node during dispose
* Removes the passed node from the list child nodes
*
- * @param pChild -
- * the child node to remove
- * @param context -
- * the navigation context to word in
+ * @param pChild
+ * - the child node to remove
+ * @param context
+ * - the navigation context to word in
*/
void removeChild(INavigationContext context, INavigationNode<?> pChild);
@@ -181,21 +181,21 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
/**
* Adds the passed child to the list of child nodes
*
- * @param pChild -
- * the child node to add
+ * @param pChild
+ * - the child node to add
*/
void addChild(C pChild);
/**
- * @param pIndex -
- * index of the child
+ * @param pIndex
+ * - index of the child
* @return the child at the specified index or null
*/
C getChild(int pIndex);
/**
- * @param pChild -
- * the child to find
+ * @param pChild
+ * - the child to find
* @return the index of the child starting at 0 or -1 if the passed child is
* not a child of the node addressed
*/
@@ -276,16 +276,16 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Adds an action to the node. Actions can be associated with nodes to
* automatically show and hide actions corresponding to the activated node
*
- * @param pAction -
- * the action to add
+ * @param pAction
+ * - the action to add
*/
void addAction(IAction pAction);
/**
* Remove an action from the node
*
- * @param pAction -
- * the action to remove
+ * @param pAction
+ * - the action to remove
*/
void removeAction(IAction pAction);
@@ -362,4 +362,9 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* @return true if input is blocked, false otherwise
*/
boolean isBlocked();
+
+ String getPresentationId();
+
+ void navigate(String targetId);
+
}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationFactory.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationFactory.java
new file mode 100644
index 0000000..ee52ab6
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationFactory.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.navigation;
+
+/**
+ *
+ */
+public interface INavigationNodePresentationFactory {
+
+ INavigationNode<?> createNode(INavigationNode<?> sourceNode, String targetId);
+
+}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationProcessor.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationProcessor.java
index 7b0c6ea..dc24747 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationProcessor.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationProcessor.java
@@ -23,4 +23,6 @@ public interface INavigationProcessor {
void dispose(INavigationNode<?> toDispose);
+ void navigate(INavigationNode<?> sourceNode, String targetId);
+
}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/ApplicationModel.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/ApplicationModel.java
index 1e11dda..6751c17 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/ApplicationModel.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/ApplicationModel.java
@@ -17,7 +17,8 @@ import org.eclipse.riena.navigation.ISubApplication;
/**
* Default implementation for the ApplicationModel
*/
-public class ApplicationModel extends NavigationNode<IApplicationModel, ISubApplication, IApplicationModelListener> implements IApplicationModel {
+public class ApplicationModel extends NavigationNode<IApplicationModel, ISubApplication, IApplicationModelListener>
+ implements IApplicationModel {
/**
*
@@ -53,6 +54,6 @@ public class ApplicationModel extends NavigationNode<IApplicationModel, ISubAppl
}
protected void initializeNavigationProcessor() {
- setNavigationProcessor(new NavigationProcessor());
+ setNavigationProcessor(new NavigationProcessor(new NavigationNodePresentationFactory()));
}
}
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 5d61a30..c9f26b9 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
@@ -642,8 +642,8 @@ public abstract class NavigationNode<S extends INavigationNode<C>, C extends INa
}
/**
- * @param selected -
- * the selected to set
+ * @param selected
+ * - the selected to set
*/
public void setSelected(boolean selected) {
if (selected != this.selected) {
@@ -774,4 +774,20 @@ public abstract class NavigationNode<S extends INavigationNode<C>, C extends INa
return getParent().getParentOfType(clazz);
}
}
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNode#navigate(java.lang.String)
+ */
+ public void navigate(String targetId) {
+ getNavigationProcessor().navigate(this, targetId);
+ }
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNode#getPresentationId()
+ */
+ public String getPresentationId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
}
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
new file mode 100644
index 0000000..f970d2f
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 compeople AG and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * compeople AG - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.riena.navigation.model;
+
+import org.eclipse.riena.navigation.IModulePresentationDefiniton;
+import org.eclipse.riena.navigation.INavigationNode;
+import org.eclipse.riena.navigation.INavigationNodePresentationFactory;
+import org.eclipse.riena.navigation.INodeProvider;
+
+/**
+ *
+ */
+public class NavigationNodePresentationFactory implements INavigationNodePresentationFactory {
+
+ public INavigationNode<?> createNode(INavigationNode<?> sourceNode, String targetId) {
+
+ INavigationNode targetNode = findNode(sourceNode, targetId);
+
+ if (targetNode == null) {
+ IModulePresentationDefiniton presentationDefinition = getPresentationDefinition(targetId);
+ INodeProvider provider = presentationDefinition.getProvider();
+ targetNode = provider.provide();
+
+ INavigationNode parentNode = createNode(sourceNode, presentationDefinition.getParent());
+ parentNode.addChild(targetNode);
+ }
+
+ return targetNode;
+ }
+
+ private IModulePresentationDefiniton getPresentationDefinition(String targetId) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private INavigationNode<?> findNode(INavigationNode<?> sourceNode, String targetId) {
+
+ // search the tree that contains the sourceNode for a node with
+ // the presentationId targetId...
+
+ return null;
+ }
+
+}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java
index fa45837..7e8254c 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java
@@ -19,6 +19,7 @@ import java.util.List;
import org.eclipse.riena.navigation.IModuleNode;
import org.eclipse.riena.navigation.INavigationContext;
import org.eclipse.riena.navigation.INavigationNode;
+import org.eclipse.riena.navigation.INavigationNodePresentationFactory;
import org.eclipse.riena.navigation.INavigationProcessor;
import org.eclipse.riena.navigation.ISubModuleNode;
@@ -27,6 +28,13 @@ import org.eclipse.riena.navigation.ISubModuleNode;
*/
public class NavigationProcessor implements INavigationProcessor {
+ private INavigationNodePresentationFactory navigationNodePresentationFactory;
+
+ public NavigationProcessor(INavigationNodePresentationFactory navigationNodePresentationFactory) {
+ super();
+ this.navigationNodePresentationFactory = navigationNodePresentationFactory;
+ }
+
/**
* @see org.eclipse.riena.navigation.INavigationProcessor#activate(org.eclipse.riena.navigation.INavigationNode)
*/
@@ -102,6 +110,17 @@ public class NavigationProcessor implements INavigationProcessor {
}
/**
+ * @see org.eclipse.riena.navigation.INavigationProcessor#navigate(org.eclipse
+ * .riena.navigation.INavigationNode, java.lang.String)
+ */
+ public void navigate(INavigationNode<?> sourceNode, String targetId) {
+
+ INavigationNode<?> targetNode = navigationNodePresentationFactory.createNode(sourceNode, targetId);
+
+ targetNode.activate();
+ }
+
+ /**
* Ascertain the correct node to dispose. If e.g. the first module in a
* Group is disposed, than the whole group has to be disposed
*
@@ -147,8 +166,8 @@ public class NavigationProcessor implements INavigationProcessor {
* Find a node or list of nodes which have to activated when a specified
* node is disposed
*
- * @param toDispose -
- * the node to dispose
+ * @param toDispose
+ * - the node to dispose
* @return return a list of nodes
*/
private List<INavigationNode<?>> getNodesToActivateOnDispose(INavigationNode<?> toDispose) {
@@ -184,8 +203,8 @@ public class NavigationProcessor implements INavigationProcessor {
/**
* Finds all the nodes to activate
*
- * @param toActivate -
- * the node do activate
+ * @param toActivate
+ * - the node do activate
* @return a List of all nodes to activate
*/
private List<INavigationNode<?>> getNodesToActivateOnActivation(INavigationNode<?> toActivate) {
@@ -423,8 +442,8 @@ public class NavigationProcessor implements INavigationProcessor {
/**
* The navigation processor decides which child to activate even initially
*
- * @param pNode -
- * the node who's child is searched
+ * @param pNode
+ * - the node who's child is searched
*/
private INavigationNode<?> getChildToActivate(INavigationNode<?> pNode) {
// for sub module is always null
@@ -540,10 +559,10 @@ public class NavigationProcessor implements INavigationProcessor {
* this navigation processor allows only one selected child, so it resets
* the flag in all children before marking the one
*
- * @param parent -
- * the parent to reset in
- * @param child -
- * the child to set as selected
+ * @param parent
+ * - the parent to reset in
+ * @param child
+ * - the child to set as selected
*/
private void setSelectedChild(INavigationNode<?> parent, INavigationNode<?> child) {
for (INavigationNode<?> next : parent.getChildren()) {