interface org.aswing.plaf.ComponentUI

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 getBoolean(key:String): Bool

function getBorder(key:String): Border

function getClass(key:String): Class<Dynamic>

function getColor(key:String): ASColor

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 getFont(key:String): ASFont

function getIcon(key:String): Icon

function getInsets(key:String): Insets

function getInstance(key:String): Dynamic

function getInt(key:String): Int

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 IntDimension object or null

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 IntDimension object or null

function getNumber(key:String): Float

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 getString(key:String): String

function getUint(key:String): Int

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:

  1. 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.
  2. Install a LayoutManager on the component if necessary.
  3. Create/add any required sub-components to the component.
  4. Create/install event listeners on the component.
  5. Install keyboard UI (mnemonics, traversal, etc.) on the component.
  6. Initialize any appropriate instance data.
@see #uninstallUI @see org.aswing.Component#setUI @see org.aswing.Component#updateUI

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:

  1. Remove any UI-set borders from the component.
  2. Remove any UI-set layout managers on the component.
  3. Remove any UI-added sub-components from the component.
  4. Remove any UI-added event listeners from the component.
  5. Remove any UI-installed keyboard UI from the component.
  6. Remove any UI-added MCs from this component.
  7. Nullify any allocated instance data objects to allow for GC.
@see #installUI @see org.aswing.Component#updateUI

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