interface org.aswing.plaf.ComponentUI
Sub classes | ||||||||||||||||||
![]() | AdjusterUI, ColorSwatchesUI, ComboBoxUI, FrameUI, MenuElementUI, SliderUI, TableUI, TreeUI |
|
Implementors | ||||
![]() | BaseComponentUI |
|
The interface for all UI delegate objects in the AsWing pluggable look and feel architecture. The UI delegate object for a AsWing component is responsible for implementing the aspects of the component that depend on the look and feel. The Component class invokes methods from this class in order to delegate operations (painting, layout calculations, etc.) that may vary depending on the look and feel installed. Client programs should not invoke methods on this class directly.
@author paling
Instance Fields
function getDefault(key:String): Dynamic
Returns the default property for this UI of specified key.
Generally, the ui will search the key in self holder that was put by
putDefault
first, if it contains, then return it. If not
then it will call UIManager.get
to get it from LAF defaults.
returns | the default property of specifiled key. |
function getInternalFocusObject(c:Component): InteractiveObject
Returns the object to receive the focus for the component.
c | the component |
returns | the object to receive the focus. |
function getMaximumSize(c:Component): IntDimension
Returns the specified component's maximum size appropriate for
the look and feel. If null
is returned, the maximum
size will be calculated by the component's layout manager instead
(this is the preferred approach for any component with a specific
layout manager installed). The default implementation of this
method invokes getPreferredSize
and returns that value.
@see org.aswing.Component#getMaximumSize @see org.aswing.LayoutManager#maximumLayoutSize @see #getPreferredSize
c | the component whose maximum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
returns | a |
function getMinimumSize(c:Component): IntDimension
Returns the specified component's minimum size appropriate for
the look and feel. If null
is returned, the minimum
size will be calculated by the component's layout manager instead
(this is the preferred approach for any component with a specific
layout manager installed). The default implementation of this
method invokes getPreferredSize
and returns that value.
@see org.aswing.Component#getMinimumSize @see org.aswing.LayoutManager#minimumLayoutSize @see #getPreferredSize
c | the component whose minimum size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
returns | a |
function getPreferredSize(c:Component): IntDimension
Returns the specified component's preferred size appropriate for
the look and feel. If null
is returned, the preferred
size will be calculated by the component's layout manager instead
(this is the preferred approach for any component with a specific
layout manager installed). The default implementation of this
method returns null
.
@see org.aswing.Component#getPreferredSize @see org.aswing.LayoutManager#preferredLayoutSize
c | the component whose preferred size is being queried; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |
function installUI(c:Component): Void
Configures the specified component appropriate for the look and feel.
This method is invoked when the ComponentUI
instance is being installed
as the UI delegate on the specified component. This method should
completely configure the component for the look and feel,
including the following:
- Install any default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
- Install a
LayoutManager
on the component if necessary. - Create/add any required sub-components to the component.
- Create/install event listeners on the component.
- Install keyboard UI (mnemonics, traversal, etc.) on the component.
- Initialize any appropriate instance data.
c | the component where this UI delegate is being installed |
function paint(c:Component, g:Graphics2D, b:IntRectangle): Void
Notifies this UI delegate that it's time to paint the specified
component. This method is invoked by Component
when the specified component is being painted.
In general this method need be overridden by subclasses; all look-and-feel rendering code should reside in this method. And there is a default background paint method, you should call it in your overridden paint method.
@see org.aswing.Component#paint @see #paintBackGround
c | the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components. |
g | the Graphics context in which to paint. |
b | the bounds to paint UI in. |
function paintFocus(c:Component, g:Graphics2D, b:IntRectangle): Void
Paints focus representation to the component.
c | the component being painted; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components. |
g | the Graphics context in which to paint. |
b | the bounds to paint focus in. |
function putDefault(key:String, value:Dynamic): Void
Puts a ui default value used to this UI instead of LAF defualt value. The values should be put before installing then it can be used.
key | the key. |
value | the value. |
function refreshStyleProperties(): Void
Refresh the color and font and any other style properties the UI supported and then repaint the component.
function uninstallUI(c:Component): Void
Reverses configuration which was done on the specified component during
installUI
. This method is invoked when this
ComponentUI
instance is being removed as the UI delegate
for the specified component. This method should undo the
configuration performed in installUI
, being careful to
leave the Component
instance in a clean state (no
extraneous listeners, look-and-feel-specific property objects, etc.).
This should include the following:
- Remove any UI-set borders from the component.
- Remove any UI-set layout managers on the component.
- Remove any UI-added sub-components from the component.
- Remove any UI-added event listeners from the component.
- Remove any UI-installed keyboard UI from the component.
- Remove any UI-added MCs from this component.
- Nullify any allocated instance data objects to allow for GC.
c | the component from which this UI delegate is being removed; this argument is often ignored, but might be used if the UI object is stateless and shared by multiple components |