public abstract class Dialog
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
CANCEL_BUTTON
Cancel button ID
|
static int |
OK_BUTTON
Ok button ID
|
| Constructor and Description |
|---|
Dialog(@Nullable javafx.stage.Window parent,
@NonNull java.lang.String title)
Create a new dialog instance
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
buttonPressed(int type)
Method called when button is pressed
|
protected void |
cancelPressed()
Method called when the cancle button is invoked
|
protected void |
close()
Close the dialog
|
protected javafx.stage.Stage |
create()
Create the dialogs stage
|
protected javafx.scene.Node |
createButtonBar() |
protected javafx.scene.control.Button |
createButtonForBar(int type,
java.lang.String label,
boolean defaultOkButton,
boolean defaultCancel)
Create a button for the button bar
|
protected java.util.List<javafx.scene.control.Button> |
createButtonsForBar()
Create the buttons for the bar
|
protected javafx.scene.Parent |
createContents()
Create the dialog content
Subclasses should normally override
createDialogArea()
|
protected abstract javafx.scene.Node |
createDialogArea() |
@NonNull javafx.scene.shape.Rectangle |
getBounds()
The bounds of the dialog
Has to be called after
open(). |
protected javafx.geometry.Insets |
getContentInset() |
protected javafx.geometry.Point2D |
getInitialContentSize(javafx.scene.Parent rootContainer)
Get the initial size of the content
|
protected javafx.geometry.Point2D |
getInitialLocation(javafx.scene.Parent rootContainer)
Get initial location of the dialog
|
protected javafx.geometry.Point2D |
getInitialSize(javafx.scene.Parent rootContainer)
Get the initial size of the dialog
|
protected javafx.stage.Modality |
getModality() |
protected java.util.List<java.lang.String> |
getStylesheets() |
protected boolean |
isCancelDefault(int buttonId)
Check if the button ID is the default cancle button
|
protected boolean |
isOkDefault(int buttonId)
Check if the button ID is the default ok button
|
protected void |
okPressed()
Method called when the ok button is invoked
|
int |
open()
Open the dialog
|
void |
pack()
Pack the dialog to the content size
|
protected void |
preopen(javafx.stage.Stage s)
Called before dialog is opened
|
void |
setBounds(int x,
int y,
int width,
int height)
Set the bounds of the dialog
Has to be called after
open(). |
protected void |
setReturnCode(int returnCode)
Setting the return code
|
public static final int OK_BUTTON
public static final int CANCEL_BUTTON
public Dialog(@Nullable javafx.stage.Window parent,
@NonNull java.lang.String title)
parent - the owner, might be nulltitle - the title shown in the window trimprotected javafx.scene.Parent createContents()
Subclasses should normally override createDialogArea()
protected javafx.geometry.Insets getContentInset()
protected abstract javafx.scene.Node createDialogArea()
protected javafx.scene.Node createButtonBar()
protected java.util.List<javafx.scene.control.Button> createButtonsForBar()
protected boolean isOkDefault(int buttonId)
buttonId - the button idtrue if the button is the default ok buttonButton.defaultButtonProperty()protected boolean isCancelDefault(int buttonId)
buttonId - the button idtrue if the button is the default cancel buttonprotected javafx.scene.control.Button createButtonForBar(int type,
java.lang.String label,
boolean defaultOkButton,
boolean defaultCancel)
type - the button idlabel - the labeldefaultOkButton - true if it is the default button Button.defaultButtonProperty()defaultCancel - true if it is the cancel button Button.cancelButtonProperty()protected void buttonPressed(int type)
type - the button idprotected void okPressed()
protected void cancelPressed()
protected void setReturnCode(int returnCode)
returnCode - the new return codeprotected void close()
protected java.util.List<java.lang.String> getStylesheets()
protected javafx.stage.Stage create()
protected javafx.geometry.Point2D getInitialContentSize(javafx.scene.Parent rootContainer)
rootContainer - the root containernull if default is usedprotected javafx.geometry.Point2D getInitialSize(javafx.scene.Parent rootContainer)
rootContainer - the root containernull if the default is usedprotected javafx.geometry.Point2D getInitialLocation(javafx.scene.Parent rootContainer)
rootContainer - the root containernull if the default is usedpublic void setBounds(int x,
int y,
int width,
int height)
Has to be called after open(). For initial size and location use
getInitialSize(Parent) getInitialLocation(Parent)
x - the x positiony - thy y positionwidth - the widthheight - the heightpublic @NonNull javafx.scene.shape.Rectangle getBounds()
Has to be called after open().
public void pack()
protected javafx.stage.Modality getModality()
Modality.WINDOW_MODAL)public int open()
protected void preopen(javafx.stage.Stage s)
s - the stage