Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
twi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Maria Barbatei
twi
Commits
76236008
Commit
76236008
authored
May 27, 2016
by
Aljoscha Niazi-Shahabi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace Uebung7Gui.java
parent
bafa8359
Pipeline
#2811
skipped
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
81 additions
and
18 deletions
+81
-18
Sandbox/Uebung7Gui.java
Sandbox/Uebung7Gui.java
+81
-18
No files found.
Sandbox/Uebung7Gui.java
View file @
76236008
...
...
@@ -74,22 +74,25 @@ import javafx.event.EventHandler;
import
javafx.event.ActionEvent
;
import
javafx.geometry.Insets
;
import
javafx.geometry.Orientation
;
import
javafx.geometry.Pos
;
import
java.io.File
;
import
java.io.FileWriter
;
import
java.io.IOException
;
import
javafx.scene.input.MouseEvent
;
import
javafx.scene.Scene
;
import
javafx.scene.control.
Button
;
import
javafx.scene.control.Label
;
import
javafx.scene.control.
*
;
/*
import javafx.scene.control.Label;
import javafx.scene.control.ScrollBar;
import javafx.scene.control.TextField;
import javafx.scene.control.TreeItem;
import
javafx.scene.control.TreeView
;
import javafx.scene.control.TreeView;
*/
import
javafx.scene.layout.BorderPane
;
import
javafx.scene.layout.HBox
;
import
javafx.scene.layout.VBox
;
import
javafx.stage.DirectoryChooser
;
import
javafx.stage.FileChooser
;
import
javafx.stage.Stage
;
import
javafx.scene.text.Text
;
/**
...
...
@@ -149,9 +152,21 @@ public class Uebung7Gui extends Application {
bp
.
setPadding
(
new
Insets
(
10
,
20
,
10
,
20
));
final
FileChooser
fileChooser
=
new
FileChooser
();
final
Button
btnBrowse
=
new
Button
(
"
Arztbrief auswähl
en"
);
final
Button
btnBrowse
=
new
Button
(
"
Durchsuch
en"
);
final
Button
btnJSON
=
new
Button
(
"Als JSON exportieren"
);
final
Button
btnAnalyze
=
new
Button
(
"Arztbrief analysieren"
);
final
Button
btnAnalyze
=
new
Button
(
"Analysieren"
);
final
ComboBox
pfadComboBox
=
new
ComboBox
();
pfadComboBox
.
setEditable
(
true
);
pfadComboBox
.
valueProperty
().
addListener
(
new
ChangeListener
<
String
>()
{
@Override
public
void
changed
(
ObservableValue
ov
,
String
t
,
String
t1
)
{
arztbrief
=
t1
;
}
});
btnBrowse
.
setOnAction
(
...
...
@@ -161,7 +176,10 @@ public class Uebung7Gui extends Application {
configureFileChooser
(
fileChooser
);
File
file
=
fileChooser
.
showOpenDialog
(
primaryStage
);
if
(
file
!=
null
)
{
arztbrief
=
file
.
getPath
();
pfadComboBox
.
getItems
().
addAll
(
file
.
getPath
()
);
pfadComboBox
.
setValue
(
file
.
getPath
());
}
}
});
...
...
@@ -175,16 +193,40 @@ public class Uebung7Gui extends Application {
System
.
out
.
println
(
arztbrief
);
}
});
btnJSON
.
setOnAction
(
new
EventHandler
<
ActionEvent
>()
{
@Override
public
void
handle
(
ActionEvent
event
)
{
FileChooser
fileChooser
=
new
FileChooser
();
fileChooser
.
setInitialDirectory
(
new
File
(
System
.
getProperty
(
"user.home"
))
);
//Nur .json Dateien als Möglichkeit festlegen
FileChooser
.
ExtensionFilter
extFilter
=
new
FileChooser
.
ExtensionFilter
(
"JSON-Dateien (*.json)"
,
"*.json"
);
fileChooser
.
getExtensionFilters
().
add
(
extFilter
);
//Speicherdialog anzeigen
File
file
=
fileChooser
.
showSaveDialog
(
primaryStage
);
if
(
file
!=
null
){
//Datei als JSON speichern
SaveFile
(
file
);
}
}
});
// Elemente des TopPanes initialisieren
Insets
standardabstand
=
new
Insets
(
10
,
10
,
10
,
10
);
Label
toplabel1
=
new
Label
(
"Arztbrief auswählen"
);
Label
toplabel
=
new
Label
(
"Arztbrief auswählen:"
);
Label
emptylabel
=
new
Label
(
""
);
toplabel1
.
setPadding
(
standardabstand
);
//toplabel.setPadding(standardabstand);
btnAnalyze
.
setAlignment
(
toplabel
.
getAlignment
());
HBox
topbox1
=
new
HBox
(
20
);
...
...
@@ -193,11 +235,15 @@ public class Uebung7Gui extends Application {
HBox
topbox2
=
new
HBox
(
20
);
topbox2
.
setPadding
(
standardabstand
);
VBox
main_topbox
=
new
VBox
(
5
);
HBox
topbox3
=
new
HBox
(
20
);
topbox2
.
setPadding
(
standardabstand
);
VBox
main_topbox
=
new
VBox
(
1
);
topbox1
.
getChildren
().
setAll
(
btnBrowse
);
topbox1
.
getChildren
().
setAll
(
toplabel
,
pfadComboBox
,
btnBrowse
);
topbox2
.
getChildren
().
setAll
(
btnAnalyze
);
main_topbox
.
getChildren
().
setAll
(
topbox1
,
topbox2
);
topbox3
.
getChildren
().
setAll
(
emptylabel
);
main_topbox
.
getChildren
().
setAll
(
topbox1
,
topbox2
,
topbox3
);
bp
.
setTop
(
main_topbox
);
...
...
@@ -234,11 +280,13 @@ public class Uebung7Gui extends Application {
primaryStage
.
setScene
(
scene
);
primaryStage
.
show
();
pfadComboBox
.
setMaxWidth
(
scene
.
getWidth
()*
0.6
);
pfadComboBox
.
setMinWidth
(
scene
.
getWidth
()*
0.6
);
//Elemente der BottomPane initialisieren
//btnJSON.setTranslateX(scene.getWidth()*0.75);
bp
.
setBottom
(
btnJSON
);
}
/* handle wird aufgerufen sobald ein Button geklickt wird
...
...
@@ -247,10 +295,7 @@ public class Uebung7Gui extends Application {
if (event.getSource() == btnJSON) {
}
}
...
...
@@ -290,6 +335,24 @@ public class Uebung7Gui extends Application {
parent
.
getChildren
().
add
(
item
);
return
item
;
}
private
void
SaveFile
(
File
file
){
try
{
FileWriter
fileWriter
=
new
FileWriter
(
file
);
//TEST STRING!
String
content
=
"GET JSON STRING VOM BACKEND_____"
;
fileWriter
.
write
(
content
);
fileWriter
.
close
();
}
catch
(
IOException
ex
)
{
Logger
.
getLogger
(
Uebung7Gui
.
class
.
getName
()).
log
(
Level
.
SEVERE
,
null
,
ex
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment