summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-07-28 05:59:21 (EDT)
committerCarsten Drossel2008-07-28 05:59:21 (EDT)
commit891e261db8e542927ffefb19011ec3a85a61e65b (patch)
tree97f8306faef8344d1339a61408b1a2bb22d14d6e
parent49f475c612850ccd361aa346bb82b2b6260beccb (diff)
downloadorg.eclipse.riena-891e261db8e542927ffefb19011ec3a85a61e65b.zip
org.eclipse.riena-891e261db8e542927ffefb19011ec3a85a61e65b.tar.gz
org.eclipse.riena-891e261db8e542927ffefb19011ec3a85a61e65b.tar.bz2
extended navigation concept - merging results from branch
-rw-r--r--org.eclipse.riena.navigation/META-INF/MANIFEST.MF5
-rw-r--r--org.eclipse.riena.navigation/plugin.xml7
-rw-r--r--org.eclipse.riena.navigation/schema/org.eclipse.riena.navigation.NavigationNodePresentation.exsd116
-rw-r--r--org.eclipse.riena.navigation/schema/org.eclipse.riena.navigation.WorkAreaPresentation.exsd126
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/internal/navigation/Activator.java17
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationArgumentListener.java20
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNode.java45
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeBuilder.java23
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeId.java22
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationDefiniton.java32
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationProcessor.java5
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationDefinition.java25
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationProviderService.java62
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IWorkAreaPresentationDefinition.java42
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/ApplicationModel.java4
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNode.java47
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodeId.java84
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java58
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationExtensionInjectionHelper.java28
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderService.java204
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderServiceAccessor.java60
21 files changed, 1019 insertions, 13 deletions
diff --git a/org.eclipse.riena.navigation/META-INF/MANIFEST.MF b/org.eclipse.riena.navigation/META-INF/MANIFEST.MF
index 22ba29e..6f5dccb 100644
--- a/org.eclipse.riena.navigation/META-INF/MANIFEST.MF
+++ b/org.eclipse.riena.navigation/META-INF/MANIFEST.MF
@@ -1,11 +1,12 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Model Plug-in
-Bundle-SymbolicName: org.eclipse.riena.navigation
+Bundle-SymbolicName: org.eclipse.riena.navigation;singleton:=true
Bundle-Version: 1.0.0.M4
Bundle-Activator: org.eclipse.riena.internal.navigation.Activator
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.riena.core
+ org.eclipse.riena.core,
+ org.eclipse.riena.ui.ridgets;bundle-version="1.0.0"
Eclipse-LazyStart: true
Export-Package: org.eclipse.riena.navigation,
org.eclipse.riena.navigation.common,
diff --git a/org.eclipse.riena.navigation/plugin.xml b/org.eclipse.riena.navigation/plugin.xml
new file mode 100644
index 0000000..827f304
--- /dev/null
+++ b/org.eclipse.riena.navigation/plugin.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="org.eclipse.riena.navigation.NavigationNodePresentation" name="NavigationNodePresentation" schema="schema/org.eclipse.riena.navigation.NavigationNodePresentation.exsd"/>
+ <extension-point id="org.eclipse.riena.navigation.WorkAreaPresentation" name="WorkAreaPresentation" schema="schema/org.eclipse.riena.navigation.WorkAreaPresentation.exsd"/>
+
+</plugin>
diff --git a/org.eclipse.riena.navigation/schema/org.eclipse.riena.navigation.NavigationNodePresentation.exsd b/org.eclipse.riena.navigation/schema/org.eclipse.riena.navigation.NavigationNodePresentation.exsd
new file mode 100644
index 0000000..cc4e51a
--- /dev/null
+++ b/org.eclipse.riena.navigation/schema/org.eclipse.riena.navigation.NavigationNodePresentation.exsd
@@ -0,0 +1,116 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.riena.navigation" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.riena.navigation" id="org.eclipse.riena.navigation.NavigationNodePresentation" name="NavigationNodePresentation"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="navigationNodePresentation" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="navigationNodePresentation">
+ <complexType>
+ <attribute name="presentationId" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="nodeProvider" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.riena.navigation.INavigationNodeProvider"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="parentPresentationId" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiInfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.riena.navigation/schema/org.eclipse.riena.navigation.WorkAreaPresentation.exsd b/org.eclipse.riena.navigation/schema/org.eclipse.riena.navigation.WorkAreaPresentation.exsd
new file mode 100644
index 0000000..c32f81c
--- /dev/null
+++ b/org.eclipse.riena.navigation/schema/org.eclipse.riena.navigation.WorkAreaPresentation.exsd
@@ -0,0 +1,126 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.riena.navigation" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.riena.navigation" id="org.eclipse.riena.navigation.WorkAreaPresentation" name="WorkAreaPresentation"/>
+ </appinfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="workAreaPresentation" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="workAreaPresentation">
+ <complexType>
+ <attribute name="presentationId" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="viewShared" type="boolean">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="viewController" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.riena.ui.ridgets.viewcontroller.IViewController"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="view" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="java.lang.Object:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/internal/navigation/Activator.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/internal/navigation/Activator.java
index f56a04e..0ce7557 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/internal/navigation/Activator.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/internal/navigation/Activator.java
@@ -10,8 +10,14 @@
*******************************************************************************/
package org.eclipse.riena.internal.navigation;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
import org.eclipse.riena.core.RienaPlugin;
+import org.eclipse.riena.navigation.IPresentationProviderService;
+import org.eclipse.riena.navigation.model.PresentationProviderService;
import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
/**
* The activator class controls the plug-in life cycle
@@ -23,6 +29,7 @@ public class Activator extends RienaPlugin {
// The shared instance
private static Activator plugin;
+ private IPresentationProviderService service = null;
/**
* The constructor
@@ -39,6 +46,12 @@ public class Activator extends RienaPlugin {
public void start(BundleContext context) throws Exception {
super.start(context);
Activator.plugin = this;
+
+ service = new PresentationProviderService();
+ Dictionary<String, Object> dict = new Hashtable<String, Object>();
+ dict.put(Constants.SERVICE_RANKING, Integer.valueOf(-100));
+
+ context.registerService(IPresentationProviderService.class.getName(), service, dict);
}
/*
@@ -49,6 +62,10 @@ public class Activator extends RienaPlugin {
*/
public void stop(BundleContext context) throws Exception {
Activator.plugin = null;
+ if (service != null) {
+ service.cleanUp();
+ service = null;
+ }
super.stop(context);
}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationArgumentListener.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationArgumentListener.java
new file mode 100644
index 0000000..526319a
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationArgumentListener.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 INavigationArgumentListener {
+
+ void valueChanged(Object argument);
+
+}
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 683c1ea..de72e19 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
@@ -367,4 +367,49 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
* @return true if input is blocked, false otherwise
*/
boolean isBlocked();
+
+ INavigationNodeId getPresentationId();
+
+ /**
+ * Creates the specified navigation node and adds it to the application
+ * model it does not already exist.
+ *
+ * @param targetId
+ * Refers to an extension point describing the target node.
+ * @see INavigationNodeBuilder
+ */
+ void create(INavigationNodeId targetId);
+
+ /**
+ * Creates the specified navigation node (if it does not already exist) and
+ * navigates to it.
+ *
+ * @param targetId
+ * Refers to an extension point describing the target node.
+ * @see INavigationNodeBuilder
+ */
+ void navigate(INavigationNodeId targetId);
+
+ /**
+ * Creates the specified navigation node (if it does not already exist) and
+ * navigates to it.
+ *
+ * @param targetId
+ * @param argument
+ * 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);
+
}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeBuilder.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeBuilder.java
new file mode 100644
index 0000000..8661f0f
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeBuilder.java
@@ -0,0 +1,23 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * Implementations of this interface are responsible for creating application
+ * specific modules (or module trees).
+ *
+ * @author Erich Achilles
+ */
+public interface INavigationNodeBuilder {
+
+ INavigationNode<?> buildNode(INavigationNodeId INavigationNodeId);
+
+}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeId.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeId.java
new file mode 100644
index 0000000..a98477c
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodeId.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * Returns the identifier of a node in the navigation model.
+ */
+public interface INavigationNodeId {
+
+ String getTypeId();
+
+ String getInstanceId();
+
+}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationDefiniton.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationDefiniton.java
new file mode 100644
index 0000000..41a55bd
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationDefiniton.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * A modulePresentationDefinition defines the navigationModule to be activated.
+ *
+ * @author Erich Achilles
+ */
+public interface INavigationNodePresentationDefiniton extends IPresentationDefinition {
+
+ /**
+ * Returns the ModuleComposer for this module presentation
+ */
+
+ INavigationNodeBuilder createNodeBuilder();
+
+ /**
+ * The id of this presentations parent presentation
+ */
+
+ String getParentPresentationId();
+
+}
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..559fdbc 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,9 @@ public interface INavigationProcessor {
void dispose(INavigationNode<?> toDispose);
+ void create(INavigationNode<?> sourceNode, INavigationNodeId targetId);
+
+ void navigate(INavigationNode<?> sourceNode, INavigationNodeId targetId, Object argument,
+ INavigationArgumentListener argumentListener);
+
}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationDefinition.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationDefinition.java
new file mode 100644
index 0000000..b4f6ac6
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationDefinition.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * 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;
+
+/**
+ * Base interface for presentation definitions, carries the ID
+ *
+ * @author Erich Achilles
+ */
+public interface IPresentationDefinition {
+
+ /**
+ * The id of this presentation
+ */
+
+ String getPresentationId();
+}
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
new file mode 100644
index 0000000..d08ce0e
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationProviderService.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.riena.ui.ridgets.viewcontroller.IViewController;
+
+/**
+ * Implementation of this service interface provides service methods to get
+ * information provided by WorkAreaPresentationDefinitions and
+ * NavigationNodePresentationDefitinios identified by a given presentationID.
+ *
+ *
+ *
+ */
+public interface IPresentationProviderService {
+
+ /**
+ * Returns a navigationNode identified by the given navigationNodeId
+ *
+ * @param sourceNode
+ * @param targetId
+ * @return
+ */
+
+ INavigationNode<?> createNode(INavigationNode<?> sourceNode, INavigationNodeId targetId, Object argument,
+ INavigationArgumentListener argumentListener);
+
+ /**
+ * Return an instance of a view
+ *
+ */
+
+ Object createView(INavigationNodeId targetId);
+
+ /**
+ * Returns the view controller for the work area presentation for the given
+ * navigationNodeId
+ */
+
+ IViewController createViewController(INavigationNode node);
+
+ /**
+ * Return true if the specified view should be a shared view, false
+ * otherwise
+ */
+
+ boolean isViewShared(INavigationNodeId targetId);
+
+ /**
+ * Perform some housekeeping
+ */
+ void cleanUp();
+
+}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IWorkAreaPresentationDefinition.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IWorkAreaPresentationDefinition.java
new file mode 100644
index 0000000..4d655d5
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IWorkAreaPresentationDefinition.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * 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;
+
+import org.eclipse.riena.ui.ridgets.viewcontroller.IViewController;
+
+/**
+ * A WorkAreaPresentationDefinition defines the work area to be activated.
+ *
+ * @author Erich Achilles
+ */
+public interface IWorkAreaPresentationDefinition extends IPresentationDefinition {
+
+ /**
+ * Returns the view controller for this work area presentation
+ */
+
+ IViewController createViewController();
+
+ /**
+ * Return true if the specified view should be a shared view, false
+ * otherwise
+ */
+
+ boolean isViewShared();
+
+ /**
+ * Return an instance of a view
+ *
+ */
+
+ Object createView();
+
+}
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..74a9f5f 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 {
/**
*
@@ -55,4 +56,5 @@ public class ApplicationModel extends NavigationNode<IApplicationModel, ISubAppl
protected void initializeNavigationProcessor() {
setNavigationProcessor(new NavigationProcessor());
}
+
}
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 7746e8e..4fb3cb7 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
@@ -21,8 +21,10 @@ 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.INavigationNodeListener;
import org.eclipse.riena.navigation.INavigationNodeListenerable;
import org.eclipse.riena.navigation.INavigationProcessor;
@@ -43,6 +45,7 @@ import org.eclipse.riena.navigation.common.TypecastingObject;
public abstract class NavigationNode<S extends INavigationNode<C>, C extends INavigationNode<?>, L extends INavigationNodeListener<S, C>>
extends TypecastingObject implements INavigationNode<C>, INavigationNodeListenerable<S, C, L> {
+ private INavigationNodeId presentationId;
private State state;
private String label;
private String icon;
@@ -848,4 +851,48 @@ public abstract class NavigationNode<S extends INavigationNode<C>, C extends INa
return getParent().getParentOfType(clazz);
}
}
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNode#create(org.eclipse.riena.navigation.INavigationNodeId)
+ */
+ public void create(INavigationNodeId targetId) {
+ getNavigationProcessor().create(this, targetId);
+ }
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNode#navigate(org.eclipse.riena.navigation.INavigationNodeId)
+ */
+ public void navigate(INavigationNodeId targetId) {
+ navigate(targetId, null);
+ }
+
+ /**
+ * @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);
+ }
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNode#getPresentationId()
+ */
+ public INavigationNodeId getPresentationId() {
+ return presentationId;
+ }
+
+ public void setPresentationId(INavigationNodeId presentationId) {
+ // TODO set via constructor, remove setter
+ this.presentationId = presentationId;
+ }
+
}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodeId.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodeId.java
new file mode 100644
index 0000000..a338c78
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodeId.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * 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.INavigationNodeId;
+
+/**
+ *
+ */
+public class NavigationNodeId implements INavigationNodeId {
+
+ private String instanceId;
+ private String typeId;
+
+ public NavigationNodeId(String typeId, String instanceId) {
+ this.typeId = typeId;
+ this.instanceId = instanceId;
+ }
+
+ public NavigationNodeId(String typeId) {
+ this(typeId, null);
+ }
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNodeId#getTypeId()
+ */
+ public String getTypeId() {
+ return typeId;
+ }
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNodeId#getInstanceId()
+ */
+ public String getInstanceId() {
+ return instanceId;
+ }
+
+ /**
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ @Override
+ public boolean equals(Object other) {
+ if (other instanceof INavigationNodeId) {
+ INavigationNodeId otherId = (INavigationNodeId) other;
+ return equals(typeId, ((INavigationNodeId) other).getTypeId())
+ && equals(instanceId, otherId.getInstanceId());
+ }
+ return false;
+ }
+
+ public String toString() {
+ StringBuilder sb = new StringBuilder(typeId);
+ if (instanceId != null) {
+ sb.append("[");
+ sb.append(instanceId);
+ sb.append("]");
+ }
+ return sb.toString();
+ }
+
+ /**
+ * @see java.lang.Object#hashCode()
+ */
+ @Override
+ public int hashCode() {
+ if (typeId != null) {
+ return typeId.hashCode();
+ }
+ return 0;
+ }
+
+ private boolean equals(String string1, String string2) {
+ return (string1 == null && string2 == null) || (string1 != null && string1.equals(string2));
+ }
+
+}
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..f16b599 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
@@ -17,9 +17,12 @@ import java.util.LinkedList;
import java.util.List;
import org.eclipse.riena.navigation.IModuleNode;
+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.IPresentationProviderService;
import org.eclipse.riena.navigation.ISubModuleNode;
/**
@@ -102,6 +105,41 @@ public class NavigationProcessor implements INavigationProcessor {
}
/**
+ * @see org.eclipse.riena.navigation.INavigationProcessor#create(org.eclipse.riena.navigation.INavigationNode,
+ * org.eclipse.riena.navigation.INavigationNodeId)
+ */
+ public void create(INavigationNode<?> sourceNode, INavigationNodeId targetId) {
+ createTarget(sourceNode, targetId, null, null);
+ }
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationProcessor#navigate(org.eclipse.riena.navigation.INavigationNode,
+ * 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 = createTarget(sourceNode, targetId, argument, argumentListener);
+
+ targetNode.activate();
+ }
+
+ private INavigationNode<?> createTarget(INavigationNode<?> sourceNode, INavigationNodeId targetId, Object argument,
+ INavigationArgumentListener argumentListener) {
+ INavigationNode<?> targetNode = getPresentationDefinitionService().createNode(sourceNode, targetId, argument,
+ argumentListener);
+ return targetNode;
+ }
+
+ protected IPresentationProviderService getPresentationDefinitionService() {
+
+ // TODO: handling if no service found ???
+ return PresentationProviderServiceAccessor.current().getPresentationProviderService();
+
+ }
+
+ /**
* 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 +185,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 +222,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 +461,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 +578,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()) {
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationExtensionInjectionHelper.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationExtensionInjectionHelper.java
new file mode 100644
index 0000000..fbb639e
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationExtensionInjectionHelper.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * 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.IPresentationDefinition;
+
+public class PresentationExtensionInjectionHelper<E extends IPresentationDefinition> {
+
+ private E[] data;
+
+ public void update(E[] data) {
+ this.data = data;
+
+ }
+
+ public E[] getData() {
+ return data;
+ }
+
+}
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
new file mode 100644
index 0000000..d406f4c
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderService.java
@@ -0,0 +1,204 @@
+/*******************************************************************************
+ * 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.core.injector.Inject;
+import org.eclipse.riena.internal.navigation.Activator;
+import org.eclipse.riena.navigation.INavigationArgumentListener;
+import org.eclipse.riena.navigation.INavigationNode;
+import org.eclipse.riena.navigation.INavigationNodeId;
+import org.eclipse.riena.navigation.INavigationNodePresentationDefiniton;
+import org.eclipse.riena.navigation.INavigationNodeBuilder;
+import org.eclipse.riena.navigation.IPresentationDefinition;
+import org.eclipse.riena.navigation.IPresentationProviderService;
+import org.eclipse.riena.navigation.IWorkAreaPresentationDefinition;
+import org.eclipse.riena.ui.ridgets.viewcontroller.IViewController;
+
+/**
+ * This class provides service methods to get information provided by
+ * WorkAreaPresentationDefinitions and NavigationNodePresentationDefitinios
+ * identified by a given presentationID.
+ *
+ *
+ *
+ */
+public class PresentationProviderService implements IPresentationProviderService {
+
+ // TODO: split off ... problem: navigation is gui-less ...
+
+ private static final String EP_WORKAREA = "org.eclipse.riena.navigation.WorkAreaPresentation";
+ private static final String EP_NAVNODE = "org.eclipse.riena.navigation.NavigationNodePresentation";
+ private PresentationExtensionInjectionHelper<IWorkAreaPresentationDefinition> targetWA;
+ private PresentationExtensionInjectionHelper<INavigationNodePresentationDefiniton> targetNN;
+
+ /**
+ * Injects the extension point into a given target. The target returns a set
+ * of presentation definitions
+ */
+ private void inject(Class<? extends IPresentationDefinition> interfaceType, String wpID,
+ PresentationExtensionInjectionHelper<? extends IPresentationDefinition> target) {
+ Inject.extension(wpID).useType(interfaceType).into(target).andStart(Activator.getDefault().getContext());
+ }
+
+ public PresentationProviderService() {
+
+ targetWA = new PresentationExtensionInjectionHelper<IWorkAreaPresentationDefinition>();
+ inject(IWorkAreaPresentationDefinition.class, EP_WORKAREA, targetWA);
+ targetNN = new PresentationExtensionInjectionHelper<INavigationNodePresentationDefiniton>();
+ inject(INavigationNodePresentationDefiniton.class, EP_NAVNODE, targetNN);
+
+ }
+
+ /**
+ * @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)
+ */
+ public INavigationNode<?> createNode(INavigationNode<?> sourceNode, INavigationNodeId targetId, Object argument,
+ INavigationArgumentListener argumentListener) {
+ INavigationNode<?> targetNode = findNode(getRootNode(sourceNode), targetId);
+
+ if (targetNode == null) {
+ INavigationNodePresentationDefiniton presentationDefinition = getPresentationDefinitionNN(targetId);
+ if (presentationDefinition != null) {
+ INavigationNodeBuilder builder = presentationDefinition.createNodeBuilder();
+ targetNode = builder.buildNode(targetId);
+
+ INavigationNode parentNode = createNode(sourceNode, new NavigationNodeId(presentationDefinition
+ .getParentPresentationId()), null, null);
+ parentNode.addChild(targetNode);
+ } else {
+ // TODO throw some new type of failure
+ }
+ }
+
+ return targetNode;
+ }
+
+ private IWorkAreaPresentationDefinition getPresentationDefinitionWA(String targetId) {
+
+ if (targetWA == null || targetWA.getData().length == 0) {
+ return null;
+ } else {
+ IWorkAreaPresentationDefinition[] data = targetWA.getData();
+ for (int i = 0; i < data.length; i++) {
+ if (data[i].getPresentationId() != null && data[i].getPresentationId().equals(targetId)) {
+ return data[i];
+ }
+
+ }
+ }
+ return null;
+
+ }
+
+ private INavigationNodePresentationDefiniton getPresentationDefinitionNN(INavigationNodeId targetId) {
+
+ if (targetNN == null || targetNN.getData().length == 0 || targetId == null) {
+ return null;
+ } else {
+ INavigationNodePresentationDefiniton[] data = targetNN.getData();
+ for (int i = 0; i < data.length; i++) {
+ if (data[i].getPresentationId() != null && data[i].getPresentationId().equals(targetId.getTypeId())) {
+ return data[i];
+ }
+
+ }
+ }
+ return null;
+
+ }
+
+ protected INavigationNode<?> getRootNode(INavigationNode<?> node) {
+ if (node.getParent() == null) {
+ return node;
+ }
+ return getRootNode(node.getParent());
+ }
+
+ protected INavigationNode<?> findNode(INavigationNode<?> node, INavigationNodeId targetId) {
+
+ if (targetId == null) {
+ return null;
+ }
+ if (targetId.equals(node.getPresentationId())) {
+ return node;
+ }
+ for (INavigationNode<?> child : node.getChildren()) {
+ INavigationNode<?> foundNode = findNode(child, targetId);
+ if (foundNode != null) {
+ return foundNode;
+ }
+ }
+ return null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.navigation.IPresentationProviderService#createView
+ * (org.eclipse.riena.navigation.INavigationNodeId)
+ */
+ public Object createView(INavigationNodeId targetId) {
+ IWorkAreaPresentationDefinition presentationDefinition = getPresentationDefinitionWA(targetId.getTypeId());
+ Object view = null;
+
+ if (presentationDefinition != null) {
+ view = presentationDefinition.createView();
+ }
+
+ return view;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @seeorg.eclipse.riena.navigation.IPresentationDefinitionService#
+ * createViewController()
+ */
+ public IViewController createViewController(INavigationNode node) {
+ IWorkAreaPresentationDefinition presentationDefinition = getPresentationDefinitionWA(node.getPresentationId()
+ .getTypeId());
+ IViewController viewController = null;
+
+ if (presentationDefinition != null) {
+ viewController = presentationDefinition.createViewController();
+ }
+
+ return viewController;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.riena.navigation.IPresentationProviderService#isViewShared ()
+ */
+ public boolean isViewShared(INavigationNodeId targetId) {
+ IWorkAreaPresentationDefinition presentationDefinition = getPresentationDefinitionWA(targetId.getTypeId());
+
+ if (presentationDefinition != null) {
+ return presentationDefinition.isViewShared();
+ }
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.riena.navigation.IPresentationProviderService#cleanUp()
+ */
+ public void cleanUp() {
+ // TODO: implement, does noething special yet
+
+ }
+
+}
diff --git a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderServiceAccessor.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderServiceAccessor.java
new file mode 100644
index 0000000..4b5834b
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderServiceAccessor.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * 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.core.injector.Inject;
+import org.eclipse.riena.internal.navigation.Activator;
+import org.eclipse.riena.navigation.IPresentationProviderService;
+
+/**
+ *
+ */
+public class PresentationProviderServiceAccessor {
+ private static PresentationProviderServiceAccessor psa = null;
+ private IPresentationProviderService service = null;
+
+ /**
+ * Default Constructor
+ */
+ private PresentationProviderServiceAccessor() {
+ Inject.service(IPresentationProviderService.class.getName()).useRanking().into(this).andStart(
+ Activator.getDefault().getContext());
+
+ }
+
+ static public PresentationProviderServiceAccessor current() {
+ if (psa == null)
+ return initPresentationServiceAccessor();
+ return psa;
+ }
+
+ static private PresentationProviderServiceAccessor initPresentationServiceAccessor() {
+ psa = new PresentationProviderServiceAccessor();
+
+ return psa;
+ }
+
+ public IPresentationProviderService getPresentationProviderService() {
+
+ return service;
+
+ }
+
+ public void bind(IPresentationProviderService s) {
+ service = s;
+ }
+
+ public void unbind(IPresentationProviderService dep) {
+ service.cleanUp();
+ service = null;
+ }
+
+}