qnx.fuse.ui.core.UIComponent

UIComponent

Properties | Methods


Packageqnx.fuse.ui.core
Classpublic class UIComponent
InheritanceUIComponent Inheritance flash.display.MovieClip
Implements ILayoutElement, IInvalidating
Subclasses Container, DropDown, Image, Label, List, MediaControl, Picker, SegmentedControl, SkinnableComponent, SliderBase, TextBase, TilingBackground, UISkin, VideoDisplay

The UIComponent class is the base class for all components.

Class information:
PlayBook Tablet OS Version:   1.0.6



Public Properties

 PropertyDefined By
  explicitHeight : Number
[read-only] Returns the explicit height (actual height, in pixels) of the UI component.
UIComponent
  explicitWidth : Number
[read-only] Returns the explicit width (actual width, in pixels) of the UI component.
UIComponent
  includeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
  layoutData : Object
Returns the layout data for the object.
UIComponent
  minHeight : Number
Gets or sets the minimum preferred height of the control.
UIComponent
  minWidth : Number
Gets or sets the minimum preferred width of the control.
UIComponent

Public Methods

 MethodDefined By
  
Creates a new UIComponent instance.
UIComponent
  
childChanged(resizedChild:DisplayObject = null):Boolean
Notifies the UIComponent that one or more of its children has changed in a manner that may affect this object's layout.
UIComponent
  
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
  
Returns the size options for the given control.
UIComponent
  
Calling this method results in a call to the components validateDisplayList() method before the display list is rendered.
UIComponent
  
Calling this method results in a call to the components validateProperties() method before the display list is rendered.
UIComponent
  
measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
This method calls doMeasure() in order to calculate the preferred size of the control.
UIComponent
  
setActualSize(w:Number, h:Number):void
Sets the width and height of the object without setting the explicitWidth and explicitHeight.
UIComponent
  
setLayoutBounds(bounds:Rectangle):void
Sets the receiver's size and location to the rectangular area specified by the arguments.
UIComponent
  
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
  
Validates the display list of the component by calling the updateDisplayList().
UIComponent
  
Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary.
UIComponent
  
Validates the properties of the component by calling the commitProperties() method.
UIComponent

Protected Methods

 MethodDefined By
  
Process properties of the component.
UIComponent
  
Process the state of the component.
UIComponent
  
doMeasure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
Performs a measurement on the control, and returns a LayoutMeasurement instance containing the available width and height within the layout.
UIComponent
  
flushCache():void
Invoked as part of parentLayoutChanged.
UIComponent
  
onAdded():void
Called when the instance is added to the stage.
UIComponent
  
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
  
Invalidates the parent's size and display list if includeInLayout property is set to true.
UIComponent
  
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Sets the size and position of the children of the component.
UIComponent

Property Detail

explicitHeight


explicitHeight:Number  [read-only]

Returns the explicit height (actual height, in pixels) of the UI component.


Implementation

public function get explicitHeight():Number

explicitWidth


explicitWidth:Number  [read-only]

Returns the explicit width (actual width, in pixels) of the UI component.


Implementation

public function get explicitWidth():Number

includeInLayout


includeInLayout:Boolean

Specifies whether or not the component should be included in its parent container's layout. If set to true, the component will be sized and positioned based on the container's layout rules. If set to false, the component's size and position are not considered in the layout of the parent container.

After changing the value of this attribute, the container will receive ILayout.layoutChanged(null). The null argument indicates that this is not a change in a control's measure() or getSizeOptions() method.


Implementation

public function get includeInLayout():Boolean
public function set includeInLayout(value:Boolean):void

layoutData


layoutData:Object

Returns the layout data for the object. The meaning and type of this property is determined by the layout that contains the layout element, but it is generally used to configure all per-control settings in the layout.

The following attributes are common to all layout data:

  • Once a layoutData object is attached to an ILayoutElement, the object instance must never be changed. If callers want to modify the layout data, they must clone the old layout data object, modify it, then attach the new copy of it to the layout element. Layouts are allowed to compare the old layout data with the new one to determine what changed. If the original layout data is ever modified, the layout may incorrectly determine that nothing changed and ignore the event.
  • If this property changes, the layout will be notified via a call to ILayout.layoutChanged(null).


Implementation

public function get layoutData():Object
public function set layoutData(value:Object):void

minHeight


minHeight:Number

Gets or sets the minimum preferred height of the control. Can be used to ensure the control remains a usable size even when filled with very small controls. This only affects the control's preferred size and may be overridden by the parent layout.

The default value is 0.


Implementation

public function get minHeight():Number
public function set minHeight(value:Number):void

minWidth


minWidth:Number

Gets or sets the minimum preferred width of the control. Can be used to ensure the control remains a usable size even when filled with very small controls. This only affects the control's preferred size and may be overridden by the parent layout.

The default value is 0.


Implementation

public function get minWidth():Number
public function set minWidth(value:Number):void

Constructor Detail

UIComponent()


public function UIComponent()

Creates a new UIComponent instance.

Method Detail

childChanged()


public function childChanged(resizedChild:DisplayObject = null):Boolean

Notifies the UIComponent that one or more of its children has changed in a manner that may affect this object's layout. Subclasses may override this method to clear any cached information about their children or to opt out of changing their parent.

Parameters

resizedChild:DisplayObject (default = null) — If this is non-null, it indicates specifically that the getSizeOptions() or measure() method for the given child has changed. If this is null, it indicates any other kind of change that may affect this layout, including children being added, removed, reordered, a change in layout data or a change in the layout itself.

Returns

Boolean — true if this change may have an effect on the receiver's getSizeOptions or measure method. false if there is no chance of this change having any effect on the receiver's getSizeOptions or measure method.

commitProperties()


protected function commitProperties():void

Process properties of the component. You may want to override this in your own component subclasses.

Do not call this method yourself. It will be called by the validationProperties() method when required. It is called before the measure() method is called allowing you to adjust any properties that may be impact layout.

commitState()


protected function commitState():void

Process the state of the component. You may want to override this method in your own components.

The default implementation of this method sets the state of the skin to the current state of the component. This method is called after the commitProperties() method is called and before the measure() method is called.

destroy()


public function destroy():void

Call this method when you want to have your object collected by the garbage collector.

NOTE: This method does not remove the object from memory. Instead, it enables your instance to clean up after itself internally so that it can be garbage-collected.

doMeasure()


protected function doMeasure(availableWidth:Number, availableHeight:Number):LayoutMeasurement

Performs a measurement on the control, and returns a LayoutMeasurement instance containing the available width and height within the layout.

Override this method to provide custom measurement for your own controls.

Parameters

availableWidth:Number — The amount of space (width) available within the layout.
availableHeight:Number — The amount of space (height) available within the layout.

Returns

LayoutMeasurement — LayoutMeasurement

flushCache()


protected function flushCache():void

Invoked as part of parentLayoutChanged. If the subclass is caching the result of its doMeasure() method, it should override this method to clear the cache.

getSizeOptions()


public function getSizeOptions():int

Returns the size options for the given control. The size options determine the behaviour of the control during a resize operation.

Returns

int — A integer that defines a given size option.

invalidateDisplayList()


public function invalidateDisplayList():void

Calling this method results in a call to the components validateDisplayList() method before the display list is rendered. For UIComponent classes, this will result in a call to updateDisplayList().

invalidateProperties()


public function invalidateProperties():void

Calling this method results in a call to the components validateProperties() method before the display list is rendered. For UIComponent classes, this will result in a call to commitProperties().

measure()


public final function measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement

This method calls doMeasure() in order to calculate the preferred size of the control.

Override the doMeasure() method to add custom measurement to a control.

Parameters

availableWidth:Number — The available width.
availableHeight:Number — The available height.

Returns

LayoutMeasurement — LayoutMeasurement

See also

UIComponent.doMeasure()

onAdded()


protected function onAdded():void

Called when the instance is added to the stage.

This method can be overwritten in your subclasses. This method is called when the Event.ADDED_TO_STAGE event is dispatched.

onRemoved()


protected function onRemoved():void

Called when the instance is removed from the stage.

This method can be overwritten in your subclasses. This method is called when the Event.REMOVED_FROM_STAGE event is dispatched.

parentLayoutChanged()


protected final function parentLayoutChanged():void

Invalidates the parent's size and display list if includeInLayout property is set to true.

setActualSize()


public function setActualSize(w:Number, h:Number):void

Sets the width and height of the object without setting the explicitWidth and explicitHeight. This allows the component to return to its previous size in a future layout call.

Parameters

w:Number
h:Number

setLayoutBounds()


public function setLayoutBounds(bounds:Rectangle):void

Sets the receiver's size and location to the rectangular area specified by the arguments.

Parameters

bounds:Rectangle — The receivers size and location.

setPosition()


public function setPosition(x:Number, y:Number):void

Sets the x and y position of the component.

Parameters

x:Number — The new x position to be set.
y:Number — The new y position to be set.

updateDisplayList()


protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void

Sets the size and position of the children of the component. Component developers will want to subclass this method to adjust its children correctly.

If the component needs to do any drawing it should be done in this method as well.

This method should not be called directly as it is called by framework when its invalidateDisplayList() method is called.

Parameters

unscaledWidth:Number — The unscaled width of the component. Any drawing, sizing and positioning should be based on this value and not width.
unscaledHeight:Number — The unscaled height of the component. Any drawing, sizing, and positioning should be based on this value and not height.

validateDisplayList()


public function validateDisplayList():void

Validates the display list of the component by calling the updateDisplayList(). This allows you to make any adjustments to the components children's size and layout. Do not call this method directly as it is called by the framework for you. Also, do not subclass this method. Instead you should subclass the updateDisplayList() method.

See also

updateDisplayList()

validateNow()


public function validateNow():void

Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary.

validateProperties()


public function validateProperties():void

Validates the properties of the component by calling the commitProperties() method. Do not call this method directly as it is called by the framework for you. Also, do not subclass this method. Instead you should subclass the commitProperties() method.

See also

commitProperties()