Module io.github.mmm.ui.api.window
Package io.github.mmm.ui.spi.window
Class UiWindowPositionAndSize
- java.lang.Object
-
- io.github.mmm.ui.spi.window.UiWindowPositionAndSize
-
- All Implemented Interfaces:
AttributeReadPosition,AttributeReadSize,AttributeWritePosition,AttributeWritePositionRange,AttributeWriteSize,AttributeWriteSizeInPixel,AttributeWriteSizeRange
- Direct Known Subclasses:
FxAbstractWindowPositionAndSize,TestAbstractWindowPositionAndSize
public abstract class UiWindowPositionAndSize extends Object implements AttributeWritePositionRange, AttributeWriteSizeRange
Abstract base implementation for position, size and controls related attributes ofUiAbstractWindoworUiChildWindow.- Since:
- 1.0.0
-
-
Field Summary
Fields Modifier and Type Field Description protected doubleheightprotected doublemaxHeightprotected doublemaxWidthprotected doublemaxXprotected doublemaxYprotected doubleminHeightprotected doubleminWidthprotected doubleminXprotected doubleminYprotected doublewidthprotected doublexprotected doubley
-
Constructor Summary
Constructors Constructor Description UiWindowPositionAndSize()The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcenterOnScreen(boolean force)Initializes the position and size.protected static doubleclipMax(double max)protected static doubleclipSize(double size)protected static doubleclipZero(double pos)doublegetHeightInPixel()doublegetMaxHeight()doublegetMaxWidth()doublegetMaxX()doublegetMaxY()doublegetMinHeight()doublegetMinWidth()doublegetMinX()doublegetMinY()protected abstract doublegetScreenHeight()protected abstract doublegetScreenWidth()doublegetWidthInPixel()doublegetX()doublegetY()voidsetHeight(UiSize height)voidsetHeightInPixel(double height)voidsetMaxHeight(double maxHeight)voidsetMaxWidth(double maxWidth)voidsetMaxX(double maxX)voidsetMaxY(double maxY)voidsetMinHeight(double minHeight)voidsetMinWidth(double minWidth)voidsetMinX(double minX)voidsetMinY(double minY)voidsetPosition(double x, double y)This method sets the position of the widget.voidsetSize(UiSize width, UiSize height)voidsetSizeInPixel(double width, double height)voidsetWidth(UiSize width)voidsetWidthInPixel(double width)voidsetX(double x)voidsetY(double y)-
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
-
-
-
-
Field Detail
-
x
protected double x
- See Also:
getX()
-
y
protected double y
- See Also:
getY()
-
minX
protected double minX
- See Also:
getMinX()
-
minY
protected double minY
- See Also:
getMinY()
-
maxX
protected double maxX
- See Also:
getMaxX()
-
maxY
protected double maxY
- See Also:
getMaxY()
-
width
protected double width
- See Also:
AttributeReadSize.getWidth()
-
height
protected double height
- See Also:
AttributeReadSize.getHeight()
-
minWidth
protected double minWidth
- See Also:
getMinWidth()
-
minHeight
protected double minHeight
- See Also:
getMinHeight()
-
maxWidth
protected double maxWidth
- See Also:
getMaxWidth()
-
maxHeight
protected double maxHeight
- See Also:
getMaxHeight()
-
-
Method Detail
-
getWidthInPixel
public double getWidthInPixel()
- Specified by:
getWidthInPixelin interfaceAttributeReadSize- Returns:
- the width of this object in pixels.
NOTE: The result will typically be anintvalue. 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:
setWidthInPixelin interfaceAttributeWriteSize- Specified by:
setWidthInPixelin interfaceAttributeWriteSizeInPixel- Parameters:
width- the newwidth in pixel.
-
setWidth
public void setWidth(UiSize width)
- Specified by:
setWidthin interfaceAttributeWriteSize- Parameters:
width- the newwidth.
-
getHeightInPixel
public double getHeightInPixel()
- Specified by:
getHeightInPixelin interfaceAttributeReadSize- Returns:
- the height of this object in pixels.
NOTE: The result will typically be anintvalue. 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:
setHeightInPixelin interfaceAttributeWriteSize- Specified by:
setHeightInPixelin interfaceAttributeWriteSizeInPixel- Parameters:
height- the newheight in pixel.
-
setHeight
public void setHeight(UiSize height)
- Specified by:
setHeightin interfaceAttributeWriteSize- Parameters:
height- the newheight.
-
setSizeInPixel
public void setSizeInPixel(double width, double height)- Specified by:
setSizeInPixelin interfaceAttributeWriteSize- Specified by:
setSizeInPixelin interfaceAttributeWriteSizeInPixel- Parameters:
width- the newwidth in pixel.height- the newheight in pixel.
-
setSize
public void setSize(UiSize width, UiSize height)
- Specified by:
setSizein interfaceAttributeWriteSize- Parameters:
width- the newwidth.height- the newheight.
-
getMinWidth
public double getMinWidth()
- Specified by:
getMinWidthin interfaceAttributeWriteSizeRange- Returns:
- the minimum allowed value of
width in pixel. Will be200by default. Should be less or equal tomaxWidth.
-
setMinWidth
public void setMinWidth(double minWidth)
- Specified by:
setMinWidthin interfaceAttributeWriteSizeRange- Parameters:
minWidth- the new value ofminWidth. Will not affect currentwidthbut only apply to resizing by the end-user.
-
getMaxWidth
public double getMaxWidth()
- Specified by:
getMaxWidthin interfaceAttributeWriteSizeRange- Returns:
- the maximum allowed value of
width in pixel. Will beInteger.MAX_VALUEby default (unbounded) and is automatically clipped to the available width (of theUiScreenor main window). Should be greater or equal tominWidth.
-
setMaxWidth
public void setMaxWidth(double maxWidth)
- Specified by:
setMaxWidthin interfaceAttributeWriteSizeRange- Parameters:
maxWidth- the new value ofmaxWidth. Will not affect currentwidthbut only apply to resizing by the end-user.
-
getMinHeight
public double getMinHeight()
- Specified by:
getMinHeightin interfaceAttributeWriteSizeRange- Returns:
- the minimum allowed value of
height in pixel. Will be200by default. Should be less or equal tomaxHeight.
-
setMinHeight
public void setMinHeight(double minHeight)
- Specified by:
setMinHeightin interfaceAttributeWriteSizeRange- Parameters:
minHeight- the new value ofminHeight. Will not affect currentheightbut only apply to resizing by the end-user.
-
getMaxHeight
public double getMaxHeight()
- Specified by:
getMaxHeightin interfaceAttributeWriteSizeRange- Returns:
- the maximum allowed value of
height in pixel. Will beInteger.MAX_VALUEby default (unbounded) and is automatically clipped to the available height (of theUiScreenor main window). Should be greater or equal tominHeight.
-
setMaxHeight
public void setMaxHeight(double maxHeight)
- Specified by:
setMaxHeightin interfaceAttributeWriteSizeRange- Parameters:
maxHeight- the new value ofmaxHeight. Will not affect currentheightbut only apply to resizing by the end-user.
-
getX
public double getX()
- Specified by:
getXin interfaceAttributeReadPosition- 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:
setXin interfaceAttributeWritePosition- Parameters:
x- the newposition on the x-axis.
-
getY
public double getY()
- Specified by:
getYin interfaceAttributeReadPosition- 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:
setYin interfaceAttributeWritePosition- Parameters:
y- the newposition on the y-axis.
-
setPosition
public void setPosition(double x, double y)Description copied from interface:AttributeWritePositionThis method sets the position of the widget.- Specified by:
setPositionin interfaceAttributeWritePosition- Parameters:
x- the newposition on the x-axis.y- the newposition on the y-axis.
-
getMinX
public double getMinX()
- Specified by:
getMinXin interfaceAttributeWritePositionRange- Returns:
- the minimum allowed value of
X. Will be0by default (unbounded). Should be less or equal tomaxX.
-
setMinX
public void setMinX(double minX)
- Specified by:
setMinXin interfaceAttributeWritePositionRange- Parameters:
minX- the new value ofminX. Will not affect currentXcoordinate but only apply to moving and resizing by the end-user.
-
getMaxX
public double getMaxX()
- Specified by:
getMaxXin interfaceAttributeWritePositionRange- Returns:
- the maximum allowed value of
X. Will beInteger.MAX_VALUEby default (unbounded) and is automatically clipped to the available width (of theUiScreenor main window). Should be greater or equal tominX.
-
setMaxX
public void setMaxX(double maxX)
- Specified by:
setMaxXin interfaceAttributeWritePositionRange- Parameters:
maxX- the new value ofmaxX. Will not affect currentXcoordinate but only apply to moving and resizing by the end-user.
-
getMinY
public double getMinY()
- Specified by:
getMinYin interfaceAttributeWritePositionRange- Returns:
- the minimum allowed value of
Y. Will be0by default (unbounded). Should be less or equal tomaxY.
-
setMinY
public void setMinY(double minY)
- Specified by:
setMinYin interfaceAttributeWritePositionRange- Parameters:
minY- the new value ofminY. Will not affect currentYcoordinate but only apply to moving and resizing by the end-user.
-
getMaxY
public double getMaxY()
- Specified by:
getMaxYin interfaceAttributeWritePositionRange- Returns:
- the maximum allowed value of
Y. Will beInteger.MAX_VALUEby default (unbounded) and is automatically clipped to the available width (of theUiScreenor main window). Should be greater or equal tominY.
-
setMaxY
public void setMaxY(double maxY)
- Specified by:
setMaxYin interfaceAttributeWritePositionRange- Parameters:
maxY- the new value ofmaxY. Will not affect currentYcoordinate but only apply to moving and resizing by the end-user.
-
getScreenWidth
protected abstract double getScreenWidth()
- Returns:
- the current width of the screen available for child windows.
-
getScreenHeight
protected abstract double getScreenHeight()
- Returns:
- the current height of the screen available for child windows.
-
centerOnScreen
public void centerOnScreen(boolean force)
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.
-
clipSize
protected static double clipSize(double size)
- Parameters:
size- the width or height to clip.- Returns:
- the maximum of the given
sizeand100.
-
clipZero
protected static double clipZero(double pos)
- Parameters:
pos- the position value.- Returns:
- the maximum of the given
posand0.
-
clipMax
protected static double clipMax(double max)
- Parameters:
max- the maximum value.- Returns:
- the given
maxclipped to the range from0toInteger.MAX_VALUE.
-
-