summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-08-07 04:57:21 (EDT)
committerCarsten Drossel2008-08-07 04:57:21 (EDT)
commit9ef53d1f7f8aa7ca60ae58680aa21bd0e9231fc4 (patch)
tree1a0f83cd453af3c8a8d49aa6cf6b1c3f60995528
parent18cae310beb9dd1798547a7b2ddd81e47c7e742c (diff)
downloadorg.eclipse.riena-9ef53d1f7f8aa7ca60ae58680aa21bd0e9231fc4.zip
org.eclipse.riena-9ef53d1f7f8aa7ca60ae58680aa21bd0e9231fc4.tar.gz
org.eclipse.riena-9ef53d1f7f8aa7ca60ae58680aa21bd0e9231fc4.tar.bz2
applying patch for bugzilla entry 243324 - refactoring navigation node creation API, introduce NavigationArgument
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNode.java15
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationProcessor.java4
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationProviderService.java6
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/NavigationArgument.java97
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNode.java14
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java20
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderService.java19
7 files changed, 130 insertions, 45 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 82cb421..6a0e7a6 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
@@ -410,21 +410,12 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* Refers to an extension point describing the target node.
* @see INavigationNodeBuilder
*/
- void navigate(INavigationNodeId targetId, Object argument);
-
- /**
- * Creates the specified navigation node (if it does not already exist) and
- * navigates to it.
- *
- * @param targetId
- * @param argument
- * @param argumentListener
- * @see INavigationNodeBuilder
- */
- void navigate(INavigationNodeId targetId, Object argument, INavigationArgumentListener argumentListener);
+ void navigate(INavigationNodeId targetId, NavigationArgument argument);
/**
* Navigates back to the caller of a navigation.
*/
void navigateBack();
+
+ void setPresentationId(INavigationNodeId id);
}
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 6b8329f..191e404 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
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.riena.navigation;
+
/**
* Manages the Navigation. Is called by a navigation node to navigate to it The
* navigation processor works with the INavigationNode What does the navigation
@@ -25,8 +26,7 @@ public interface INavigationProcessor extends INavigationHistory, INavigationHis
void create(INavigationNode<?> sourceNode, INavigationNodeId targetId);
- void navigate(INavigationNode<?> sourceNode, INavigationNodeId targetId, Object argument,
- INavigationArgumentListener argumentListener);
+ void navigate(INavigationNode<?> sourceNode, INavigationNodeId targetId, NavigationArgument argument);
/**
* Navigates to the caller (the source node) of the given targetNode.
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationProviderService.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationProviderService.java
index 25701c1..b4c6ecd 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationProviderService.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationProviderService.java
@@ -28,11 +28,11 @@ public interface IPresentationProviderService {
*
* @param sourceNode
* @param targetId
+ * @param argument
* @return
*/
-
- INavigationNode<?> provideNode(INavigationNode<?> sourceNode, INavigationNodeId targetId, Object argument,
- INavigationArgumentListener argumentListener);
+ INavigationNode<?> provideNode(INavigationNode<?> sourceNode, INavigationNodeId targetId,
+ NavigationArgument argument);
/**
* Return an instance of a view
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/NavigationArgument.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/NavigationArgument.java
new file mode 100644
index 0000000..b136f6d
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/NavigationArgument.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * 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;
+
+
+/**
+ * Class is a container for all additional navigation arguments.
+ */
+public class NavigationArgument {
+ private Object argument;
+ private String parentNodeId;
+ private INavigationArgumentListener argumentListener;
+
+ /**
+ * @param argument
+ * @param argumentListener
+ * @param parentNodeId
+ */
+ public NavigationArgument(Object argument, INavigationArgumentListener argumentListener, String parentNodeId) {
+ super();
+ this.argument = argument;
+ this.argumentListener = argumentListener;
+ this.parentNodeId = parentNodeId;
+ }
+
+ /**
+ * @param argument
+ */
+ public NavigationArgument(Object argument) {
+ super();
+ this.argument = argument;
+ }
+
+ /**
+ * @param argument
+ * @param argumentListener
+ */
+ public NavigationArgument(Object argument, INavigationArgumentListener argumentListener) {
+ super();
+ this.argument = argument;
+ this.argumentListener = argumentListener;
+ }
+
+ /**
+ * @return the externalParameter
+ */
+ public Object getExternalParameter() {
+ return argument;
+ }
+
+ /**
+ * @param externalParameter
+ * the externalParameter to set
+ */
+ public void setExternalParameter(Object externalParameter) {
+ this.argument = externalParameter;
+ }
+
+ /**
+ * @return the parentNodeId
+ */
+ public String getParentNodeId() {
+ return parentNodeId;
+ }
+
+ /**
+ * @param parentNodeId
+ * the parentNodeId to set
+ */
+ public void setParentNode(String parentNodeId) {
+ this.parentNodeId = parentNodeId;
+ }
+
+ /**
+ * @return the argumentListener
+ */
+ public INavigationArgumentListener getArgumentListener() {
+ return argumentListener;
+ }
+
+ /**
+ * @param argumentListener
+ * the argumentListener to set
+ */
+ public void setArgumentListener(INavigationArgumentListener argumentListener) {
+ this.argumentListener = argumentListener;
+ }
+
+}
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 fe1da72..2c252ee 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
@@ -24,13 +24,13 @@ import org.eclipse.riena.core.marker.IMarkable;
import org.eclipse.riena.core.marker.IMarker;
import org.eclipse.riena.core.marker.Markable;
import org.eclipse.riena.navigation.IAction;
-import org.eclipse.riena.navigation.INavigationArgumentListener;
import org.eclipse.riena.navigation.INavigationContext;
import org.eclipse.riena.navigation.INavigationNode;
import org.eclipse.riena.navigation.INavigationNodeId;
import org.eclipse.riena.navigation.INavigationProcessor;
import org.eclipse.riena.navigation.IPresentation;
import org.eclipse.riena.navigation.ISimpleNavigationNodeListener;
+import org.eclipse.riena.navigation.NavigationArgument;
import org.eclipse.riena.navigation.common.TypecastingObject;
import org.eclipse.riena.navigation.listener.INavigationNodeListener;
import org.eclipse.riena.navigation.listener.INavigationNodeListenerable;
@@ -903,19 +903,11 @@ public abstract class NavigationNode<S extends INavigationNode<C>, C extends INa
/**
* @see org.eclipse.riena.navigation.INavigationNode#navigate(org.eclipse.riena.navigation.INavigationNodeId,
- * java.lang.Object)
- */
- public void navigate(INavigationNodeId targetId, Object argument) {
- navigate(targetId, argument, null);
- }
-
- /**
- * @see org.eclipse.riena.navigation.INavigationNode#navigate(org.eclipse.riena.navigation.INavigationNodeId,
* java.lang.Object,
* org.eclipse.riena.navigation.INavigationArgumentListener)
*/
- public void navigate(INavigationNodeId targetId, Object argument, INavigationArgumentListener argumentListener) {
- getNavigationProcessor().navigate(this, targetId, argument, argumentListener);
+ public void navigate(INavigationNodeId targetId, NavigationArgument argument) {
+ getNavigationProcessor().navigate(this, targetId, argument);
}
/**
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 0221a3a..dd8ee4a 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
@@ -22,7 +22,6 @@ import java.util.Stack;
import java.util.Vector;
import org.eclipse.riena.navigation.IModuleNode;
-import org.eclipse.riena.navigation.INavigationArgumentListener;
import org.eclipse.riena.navigation.INavigationContext;
import org.eclipse.riena.navigation.INavigationHistory;
import org.eclipse.riena.navigation.INavigationHistoryEvent;
@@ -32,6 +31,7 @@ import org.eclipse.riena.navigation.INavigationNodeId;
import org.eclipse.riena.navigation.INavigationProcessor;
import org.eclipse.riena.navigation.IPresentationProviderService;
import org.eclipse.riena.navigation.ISubModuleNode;
+import org.eclipse.riena.navigation.NavigationArgument;
/**
* Default implementation for the navigation processor
@@ -175,7 +175,7 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
* org.eclipse.riena.navigation.INavigationNodeId)
*/
public void create(INavigationNode<?> sourceNode, INavigationNodeId targetId) {
- provideNode(sourceNode, targetId, null, null);
+ provideNode(sourceNode, targetId, null);
}
/**
@@ -183,17 +183,17 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
* org.eclipse.riena.navigation.INavigationNodeId, java.lang.Object,
* org.eclipse.riena.navigation.INavigationArgumentListener)
*/
- public void navigate(INavigationNode<?> sourceNode, INavigationNodeId targetId, Object argument,
- INavigationArgumentListener argumentListener) {
- INavigationNode<?> targetNode = provideNode(sourceNode, targetId, argument, argumentListener);
+ public void navigate(INavigationNode<?> sourceNode, INavigationNodeId targetId, NavigationArgument argument) {
+ INavigationNode<?> targetNode = provideNode(sourceNode, targetId, argument);
+ if (targetNode == null)
+ return;
navigationMap.put(targetNode, sourceNode);
targetNode.activate();
}
- private INavigationNode<?> provideNode(INavigationNode<?> sourceNode, INavigationNodeId targetId, Object argument,
- INavigationArgumentListener argumentListener) {
- INavigationNode<?> targetNode = getPresentationDefinitionService().provideNode(sourceNode, targetId, argument,
- argumentListener);
+ private INavigationNode<?> provideNode(INavigationNode<?> sourceNode, INavigationNodeId targetId,
+ NavigationArgument argument) {
+ INavigationNode<?> targetNode = getPresentationDefinitionService().provideNode(sourceNode, targetId, argument);
return targetNode;
}
@@ -805,7 +805,7 @@ public class NavigationProcessor implements INavigationProcessor, INavigationHis
return;
}
}
- navigate(targetNode, sourceNode.getPresentationId(), null, null);
+ navigate(targetNode, sourceNode.getPresentationId(), null);
}
/*
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderService.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderService.java
index 61933a0..bade155 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderService.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderService.java
@@ -14,7 +14,6 @@ import org.eclipse.equinox.log.Logger;
import org.eclipse.riena.core.injector.Inject;
import org.eclipse.riena.internal.navigation.Activator;
import org.eclipse.riena.navigation.ApplicationModelFailure;
-import org.eclipse.riena.navigation.INavigationArgumentListener;
import org.eclipse.riena.navigation.INavigationNode;
import org.eclipse.riena.navigation.INavigationNodeBuilder;
import org.eclipse.riena.navigation.INavigationNodeId;
@@ -22,6 +21,7 @@ import org.eclipse.riena.navigation.INavigationNodePresentationDefiniton;
import org.eclipse.riena.navigation.IPresentationDefinition;
import org.eclipse.riena.navigation.IPresentationProviderService;
import org.eclipse.riena.navigation.IWorkAreaPresentationDefinition;
+import org.eclipse.riena.navigation.NavigationArgument;
import org.eclipse.riena.ui.ridgets.viewcontroller.IViewController;
import org.osgi.service.log.LogService;
@@ -65,12 +65,12 @@ public class PresentationProviderService implements IPresentationProviderService
/**
* @see org.eclipse.riena.navigation.IPresentationProviderService#createNode(org.eclipse.riena.navigation.INavigationNode,
- * org.eclipse.riena.navigation.INavigationNodeId, java.lang.Object,
- * org.eclipse.riena.navigation.INavigationArgumentListener)
+ * org.eclipse.riena.navigation.INavigationNodeId,
+ * org.eclipse.riena.navigation.NavigationArgument)
*/
@SuppressWarnings("unchecked")
- public INavigationNode<?> provideNode(INavigationNode<?> sourceNode, INavigationNodeId targetId, Object argument,
- INavigationArgumentListener argumentListener) {
+ public INavigationNode<?> provideNode(INavigationNode<?> sourceNode, INavigationNodeId targetId,
+ NavigationArgument argument) {
INavigationNode<?> targetNode = findNode(getRootNode(sourceNode), targetId);
if (targetNode == null) {
if (LOGGER.isLoggable(LogService.LOG_DEBUG))
@@ -80,8 +80,13 @@ public class PresentationProviderService implements IPresentationProviderService
INavigationNodeBuilder builder = presentationDefinition.createNodeBuilder();
prepareNavigationNodeBuilder(targetId, builder);
targetNode = builder.buildNode(targetId);
- INavigationNode parentNode = provideNode(sourceNode, new NavigationNodeId(presentationDefinition
- .getParentPresentationId()), null, null);
+ INavigationNode parentNode = null;
+ if (argument != null && argument.getParentNodeId() != null) {
+ parentNode = provideNode(sourceNode, new NavigationNodeId(argument.getParentNodeId()), null);
+ } else {
+ parentNode = provideNode(sourceNode, new NavigationNodeId(presentationDefinition
+ .getParentPresentationId()), null);
+ }
parentNode.addChild(targetNode);
} else {
// TODO throw some new type of failure