Packagetwaver.network.ui
Classpublic class ElementUI
InheritanceElementUI Inheritance mx.core.UIComponent
Subclasses LinkUI, NodeUI

Element ui is extends from UIComponent and responsible for drawing element content on network canvas. Every element has an element ui class name so in runtime TWaver Flex will create an element ui instance for this element to paint content on network canvas dynamically.

In TWaver MVC framework, elements are model, network and these ui classes are view. To visit element ui instance, you can not get from element class because element is just a plain class defines data model. Also, an element can be displayed on many networks in the same time so it will has many more element ui instances for each network in the same time. use network.getElementUI(element) to get element ui instance for an element. Call network.invalidateElementUI(element) to invalidate the element ui for this element.

For example, element Node use NodeUI as the element ui:

	 public class Node extends Element{
	 	//...
	 	override public function get elementUIClass():Class{
	 		return NodeUI;
	 	}
	 }
	 

See also

twaver.network.Network
twaver.Element


Public Properties
 PropertyDefined By
  alarmAttachment : AlarmAttachment
[read-only] Get alarm attachment of this element ui.
ElementUI
  attachments : ICollection
[read-only] Get all attachments as a collection.
ElementUI
  bodyRect : Rectangle
[read-only] Get the element body rectangle.
ElementUI
  editAttachment : EditAttachment
[read-only] Get edit attachment.
ElementUI
  element : IElement
[read-only] Get the element of this element ui.
ElementUI
  hotSpot : Point
Get hotspot point of this element ui.
ElementUI
  iconsAttachment : IconsAttachment
[read-only] Get icon attachment.
ElementUI
  labelAttachment : LabelAttachment
[read-only] Get label attachment of this element ui.
ElementUI
  network : Network
[read-only] Get network component this element ui displayed on.
ElementUI
  unionBounds : Rectangle
[read-only] Get the rectangle covers all graphical elements, including element body and all attachments.
ElementUI
  visible : Boolean
[override] [write-only]
ElementUI
Protected Properties
 PropertyDefined By
  bodyComponent : UIComponent
ElementUI
  innerColor : Object
[read-only] Get element inner color.
ElementUI
  outerColor : Object
[read-only] Get element outline color.
ElementUI
Public Methods
 MethodDefined By
  
ElementUI(network:Network, element:IElement)
Create an element ui for specified element on this network.
ElementUI
  
Check all attachments installed on this element ui.
ElementUI
  
dispose():void
Dispose all resources used by this element ui.
ElementUI
  
handlePropertyChange(e:PropertyChangeEvent):void
Called when any element property changed.
ElementUI
  
Called when selection changed.
ElementUI
  
hitsTest(point:Point, tolerance:int):Object
ElementUI
  
invalidate(checkAttachments:Boolean):void
Invalidate element ui.
ElementUI
  
Update all properties from network and element, redraw this element ui.
ElementUI
Protected Methods
 MethodDefined By
  
addAttachment(attachment:Attachment):void
Add attachment into this element ui.
ElementUI
  
Check, update and display alarm attachment.
ElementUI
  
Check, update and display edit attachment.
ElementUI
  
Check, update and display icon attachment.
ElementUI
  
Check, update and display label attachment.
ElementUI
  
[override]
ElementUI
  
Create element body effect filters of this element ui.
ElementUI
  
createBodyRect():Rectangle
Create body bound rectangle.
ElementUI
  
Create element effect filters of this element ui.
ElementUI
  
drawBody(g:Graphics):void
Draw element body.
ElementUI
  
getDyeColor(styleProp:String):Number
Get dye color of the specified style property.
ElementUI
  
isEditable():Boolean
Check whether this element is editable now.
ElementUI
  
measure():void
[override]
ElementUI
  
removeAttachment(attachment:Attachment):void
Remove specified attachment from this element ui.
ElementUI
  
Update element measure.
ElementUI
Property Detail
alarmAttachmentproperty
alarmAttachment:AlarmAttachment  [read-only]

Get alarm attachment of this element ui.


Implementation
    public function get alarmAttachment():AlarmAttachment
attachmentsproperty 
attachments:ICollection  [read-only]

Get all attachments as a collection.


Implementation
    public function get attachments():ICollection
bodyComponentproperty 
protected var bodyComponent:UIComponent

bodyRectproperty 
bodyRect:Rectangle  [read-only]

Get the element body rectangle.


Implementation
    public function get bodyRect():Rectangle
editAttachmentproperty 
editAttachment:EditAttachment  [read-only]

Get edit attachment. Edit attachment shows small editing indicators on this element ui used to resizing, moving control point etc.


Implementation
    public function get editAttachment():EditAttachment
elementproperty 
element:IElement  [read-only]

Get the element of this element ui.


Implementation
    public function get element():IElement
hotSpotproperty 
hotSpot:Point

Get hotspot point of this element ui.


Implementation
    public function get hotSpot():Point
    public function set hotSpot(value:Point):void
iconsAttachmentproperty 
iconsAttachment:IconsAttachment  [read-only]

Get icon attachment. Icon attachment display all small icons attached on this element ui.


Implementation
    public function get iconsAttachment():IconsAttachment
innerColorproperty 
innerColor:Object  [read-only]

Get element inner color.


Implementation
    protected function get innerColor():Object
labelAttachmentproperty 
labelAttachment:LabelAttachment  [read-only]

Get label attachment of this element ui.


Implementation
    public function get labelAttachment():LabelAttachment
networkproperty 
network:Network  [read-only]

Get network component this element ui displayed on.


Implementation
    public function get network():Network
outerColorproperty 
outerColor:Object  [read-only]

Get element outline color.


Implementation
    protected function get outerColor():Object
unionBoundsproperty 
unionBounds:Rectangle  [read-only]

Get the rectangle covers all graphical elements, including element body and all attachments.


Implementation
    public function get unionBounds():Rectangle
visibleproperty 
visible:Boolean  [write-only] [override]


Implementation
    public function set visible(value:Boolean):void
Constructor Detail
ElementUI()Constructor
public function ElementUI(network:Network, element:IElement)

Create an element ui for specified element on this network.

Parameters
network:Network — the network component this element ui displayed on.
 
element:IElement — the element this element ui works for.
Method Detail
addAttachment()method
protected function addAttachment(attachment:Attachment):void

Add attachment into this element ui.

Parameters

attachment:Attachment — attachment to be added.

checkAlarmAttachment()method 
protected function checkAlarmAttachment():void

Check, update and display alarm attachment.

checkAttachments()method 
public function checkAttachments():void

Check all attachments installed on this element ui.

checkEditAttachment()method 
protected function checkEditAttachment():void

Check, update and display edit attachment.

checkIconsAttachment()method 
protected function checkIconsAttachment():void

Check, update and display icon attachment.

checkLabelAttachment()method 
protected function checkLabelAttachment():void

Check, update and display label attachment.

commitProperties()method 
override protected final function commitProperties():void

createBodyFilters()method 
protected function createBodyFilters():Array

Create element body effect filters of this element ui.

Returns
Array — element body effect filters of this element ui.
createBodyRect()method 
protected function createBodyRect():Rectangle

Create body bound rectangle.

Returns
Rectangle — body bound rectangle.
createFilters()method 
protected function createFilters():Array

Create element effect filters of this element ui.

Returns
Array — element effect filters of this element ui.
dispose()method 
public function dispose():void

Dispose all resources used by this element ui.

drawBody()method 
protected function drawBody(g:Graphics):void

Draw element body.

Parameters

g:Graphics — the graphic draw body on.

getDyeColor()method 
protected function getDyeColor(styleProp:String):Number

Get dye color of the specified style property.

Parameters

styleProp:String — style property name of the color you want to get.

Returns
Number — dye color of this style property.
handlePropertyChange()method 
public function handlePropertyChange(e:PropertyChangeEvent):void

Called when any element property changed.

Parameters

e:PropertyChangeEvent — element property change event.

handleSelectionChange()method 
public function handleSelectionChange(e:SelectionChangeEvent):void

Called when selection changed.

Parameters

e:SelectionChangeEvent — selection changed event.

hitsTest()method 
public function hitsTest(point:Point, tolerance:int):Object

Parameters

point:Point
 
tolerance:int

Returns
Object
invalidate()method 
public function invalidate(checkAttachments:Boolean):void

Invalidate element ui.

Parameters

checkAttachments:Boolean — whether need to recheck all attachements.

isEditable()method 
protected function isEditable():Boolean

Check whether this element is editable now.

Returns
Boolean — whether this element is editable now.
measure()method 
override protected final function measure():void

removeAttachment()method 
protected function removeAttachment(attachment:Attachment):void

Remove specified attachment from this element ui.

Parameters

attachment:Attachment — the attachment to be removed.

updateMeasure()method 
protected function updateMeasure():void

Update element measure.

updateProperties()method 
public function updateProperties():void

Update all properties from network and element, redraw this element ui.