Skip to content

Commit 60d12e3

Browse files
author
Open Lowcode SAS
committed
Close #59
1 parent aa895ae commit 60d12e3

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

src/org/openlowcode/client/graphic/widget/CImageChooser.java

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,13 @@ public Node getNode(
121121
Window parentwindow,
122122
TabPane[] parenttabpanes) {
123123
BorderPane borderpane = new BorderPane();
124-
Button launchaction = new Button(title);
124+
Button launchaction = new Button(title+" (selection)");
125+
Button launchactionfull = new Button(title+" (full)");
125126
launchaction.setStyle("-fx-base: #ffffff; -fx-hover-base: #ddeeff;");
127+
launchactionfull.setStyle("-fx-base: #ffffff; -fx-hover-base: #ddeeff;");
126128
actionmanager.registerEvent(launchaction, actiontolaunch);
129+
actionmanager.registerEvent(launchactionfull, actiontolaunch);
130+
127131
Pane buttonbox = CComponentBand.returnBandPane(CComponentBand.DIRECTION_RIGHT);
128132
mainscrollpane = new ScrollPane();
129133
mainscrollpane.setMinHeight(500 + 16);
@@ -168,6 +172,34 @@ public void handle(ActionEvent event) {
168172

169173
});
170174

175+
launchactionfull.setOnAction(new EventHandler<ActionEvent>() {
176+
@Override
177+
public void handle(ActionEvent event) {
178+
if (referenceimage != null) {
179+
try {
180+
BufferedImage referenceimagebuffered = SwingFXUtils.fromFXImage(referenceimage, null);
181+
ByteArrayOutputStream referenceimageoutputstream = new ByteArrayOutputStream();
182+
ImageIO.write(referenceimagebuffered, "PNG", referenceimageoutputstream);
183+
fullimage = referenceimageoutputstream.toByteArray();
184+
ByteArrayInputStream bigimageinputstream = new ByteArrayInputStream(fullimage);
185+
Image Thumbnail = new Image(bigimageinputstream, thumbnailsize, thumbnailsize, true, true);
186+
BufferedImage thumbnailimage = SwingFXUtils.fromFXImage(Thumbnail, null);
187+
ByteArrayOutputStream thumbnailstream = new ByteArrayOutputStream();
188+
ImageIO.write(thumbnailimage, "PNG", thumbnailstream);
189+
thumbnail = thumbnailstream.toByteArray();
190+
filesgenerated = true;
191+
actionmanager.handle(event);
192+
193+
} catch (Exception e) {
194+
logger.warning("Error in file generation " + e.getClass().getName() + " - " + e.getMessage());
195+
for (int i = 0; i < e.getStackTrace().length; i++)
196+
logger.warning(" " + e.getStackTrace()[i]);
197+
}
198+
199+
}
200+
}
201+
});
202+
171203
Button button = new Button("get Image from clipboard");
172204
button.setStyle("-fx-base: #ffffff; -fx-hover-base: #ddeeff;");
173205
button.setOnAction(new EventHandler<ActionEvent>() {
@@ -248,6 +280,7 @@ public void handle(ActionEvent arg0) {
248280
buttonbox.getChildren().add(button);
249281
buttonbox.getChildren().add(loadfromfile);
250282
buttonbox.getChildren().add(launchaction);
283+
buttonbox.getChildren().add(launchactionfull);
251284

252285
borderpane.setTop(buttonbox);
253286
borderpane.setCenter(mainscrollpane);

0 commit comments

Comments
 (0)