diff options
author | Tom Schindl | 2013-05-23 21:29:43 +0000 |
---|---|---|
committer | Tom Schindl | 2013-05-23 21:29:43 +0000 |
commit | a6cd03a13440b4e455b0f1245b3eb05d74c0e0e0 (patch) | |
tree | 7062c78a00340df5b8db063ca694919174400377 /demos | |
parent | cf2b7f224f3f117584c7d7a7923b06a2f3e910b3 (diff) | |
download | org.eclipse.efxclipse-a6cd03a13440b4e455b0f1245b3eb05d74c0e0e0.tar.gz org.eclipse.efxclipse-a6cd03a13440b4e455b0f1245b3eb05d74c0e0e0.tar.xz org.eclipse.efxclipse-a6cd03a13440b4e455b0f1245b3eb05d74c0e0e0.zip |
initial check in
Diffstat (limited to 'demos')
19 files changed, 855 insertions, 0 deletions
diff --git a/demos/org.eclipse.fx.demo.fxgraph/.DS_Store b/demos/org.eclipse.fx.demo.fxgraph/.DS_Store Binary files differnew file mode 100644 index 000000000..9a874b576 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/.DS_Store diff --git a/demos/org.eclipse.fx.demo.fxgraph/.classpath b/demos/org.eclipse.fx.demo.fxgraph/.classpath new file mode 100755 index 000000000..254e95875 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+ <classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/demos/org.eclipse.fx.demo.fxgraph/.gitignore b/demos/org.eclipse.fx.demo.fxgraph/.gitignore new file mode 100644 index 000000000..5e56e040e --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/.gitignore @@ -0,0 +1 @@ +/bin diff --git a/demos/org.eclipse.fx.demo.fxgraph/.project b/demos/org.eclipse.fx.demo.fxgraph/.project new file mode 100755 index 000000000..38b7e36e8 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fx.demo.fxgraph</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/demos/org.eclipse.fx.demo.fxgraph/.settings/org.eclipse.core.resources.prefs b/demos/org.eclipse.fx.demo.fxgraph/.settings/org.eclipse.core.resources.prefs new file mode 100755 index 000000000..4824b8026 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/demos/org.eclipse.fx.demo.fxgraph/.settings/org.eclipse.core.runtime.prefs b/demos/org.eclipse.fx.demo.fxgraph/.settings/org.eclipse.core.runtime.prefs new file mode 100755 index 000000000..deae05a97 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/.settings/org.eclipse.core.runtime.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +line.separator=\r\n diff --git a/demos/org.eclipse.fx.demo.fxgraph/.settings/org.eclipse.jdt.core.prefs b/demos/org.eclipse.fx.demo.fxgraph/.settings/org.eclipse.jdt.core.prefs new file mode 100755 index 000000000..7341ab168 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.7 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.7 diff --git a/demos/org.eclipse.fx.demo.fxgraph/about.html b/demos/org.eclipse.fx.demo.fxgraph/about.html new file mode 100755 index 000000000..ecd1378e9 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/about.html @@ -0,0 +1,28 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> +<head> +<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/> +<title>About</title> +</head> +<body lang="EN-US"> +<h2>About This Content</h2> + +<p>June 2, 2006</p> +<h3>License</h3> + +<p>The BestSolution.at makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>. +For purposes of the EPL, "Program" will mean the Content.</p> + +<p>If you did not receive this Content directly from the BestSolution.at, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p> + +</body> +</html>
\ No newline at end of file diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/.DS_Store b/demos/org.eclipse.fx.demo.fxgraph/src/.DS_Store Binary files differnew file mode 100644 index 000000000..5df2016a4 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/.DS_Store diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/App.java b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/App.java new file mode 100755 index 000000000..5ce1576a8 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/App.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2008, 2011 Oracle and/or its affiliates. + * All rights reserved. Use is subject to license terms. + * + * This file is available and licensed under the following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * - Neither the name of Oracle Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.eclipse.fx.demo.fxgraph; + +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.eclipse.fx.demo.fxgraph.model.User; +import org.eclipse.fx.demo.fxgraph.security.Authenticator; + +import javafx.application.Application; +import javafx.fxml.FXMLLoader; +import javafx.fxml.JavaFXBuilderFactory; +import javafx.geometry.Orientation; +import javafx.scene.Scene; +import javafx.scene.control.Button; +import javafx.scene.control.SplitPane; +import javafx.scene.layout.AnchorPane; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +/** + * Main Application. This class handles navigation and user session. + */ +public class App extends Application { + private Stage stage; + private User loggedUser; + + private static App instance; + + public App() { + instance = this; + } + + public static App getInstance() { + return instance; + } + + /** + * @param args the command line arguments + */ + public static void main(String[] args) { + launch(args); + } + + @Override public void start(Stage primaryStage) { + try { + stage = primaryStage; + gotoLogin(); + primaryStage.setWidth(600); + primaryStage.setHeight(600); + primaryStage.show(); + } catch (Exception ex) { + Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public User getLoggedUser() { + return loggedUser; + } + + public boolean userLogging(String userId, String password){ + if (Authenticator.validate(userId, password)) { + loggedUser = User.of(userId); + gotoProfile(); + return true; + } else { + return false; + } + } + + public void userLogout(){ + loggedUser = null; + gotoLogin(); + } + + private void gotoProfile() { + try { + replaceSceneContent("profile.fxml"); + } catch (Exception ex) { + Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); + } + } + + private void gotoLogin() { + try { + replaceSceneContent("login.fxml"); + } catch (Exception ex) { + Logger.getLogger(App.class.getName()).log(Level.SEVERE, null, ex); + } + } + + private AnchorPane replaceSceneContent(String fxml) throws Exception { + AnchorPane page = (AnchorPane) FXMLLoader.load(App.class.getResource(fxml), null, new JavaFXBuilderFactory()); + Scene scene = stage.getScene(); + if (scene == null) { + scene = new Scene(page); + scene.getStylesheets().add(App.class.getResource("demo.css").toExternalForm()); + stage.setScene(scene); + } else { + stage.getScene().setRoot(page); + } + stage.sizeToScene(); + return page; + } +} diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/LoginController.java b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/LoginController.java new file mode 100755 index 000000000..7b94053d0 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/LoginController.java @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2008, 2011 Oracle and/or its affiliates. + * All rights reserved. Use is subject to license terms. + * + * This file is available and licensed under the following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * - Neither the name of Oracle Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.eclipse.fx.demo.fxgraph; + +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.PasswordField; +import javafx.scene.control.TextField; +import javafx.scene.control.Label; + +/** + * Login Controller. + */ +public class LoginController { + @FXML private TextField userId; + @FXML private PasswordField password; + @FXML private Label errorMessage; + + @FXML protected void processLogin(ActionEvent event) { + if(!App.getInstance().userLogging(userId.getText(), password.getText())){ + errorMessage.setText("Invalid username or password: " + userId.getText()); + } + } +} diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/ProfileController.java b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/ProfileController.java new file mode 100755 index 000000000..ee2d9f2a2 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/ProfileController.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2008, 2011 Oracle and/or its affiliates. + * All rights reserved. Use is subject to license terms. + * + * This file is available and licensed under the following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * - Neither the name of Oracle Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.eclipse.fx.demo.fxgraph; + +import javafx.scene.control.TextArea; + +import java.net.URL; +import java.util.ResourceBundle; + +import org.eclipse.fx.demo.fxgraph.model.User; + +import javafx.animation.FadeTransition; +import javafx.collections.ObservableMap; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.Initializable; +import javafx.scene.control.CheckBox; +import javafx.scene.control.Hyperlink; +import javafx.scene.control.Label; +import javafx.scene.control.TextField; +import javafx.util.Duration; + +/** + * Java FX FXML Controller. + */ +public class ProfileController implements Initializable { + @FXML private TextField user; + @FXML private TextField phone; + @FXML private TextField email; + @FXML private TextArea address; + @FXML private CheckBox subscribed; + @FXML private Label success; + + @Override public void initialize(URL location, ResourceBundle resources) { + User loggedUser = App.getInstance().getLoggedUser(); + user.setText(loggedUser.getId()); + if(loggedUser.getEmail() != null) { + email.setText(loggedUser.getEmail()); + } + if(loggedUser.getPhone() != null) { + phone.setText(loggedUser.getPhone()); + } + if(loggedUser.getAddress() != null) { + address.setText(loggedUser.getAddress()); + } + subscribed.setSelected(loggedUser.isSubscribed()); + success.setOpacity(0); + } + + @FXML protected void processLogout(ActionEvent event) { + App.getInstance().userLogout(); + } + + @FXML protected void processUpdate(ActionEvent event) { + User loggedUser = App.getInstance().getLoggedUser(); + loggedUser.setEmail(email.getText()); + loggedUser.setPhone(phone.getText()); + loggedUser.setSubscribed(subscribed.isSelected()); + loggedUser.setAddress(address.getText()); + animateMessage(); + } + + private void animateMessage() { + FadeTransition ft = new FadeTransition(new Duration(3000), success); + ft.setFromValue(0.0); + ft.setToValue(1); + ft.play(); + } +} diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/demo.css b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/demo.css new file mode 100755 index 000000000..fb4753602 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/demo.css @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2008, 2011 Oracle and/or its affiliates. + * All rights reserved. Use is subject to license terms. + * + * This file is available and licensed under the following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * - Neither the name of Oracle Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +.login { + -fx-background-color:linear-gradient(white,#DDDDDD); + -fx-font-size: 1.2em; +} +.profile { + -fx-background-color:linear-gradient(white,#DDDDDD); + -fx-font-size: 1.2em; +} +.profile #subscribed { + -fx-font-size: 0.8em; +} +.profile #message { + -fx-font-size: 1.2em; + -fx-font-weight: bold; +} diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/login.fxgraph b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/login.fxgraph new file mode 100755 index 000000000..b44b7dd83 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/login.fxgraph @@ -0,0 +1,64 @@ +package org.eclipse.fx.demo.fxgraph
+
+import java.lang.*
+import java.util.*
+import javafx.collections.*
+import javafx.scene.*
+import javafx.scene.control.*
+import javafx.scene.layout.*
+import javafx.scene.paint.*
+import javafx.scene.text.* +
+component LoginComponent controlledby org.eclipse.fx.demo.fxgraph.LoginController styledwith "demo.css" {
+ AnchorPane id Login {
+ prefHeight : 280.0,
+ prefWidth : 480.0,
+ children : [
+ TextField id userId {
+ layoutX : 68.0,
+ layoutY : 58.0,
+ prefWidth : 126.0,
+ onAction : controllermethod processLogin
+ },
+ PasswordField id password {
+ layoutX : 323.0,
+ layoutY : 58.0,
+ prefWidth : 126.0,
+ onAction : controllermethod processLogin
+ },
+ Label {
+ layoutX : 229.0,
+ layoutY : 61.0,
+ text : "Test"
+ },
+ Label {
+ layoutX : 16.0,
+ layoutY : 61.0,
+ text : "User"
+ },
+ Button id login {
+ layoutX : 200.0,
+ layoutY : 125.0,
+ text : "login",
+ defaultButton : true,
+ onAction : controllermethod processLogin
+ },
+ Label id errorMessage {
+ layoutX : 80.0,
+ layoutY : 200.0,
+ textFill : "RED"
+ }
+ ],
+ styleClass : [
+ String("login")
+ ],
+ properties : {
+ backgroundColor : Color {
+ blue: 1.0,
+ green: 1.0,
+ red: 1.0
+ },
+ elementLockSel : Boolean(true)
+ }
+ }
+}
\ No newline at end of file diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/login.fxml b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/login.fxml new file mode 100755 index 000000000..6d8e77d5a --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/login.fxml @@ -0,0 +1,36 @@ +<?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/fxgraph/login.fxgraph
+-->
+
+<?import java.lang.*?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.control.PasswordField?>
+<?import javafx.scene.control.TextField?>
+<?import javafx.scene.layout.AnchorPane?>
+<?import javafx.scene.paint.Color?>
+<?scenebuilder-stylesheet demo.css?>
+
+<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:id="Login" fx:controller="org.eclipse.fx.demo.fxgraph.LoginController" prefHeight="280.0" prefWidth="480.0">
+
+ <children>
+ <TextField fx:id="userId" layoutX="68.0" layoutY="58.0" prefWidth="126.0" onAction="#processLogin"/>
+ <PasswordField fx:id="password" layoutX="323.0" layoutY="58.0" prefWidth="126.0" onAction="#processLogin"/>
+ <Label layoutX="229.0" layoutY="61.0" text="Test"/>
+ <Label layoutX="16.0" layoutY="61.0" text="User"/>
+ <Button fx:id="login" layoutX="200.0" layoutY="125.0" text="login" defaultButton="true" onAction="#processLogin"/>
+ <Label fx:id="errorMessage" layoutX="80.0" layoutY="200.0" textFill="RED"/>
+ </children>
+ <styleClass>
+ <String fx:value="login"/>
+ </styleClass>
+ <properties>
+ <backgroundColor>
+ <Color blue="1.0" green="1.0" red="1.0"/>
+ </backgroundColor>
+ <elementLockSel>
+ <Boolean fx:value="true"/>
+ </elementLockSel>
+ </properties>
+</AnchorPane>
diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/model/User.java b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/model/User.java new file mode 100755 index 000000000..3f168681e --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/model/User.java @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2008, 2011 Oracle and/or its affiliates. + * All rights reserved. Use is subject to license terms. + * + * This file is available and licensed under the following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * - Neither the name of Oracle Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.eclipse.fx.demo.fxgraph.model; + +import java.util.HashMap; +import java.util.Map; + +/** + * Data object for a User + */ +public class User { + private static final Map<String, User> USERS = new HashMap<String, User>(); + + private String id; + private String email; + private String phone; + private boolean subscribed; + private String address; + + private User(String id) { + this.id = id; + } + + public static User of(String id) { + User user = USERS.get(id); + if (user == null) { + user = new User(id); + USERS.put(id, user); + } + return user; + } + + public String getId() { + return id; + } + + /** + * @return the email + */ + public String getEmail() { + return email; + } + + /** + * @param email the email to set + */ + public void setEmail(String email) { + this.email = email; + } + + /** + * @return the phone + */ + public String getPhone() { + return phone; + } + + /** + * @param phone the phone to set + */ + public void setPhone(String phone) { + this.phone = phone; + } + + /** + * @return the subscribed + */ + public boolean isSubscribed() { + return subscribed; + } + + /** + * @param subscribed the subscribed to set + */ + public void setSubscribed(boolean subscribed) { + this.subscribed = subscribed; + } + + /** + * @return the address + */ + public String getAddress() { + return address; + } + + /** + * @param address the address to set + */ + public void setAddress(String address) { + this.address = address; + } +} diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/profile.fxgraph b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/profile.fxgraph new file mode 100755 index 000000000..12d4de06d --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/profile.fxgraph @@ -0,0 +1,129 @@ +package org.eclipse.fx.demo.fxgraph
+
+import java.lang.*
+import javafx.scene.control.*
+import javafx.scene.layout.*
+import javafx.scene.shape.*
+import javafx.scene.text.* +import org.eclipse.fx.demo.fxgraph.*
+
+component ProfileComponent controlledby org.eclipse.fx.demo.fxgraph.ProfileController {
+ AnchorPane id Profile {
+ prefWidth : 650.0,
+ prefHeight : 443.0,
+ children : [
+ Button id update {
+ maxHeight : 2.0,
+ text : "Update",
+ call AnchorPane#bottomAnchor : 15.0,
+ call AnchorPane#rightAnchor : 168.0,
+ onAction : controllermethod processUpdate
+ },
+ Label id message {
+ layoutX : 56.0,
+ layoutY : 77.0,
+ text : "Please review your profile data."
+ },
+ Label {
+ layoutX : 56.0,
+ layoutY : 123.0,
+ text : "User:"
+ },
+ Label {
+ layoutX : 56.0,
+ layoutY : 224.0,
+ text : "Phone:"
+ },
+ Label {
+ layoutX : 56.0,
+ layoutY : 173.0,
+ text : "Email:"
+ },
+ TextField id user {
+ editable : false,
+ layoutX : 149.0,
+ layoutY : 120.0,
+ maxWidth : 2.0,
+ maxHeight : 30.0,
+ minWidth : 215.0,
+ prefWidth : 215.0,
+ prefHeight : 30.0
+ },
+ TextField id email {
+ editable : true,
+ layoutX : 149.0,
+ layoutY : 171,
+ maxWidth : 2.0,
+ minHeight : 30.0,
+ minWidth : 215.0,
+ prefHeight : 30.0,
+ prefWidth : 215.0
+ },
+ TextField id phone {
+ layoutX : 149.0,
+ layoutY : 224,
+ maxWidth : 2.0,
+ minHeight : 30.0,
+ minWidth : 215.0,
+ prefHeight : 30.0,
+ prefWidth : 215.0
+ },
+ CheckBox id subscribed {
+ layoutX : 402,
+ layoutY : 120,
+ text : "Subscribe to Newsletter"
+ },
+ Separator {
+ layoutX : 380,
+ layoutY : 110,
+ prefHeight : 155,
+ orientation : "vertical"
+ },
+ Hyperlink id logout {
+ layoutY : 24.0,
+ text : "logout",
+ call AnchorPane#rightAnchor: 52.0,
+ onAction : controllermethod processLogout
+ },
+ Button id Button {
+ disable : true,
+ maxHeight : 2,
+ maxWidth : 2.0,
+ text : "Continue",
+ defaultButton : true,
+ call AnchorPane#bottomAnchor:15.0,
+ call AnchorPane#rightAnchor: 52.0,
+ onAction : controllermethod processLogout
+ },
+ Label id success {
+ layoutX : 100.0,
+ layoutY : 401.0,
+ opacity : 0.0,
+ text : "Profile successfully updated!"
+ },
+ Label {
+ layoutX : 56.0,
+ layoutY : 284.0,
+ text : "Address:"
+ },
+ TextArea id address {
+ maxHeight : 2.0,
+ maxWidth : 2.0,
+ minHeight : 85.0,
+ minWidth : 448.0,
+ prefHeight : 85.0,
+ prefWidth : 448.0,
+ call AnchorPane#bottomAnchor: 69.0,
+ call AnchorPane#leftAnchor: 149.0,
+ call AnchorPane#rightAnchor: 52.0,
+ call AnchorPane#topAnchor: 289.0
+ }
+ ],
+ styleClass : [
+ String("profile")
+ ],
+ properties : {
+ elementLockSel : Boolean(true)
+ }
+ }
+}
\ No newline at end of file diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/profile.fxml b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/profile.fxml new file mode 100755 index 000000000..93a771c8d --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/profile.fxml @@ -0,0 +1,43 @@ +<?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/fxgraph/profile.fxgraph
+-->
+
+<?import java.lang.*?>
+<?import javafx.scene.control.Button?>
+<?import javafx.scene.control.CheckBox?>
+<?import javafx.scene.control.Hyperlink?>
+<?import javafx.scene.control.Label?>
+<?import javafx.scene.control.Separator?>
+<?import javafx.scene.control.TextArea?>
+<?import javafx.scene.control.TextField?>
+<?import javafx.scene.layout.AnchorPane?>
+
+<AnchorPane xmlns:fx="http://javafx.com/fxml" fx:id="Profile" fx:controller="org.eclipse.fx.demo.fxgraph.ProfileController" prefWidth="650.0" prefHeight="443.0">
+
+ <children>
+ <Button fx:id="update" maxHeight="2.0" text="Update" onAction="#processUpdate" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="168.0"/>
+ <Label fx:id="message" layoutX="56.0" layoutY="77.0" text="Please review your profile data."/>
+ <Label layoutX="56.0" layoutY="123.0" text="User:"/>
+ <Label layoutX="56.0" layoutY="224.0" text="Phone:"/>
+ <Label layoutX="56.0" layoutY="173.0" text="Email:"/>
+ <TextField fx:id="user" editable="false" layoutX="149.0" layoutY="120.0" maxWidth="2.0" maxHeight="30.0" minWidth="215.0" prefWidth="215.0" prefHeight="30.0"/>
+ <TextField fx:id="email" editable="true" layoutX="149.0" layoutY="171" maxWidth="2.0" minHeight="30.0" minWidth="215.0" prefHeight="30.0" prefWidth="215.0"/>
+ <TextField fx:id="phone" layoutX="149.0" layoutY="224" maxWidth="2.0" minHeight="30.0" minWidth="215.0" prefHeight="30.0" prefWidth="215.0"/>
+ <CheckBox fx:id="subscribed" layoutX="402" layoutY="120" text="Subscribe to Newsletter"/>
+ <Separator layoutX="380" layoutY="110" prefHeight="155" orientation="vertical"/>
+ <Hyperlink fx:id="logout" layoutY="24.0" text="logout" onAction="#processLogout" AnchorPane.rightAnchor="52.0"/>
+ <Button fx:id="Button" disable="true" maxHeight="2" maxWidth="2.0" text="Continue" defaultButton="true" onAction="#processLogout" AnchorPane.bottomAnchor="15.0" AnchorPane.rightAnchor="52.0"/>
+ <Label fx:id="success" layoutX="100.0" layoutY="401.0" opacity="0" text="Profile successfully updated!"/>
+ <Label layoutX="56.0" layoutY="284.0" text="Address:"/>
+ <TextArea fx:id="address" maxHeight="2.0" maxWidth="2.0" minHeight="85.0" minWidth="448.0" prefHeight="85.0" prefWidth="448.0" AnchorPane.bottomAnchor="69.0" AnchorPane.leftAnchor="149.0" AnchorPane.rightAnchor="52.0" AnchorPane.topAnchor="289.0"/>
+ </children>
+ <styleClass>
+ <String fx:value="profile"/>
+ </styleClass>
+ <properties>
+ <elementLockSel>
+ <Boolean fx:value="true"/>
+ </elementLockSel>
+ </properties>
+</AnchorPane>
diff --git a/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/security/Authenticator.java b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/security/Authenticator.java new file mode 100755 index 000000000..508e3be48 --- /dev/null +++ b/demos/org.eclipse.fx.demo.fxgraph/src/org/eclipse/fx/demo/fxgraph/security/Authenticator.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2008, 2011 Oracle and/or its affiliates. + * All rights reserved. Use is subject to license terms. + * + * This file is available and licensed under the following license: + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the distribution. + * - Neither the name of Oracle Corporation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +package org.eclipse.fx.demo.fxgraph.security; + +import java.util.HashMap; +import java.util.Map; + +/** + * Simple Authenticator service, that checks user logins + */ +public class Authenticator { + private static final Map<String, String> USERS = new HashMap<String, String>(); + static { + USERS.put("demo", "demo"); + } + public static boolean validate(String user, String password){ + String validUserPassword = USERS.get(user); + return validUserPassword != null && validUserPassword.equals(password); + } +} |