initial commit
This commit is contained in:
109
.gitignore
vendored
Normal file
109
.gitignore
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/intellij
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij
|
||||
|
||||
### Intellij ###
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
|
||||
### Intellij Patch ###
|
||||
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||
|
||||
# *.iml
|
||||
# modules.xml
|
||||
# .idea/misc.xml
|
||||
# *.ipr
|
||||
|
||||
# Sonarlint plugin
|
||||
# https://plugins.jetbrains.com/plugin/7973-sonarlint
|
||||
.idea/**/sonarlint/
|
||||
|
||||
# SonarQube Plugin
|
||||
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
|
||||
.idea/**/sonarIssues.xml
|
||||
|
||||
# Markdown Navigator plugin
|
||||
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
|
||||
.idea/**/markdown-navigator.xml
|
||||
.idea/**/markdown-navigator-enh.xml
|
||||
.idea/**/markdown-navigator/
|
||||
|
||||
# Cache file creation bug
|
||||
# See https://youtrack.jetbrains.com/issue/JBR-2257
|
||||
.idea/$CACHE_FILE$
|
||||
|
||||
# CodeStream plugin
|
||||
# https://plugins.jetbrains.com/plugin/12206-codestream
|
||||
.idea/codestream.xml
|
||||
|
||||
# End of https://www.toptal.com/developers/gitignore/api/intellij
|
||||
|
||||
10
.idea/artifacts/KinoViewer_jar.xml
generated
Normal file
10
.idea/artifacts/KinoViewer_jar.xml
generated
Normal file
@@ -0,0 +1,10 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="KinoViewer:jar">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/KinoViewer_jar</output-path>
|
||||
<root id="archive" name="KinoViewer.jar">
|
||||
<element id="module-output" name="KinoViewer" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/jfxrt.jar" path-in-jar="/" />
|
||||
<element id="extracted-dir" path="$PROJECT_DIR$/lib/mysql-connector-java-5.1.42-bin.jar" path-in-jar="/" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
23
.idea/compiler.xml
generated
Normal file
23
.idea/compiler.xml
generated
Normal file
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="!?*.java" />
|
||||
<entry name="!?*.form" />
|
||||
<entry name="!?*.class" />
|
||||
<entry name="!?*.groovy" />
|
||||
<entry name="!?*.scala" />
|
||||
<entry name="!?*.flex" />
|
||||
<entry name="!?*.kt" />
|
||||
<entry name="!?*.clj" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="false">
|
||||
<processorPath useClasspath="true" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
1
.idea/description.html
generated
Normal file
1
.idea/description.html
generated
Normal file
@@ -0,0 +1 @@
|
||||
<html>Simple <b>Java</b> application that includes a class with <code>main()</code> method</html>
|
||||
5
.idea/encodings.xml
generated
Normal file
5
.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
</project>
|
||||
|
||||
7
.idea/kotlinc.xml
generated
Normal file
7
.idea/kotlinc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="KotlinCommonCompilerArguments">
|
||||
<option name="languageVersion" value="1.1" />
|
||||
<option name="apiVersion" value="1.1" />
|
||||
</component>
|
||||
</project>
|
||||
50
.idea/misc.xml
generated
Normal file
50
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ClientPropertiesManager">
|
||||
<properties class="javax.swing.AbstractButton">
|
||||
<property name="hideActionText" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JComponent">
|
||||
<property name="html.disable" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JEditorPane">
|
||||
<property name="JEditorPane.w3cLengthUnits" class="java.lang.Boolean" />
|
||||
<property name="JEditorPane.honorDisplayProperties" class="java.lang.Boolean" />
|
||||
<property name="charset" class="java.lang.String" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JList">
|
||||
<property name="List.isFileList" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JPasswordField">
|
||||
<property name="JPasswordField.cutCopyAllowed" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JSlider">
|
||||
<property name="Slider.paintThumbArrowShape" class="java.lang.Boolean" />
|
||||
<property name="JSlider.isFilled" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JTable">
|
||||
<property name="Table.isFileList" class="java.lang.Boolean" />
|
||||
<property name="JTable.autoStartsEdit" class="java.lang.Boolean" />
|
||||
<property name="terminateEditOnFocusLost" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JToolBar">
|
||||
<property name="JToolBar.isRollover" class="java.lang.Boolean" />
|
||||
</properties>
|
||||
<properties class="javax.swing.JTree">
|
||||
<property name="JTree.lineStyle" class="java.lang.String" />
|
||||
</properties>
|
||||
<properties class="javax.swing.text.JTextComponent">
|
||||
<property name="caretAspectRatio" class="java.lang.Double" />
|
||||
<property name="caretWidth" class="java.lang.Integer" />
|
||||
</properties>
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="ProjectKey">
|
||||
<option name="state" value="project://63537948-39a4-48a0-9c97-34259a0fa913" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/KinoViewer.iml" filepath="$PROJECT_DIR$/KinoViewer.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
7
.idea/vcs.xml
generated
Normal file
7
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
12
KinoViewer.iml
Normal file
12
KinoViewer.iml
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" exported="" name="lib" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
BIN
amd64/libglass.so
Normal file
BIN
amd64/libglass.so
Normal file
Binary file not shown.
BIN
amd64/libprism_es2.so
Normal file
BIN
amd64/libprism_es2.so
Normal file
Binary file not shown.
BIN
lib/jfxrt.jar
Normal file
BIN
lib/jfxrt.jar
Normal file
Binary file not shown.
BIN
lib/mysql-connector-java-5.1.42-bin.jar
Normal file
BIN
lib/mysql-connector-java-5.1.42-bin.jar
Normal file
Binary file not shown.
3
src/META-INF/MANIFEST.MF
Normal file
3
src/META-INF/MANIFEST.MF
Normal file
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: sample.Main
|
||||
|
||||
35
src/sample/Chair.java
Normal file
35
src/sample/Chair.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package sample;
|
||||
|
||||
/**
|
||||
* Created by sebastian on 09.05.17.
|
||||
*/
|
||||
public class Chair {
|
||||
private final int row;
|
||||
private final int pos;
|
||||
private final boolean isUsed;
|
||||
private final double price;
|
||||
|
||||
public Chair(int row, int pos, boolean isUsed, double price) {
|
||||
|
||||
this.row = row;
|
||||
this.pos = pos;
|
||||
this.isUsed = isUsed;
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public int getRow() {
|
||||
return row;
|
||||
}
|
||||
|
||||
public int getPos() {
|
||||
return pos;
|
||||
}
|
||||
|
||||
public boolean isUsed() {
|
||||
return isUsed;
|
||||
}
|
||||
|
||||
public double getPrice() {
|
||||
return price;
|
||||
}
|
||||
}
|
||||
45
src/sample/ChairIterator.java
Normal file
45
src/sample/ChairIterator.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package sample;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created by sebastian on 09.05.17.
|
||||
*/
|
||||
public class ChairIterator implements Iterator<Chair> {
|
||||
|
||||
private ResultSet resultSet;
|
||||
private boolean hasNext = false;
|
||||
|
||||
public ChairIterator(ResultSet resultSet) throws SQLException {
|
||||
this.resultSet = resultSet;
|
||||
hasNext = resultSet.next();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return hasNext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Chair next() {
|
||||
if (!hasNext) {
|
||||
return null;
|
||||
} else {
|
||||
try {
|
||||
Chair chair = new Chair(
|
||||
resultSet.getInt("Row"),
|
||||
resultSet.getInt("Pos"),
|
||||
resultSet.getBoolean("isUsed"),
|
||||
resultSet.getDouble("Price")
|
||||
);
|
||||
hasNext = resultSet.next();
|
||||
return chair;
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
src/sample/ChoiceValue.java
Normal file
23
src/sample/ChoiceValue.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package sample;
|
||||
|
||||
/**
|
||||
* Created by sebastian on 08.05.17.
|
||||
*/
|
||||
public class ChoiceValue {
|
||||
|
||||
private final int key;
|
||||
private final String value;
|
||||
|
||||
ChoiceValue(int key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
int getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
75
src/sample/Controller.java
Normal file
75
src/sample/Controller.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package sample;
|
||||
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.fxml.FXML;
|
||||
import javafx.scene.canvas.Canvas;
|
||||
import javafx.scene.canvas.GraphicsContext;
|
||||
import javafx.scene.control.ChoiceBox;
|
||||
import javafx.scene.paint.Color;
|
||||
import javafx.scene.text.TextAlignment;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Controller {
|
||||
private static final String CLASS_NAME = Controller.class.getName();
|
||||
private DataHandler dataHandler = null;
|
||||
|
||||
@FXML
|
||||
public ChoiceBox<ChoiceValue> fxChoiceBox;
|
||||
public Canvas fxCanvas;
|
||||
|
||||
@FXML
|
||||
public void initialize() {
|
||||
try {
|
||||
dataHandler = new DataHandler("sebse.de", 3306, "db_vorlesung", "db_vorlesung", "db_vorlesung");
|
||||
ArrayList<ChoiceValue> choices = dataHandler.getPresentations();
|
||||
fxChoiceBox.getItems().addAll(choices);
|
||||
} catch (SQLException e) {
|
||||
Log.severe(CLASS_NAME, "SQL-Fehler!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
GraphicsContext context = fxCanvas.getGraphicsContext2D();
|
||||
|
||||
fxChoiceBox.getSelectionModel().selectedIndexProperty().addListener((ObservableValue<? extends Number> observableValue, Number number, Number t1) -> {
|
||||
|
||||
if (dataHandler != null) {
|
||||
try {
|
||||
HallDimens dimens = dataHandler.getHallDimentions(fxChoiceBox.getItems().get(t1.intValue()).getKey());
|
||||
Log.finer(CLASS_NAME, dimens != null);
|
||||
if (dimens != null) {
|
||||
Log.finer(CLASS_NAME, dimens.toString());
|
||||
|
||||
double width = fxCanvas.getWidth()/(dimens.getWidth()+2);
|
||||
double height = fxCanvas.getHeight()/(dimens.getHeight()+4);
|
||||
|
||||
context.setFill(Color.LAVENDER);
|
||||
context.fillRect(0, 0, fxCanvas.getWidth(), fxCanvas.getHeight());
|
||||
|
||||
context.setStroke(Color.BLACK);
|
||||
context.setFill(Color.BLACK);
|
||||
for (ChairIterator iter = dataHandler.getChairIterator(fxChoiceBox.getItems().get(t1.intValue()).getKey()); iter.hasNext(); ) {
|
||||
Chair chair = iter.next();
|
||||
if (chair.isUsed())
|
||||
context.fillRect(width*chair.getPos(), height*chair.getRow(), width, height);
|
||||
else
|
||||
context.strokeRect(width*chair.getPos(), height*chair.getRow(), width, height);
|
||||
}
|
||||
|
||||
context.fillRect(width, height*(dimens.getHeight()+2), width*dimens.getWidth(), height);
|
||||
context.setStroke(Color.RED);
|
||||
context.setTextAlign(TextAlignment.CENTER);
|
||||
context.strokeText("Leinwand", fxCanvas.getWidth()/2, height*(dimens.getHeight()+3));
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
context.setFill(Color.LAVENDER);
|
||||
context.fillRect(0, 0, fxCanvas.widthProperty().doubleValue(), fxCanvas.heightProperty().doubleValue());
|
||||
}
|
||||
}
|
||||
102
src/sample/DataHandler.java
Normal file
102
src/sample/DataHandler.java
Normal file
@@ -0,0 +1,102 @@
|
||||
package sample;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Created by sebastian on 08.05.17.
|
||||
*/
|
||||
public class DataHandler {
|
||||
private static final String CLASS_NAME = DataHandler.class.getName();
|
||||
|
||||
private final String host;
|
||||
private final int port;
|
||||
private final String user;
|
||||
private final String pwd;
|
||||
private String database;
|
||||
private final Connection connect;
|
||||
|
||||
public DataHandler(String host, int port, String user, String pwd, String database) throws SQLException {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.user = user;
|
||||
this.pwd = pwd;
|
||||
this.database = database;
|
||||
|
||||
// This will load the MySQL driver, each DB has its own driver
|
||||
try {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
} catch (ClassNotFoundException e) {
|
||||
Log.severe(CLASS_NAME, "MySQL driver not found!");
|
||||
e.printStackTrace();
|
||||
}
|
||||
// Setup the connection with the DB
|
||||
connect = DriverManager
|
||||
.getConnection("jdbc:mysql://"+host+":"+port+"/"+database+"?"
|
||||
+ "user="+user+"&password="+pwd+"");
|
||||
|
||||
}
|
||||
|
||||
public ArrayList<ChoiceValue> getPresentations() throws SQLException {
|
||||
ArrayList<ChoiceValue> choices = new ArrayList<>();
|
||||
|
||||
Statement stmt = connect.createStatement();
|
||||
ResultSet rs = stmt.executeQuery("SELECT ID, Saalname, Beginn, Filmname FROM v_Vorstellung");
|
||||
|
||||
while (rs.next()) {
|
||||
choices.add(new ChoiceValue(rs.getInt("ID"), rs.getString("Saalname")+" - "+rs.getString("Beginn")+" - "+rs.getString("Filmname")));
|
||||
}
|
||||
return choices;
|
||||
}
|
||||
|
||||
|
||||
public HallDimens getHallDimentions(int presID) throws SQLException {
|
||||
PreparedStatement stmt = connect.prepareStatement(
|
||||
"SELECT MIN(Sitzplatz.Reihe) `MinReihe`, MIN(Sitzplatz.Platz) `MinPlatz`, " +
|
||||
"MAX(Sitzplatz.Reihe) `MaxReihe`, MAX(Sitzplatz.Platz) `MaxPlatz` " +
|
||||
"FROM Saal " +
|
||||
"JOIN Sitzplatz ON Saal.ID = Sitzplatz.fk_Saal_ID " +
|
||||
"JOIN Vorstellung ON Saal.ID = Vorstellung.fk_Saal_ID " +
|
||||
"WHERE Vorstellung.ID=? " +
|
||||
"GROUP BY Saal.ID"
|
||||
);
|
||||
stmt.setInt(1, presID);
|
||||
Log.finer(CLASS_NAME, stmt.toString());
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
if (rs.next())
|
||||
return new HallDimens(
|
||||
rs.getInt("MinPlatz"),
|
||||
rs.getInt("MinReihe"),
|
||||
rs.getInt("MaxPlatz"),
|
||||
rs.getInt("MaxReihe")
|
||||
);
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public ChairIterator getChairIterator(int presID) throws SQLException {
|
||||
PreparedStatement stmt = connect.prepareStatement(
|
||||
"SELECT *, COUNT(*)=2 `isUsed` FROM ((" +
|
||||
"SELECT Sitzplatz.Reihe `Row`, Sitzplatz.Platz `Pos`, Sitzplatz.Preis `Price` " +
|
||||
"FROM Vorstellung " +
|
||||
"JOIN Saal ON Vorstellung.fk_Saal_ID = Saal.ID " +
|
||||
"JOIN Sitzplatz ON Saal.ID = Sitzplatz.fk_Saal_ID " +
|
||||
"WHERE Vorstellung.ID=?" +
|
||||
") UNION ALL (" +
|
||||
"SELECT Sitzplatz.Reihe `Row`, Sitzplatz.Platz `Pos`, Sitzplatz.Preis `Price` " +
|
||||
"FROM Vorstellung " +
|
||||
"JOIN Reservierung ON Vorstellung.ID = Reservierung.fk_Vorstellung_ID " +
|
||||
"JOIN nm_Reservierung_Sitzplatz ON Reservierung.ID = nm_Reservierung_Sitzplatz.fk_Reservierung_ID " +
|
||||
"JOIN Sitzplatz ON nm_Reservierung_Sitzplatz.fk_Sitzplatz_ID = Sitzplatz.ID " +
|
||||
"WHERE Vorstellung.ID=?" +
|
||||
")) t GROUP BY `Row`, `Pos`, `Price`"
|
||||
);
|
||||
stmt.setInt(1, presID);
|
||||
stmt.setInt(2, presID);
|
||||
ResultSet rs = stmt.executeQuery();
|
||||
return new ChairIterator(rs);
|
||||
}
|
||||
|
||||
}
|
||||
46
src/sample/HallDimens.java
Normal file
46
src/sample/HallDimens.java
Normal file
@@ -0,0 +1,46 @@
|
||||
package sample;
|
||||
|
||||
/**
|
||||
* Created by sebastian on 08.05.17.
|
||||
*/
|
||||
public class HallDimens {
|
||||
private final int minWidth;
|
||||
private final int minHeight;
|
||||
private final int maxWidth;
|
||||
private final int maxHeight;
|
||||
|
||||
public HallDimens(int minWidth, int minHeight, int maxWidth, int maxHeight) {
|
||||
this.minWidth = minWidth;
|
||||
this.minHeight = minHeight;
|
||||
this.maxWidth = maxWidth;
|
||||
this.maxHeight = maxHeight;
|
||||
}
|
||||
|
||||
public int getMinWidth() {
|
||||
return minWidth;
|
||||
}
|
||||
|
||||
public int getMinHeight() {
|
||||
return minHeight;
|
||||
}
|
||||
|
||||
public int getMaxWidth() {
|
||||
return maxWidth;
|
||||
}
|
||||
|
||||
public int getMaxHeight() {
|
||||
return maxHeight;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return maxWidth-minWidth+1;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return maxHeight-minHeight+1;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "mw: "+getMinWidth()+"mh: "+getMinHeight()+"w: "+getWidth()+"h: "+getHeight();
|
||||
}
|
||||
}
|
||||
61
src/sample/Log.java
Normal file
61
src/sample/Log.java
Normal file
@@ -0,0 +1,61 @@
|
||||
package sample;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.logging.ConsoleHandler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
/**
|
||||
* Created by sebastian on 08.05.17.
|
||||
*/
|
||||
@SuppressWarnings("WeakerAccess")
|
||||
public class Log {
|
||||
private static final Level LOG_LEVEL = Level.FINEST;
|
||||
|
||||
|
||||
private static HashMap<String, Logger> logger = new HashMap<>();
|
||||
private static ConsoleHandler consoleHandler;
|
||||
|
||||
public static Logger getLogger(String key) {
|
||||
if (!logger.containsKey(key)) {
|
||||
Logger newLogger = Logger.getLogger(key);
|
||||
newLogger.setLevel(LOG_LEVEL);
|
||||
newLogger.addHandler(getConsoleHandler());
|
||||
logger.put(key, newLogger);
|
||||
}
|
||||
|
||||
return logger.get(key);
|
||||
}
|
||||
|
||||
private static ConsoleHandler getConsoleHandler() {
|
||||
if (consoleHandler == null) {
|
||||
consoleHandler = new ConsoleHandler();
|
||||
consoleHandler.setLevel(Level.FINEST);
|
||||
}
|
||||
return consoleHandler;
|
||||
}
|
||||
|
||||
public static void finer(String key, String log) {
|
||||
getLogger(key).log(Level.FINER, log);
|
||||
}
|
||||
|
||||
public static void finer(String key, int log) {
|
||||
getLogger(key).log(Level.FINER, String.valueOf(log));
|
||||
}
|
||||
|
||||
public static void finer(String key, boolean log) {
|
||||
getLogger(key).log(Level.FINER, String.valueOf(log));
|
||||
}
|
||||
|
||||
public static void severe(String key, String log) {
|
||||
getLogger(key).log(Level.SEVERE, log);
|
||||
}
|
||||
|
||||
public static void severe(String key, int log) {
|
||||
getLogger(key).log(Level.SEVERE, String.valueOf(log));
|
||||
}
|
||||
|
||||
public static void severe(String key, boolean log) {
|
||||
getLogger(key).log(Level.SEVERE, String.valueOf(log));
|
||||
}
|
||||
}
|
||||
27
src/sample/Main.java
Normal file
27
src/sample/Main.java
Normal file
@@ -0,0 +1,27 @@
|
||||
package sample;
|
||||
|
||||
import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Parent;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
public class Main extends Application {
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception{
|
||||
Parent root = FXMLLoader.load(getClass().getResource("sample.fxml"));
|
||||
primaryStage.setTitle("KinoViewer");
|
||||
primaryStage.setScene(new Scene(root, 800, 600));
|
||||
primaryStage.setMinWidth(800);
|
||||
primaryStage.setMaxWidth(800);
|
||||
primaryStage.setMinHeight(600);
|
||||
primaryStage.setMaxHeight(600);
|
||||
primaryStage.show();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
launch(args);
|
||||
}
|
||||
}
|
||||
25
src/sample/sample.fxml
Normal file
25
src/sample/sample.fxml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.canvas.Canvas?>
|
||||
<?import javafx.scene.control.ChoiceBox?>
|
||||
<?import javafx.scene.control.Label?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<VBox prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.112" xmlns:fx="http://javafx.com/fxml/1" fx:controller="sample.Controller">
|
||||
<children>
|
||||
<HBox alignment="CENTER_LEFT" prefHeight="50.0">
|
||||
<children>
|
||||
<Label text="Vorstellung: " />
|
||||
<ChoiceBox fx:id="fxChoiceBox" prefHeight="26.0" prefWidth="690.0" />
|
||||
|
||||
</children>
|
||||
</HBox>
|
||||
<Canvas fx:id="fxCanvas" height="550" width="800">
|
||||
<VBox.margin>
|
||||
<Insets />
|
||||
</VBox.margin>
|
||||
</Canvas>
|
||||
</children>
|
||||
</VBox>
|
||||
Reference in New Issue
Block a user