-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f88a8e2
commit 28ee9a7
Showing
46 changed files
with
2,368 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" path="img"/> | ||
<classpathentry kind="src" path="res"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>RestaurantBillingSystem</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.control.Button?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.control.PasswordField?> | ||
<?import javafx.scene.control.TextField?> | ||
<?import javafx.scene.layout.AnchorPane?> | ||
<?import javafx.scene.text.Font?> | ||
|
||
<AnchorPane id="pane" prefHeight="400" prefWidth="600" stylesheets="@login.css" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="billingsystem.MainController"> | ||
<children> | ||
<Button fx:id="login" layoutX="254.0" layoutY="296.0" mnemonicParsing="false" onAction="#handleLogin" prefHeight="24.0" prefWidth="93.0" text="Login"> | ||
<font> | ||
<Font name="System Bold" size="12.0" /> | ||
</font></Button> | ||
<TextField fx:id="user" layoutX="226.0" layoutY="166.0" onAction="#handleLogin" /> | ||
<PasswordField fx:id="pwdFld" layoutX="226.0" layoutY="216.0" onAction="#handleLogin" /> | ||
<Label layoutX="226.0" layoutY="141.0" prefHeight="25.0" prefWidth="149.0" text="Username" textFill="IVORY" /> | ||
<Label layoutX="226.0" layoutY="191.0" prefHeight="25.0" prefWidth="149.0" text="Password" textFill="IVORY" /> | ||
<Label alignment="CENTER" layoutX="151.0" layoutY="52.0" prefHeight="54.0" prefWidth="299.0" text="Restaurant Billing System" textFill="IVORY"> | ||
<font> | ||
<Font name="System Bold" size="20.0" /> | ||
</font> | ||
</Label> | ||
</children> | ||
</AnchorPane> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#pane { | ||
-fx-background-image:url('login.jpg'); | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
|
||
<?import javafx.scene.control.Button?> | ||
<?import javafx.scene.control.Label?> | ||
<?import javafx.scene.control.PasswordField?> | ||
<?import javafx.scene.control.TextField?> | ||
<?import javafx.scene.layout.AnchorPane?> | ||
<?import javafx.scene.text.Font?> | ||
|
||
<AnchorPane id="pane" prefHeight="400" prefWidth="600" stylesheets="@login.css" xmlns="http://javafx.com/javafx/8.0.60" xmlns:fx="http://javafx.com/fxml/1" fx:controller="billingsystem.MainController"> | ||
<children> | ||
<Button fx:id="login" layoutX="254.0" layoutY="296.0" mnemonicParsing="false" onAction="#handleLogin" prefHeight="24.0" prefWidth="93.0" text="Login"> | ||
<font> | ||
<Font name="System Bold" size="12.0" /> | ||
</font></Button> | ||
<TextField fx:id="user" layoutX="226.0" layoutY="166.0" onAction="#handleLogin" /> | ||
<PasswordField fx:id="pwdFld" layoutX="226.0" layoutY="216.0" onAction="#handleLogin" /> | ||
<Label layoutX="226.0" layoutY="141.0" prefHeight="25.0" prefWidth="149.0" text="Username" textFill="IVORY" /> | ||
<Label layoutX="226.0" layoutY="191.0" prefHeight="25.0" prefWidth="149.0" text="Password" textFill="IVORY" /> | ||
<Label alignment="CENTER" layoutX="151.0" layoutY="52.0" prefHeight="54.0" prefWidth="299.0" text="Restaurant Billing System" textFill="IVORY"> | ||
<font> | ||
<Font name="System Bold" size="20.0" /> | ||
</font> | ||
</Label> | ||
</children> | ||
</AnchorPane> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
package billingsystem; | ||
|
||
import java.io.FileInputStream; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.ObjectInputStream; | ||
import java.io.ObjectOutputStream; | ||
import java.util.ArrayList; | ||
import java.util.logging.FileHandler; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
import java.util.logging.SimpleFormatter; | ||
|
||
import javafx.application.Application; | ||
import javafx.fxml.FXMLLoader; | ||
import javafx.stage.Stage; | ||
import javafx.scene.Parent; | ||
import javafx.scene.Scene; | ||
|
||
/** | ||
* | ||
* @author Jason Li | ||
* @version 1.0 | ||
* @since 19.12.2016 | ||
* | ||
* | ||
* The Class Main. | ||
*/ | ||
public class Main extends Application { | ||
|
||
/** The Constant logger. */ | ||
private static final Logger logger = Logger.getLogger(Main.class.getName()); | ||
|
||
/** The fh log. */ | ||
private static FileHandler fhLog; | ||
|
||
/** The user path. */ | ||
private String userPath = "res/users.ser"; | ||
|
||
/** The log path. */ | ||
private String logPath = "res/activity.log"; | ||
|
||
/** The root admin. */ | ||
private final String rootAdmin = "admin"; | ||
|
||
/** The users list. */ | ||
private ArrayList<User> usersList = null; | ||
|
||
/** The jarpath. */ | ||
private String jarpath; | ||
|
||
/* (non-Javadoc) | ||
* @see javafx.application.Application#start(javafx.stage.Stage) | ||
*/ | ||
@Override | ||
public void start(Stage primaryStage) { | ||
|
||
try { | ||
fhLog = new FileHandler(logPath, true); | ||
logger.addHandler(fhLog); | ||
SimpleFormatter formatter = new SimpleFormatter(); | ||
fhLog.setFormatter(formatter); | ||
} catch (SecurityException e) { | ||
logger.log(Level.SEVERE, "" + e); | ||
} catch (IOException e) { | ||
logger.log(Level.WARNING, | ||
"Logger could not be set up to log to activity log. Logs will only be displayed in the console. \n" | ||
+ e); | ||
} | ||
try { | ||
try { | ||
FileInputStream fileIn = new FileInputStream(userPath); | ||
ObjectInputStream in = new ObjectInputStream(fileIn); | ||
usersList = (ArrayList<User>) in.readObject(); | ||
in.close(); | ||
fileIn.close(); | ||
} catch (IOException i) { | ||
logger.log(Level.INFO, "Root admin account 'admin' created on first time login."); | ||
// Create admin account if not existent | ||
User admin = new User(rootAdmin, "", true); | ||
usersList = new ArrayList<User>(); | ||
usersList.add(admin); | ||
try { | ||
// Create user list with initial admin account | ||
FileOutputStream fileOut = new FileOutputStream(userPath); | ||
ObjectOutputStream out = new ObjectOutputStream(fileOut); | ||
out.writeObject(usersList); | ||
out.close(); | ||
fileOut.close(); | ||
} catch (IOException i2) { | ||
logger.log(Level.WARNING, "" + i2); | ||
} | ||
} | ||
|
||
// Create Login Screen | ||
Parent root = FXMLLoader.load(getClass().getResource("/billingsystem/Login.fxml")); | ||
Scene scene = new Scene(root); | ||
scene.getStylesheets().add(getClass().getResource("login.css").toExternalForm()); | ||
primaryStage.setScene(scene); | ||
primaryStage.setResizable(false); | ||
primaryStage.show(); | ||
fhLog.close(); | ||
|
||
} catch (Exception e) { | ||
logger.log(Level.SEVERE, | ||
"Login Screen file has been deleted or is corrupted. Please restore 'Login.fxml' links. \n" + e); | ||
} | ||
} | ||
|
||
/** | ||
* The main method. | ||
* | ||
* @param args the arguments | ||
*/ | ||
public static void main(String[] args) { | ||
launch(args); | ||
} | ||
} |
Oops, something went wrong.