Module io.github.mmm.ui.fx.window
Class FxAbstractWindowPositionAndSize
- java.lang.Object
-
- io.github.mmm.ui.spi.window.UiWindowPositionAndSize
-
- io.github.mmm.ui.fx.widget.window.FxAbstractWindowPositionAndSize
-
- All Implemented Interfaces:
AttributeReadPosition
,AttributeReadSize
,AttributeWritePosition
,AttributeWritePositionRange
,AttributeWriteSize
,AttributeWriteSizeInPixel
,AttributeWriteSizeRange
public class FxAbstractWindowPositionAndSize extends UiWindowPositionAndSize
Implementation ofUiWindowPositionAndSize
for JavaFx.- Since:
- 1.0.0
-
-
Constructor Summary
Constructors Constructor Description FxAbstractWindowPositionAndSize(javafx.stage.Stage stage)
The constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
centerOnScreen(boolean force)
Initializes the position and size.double
getHeightInPixel()
protected double
getScreenHeight()
protected double
getScreenWidth()
double
getWidthInPixel()
double
getX()
double
getY()
void
setHeightInPixel(double height)
void
setWidthInPixel(double width)
void
setX(double x)
void
setY(double y)
-
Methods inherited from class io.github.mmm.ui.spi.window.UiWindowPositionAndSize
clipMax, clipSize, clipZero, getMaxHeight, getMaxWidth, getMaxX, getMaxY, getMinHeight, getMinWidth, getMinX, getMinY, setHeight, setMaxHeight, setMaxWidth, setMaxX, setMaxY, setMinHeight, setMinWidth, setMinX, setMinY, setPosition, setSize, setSizeInPixel, setWidth
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeReadSize
getHeight, getWidth
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeWritePositionRange
setXRange, setYRange
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeWriteSize
setSize
-
Methods inherited from interface io.github.mmm.ui.api.attribute.AttributeWriteSizeRange
setHeightRange, setWidthRange
-
-
-
-
Method Detail
-
getX
public double getX()
- Specified by:
getX
in interfaceAttributeReadPosition
- Overrides:
getX
in classUiWindowPositionAndSize
- Returns:
- the x position of this object as the number of pixels from the left on the x-axis (horizontally).
-
setX
public void setX(double x)
- Specified by:
setX
in interfaceAttributeWritePosition
- Overrides:
setX
in classUiWindowPositionAndSize
- Parameters:
x
- the newposition on the x-axis
.
-
getY
public double getY()
- Specified by:
getY
in interfaceAttributeReadPosition
- Overrides:
getY
in classUiWindowPositionAndSize
- Returns:
- the y position of this object as the number of pixels from the top on the y-axis (vertically).
-
setY
public void setY(double y)
- Specified by:
setY
in interfaceAttributeWritePosition
- Overrides:
setY
in classUiWindowPositionAndSize
- Parameters:
y
- the newposition on the y-axis
.
-
getWidthInPixel
public double getWidthInPixel()
- Specified by:
getWidthInPixel
in interfaceAttributeReadSize
- Overrides:
getWidthInPixel
in classUiWindowPositionAndSize
- Returns:
- the width of this object in pixels.
NOTE: The result will typically be anint
value. However, to be compatible withUiSize.getAmount()
and with some underlying native toolkits we usedouble
. You may cast the result toint
.
-
setWidthInPixel
public void setWidthInPixel(double width)
- Specified by:
setWidthInPixel
in interfaceAttributeWriteSize
- Specified by:
setWidthInPixel
in interfaceAttributeWriteSizeInPixel
- Overrides:
setWidthInPixel
in classUiWindowPositionAndSize
- Parameters:
width
- the newwidth in pixel
.
-
getHeightInPixel
public double getHeightInPixel()
- Specified by:
getHeightInPixel
in interfaceAttributeReadSize
- Overrides:
getHeightInPixel
in classUiWindowPositionAndSize
- Returns:
- the height of this object in pixels.
NOTE: The result will typically be anint
value. However, to be compatible withUiSize.getAmount()
and with some underlying native toolkits we usedouble
. You may cast the result toint
.
-
setHeightInPixel
public void setHeightInPixel(double height)
- Specified by:
setHeightInPixel
in interfaceAttributeWriteSize
- Specified by:
setHeightInPixel
in interfaceAttributeWriteSizeInPixel
- Overrides:
setHeightInPixel
in classUiWindowPositionAndSize
- Parameters:
height
- the newheight in pixel
.
-
getScreenWidth
protected double getScreenWidth()
- Specified by:
getScreenWidth
in classUiWindowPositionAndSize
- Returns:
- the current width of the screen available for child windows.
-
getScreenHeight
protected double getScreenHeight()
- Specified by:
getScreenHeight
in classUiWindowPositionAndSize
- Returns:
- the current height of the screen available for child windows.
-
centerOnScreen
public void centerOnScreen(boolean force)
Description copied from class:UiWindowPositionAndSize
Initializes the position and size. If neither of those is set, size will be set to a quarter of the screen (half of screen width and height) and window is centered on the screen.- Overrides:
centerOnScreen
in classUiWindowPositionAndSize
- Parameters:
force
-true
to always updateX
andY
to center the window on the screen,false
to only updateX
andY
in case they are uninitialized (-1
).
-
-