class org.aswing.Component extends AWSprite

The super class for all Components.

Instance Fields

Show inherited public instance fieldsHide inherited public instance fields

Inherited from AWSprite

function bringToBottom(child:DisplayObject):Void
function bringToTop(child:DisplayObject):Void
function containsChild(child:DisplayObject):Bool
function getHighestIndexUnderForeground():Int
function getLowestIndexAboveBackground():Int
function isClipMasked():Bool
function setChildIndex(child:DisplayObject, index:Int):Void
function setClipMaskRect(b:IntRectangle):Void
function setClipMasked(m:Bool):Void
function toString():String

Inherited from Sprite

var buttonMode:Bool
var dropTarget:DisplayObject
var graphics:Graphics
var hitArea:Sprite
var soundTransform:SoundTransform
var useHandCursor:Bool
function startDrag(?lockCenter:Bool, ?bounds:Rectangle):Void
function startTouchDrag(touchPointID:Int, ?lockCenter:Bool, ?bounds:Rectangle):Void
function stopDrag():Void
function stopTouchDrag(touchPointID:Int):Void

Inherited from DisplayObjectContainer

var mouseChildren:Bool
var numChildren:Int
var tabChildren:Bool
var textSnapshot:TextSnapshot
function addChild(child:DisplayObject):DisplayObject
function addChildAt(child:DisplayObject, index:Int):DisplayObject
function areInaccessibleObjectsUnderPoint(point:Point):Bool
function contains(child:DisplayObject):Bool
function getChildAt(index:Int):DisplayObject
function getChildByName(name:String):DisplayObject
function getChildIndex(child:DisplayObject):Int
function getObjectsUnderPoint(point:Point):Array<DisplayObject>
function removeChild(child:DisplayObject):DisplayObject
function removeChildAt(index:Int):DisplayObject
function setChildIndex(child:DisplayObject, index:Int):Void
function swapChildren(child1:DisplayObject, child2:DisplayObject):Void
function swapChildrenAt(index1:Int, index2:Int):Void

Inherited from InteractiveObject

var accessibilityImplementation:AccessibilityImplementation
var contextMenu:ContextMenu
var doubleClickEnabled:Bool
var focusRect:Dynamic
var mouseEnabled:Bool
var tabEnabled:Bool
var tabIndex:Int

Inherited from DisplayObject

var accessibilityProperties:AccessibilityProperties
var alpha:Float
var blendMode:BlendMode
var blendShader:Shader
var cacheAsBitmap:Bool
var filters:Array<BitmapFilter>
var height:Float
var loaderInfo:LoaderInfo
var mask:DisplayObject
var mouseX:Float
var mouseY:Float
var name:String
var opaqueBackground:Null<UInt>
var parent:DisplayObjectContainer
var root:DisplayObject
var rotation:Float
var rotationX:Float
var rotationY:Float
var rotationZ:Float
var scale9Grid:Rectangle
var scaleX:Float
var scaleY:Float
var scaleZ:Float
var scrollRect:Rectangle
var stage:Stage
var transform:Transform
var visible:Bool
var width:Float
var x:Float
var y:Float
var z:Float
function getBounds(targetCoordinateSpace:DisplayObject):Rectangle
function getRect(targetCoordinateSpace:DisplayObject):Rectangle
function globalToLocal(point:Point):Point
function globalToLocal3D(point:Point):Vector3D
function hitTestObject(obj:DisplayObject):Bool
function hitTestPoint(x:Float, y:Float, ?shapeFlag:Bool):Bool
function local3DToGlobal(point3d:Vector3D):Point
function localToGlobal(point:Point):Point

Inherited from EventDispatcher

function addEventListener(type:String, listener:Dynamic ->Void?useCapture:Bool, ?priority:Int, ?useWeakReference:Bool):Void
function dispatchEvent(event:Event):Bool
function hasEventListener(type:String):Bool
function removeEventListener(type:String, listener:Dynamic ->Void?useCapture:Bool):Void
function toString():String
function willTrigger(type:String):Bool

var alignmentX:Float

The alignment along the X axis.

This specifies how the component would like to be aligned relative to its size when its size is maxer than its maximumSize.

The value should be a number between 0 and 1 where 0 represents alignment start from left, 1 is aligned the furthest away from the left, 0.5 is centered, etc.

var alignmentY:Float

The alignment along the Y axis.

This specifies how the component would like to be aligned relative to its size when its size is maxer than its maximumSize.

The value should be a number between 0 and 1 where 0 represents alignment start from top, 1 is aligned the furthest away from the top, 0.5 is middle, etc.

var background:ASColor

The background color of this component.

It affects each component differently. Generally it affects the background of a component, or to be the main tinge of a component.

If it is null and it has style proxy, then this component will inherit the background color of its style proxy.

var backgroundDecorator:GroundDecorator

A decorator represents the component background with a DisplayObject.

See Also

var border:Border

The border for the component, null to remove border. Border's display object will always on top of background decorator but under other assets.

var bounds:IntRectangle

The location of the top-left corner of a component is specified by x and y, and the size is specified by width and height.

var clipBounds:IntRectangle

The clip bounds, a rectangle mask to make specified bounds visible.

`null' to make the componet mask whole rectangle(show all).

Default is null.

Note: the getter clones the value.

var constraints:Dynamic

Component constraints. It's used by layout managers to layout components in a container.

For example, BorderLayout.CENTER

var currentSize:IntDimension

The component's size.

You can set a Component's size max than its maximumSize, but when it was drawed, it will not max than its maximumSize.Just as its maximumSize and posited itself in that size dimension you just setted. The position is relative to alignmentX

See Component.alignmentX, Component.alignmentY, Component.minimumSize, Component.countMaximumSize, Component.preferredSize

var dragEnabled:Bool

Means whether this component can fire ON_DRAG_RECOGNIZED event. (Default value is false)

var dropTrigger:Bool

Means whether this component can trigger dragging component to fire drag events when dragging over to this component.(Default value is false) See ON_DRAG_ENTER, ON_DRAG_OVER, ON_DRAG_EXIT, ON_DRAG_DROP

var enabled:Bool

Enable or disable the component.

If a component is disabled, it will not fire mouse events. And some component will has different interface when enabled or disabled.

var focusable:Bool

The focusable state of this Component. This value overrides the Component's default focusability.

var focusableSet:Bool

Indicates whether or not the focusable property is set by user. If it is not set, focusable will be replaced with the value defined in LAF defaults when install a UI.

var font:ASFont

The text font for this component.

The setting of this property will cause a repaint and revalidate method call.

var foreground:ASColor

The foreground color of this component.

It affects each component differently. Generally it affects the text color of a component.

If it is null and it has style proxy, then this component will inherit the foreground color of its style proxy.

var foregroundDecorator:GroundDecorator

A decorator represents the component foreground with a DisplayObject.

See Also

var location:IntPoint

The location of the top-left corner of a component is specified by x and y, and the size is specified by width and height.

var maximumSize:IntDimension

The maximum size of a `Component'.

If it's null it'll be calculated. @see ComponentUI.getMaximumSize

var mideground:ASColor

The mideground color affects each component differently, generally it affects the thumb color. Most component has no thumb will not use this property.

If it is null and it has style proxy, then this component will inherit the mideground color of its style proxy.

var minimumSize:IntDimension

The minimum size of a `Component'.

If it's null it'll be calculated. @see ComponentUI.getMinimumSize

var opaque:Bool

It's true if this component is completely opaque.

An opaque component paints every pixel within its rectangular bounds. A non-opaque component paints only a subset of its pixels or none at all, allowing the pixels underneath it to "show through". Therefore, a component that does not fully paint its pixels provides a degree of transparency.

The value is from LookAndFeel defaults if you have not set it.

Subclasses that guarantee to always completely paint their contents should override this method and return true.

var opaqueSet:Bool

The value means whether or not the opaque property is set by user.

If it is not set, Component.opaque will can be replaced with the value defined in LAF defaults when install a UI.

It'll also be set to true when you set the value of Component.opaque.

var preferredSize:IntDimension

The preferredSize's used during a layout process. LayoutManager tries to layout a component to this size.

var resizerMargin:Insets

The space between the component's border and the resizer trigger

var styleProxy:Component

The style proxy is used to provide the style(background, mideground, foreground and StyleTune) properties for this component if any of them are set to null or DefaultEmptyDecoraterResource.NULL_XXX.

For example, if you set a button's background to null, then background of the button will return its style proxy's background.

By default, the proxy is the parent of this component

var styleTune:StyleTune

The style tune affects each component differently based on its LAF UI implements, generally it affects the border and content color gradient.

Not every LookAndFeel UI will use style tune. BasicLookAndFeel use it mostly.

If it is null then this component will use DefaultEmptyDecoraterResource.NULL_STYLE_TUNE

See Also

var toolTipText:String

The text to display in a tool tip. The text displays when the cursor lingers over the component.

This tip will display with a shared tool tip with other components, so if you want to display more than one tip at same time, you may need to create your JToolTip or JSharedToolTip.

if the text is null, the tool tip is turned off for this component.

var ui:ComponentUI

The look and feel delegate for this component. Component subclasses generally override this method

var uiElement:Bool

Indicates if this component is just a ui element component or this component is a regular use created component.

If a component is a ui element, it and its children will not be called Component.updateUI when AsWingUtils to go thought a list of component to update the UI. That is because ui element will be removed when uninstall UI, new ui elements will be created when install UI. So it do not need to do update.

returns

whether or not this component is a ui element component.

var visibility:Bool

Makes a component hide or shown. If a component was hide, some laterly operation may not be done, they will be done when next shown, ex: repaint, doLayout .... So suggest you dont changed a component's visible frequently.

function new(): Void

function addDragAcceptableInitiator(com:Component): Void

Adds a component to be the acceptable drag initiator to this component.

It is not meanning that the DnD events will not be fired when the initiator is dragging enter/over/exit/drop on this component. It is meanning that you can have a convenient way to proccess that events from the method Component.isDragAcceptableInitiator later, and the default dragging image will take advantage to present a better picture when painting.

com

the acceptable drag initiator

function componentToGlobal(p:IntPoint): IntPoint

Converts local (inside component space) coordinates to the global space.

function getClientProperty(key:String, ?defaultValue:Dynamic = null): Dynamic

Returns the value of the property with the specified key. Only properties added with putClientProperty will return a non-null value.

key

the being queried

defaultValue

if the value doesn't exists, the defaultValue will be returned

returns

the value of this property or null

function getDefaultBasicUIClass(): Class<Dynamic>

Returns the default basic ui class for this component. If there is not a ui class specified in L&F for this component, this method will be called to return a default one.

function getFocusManager(): FocusManager

Returns the focus manager for this component's stage, or null if this component is not on stage.

function getGlobalLocation(?rv:IntPoint = null): IntPoint

Stores the global location value of this component into "return value" rv and returns rv.

If rv is null a new Point object is allocated.

rv

the return value, modified to the component's global location. See Component.location, Component.setGlobalLocation, flash.DisplayObject.localToGlobal, flash.DisplayObject.globalToLocal

function getInsets(): Insets

If a border has been set on this component, returns the border's insets; otherwise returns an empty insets.

function getInternalFocusObject(): InteractiveObject

Returns the object to receive the focus for this component. It will call the ui to return the ui specified object, if ui is null or ui returned null, then it just return the component self.

Other component may return a child object, for example JTextComponent will return its TextField object.

returns

the object to receive the focus.

See Also

function getKeyboardManager(): KeyboardManager

Returns the keyboard manager of this component's JRootPane ancestor or null if no root pane ancestor.

function getMousePosition(): IntPoint

Returns the coordinate of the mouse position, in pixels, in the component scope.

returns

the coordinate of the mouse position.

function getPaintBounds(): IntRectangle

Returns the bounds that component should paint in.

This is same to some paint method param b:Rectangle. So if you want to paint outside those method, you can get the rectangle from here.

If this component has a little maximum size, and then current size is larger, the bounds return from this method will be related to Component.alignmentX, Component.alignmentY and Component.maximumSize.

returns

return the rectangle that component should paint in.

function getParent(): Container

Returns the Container parent, if it parent is not a Container, null will be returned.

returns

the Container parent

function getRootPaneAncestor(): JRootPane

Returns the first JRootPane ancestor of this component, or null if not found.

function getUIClassID(): String

Returns the UIDefaults key used to look up the name of the org.aswing.plaf.ComponentUI class that defines the look and feel for this component.

Most applications will never need to call this method. Subclasses of Component that support pluggable look and feel should override this method to

return a UIDefaults key that maps to the ComponentUI subclass that defines their look and feel.

returns

the UIDefaults key for a ComponentUI subclass

See Also

function globalToComponent(p:IntPoint): IntPoint

Converts global coordinates to the local space (inside component space).

function hitTestMouse(): Bool

Returns whether the component hit the mouse.

function invalidate(): Void

Invalidates this component.

This component and all parents above it are marked as needing to be laid out, and all Component.clearPreferSizeCaches. This method can be called often, so it needs to execute quickly. See Component.validate, Component.doLayout, Component.invalidatePreferSizeCaches, org.aswing.LayoutManager

function invalidatePreferSizeCaches(): Void

Clears this component and all parents above it's preferred size caches.

By default all components' prefer sizes(max, min, prefer) have caches, if you make some call that cached a invalided component's sizes but then you modify the component again, so it's prefer size need to be renew, Component.invalidatePreferSizeCaches will be helpful now.

Generally you do not need to call this method manually unless you get above situation. this method will be called inside Component.invalidate automatically. See Component.invalidate, Component.validate, Component.setCachePreferSizes, org.aswing.LayoutManager

function isCachePreferSizes(): Bool

Returns whether or not the preferred size, minimum size and max size cache is turned on.

returns

whether or not the preferred size, minimum size and max size cache is turned on.

function isDragAcceptableInitiator(com:Component): Bool

Returns whether the component is acceptable drag initiator for this component.

com

the maybe acceptable drag initiator

returns

true if it is acceptable drag initiator, false not

function isFocusOwner(): Bool

Returns true if this Component is the focus owner.

returns

true if this Component is the focus owner; false otherwise

function isFontValidated(): Bool

Returns whether the new font are applied and taked effect.

Some UI can just apply font to text when this method returned false to avoid wasteful time for font applying.

returns

true if currently font are applied to texts, otherwish false.

See Also

function isOnStage(): Bool

Determines whether or not this component is on stage(on the display list).

returns

turn of this component is on display list, false not.

function isShowing(): Bool

Determines whether this component is showing on screen. This means that the component must be visible, and it must be in a container that is visible and showing.

returns

true if the component is showing, false otherwise

See Also

function isValid(): Bool

Determines whether this component is valid. A component is valid when it is correctly sized within its parent container and all its children are also valid. components are invalidated before they are first shown on the screen. By the time the parent container is fully realized, all its components will be valid.

returns

true if the component is valid, false otherwise

See Also

function isValidateRoot(): Bool

If this method returns true, revalidate calls by descendants of this component will cause the entire tree beginning with this root to be validated. Returns false by default. JScrollPane overrides this method and returns true.

returns

return true if this component is located in a non-component container, otherwise returns false

function makeFocus(): Void

Makes this component's internal focus object to be the stage focus directly, without any judgement.

You'd better to call Component.requestFocus() generally, this method is only used to some internal implementation at most time.

function pack(): Void

Causes this component to be sized to fit the preferred size.

function paintFocusRect(?force:Bool = false): Void

Paints the focus rect if need. The focus will be paint by the component ui if this component is focusOwner and FocusManager.getCurrentManager().isTraversing().

force

force to paint the focus rect nomatter if it is focused.

function paintImmediately(): Void

Redraw the component UI face immediately if it is visible and ready to paint. See Component.repaint, Component.visibility, Component.isReadyToPaint

function parentReAppendChildren(): Void

Calls parent reAppendChildren if parent is a container.

function putClientProperty(key:String, value:Dynamic): Void

Adds an arbitrary key/value "client property" to this component.

The get/putClientProperty methods provide access to a small per-instance hashtable.

Callers can use get/putClientProperty to annotate components that were created by another module.

For example, a layout manager might store per child constraints this way. For example: componentA.putClientProperty("to the left of", componentB);

key

the new client property key

value

the new client property value

function reAppendToParent(?constraints:Dynamic = null): Void

Removes this component from its parent and then append it with specified constraints. If this component is not in a container yet, no effect will take.

constraints

the new constraints, null means get from getConstraints method.

See Also

function removeDragAcceptableInitiator(com:Component): Void

Removes a component to be the acceptable drag initiator to this component.

com

the acceptable drag initiator

function removeFromContainer(): Void

Removes this component from its parent, whatever it is as a component child or only a display object child, or it's parent is just a display object container.

This method will remove this component in any case.

function repaint(): Void

Redraws the component face next RENDER event.

This method can be called often, so it needs to execute quickly.

See Also

function requestFocus(): Bool

Requests that this Component get the input focus, and that this Component's top-level ancestor become the focused Window. This component must be displayable, visible, and focusable for the request to be granted. Every effort will be made to honor the request; however, in some cases it may be impossible to do so. Developers must never assume that this Component is the focus owner until this Component receives a org.aswing.event.AWEvent.FOCUS_GAINED event.

returns

true if the request is made successful, false if the request is denied.

function revalidate(): Void

Supports deferred automatic layout.

Calls Component.invalidate and then adds this component to a list of components that need to be validated. Validation will occur after all currently pending events have been dispatched. In other words after this method is called, the first component (if any) found when walking up the containment hierarchy of this component will be validated. By default, JPopup, JScrollPane, and JTextField return true from Component.isValidateRoot.

This method will or will not automatically be called on this component when a property value changes such that size, location, or internal layout of this component has been affected.But invalidate will do called after thats method, so you want to get the contents of the GUI to update you should call this method.

See Component.invalidate, Component.validate, Component.isValidateRoot, RepaintManager.addInvalidComponent

function setCachePreferSizes(b:Bool): Void

Sets whether or not turn on the preferred size, minimum size and max size cache. By default, this is true(means turned on).

If this is turned on, the size count will be very fast as most time. So suggest you that do not turn off it unless you have your personal reason.

b

true to turn on it, false trun off it.

function setClipSize(size:IntDimension): Void

Sets the size of clip bounds, a rectangle mask to make specified bounds visible.

This will be only in effect after component created and before next layout time.

function setDragAcceptableInitiatorAppraiser(func:Dynamic ->Bool): Void

Sets a function to judge whether a component is acceptable drag initiator. This function will be called to judge when dragAcceptableInitiator set does not contains the component.

the

judge function func(initiator:Component):Boolean

function setFontValidated(b:Bool): Void

Sets whether the new font are applied and taked effect.

Once the UI applied the font, it can call this method to set the value to be true, to avoid next wasteful applying.

returns

true set font are applied, otherwish false.

See Also

function setGlobalLocation(gp:IntPoint): Void

Set the component's location in global coordinate. This method should only be called when the component is on the display list. See Component.location, flash.DisplayObject.localToGlobal, flash.DisplayObject.globalToLocal

gp

the global location.

function transferFocus(): Bool

Transfers the focus to the next component, as though this Component were the focus owner.

returns

true if transfered, false otherwise

function transferFocusBackward(): Bool

Transfers the focus to the previous component, as though this Component were the focus owner.

returns

true if transfered, false otherwise

function updateUI(): Void

Resets the UI property to a value from the current look and feel. Component subclasses must override this method like this: ` public void updateUI() {

 setUI(SliderUI(UIManager.getUI(this)));

} `

See Component.ui, UIManager.getLookAndFeel, UIManager.getUI

function validate(): Void

Ensures that this component has a valid layout. This method is primarily intended to operate on instances of Container. See Component.invalidate, Container.doLayout, LayoutManager, Container.validate