summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-08-07 11:00:41 (EDT)
committerCarsten Drossel2008-08-07 11:00:41 (EDT)
commit8471d19d2655c134e41b91fdd8a1754050939418 (patch)
tree8b4490f58c618faaa96e8de2c9142e220d7cecce
parent2f29618f2f02784ac49ce87d1c38e1eb2a6d442b (diff)
downloadorg.eclipse.riena-8471d19d2655c134e41b91fdd8a1754050939418.zip
org.eclipse.riena-8471d19d2655c134e41b91fdd8a1754050939418.tar.gz
org.eclipse.riena-8471d19d2655c134e41b91fdd8a1754050939418.tar.bz2
applying patch for bugzilla entry 243404 - refactor IPresentationProviderService API
-rw-r--r--org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java14
-rw-r--r--org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleView.java2
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/IPresentationProviderService.java17
-rw-r--r--org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderService.java54
4 files changed, 26 insertions, 61 deletions
diff --git a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java
index 1d5cb35..c369fde 100644
--- a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java
+++ b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/presentation/SwtPresentationManager.java
@@ -49,15 +49,13 @@ public class SwtPresentationManager {
}
public SwtViewId getSwtViewId(INavigationNode<?> pNode) {
-
SwtViewId swtViewId = views.get(pNode);
-
if (swtViewId == null) {
INavigationNodeId presentationId = pNode.getPresentationId();
if (presentationId != null) {
- String viewId = getPresentationDefinitionService().getViewId(presentationId);
+ String viewId = (String) getPresentationProviderService().provideView(presentationId);
String secondaryId = null;
- if (getPresentationDefinitionService().isViewShared(presentationId)) {
+ if (getPresentationProviderService().isViewShared(presentationId)) {
secondaryId = "shared"; //$NON-NLS-1$
} else {
secondaryId = getNextSecondaryId(viewId);
@@ -178,14 +176,14 @@ public class SwtPresentationManager {
}
}
return null;
-
}
- protected IPresentationProviderService getPresentationDefinitionService() {
-
+ /**
+ * @return
+ */
+ protected IPresentationProviderService getPresentationProviderService() {
// TODO: handling if no service found ???
return PresentationProviderServiceAccessor.current().getPresentationProviderService();
-
}
}
diff --git a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleView.java b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleView.java
index d82ed6c..e682f56 100644
--- a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleView.java
+++ b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleView.java
@@ -142,7 +142,7 @@ public abstract class SubModuleView<C extends SubModuleController> extends ViewP
protected abstract void basicCreatePartControl(Composite parent);
protected C createController(ISubModuleNode pSubModuleNode) {
- C controller = (C) getPresentationDefinitionService().createViewController(pSubModuleNode);
+ C controller = (C) getPresentationDefinitionService().provideController(pSubModuleNode);
controller.setNavigationNode(pSubModuleNode);
return controller;
}
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 b4c6ecd..5bb953e 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
@@ -16,9 +16,6 @@ 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 {
@@ -35,31 +32,27 @@ public interface IPresentationProviderService {
NavigationArgument argument);
/**
- * Return an instance of a view
+ * Return an Object representing a instance of a view. In case of SWT/Riena
+ * it is the String representation of the view (the view id).
*
+ * @return the view id of the matching view
*/
-
- Object createView(INavigationNodeId targetId);
-
- String getViewId(INavigationNodeId targetId);
+ Object provideView(INavigationNodeId targetId);
/**
* Returns the view controller for the work area presentation for the given
* navigationNodeId
*/
-
- IViewController createViewController(INavigationNode<?> node);
+ IViewController provideController(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/model/PresentationProviderService.java b/org.eclipse.riena.navigation/src/org/eclipse/riena/navigation/model/PresentationProviderService.java
index bade155..8714a23 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
@@ -29,9 +29,6 @@ import org.osgi.service.log.LogService;
* This class provides service methods to get information provided by
* WorkAreaPresentationDefinitions and NavigationNodePresentationDefitinios
* identified by a given presentationID.
- *
- *
- *
*/
public class PresentationProviderService implements IPresentationProviderService {
@@ -109,7 +106,7 @@ public class PresentationProviderService implements IPresentationProviderService
* @param targetId
* @return
*/
- private IWorkAreaPresentationDefinition getPresentationDefinitionWA(String targetId) {
+ protected IWorkAreaPresentationDefinition getPresentationDefinitionWA(String targetId) {
if (targetWA == null || targetWA.getData().length == 0) {
return null;
} else {
@@ -127,7 +124,7 @@ public class PresentationProviderService implements IPresentationProviderService
* @param targetId
* @return
*/
- private INavigationNodePresentationDefiniton getPresentationDefinitionNN(INavigationNodeId targetId) {
+ protected INavigationNodePresentationDefiniton getPresentationDefinitionNN(INavigationNodeId targetId) {
if (targetNN == null || targetNN.getData().length == 0 || targetId == null) {
return null;
} else {
@@ -140,7 +137,6 @@ public class PresentationProviderService implements IPresentationProviderService
}
}
return null;
-
}
/**
@@ -175,43 +171,26 @@ public class PresentationProviderService implements IPresentationProviderService
return null;
}
- /*
- * (non-Javadoc)
+ /**
+ * This is the basic SWT implementation from Riena. It returns the matching
+ * view id for the given navigationNodeId
*
* @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;
- }
-
- /**
- * @see org.eclipse.riena.navigation.IPresentationProviderService#getViewId(org.eclipse.riena.navigation.INavigationNodeId)
+ * (org.eclipse.riena.navigation.INavigationNodeId)
*/
- public String getViewId(INavigationNodeId nodeId) {
+ public Object provideView(INavigationNodeId nodeId) {
IWorkAreaPresentationDefinition presentationDefinition = getPresentationDefinitionWA(nodeId.getTypeId());
-
if (presentationDefinition != null) {
return presentationDefinition.getViewId();
} else {
- throw new ApplicationModelFailure("No presentation definition found for node '" + nodeId.getTypeId() + "'.");
+ throw new ApplicationModelFailure("No presentation definition found for node '" + nodeId.getTypeId() + "'."); //$NON-NLS-2$
}
}
- /*
- * (non-Javadoc)
- *
- * @seeorg.eclipse.riena.navigation.IPresentationDefinitionService#
- * createViewController()
+ /**
+ * @see org.eclipse.riena.navigation.IPresentationProviderService#provideController(org.eclipse.riena.navigation.INavigationNode)
*/
- public IViewController createViewController(INavigationNode<?> node) {
+ public IViewController provideController(INavigationNode<?> node) {
IWorkAreaPresentationDefinition presentationDefinition = getPresentationDefinitionWA(node.getPresentationId()
.getTypeId());
IViewController viewController = null;
@@ -223,11 +202,8 @@ public class PresentationProviderService implements IPresentationProviderService
return viewController;
}
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.riena.navigation.IPresentationProviderService#isViewShared ()
+ /**
+ * @see org.eclipse.riena.navigation.IPresentationProviderService#isViewShared(org.eclipse.riena.navigation.INavigationNodeId)
*/
public boolean isViewShared(INavigationNodeId targetId) {
IWorkAreaPresentationDefinition presentationDefinition = getPresentationDefinitionWA(targetId.getTypeId());
@@ -238,9 +214,7 @@ public class PresentationProviderService implements IPresentationProviderService
return false;
}
- /*
- * (non-Javadoc)
- *
+ /**
* @see org.eclipse.riena.navigation.IPresentationProviderService#cleanUp()
*/
public void cleanUp() {