|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ComponentWrapper
A class that wraps the important parts of a Component.
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 == null || 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 | |
---|---|
int |
getBaseline(int width,
int height)
Returns the baseline for the component given the suggested height. |
java.lang.Object |
getComponent()
Returns the actual object that this wrapper is aggregating. |
int |
getComponetType(boolean disregardScrollPane)
Returns the type of component that this wrapper is wrapping. |
int |
getHeight()
Returns the current height for this component. |
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. |
int |
getLayoutHashCode()
Returns a hash code that should be resonably different for anything that might change the layout. |
java.lang.String |
getLinkId()
Returns a String id that can be used to reference the component in link constraints. |
int |
getMaximumHeight()
Returns the maximum height of the component. |
int |
getMaximumWidth()
Returns the maximum width of the component. |
int |
getMinimumHeight()
Returns the minimum height of the component. |
int |
getMinimumWidth()
Returns the minimum width of the component. |
ContainerWrapper |
getParent()
Returns the container for this component. |
float |
getPixelUnitFactor(boolean isHor)
Returns the pixel unit factor for the horizontal or vertical dimension. |
int |
getPreferredHeight()
Returns the preferred height of the component. |
int |
getPreferredWidth()
Returns the preferred width of the component. |
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 . |
int |
getScreenLocationX()
Returns the screen x-coordinate for the upper left coordinate of the component layoutable bounds. |
int |
getScreenLocationY()
Returns the screen y-coordinate for the upper left coordinate of the component layoutable bounds. |
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 . |
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 |
getWidth()
Returns the current width for this component. |
int[] |
getVisualPadding()
Returns the padding on a component by component basis. |
int |
getX()
Returns the current x coordinate for this component. |
int |
getY()
Returns the current y coordinate for this component. |
boolean |
hasBaseline()
Returns if the component has a baseline and if it can be retrieved. |
boolean |
isVisible()
Returns if the component's visibility is set to true . |
void |
paintDebugOutline()
Paints component outline to indicate where it is. |
void |
setBounds(int x,
int y,
int width,
int height)
Sets the component's bounds. |
Field Detail |
---|
static final int TYPE_UNSET
static final int TYPE_UNKNOWN
static final int TYPE_CONTAINER
static final int TYPE_LABEL
static final int TYPE_TEXT_FIELD
static final int TYPE_TEXT_AREA
static final int TYPE_BUTTON
static final int TYPE_LIST
static final int TYPE_TABLE
static final int TYPE_SCROLL_PANE
static final int TYPE_IMAGE
static final int TYPE_PANEL
static final int TYPE_COMBO_BOX
static final int TYPE_SLIDER
static final int TYPE_SPINNER
static final int TYPE_PROGRESS_BAR
static final int TYPE_TREE
static final int TYPE_CHECK_BOX
static final int TYPE_SCROLL_BAR
static final int TYPE_SEPARATOR
Method Detail |
---|
java.lang.Object getComponent()
If this is a container the container should be returned instead.
null
.int getX()
int getY()
int getWidth()
int getHeight()
int getScreenLocationX()
int getScreenLocationY()
int getMinimumWidth()
int getMinimumHeight()
int getPreferredWidth()
int getPreferredHeight()
int getMaximumWidth()
int getMaximumHeight()
void setBounds(int x, int y, int width, int height)
x
- The x coordinate.y
- The y coordinate.width
- The width.height
- The height.boolean isVisible()
true
. This should not return if the component is
actually visibile, but if the visibility is set to true or not.
true
means visible.int getBaseline(int width, int height)
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.
boolean hasBaseline()
false
for Swing before mustang.
ContainerWrapper getParent()
null
.float getPixelUnitFactor(boolean isHor)
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;
isHor
- If it is the horizontal factor that should be returned.
int getHorizontalScreenDPI()
int getVerticalScreenDPI()
int getScreenWidth()
null
.
1280
.int getScreenHeight()
null
.
1024
.java.lang.String getLinkId()
null
should be returned.
For instance the Swing implementation returns the string returned from Component.getName()
.
null
.int getLayoutHashCode()
int[] getVisualPadding()
Default implementation returnes null
for all components except for Windows XP's JTabbedPane which will return new Insets(0, 0, 2, 2).
NOTE! To reduce cenerated garbage the returned padding should never be changed so that the same insets can be returned many times.
null
if no padding. NOTE! To reduce cenerated garbage the returned padding should never be changed so that
the same insets can be returned many times. [top, left, bottom, right]void paintDebugOutline()
int getComponetType(boolean disregardScrollPane)
This method can be invoked often so the result should be cached.
disregardScrollPane
- Is true
any wrapping scroll pane should be disregarded and the type
of the scrolled component should be returned.
TYPE_LABEL
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |