summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-07-15 10:59:07 (EDT)
committerCarsten Drossel2008-07-15 10:59:07 (EDT)
commit2c6c7d2b3c1e4a201252131f6f3d6fb6ce1d8294 (patch)
tree4604b29d94a70a1a52c11854c1d2b495704bd56c
parent5ee06b6716a9a5d28434022b7f54edd9dbb694a6 (diff)
downloadorg.eclipse.riena-2c6c7d2b3c1e4a201252131f6f3d6fb6ce1d8294.zip
org.eclipse.riena-2c6c7d2b3c1e4a201252131f6f3d6fb6ce1d8294.tar.gz
org.eclipse.riena-2c6c7d2b3c1e4a201252131f6f3d6fb6ce1d8294.tar.bz2
using INavigationNodeId object instead of String for presentationId
-rw-r--r--org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/application/SwtExampleApplication.java5
-rw-r--r--org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/controllers/NavigateSubModuleViewController.java3
-rw-r--r--org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open2NavigationNodeBuilder.java3
-rw-r--r--org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open3NavigationNodeBuilder.java3
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNode.java4
-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/INavigationNodePresentationFactory.java4
-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/INavigationProcessor.java2
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNode.java9
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodeId.java74
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java14
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationProcessor.java7
13 files changed, 126 insertions, 26 deletions
diff --git a/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/application/SwtExampleApplication.java b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/application/SwtExampleApplication.java
index 74c6b44..daaf2d3 100644
--- a/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/application/SwtExampleApplication.java
+++ b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/application/SwtExampleApplication.java
@@ -32,6 +32,7 @@ import org.eclipse.riena.navigation.ISubModuleNode;
import org.eclipse.riena.navigation.model.ApplicationModel;
import org.eclipse.riena.navigation.model.ModuleGroupNode;
import org.eclipse.riena.navigation.model.ModuleNode;
+import org.eclipse.riena.navigation.model.NavigationNodeId;
import org.eclipse.riena.navigation.model.SubApplication;
import org.eclipse.riena.navigation.model.SubModuleNode;
import org.eclipse.riena.navigation.ui.controllers.ApplicationViewController;
@@ -95,7 +96,7 @@ public class SwtExampleApplication extends SwtApplication {
applicationModel.setIcon(createIconPath(IExampleIcons.ICON_APPLICATION));
// sub application 1
subApplication = new SubApplication("Navigation");
- subApplication.setPresentationId("app1");
+ subApplication.setPresentationId(new NavigationNodeId("app1"));
subApplication.setIcon(createIconPath(IExampleIcons.ICON_APPLICATION));
presentation.present(subApplication, "subapplication.1");
applicationModel.addChild(subApplication);
@@ -146,7 +147,7 @@ public class SwtExampleApplication extends SwtApplication {
// Playground
subApplication = new SubApplication("Playground");
- subApplication.setPresentationId("playground");
+ subApplication.setPresentationId(new NavigationNodeId("playground"));
subApplication.setIcon(createIconPath(IExampleIcons.ICON_SAMPLE));
presentation.present(subApplication, "subapplication.2");
applicationModel.addChild(subApplication);
diff --git a/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/controllers/NavigateSubModuleViewController.java b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/controllers/NavigateSubModuleViewController.java
index 0a0f7a4..819eb94 100644
--- a/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/controllers/NavigateSubModuleViewController.java
+++ b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/controllers/NavigateSubModuleViewController.java
@@ -8,6 +8,7 @@
package org.eclipse.riena.example.client.controllers;
import org.eclipse.riena.navigation.ISubModuleNode;
+import org.eclipse.riena.navigation.model.NavigationNodeId;
import org.eclipse.riena.navigation.ui.controllers.SubModuleNodeViewController;
import org.eclipse.riena.ui.ridgets.IActionListener;
import org.eclipse.riena.ui.ridgets.IActionRidget;
@@ -39,7 +40,7 @@ public class NavigateSubModuleViewController extends SubModuleNodeViewController
* @see org.eclipse.riena.ui.ridgets.IActionListener#callback()
*/
public void callback() {
- getNavigationNode().navigate(target.getText());
+ getNavigationNode().navigate(new NavigationNodeId(target.getText()));
}
}
diff --git a/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open2NavigationNodeBuilder.java b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open2NavigationNodeBuilder.java
index 34e6e0b..06b5458 100644
--- a/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open2NavigationNodeBuilder.java
+++ b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open2NavigationNodeBuilder.java
@@ -11,6 +11,7 @@ import org.eclipse.riena.example.client.views.FocusableView;
import org.eclipse.riena.example.client.views.MarkerView;
import org.eclipse.riena.navigation.IModuleGroupNode;
import org.eclipse.riena.navigation.IModuleNode;
+import org.eclipse.riena.navigation.INavigationNodeId;
import org.eclipse.riena.navigation.INavigationNodeProvider;
import org.eclipse.riena.navigation.model.ModuleGroupNode;
import org.eclipse.riena.navigation.model.ModuleNode;
@@ -25,7 +26,7 @@ public class Open2NavigationNodeBuilder implements INavigationNodeProvider {
/**
* @see org.eclipse.riena.navigation.INavigationNodeProvider#buildNode()
*/
- public IModuleGroupNode buildNode(String presentationId) {
+ public IModuleGroupNode buildNode(INavigationNodeId presentationId) {
ModuleGroupNode node = new ModuleGroupNode("New Group");
node.setPresentationId(presentationId);
IModuleNode module = new ModuleNode("New Module");
diff --git a/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open3NavigationNodeBuilder.java b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open3NavigationNodeBuilder.java
index e96046d..b0732af 100644
--- a/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open3NavigationNodeBuilder.java
+++ b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open3NavigationNodeBuilder.java
@@ -12,6 +12,7 @@ import org.eclipse.riena.example.client.views.MarkerView;
import org.eclipse.riena.example.client.views.TreeView;
import org.eclipse.riena.navigation.IModuleGroupNode;
import org.eclipse.riena.navigation.IModuleNode;
+import org.eclipse.riena.navigation.INavigationNodeId;
import org.eclipse.riena.navigation.INavigationNodeProvider;
import org.eclipse.riena.navigation.model.ModuleGroupNode;
import org.eclipse.riena.navigation.model.ModuleNode;
@@ -26,7 +27,7 @@ public class Open3NavigationNodeBuilder implements INavigationNodeProvider {
/**
* @see org.eclipse.riena.navigation.INavigationNodeProvider#buildNode()
*/
- public IModuleGroupNode buildNode(String presentationId) {
+ public IModuleGroupNode buildNode(INavigationNodeId presentationId) {
ModuleGroupNode node = new ModuleGroupNode("New Group");
node.setPresentationId(presentationId);
IModuleNode module = new ModuleNode("New Module");
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 e7cffee..15df296 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
@@ -363,8 +363,8 @@ public interface INavigationNode<C extends INavigationNode<?>> extends ITypecast
*/
boolean isBlocked();
- String getPresentationId();
+ INavigationNodeId getPresentationId();
- void navigate(String targetId);
+ void navigate(INavigationNodeId targetId);
}
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/INavigationNodePresentationFactory.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationFactory.java
index d79338d..73c4639 100644
--- a/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationFactory.java
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/INavigationNodePresentationFactory.java
@@ -15,8 +15,8 @@ package org.eclipse.riena.navigation;
*/
public interface INavigationNodePresentationFactory {
- INavigationNode<?> createNode(INavigationNode<?> sourceNode, String targetId);
+ INavigationNode<?> createNode(INavigationNode<?> sourceNode, INavigationNodeId targetId);
- INavigationNodePresentationDefiniton getPresentationDefinition(String targetId);
+ INavigationNodePresentationDefiniton getPresentationDefinition(INavigationNodeId targetId);
}
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 0aa197b..c59ca3f 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(String presentationId);
+ INavigationNode<?> buildNode(INavigationNodeId INavigationNodeId);
}
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 dc24747..2207446 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,6 +23,6 @@ public interface INavigationProcessor {
void dispose(INavigationNode<?> toDispose);
- void navigate(INavigationNode<?> sourceNode, String targetId);
+ void navigate(INavigationNode<?> sourceNode, INavigationNodeId targetId);
}
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 cd194ff..35a4b2b 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
@@ -23,6 +23,7 @@ import org.eclipse.riena.core.marker.Markable;
import org.eclipse.riena.navigation.IAction;
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,7 +44,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 String presentationId;
+ private INavigationNodeId presentationId;
private State state;
private String label;
private String icon;
@@ -779,18 +780,18 @@ public abstract class NavigationNode<S extends INavigationNode<C>, C extends INa
/**
* @see org.eclipse.riena.navigation.INavigationNode#navigate(java.lang.String)
*/
- public void navigate(String targetId) {
+ public void navigate(INavigationNodeId targetId) {
getNavigationProcessor().navigate(this, targetId);
}
/**
* @see org.eclipse.riena.navigation.INavigationNode#getPresentationId()
*/
- public String getPresentationId() {
+ public INavigationNodeId getPresentationId() {
return presentationId;
}
- public void setPresentationId(String 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..76fa69a
--- /dev/null
+++ b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodeId.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * 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;
+ }
+
+ /**
+ * @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/NavigationNodePresentationFactory.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/NavigationNodePresentationFactory.java
index e5996f2..22e71a4 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
@@ -13,6 +13,7 @@ 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.INavigationNode;
+import org.eclipse.riena.navigation.INavigationNodeId;
import org.eclipse.riena.navigation.INavigationNodePresentationDefiniton;
import org.eclipse.riena.navigation.INavigationNodePresentationFactory;
import org.eclipse.riena.navigation.INavigationNodeProvider;
@@ -33,7 +34,7 @@ public class NavigationNodePresentationFactory implements INavigationNodePresent
Inject.extension(ID).into(target).andStart(Activator.getDefault().getContext());
}
- public INavigationNode<?> createNode(INavigationNode<?> sourceNode, String targetId) {
+ public INavigationNode<?> createNode(INavigationNode<?> sourceNode, INavigationNodeId targetId) {
INavigationNode<?> targetNode = findNode(getRootNode(sourceNode), targetId);
if (targetNode == null) {
@@ -42,7 +43,8 @@ public class NavigationNodePresentationFactory implements INavigationNodePresent
INavigationNodeProvider builder = presentationDefinition.createNodeProvider();
targetNode = builder.buildNode(targetId);
- INavigationNode parentNode = createNode(sourceNode, presentationDefinition.getParentPresentationId());
+ INavigationNode parentNode = createNode(sourceNode, new NavigationNodeId(presentationDefinition
+ .getParentPresentationId()));
parentNode.addChild(targetNode);
} else {
// TODO throw some new type of failure
@@ -52,14 +54,14 @@ public class NavigationNodePresentationFactory implements INavigationNodePresent
return targetNode;
}
- public INavigationNodePresentationDefiniton getPresentationDefinition(String targetId) {
+ public INavigationNodePresentationDefiniton getPresentationDefinition(INavigationNodeId targetId) {
- if (target == null || target.getData().length == 0) {
+ if (target == null || target.getData().length == 0 || targetId == null) {
return null;
} else {
INavigationNodePresentationDefiniton[] data = target.getData();
for (int i = 0; i < data.length; i++) {
- if (data[i].getPresentationId() != null && data[i].getPresentationId().equals(targetId)) {
+ if (data[i].getPresentationId() != null && data[i].getPresentationId().equals(targetId.getTypeId())) {
return data[i];
}
@@ -76,7 +78,7 @@ public class NavigationNodePresentationFactory implements INavigationNodePresent
return getRootNode(node.getParent());
}
- private INavigationNode<?> findNode(INavigationNode<?> node, String targetId) {
+ private INavigationNode<?> findNode(INavigationNode<?> node, INavigationNodeId targetId) {
if (targetId == null) {
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 7e8254c..327c05d 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.INavigationNodeId;
import org.eclipse.riena.navigation.INavigationNodePresentationFactory;
import org.eclipse.riena.navigation.INavigationProcessor;
import org.eclipse.riena.navigation.ISubModuleNode;
@@ -109,11 +110,7 @@ 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) {
+ public void navigate(INavigationNode<?> sourceNode, INavigationNodeId targetId) {
INavigationNode<?> targetNode = navigationNodePresentationFactory.createNode(sourceNode, targetId);