Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2013-05-24 09:35:04 -0400
committerTom Schindl2013-05-24 09:35:04 -0400
commitf5e93f1c605a35d527079df0bd0d45713e946fc2 (patch)
treed90059886129edea9c88f082f58898e5e082cb8b /demos/org.eclipse.fx.demo.osgi.di/src
parent353c8c0a1e8f2571628b530f29481c79a06a521b (diff)
downloadorg.eclipse.efxclipse-f5e93f1c605a35d527079df0bd0d45713e946fc2.tar.gz
org.eclipse.efxclipse-f5e93f1c605a35d527079df0bd0d45713e946fc2.tar.xz
org.eclipse.efxclipse-f5e93f1c605a35d527079df0bd0d45713e946fc2.zip
initial check in
Diffstat (limited to 'demos/org.eclipse.fx.demo.osgi.di/src')
-rwxr-xr-xdemos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/Activator.java30
-rwxr-xr-xdemos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/ExampleGraph.fxgraph15
-rw-r--r--demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/ExampleGraph.fxml18
-rwxr-xr-xdemos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/FXController.java29
-rwxr-xr-xdemos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/FXSubController.java29
-rwxr-xr-xdemos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/MainApplication.java35
-rwxr-xr-xdemos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/PrintService.java5
-rwxr-xr-xdemos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/PrintServiceImpl.java8
-rwxr-xr-xdemos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/SubGraph.fxgraph14
-rwxr-xr-xdemos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/SubGraph.fxml15
10 files changed, 198 insertions, 0 deletions
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/Activator.java b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/Activator.java
new file mode 100755
index 000000000..b75cf2ffd
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/Activator.java
@@ -0,0 +1,30 @@
+package org.eclipse.fx.demo.osgi.di;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private static BundleContext context;
+
+ static BundleContext getContext() {
+ return context;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext bundleContext) throws Exception {
+ Activator.context = bundleContext;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext bundleContext) throws Exception {
+ Activator.context = null;
+ }
+
+}
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/ExampleGraph.fxgraph b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/ExampleGraph.fxgraph
new file mode 100755
index 000000000..c0329dbb7
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/ExampleGraph.fxgraph
@@ -0,0 +1,15 @@
+package org.eclipse.fx.demo.osgi.di
+
+import javafx.scene.layout.BorderPane
+import javafx.scene.control.Button
+import org.eclipse.fx.demo.osgi.di.FXController
+
+component ExampleGraph controlledby FXController {
+ BorderPane {
+ center: Button id button {
+ text : "Hello World!",
+ onAction : controllermethod sayHello
+ },
+ bottom : include org.eclipse.fx.demo.osgi.di.SubGraph
+ }
+}
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/ExampleGraph.fxml b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/ExampleGraph.fxml
new file mode 100644
index 000000000..75859b4c1
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/ExampleGraph.fxml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Do not edit this file it is generated by e(fx)clipse from ../src/org/eclipse/fx/demo/osgi/di/ExampleGraph.fxgraph
+-->
+
+<?import java.lang.*?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.layout.BorderPane?>
+
+<BorderPane xmlns:fx="http://javafx.com/fxml" fx:controller="org.eclipse.fx.demo.osgi.di.FXController">
+
+ <center>
+ <Button fx:id="button" text="Hello World!" onAction="#sayHello"/>
+ </center>
+ <bottom>
+ <fx:include source="/org/eclipse/fx/demo/osgi/di/SubGraph.fxml" />
+ </bottom>
+</BorderPane>
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/FXController.java b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/FXController.java
new file mode 100755
index 000000000..de739ca83
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/FXController.java
@@ -0,0 +1,29 @@
+package org.eclipse.fx.demo.osgi.di;
+
+import javafx.fxml.FXML;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
+
+@SuppressWarnings("restriction")
+public class FXController {
+ @Inject
+ private PrintService service;
+
+ @PostConstruct
+ void created(IEclipseContext context) {
+ System.err.println("Parent post construction");
+ }
+
+ @FXML
+ void initialize() {
+ System.err.println("Parent controller");
+ }
+
+ @FXML
+ void sayHello() {
+ service.pring("Hello World!");
+ }
+}
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/FXSubController.java b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/FXSubController.java
new file mode 100755
index 000000000..f205ebe22
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/FXSubController.java
@@ -0,0 +1,29 @@
+package org.eclipse.fx.demo.osgi.di;
+
+import javafx.fxml.FXML;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.e4.core.contexts.IEclipseContext;
+
+@SuppressWarnings("restriction")
+public class FXSubController {
+ @Inject
+ private PrintService service;
+
+ @PostConstruct
+ void created(IEclipseContext context) {
+ System.err.println("Subcontroller post construction");
+ }
+
+ @FXML
+ void initialize() {
+ System.err.println("Subcontroller controller");
+ }
+
+ @FXML
+ void sayHello() {
+ service.pring("Subcontroller - Hello World!");
+ }
+}
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/MainApplication.java b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/MainApplication.java
new file mode 100755
index 000000000..46636ed6e
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/MainApplication.java
@@ -0,0 +1,35 @@
+package org.eclipse.fx.demo.osgi.di;
+
+import java.io.IOException;
+
+import javafx.scene.Scene;
+import javafx.scene.layout.BorderPane;
+import javafx.stage.Stage;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+
+import org.eclipse.equinox.app.IApplicationContext;
+import org.eclipse.fx.ui.di.FXMLBuilder;
+import org.eclipse.fx.ui.di.FXMLLoader;
+import org.eclipse.fx.ui.di.FXMLLoaderFactory;
+
+public class MainApplication {
+ @Inject
+ @FXMLLoader
+ FXMLLoaderFactory loaderFactory;
+
+ @PostConstruct
+ void run(IApplicationContext applicationContext, javafx.application.Application jfxApplication, Stage primaryStage) {
+ FXMLBuilder<BorderPane> loader = loaderFactory.loadRequestorRelative("ExampleGraph.fxml");
+ try {
+ BorderPane pane = loader.load();
+ Scene s = new Scene(pane, 200, 200);
+ primaryStage.setScene(s);
+ primaryStage.show();
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/PrintService.java b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/PrintService.java
new file mode 100755
index 000000000..956295478
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/PrintService.java
@@ -0,0 +1,5 @@
+package org.eclipse.fx.demo.osgi.di;
+
+public interface PrintService {
+ public void pring(String message);
+}
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/PrintServiceImpl.java b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/PrintServiceImpl.java
new file mode 100755
index 000000000..6b2a65ae8
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/PrintServiceImpl.java
@@ -0,0 +1,8 @@
+package org.eclipse.fx.demo.osgi.di;
+
+public class PrintServiceImpl implements PrintService {
+ @Override
+ public void pring(String message) {
+ System.err.println(message);
+ }
+}
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/SubGraph.fxgraph b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/SubGraph.fxgraph
new file mode 100755
index 000000000..9abd5d808
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/SubGraph.fxgraph
@@ -0,0 +1,14 @@
+package org.eclipse.fx.demo.osgi.di
+
+import javafx.scene.layout.BorderPane
+import javafx.scene.control.Button
+import org.eclipse.fx.demo.osgi.di.FXSubController
+
+component SubGraph controlledby FXSubController {
+ BorderPane {
+ center : Button id subbutton {
+ text : "Sub Button",
+ onAction : controllermethod sayHello
+ }
+ }
+}
diff --git a/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/SubGraph.fxml b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/SubGraph.fxml
new file mode 100755
index 000000000..1e156019b
--- /dev/null
+++ b/demos/org.eclipse.fx.demo.osgi.di/src/org/eclipse/fx/demo/osgi/di/SubGraph.fxml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Do not edit this file it is generated by e(fx)clipse from ../src/org/eclipse/fx/demo/osgi/di/SubGraph.fxgraph
+-->
+
+<?import java.lang.*?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.layout.BorderPane?>
+
+<BorderPane xmlns:fx="http://javafx.com/fxml" fx:controller="org.eclipse.fx.demo.osgi.di.FXSubController">
+
+ <center>
+ <Button fx:id="subbutton" text="Sub Button" onAction="#sayHello"/>
+ </center>
+</BorderPane>

Back to the top