Package jisa.gui
Class JFXElement
- java.lang.Object
-
- jisa.gui.JFXElement
-
- All Implemented Interfaces:
Element
- Direct Known Subclasses:
ActionQueueDisplay
,BorderDisplay
,CameraFeed
,CheckGrid
,Configurator
,Connector
,DataDisplay
,DeviceShell
,Doc
,Fields
,Grid
,ListDisplay
,Logger
,Pages
,Plot
,Progress
,Section
,SplashScreen
,Table
,Tabs
public class JFXElement extends java.lang.Object implements Element
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface jisa.gui.Element
Element.ElementBorder
-
-
Constructor Summary
Constructors Modifier Constructor Description JFXElement(java.lang.String title)
JFXElement(java.lang.String title, java.lang.String fxmlPath)
Creates a GUI window using the specified FXML file.JFXElement(java.lang.String title, java.net.URL resource)
JFXElement(java.lang.String title, javafx.scene.Node centre)
protected
JFXElement(java.lang.String title, Icon icon, java.net.URL resource)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Button
addDialogButton(java.lang.String text, SRunnable onClick)
Adds a button to the bottom-right of the element.MenuButton
addDialogMenuButton(java.lang.String text)
Button
addToolbarButton(java.lang.String text, SRunnable onClick)
Adds a button to the a toolbar at the top of this element.MenuButton
addToolbarMenuButton(java.lang.String text)
Adds a menu button to the toolbar at the top of this element.Separator
addToolbarSeparator()
Adds a separator to the toolbar at the top of this element.void
autoAdjustSize()
void
autoSizeWindow()
void
clearDialogButtons()
void
clearToolbar()
Removes all items from the toolbar at the top of this element.void
close()
Closes the windowjavafx.scene.image.Image
getIcon()
Returns any icon being used by this element.double
getMaxHeight()
double
getMaxWidth()
double
getMaxWindowHeight()
double
getMaxWindowWidth()
double
getMinHeight()
double
getMinWidth()
javafx.scene.layout.BorderPane
getNode()
Returns the JavaFX node of the element.javafx.stage.Stage
getStage()
java.lang.String
getTitle()
Returns the title of the element.double
getWindowHeight()
double
getWindowWidth()
void
hide()
Hides the windowjavafx.beans.property.ObjectProperty<javafx.scene.image.Image>
iconProperty()
boolean
isDecorated()
Returns whether the element is set to be shown with window decorations (title bar + frame) when shown as window.boolean
isExitOnClose()
boolean
isMaximised()
boolean
isShowing()
Returns whether the element is currently open in its own window.void
setCentreNode(javafx.scene.Node centre)
void
setDecorated(boolean decorated)
Sets whether a title bar + frame should be drawn around this element when shown as a window or not.void
setExitOnClose(boolean close)
void
setIcon(java.net.URL icon)
void
setIcon(Icon icon)
void
setMaxHeight(double height)
void
setMaximised(boolean flag)
Sets whether the window is maximised or not.void
setMaxWidth(double width)
void
setMaxWindowHeight(double maxHeight)
void
setMaxWindowWidth(double maxWidth)
void
setMinHeight(double height)
void
setMinWidth(double width)
void
setOnClose(SRunnable toRun)
void
setTitle(java.lang.String title)
Sets the title of the elementvoid
setWindowHeight(double height)
void
setWindowSize(double width, double height)
void
setWindowWidth(double width)
void
show()
Shows the window.void
showAsAlert()
boolean
showAsConfirmation()
int
showAsDialog(java.lang.String... buttons)
javafx.beans.property.ObjectProperty<java.lang.String>
titleProperty()
-
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface jisa.gui.Element
getBorderedNode, isVisible, setVisible
-
-
-
-
Constructor Detail
-
JFXElement
public JFXElement(java.lang.String title, javafx.scene.Node centre)
-
JFXElement
public JFXElement(java.lang.String title)
-
JFXElement
public JFXElement(java.lang.String title, java.lang.String fxmlPath) throws java.io.IOException
Creates a GUI window using the specified FXML file.- Parameters:
title
- Title to display in window title-barfxmlPath
- Path to FXML file to use- Throws:
java.io.IOException
- Upon error reading from FXML file
-
JFXElement
public JFXElement(java.lang.String title, java.net.URL resource)
-
JFXElement
protected JFXElement(java.lang.String title, Icon icon, java.net.URL resource)
-
-
Method Detail
-
setCentreNode
public void setCentreNode(javafx.scene.Node centre)
-
addToolbarButton
public Button addToolbarButton(java.lang.String text, SRunnable onClick)
Adds a button to the a toolbar at the top of this element.- Parameters:
text
- Test to display on the buttononClick
- Action to perform when clicked- Returns:
- Button handle
-
addToolbarMenuButton
public MenuButton addToolbarMenuButton(java.lang.String text)
Adds a menu button to the toolbar at the top of this element. This button displays a menu with options when clicked.- Parameters:
text
- Test to display on the button.- Returns:
- MenuButton handle
-
getMaxWidth
public double getMaxWidth()
-
setMaxWidth
public void setMaxWidth(double width)
-
setMaxWindowWidth
public void setMaxWindowWidth(double maxWidth)
-
getMaxWindowWidth
public double getMaxWindowWidth()
-
getMaxHeight
public double getMaxHeight()
-
setMaxHeight
public void setMaxHeight(double height)
-
setMaxWindowHeight
public void setMaxWindowHeight(double maxHeight)
-
getMaxWindowHeight
public double getMaxWindowHeight()
-
setMinWidth
public void setMinWidth(double width)
-
getMinWidth
public double getMinWidth()
-
setMinHeight
public void setMinHeight(double height)
-
getMinHeight
public double getMinHeight()
-
addToolbarSeparator
public Separator addToolbarSeparator()
Adds a separator to the toolbar at the top of this element.- Returns:
- Separator handle
-
clearToolbar
public void clearToolbar()
Removes all items from the toolbar at the top of this element.
-
addDialogButton
public Button addDialogButton(java.lang.String text, SRunnable onClick)
Adds a button to the bottom-right of the element.- Parameters:
text
- Text to display in buttononClick
-- Returns:
-
addDialogMenuButton
public MenuButton addDialogMenuButton(java.lang.String text)
-
clearDialogButtons
public void clearDialogButtons()
-
showAsAlert
public void showAsAlert()
-
showAsDialog
public int showAsDialog(java.lang.String... buttons)
-
showAsConfirmation
public boolean showAsConfirmation()
-
setWindowSize
public void setWindowSize(double width, double height)
-
getWindowWidth
public double getWindowWidth()
-
setWindowWidth
public void setWindowWidth(double width)
-
getWindowHeight
public double getWindowHeight()
-
setWindowHeight
public void setWindowHeight(double height)
-
autoSizeWindow
public void autoSizeWindow()
-
getStage
public javafx.stage.Stage getStage()
-
isShowing
public boolean isShowing()
Returns whether the element is currently open in its own window.- Returns:
- Open?
-
autoAdjustSize
public void autoAdjustSize()
-
isMaximised
public boolean isMaximised()
-
setMaximised
public void setMaximised(boolean flag)
Sets whether the window is maximised or not.- Parameters:
flag
- Maximised?
-
isDecorated
public boolean isDecorated()
Returns whether the element is set to be shown with window decorations (title bar + frame) when shown as window.- Returns:
- Show window decorations?
-
setDecorated
public void setDecorated(boolean decorated)
Sets whether a title bar + frame should be drawn around this element when shown as a window or not. Can only be called before the window is shown for the first time.- Parameters:
decorated
- Show window decorations?
-
getNode
public javafx.scene.layout.BorderPane getNode()
Description copied from interface:Element
Returns the JavaFX node of the element.
-
getTitle
public java.lang.String getTitle()
Description copied from interface:Element
Returns the title of the element.
-
setTitle
public void setTitle(java.lang.String title)
Description copied from interface:Element
Sets the title of the element
-
titleProperty
public javafx.beans.property.ObjectProperty<java.lang.String> titleProperty()
- Specified by:
titleProperty
in interfaceElement
-
setExitOnClose
public void setExitOnClose(boolean close)
-
isExitOnClose
public boolean isExitOnClose()
-
setOnClose
public void setOnClose(SRunnable toRun)
-
getIcon
public javafx.scene.image.Image getIcon()
Description copied from interface:Element
Returns any icon being used by this element.
-
setIcon
public void setIcon(Icon icon)
-
setIcon
public void setIcon(java.net.URL icon)
-
iconProperty
public javafx.beans.property.ObjectProperty<javafx.scene.image.Image> iconProperty()
-
-