r536 - in textjfx: . src src/main src/main/java src/main/java/org src/main/java/org/codelutin src/main/java/org/codelutin/jfx src/main/resources
Author: echatellier Date: 2012-05-09 21:12:55 +0200 (Wed, 09 May 2012) New Revision: 536 Url: http://nuiton.org/repositories/revision/sandbox/536 Log: Initial import. Added: textjfx/pom.xml textjfx/src/ textjfx/src/main/ textjfx/src/main/java/ textjfx/src/main/java/org/ textjfx/src/main/java/org/codelutin/ textjfx/src/main/java/org/codelutin/jfx/ textjfx/src/main/java/org/codelutin/jfx/MainView.java textjfx/src/main/java/org/codelutin/jfx/ReportView.java textjfx/src/main/resources/ textjfx/src/main/resources/MainView.fxml textjfx/src/main/resources/ReportView.fxml Modified: textjfx/ Property changes on: textjfx ___________________________________________________________________ Added: svn:ignore + .settings .classpath .project Added: textjfx/pom.xml =================================================================== --- textjfx/pom.xml (rev 0) +++ textjfx/pom.xml 2012-05-09 19:12:55 UTC (rev 536) @@ -0,0 +1,27 @@ +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.codelutin</groupId> + <artifactId>testjfx</artifactId> + <version>0.0.1-SNAPSHOT</version> + + <dependencies> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + <version>1.6.4</version> + <scope>compile</scope> + </dependency> + <dependency> + <groupId>org.slf4j</groupId> + <artifactId>jcl-over-slf4j</artifactId> + <version>1.6.4</version> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + <version>1.0.0</version> + <scope>runtime</scope> + </dependency> + </dependencies> +</project> \ No newline at end of file Added: textjfx/src/main/java/org/codelutin/jfx/MainView.java =================================================================== --- textjfx/src/main/java/org/codelutin/jfx/MainView.java (rev 0) +++ textjfx/src/main/java/org/codelutin/jfx/MainView.java 2012-05-09 19:12:55 UTC (rev 536) @@ -0,0 +1,91 @@ +/* * + * Copyright (C) 2012 ceric35 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + **/ +package org.codelutin.jfx; + +import java.io.IOException; +import java.util.Arrays; + +import javafx.application.Application; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.fxml.FXMLLoader; +import javafx.scene.Scene; +import javafx.scene.control.TreeItem; +import javafx.scene.control.TreeView; +import javafx.stage.Stage; + +/** + * MainView + * + * TODO ADD COMMENT HERE ! + * + * @author ceric35 + * Date : 7 mai 2012 + */ +public class MainView extends Application { + + @FXML + protected TreeView treeView; + + public static void main(String[] args) { + launch(args); + } + + /* (non-Javadoc) + * @see javafx.application.Application#start(javafx.stage.Stage) + */ + @Override + public void start(Stage primaryStage) throws Exception { + + primaryStage.setTitle("FXTimer"); + + Scene scene = (Scene)FXMLLoader.load(getClass().getResource("/MainView.fxml")); + primaryStage.setScene(scene); + primaryStage.sizeToScene(); + primaryStage.show(); + } + + @FXML + protected void loadTree(ActionEvent event) { + final TreeItem<String> treeRoot = new TreeItem<String>("Root node"); + treeRoot.getChildren().addAll(Arrays.asList( + new TreeItem<String>("Child Node 1"), + new TreeItem<String>("Child Node 2"), + new TreeItem<String>("Child Node 3"))); + + treeRoot.getChildren().get(2).getChildren().addAll(Arrays.asList( + new TreeItem<String>("Child Node 4"), + new TreeItem<String>("Child Node 5"), + new TreeItem<String>("Child Node 6"), + new TreeItem<String>("Child Node 7"), + new TreeItem<String>("Child Node 8"), + new TreeItem<String>("Child Node 9"), + new TreeItem<String>("Child Node 10"), + new TreeItem<String>("Child Node 11"), + new TreeItem<String>("Child Node 12"))); + treeView.setRoot(treeRoot); + } + + @FXML + protected void showReport(ActionEvent event) throws IOException { + Stage newStage = new Stage(); + Scene scene = (Scene)FXMLLoader.load(getClass().getResource("/ReportView.fxml")); + newStage.setScene(scene); + newStage.show(); + } +} Added: textjfx/src/main/java/org/codelutin/jfx/ReportView.java =================================================================== --- textjfx/src/main/java/org/codelutin/jfx/ReportView.java (rev 0) +++ textjfx/src/main/java/org/codelutin/jfx/ReportView.java 2012-05-09 19:12:55 UTC (rev 536) @@ -0,0 +1,73 @@ +/* * + * Copyright (C) 2012 ceric35 + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + **/ +package org.codelutin.jfx; + +import java.io.IOException; +import java.util.Arrays; + +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.TreeItem; +import javafx.scene.control.TreeView; +import javafx.stage.FileChooser; +import javafx.stage.Window; + +/** + * ReportView + * + * TODO ADD COMMENT HERE ! + * + * @author ceric35 + * Date : 8 mai 2012 + */ +public class ReportView extends Window { + + @FXML + protected TreeView treeView; + + @FXML + protected void close(ActionEvent event) throws IOException { + FileChooser chooser = new FileChooser(); + chooser.showOpenDialog(this); + } + + @FXML + protected void generate(ActionEvent event) throws IOException { + final TreeItem<String> treeRoot = new TreeItem<String>("Root node"); + treeRoot.getChildren().addAll(Arrays.asList( + new TreeItem<String>("Child Node 1"), + new TreeItem<String>("Child Node 2"), + new TreeItem<String>("Child Node 3"))); + + treeRoot.getChildren().get(2).getChildren().addAll(Arrays.asList( + new TreeItem<String>("Child Node 4"), + new TreeItem<String>("Child Node 5"), + new TreeItem<String>("Child Node 6"), + new TreeItem<String>("Child Node 7"), + new TreeItem<String>("Child Node 8"), + new TreeItem<String>("Child Node 9"), + new TreeItem<String>("Child Node 10"), + new TreeItem<String>("Child Node 11"), + new TreeItem<String>("Child Node 12"))); + treeView.setRoot(treeRoot); + + + } + + +} Added: textjfx/src/main/resources/MainView.fxml =================================================================== --- textjfx/src/main/resources/MainView.fxml (rev 0) +++ textjfx/src/main/resources/MainView.fxml 2012-05-09 19:12:55 UTC (rev 536) @@ -0,0 +1,68 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?import javafx.collections.*?> +<?import javafx.scene.*?> +<?import javafx.scene.control.*?> +<?import javafx.scene.layout.*?> +<?import javafx.scene.paint.*?> +<?import javafx.scene.text.*?> + +<Scene width="400" height="800" fx:controller="org.codelutin.jfx.MainView" + xmlns:fx="http://javafx.com/fxml"> + + <BorderPane> + <top> + <MenuBar fx:id="menuBar"> + <menus> + <Menu fx:id="menuFile" text="File"> + <items> + <MenuItem text="Load" onAction="#loadTree" /> + <SeparatorMenuItem /> + <MenuItem text="Exit"/> + </items> + </Menu> + <Menu fx:id="menuFile" text="Project"> + <items> + <MenuItem text="New"/> + <SeparatorMenuItem /> + <MenuItem text="Exit"/> + </items> + </Menu> + <Menu fx:id="menuFile" text="Task"> + <items> + <MenuItem text="New"/> + <SeparatorMenuItem /> + <MenuItem text="Exit"/> + </items> + </Menu> + <Menu fx:id="menuFile" text="Report"> + <items> + <MenuItem text="Report" onAction="#showReport" /> + </items> + </Menu> + <Menu fx:id="menuFile" text="Options"> + <items> + <MenuItem text="New"/> + <SeparatorMenuItem /> + <MenuItem text="Exit"/> + </items> + </Menu> + <Menu fx:id="menuFile" text="Help"> + <items> + <MenuItem text="New"/> + <SeparatorMenuItem /> + <MenuItem text="Exit"/> + </items> + </Menu> + </menus> + </MenuBar> + </top> + + <center> + + <TreeView fx:id="treeView"> + + </TreeView> + + </center> + </BorderPane> +</Scene> Added: textjfx/src/main/resources/ReportView.fxml =================================================================== --- textjfx/src/main/resources/ReportView.fxml (rev 0) +++ textjfx/src/main/resources/ReportView.fxml 2012-05-09 19:12:55 UTC (rev 536) @@ -0,0 +1,51 @@ +<?import javafx.scene.*?> +<?import javafx.scene.control.*?> +<?import javafx.scene.layout.*?> +<?import org.codelutin.jfx.widget.*?> + +<Scene width="500" height="500" fx:controller="org.codelutin.jfx.ReportView" + xmlns:fx="http://javafx.com/fxml"> + +<SplitPane orientation="HORIZONTAL"> + + <BorderPane> + + <top> + <TitledPane text="Options" collapsible="false"> + <content> + <GridPane> + <Label text="De" GridPane.rowIndex="0" GridPane.columnIndex="0" /> + <Label text="13/23/2012" GridPane.rowIndex="0" GridPane.columnIndex="1" /> + <Label text="A:" GridPane.rowIndex="1" GridPane.columnIndex="0" /> + <Label text="13/23/2012" GridPane.rowIndex="1" GridPane.columnIndex="1" /> + </GridPane> + </content> + </TitledPane> + </top> + + <center> + <TitledPane text="Projects" collapsible="false"> + <TreeView fx:id="treeView" editable="true"> + + </TreeView> + </TitledPane> + </center> + </BorderPane> + + <BorderPane> + <center> + <TextArea fx:id="reportArea" text="truc" /> + </center> + <bottom> + <HBox> + <Button text="Generate" onAction="#generate" /> + <Button text="Send by email" /> + <Button text="Close" onAction="#close" /> + </HBox> + </bottom> + </BorderPane> + + +</SplitPane> + +</Scene> \ No newline at end of file
participants (1)
-
echatellier@users.nuiton.org