@@ -211,17 +211,21 @@ trait ShowMessage {
211
211
* @param header header text.
212
212
* @param content main content text.
213
213
*/
214
- def showError (title : String , header : String , content : String = " " ): Unit = {
214
+ def showError (title : String , header : String , content : String = " " , resizable : Boolean = false ): Unit = {
215
215
messageLogger.foreach(_.error(s " < $title> $header $content" ))
216
216
// Rename to avoid name clashes
217
- val dialogTitle = title
217
+ val _title = title
218
+ val _resizable = resizable
218
219
219
220
onFXAndWait {
220
221
new Alert (AlertType .Error ) {
221
222
initOwner(parentWindow.orNull)
222
- this .title = dialogTitle
223
+ this .title = _title
223
224
headerText = header
224
225
contentText = content
226
+ this .resizable = _resizable
227
+ dialogPane().setMinWidth(Region .USE_PREF_SIZE )
228
+ dialogPane().setMinHeight(Region .USE_PREF_SIZE )
225
229
}.showAndWait()
226
230
}
227
231
}
@@ -248,18 +252,18 @@ trait ShowMessage {
248
252
def showInformation (title : String , header : String , content : String , resizable : Boolean = false ): Unit = {
249
253
// messageLogger.info(s"<$title> $header $content")
250
254
// Rename to avoid name clashes
251
- val dialogTitle = title
252
-
255
+ val _title = title
253
256
val _resizable = resizable
254
257
255
258
onFXAndWait {
256
259
new Alert (AlertType .Information ) {
257
260
initOwner(parentWindow.orNull)
258
- this .title = dialogTitle
261
+ this .title = _title
259
262
headerText = header
260
263
contentText = content
261
264
this .resizable = _resizable
262
- dialogPane().minHeight(Region .USE_PREF_SIZE )
265
+ dialogPane().setMinWidth(Region .USE_PREF_SIZE )
266
+ dialogPane().setMinHeight(Region .USE_PREF_SIZE )
263
267
}.showAndWait()
264
268
}
265
269
}
@@ -271,17 +275,21 @@ trait ShowMessage {
271
275
* @param header header text.
272
276
* @param content main content text.
273
277
*/
274
- def showWarning (title : String , header : String , content : String ): Unit = {
278
+ def showWarning (title : String , header : String , content : String , resizable : Boolean = false ): Unit = {
275
279
messageLogger.foreach(_.warn(s " < $title> $header $content" ))
276
280
// Rename to avoid name clashes
277
- val dialogTitle = title
281
+ val _title = title
282
+ val _resizable = resizable
278
283
279
284
onFXAndWait {
280
285
new Alert (AlertType .Warning ) {
281
286
initOwner(parentWindow.orNull)
282
- this .title = dialogTitle
287
+ this .title = _title
283
288
headerText = header
284
289
contentText = content
290
+ this .resizable = _resizable
291
+ dialogPane().setMinWidth(Region .USE_PREF_SIZE )
292
+ dialogPane().setMinHeight(Region .USE_PREF_SIZE )
285
293
}.showAndWait()
286
294
}
287
295
}
@@ -294,16 +302,20 @@ trait ShowMessage {
294
302
* @param content content text.
295
303
* @return `true` when user selected 'OK' and `false` when user selected `Cancel` or dismissed the dialog.
296
304
*/
297
- def showConfirmation (title : String , header : String , content : String = " " ): Boolean = {
305
+ def showConfirmation (title : String , header : String , content : String = " " , resizable : Boolean = false ): Boolean = {
298
306
// Rename to avoid name clashes
299
- val dialogTitle = title
307
+ val _title = title
308
+ val _resizable = resizable
300
309
301
310
val result = onFXAndWait {
302
311
new Alert (AlertType .Confirmation ) {
303
312
initOwner(parentWindow.orNull)
304
- this .title = dialogTitle
313
+ this .title = _title
305
314
headerText = header
306
315
contentText = content
316
+ this .resizable = _resizable
317
+ dialogPane().setMinWidth(Region .USE_PREF_SIZE )
318
+ dialogPane().setMinHeight(Region .USE_PREF_SIZE )
307
319
}.showAndWait()
308
320
}
309
321
result match {
@@ -321,16 +333,25 @@ trait ShowMessage {
321
333
* @return `Some(true)` when user selected 'OK', `Some(false)` when user selected `No`,
322
334
* and `None` user selected `Cancel` or dismissed the dialog.
323
335
*/
324
- def showConfirmationYesNoCancel (title : String , header : String , content : String = " " ): Option [Boolean ] = {
336
+ def showConfirmationYesNoCancel (
337
+ title : String ,
338
+ header : String ,
339
+ content : String = " " ,
340
+ resizable : Boolean = false
341
+ ): Option [Boolean ] = {
325
342
// Rename to avoid name clashes
326
- val dialogTitle = title
343
+ val _title = title
344
+ val _resizable = resizable
327
345
328
346
val result = onFXAndWait {
329
347
new Alert (AlertType .Confirmation ) {
330
348
initOwner(parentWindow.orNull)
331
- this .title = dialogTitle
349
+ this .title = _title
332
350
headerText = header
333
351
contentText = content
352
+ this .resizable = _resizable
353
+ dialogPane().setMinWidth(Region .USE_PREF_SIZE )
354
+ dialogPane().setMinHeight(Region .USE_PREF_SIZE )
334
355
buttonTypes = Seq (ButtonType .OK , ButtonType .No , ButtonType .Cancel )
335
356
}.showAndWait()
336
357
}
0 commit comments