|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.miginfocom.swt.SwtComponentWrapper
public class SwtComponentWrapper
Field Summary |
---|
Fields inherited from interface net.miginfocom.layout.ComponentWrapper |
---|
TYPE_BUTTON, TYPE_CHECK_BOX, TYPE_COMBO_BOX, TYPE_CONTAINER, TYPE_IMAGE, TYPE_LABEL, TYPE_LIST, TYPE_PANEL, TYPE_PROGRESS_BAR, TYPE_SCROLL_BAR, TYPE_SCROLL_PANE, TYPE_SEPARATOR, TYPE_SLIDER, TYPE_SPINNER, TYPE_TABLE, TYPE_TEXT_AREA, TYPE_TEXT_FIELD, TYPE_TREE, TYPE_UNKNOWN, TYPE_UNSET |
Constructor Summary | |
---|---|
SwtComponentWrapper(org.eclipse.swt.widgets.Control c)
|
Method Summary | |
---|---|
boolean |
equals(java.lang.Object o)
|
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 reasonably 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(int sz)
Returns the maximum height of the component. |
int |
getMaximumWidth(int sz)
Returns the maximum width of the component. |
int |
getMinimumHeight(int sz)
Returns the minimum height of the component. |
int |
getMinimumWidth(int sz)
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(int sz)
Returns the preferred height of the component. |
int |
getPreferredWidth(int sz)
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 layout-able bounds. |
int |
getScreenLocationY()
Returns the screen y-coordinate for the upper left coordinate of the component layout-able 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[] |
getVisualPadding()
Returns the padding on a component by component basis. |
int |
getWidth()
Returns the current width for this component. |
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. |
int |
hashCode()
|
static boolean |
isMinimumSizeZero()
Sets if minimum size for SWT components should be preferred size (default, false) or 0. |
static boolean |
isUseVisualPadding()
|
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. |
static void |
setMinimumSizeZero(boolean b)
Sets if minimum size for SWT components should be preferred size (default, false) or 0. |
static void |
setUseVisualPadding(boolean b)
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SwtComponentWrapper(org.eclipse.swt.widgets.Control c)
Method Detail |
---|
public final int getBaseline(int width, int height)
ComponentWrapper
getBaseline
in interface ComponentWrapper
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.
public final java.lang.Object getComponent()
ComponentWrapper
If this is a container the container should be returned instead.
getComponent
in interface ComponentWrapper
null
.public final float getPixelUnitFactor(boolean isHor)
ComponentWrapper
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;
getPixelUnitFactor
in interface ComponentWrapper
isHor
- If it is the horizontal factor that should be returned.
public final int getX()
ComponentWrapper
getX
in interface ComponentWrapper
public final int getY()
ComponentWrapper
getY
in interface ComponentWrapper
public final int getWidth()
ComponentWrapper
getWidth
in interface ComponentWrapper
public final int getHeight()
ComponentWrapper
getHeight
in interface ComponentWrapper
public final int getScreenLocationX()
ComponentWrapper
getScreenLocationX
in interface ComponentWrapper
public final int getScreenLocationY()
ComponentWrapper
getScreenLocationY
in interface ComponentWrapper
public final int getMinimumHeight(int sz)
ComponentWrapper
getMinimumHeight
in interface ComponentWrapper
sz
- 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.public final int getMinimumWidth(int sz)
ComponentWrapper
getMinimumWidth
in interface ComponentWrapper
sz
- 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.public final int getPreferredHeight(int sz)
ComponentWrapper
getPreferredHeight
in interface ComponentWrapper
sz
- 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.public final int getPreferredWidth(int sz)
ComponentWrapper
getPreferredWidth
in interface ComponentWrapper
sz
- 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.public final int getMaximumHeight(int sz)
ComponentWrapper
getMaximumHeight
in interface ComponentWrapper
sz
- 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.public final int getMaximumWidth(int sz)
ComponentWrapper
getMaximumWidth
in interface ComponentWrapper
sz
- 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.public final ContainerWrapper getParent()
ComponentWrapper
getParent
in interface ComponentWrapper
null
if the component has no parent.public int getHorizontalScreenDPI()
ComponentWrapper
If headless mode PlatformDefaults.getDefaultDPI()
will be returned.
getHorizontalScreenDPI
in interface ComponentWrapper
public int getVerticalScreenDPI()
ComponentWrapper
If headless mode PlatformDefaults.getDefaultDPI()
will be returned.
getVerticalScreenDPI
in interface ComponentWrapper
public final int getScreenWidth()
ComponentWrapper
null
.
If in headless mode 1024
is returned.
getScreenWidth
in interface ComponentWrapper
1280
.public final int getScreenHeight()
ComponentWrapper
null
.
If in headless mode 768
is returned.
getScreenHeight
in interface ComponentWrapper
1024
.public final boolean hasBaseline()
ComponentWrapper
false
for Swing before mustang.
hasBaseline
in interface ComponentWrapper
public final java.lang.String getLinkId()
ComponentWrapper
null
should be returned.
For instance the Swing implementation returns the string returned from Component.getName()
.
getLinkId
in interface ComponentWrapper
null
.public final void setBounds(int x, int y, int width, int height)
ComponentWrapper
setBounds
in interface ComponentWrapper
x
- The x coordinate.y
- The y coordinate.width
- The width.height
- The height.public boolean isVisible()
ComponentWrapper
true
. This should not return if the component is
actually visible, but if the visibility is set to true or not.
isVisible
in interface ComponentWrapper
true
means visible.public final int[] getVisualPadding()
ComponentWrapper
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.
getVisualPadding
in interface ComponentWrapper
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]public static boolean isUseVisualPadding()
public static void setUseVisualPadding(boolean b)
public static boolean isMinimumSizeZero()
true
means minimum size is 0.public static void setMinimumSizeZero(boolean b)
b
- true
means minimum size is 0.public int getLayoutHashCode()
ComponentWrapper
getLayoutHashCode
in interface ComponentWrapper
public final void paintDebugOutline()
ComponentWrapper
paintDebugOutline
in interface ComponentWrapper
public int getComponetType(boolean disregardScrollPane)
ComponentWrapper
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.
getComponetType
in interface ComponentWrapper
disregardScrollPane
- Is true
any wrapping scroll pane should be disregarded and the type
of the scrolled component should be returned.
ComponentWrapper.TYPE_LABEL
.public final int hashCode()
hashCode
in class java.lang.Object
public final boolean equals(java.lang.Object o)
equals
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |