net.miginfocom.layout
public interface ComponentWrapper
NOTE!.equals() and .hashcode() should be shunted to the wrapped component. E.g.
public int hashCode() { return getComponent().hashCode(); } public final boolean equals(Object o) { if (o instanceof ComponentWrapper == false) return false; return getComponent().equals(((ComponentWrapper) o).getComponent()); }
Field Summary | |
---|---|
static int | TYPE_BUTTON |
static int | TYPE_CHECK_BOX |
static int | TYPE_COMBO_BOX |
static int | TYPE_CONTAINER |
static int | TYPE_IMAGE |
static int | TYPE_LABEL |
static int | TYPE_LIST |
static int | TYPE_PANEL |
static int | TYPE_PROGRESS_BAR |
static int | TYPE_SCROLL_BAR |
static int | TYPE_SCROLL_PANE |
static int | TYPE_SEPARATOR |
static int | TYPE_SLIDER |
static int | TYPE_SPINNER |
static int | TYPE_TABLE |
static int | TYPE_TEXT_AREA |
static int | TYPE_TEXT_FIELD |
static int | TYPE_TREE |
static int | TYPE_UNKNOWN |
static int | TYPE_UNSET |
Method Summary | |
---|---|
abstract int | getBaseline(int width, int height) Returns the baseline for the component given the suggested height. |
abstract Object | getComponent() Returns the actual object that this wrapper is aggregating. |
abstract int | getComponetType(boolean disregardScrollPane) Returns the type of component that this wrapper is wrapping.
|
abstract int | getHeight() Returns the current height for this component. |
abstract int | getHorizontalScreenDPI() Returns the DPI (Dots Per Inch) of the screen the component is currently in or for the default
screen if the component is not visible.
|
abstract int | getLayoutHashCode() Returns a hash code that should be reasonably different for anything that might change the layout. |
abstract String | getLinkId() Returns a String id that can be used to reference the component in link constraints. |
abstract int | getMaximumHeight(int wHint) Returns the maximum height of the component. |
abstract int | getMaximumWidth(int hHint) Returns the maximum width of the component. |
abstract int | getMinimumHeight(int wHint) Returns the minimum height of the component. |
abstract int | getMinimumWidth(int hHint) Returns the minimum width of the component. |
abstract ContainerWrapper | getParent() Returns the container for this component. |
abstract float | getPixelUnitFactor(boolean isHor) Returns the pixel unit factor for the horizontal or vertical dimension.
|
abstract int | getPreferredHeight(int wHint) Returns the preferred height of the component. |
abstract int | getPreferredWidth(int hHint) Returns the preferred width of the component. |
abstract int | getScreenHeight() Returns the pixel size of the screen that the component is currently in or for the default
screen if the component is not visible or null .
|
abstract int | getScreenLocationX() Returns the screen x-coordinate for the upper left coordinate of the component layout-able bounds. |
abstract int | getScreenLocationY() Returns the screen y-coordinate for the upper left coordinate of the component layout-able bounds. |
abstract int | getScreenWidth() Returns the pixel size of the screen that the component is currently in or for the default
screen if the component is not visible or null .
|
abstract int | getVerticalScreenDPI() Returns the DPI (Dots Per Inch) of the screen the component is currently in or for the default
screen if the component is not visible.
|
int[] | getVisualPadding() Returns the padding on a component by component basis. |
abstract int | getWidth() Returns the current width for this component. |
abstract int | getX() Returns the current x coordinate for this component. |
abstract int | getY() Returns the current y coordinate for this component. |
abstract boolean | hasBaseline() Returns if the component has a baseline and if it can be retrieved. |
abstract boolean | isVisible() Returns if the component's visibility is set to true . |
abstract void | paintDebugOutline() Paints component outline to indicate where it is. |
abstract void | setBounds(int x, int y, int width, int height) Sets the component's bounds. |
Parameters: width The width to calculate for if other than the current. If -1
the current size should be used. height The height to calculate for if other than the current. If -1
the current size should be used.
Returns: The baseline from the top or -1 if not applicable.
If this is a container the container should be returned instead.
Returns: The actual object that this wrapper is aggregating. Not null
.
This method can be invoked often so the result should be cached.
NOTE! This is misspelled. Keeping it that way though since this is only used by developers who port MigLayout.
Parameters: disregardScrollPane Is true
any wrapping scroll pane should be disregarded and the type
of the scrolled component should be returned.
Returns: The type of component that this wrapper is wrapping. E.g. TYPE_LABEL.
Returns: The current height for this component.
If headless mode PlatformDefaults will be returned.
Returns: The DPI.
Returns: A hash code that should be reasonably different for anything that might change the layout. Returns -1 if the widget is disposed.
null
should be returned.
For instance the Swing implementation returns the string returned from Component.getName()
.
Returns: The string link id or null
.
Parameters: wHint The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns: The maximum height of the component.
Since: 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for any implementing classes. This change was worth it though.
Parameters: hHint The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns: The maximum width of the component.
Since: 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for any implementing classes. This change was worth it though.
Parameters: wHint The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns: The minimum height of the component.
Since: 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for any implementing classes. This change was worth it though.
Parameters: hHint The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns: The minimum width of the component.
Since: 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for any implementing classes. This change was worth it though.
Returns: The container for this component. Will return null
if the component has no parent.
The factor is 1 for both dimensions on the normal font in a JPanel on Windows. The factor should increase with a bigger "X".
This is the Swing version:
Rectangle2D r = fm.getStringBounds("X", parent.getGraphics()); wFactor = r.getWidth() / 6; hFactor = r.getHeight() / 13.27734375f;
Parameters: isHor If it is the horizontal factor that should be returned.
Returns: The factor.
Parameters: wHint The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns: The preferred height of the component.
Since: 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for any implementing classes. This change was worth it though.
Parameters: hHint The Size hint for the other dimension. An implementation can use this value or the
current size for the widget in this dimension, or a combination of both, to calculate the correct size.
Use -1 to denote that there is no hint. This corresponds with SWT.DEFAULT.
Returns: The preferred width of the component.
Since: 3.5. Added the hint as a parameter knowing that a correction and recompilation is necessary for any implementing classes. This change was worth it though.
null
.
If in headless mode 768
is returned.
Returns: The screen size. E.g. 1024
.
Returns: The screen x-coordinate for the upper left coordinate of the component layout-able bounds.
Returns: The screen y-coordinate for the upper left coordinate of the component layout-able bounds.
null
.
If in headless mode 1024
is returned.
Returns: The screen size. E.g. 1280
.
If headless mode PlatformDefaults will be returned.
Returns: The DPI.
Default implementation returns null
for all components except for Windows XP's JTabbedPane which will return new Insets(0, 0, 2, 2).
NOTE! To reduce generated garbage the returned padding should never be changed so that the same insets can be returned many times.
Returns: null
if no padding. NOTE! To reduce generated garbage the returned padding should never be changed so that
the same insets can be returned many times. [top, left, bottom, right]
Returns: The current width for this component.
Returns: The current x coordinate for this component.
Returns: The current y coordinate for this component.
false
for Swing before mustang.Returns: If the component has a baseline and if it can be retrieved.
true
. This should not return if the component is
actually visible, but if the visibility is set to true or not.Returns: true
means visible.
Parameters: x The x coordinate. y The y coordinate. width The width. height The height.