Clean initial
This commit is contained in:
		
						commit
						a2035a8486
					
				
					 21 changed files with 1193 additions and 0 deletions
				
			
		
							
								
								
									
										28
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								.gitignore
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,28 @@ | |||
| # Ignore Gradle project-specific cache directory | ||||
| .gradle | ||||
| 
 | ||||
| # Ignore Gradle build output directory | ||||
| build | ||||
| 
 | ||||
| *.gradle | ||||
| 
 | ||||
| **/build/ | ||||
| !src/**/build/ | ||||
| 
 | ||||
| # Ignore Gradle GUI config | ||||
| gradle-app.setting | ||||
| 
 | ||||
| # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) | ||||
| !gradle-wrapper.jar | ||||
| 
 | ||||
| # Avoid ignore Gradle wrappper properties | ||||
| !gradle-wrapper.properties | ||||
| 
 | ||||
| # Cache of project | ||||
| .gradletasknamecache | ||||
| 
 | ||||
| # Eclipse Gradle plugin generated files | ||||
| # Eclipse Core | ||||
| .project | ||||
| # JDT-specific (Eclipse Java Development Tools) | ||||
| .classpath.class | ||||
							
								
								
									
										
											BIN
										
									
								
								gradle/wrapper/gradle-wrapper.jar
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								gradle/wrapper/gradle-wrapper.jar
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										5
									
								
								gradle/wrapper/gradle-wrapper.properties
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								gradle/wrapper/gradle-wrapper.properties
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,5 @@ | |||
| distributionBase=GRADLE_USER_HOME | ||||
| distributionPath=wrapper/dists | ||||
| distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip | ||||
| zipStoreBase=GRADLE_USER_HOME | ||||
| zipStorePath=wrapper/dists | ||||
							
								
								
									
										188
									
								
								gradlew
									
										
									
									
										vendored
									
									
										Executable file
									
								
							
							
						
						
									
										188
									
								
								gradlew
									
										
									
									
										vendored
									
									
										Executable file
									
								
							|  | @ -0,0 +1,188 @@ | |||
| #!/usr/bin/env sh | ||||
| 
 | ||||
| # | ||||
| # Copyright 2015 the original author or authors. | ||||
| # | ||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| # you may not use this file except in compliance with the License. | ||||
| # You may obtain a copy of the License at | ||||
| # | ||||
| #      http://www.apache.org/licenses/LICENSE-2.0 | ||||
| # | ||||
| # Unless required by applicable law or agreed to in writing, software | ||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| # See the License for the specific language governing permissions and | ||||
| # limitations under the License. | ||||
| # | ||||
| 
 | ||||
| ############################################################################## | ||||
| ## | ||||
| ##  Gradle start up script for UN*X | ||||
| ## | ||||
| ############################################################################## | ||||
| 
 | ||||
| # Attempt to set APP_HOME | ||||
| # Resolve links: $0 may be a link | ||||
| PRG="$0" | ||||
| # Need this for relative symlinks. | ||||
| while [ -h "$PRG" ] ; do | ||||
|     ls=`ls -ld "$PRG"` | ||||
|     link=`expr "$ls" : '.*-> \(.*\)$'` | ||||
|     if expr "$link" : '/.*' > /dev/null; then | ||||
|         PRG="$link" | ||||
|     else | ||||
|         PRG=`dirname "$PRG"`"/$link" | ||||
|     fi | ||||
| done | ||||
| SAVED="`pwd`" | ||||
| cd "`dirname \"$PRG\"`/" >/dev/null | ||||
| APP_HOME="`pwd -P`" | ||||
| cd "$SAVED" >/dev/null | ||||
| 
 | ||||
| APP_NAME="Gradle" | ||||
| APP_BASE_NAME=`basename "$0"` | ||||
| 
 | ||||
| # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||||
| DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' | ||||
| 
 | ||||
| # Use the maximum available, or set MAX_FD != -1 to use that value. | ||||
| MAX_FD="maximum" | ||||
| 
 | ||||
| warn () { | ||||
|     echo "$*" | ||||
| } | ||||
| 
 | ||||
| die () { | ||||
|     echo | ||||
|     echo "$*" | ||||
|     echo | ||||
|     exit 1 | ||||
| } | ||||
| 
 | ||||
| # OS specific support (must be 'true' or 'false'). | ||||
| cygwin=false | ||||
| msys=false | ||||
| darwin=false | ||||
| nonstop=false | ||||
| case "`uname`" in | ||||
|   CYGWIN* ) | ||||
|     cygwin=true | ||||
|     ;; | ||||
|   Darwin* ) | ||||
|     darwin=true | ||||
|     ;; | ||||
|   MINGW* ) | ||||
|     msys=true | ||||
|     ;; | ||||
|   NONSTOP* ) | ||||
|     nonstop=true | ||||
|     ;; | ||||
| esac | ||||
| 
 | ||||
| CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar | ||||
| 
 | ||||
| # Determine the Java command to use to start the JVM. | ||||
| if [ -n "$JAVA_HOME" ] ; then | ||||
|     if [ -x "$JAVA_HOME/jre/sh/java" ] ; then | ||||
|         # IBM's JDK on AIX uses strange locations for the executables | ||||
|         JAVACMD="$JAVA_HOME/jre/sh/java" | ||||
|     else | ||||
|         JAVACMD="$JAVA_HOME/bin/java" | ||||
|     fi | ||||
|     if [ ! -x "$JAVACMD" ] ; then | ||||
|         die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME | ||||
| 
 | ||||
| Please set the JAVA_HOME variable in your environment to match the | ||||
| location of your Java installation." | ||||
|     fi | ||||
| else | ||||
|     JAVACMD="java" | ||||
|     which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||||
| 
 | ||||
| Please set the JAVA_HOME variable in your environment to match the | ||||
| location of your Java installation." | ||||
| fi | ||||
| 
 | ||||
| # Increase the maximum file descriptors if we can. | ||||
| if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then | ||||
|     MAX_FD_LIMIT=`ulimit -H -n` | ||||
|     if [ $? -eq 0 ] ; then | ||||
|         if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then | ||||
|             MAX_FD="$MAX_FD_LIMIT" | ||||
|         fi | ||||
|         ulimit -n $MAX_FD | ||||
|         if [ $? -ne 0 ] ; then | ||||
|             warn "Could not set maximum file descriptor limit: $MAX_FD" | ||||
|         fi | ||||
|     else | ||||
|         warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" | ||||
|     fi | ||||
| fi | ||||
| 
 | ||||
| # For Darwin, add options to specify how the application appears in the dock | ||||
| if $darwin; then | ||||
|     GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" | ||||
| fi | ||||
| 
 | ||||
| # For Cygwin, switch paths to Windows format before running java | ||||
| if $cygwin ; then | ||||
|     APP_HOME=`cygpath --path --mixed "$APP_HOME"` | ||||
|     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` | ||||
|     JAVACMD=`cygpath --unix "$JAVACMD"` | ||||
| 
 | ||||
|     # We build the pattern for arguments to be converted via cygpath | ||||
|     ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` | ||||
|     SEP="" | ||||
|     for dir in $ROOTDIRSRAW ; do | ||||
|         ROOTDIRS="$ROOTDIRS$SEP$dir" | ||||
|         SEP="|" | ||||
|     done | ||||
|     OURCYGPATTERN="(^($ROOTDIRS))" | ||||
|     # Add a user-defined pattern to the cygpath arguments | ||||
|     if [ "$GRADLE_CYGPATTERN" != "" ] ; then | ||||
|         OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" | ||||
|     fi | ||||
|     # Now convert the arguments - kludge to limit ourselves to /bin/sh | ||||
|     i=0 | ||||
|     for arg in "$@" ; do | ||||
|         CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` | ||||
|         CHECK2=`echo "$arg"|egrep -c "^-"`                                 ### Determine if an option | ||||
| 
 | ||||
|         if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then                    ### Added a condition | ||||
|             eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` | ||||
|         else | ||||
|             eval `echo args$i`="\"$arg\"" | ||||
|         fi | ||||
|         i=$((i+1)) | ||||
|     done | ||||
|     case $i in | ||||
|         (0) set -- ;; | ||||
|         (1) set -- "$args0" ;; | ||||
|         (2) set -- "$args0" "$args1" ;; | ||||
|         (3) set -- "$args0" "$args1" "$args2" ;; | ||||
|         (4) set -- "$args0" "$args1" "$args2" "$args3" ;; | ||||
|         (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; | ||||
|         (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; | ||||
|         (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; | ||||
|         (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; | ||||
|         (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; | ||||
|     esac | ||||
| fi | ||||
| 
 | ||||
| # Escape application args | ||||
| save () { | ||||
|     for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done | ||||
|     echo " " | ||||
| } | ||||
| APP_ARGS=$(save "$@") | ||||
| 
 | ||||
| # Collect all arguments for the java command, following the shell quoting and substitution rules | ||||
| eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" | ||||
| 
 | ||||
| # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong | ||||
| if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then | ||||
|   cd "$(dirname "$0")" | ||||
| fi | ||||
| 
 | ||||
| exec "$JAVACMD" "$@" | ||||
							
								
								
									
										100
									
								
								gradlew.bat
									
										
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										100
									
								
								gradlew.bat
									
										
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,100 @@ | |||
| @rem | ||||
| @rem Copyright 2015 the original author or authors. | ||||
| @rem | ||||
| @rem Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| @rem you may not use this file except in compliance with the License. | ||||
| @rem You may obtain a copy of the License at | ||||
| @rem | ||||
| @rem      http://www.apache.org/licenses/LICENSE-2.0 | ||||
| @rem | ||||
| @rem Unless required by applicable law or agreed to in writing, software | ||||
| @rem distributed under the License is distributed on an "AS IS" BASIS, | ||||
| @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| @rem See the License for the specific language governing permissions and | ||||
| @rem limitations under the License. | ||||
| @rem | ||||
| 
 | ||||
| @if "%DEBUG%" == "" @echo off | ||||
| @rem ########################################################################## | ||||
| @rem | ||||
| @rem  Gradle startup script for Windows | ||||
| @rem | ||||
| @rem ########################################################################## | ||||
| 
 | ||||
| @rem Set local scope for the variables with windows NT shell | ||||
| if "%OS%"=="Windows_NT" setlocal | ||||
| 
 | ||||
| set DIRNAME=%~dp0 | ||||
| if "%DIRNAME%" == "" set DIRNAME=. | ||||
| set APP_BASE_NAME=%~n0 | ||||
| set APP_HOME=%DIRNAME% | ||||
| 
 | ||||
| @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. | ||||
| set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" | ||||
| 
 | ||||
| @rem Find java.exe | ||||
| if defined JAVA_HOME goto findJavaFromJavaHome | ||||
| 
 | ||||
| set JAVA_EXE=java.exe | ||||
| %JAVA_EXE% -version >NUL 2>&1 | ||||
| if "%ERRORLEVEL%" == "0" goto init | ||||
| 
 | ||||
| echo. | ||||
| echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. | ||||
| echo. | ||||
| echo Please set the JAVA_HOME variable in your environment to match the | ||||
| echo location of your Java installation. | ||||
| 
 | ||||
| goto fail | ||||
| 
 | ||||
| :findJavaFromJavaHome | ||||
| set JAVA_HOME=%JAVA_HOME:"=% | ||||
| set JAVA_EXE=%JAVA_HOME%/bin/java.exe | ||||
| 
 | ||||
| if exist "%JAVA_EXE%" goto init | ||||
| 
 | ||||
| echo. | ||||
| echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% | ||||
| echo. | ||||
| echo Please set the JAVA_HOME variable in your environment to match the | ||||
| echo location of your Java installation. | ||||
| 
 | ||||
| goto fail | ||||
| 
 | ||||
| :init | ||||
| @rem Get command-line arguments, handling Windows variants | ||||
| 
 | ||||
| if not "%OS%" == "Windows_NT" goto win9xME_args | ||||
| 
 | ||||
| :win9xME_args | ||||
| @rem Slurp the command line arguments. | ||||
| set CMD_LINE_ARGS= | ||||
| set _SKIP=2 | ||||
| 
 | ||||
| :win9xME_args_slurp | ||||
| if "x%~1" == "x" goto execute | ||||
| 
 | ||||
| set CMD_LINE_ARGS=%* | ||||
| 
 | ||||
| :execute | ||||
| @rem Setup the command line | ||||
| 
 | ||||
| set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar | ||||
| 
 | ||||
| @rem Execute Gradle | ||||
| "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% | ||||
| 
 | ||||
| :end | ||||
| @rem End local scope for the variables with windows NT shell | ||||
| if "%ERRORLEVEL%"=="0" goto mainEnd | ||||
| 
 | ||||
| :fail | ||||
| rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of | ||||
| rem the _cmd.exe /c_ return code! | ||||
| if  not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 | ||||
| exit /b 1 | ||||
| 
 | ||||
| :mainEnd | ||||
| if "%OS%"=="Windows_NT" endlocal | ||||
| 
 | ||||
| :omega | ||||
							
								
								
									
										63
									
								
								src/main/java/datamodel/CurrentUser.java
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										63
									
								
								src/main/java/datamodel/CurrentUser.java
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,63 @@ | |||
| package datamodel; | ||||
| 
 | ||||
| /** | ||||
|  * CurrentUser represents the current user that has logged on to | ||||
|  * the movie booking system. It is a singleton class. | ||||
|  */ | ||||
| public class CurrentUser { | ||||
|     /** | ||||
|      * The single instance of this class | ||||
|      */ | ||||
|     private static CurrentUser instance; | ||||
|          | ||||
|     /** | ||||
|      * The name of the current user. | ||||
|      */ | ||||
|     private String currentUserId; | ||||
|          | ||||
|     /** | ||||
|      * Create a CurrentUser object. | ||||
|      */ | ||||
|     private CurrentUser() { | ||||
|         currentUserId = null; | ||||
|     } | ||||
|          | ||||
|     /** | ||||
|      * Returns the single instance of this class. | ||||
|      * | ||||
|      * @return The single instance of the class. | ||||
|      */ | ||||
|     public static CurrentUser instance() { | ||||
|         if (instance == null) | ||||
|             instance = new CurrentUser(); | ||||
|         return instance; | ||||
|     } | ||||
|          | ||||
|     /** | ||||
|      * Check if a user has logged in. | ||||
|      * | ||||
|      * @return true if a user has logged in, false otherwise. | ||||
|      */ | ||||
|     public boolean isLoggedIn() { | ||||
|         return currentUserId != null; | ||||
|     } | ||||
|          | ||||
|     /**  | ||||
|      * Get the user id of the current user. Should only be called if | ||||
|      * a user has logged in. | ||||
|      * | ||||
|      * @return The user id of the current user. | ||||
|      */ | ||||
|     public String getCurrentUserId() { | ||||
|         return currentUserId == null ? "<none>" : currentUserId; | ||||
|     } | ||||
|          | ||||
|     /** | ||||
|      * A new user logs in. | ||||
|      * | ||||
|      * @param userId The user id of the new user. | ||||
|      */ | ||||
|     public void loginAs(String userId) { | ||||
|         currentUserId = userId; | ||||
|     } | ||||
| } | ||||
							
								
								
									
										88
									
								
								src/main/java/datamodel/Database.java
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										88
									
								
								src/main/java/datamodel/Database.java
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,88 @@ | |||
| package datamodel; | ||||
| 
 | ||||
| import java.sql.*; | ||||
| /** | ||||
|  * Database is a class that specifies the interface to the  | ||||
|  * movie database. Uses JDBC and the MySQL Connector/J driver. | ||||
|  */ | ||||
| public class Database { | ||||
|     /**  | ||||
|      * The database connection. | ||||
|      */ | ||||
|     private Connection conn; | ||||
|          | ||||
|     /** | ||||
|      * Create the database interface object. Connection to the database | ||||
|      * is performed later. | ||||
|      */ | ||||
|     public Database() { | ||||
|         conn = null; | ||||
|     } | ||||
|         | ||||
|     /* --- TODO: Change this method to fit your choice of DBMS --- */ | ||||
|     /**  | ||||
|      * Open a connection to the database, using the specified user name | ||||
|      * and password. | ||||
|      * | ||||
|      * @param userName The user name. | ||||
|      * @param password The user's password. | ||||
|      * @return true if the connection succeeded, false if the supplied | ||||
|      * user name and password were not recognized. Returns false also | ||||
|      * if the JDBC driver isn't found. | ||||
|      */ | ||||
|     public boolean openConnection(String userName, String password) { | ||||
|         try { | ||||
|         	// Connection strings for included DBMS clients: | ||||
|         	// [MySQL]       jdbc:mysql://[host]/[database] | ||||
|         	// [PostgreSQL]  jdbc:postgresql://[host]/[database] | ||||
|         	// [SQLite]      jdbc:sqlite://[filepath] | ||||
|         	 | ||||
|         	// Use "jdbc:mysql://puccini.cs.lth.se/" + userName if you using our shared server | ||||
|         	// If outside, this statement will hang until timeout. | ||||
|             conn = DriverManager.getConnection  | ||||
|                 ("jdbc:sqlite:movieBookings.db3", userName, password); | ||||
|         } | ||||
|         catch (SQLException e) { | ||||
|             System.err.println(e); | ||||
|             e.printStackTrace(); | ||||
|             return false; | ||||
|         } | ||||
|         return true; | ||||
|     } | ||||
|          | ||||
|     /** | ||||
|      * Close the connection to the database. | ||||
|      */ | ||||
|     public void closeConnection() { | ||||
|         try { | ||||
|             if (conn != null) | ||||
|                 conn.close(); | ||||
|         } | ||||
|         catch (SQLException e) { | ||||
|         	e.printStackTrace(); | ||||
|         } | ||||
|         conn = null; | ||||
|          | ||||
|         System.err.println("Database connection closed."); | ||||
|     } | ||||
|          | ||||
|     /** | ||||
|      * Check if the connection to the database has been established | ||||
|      * | ||||
|      * @return true if the connection has been established | ||||
|      */ | ||||
|     public boolean isConnected() { | ||||
|         return conn != null; | ||||
|     } | ||||
| 	 | ||||
|   	public Show getShowData(String mTitle, String mDate) { | ||||
| 		Integer mFreeSeats = 42; | ||||
| 		String mVenue = "Kino 2"; | ||||
| 		 | ||||
| 		/* --- TODO: add code for database query --- */ | ||||
| 		 | ||||
| 		return new Show(mTitle, mDate, mVenue, mFreeSeats); | ||||
| 	} | ||||
| 
 | ||||
|     /* --- TODO: insert more own code here --- */ | ||||
| } | ||||
							
								
								
									
										38
									
								
								src/main/java/datamodel/Reservation.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/main/java/datamodel/Reservation.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,38 @@ | |||
| package datamodel; | ||||
| 
 | ||||
| // Container for the booking data | ||||
| public class Reservation { | ||||
| 	private int bookingId; | ||||
| 	private String movieTitle; | ||||
| 	private String performanceDate; | ||||
| 	private String theatreName; | ||||
| 	 | ||||
| 	public Reservation() { | ||||
| 		this(-1, "N/A", "N/A", "N/A"); | ||||
| 	} | ||||
| 	 | ||||
| 	// constructor | ||||
| 	public Reservation(int bookingId, String movieTitle, String performanceDate, String theatreName) { | ||||
| 		this.bookingId = bookingId; | ||||
| 		this.movieTitle = movieTitle; | ||||
| 		this.performanceDate = performanceDate; | ||||
| 		this.theatreName = theatreName; | ||||
| 	} | ||||
| 
 | ||||
| 	// getters | ||||
| 	public int getBookingId() { | ||||
| 		return bookingId; | ||||
| 	} | ||||
| 	 | ||||
| 	public String getMovieTitle() { | ||||
| 		return movieTitle; | ||||
| 	} | ||||
| 	 | ||||
| 	public String getPerformanceDate() { | ||||
| 		return performanceDate; | ||||
| 	} | ||||
| 	 | ||||
| 	public String getTheatreName() { | ||||
| 		return theatreName; | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										39
									
								
								src/main/java/datamodel/Show.java
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										39
									
								
								src/main/java/datamodel/Show.java
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,39 @@ | |||
| package datamodel; | ||||
| 
 | ||||
| // Container for the database data | ||||
| /* --- TODO: Modify as needed --- */ | ||||
| 
 | ||||
| public class Show { | ||||
| 		// attributes associated with database columns | ||||
| 		private String title; | ||||
| 		private String date; | ||||
| 		private String venue; | ||||
| 		private Integer freeSeats; | ||||
| 		 | ||||
| 		// constructor for "no show" | ||||
| 		public Show() { | ||||
| 			init("","","",-1); | ||||
| 		} | ||||
| 		 | ||||
| 		// constructor defining all content | ||||
| 		public Show(String t, String d, String v, Integer fs) { | ||||
| 			init(t,d,v,fs); | ||||
| 		} | ||||
| 		 | ||||
| 		// constructor defining only the title | ||||
| 		public Show(String t) { | ||||
| 			init(t,"","",-1); | ||||
| 		} | ||||
| 		 | ||||
| 		// all constructors use this | ||||
| 		private void init(String t, String d, String v, Integer fs) { | ||||
| 			title = t; date = d; venue = v; freeSeats = fs; | ||||
| 		} | ||||
| 		 | ||||
| 		// getters | ||||
| 		public String getTitle() { return title; } | ||||
| 		public String getDate() { return date; } | ||||
| 		public String getVenue() { return venue; } | ||||
| 		public Integer getSeats() { return freeSeats; } | ||||
| 
 | ||||
| } | ||||
							
								
								
									
										12
									
								
								src/main/java/gui/App.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/main/java/gui/App.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| package gui; | ||||
| 
 | ||||
| import javafx.application.Application; | ||||
| 
 | ||||
| /** | ||||
|  * The application entry-point, the location of the primary main function. | ||||
|  */ | ||||
| public class App  { | ||||
| 	public static void main(String[] args) { | ||||
| 		Application.launch(MainApplication.class, args); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										146
									
								
								src/main/java/gui/BookingTab.java
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										146
									
								
								src/main/java/gui/BookingTab.java
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,146 @@ | |||
| package gui; | ||||
| 
 | ||||
| import javafx.collections.FXCollections; | ||||
| import javafx.fxml.FXML; | ||||
| import javafx.scene.control.Label; | ||||
| import javafx.scene.control.ListView; | ||||
| import javafx.scene.control.Button; | ||||
| import javafx.scene.text.Text; | ||||
| 
 | ||||
| import java.util.List; | ||||
| 
 | ||||
| import datamodel.CurrentUser; | ||||
| import datamodel.Database; | ||||
| import datamodel.Show; | ||||
| 
 | ||||
| import java.util.ArrayList; | ||||
| 
 | ||||
| 
 | ||||
| public class BookingTab { | ||||
| 	// top context message | ||||
| 	@FXML private Text topContext; | ||||
| 	// bottom message | ||||
| 	@FXML private Text bookMsg; | ||||
| 	 | ||||
| 	// table references | ||||
| 	@FXML private ListView<String> moviesList; | ||||
| 	@FXML private ListView<String> datesList; | ||||
| 	 | ||||
| 	// show info references | ||||
| 	@FXML private Label showTitle; | ||||
| 	@FXML private Label showDate; | ||||
| 	@FXML private Label showVenue; | ||||
| 	@FXML private Label showFreeSeats; | ||||
| 	 | ||||
| 	// booking button | ||||
| 	@FXML private Button bookTicket; | ||||
| 	 | ||||
| 	private Database db; | ||||
| 	private Show crtShow = new Show(); | ||||
| 	 | ||||
| 	public void initialize() { | ||||
| 		System.out.println("Initializing BookingTab"); | ||||
| 				 | ||||
| 		// set up listeners for the movie list selection | ||||
| 		moviesList.getSelectionModel().selectedItemProperty().addListener( | ||||
| 				(obs, oldV, newV) -> { | ||||
| 					// need to update the date list according to the selected movie | ||||
| 					// update also the details on the right panel | ||||
| 					String movie = newV; | ||||
| 					fillDatesList(newV); | ||||
| 					fillShow(movie,null); | ||||
| 				}); | ||||
| 		 | ||||
| 		// set up listeners for the date list selection | ||||
| 		datesList.getSelectionModel().selectedItemProperty().addListener( | ||||
| 				(obs, oldV, newV) -> { | ||||
| 					// need to update the details according to the selected date | ||||
| 					String movie = moviesList.getSelectionModel().getSelectedItem(); | ||||
| 					String date = newV; | ||||
| 				    fillShow(movie, date); | ||||
| 				}); | ||||
| 
 | ||||
| 		// set up booking button listener | ||||
| 		// one can either use this method (setup a handler in initialize) | ||||
| 		// or directly give a handler name in the fxml, as in the LoginTab class | ||||
| 		bookTicket.setOnAction( | ||||
| 				(event) -> { | ||||
| 					String movie = moviesList.getSelectionModel().getSelectedItem(); | ||||
| 					String date = datesList.getSelectionModel().getSelectedItem(); | ||||
| 					/* --- TODO: should attempt to book a ticket via the database --- */ | ||||
| 					/* --- do not forget to report booking number! --- */ | ||||
| 					/* --- update the displayed details (free seats) --- */ | ||||
| 					report("Booked one ticket to "+movie+" on "+date); | ||||
| 				}); | ||||
| 		 | ||||
| 		report("Ready."); | ||||
| 	} | ||||
| 	 | ||||
| 	// helpers	 | ||||
| 	// updates user display | ||||
| 	private void fillStatus(String usr) { | ||||
| 		if(usr.isEmpty()) topContext.setText("You must log in as a known user!"); | ||||
| 		else topContext.setText("Currently logged in as " + usr); | ||||
| 	} | ||||
| 	 | ||||
| 	private void report(String msg) { | ||||
| 		bookMsg.setText(msg); | ||||
| 	} | ||||
| 	 | ||||
| 	public void setDatabase(Database db) { | ||||
| 		this.db = db; | ||||
| 	} | ||||
| 	 | ||||
| 	private void fillNamesList() { | ||||
| 		List<String> allmovies = new ArrayList<String>(); | ||||
| 		 | ||||
| 		// query the database via db | ||||
| 		/* --- TODO: replace with own code --- */ | ||||
| 		allmovies.add("Pulp Fiction"); | ||||
| 		allmovies.add("The Big Lebowski"); | ||||
| 		allmovies.add("Whiplash"); | ||||
| 		/* --- END TODO --- */		 | ||||
| 		 | ||||
| 		moviesList.setItems(FXCollections.observableList(allmovies)); | ||||
| 		// remove any selection | ||||
| 		moviesList.getSelectionModel().clearSelection(); | ||||
| 	} | ||||
| 
 | ||||
| 	private void fillDatesList(String m) { | ||||
| 		List<String> alldates = new ArrayList<String>(); | ||||
| 		if(m!=null) { | ||||
| 			// query the database via db | ||||
| 			/* --- TODO: replace with own code --- */ | ||||
| 			alldates.add("2016-02-01"); | ||||
| 			alldates.add("2016-01-15"); | ||||
| 			/* --- END TODO --- */			 | ||||
| 		} | ||||
| 		datesList.setItems(FXCollections.observableList(alldates)); | ||||
| 		// remove any selection | ||||
| 		datesList.getSelectionModel().clearSelection(); | ||||
| 	} | ||||
| 	 | ||||
| 	private void fillShow(String movie, String date) { | ||||
| 		if(movie==null) // no movie selected | ||||
| 			crtShow = new Show(); | ||||
| 		else if(date==null) // no date selected yet | ||||
| 			crtShow = new Show(movie); | ||||
| 		else // query the database via db | ||||
| 			crtShow = db.getShowData(movie, date); | ||||
| 		 | ||||
| 		showTitle.setText(crtShow.getTitle()); | ||||
| 		showDate.setText(crtShow.getDate()); | ||||
| 		showVenue.setText(crtShow.getVenue()); | ||||
| 		if(crtShow.getSeats() >= 0) showFreeSeats.setText(crtShow.getSeats().toString()); | ||||
| 		else showFreeSeats.setText("-"); | ||||
| 	} | ||||
| 	 | ||||
| 	// called in case the user logged in changed | ||||
| 	public void userChanged() { | ||||
| 		fillStatus(CurrentUser.instance().getCurrentUserId()); | ||||
| 		fillNamesList(); | ||||
| 		fillDatesList(null); | ||||
| 		fillShow(null,null); | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
							
								
								
									
										71
									
								
								src/main/java/gui/LoginTab.java
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										71
									
								
								src/main/java/gui/LoginTab.java
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,71 @@ | |||
| package gui; | ||||
| 
 | ||||
| import datamodel.CurrentUser; | ||||
| import datamodel.Database; | ||||
| import javafx.event.ActionEvent; | ||||
| import javafx.fxml.FXML; | ||||
| import javafx.scene.text.Text; | ||||
| import javafx.scene.control.TextField; | ||||
| 
 | ||||
| import javafx.scene.control.Alert; | ||||
| import javafx.scene.control.Alert.*; | ||||
| 
 | ||||
| // controller for both the top tabs and login tab! | ||||
| 
 | ||||
| public class LoginTab { | ||||
|     @FXML private Text actiontarget; | ||||
|     @FXML private TextField username; | ||||
|      | ||||
|     private BookingTab bookingTabCtrl; | ||||
|     private Database db; | ||||
|         | ||||
|     @FXML protected void handleSubmitButtonAction(ActionEvent event) { | ||||
|     	 | ||||
|         if(!db.isConnected()) { | ||||
| 	        // inform the user that there is no check against the database | ||||
| 	        Alert alert = new Alert(AlertType.ERROR); | ||||
| 	        alert.setTitle("Login fail"); | ||||
| 	        alert.setHeaderText(null); | ||||
| 	        alert.setContentText("No database connection! Cannot check user credentials."); | ||||
| 	        alert.showAndWait();      	 | ||||
|         } else { | ||||
|             String uname = username.getText(); | ||||
|              | ||||
|             /* --- TODO: add code to query the database credentials --- */ | ||||
|         	// could be if(!db.login(uname)) alert... | ||||
| 
 | ||||
|         	// inform the user that there is no check against the database | ||||
| 	        Alert alert = new Alert(AlertType.INFORMATION); | ||||
| 	        alert.setTitle("Login fail"); | ||||
| 	        alert.setHeaderText(null); | ||||
| 	        alert.setContentText("No user check implemented yet!"); | ||||
| 	        alert.showAndWait(); | ||||
| 	        /* --- END TODO --- */ | ||||
| 	         | ||||
|             // setting the user name | ||||
| 	        CurrentUser.instance().loginAs(uname); | ||||
| 	         | ||||
| 	        // inform the user about logging in | ||||
| 	        actiontarget.setText("Sign in user "+uname);         | ||||
|     	 | ||||
| 	        // inform booking tab of user change | ||||
| 	        bookingTabCtrl.userChanged(); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     public void initialize() { | ||||
|     	System.out.println("Initializing LoginTab.");    	 | ||||
|     } | ||||
|          | ||||
|     // helpers | ||||
|     // use this pattern to send data down to controllers at initialization | ||||
|     public void setBookingTab(BookingTab bookingTabCtrl) { | ||||
|     	System.out.println("LoginTab sets bookingTab:"+bookingTabCtrl); | ||||
|     	this.bookingTabCtrl = bookingTabCtrl; 	 | ||||
|     } | ||||
|      | ||||
|     public void setDatabase(Database db) { | ||||
|     	this.db = db; | ||||
|     } | ||||
|      | ||||
| } | ||||
							
								
								
									
										65
									
								
								src/main/java/gui/MainApplication.java
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										65
									
								
								src/main/java/gui/MainApplication.java
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,65 @@ | |||
| package gui; | ||||
| 	 | ||||
| import datamodel.Database; | ||||
| import javafx.application.Application; | ||||
| import javafx.fxml.FXMLLoader; | ||||
| import javafx.scene.Parent; | ||||
| import javafx.scene.Scene; | ||||
| import javafx.scene.control.Alert; | ||||
| import javafx.scene.control.Alert.AlertType; | ||||
| import javafx.stage.Stage; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * The Main JavaFX Application class | ||||
|  * | ||||
|  * Use the main method in App to start it all. | ||||
|  */ | ||||
| public class MainApplication extends Application { | ||||
| 		 | ||||
| 	private Database db = new Database(); | ||||
| 	 | ||||
| 	@Override | ||||
| 	public void start(Stage primaryStage) { | ||||
| 		try { | ||||
| 			 | ||||
| 			// BorderPane root = new BorderPane(); | ||||
| 			FXMLLoader loader = new FXMLLoader(getClass().getResource("/TopTab.fxml")); | ||||
| 			Parent root = loader.load(); | ||||
| 			 | ||||
| 			Scene scene = new Scene(root,600,440); | ||||
| 			scene.getStylesheets().add(getClass().getResource("/application.css").toExternalForm()); | ||||
| 
 | ||||
| 			// obtain main controller | ||||
| 			TopTabView wc = (TopTabView) loader.getController(); | ||||
| 	        // make the database object visible to the controller | ||||
| 	        wc.setDatabase(db); | ||||
| 
 | ||||
| 			primaryStage.setTitle("Movie Booking System"); | ||||
| 			primaryStage.setScene(scene); | ||||
| 			primaryStage.show(); | ||||
| 			 | ||||
| 			// opening database connection | ||||
| 	        /* --- TODO: change xxx to your user name, yyy to your password --- */	         | ||||
| 	        if(!db.openConnection("xxx", "yyy")) { | ||||
| 	            Alert alert = new Alert(AlertType.ERROR); | ||||
| 	            alert.setTitle("Database error"); | ||||
| 	            alert.setHeaderText(null); | ||||
| 	            alert.setContentText("Could not connect to the database! Check console for details."); | ||||
| 	            alert.showAndWait(); | ||||
| 	        } | ||||
| 		} catch(Exception e) { | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	public void stop() { | ||||
| 		// close the database here | ||||
| 		db.closeConnection();		 | ||||
| 		try { | ||||
| 			super.stop(); | ||||
| 		} catch (Exception e) { | ||||
| 			e.printStackTrace(); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										64
									
								
								src/main/java/gui/ReservationsTab.java
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								src/main/java/gui/ReservationsTab.java
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,64 @@ | |||
| package gui; | ||||
| 
 | ||||
| import java.util.Arrays; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import datamodel.Reservation; | ||||
| import datamodel.Database; | ||||
| import javafx.fxml.FXML; | ||||
| import javafx.scene.control.TableColumn; | ||||
| import javafx.scene.control.TableView; | ||||
| import javafx.scene.control.cell.PropertyValueFactory; | ||||
| 
 | ||||
| public class ReservationsTab { | ||||
| 	@FXML private TableView<Reservation> tableReservations = new TableView<>(); | ||||
| 	 | ||||
| 	private Database db; | ||||
| 	 | ||||
| 	public void setDatabase(Database db) { | ||||
| 		this.db = db; | ||||
| 	} | ||||
| 	 | ||||
| 	@SuppressWarnings("unchecked") | ||||
| 	public void initialize() { | ||||
| 		System.out.println("Initializing BookingListTab"); | ||||
| 		 | ||||
| 		// Create Column ID		 | ||||
| 		TableColumn<Reservation, Integer> bookingIdColumn = new TableColumn<>("ID"); | ||||
| 		bookingIdColumn.setPrefWidth(75); | ||||
| 		bookingIdColumn.setCellValueFactory(new PropertyValueFactory<Reservation, Integer>("bookingId")); | ||||
| 
 | ||||
| 		// Create Column MovieTitle | ||||
| 		TableColumn<Reservation, String> movieTitleColumn = new TableColumn<>("Movie Title"); | ||||
| 		movieTitleColumn.setPrefWidth(150); | ||||
| 		movieTitleColumn.setCellValueFactory(new PropertyValueFactory<Reservation, String>("movieTitle")); | ||||
| 		 | ||||
| 		// Create Column Date		 | ||||
| 		TableColumn<Reservation, String> performanceDateColumn = new TableColumn<>("Date"); | ||||
| 		performanceDateColumn.setPrefWidth(120); | ||||
| 		performanceDateColumn.setCellValueFactory(new PropertyValueFactory<Reservation, String>("performanceDate")); | ||||
| 		 | ||||
| 		// Create Column Theatre Name | ||||
| 		TableColumn<Reservation, String> theatreNameColumn = new TableColumn<>("Theatre Name"); | ||||
| 		theatreNameColumn.setPrefWidth(150); | ||||
| 		theatreNameColumn.setCellValueFactory(new PropertyValueFactory<Reservation, String>("theatreName")); | ||||
| 		 | ||||
| 		//Insert all columns | ||||
| 		tableReservations.getColumns() | ||||
| 						 .addAll(bookingIdColumn, | ||||
| 								 movieTitleColumn,  | ||||
| 								 performanceDateColumn, | ||||
| 								 theatreNameColumn); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Refresh the table view, by getting and replacing the tables content. | ||||
| 	 */ | ||||
| 	public void updateList() { | ||||
| 		/* --- TODO: replace with own code using the database object instead --- */ | ||||
| 		System.out.println("Update booking list called."); | ||||
| 		 | ||||
| 		List<Reservation> bookings = Arrays.asList(new Reservation(1, "Star Wars", "2019-12-30", "Bio Söder")); | ||||
| 		tableReservations.getItems().setAll(bookings); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										40
									
								
								src/main/java/gui/TopTabView.java
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										40
									
								
								src/main/java/gui/TopTabView.java
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,40 @@ | |||
| package gui; | ||||
| 
 | ||||
| import javafx.scene.Parent; | ||||
| import javafx.scene.control.Tab; | ||||
| import datamodel.Database; | ||||
| import javafx.fxml.FXML; | ||||
| 
 | ||||
| public class TopTabView { | ||||
| 	@FXML private Parent aLoginTab; | ||||
| 	@FXML private LoginTab aLoginTabController; | ||||
| 
 | ||||
| 	@FXML private Parent aBookingTab; | ||||
| 	@FXML private BookingTab aBookingTabController; | ||||
| 	 | ||||
| 	@FXML private Tab reservationTab; | ||||
| 	@FXML private ReservationsTab aReservationTabController; | ||||
| 	 | ||||
| 	 | ||||
| 	public void initialize() { | ||||
| 		System.out.println("Initializing TopTabView"); | ||||
| 		 | ||||
| 		// send the booking controller reference to the login controller | ||||
| 		// in order to pass data between the two | ||||
| 		aLoginTabController.setBookingTab(aBookingTabController); | ||||
| 		 | ||||
| 		// When selection is changed, update the list | ||||
| 		reservationTab.setOnSelectionChanged(e -> { | ||||
| 			if(reservationTab.isSelected()) { | ||||
| 				// Initiate an update | ||||
| 				aReservationTabController.updateList(); | ||||
| 			} | ||||
| 		}); | ||||
| 	} | ||||
| 	 | ||||
| 	public void setDatabase(Database db) { | ||||
| 		aLoginTabController.setDatabase(db); | ||||
| 		aBookingTabController.setDatabase(db); | ||||
| 		aReservationTabController.setDatabase(db); | ||||
| 	} | ||||
| } | ||||
							
								
								
									
										77
									
								
								src/main/resources/application.css
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										77
									
								
								src/main/resources/application.css
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,77 @@ | |||
| /* | ||||
|  * Copyright (c) 2012 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 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. | ||||
|  */ | ||||
|   | ||||
| root {  | ||||
|     display: block; | ||||
| } | ||||
| 
 | ||||
| .root { | ||||
|      -fx-background-image: url("background.jpg"); | ||||
| } | ||||
| 
 | ||||
| .label { | ||||
|     -fx-font-size: 12px; | ||||
|     -fx-font-weight: bold; | ||||
|     -fx-text-fill: #333333; | ||||
|     -fx-effect: dropshadow( gaussian , rgba(255,255,255,0.5) , 0,0,0,1 ); | ||||
| } | ||||
| 
 | ||||
| #welcome-text { | ||||
|    -fx-font-size: 32px; | ||||
|    -fx-font-family: "Arial Black"; | ||||
|    -fx-fill: #818181; | ||||
|    -fx-effect: innershadow( three-pass-box , rgba(0,0,0,0.7) , 6, 0.0 , 0 , 2 ); | ||||
| } | ||||
| 
 | ||||
| #actiontarget { | ||||
|   -fx-fill: FIREBRICK; | ||||
|   -fx-font-weight: bold; | ||||
|   -fx-effect: dropshadow( gaussian , rgba(255,255,255,0.5) , 0,0,0,1 );   | ||||
| } | ||||
| 
 | ||||
| #topContext { | ||||
|   -fx-fill: BLUE; | ||||
|   -fx-font-weight: bold; | ||||
|   -fx-effect: dropshadow( gaussian , rgba(255,255,255,0.5) , 0,0,0,1 );  | ||||
| } | ||||
| 
 | ||||
| .button { | ||||
|     -fx-text-fill: white; | ||||
|     -fx-font-family: "Arial Narrow"; | ||||
|     -fx-font-weight: bold; | ||||
|     -fx-background-color: linear-gradient(#61a2b1, #2A5058); | ||||
|     -fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 ); | ||||
| } | ||||
| 
 | ||||
| .button:hover { | ||||
|     -fx-background-color: linear-gradient(#2A5058, #61a2b1); | ||||
| } | ||||
							
								
								
									
										
											BIN
										
									
								
								src/main/resources/background.jpg
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								src/main/resources/background.jpg
									
										
									
									
									
										Executable file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 51 KiB | 
							
								
								
									
										95
									
								
								src/main/resources/bookingTab.fxml
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										95
									
								
								src/main/resources/bookingTab.fxml
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,95 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| 
 | ||||
| <?import javafx.scene.control.Button?> | ||||
| <?import javafx.scene.control.Label?> | ||||
| <?import javafx.scene.control.ListView?> | ||||
| <?import javafx.scene.control.SplitPane?> | ||||
| <?import javafx.scene.layout.VBox?> | ||||
| <?import javafx.scene.layout.AnchorPane?> | ||||
| <?import javafx.scene.layout.ColumnConstraints?> | ||||
| <?import javafx.scene.layout.GridPane?> | ||||
| <?import javafx.scene.layout.RowConstraints?> | ||||
| <?import javafx.scene.layout.BorderPane ?> | ||||
| <?import javafx.scene.text.*?> | ||||
| 
 | ||||
| <VBox xmlns:fx="http://javafx.com/fxml" | ||||
| 	fx:controller="gui.BookingTab"> | ||||
| 	<children> | ||||
| 				<SplitPane dividerPositions="0.4" prefHeight="400.0" | ||||
| 					prefWidth="600.0" styleClass="root" VBox.vgrow="ALWAYS" > | ||||
| 					<items> | ||||
| 						<GridPane hgap="10" vgap="10"> | ||||
| 							<columnConstraints> | ||||
| 								<ColumnConstraints hgrow="ALWAYS" | ||||
| 									minWidth="10.0" prefWidth="120.0" /> | ||||
| 								<ColumnConstraints hgrow="ALWAYS" | ||||
| 									minWidth="10.0" prefWidth="110.0" /> | ||||
| 							</columnConstraints> | ||||
| 							<rowConstraints> | ||||
| 								<RowConstraints minHeight="10.0" | ||||
| 									prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| 								<RowConstraints minHeight="50" prefHeight="300" | ||||
| 									vgrow="ALWAYS" /> | ||||
| 							</rowConstraints> | ||||
| 							<children> | ||||
| 								<Label text="Movie" GridPane.rowIndex="0" | ||||
| 									GridPane.columnIndex="0" /> | ||||
| 								<Label text="Date" GridPane.rowIndex="0" | ||||
| 									GridPane.columnIndex="1" /> | ||||
| 								<ListView fx:id="moviesList" GridPane.rowIndex="1" | ||||
| 									GridPane.columnIndex="0" /> | ||||
| 								<ListView fx:id="datesList" GridPane.rowIndex="1" | ||||
| 									GridPane.columnIndex="1" /> | ||||
| 							</children> | ||||
| 						</GridPane> | ||||
| 						<AnchorPane minHeight="0.0" minWidth="0.0" | ||||
| 							prefWidth="360.0"> | ||||
| 							<children> | ||||
| 								<Button fx:id="bookTicket" mnemonicParsing="false" | ||||
| 									text="Book Ticket" AnchorPane.bottomAnchor="60.0" | ||||
| 									AnchorPane.leftAnchor="50.0" AnchorPane.rightAnchor="50.0" /> | ||||
| 								<Text fx:id="topContext" text="Not logged in!" | ||||
| 									AnchorPane.leftAnchor="5.0" AnchorPane.topAnchor="5.0" /> | ||||
| 								<GridPane AnchorPane.leftAnchor="5.0" | ||||
| 									AnchorPane.rightAnchor="5.0" AnchorPane.topAnchor="30.0"> | ||||
| 									<columnConstraints> | ||||
| 										<ColumnConstraints hgrow="SOMETIMES" | ||||
| 											minWidth="10.0" prefWidth="100.0" /> | ||||
| 										<ColumnConstraints hgrow="SOMETIMES" | ||||
| 											minWidth="10.0" prefWidth="100.0" /> | ||||
| 									</columnConstraints> | ||||
| 									<rowConstraints> | ||||
| 										<RowConstraints minHeight="10.0" | ||||
| 											prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| 										<RowConstraints minHeight="10.0" | ||||
| 											prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| 										<RowConstraints minHeight="10.0" | ||||
| 											prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| 										<RowConstraints minHeight="10.0" | ||||
| 											prefHeight="30.0" vgrow="SOMETIMES" /> | ||||
| 									</rowConstraints> | ||||
| 									<children> | ||||
| 										<Label text="Movie" /> | ||||
| 										<Label text="Date" GridPane.rowIndex="1" /> | ||||
| 										<Label text="Plays at" GridPane.rowIndex="2" /> | ||||
| 										<Label text="Free seats" GridPane.rowIndex="3" /> | ||||
| 										<Label fx:id="showTitle" text="Label" | ||||
| 											GridPane.columnIndex="1" /> | ||||
| 										<Label fx:id="showDate" text="Label" | ||||
| 											GridPane.columnIndex="1" GridPane.rowIndex="1" /> | ||||
| 										<Label fx:id="showVenue" text="Label" | ||||
| 											GridPane.columnIndex="1" GridPane.rowIndex="2" /> | ||||
| 										<Label fx:id="showFreeSeats" text="Label" | ||||
| 											GridPane.columnIndex="1" GridPane.rowIndex="3" /> | ||||
| 									</children> | ||||
| 								</GridPane> | ||||
| 								<Text fx:id="bookMsg" layoutX="83.0" layoutY="368.0" | ||||
| 									text="Label" textAlignment="CENTER" | ||||
| 									AnchorPane.bottomAnchor="10.0" AnchorPane.leftAnchor="10.0" | ||||
| 									AnchorPane.rightAnchor="10.0" /> | ||||
| 							</children> | ||||
| 						</AnchorPane> | ||||
| 					</items> | ||||
| 				</SplitPane> | ||||
| 	</children> | ||||
| </VBox> | ||||
							
								
								
									
										34
									
								
								src/main/resources/loginTab.fxml
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										34
									
								
								src/main/resources/loginTab.fxml
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| 
 | ||||
| <?import java.net.*?> | ||||
| <?import javafx.geometry.*?> | ||||
| <?import javafx.scene.control.*?> | ||||
| <?import javafx.scene.layout.*?> | ||||
| <?import javafx.scene.text.*?> | ||||
| 
 | ||||
| 
 | ||||
| <GridPane fx:controller="gui.LoginTab"  | ||||
|     xmlns:fx="http://javafx.com/fxml" alignment="center" hgap="10" vgap="10" | ||||
|     styleClass="root"> | ||||
|     <padding><Insets top="25" right="25" bottom="25" left="25"/></padding> | ||||
|      | ||||
|     <Text id="welcome-text" text="Welcome"  | ||||
|          GridPane.columnIndex="0" GridPane.rowIndex="0" | ||||
|         GridPane.columnSpan="2"/> | ||||
|   | ||||
|     <Label text="User Name:" | ||||
|         GridPane.columnIndex="0" GridPane.rowIndex="1"/> | ||||
|   | ||||
|     <TextField fx:id="username" | ||||
|         GridPane.columnIndex="1" GridPane.rowIndex="1"/> | ||||
|           | ||||
|     <HBox spacing="10" alignment="bottom_right"  | ||||
|         GridPane.columnIndex="1" GridPane.rowIndex="4"> | ||||
|         <Button text="Sign In"      | ||||
|         onAction="#handleSubmitButtonAction"/> | ||||
|     </HBox> | ||||
| 
 | ||||
|     <Text fx:id="actiontarget" | ||||
|         GridPane.columnIndex="1" GridPane.rowIndex="6"/> | ||||
|          | ||||
| </GridPane> | ||||
							
								
								
									
										17
									
								
								src/main/resources/reservationsTab.fxml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/main/resources/reservationsTab.fxml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,17 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| 
 | ||||
| <?import javafx.scene.control.TableColumn?> | ||||
| <?import javafx.scene.control.TableView?> | ||||
| <?import javafx.scene.layout.BorderPane?> | ||||
| 
 | ||||
| <BorderPane xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/11.0.1" fx:controller="gui.ReservationsTab"> | ||||
| 	<center> | ||||
| 			 | ||||
| 	</center> | ||||
|    <center> | ||||
|       <TableView fx:id="tableReservations" prefHeight="400.0" prefWidth="600.0" BorderPane.alignment="CENTER"> | ||||
|         <columns> | ||||
|         </columns> | ||||
|       </TableView> | ||||
|    </center> | ||||
| </BorderPane> | ||||
							
								
								
									
										23
									
								
								src/main/resources/topTab.fxml
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										23
									
								
								src/main/resources/topTab.fxml
									
										
									
									
									
										Executable file
									
								
							|  | @ -0,0 +1,23 @@ | |||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| 
 | ||||
| <?import javafx.scene.layout.*?> | ||||
| <?import javafx.scene.control.*?> | ||||
| 
 | ||||
| <BorderPane fx:controller="gui.TopTabView"  xmlns:fx="http://javafx.com/fxml/1" styleClass="root"> | ||||
| <center> | ||||
| 	<TabPane tabClosingPolicy="UNAVAILABLE"> | ||||
|     <tabs> | ||||
|         <Tab text="Login"> | ||||
|                 <fx:include fx:id="aLoginTab" source="loginTab.fxml"/> | ||||
|         </Tab> | ||||
|         <Tab text="Book"> | ||||
|                 <fx:include fx:id="aBookingTab" source="bookingTab.fxml"/> | ||||
|         </Tab> | ||||
|         <Tab text="Reservations" fx:id="reservationTab"> | ||||
|                 <fx:include fx:id="aReservationTab" source="reservationsTab.fxml"/> | ||||
|         </Tab> | ||||
|     </tabs> | ||||
|     </TabPane> | ||||
| </center> | ||||
| </BorderPane> | ||||
| 
 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Imbus
						Imbus