Revize e3d5fc53
Přidáno uživatelem Jan Havlíček před více než 4 roky(ů)
project/Deserializer/src/Report.java | ||
---|---|---|
1 |
import java.util.List; |
|
2 |
import java.util.stream.Collectors; |
|
3 |
|
|
1 | 4 |
import com.sun.javafx.stage.StageHelper; |
2 | 5 |
|
3 | 6 |
import javafx.application.Platform; |
... | ... | |
5 | 8 |
import javafx.scene.control.Alert; |
6 | 9 |
import javafx.scene.control.Alert.AlertType; |
7 | 10 |
import javafx.stage.Screen; |
11 |
import javafx.stage.Stage; |
|
12 |
import javafx.stage.Window; |
|
8 | 13 |
|
9 | 14 |
public class Report { |
10 | 15 |
|
11 | 16 |
private static final int HEIGHT = 200; |
12 | 17 |
private static final int WIDTH = 500; |
13 |
|
|
18 |
|
|
14 | 19 |
private static void setPosition(Alert alert) { |
15 |
if (StageHelper.getStages() != null && StageHelper.getStages().size() != 0) { |
|
20 |
List<Stage> stages = Window.getWindows().stream() |
|
21 |
.filter(Stage.class::isInstance) |
|
22 |
.map(Stage.class::cast) |
|
23 |
.collect(Collectors.toList()); |
|
24 |
//instead of StageHelper.getStages(); |
|
25 |
|
|
26 |
if (stages != null && stages.size() != 0) { |
|
16 | 27 |
if (Screen.getPrimary() != null && Screen.getPrimary().getVisualBounds() != null) { |
17 | 28 |
Rectangle2D primScreenBounds = Screen.getPrimary().getVisualBounds(); |
18 | 29 |
alert.setX((primScreenBounds.getWidth() - WIDTH - 20) / 2); |
19 | 30 |
alert.setY((primScreenBounds.getHeight() - HEIGHT - 20) / 3); |
20 | 31 |
} |
21 |
alert.initOwner(StageHelper.getStages().get(StageHelper.getStages().size() - 1));
|
|
32 |
alert.initOwner(stages.get(stages.size() - 1));
|
|
22 | 33 |
} |
23 | 34 |
} |
24 | 35 |
|
Také k dispozici: Unified diff
#7794
The jdeserializer.instance type of content gives correct format of output data (JSON-like) through method simpleFormatToString() : String
Works only with primitive data types though