summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Drossel2008-07-11 07:56:49 (EDT)
committerCarsten Drossel2008-07-11 07:56:49 (EDT)
commit29ec6659ea20f99507d6f8bced22a706696bb1bf (patch)
tree00557caf2b39aca9e3390d6bf355515fa0c1a97c
parent10cd6d1fe010e0dbf0852ecf69229f46d2ca2634 (diff)
downloadorg.eclipse.riena-29ec6659ea20f99507d6f8bced22a706696bb1bf.zip
org.eclipse.riena-29ec6659ea20f99507d6f8bced22a706696bb1bf.tar.gz
org.eclipse.riena-29ec6659ea20f99507d6f8bced22a706696bb1bf.tar.bz2
added SWT navigate example
-rw-r--r--org.eclipse.riena.example.client/plugin.xml23
-rw-r--r--org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/application/SwtExampleApplication.java17
-rw-r--r--org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/controllers/NavigateSubModuleViewController.java47
-rw-r--r--org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open2NavigationNodeBuilder.java46
-rw-r--r--org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open3NavigationNodeBuilder.java52
-rw-r--r--org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/views/NavigateSubModuleView.java61
-rw-r--r--org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleNodeView.java6
7 files changed, 249 insertions, 3 deletions
diff --git a/org.eclipse.riena.example.client/plugin.xml b/org.eclipse.riena.example.client/plugin.xml
index 075086d..ae1ec1d 100644
--- a/org.eclipse.riena.example.client/plugin.xml
+++ b/org.eclipse.riena.example.client/plugin.xml
@@ -105,6 +105,12 @@
id="org.eclipse.riena.example.client.views.NavigationSubModuleView"
name="org.eclipse.riena.example.client.views.NavigationSubModuleView">
</view>
+ <view
+ allowMultiple="true"
+ class="org.eclipse.riena.example.client.views.NavigateSubModuleView"
+ id="org.eclipse.riena.example.client.views.NavigateSubModuleView"
+ name="org.eclipse.riena.example.client.views.NavigateSubModuleView">
+ </view>
</extension>
<extension
point="org.eclipse.ui.actionSets">
@@ -254,4 +260,21 @@
</handler>
</extension>
+ <extension
+ point="org.eclipse.riena.navigation.NavigationNodePresentation">
+ <navigationNodePresentation
+ presentationId="open2"
+ nodeProvider="org.eclipse.riena.example.client.navigation.model.Open2NavigationNodeBuilder"
+ parentPresentationId="app1">
+ </navigationNodePresentation>
+ </extension>
+ <extension
+ point="org.eclipse.riena.navigation.NavigationNodePresentation">
+ <navigationNodePresentation
+ presentationId="open3"
+ nodeProvider="org.eclipse.riena.example.client.navigation.model.Open3NavigationNodeBuilder"
+ parentPresentationId="playground">
+ </navigationNodePresentation>
+ </extension>
+
</plugin>
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 34954d2..74c6b44 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
@@ -15,6 +15,7 @@ import org.eclipse.riena.example.client.views.ComboView;
import org.eclipse.riena.example.client.views.FocusableView;
import org.eclipse.riena.example.client.views.ListView;
import org.eclipse.riena.example.client.views.MarkerView;
+import org.eclipse.riena.example.client.views.NavigateSubModuleView;
import org.eclipse.riena.example.client.views.NavigationSubModuleView;
import org.eclipse.riena.example.client.views.RidgetsSubModuleView;
import org.eclipse.riena.example.client.views.SharedViewDemoView;
@@ -27,7 +28,6 @@ import org.eclipse.riena.internal.example.client.Activator;
import org.eclipse.riena.navigation.IApplicationModel;
import org.eclipse.riena.navigation.IModuleGroupNode;
import org.eclipse.riena.navigation.IModuleNode;
-import org.eclipse.riena.navigation.ISubApplication;
import org.eclipse.riena.navigation.ISubModuleNode;
import org.eclipse.riena.navigation.model.ApplicationModel;
import org.eclipse.riena.navigation.model.ModuleGroupNode;
@@ -84,7 +84,7 @@ public class SwtExampleApplication extends SwtApplication {
@Override
protected IApplicationModel createModel() {
- ISubApplication subApplication = null;
+ SubApplication subApplication = null;
IModuleGroupNode moduleGroup = null;
IModuleNode module = null;
ISubModuleNode subModule = null;
@@ -95,6 +95,7 @@ public class SwtExampleApplication extends SwtApplication {
applicationModel.setIcon(createIconPath(IExampleIcons.ICON_APPLICATION));
// sub application 1
subApplication = new SubApplication("Navigation");
+ subApplication.setPresentationId("app1");
subApplication.setIcon(createIconPath(IExampleIcons.ICON_APPLICATION));
presentation.present(subApplication, "subapplication.1");
applicationModel.addChild(subApplication);
@@ -145,6 +146,7 @@ public class SwtExampleApplication extends SwtApplication {
// Playground
subApplication = new SubApplication("Playground");
+ subApplication.setPresentationId("playground");
subApplication.setIcon(createIconPath(IExampleIcons.ICON_SAMPLE));
presentation.present(subApplication, "subapplication.2");
applicationModel.addChild(subApplication);
@@ -224,6 +226,17 @@ public class SwtExampleApplication extends SwtApplication {
presentation.present(treeSubModule, TreeView.ID);
playgroundModule.addChild(treeSubModule);
+ // navigate
+ moduleGroup = new ModuleGroupNode("Navigate");
+ moduleGroup.setPresentWithSingleModule(false);
+ subApplication.addChild(moduleGroup);
+ module = new ModuleNode("Navigate");
+ module.setIcon(createIconPath(IExampleIcons.ICON_GREEN_LED));
+ moduleGroup.addChild(module);
+ subModule = new SubModuleNode("Navigate");
+ presentation.present(subModule, NavigateSubModuleView.ID);
+ module.addChild(subModule);
+
return applicationModel;
}
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
new file mode 100644
index 0000000..0a0f7a4
--- /dev/null
+++ b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/controllers/NavigateSubModuleViewController.java
@@ -0,0 +1,47 @@
+/****************************************************************
+ * *
+ * Copyright (c) 2004-2008 compeople AG *
+ * All rights reserved. The use of this program and the *
+ * accompanying materials are subject to license terms. *
+ * *
+ ****************************************************************/
+package org.eclipse.riena.example.client.controllers;
+
+import org.eclipse.riena.navigation.ISubModuleNode;
+import org.eclipse.riena.navigation.ui.controllers.SubModuleNodeViewController;
+import org.eclipse.riena.ui.ridgets.IActionListener;
+import org.eclipse.riena.ui.ridgets.IActionRidget;
+import org.eclipse.riena.ui.ridgets.ITextFieldRidget;
+import org.eclipse.riena.ui.ridgets.uibinding.IInjectAllRidgetsAtOnce;
+
+public class NavigateSubModuleViewController extends SubModuleNodeViewController implements IInjectAllRidgetsAtOnce {
+
+ private ITextFieldRidget target;
+
+ public NavigateSubModuleViewController(ISubModuleNode navigationNode) {
+ super(navigationNode);
+ }
+
+ public void configureRidgets() {
+
+ target = (ITextFieldRidget) getRidget("target");
+
+ IActionRidget navigate = (IActionRidget) getRidget("navigate");
+ navigate.setText("Go");
+ navigate.addListener(new NavigateListener());
+
+ setDefaultButton(navigate);
+ }
+
+ private class NavigateListener implements IActionListener {
+
+ /**
+ * @see org.eclipse.riena.ui.ridgets.IActionListener#callback()
+ */
+ public void callback() {
+ getNavigationNode().navigate(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
new file mode 100644
index 0000000..34e6e0b
--- /dev/null
+++ b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open2NavigationNodeBuilder.java
@@ -0,0 +1,46 @@
+/****************************************************************
+ * *
+ * Copyright (c) 2004-2008 compeople AG *
+ * All rights reserved. The use of this program and the *
+ * accompanying materials are subject to license terms. *
+ * *
+ ****************************************************************/
+package org.eclipse.riena.example.client.navigation.model;
+
+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.INavigationNodeProvider;
+import org.eclipse.riena.navigation.model.ModuleGroupNode;
+import org.eclipse.riena.navigation.model.ModuleNode;
+import org.eclipse.riena.navigation.model.SubModuleNode;
+import org.eclipse.riena.navigation.ui.swt.presentation.SwtPresentationManagerAccessor;
+
+/**
+ *
+ */
+public class Open2NavigationNodeBuilder implements INavigationNodeProvider {
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNodeProvider#buildNode()
+ */
+ public IModuleGroupNode buildNode(String presentationId) {
+ ModuleGroupNode node = new ModuleGroupNode("New Group");
+ node.setPresentationId(presentationId);
+ IModuleNode module = new ModuleNode("New Module");
+ node.addChild(module);
+ SubModuleNode subModule = new SubModuleNode("New SubModule 1");
+ // TODO get presentation via presentationId from extension point
+ // subModule.setPresentationId("child1");
+ SwtPresentationManagerAccessor.getManager().present(subModule, FocusableView.ID);
+ module.addChild(subModule);
+ subModule = new SubModuleNode("New SubModule 2");
+ // TODO get presentation via presentationId from extension point
+ // subModule.setPresentationId("child2");
+ SwtPresentationManagerAccessor.getManager().present(subModule, MarkerView.ID);
+ module.addChild(subModule);
+ return node;
+ }
+
+}
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
new file mode 100644
index 0000000..e96046d
--- /dev/null
+++ b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/navigation/model/Open3NavigationNodeBuilder.java
@@ -0,0 +1,52 @@
+/****************************************************************
+ * *
+ * Copyright (c) 2004-2008 compeople AG *
+ * All rights reserved. The use of this program and the *
+ * accompanying materials are subject to license terms. *
+ * *
+ ****************************************************************/
+package org.eclipse.riena.example.client.navigation.model;
+
+import org.eclipse.riena.example.client.views.FocusableView;
+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.INavigationNodeProvider;
+import org.eclipse.riena.navigation.model.ModuleGroupNode;
+import org.eclipse.riena.navigation.model.ModuleNode;
+import org.eclipse.riena.navigation.model.SubModuleNode;
+import org.eclipse.riena.navigation.ui.swt.presentation.SwtPresentationManagerAccessor;
+
+/**
+ *
+ */
+public class Open3NavigationNodeBuilder implements INavigationNodeProvider {
+
+ /**
+ * @see org.eclipse.riena.navigation.INavigationNodeProvider#buildNode()
+ */
+ public IModuleGroupNode buildNode(String presentationId) {
+ ModuleGroupNode node = new ModuleGroupNode("New Group");
+ node.setPresentationId(presentationId);
+ IModuleNode module = new ModuleNode("New Module");
+ node.addChild(module);
+ SubModuleNode subModule = new SubModuleNode("New SubModule 1");
+ // TODO get presentation via presentationId from extension point
+ // subModule.setPresentationId("child1");
+ SwtPresentationManagerAccessor.getManager().present(subModule, FocusableView.ID);
+ module.addChild(subModule);
+ subModule = new SubModuleNode("New SubModule 2");
+ // TODO get presentation via presentationId from extension point
+ // subModule.setPresentationId("child2");
+ SwtPresentationManagerAccessor.getManager().present(subModule, MarkerView.ID);
+ module.addChild(subModule);
+ subModule = new SubModuleNode("New SubModule 3");
+ // TODO get presentation via presentationId from extension point
+ // subModule.setPresentationId("child3");
+ SwtPresentationManagerAccessor.getManager().present(subModule, TreeView.ID);
+ module.addChild(subModule);
+ return node;
+ }
+
+}
diff --git a/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/views/NavigateSubModuleView.java b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/views/NavigateSubModuleView.java
new file mode 100644
index 0000000..de49da7
--- /dev/null
+++ b/org.eclipse.riena.example.client/src/org/eclipse/riena/example/client/views/NavigateSubModuleView.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * 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.example.client.views;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.riena.example.client.controllers.NavigateSubModuleViewController;
+import org.eclipse.riena.internal.example.client.utils.UIControlsFactory;
+import org.eclipse.riena.navigation.ISubModuleNode;
+import org.eclipse.riena.navigation.ui.swt.binding.DefaultSwtControlRidgetMapper;
+import org.eclipse.riena.navigation.ui.swt.views.SWTBindingPropertyLocator;
+import org.eclipse.riena.navigation.ui.swt.views.SubModuleNodeView;
+import org.eclipse.riena.ui.ridgets.uibinding.IBindingManager;
+import org.eclipse.riena.ui.ridgets.uibinding.InjectAllAtOnceBindingManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * SWT {@link IComboRidget} sample.
+ */
+public class NavigateSubModuleView extends SubModuleNodeView<NavigateSubModuleViewController> {
+
+ public static final String ID = NavigateSubModuleView.class.getName();
+
+ @Override
+ protected void basicCreatePartControl(Composite parent) {
+ parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
+ parent.setLayout(new GridLayout(1, false));
+ GridDataFactory fillFactory = GridDataFactory.fillDefaults();
+
+ UIControlsFactory.createLabel(parent, "&Navigate To:");
+ Text target = UIControlsFactory.createText(parent);
+ fillFactory.applyTo(target);
+ addUIControl(target, "target"); //$NON-NLS-1$
+
+ Button navigate = UIControlsFactory.createButton(parent);
+ fillFactory.applyTo(navigate);
+ addUIControl(navigate, "navigate"); //$NON-NLS-1$
+ }
+
+ @Override
+ protected NavigateSubModuleViewController createController(ISubModuleNode subModuleNode) {
+ return new NavigateSubModuleViewController(subModuleNode);
+ }
+
+ protected IBindingManager createBindingManager() {
+ return new InjectAllAtOnceBindingManager(new SWTBindingPropertyLocator(), new DefaultSwtControlRidgetMapper());
+ }
+
+}
diff --git a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleNodeView.java b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleNodeView.java
index 33e88dd..2128643 100644
--- a/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleNodeView.java
+++ b/org.eclipse.riena.navigation.ui.swt/src/org/eclipse/riena/navigation/ui/swt/views/SubModuleNodeView.java
@@ -44,11 +44,15 @@ public abstract class SubModuleNodeView<C extends SubModuleNodeViewController> e
private IBindingManager bindingManager;
public SubModuleNodeView() {
- bindingManager = new DefaultBindingManager(new SWTBindingPropertyLocator(), new DefaultSwtControlRidgetMapper());
+ bindingManager = createBindingManager();
node2Controler = new HashMap<ISubModuleNode, C>();
uiControls = new ArrayList<Object>();
}
+ protected IBindingManager createBindingManager() {
+ return new DefaultBindingManager(new SWTBindingPropertyLocator(), new DefaultSwtControlRidgetMapper());
+ }
+
/**
* Adds the given control to the list of the controls that will be binded.
*