2018-03-29 19:45:41 +02:00
package application ;
import javafx.fxml.FXML ;
import javafx.geometry.Insets ;
import javafx.scene.Node ;
import javafx.scene.control.Alert ;
import javafx.scene.control.Alert.AlertType ;
import javafx.scene.control.Button ;
import javafx.scene.control.ButtonBar.ButtonData ;
import javafx.scene.control.ButtonType ;
import javafx.scene.control.Dialog ;
import javafx.scene.control.TreeTableColumn ;
import javafx.scene.control.TreeTableView ;
import javafx.scene.control.TextField ;
import javafx.scene.control.TreeItem ;
2018-03-31 00:35:45 +02:00
import javafx.scene.control.TitledPane ;
2018-03-31 23:50:17 +02:00
import javafx.scene.control.Tooltip ;
2018-04-02 15:07:58 +02:00
import javafx.scene.control.ChoiceBox ;
2018-03-31 23:50:17 +02:00
//import com.sun.java.swing.action.NewAction;
2018-03-29 19:45:41 +02:00
import java.awt.Desktop ;
import java.awt.Toolkit ;
import java.awt.datatransfer.Clipboard ;
import java.awt.datatransfer.StringSelection ;
import java.io.File ;
import java.io.FileInputStream ;
import java.io.FileOutputStream ;
import java.io.IOException ;
import java.io.InputStream ;
import java.io.OutputStream ;
import java.net.URI ;
import java.net.URISyntaxException ;
import java.sql.DriverManager ;
import java.util.Optional ;
import java.util.Properties ;
2018-04-02 15:07:58 +02:00
import javax.security.auth.callback.Callback ;
import javax.swing.plaf.basic.BasicInternalFrameTitlePane.TitlePaneLayout ;
2018-03-29 19:45:41 +02:00
import javafx.application.Platform ;
import javafx.beans.value.ChangeListener ;
import javafx.beans.value.ObservableValue ;
2018-04-02 15:07:58 +02:00
import javafx.collections.FXCollections ;
import javafx.collections.ObservableList ;
2018-03-29 19:45:41 +02:00
import javafx.event.ActionEvent ;
import javafx.scene.control.Label ;
2018-04-02 15:07:58 +02:00
import javafx.scene.control.ListCell ;
import javafx.scene.control.ListView ;
2018-03-29 19:45:41 +02:00
import javafx.scene.control.PasswordField ;
import javafx.scene.layout.AnchorPane ;
import javafx.scene.layout.GridPane ;
import javafx.util.Pair ;
2018-03-29 19:51:34 +02:00
public class MainWindowController
{
2018-03-29 19:45:41 +02:00
private static final String String = null ;
2018-03-29 19:51:34 +02:00
2018-03-29 19:45:41 +02:00
Toolkit toolkit = Toolkit . getDefaultToolkit ( ) ;
2018-03-29 19:51:34 +02:00
2018-03-29 19:45:41 +02:00
Clipboard clipboard = toolkit . getSystemClipboard ( ) ;
2018-03-29 19:51:34 +02:00
2018-03-29 19:45:41 +02:00
@FXML
private AnchorPane mainAnchorpane ;
2018-03-29 19:51:34 +02:00
2018-03-31 23:50:17 +02:00
@FXML
private AnchorPane paneDB ;
2018-03-29 19:45:41 +02:00
@FXML
2018-03-30 00:19:35 +02:00
private TreeTableView < tableData > tableCurrentOrder ;
2018-03-29 19:51:34 +02:00
2018-03-29 19:45:41 +02:00
@FXML
2018-03-30 00:19:35 +02:00
private TreeTableColumn < tableData , String > columnQuantity ;
2018-03-29 19:51:34 +02:00
2018-03-29 19:45:41 +02:00
@FXML
2018-03-30 00:19:35 +02:00
private TreeTableColumn < tableData , String > columnPosition ;
2018-03-29 19:51:34 +02:00
2018-03-29 19:45:41 +02:00
@FXML
2018-03-31 00:35:45 +02:00
private TreeTableColumn < tableData , Integer > idSpalte01 = new TreeTableColumn < > (
2018-04-02 15:07:58 +02:00
" tableCurrentOrder " ) ;
2018-03-31 00:35:45 +02:00
@FXML
private TreeTableView < tableData > jobsTreeTable ;
@FXML
2018-04-02 15:07:58 +02:00
private TreeTableColumn < tableData , String > columnJobValue ;
2018-03-31 00:35:45 +02:00
@FXML
private TreeTableColumn < tableData , String > columnState ;
@FXML
private TreeTableColumn < tableData , String > columnPositions ;
@FXML
private TreeTableColumn < tableData , String > columnTime ;
@FXML
2018-04-02 15:07:58 +02:00
private TreeTableColumn < tableData , String > columnJobNumber ;
2018-03-31 00:35:45 +02:00
@FXML
private TreeTableColumn < tableData , Integer > idSpalte02 = new TreeTableColumn < > (
2018-04-02 15:07:58 +02:00
" jobsTreeTable " ) ;
2018-03-29 19:51:34 +02:00
2018-03-31 02:00:12 +02:00
@FXML
2018-04-02 15:07:58 +02:00
private TreeTableView < tableDataPositionen > entryTreeTable ;
2018-03-31 02:00:12 +02:00
@FXML
2018-04-02 15:07:58 +02:00
private TreeTableColumn < tableDataPositionen , String > columnColor ;
2018-03-31 02:00:12 +02:00
@FXML
2018-04-02 15:07:58 +02:00
private TreeTableColumn < tableDataPositionen , String > columnPrize ;
2018-03-31 02:00:12 +02:00
@FXML
2018-04-02 15:07:58 +02:00
private TreeTableColumn < tableDataPositionen , String > columnPositionsEdit ;
2018-03-31 02:00:12 +02:00
@FXML
2018-04-02 15:07:58 +02:00
private TreeTableColumn < tableDataPositionen , Integer > columnPosnumber ;
2018-03-31 02:00:12 +02:00
@FXML
2018-04-02 15:07:58 +02:00
private ChoiceBox < String > colorChoise ;
2018-03-31 02:00:12 +02:00
2018-03-29 19:45:41 +02:00
@FXML
private Button ueberbtn ;
2018-03-29 19:51:34 +02:00
2018-03-29 22:48:11 +02:00
@FXML
private Button gridButton01 ;
@FXML
private Button gridButton02 ;
@FXML
private Button gridButton03 ;
@FXML
private Button gridButton04 ;
@FXML
private Button gridButton05 ;
@FXML
private Button gridButton06 ;
@FXML
private Button gridButton07 ;
@FXML
private Button gridButton08 ;
@FXML
private Button gridButton09 ;
@FXML
private Button gridButton10 ;
@FXML
private Button gridButton11 ;
@FXML
private Button gridButton12 ;
@FXML
private Button gridButton13 ;
@FXML
private Button gridButton14 ;
@FXML
private Button gridButton15 ;
@FXML
private Button gridButton16 ;
@FXML
private Button gridButton17 ;
@FXML
private Button gridButton18 ;
@FXML
private Button gridButton19 ;
@FXML
private Button gridButton20 ;
@FXML
private Button gridButton21 ;
@FXML
private Button gridButton22 ;
@FXML
private Button gridButton23 ;
@FXML
private Button gridButton24 ;
@FXML
private Button gridButton25 ;
2018-03-30 00:19:35 +02:00
@FXML
private Button btnDeleteSelectedPosition ;
@FXML
private Button btnPrintBill ;
@FXML
private Button btnLock ;
2018-03-31 00:35:45 +02:00
@FXML
private Button btnReprintJob ;
@FXML
2018-04-02 15:07:58 +02:00
private Button btnCancelJob ;
2018-03-31 00:35:45 +02:00
@FXML
private Button btnCalcStats ;
2018-03-31 02:00:12 +02:00
@FXML
private Button btnSaveEntry ;
@FXML
private Button btnClearEntry ;
2018-03-31 23:50:17 +02:00
@FXML
private Button btnCreateNewDatabase ;
@FXML
private Button btnOpenFolder ;
2018-03-30 00:19:35 +02:00
@FXML
private Label labelAllPrize ;
@FXML
private Label labelJobCounter ;
@FXML
private Label labelTime ;
2018-03-31 00:35:45 +02:00
@FXML
private Label lableJobCount ;
@FXML
private Label labelAvgJob ;
@FXML
private Label lableAllValue ;
2018-03-31 02:00:12 +02:00
@FXML
private Label lableNewPosition ;
@FXML
private Label labelNewValue ;
@FXML
private Label lableNewColor ;
2018-03-31 23:50:17 +02:00
@FXML
private Label labelDBStatus ;
@FXML
private Label labelDBName ;
2018-03-31 00:35:45 +02:00
@FXML
private TitledPane titlePaneStats ;
2018-03-31 02:00:12 +02:00
@FXML
private TextField tftNewPosition ;
@FXML
private TextField tftNewValue ;
2018-03-31 23:50:17 +02:00
@FXML
private TextField tftNewDBName ;
2018-03-29 19:45:41 +02:00
private Main main ;
2018-03-29 19:51:34 +02:00
2018-03-29 19:45:41 +02:00
private DBController dbc ;
2018-03-29 19:51:34 +02:00
private String filepathXMLLinux = System . getProperty ( " user.home " )
2018-03-31 23:50:17 +02:00
+ " /bin/jFxKasse/config.xml " ; // Pfad wo die XML liegt
2018-03-29 19:51:34 +02:00
2018-04-02 15:07:58 +02:00
private int idPositionen = 0 ;
private String selectedColorName ;
2018-03-29 19:51:34 +02:00
2018-03-31 23:50:17 +02:00
private String databaseName ;
2018-04-02 15:07:58 +02:00
// private ObservableList<String> color =
// FXCollections.observableArrayList("English", "Deutsch");
2018-03-29 19:45:41 +02:00
@FXML
2018-04-02 15:07:58 +02:00
TreeItem < tableData > rootCurrentJob = new TreeItem < > (
new tableData ( 0 , " 0 " , " 0 " ) ) ;
@FXML
TreeItem < tableData > rootJobs = new TreeItem < > ( new tableData ( 0 , " 0 " , " 0 " ) ) ;
@FXML
TreeItem < tableDataPositionen > rootPositionen = new TreeItem < > (
new tableDataPositionen ( 0 , " 0 " , " 0 " , " 0 " ) ) ;
2018-03-29 19:51:34 +02:00
2018-03-29 19:45:41 +02:00
Properties props = new Properties ( ) ;
@FXML
2018-03-29 19:51:34 +02:00
public void ueberbtnAction ( ActionEvent event )
{ // Öffnet den Über-Dialog
2018-03-29 19:45:41 +02:00
// Erstellt einen Dialog
Dialog < Pair < String , String > > dialog = new Dialog < > ( ) ;
2018-03-31 02:00:12 +02:00
dialog . setTitle ( " Über jFxKasse " ) ;
2018-03-31 23:50:17 +02:00
dialog . setHeaderText (
" Informationen und Lizenzen - Version 0.7 - UI Techdemo " ) ;
2018-03-29 19:45:41 +02:00
// Erzeugt den Button
dialog . getDialogPane ( ) . getButtonTypes ( ) . addAll ( ButtonType . OK ) ;
// Erzeugt die Textfelder und Label
GridPane grid = new GridPane ( ) ;
grid . setHgap ( 10 ) ;
grid . setVgap ( 10 ) ;
grid . setPadding ( new Insets ( 20 , 150 , 10 , 10 ) ) ;
2018-03-29 19:51:34 +02:00
grid . add ( new Label ( " Datenbank: sqlite.org - Public Domain "
+ " \ nUI Design: eclipse.org/efxclipse/install.html - Eclipse Public License 1.0 "
+ " \ nUI - Datenbank Integration: basierend auf Project-HomeFlix - github.com/Seil0/Project-HomeFlix - GPLv3 \ n "
2018-03-31 02:00:12 +02:00
+ " \ nMaintainer: hendrik.schutter@coptersicht.de "
+ " \ n(c) 2018 Hendrik Schutter " ) , 0 , 0 ) ;
2018-03-29 19:45:41 +02:00
2018-03-29 19:51:34 +02:00
dialog . getDialogPane ( ) . setContent ( grid ) ; // Setzt die GridPane auf die
2018-03-31 23:50:17 +02:00
dialog . setResizable ( true ) ; // DialogPane
2018-03-29 19:45:41 +02:00
dialog . showAndWait ( ) ;
}
2018-03-29 19:51:34 +02:00
2018-03-31 23:50:17 +02:00
@FXML
public void btnOpenFolderAction ( ActionEvent event ) throws IOException
{
2018-04-02 15:07:58 +02:00
Runtime . getRuntime ( ) . exec (
" xdg-open " + System . getProperty ( " user.home " ) + " /bin/jFxKasse " ) ;
2018-03-31 23:50:17 +02:00
}
@FXML
public void btnCreateNewDatabaseAction ( ActionEvent event ) throws Exception
{
System . out . println ( " Button! " ) ;
System . out . println ( tftNewDBName . getText ( ) ) ;
setDatabaseName ( tftNewDBName . getText ( ) ) ;
dbc . dbname = getDatabaseName ( ) ;
dbc . verbindeDatenbank ( ) ; // Verbindet mit der Datenbank-Datei
2018-04-02 15:07:58 +02:00
dbc . erstelleTabellePositionen ( ) ;
2018-03-31 23:50:17 +02:00
dbc . erstelleTabelleJobs ( ) ;
try {
saveSettings ( getDatabaseName ( ) ) ;
} catch ( Exception e ) {
// TODO Auto-generated catch block
e . printStackTrace ( ) ;
}
setDBLabel ( ) ;
2018-04-02 15:07:58 +02:00
blockUI ( false ) ;
fuelleTabllePositionen ( ) ;
2018-03-31 23:50:17 +02:00
initUI ( ) ; // Startet die UI
}
2018-03-31 02:00:12 +02:00
@FXML
public void btnSaveEntryAction ( ActionEvent event )
{
2018-04-02 15:07:58 +02:00
System . out . println ( " Speichere Eintrag! " ) ;
dbc . setName ( idPositionen , tftNewPosition . getText ( ) ) ;
dbc . setValue ( idPositionen , tftNewValue . getText ( ) ) ;
dbc . setColor ( idPositionen , getColorCodes ( selectedColorName ) ) ;
fuelleTabllePositionen ( ) ;
2018-03-31 02:00:12 +02:00
}
@FXML
public void btnClearEntryAction ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
2018-03-31 00:35:45 +02:00
@FXML
public void btnCalcStatsAction ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void btnReprintJobAction ( ActionEvent event )
{
2018-04-02 15:07:58 +02:00
// System.out.println("fuelleTabellePositionen");
// fuelleTabllePositionen();
2018-03-31 00:35:45 +02:00
}
@FXML
2018-04-02 15:07:58 +02:00
public void btnCancelJobAction ( ActionEvent event )
2018-03-31 00:35:45 +02:00
{
System . out . println ( " Button! " ) ;
}
2018-03-30 00:19:35 +02:00
@FXML
public void btnLockAction ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
2018-04-02 15:07:58 +02:00
dbc . ausgebenSysoPositionen ( ) ;
2018-03-30 00:19:35 +02:00
}
@FXML
public void btnDeleteSelectedPositionAction ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void btnPrintBillAction ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
2018-03-29 22:48:11 +02:00
@FXML
public void gridButton01Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton02Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton03Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton04Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton05Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton06Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton07Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton08Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton09Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton10Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton11Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton12Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton13Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton14Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton15Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton16Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton17Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton18Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton19Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton20Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton21Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton22Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton23Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton24Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
@FXML
public void gridButton25Action ( ActionEvent event )
{
System . out . println ( " Button! " ) ;
}
2018-03-29 19:45:41 +02:00
@FXML
2018-03-29 19:51:34 +02:00
2018-04-02 15:07:58 +02:00
public void fuelleTabllePositionen ( )
2018-03-29 19:51:34 +02:00
{ // Lädt die Datenbank in die Tabelle
2018-03-31 02:00:12 +02:00
// dbc.setSchluessel(schluessel);
2018-04-02 15:07:58 +02:00
rootPositionen . getChildren ( ) . remove ( 0 ,
rootPositionen . getChildren ( ) . size ( ) ) ;
for ( int i = 0 ; i < dbc . ladeTabellePositionen ( ) . size ( ) ; i + + ) {
tableDataPositionen helpTableData = new tableDataPositionen (
dbc . ladeTabellePositionen ( ) . get ( i ) . getID ( ) ,
dbc . ladeTabellePositionen ( ) . get ( i ) . getName ( ) ,
dbc . ladeTabellePositionen ( ) . get ( i ) . getValue ( ) ,
getColorNames ( dbc . ladeTabellePositionen ( ) . get ( i ) . getColor ( ) ) ) ;
rootPositionen . getChildren ( )
. add ( new TreeItem < tableDataPositionen > ( helpTableData ) ) ;
2018-03-29 19:45:41 +02:00
}
}
2018-03-29 19:51:34 +02:00
public void initUI ( )
{
2018-03-31 23:50:17 +02:00
System . out . println ( " initUI " ) ;
tftNewDBName . setText ( getDatabaseName ( ) ) ;
2018-04-02 15:07:58 +02:00
initPositionen ( ) ;
}
private void initPositionen ( )
{
entryTreeTable . setRoot ( rootPositionen ) ;
entryTreeTable . setShowRoot ( false ) ;
entryTreeTable . setEditable ( false ) ;
ObservableList < String > color = FXCollections . observableArrayList ( " Rot " ,
" Orange " , " Braun " , " Weiß " , " Gelb " , " Gr \ u00fcn " , " Blau " , " Indigo " ) ;
colorChoise . setItems ( color ) ;
colorChoise . getSelectionModel ( ) . selectedIndexProperty ( )
. addListener ( new ChangeListener < Number > ( ) {
@Override
public void changed ( ObservableValue < ? extends Number > ov ,
Number value , Number new_value )
{
selectedColorName = colorChoise . getItems ( )
. get ( ( int ) new_value ) . toString ( ) ;
System . out . println ( " Ausgewählte Farbe: " + selectedColorName ) ;
}
} ) ;
2018-03-29 19:45:41 +02:00
2018-04-02 15:07:58 +02:00
columnPosnumber . setCellValueFactory (
2018-03-29 19:51:34 +02:00
cellData - > cellData . getValue ( ) . getValue ( ) . idProperty ( ) . asObject ( ) ) ;
2018-04-02 15:07:58 +02:00
columnPositionsEdit . setCellValueFactory (
cellData - > cellData . getValue ( ) . getValue ( ) . nameProperty ( ) ) ;
columnPrize . setCellValueFactory (
cellData - > cellData . getValue ( ) . getValue ( ) . valueProperty ( ) ) ;
columnColor . setCellValueFactory (
cellData - > cellData . getValue ( ) . getValue ( ) . colorProperty ( ) ) ;
entryTreeTable . getSelectionModel ( ) . selectedItemProperty ( )
2018-03-29 19:51:34 +02:00
. addListener ( new ChangeListener < Object > ( ) {
@Override
public void changed ( ObservableValue < ? > observable , Object oldVal ,
Object newVal )
{
// last = selected; //for auto-play
2018-04-02 15:07:58 +02:00
int selected = entryTreeTable . getSelectionModel ( )
2018-03-29 19:51:34 +02:00
. getSelectedIndex ( ) ; // get selected item
2018-04-02 15:07:58 +02:00
idPositionen = columnPosnumber . getCellData ( selected ) ; // Ausgewählte
// Spalte
System . out . println (
" Positionen - Ausgewaehlte Spalte: " + idPositionen ) ;
try { // Setzt den Inhalt in die Textfelder
tftNewPosition . setText ( dbc . getName ( idPositionen ) ) ;
tftNewValue . setText ( dbc . getValue ( idPositionen ) ) ;
colorChoise . getSelectionModel ( )
. select ( getColorID ( dbc . getColor ( idPositionen ) ) ) ;
2018-03-29 19:51:34 +02:00
} catch ( Exception e ) {
// TODO Auto-generated catch block
e . printStackTrace ( ) ;
}
}
} ) ;
2018-04-02 15:07:58 +02:00
2018-03-29 19:45:41 +02:00
}
2018-03-29 19:51:34 +02:00
public void setMain ( Main main , DBController dbc )
{
2018-03-29 19:45:41 +02:00
this . main = main ;
this . dbc = dbc ;
}
2018-03-29 19:51:34 +02:00
public String getSystemDatum ( )
{ // Gibt das System-Datum zurück
2018-03-29 19:45:41 +02:00
java . util . Date now = new java . util . Date ( ) ;
2018-03-29 19:51:34 +02:00
java . text . SimpleDateFormat sdf = new java . text . SimpleDateFormat (
" dd.MM.yyyy " ) ;
2018-03-29 19:45:41 +02:00
String heutigesDatum = sdf . format ( now ) ;
return heutigesDatum ;
}
2018-03-29 19:51:34 +02:00
2018-03-31 23:50:17 +02:00
public void saveSettings ( String databasename ) throws Exception
2018-03-29 19:51:34 +02:00
{
OutputStream outputStream ; // new output-stream
2018-03-29 19:45:41 +02:00
try {
2018-03-31 23:50:17 +02:00
props . setProperty ( " databasename " , databasename ) ; // writes dbname into
// property
2018-04-02 15:07:58 +02:00
outputStream = new FileOutputStream ( filepathXMLLinux ) ;
2018-03-31 23:50:17 +02:00
props . storeToXML ( outputStream , " jFxKasse settings " ) ; // writes new .xml
2018-03-29 19:45:41 +02:00
outputStream . close ( ) ;
} catch ( IOException e ) {
}
}
2018-03-29 19:51:34 +02:00
public boolean loadSettings ( ) throws Exception
{ // Ladt die Daten aus der XML
2018-03-29 19:45:41 +02:00
InputStream inputStream ;
try {
2018-04-02 15:07:58 +02:00
inputStream = new FileInputStream ( filepathXMLLinux ) ;
2018-03-29 19:45:41 +02:00
props . loadFromXML ( inputStream ) ;
2018-03-31 23:50:17 +02:00
setDatabaseName ( props . getProperty ( " databasename " ) ) ;
// = crypo.entschluesseln(props.getProperty("key"),
2018-03-29 19:51:34 +02:00
// crypo.getProgrammSchluessel()); //liest schluessel von property
// base32Secret = crypo.entschluesseln(props.getProperty("TOTPkey"),
// crypo.getProgrammSchluessel()); //liest schluessel von property
2018-03-29 19:45:41 +02:00
inputStream . close ( ) ;
return true ;
} catch ( IOException e ) {
e . printStackTrace ( ) ;
return false ;
}
}
2018-03-29 19:51:34 +02:00
public void starteDB ( )
{ // Startet die Datenbank
2018-03-29 19:45:41 +02:00
dbc . verbindeDatenbank ( ) ;
}
2018-03-29 19:51:34 +02:00
2018-03-31 23:50:17 +02:00
public String getDatabaseName ( )
{
return databaseName ;
}
public void setDatabaseName ( String NewDatabaseName )
{
databaseName = NewDatabaseName ;
}
public void setDBLabel ( ) throws Exception
{
if ( loadSettings ( ) = = true ) {
labelDBStatus
. setText ( " Geladene Datenbank: " + getDatabaseName ( ) + " .db " ) ;
btnCreateNewDatabase . setDisable ( true ) ;
tftNewDBName . setDisable ( true ) ;
labelDBName . setTooltip ( new Tooltip (
" Um eine neue Datenbank zu erzeugen muss die vorherige config.xml und "
2018-04-02 15:07:58 +02:00
+ getDatabaseName ( )
+ " .db gelöscht werden! Anwendung danach neustarten! " ) ) ;
2018-03-31 23:50:17 +02:00
labelDBStatus . setTooltip ( new Tooltip (
" Um eine neue Datenbank zu erzeugen muss die vorherige config.xml und "
2018-04-02 15:07:58 +02:00
+ getDatabaseName ( )
+ " .db gelöscht werden! Anwendung danach neustarten! " ) ) ;
2018-03-31 23:50:17 +02:00
} else {
labelDBStatus . setText ( " Keine Datenbank gefunden! " ) ;
}
2018-03-29 19:45:41 +02:00
}
2018-03-29 19:51:34 +02:00
2018-04-02 15:07:58 +02:00
private String getColorCodes ( String pColorName )
{
switch ( pColorName ) {
case " Rot " :
return " #FF0000 " ;
case " Orange " :
return " #FF4500 " ;
case " Braun " :
return " #8B4513 " ;
case " Weiß " :
return " #FAF0E6 " ;
case " Gelb " :
return " #FFD700 " ;
case " Gr \ u00fcn " :
return " #556B2F " ;
case " Blau " :
return " #00BFFF " ;
case " Indigo " :
return " #4B0082 " ;
default :
return " #FFFFFF " ;
}
}
private String getColorNames ( String pColorCode )
{
switch ( pColorCode ) {
case " #FF0000 " :
return " Rot " ;
case " #FF4500 " :
return " Orange " ;
case " #8B4513 " :
return " Braun " ;
case " #FAF0E6 " :
return " Weiß " ;
case " #FFD700b " :
return " Gelb " ;
case " #556B2F " :
return " Gr \ u00fcn " ;
case " #00BFFF " :
return " Blau " ;
case " #4B0082 " :
return " Indigo " ;
default :
return " Farbe " ;
}
}
private Integer getColorID ( String pColorCode )
{
switch ( pColorCode ) {
case " #FF0000 " :
return 0 ;
case " #FF4500 " :
return 1 ;
case " #8B4513 " :
return 2 ;
case " #FAF0E6 " :
return 3 ;
case " #FFD700b " :
return 4 ;
case " #556B2F " :
return 5 ;
case " #00BFFF " :
return 6 ;
case " #4B0082 " :
return 7 ;
default :
return 0 ;
}
}
public void blockUI ( boolean pState )
{
btnCalcStats . setDisable ( pState ) ;
btnClearEntry . setDisable ( pState ) ;
btnDeleteSelectedPosition . setDisable ( pState ) ;
btnPrintBill . setDisable ( pState ) ;
btnReprintJob . setDisable ( pState ) ;
btnSaveEntry . setDisable ( pState ) ;
btnCancelJob . setDisable ( pState ) ;
gridButton01 . setDisable ( pState ) ;
gridButton02 . setDisable ( pState ) ;
gridButton03 . setDisable ( pState ) ;
gridButton04 . setDisable ( pState ) ;
gridButton05 . setDisable ( pState ) ;
gridButton06 . setDisable ( pState ) ;
gridButton07 . setDisable ( pState ) ;
gridButton08 . setDisable ( pState ) ;
gridButton09 . setDisable ( pState ) ;
gridButton10 . setDisable ( pState ) ;
gridButton11 . setDisable ( pState ) ;
gridButton12 . setDisable ( pState ) ;
gridButton13 . setDisable ( pState ) ;
gridButton14 . setDisable ( pState ) ;
gridButton15 . setDisable ( pState ) ;
gridButton16 . setDisable ( pState ) ;
gridButton17 . setDisable ( pState ) ;
gridButton18 . setDisable ( pState ) ;
gridButton19 . setDisable ( pState ) ;
gridButton20 . setDisable ( pState ) ;
gridButton21 . setDisable ( pState ) ;
gridButton22 . setDisable ( pState ) ;
gridButton23 . setDisable ( pState ) ;
gridButton24 . setDisable ( pState ) ;
gridButton25 . setDisable ( pState ) ;
tftNewPosition . setDisable ( pState ) ;
tftNewValue . setDisable ( pState ) ;
colorChoise . setDisable ( pState ) ;
tableCurrentOrder . setDisable ( pState ) ;
jobsTreeTable . setDisable ( pState ) ;
entryTreeTable . setDisable ( pState ) ;
labelAllPrize . setVisible ( ! pState ) ;
labelJobCounter . setVisible ( ! pState ) ;
titlePaneStats . setVisible ( ! pState ) ;
}
2018-03-29 19:45:41 +02:00
}