@ -0,0 +1,53 @@
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!-- You may freely edit this file. See commented blocks below for --><!-- some examples of how to customize the build. --><!-- (If you delete it and reopen the project it will be recreated.) --><!-- By default, only the Clean and Build commands use this build script. --><project name="JavaFXTableExampleDist" default="default" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant"> |
||||
<description>Builds, tests, and runs the project JavaFXTableExampleDist.</description> |
||||
<import file="nbproject/build-impl.xml"/> |
||||
<!-- |
||||
|
||||
There exist several targets which are by default empty and which can be |
||||
used for execution of your tasks. These targets are usually executed |
||||
before and after some main targets. Those of them relevant for JavaFX project are: |
||||
|
||||
-pre-init: called before initialization of project properties |
||||
-post-init: called after initialization of project properties |
||||
-pre-compile: called before javac compilation |
||||
-post-compile: called after javac compilation |
||||
-pre-compile-test: called before javac compilation of JUnit tests |
||||
-post-compile-test: called after javac compilation of JUnit tests |
||||
-pre-jfx-jar: called before FX SDK specific <fx:jar> task |
||||
-post-jfx-jar: called after FX SDK specific <fx:jar> task |
||||
-pre-jfx-deploy: called before FX SDK specific <fx:deploy> task |
||||
-post-jfx-deploy: called after FX SDK specific <fx:deploy> task |
||||
-pre-jfx-native: called just after -pre-jfx-deploy if <fx:deploy> runs in native packaging mode |
||||
-post-jfx-native: called just after -post-jfx-deploy if <fx:deploy> runs in native packaging mode |
||||
-post-clean: called after cleaning build products |
||||
|
||||
(Targets beginning with '-' are not intended to be called on their own.) |
||||
|
||||
Example of inserting a HTML postprocessor after javaFX SDK deployment: |
||||
|
||||
<target name="-post-jfx-deploy"> |
||||
<basename property="jfx.deployment.base" file="${jfx.deployment.jar}" suffix=".jar"/> |
||||
<property name="jfx.deployment.html" location="${jfx.deployment.dir}${file.separator}${jfx.deployment.base}.html"/> |
||||
<custompostprocess> |
||||
<fileset dir="${jfx.deployment.html}"/> |
||||
</custompostprocess> |
||||
</target> |
||||
|
||||
Example of calling an Ant task from JavaFX SDK. Note that access to JavaFX SDK Ant tasks must be |
||||
initialized; to ensure this is done add the dependence on -check-jfx-sdk-version target: |
||||
|
||||
<target name="-post-jfx-jar" depends="-check-jfx-sdk-version"> |
||||
<echo message="Calling jar task from JavaFX SDK"/> |
||||
<fx:jar ...> |
||||
... |
||||
</fx:jar> |
||||
</target> |
||||
|
||||
For more details about JavaFX SDK Ant tasks go to |
||||
http://docs.oracle.com/javafx/2/deployment/jfxpub-deployment.htm |
||||
|
||||
For list of available properties check the files |
||||
nbproject/build-impl.xml and nbproject/jfx-impl.xml. |
||||
|
||||
--> |
||||
</project> |
@ -0,0 +1,4 @@
@@ -0,0 +1,4 @@
|
||||
#Sat, 25 Feb 2023 13:32:48 +0300 |
||||
|
||||
|
||||
C\:\\Users\\denis.LAPTOP-4LI8UQ4O\\OneDrive\\\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b\\NetBeansProjects\\JavaFXTableExample_dist\\JavaFXTableExampleDist= |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<?import java.lang.*?> |
||||
<?import java.util.*?> |
||||
<?import javafx.scene.*?> |
||||
<?import javafx.scene.control.*?> |
||||
<?import javafx.scene.layout.*?> |
||||
|
||||
<AnchorPane id="AnchorPane" prefHeight="800" prefWidth="1150" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafxtableexampledist.FXMLEducationController"> |
||||
<children> |
||||
<TableView fx:id="table" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> |
||||
<columns> |
||||
<TableColumn fx:id="idCol" prefWidth="100" text="ИД" /> |
||||
<TableColumn fx:id="universityCol" prefWidth="400" text="Университет" /> |
||||
<TableColumn fx:id="dateCol" prefWidth="200" text="Дата" /> |
||||
<TableColumn fx:id="cityCol" prefWidth="150" text="Город" /> |
||||
<TableColumn fx:id="idpersonCol" prefWidth="300" text="Персона" /> |
||||
</columns> |
||||
</TableView> |
||||
<!-- <Button layoutX="126" layoutY="90" text="Click Me!" onAction="#handleButtonAction" fx:id="button" /> |
||||
<Label layoutX="126" layoutY="120" minHeight="16" minWidth="69" fx:id="label" />--> |
||||
</children> |
||||
</AnchorPane> |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<?import java.lang.*?> |
||||
<?import java.util.*?> |
||||
<?import javafx.scene.*?> |
||||
<?import javafx.scene.control.*?> |
||||
<?import javafx.scene.layout.*?> |
||||
|
||||
<AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafxtableexampledist.FXMLMainController"> |
||||
<children> |
||||
<TableView onMouseClicked="#handleClickedAction" onKeyPressed="#handleKeyPressedAction" fx:id="table" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> |
||||
<columns> |
||||
<TableColumn fx:id="idCol" prefWidth="100" text="ИД" /> |
||||
<TableColumn fx:id="firstCol" prefWidth="200" text="Имя" /> |
||||
<TableColumn fx:id="lastCol" prefWidth="200" text="Фамилия" /> |
||||
<TableColumn fx:id="genderCol" prefWidth="150" text="Пол" /> |
||||
<TableColumn fx:id="countCol" prefWidth="50" text="Кол-во" /> |
||||
</columns> |
||||
</TableView> |
||||
</children> |
||||
</AnchorPane> |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
<html><head> |
||||
<SCRIPT src="./web-files/dtjava.js"></SCRIPT> |
||||
<script> |
||||
function launchApplication(jnlpfile) { |
||||
dtjava.launch( { |
||||
url : 'JavaFXTableExampleDist.jnlp', |
||||
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iSmF2YUZYVGFibGVFeGFtcGxlRGlzdC5qbmxwIj4NCiAgPGluZm9ybWF0aW9uPg0KICAgIDx0aXRsZT5KYXZhRlhUYWJsZUV4YW1wbGVEaXN0PC90aXRsZT4NCiAgICA8dmVuZG9yPmRlbmlzPC92ZW5kb3I+DQogICAgPGRlc2NyaXB0aW9uPm51bGw8L2Rlc2NyaXB0aW9uPg0KICAgIDxvZmZsaW5lLWFsbG93ZWQvPg0KICA8L2luZm9ybWF0aW9uPg0KICA8cmVzb3VyY2VzPg0KICAgIDxqMnNlIHZlcnNpb249IjEuNisiIGhyZWY9Imh0dHA6Ly9qYXZhLnN1bi5jb20vcHJvZHVjdHMvYXV0b2RsL2oyc2UiLz4NCiAgICA8amFyIGhyZWY9IkphdmFGWFRhYmxlRXhhbXBsZURpc3QuamFyIiBzaXplPSIxNTMzMSIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5LmphciIgc2l6ZT0iMzIzMjc3MCIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5Y2xpZW50LmphciIgc2l6ZT0iNTg4Mzk0IiBkb3dubG9hZD0iZWFnZXIiIC8+DQogICAgPGphciBocmVmPSJsaWJcZGVyYnluZXQuamFyIiBzaXplPSIyNzI2MjYiIGRvd25sb2FkPSJlYWdlciIgLz4NCiAgPC9yZXNvdXJjZXM+DQogIDxhcHBsZXQtZGVzYyAgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImNvbS5qYXZhZngubWFpbi5Ob0phdmFGWEZhbGxiYWNrIiAgbmFtZT0iSmF2YUZYVGFibGVFeGFtcGxlRGlzdCIgPg0KICAgIDxwYXJhbSBuYW1lPSJyZXF1aXJlZEZYVmVyc2lvbiIgdmFsdWU9IjguMCsiLz4NCiAgPC9hcHBsZXQtZGVzYz4NCiAgPGpmeDpqYXZhZngtZGVzYyAgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImphdmFmeHRhYmxlZXhhbXBsZWRpc3QuTWFpbiIgIG5hbWU9IkphdmFGWFRhYmxlRXhhbXBsZURpc3QiIC8+DQogIDx1cGRhdGUgY2hlY2s9ImFsd2F5cyIvPg0KPC9qbmxwPg0K' |
||||
}, |
||||
{ |
||||
javafx : '8.0+' |
||||
}, |
||||
{} |
||||
); |
||||
return false; |
||||
} |
||||
</script> |
||||
|
||||
<script> |
||||
function javafxEmbedjavafxtableexampledist() { |
||||
dtjava.embed( |
||||
{ |
||||
id : 'javafxtableexampledist', |
||||
url : 'JavaFXTableExampleDist.jnlp', |
||||
placeholder : 'javafx-app-placeholder', |
||||
width : '800', |
||||
height : '600', |
||||
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iSmF2YUZYVGFibGVFeGFtcGxlRGlzdC5qbmxwIj4NCiAgPGluZm9ybWF0aW9uPg0KICAgIDx0aXRsZT5KYXZhRlhUYWJsZUV4YW1wbGVEaXN0PC90aXRsZT4NCiAgICA8dmVuZG9yPmRlbmlzPC92ZW5kb3I+DQogICAgPGRlc2NyaXB0aW9uPm51bGw8L2Rlc2NyaXB0aW9uPg0KICAgIDxvZmZsaW5lLWFsbG93ZWQvPg0KICA8L2luZm9ybWF0aW9uPg0KICA8cmVzb3VyY2VzPg0KICAgIDxqMnNlIHZlcnNpb249IjEuNisiIGhyZWY9Imh0dHA6Ly9qYXZhLnN1bi5jb20vcHJvZHVjdHMvYXV0b2RsL2oyc2UiLz4NCiAgICA8amFyIGhyZWY9IkphdmFGWFRhYmxlRXhhbXBsZURpc3QuamFyIiBzaXplPSIxNTMzMSIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5LmphciIgc2l6ZT0iMzIzMjc3MCIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5Y2xpZW50LmphciIgc2l6ZT0iNTg4Mzk0IiBkb3dubG9hZD0iZWFnZXIiIC8+DQogICAgPGphciBocmVmPSJsaWJcZGVyYnluZXQuamFyIiBzaXplPSIyNzI2MjYiIGRvd25sb2FkPSJlYWdlciIgLz4NCiAgPC9yZXNvdXJjZXM+DQogIDxhcHBsZXQtZGVzYyAgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImNvbS5qYXZhZngubWFpbi5Ob0phdmFGWEZhbGxiYWNrIiAgbmFtZT0iSmF2YUZYVGFibGVFeGFtcGxlRGlzdCIgPg0KICAgIDxwYXJhbSBuYW1lPSJyZXF1aXJlZEZYVmVyc2lvbiIgdmFsdWU9IjguMCsiLz4NCiAgPC9hcHBsZXQtZGVzYz4NCiAgPGpmeDpqYXZhZngtZGVzYyAgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImphdmFmeHRhYmxlZXhhbXBsZWRpc3QuTWFpbiIgIG5hbWU9IkphdmFGWFRhYmxlRXhhbXBsZURpc3QiIC8+DQogIDx1cGRhdGUgY2hlY2s9ImFsd2F5cyIvPg0KPC9qbmxwPg0K' |
||||
}, |
||||
{ |
||||
javafx : '8.0+' |
||||
}, |
||||
{} |
||||
); |
||||
} |
||||
<!-- Embed FX application into web page once page is loaded --> |
||||
dtjava.addOnloadCallback(javafxEmbedjavafxtableexampledist); |
||||
</script> |
||||
|
||||
</head><body> |
||||
<h2>Test page for <b>JavaFXTableExampleDist</b></h2> |
||||
<b>Webstart:</b> <a href='JavaFXTableExampleDist.jnlp' onclick="return launchApplication('JavaFXTableExampleDist.jnlp');">click to launch this app as webstart</a><br><hr><br> |
||||
|
||||
<!-- Applet will be inserted here --> |
||||
<div id='javafx-app-placeholder'></div> |
||||
</body></html> |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<jnlp spec="1.0" xmlns:jfx="http://javafx.com" href="JavaFXTableExampleDist.jnlp"> |
||||
<information> |
||||
<title>JavaFXTableExampleDist</title> |
||||
<vendor>denis</vendor> |
||||
<description>null</description> |
||||
<offline-allowed/> |
||||
</information> |
||||
<resources> |
||||
<j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se"/> |
||||
<jar href="JavaFXTableExampleDist.jar" size="15331" download="eager" /> |
||||
<jar href="lib\derby.jar" size="3232770" download="eager" /> |
||||
<jar href="lib\derbyclient.jar" size="588394" download="eager" /> |
||||
<jar href="lib\derbynet.jar" size="272626" download="eager" /> |
||||
</resources> |
||||
<applet-desc width="800" height="600" main-class="com.javafx.main.NoJavaFXFallback" name="JavaFXTableExampleDist" > |
||||
<param name="requiredFXVersion" value="8.0+"/> |
||||
</applet-desc> |
||||
<jfx:javafx-desc width="800" height="600" main-class="javafxtableexampledist.Main" name="JavaFXTableExampleDist" /> |
||||
<update check="always"/> |
||||
</jnlp> |
After Width: | Height: | Size: 725 B |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 2.4 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,3 @@
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0 |
||||
X-COMMENT: Main-Class will be added automatically by build |
||||
|
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
# Do not modify this property in this configuration. It can be re-generated. |
||||
$label=\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043a\u0430\u043a WebStart |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
# Do not modify this property in this configuration. It can be re-generated. |
||||
$label=\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 |
@ -0,0 +1,8 @@
@@ -0,0 +1,8 @@
|
||||
build.xml.data.CRC32=dfec3d98 |
||||
build.xml.script.CRC32=4bdb3dab |
||||
build.xml.stylesheet.CRC32=8064a381@1.80.1.48 |
||||
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. |
||||
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. |
||||
nbproject/build-impl.xml.data.CRC32=dfec3d98 |
||||
nbproject/build-impl.xml.script.CRC32=5009d495 |
||||
nbproject/build-impl.xml.stylesheet.CRC32=830a3534@1.80.1.48 |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
# Do not modify this property in this configuration. It can be re-generated. |
||||
javafx.run.as=webstart |
@ -0,0 +1,2 @@
@@ -0,0 +1,2 @@
|
||||
# Do not modify this property in this configuration. It can be re-generated. |
||||
javafx.run.as=embedded |
@ -0,0 +1,12 @@
@@ -0,0 +1,12 @@
|
||||
auxiliary.org-netbeans-modules-projectapi.issue214819_5f_fx_5f_enabled=true |
||||
compile.on.save=true |
||||
do.depend=false |
||||
do.jar=true |
||||
# \u041d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0432 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u0441\u0432\u043e\u0439\u0441\u0442\u0432\u0430 \u0434\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0437\u0430\u0434\u0430\u0447\u0438 JavaFX Ant |
||||
endorsed.javafx.ant.classpath=. |
||||
javac.debug=true |
||||
javadoc.preview=true |
||||
javafx.run.as=standalone |
||||
javafx.run.inbrowser=<\u0411\u0440\u0430\u0443\u0437\u0435\u0440 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e> |
||||
javafx.run.inbrowser.path=C:\\Program Files\\Internet Explorer\\IEXPLORE.EXE |
||||
user.properties.file=C:\\Users\\denis.LAPTOP-4LI8UQ4O\\AppData\\Roaming\\NetBeans\\8.2\\build.properties |
@ -0,0 +1,124 @@
@@ -0,0 +1,124 @@
|
||||
annotation.processing.enabled=true |
||||
annotation.processing.enabled.in.editor=false |
||||
annotation.processing.processors.list= |
||||
annotation.processing.run.all.processors=true |
||||
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output |
||||
application.title=JavaFXTableExampleDist |
||||
application.vendor=denis |
||||
build.classes.dir=${build.dir}/classes |
||||
build.classes.excludes=**/*.java,**/*.form |
||||
# This directory is removed when the project is cleaned: |
||||
build.dir=build |
||||
build.generated.dir=${build.dir}/generated |
||||
build.generated.sources.dir=${build.dir}/generated-sources |
||||
# Only compile against the classpath explicitly listed here: |
||||
build.sysclasspath=ignore |
||||
build.test.classes.dir=${build.dir}/test/classes |
||||
build.test.results.dir=${build.dir}/test/results |
||||
compile.on.save=true |
||||
compile.on.save.unsupported.javafx=true |
||||
# Uncomment to specify the preferred debugger connection transport: |
||||
#debug.transport=dt_socket |
||||
debug.classpath=\ |
||||
${run.classpath} |
||||
debug.test.classpath=\ |
||||
${run.test.classpath} |
||||
# This directory is removed when the project is cleaned: |
||||
dist.dir=dist |
||||
dist.jar=${dist.dir}/JavaFXTableExampleDist.jar |
||||
dist.javadoc.dir=${dist.dir}/javadoc |
||||
endorsed.classpath= |
||||
excludes= |
||||
includes=** |
||||
# Non-JavaFX jar file creation is deactivated in JavaFX 2.0+ projects |
||||
jar.archive.disabled=true |
||||
jar.compress=false |
||||
javac.classpath=\ |
||||
${javafx.classpath.extension}:\ |
||||
${libs.JAVADB_DRIVER_LABEL.classpath} |
||||
# Space-separated list of extra javac options |
||||
javac.compilerargs= |
||||
javac.deprecation=false |
||||
javac.external.vm=false |
||||
javac.processorpath=\ |
||||
${javac.classpath} |
||||
javac.source=1.8 |
||||
javac.target=1.8 |
||||
javac.test.classpath=\ |
||||
${javac.classpath}:\ |
||||
${build.classes.dir} |
||||
javac.test.processorpath=\ |
||||
${javac.test.classpath} |
||||
javadoc.additionalparam= |
||||
javadoc.author=false |
||||
javadoc.encoding=${source.encoding} |
||||
javadoc.noindex=false |
||||
javadoc.nonavbar=false |
||||
javadoc.notree=false |
||||
javadoc.private=false |
||||
javadoc.splitindex=true |
||||
javadoc.use=true |
||||
javadoc.version=false |
||||
javadoc.windowtitle= |
||||
javafx.application.implementation.version=1.0 |
||||
javafx.binarycss=false |
||||
javafx.classpath.extension=\ |
||||
${java.home}/lib/javaws.jar:\ |
||||
${java.home}/lib/deploy.jar:\ |
||||
${java.home}/lib/plugin.jar |
||||
javafx.deploy.adddesktopshortcut=false |
||||
javafx.deploy.addstartmenushortcut=false |
||||
javafx.deploy.allowoffline=true |
||||
# If true, application update mode is set to 'background', if false, update mode is set to 'eager' |
||||
javafx.deploy.backgroundupdate=false |
||||
javafx.deploy.disable.proxy=false |
||||
javafx.deploy.embedJNLP=true |
||||
javafx.deploy.includeDT=true |
||||
javafx.deploy.installpermanently=false |
||||
javafx.deploy.permissionselevated=false |
||||
# \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 'true' \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043a\u043e\u043f\u0438\u0438 \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u043d\u0438\u044f \u0430\u0440\u0442\u0435\u0444\u0430\u043a\u0442\u043e\u0432 \u0434\u043e \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430 (\u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0438) |
||||
javafx.disable.concurrent.runs=false |
||||
# \u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 'true' \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 Run-in-Browser \u0438\u043b\u0438 WebStart |
||||
javafx.enable.concurrent.external.runs=false |
||||
# This is a JavaFX project |
||||
javafx.enabled=true |
||||
javafx.fallback.class=com.javafx.main.NoJavaFXFallback |
||||
# Main class for JavaFX |
||||
javafx.main.class=javafxtableexampledist.Main |
||||
javafx.preloader.class= |
||||
# This project does not use Preloader |
||||
javafx.preloader.enabled=false |
||||
javafx.preloader.jar.filename= |
||||
javafx.preloader.jar.path= |
||||
javafx.preloader.project.path= |
||||
javafx.preloader.type=none |
||||
# Set true for GlassFish only. Rebases manifest classpaths of JARs in lib dir. Not usable with signed JARs. |
||||
javafx.rebase.libs=false |
||||
javafx.run.height=600 |
||||
javafx.run.width=800 |
||||
javafx.signing.blob=false |
||||
javafx.signing.enabled=false |
||||
javafx.signing.type=notsigned |
||||
# Pre-JavaFX 2.0 WebStart is deactivated in JavaFX 2.0+ projects |
||||
jnlp.enabled=false |
||||
# Main class for Java launcher |
||||
main.class=com.javafx.main.Main |
||||
# \u0414\u043b\u044f \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0435\u043d\u0438\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0447\u043d\u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0430 Codebase \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f RIA |
||||
manifest.custom.codebase=* |
||||
# \u0423\u043a\u0430\u0436\u0438\u0442\u0435 \u0430\u0442\u0440\u0438\u0431\u0443\u0442 \u043c\u0430\u043d\u0438\u0444\u0435\u0441\u0442\u0430 Permissions \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e (\u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b: sandbox, all-permissions) |
||||
manifest.custom.permissions= |
||||
manifest.file=manifest.mf |
||||
meta.inf.dir=${src.dir}/META-INF |
||||
mkdist.disabled=false |
||||
native.bundling.enabled=false |
||||
platform.active=default_platform |
||||
run.classpath=\ |
||||
${dist.jar}:\ |
||||
${javac.classpath}:\ |
||||
${build.classes.dir} |
||||
run.test.classpath=\ |
||||
${javac.test.classpath}:\ |
||||
${build.test.classes.dir} |
||||
source.encoding=UTF-8 |
||||
src.dir=src |
||||
test.src.dir=test |
@ -0,0 +1,25 @@
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<project xmlns="http://www.netbeans.org/ns/project/1"> |
||||
<type>org.netbeans.modules.java.j2seproject</type> |
||||
<configuration> |
||||
<buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1"> |
||||
<extension file="jfx-impl.xml" id="jfx3"> |
||||
<dependency dependsOn="-jfx-copylibs" target="-post-jar"/> |
||||
<dependency dependsOn="-rebase-libs" target="-post-jar"/> |
||||
<dependency dependsOn="jfx-deployment" target="-post-jar"/> |
||||
<dependency dependsOn="jar" target="debug"/> |
||||
<dependency dependsOn="jar" target="profile"/> |
||||
<dependency dependsOn="jar" target="run"/> |
||||
</extension> |
||||
</buildExtensions> |
||||
<data xmlns="http://www.netbeans.org/ns/j2se-project/3"> |
||||
<name>JavaFXTableExampleDist</name> |
||||
<source-roots> |
||||
<root id="src.dir"/> |
||||
</source-roots> |
||||
<test-roots> |
||||
<root id="test.src.dir"/> |
||||
</test-roots> |
||||
</data> |
||||
</configuration> |
||||
</project> |
@ -0,0 +1,111 @@
@@ -0,0 +1,111 @@
|
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package javafxtableexampledist; |
||||
|
||||
import java.sql.Date; |
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* |
||||
* @author denis |
||||
*/ |
||||
public class Education { |
||||
private Integer id; |
||||
private String universityname; |
||||
private Date dateFinish; |
||||
private String city; |
||||
private Person person; |
||||
|
||||
public Education(Integer id, String universityname, Date dateFinish, String city) { |
||||
this.id = id; |
||||
this.universityname = universityname; |
||||
this.dateFinish = dateFinish; |
||||
this.city = city; |
||||
} |
||||
|
||||
public Person getPerson() { |
||||
return person; |
||||
} |
||||
|
||||
public void setPerson(Person person) { |
||||
this.person = person; |
||||
} |
||||
|
||||
public Integer getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Integer id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getUniversityname() { |
||||
return universityname; |
||||
} |
||||
|
||||
public void setUniversityname(String universityname) { |
||||
this.universityname = universityname; |
||||
} |
||||
|
||||
public Date getDateFinish() { |
||||
return dateFinish; |
||||
} |
||||
|
||||
public void setDateFinish(Date dateFinish) { |
||||
this.dateFinish = dateFinish; |
||||
} |
||||
|
||||
public String getCity() { |
||||
return city; |
||||
} |
||||
|
||||
public void setCity(String city) { |
||||
this.city = city; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
int hash = 7; |
||||
hash = 97 * hash + Objects.hashCode(this.id); |
||||
hash = 97 * hash + Objects.hashCode(this.universityname); |
||||
hash = 97 * hash + Objects.hashCode(this.dateFinish); |
||||
hash = 97 * hash + Objects.hashCode(this.city); |
||||
return hash; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) { |
||||
return true; |
||||
} |
||||
if (obj == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != obj.getClass()) { |
||||
return false; |
||||
} |
||||
final Education other = (Education) obj; |
||||
if (!Objects.equals(this.universityname, other.universityname)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.city, other.city)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.id, other.id)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.dateFinish, other.dateFinish)) { |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "Education{" + "id=" + id + ", universityname=" + universityname + ", dateFinish=" + dateFinish + ", city=" + city + '}'; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,38 @@
@@ -0,0 +1,38 @@
|
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package javafxtableexampledist; |
||||
|
||||
import java.io.IOException; |
||||
import java.util.logging.Level; |
||||
import java.util.logging.Logger; |
||||
import javafx.fxml.FXMLLoader; |
||||
import javafx.scene.Parent; |
||||
import javafx.scene.Scene; |
||||
import javafx.stage.Modality; |
||||
import javafx.stage.Stage; |
||||
|
||||
/** |
||||
* |
||||
* @author denis |
||||
*/ |
||||
public class EducationStage extends Stage{ |
||||
|
||||
public void init(Person person){ |
||||
Parent root; |
||||
try { |
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("FXMLEducation.fxml")); |
||||
root = loader.load(); |
||||
Scene scene = new Scene(root); |
||||
setScene(scene); |
||||
initModality(Modality.APPLICATION_MODAL); |
||||
((FXMLEducationController)loader.getController()).initTable(person); |
||||
showAndWait(); |
||||
} catch (IOException ex) { |
||||
Logger.getLogger(EducationStage.class.getName()).log(Level.SEVERE, null, ex); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,23 @@
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<?import java.lang.*?> |
||||
<?import java.util.*?> |
||||
<?import javafx.scene.*?> |
||||
<?import javafx.scene.control.*?> |
||||
<?import javafx.scene.layout.*?> |
||||
|
||||
<AnchorPane id="AnchorPane" prefHeight="800" prefWidth="1150" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafxtableexampledist.FXMLEducationController"> |
||||
<children> |
||||
<TableView fx:id="table" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> |
||||
<columns> |
||||
<TableColumn fx:id="idCol" prefWidth="100" text="ИД" /> |
||||
<TableColumn fx:id="universityCol" prefWidth="400" text="Университет" /> |
||||
<TableColumn fx:id="dateCol" prefWidth="200" text="Дата" /> |
||||
<TableColumn fx:id="cityCol" prefWidth="150" text="Город" /> |
||||
<TableColumn fx:id="idpersonCol" prefWidth="300" text="Персона" /> |
||||
</columns> |
||||
</TableView> |
||||
<!-- <Button layoutX="126" layoutY="90" text="Click Me!" onAction="#handleButtonAction" fx:id="button" /> |
||||
<Label layoutX="126" layoutY="120" minHeight="16" minWidth="69" fx:id="label" />--> |
||||
</children> |
||||
</AnchorPane> |
@ -0,0 +1,43 @@
@@ -0,0 +1,43 @@
|
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package javafxtableexampledist; |
||||
|
||||
import java.net.URL; |
||||
import java.util.ResourceBundle; |
||||
import javafx.collections.FXCollections; |
||||
import javafx.collections.ObservableList; |
||||
import javafx.fxml.FXML; |
||||
import javafx.fxml.Initializable; |
||||
import javafx.scene.control.TableView; |
||||
import javafx.scene.control.cell.PropertyValueFactory; |
||||
|
||||
/** |
||||
* FXML Controller class
|
||||
* |
||||
* @author denis |
||||
*/ |
||||
public class FXMLEducationController implements Initializable { |
||||
|
||||
@FXML |
||||
private TableView<Education> table; |
||||
|
||||
@Override |
||||
public void initialize(URL url, ResourceBundle rb) { |
||||
|
||||
table.getColumns().get(0).setCellValueFactory(new PropertyValueFactory<>("id")); |
||||
table.getColumns().get(1).setCellValueFactory(new PropertyValueFactory<>("universityname")); |
||||
table.getColumns().get(2).setCellValueFactory(new PropertyValueFactory<>("dateFinish")); |
||||
table.getColumns().get(3).setCellValueFactory(new PropertyValueFactory<>("city")); |
||||
table.getColumns().get(4).setCellValueFactory(new PropertyValueFactory<>("person")); |
||||
|
||||
} |
||||
|
||||
public void initTable(Person person){ |
||||
ObservableList<Education> educations = FXCollections.observableArrayList(new Repository().getEducationByPersonid(person.getId())); |
||||
table.setItems(educations); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,21 @@
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
||||
<?import java.lang.*?> |
||||
<?import java.util.*?> |
||||
<?import javafx.scene.*?> |
||||
<?import javafx.scene.control.*?> |
||||
<?import javafx.scene.layout.*?> |
||||
|
||||
<AnchorPane id="AnchorPane" prefHeight="200" prefWidth="320" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafxtableexampledist.FXMLMainController"> |
||||
<children> |
||||
<TableView onMouseClicked="#handleClickedAction" onKeyPressed="#handleKeyPressedAction" fx:id="table" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> |
||||
<columns> |
||||
<TableColumn fx:id="idCol" prefWidth="100" text="ИД" /> |
||||
<TableColumn fx:id="firstCol" prefWidth="200" text="Имя" /> |
||||
<TableColumn fx:id="lastCol" prefWidth="200" text="Фамилия" /> |
||||
<TableColumn fx:id="genderCol" prefWidth="150" text="Пол" /> |
||||
<TableColumn fx:id="countCol" prefWidth="50" text="Кол-во" /> |
||||
</columns> |
||||
</TableView> |
||||
</children> |
||||
</AnchorPane> |
@ -0,0 +1,78 @@
@@ -0,0 +1,78 @@
|
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package javafxtableexampledist; |
||||
|
||||
import java.net.URL; |
||||
import java.util.List; |
||||
import java.util.ResourceBundle; |
||||
import java.util.stream.Collectors; |
||||
import javafx.collections.FXCollections; |
||||
import javafx.collections.ObservableList; |
||||
import javafx.event.ActionEvent; |
||||
import javafx.fxml.FXML; |
||||
import javafx.fxml.Initializable; |
||||
import javafx.scene.control.Label; |
||||
import javafx.scene.control.TableColumn; |
||||
import javafx.scene.control.TableView; |
||||
import javafx.scene.control.cell.PropertyValueFactory; |
||||
import javafx.scene.input.KeyCode; |
||||
import javafx.scene.input.KeyEvent; |
||||
import javafx.scene.input.MouseEvent; |
||||
|
||||
/** |
||||
* |
||||
* @author denis |
||||
*/ |
||||
public class FXMLMainController implements Initializable { |
||||
|
||||
@FXML |
||||
private TableView<PersonDto> table; |
||||
@FXML |
||||
private TableColumn<PersonDto, Integer> idCol; |
||||
@FXML |
||||
private TableColumn<PersonDto, String> firstCol; |
||||
@FXML |
||||
private TableColumn<PersonDto, String> lastCol; |
||||
@FXML |
||||
private TableColumn<PersonDto, String> genderCol; |
||||
@FXML |
||||
private TableColumn<PersonDto, Integer> countCol; |
||||
|
||||
@FXML |
||||
private void handleClickedAction(MouseEvent event) { |
||||
if(event.getClickCount()==2){ |
||||
openEducationStage(); |
||||
} |
||||
} |
||||
|
||||
@FXML |
||||
private void handleKeyPressedAction(KeyEvent event){ |
||||
if(event.getCode()==KeyCode.ENTER){ |
||||
openEducationStage(); |
||||
} |
||||
} |
||||
|
||||
private void openEducationStage(){ |
||||
Repository repository = new Repository(); |
||||
int idperson = table.getSelectionModel().getSelectedItem().getId(); |
||||
Person person = repository.findPersonById(idperson); |
||||
new EducationStage().init(person); |
||||
} |
||||
|
||||
@Override |
||||
public void initialize(URL url, ResourceBundle rb) { |
||||
Repository repository = new Repository(); |
||||
List<Person> persons = repository.getAllPersonWithEducation(); |
||||
List<PersonDto> personDto = persons.stream().map(per -> new PersonDto(per)).collect(Collectors.toList()); |
||||
idCol.setCellValueFactory(new PropertyValueFactory<>("id")); |
||||
firstCol.setCellValueFactory(new PropertyValueFactory<>("firstname")); |
||||
lastCol.setCellValueFactory(new PropertyValueFactory<>("lastname")); |
||||
genderCol.setCellValueFactory(new PropertyValueFactory<>("gender")); |
||||
countCol.setCellValueFactory(new PropertyValueFactory<>("educationCount")); |
||||
table.setItems(FXCollections.observableArrayList(personDto)); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package javafxtableexampledist; |
||||
|
||||
import javafx.application.Application; |
||||
import javafx.fxml.FXMLLoader; |
||||
import javafx.scene.Parent; |
||||
import javafx.scene.Scene; |
||||
import javafx.stage.Stage; |
||||
|
||||
/** |
||||
* |
||||
* @author denis |
||||
*/ |
||||
public class Main extends Application { |
||||
|
||||
@Override |
||||
public void start(Stage stage) throws Exception { |
||||
Parent root = FXMLLoader.load(getClass().getResource("FXMLMain.fxml")); |
||||
|
||||
Scene scene = new Scene(root); |
||||
|
||||
stage.setScene(scene); |
||||
stage.show(); |
||||
} |
||||
|
||||
/** |
||||
* @param args the command line arguments |
||||
*/ |
||||
public static void main(String[] args) { |
||||
launch(args); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,122 @@
@@ -0,0 +1,122 @@
|
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package javafxtableexampledist; |
||||
|
||||
import java.util.HashSet; |
||||
import java.util.Objects; |
||||
import java.util.Set; |
||||
|
||||
/** |
||||
* |
||||
* @author denis |
||||
*/ |
||||
public class Person { |
||||
|
||||
private Integer id; |
||||
private String firstname; |
||||
private String lastname; |
||||
private String gender; |
||||
private Set<Education> educations = new HashSet<>(); |
||||
|
||||
public Person(){} |
||||
|
||||
public Person(Integer id, String firstname, String lastname, String gender) { |
||||
this.id = id; |
||||
this.firstname = firstname; |
||||
this.lastname = lastname; |
||||
this.gender = gender; |
||||
} |
||||
|
||||
public void addEducation(Education education){ |
||||
educations.add(education); |
||||
} |
||||
|
||||
public Set<Education> getEducations() { |
||||
return educations; |
||||
} |
||||
|
||||
public void setEducations(Set<Education> educations) { |
||||
this.educations = educations; |
||||
} |
||||
|
||||
public Integer getId() { |
||||
return id; |
||||
} |
||||
|
||||
public String getFirstname() { |
||||
return firstname; |
||||
} |
||||
|
||||
public String getLastname() { |
||||
return lastname; |
||||
} |
||||
|
||||
public String getGender() { |
||||
return gender; |
||||
} |
||||
|
||||
public void setId(Integer id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public void setFirstname(String firstname) { |
||||
this.firstname = firstname; |
||||
} |
||||
|
||||
public void setLastname(String lastname) { |
||||
this.lastname = lastname; |
||||
} |
||||
|
||||
public void setGender(String gender) { |
||||
this.gender = gender; |
||||
} |
||||
|
||||
|
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
int hash = 7; |
||||
hash = 97 * hash + Objects.hashCode(this.id); |
||||
hash = 97 * hash + Objects.hashCode(this.firstname); |
||||
hash = 97 * hash + Objects.hashCode(this.lastname); |
||||
hash = 97 * hash + Objects.hashCode(this.gender); |
||||
return hash; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) { |
||||
return true; |
||||
} |
||||
if (obj == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != obj.getClass()) { |
||||
return false; |
||||
} |
||||
final Person other = (Person) obj; |
||||
if (!Objects.equals(this.firstname, other.firstname)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.lastname, other.lastname)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.gender, other.gender)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.id, other.id)) { |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
|
||||
|
||||
@Override |
||||
public String toString() { |
||||
return firstname + " " + lastname + ", " + gender; |
||||
} |
||||
} |
@ -0,0 +1,115 @@
@@ -0,0 +1,115 @@
|
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package javafxtableexampledist; |
||||
|
||||
import java.util.Objects; |
||||
|
||||
/** |
||||
* |
||||
* @author denis |
||||
*/ |
||||
public class PersonDto { |
||||
|
||||
private Integer id; |
||||
private String firstname; |
||||
private String lastname; |
||||
private String gender; |
||||
private Integer educationCount; |
||||
|
||||
public PersonDto(Person person) { |
||||
id = person.getId(); |
||||
firstname = person.getFirstname(); |
||||
lastname = person.getLastname(); |
||||
gender = person.getGender(); |
||||
educationCount = person.getEducations().size(); |
||||
} |
||||
|
||||
public Integer getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(Integer id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getFirstname() { |
||||
return firstname; |
||||
} |
||||
|
||||
public void setFirstname(String firstname) { |
||||
this.firstname = firstname; |
||||
} |
||||
|
||||
public String getLastname() { |
||||
return lastname; |
||||
} |
||||
|
||||
public void setLastname(String lastname) { |
||||
this.lastname = lastname; |
||||
} |
||||
|
||||
public String getGender() { |
||||
return gender; |
||||
} |
||||
|
||||
public void setGender(String gender) { |
||||
this.gender = gender; |
||||
} |
||||
|
||||
public Integer getEducationCount() { |
||||
return educationCount; |
||||
} |
||||
|
||||
public void setEducationCount(Integer educationCount) { |
||||
this.educationCount = educationCount; |
||||
} |
||||
|
||||
@Override |
||||
public int hashCode() { |
||||
int hash = 7; |
||||
hash = 73 * hash + Objects.hashCode(this.id); |
||||
hash = 73 * hash + Objects.hashCode(this.firstname); |
||||
hash = 73 * hash + Objects.hashCode(this.lastname); |
||||
hash = 73 * hash + Objects.hashCode(this.gender); |
||||
hash = 73 * hash + Objects.hashCode(this.educationCount); |
||||
return hash; |
||||
} |
||||
|
||||
@Override |
||||
public boolean equals(Object obj) { |
||||
if (this == obj) { |
||||
return true; |
||||
} |
||||
if (obj == null) { |
||||
return false; |
||||
} |
||||
if (getClass() != obj.getClass()) { |
||||
return false; |
||||
} |
||||
final PersonDto other = (PersonDto) obj; |
||||
if (!Objects.equals(this.firstname, other.firstname)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.lastname, other.lastname)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.gender, other.gender)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.id, other.id)) { |
||||
return false; |
||||
} |
||||
if (!Objects.equals(this.educationCount, other.educationCount)) { |
||||
return false; |
||||
} |
||||
return true; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return "PersonDto{" + "id=" + id + ", firstname=" + firstname + ", lastname=" + lastname + ", gender=" + gender + ", educationCount=" + educationCount + '}'; |
||||
} |
||||
} |
@ -0,0 +1,120 @@
@@ -0,0 +1,120 @@
|
||||
/* |
||||
* To change this license header, choose License Headers in Project Properties. |
||||
* To change this template file, choose Tools | Templates |
||||
* and open the template in the editor. |
||||
*/ |
||||
package javafxtableexampledist; |
||||
|
||||
import java.sql.Connection; |
||||
import java.sql.Date; |
||||
import java.sql.DriverManager; |
||||
import java.sql.ResultSet; |
||||
import java.sql.SQLException; |
||||
import java.sql.Statement; |
||||
import java.util.ArrayList; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* |
||||
* @author denis |
||||
*/ |
||||
public class Repository { |
||||
|
||||
private String url = "jdbc:derby://localhost:1527/TrainingDatabase"; |
||||
private String user = "root"; |
||||
private String psw = "root"; |
||||
|
||||
public List<Person> getAllPersonWithEducation(){ |
||||
List<Person> persons = new ArrayList<>(); |
||||
try(Connection con = DriverManager.getConnection(url, user, psw); |
||||
Statement stm = con.createStatement()){ |
||||
try (ResultSet rs = stm.executeQuery("SELECT * FROM PERSON LEFT JOIN EDUCATION ON PERSON.ID=EDUCATION.PERSONID");){ |
||||
while(rs.next()){ |
||||
int personid = rs.getInt(1); |
||||
Person person = persons.stream().filter(per -> per.getId()==personid).findFirst().orElse(null); |
||||
if(person==null){ |
||||
String firstname = rs.getString(2); |
||||
String lastname = rs.getString(3); |
||||
String gender = rs.getString(4); |
||||
person = new Person(personid, firstname, lastname, gender); |
||||
persons.add(person); |
||||
} |
||||
if(rs.getString(5)!=null){ |
||||
int educationid = rs.getInt(5); |
||||
Integer educationid2 = Integer.valueOf(rs.getString(5)); |
||||
String universityname = rs.getString(6); |
||||
Date dateFinish = rs.getDate(7); |
||||
String city = rs.getString(8); |
||||
Education education = new Education(educationid, universityname, dateFinish, city); |
||||
person.addEducation(education); |
||||
education.setPerson(person); |
||||
} |
||||
} |
||||
} |
||||
}catch (SQLException e){ |
||||
e.printStackTrace(); |
||||
} |
||||
return persons; |
||||
} |
||||
|
||||
public List<Person> getAllPerson(){ |
||||
List<Person> persons = new ArrayList<>(); |
||||
try(Connection con = DriverManager.getConnection(url, user, psw); |
||||
Statement stm = con.createStatement()){ |
||||
try (ResultSet rs = stm.executeQuery("SELECT * FROM PERSON");){ |
||||
while(rs.next()){ |
||||
int id = rs.getInt(1); |
||||
String firstname = rs.getString(2); |
||||
String lastname = rs.getString(3); |
||||
String gender = rs.getString(4); |
||||
persons.add(new Person(id, firstname, lastname, gender)); |
||||
} |
||||
} |
||||
}catch (SQLException e){ |
||||
e.printStackTrace(); |
||||
} |
||||
return persons; |
||||
} |
||||
|
||||
public Person findPersonById(int id){ |
||||
Person person = new Person(); |
||||
try(Connection con = DriverManager.getConnection(url, user, psw); |
||||
Statement stm = con.createStatement()){ |
||||
try (ResultSet rs = stm.executeQuery("SELECT * FROM PERSON WHERE id=" + id);){ |
||||
if(rs.next()){ |
||||
person.setId(rs.getInt(1)); |
||||
person.setFirstname(rs.getString(2)); |
||||
person.setLastname(rs.getString(3)); |
||||
person.setGender(rs.getString(4)); |
||||
} |
||||
} |
||||
}catch (SQLException e){ |
||||
e.printStackTrace(); |
||||
} |
||||
return person; |
||||
} |
||||
|
||||
public List<Education> getEducationByPersonid(int personid){ |
||||
List<Education> educations = new ArrayList<>(); |
||||
|
||||
try(Connection con = DriverManager.getConnection(url, user, psw); |
||||
Statement stm = con.createStatement()){ |
||||
try (ResultSet rs = stm.executeQuery("SELECT * FROM EDUCATION WHERE PERSONID=" + personid)){ |
||||
while(rs.next()){ |
||||
int id = rs.getInt(1); |
||||
String universityname = rs.getString(2); |
||||
Date dateFinish = rs.getDate(3); |
||||
String city = rs.getString(4); |
||||
Education education = new Education(id, universityname, dateFinish, city); |
||||
education.setPerson(findPersonById(personid)); |
||||
educations.add(education); |
||||
} |
||||
} |
||||
}catch (SQLException e){ |
||||
e.printStackTrace(); |
||||
} |
||||
|
||||
return educations; |
||||
} |
||||
|
||||
} |