# sys::Component

    sys::Obj
      sys::Virtual
        sys::Component

`public class Component`

Component is the base class for all Sedona component classes.

ADDED

  `public static const define int ADDED`

REMOVED

  `public static const define int REMOVED`

REORDERED

  `public static const define int REORDERED`

children

  `public short children`

  First child id in linked list of children (do not modify directly)

id

  `public short id`

  Identifier in application (do not modify directly)

linksFrom

  `public Link linksFrom`

  Linked list of Links where this is the "from" component

linksTo

  `public Link linksTo`

  Linked list of Links where this is the "to" component

meta

  `public property int meta [config]`

  Metadata common to all components is packed into 32-bits:

        00-03: nibble for security groups
        16-23: byte logical x coordinate on wiresheet
        23-31: byte logical y coordinate on wiresheet

name

  `public inline Str name`

nameLen

  `public static const define int nameLen`

  Human name for this component which is unique within its parent (do not modify directly)

nextSibling

  `public short nextSibling`

  Next sibling id for linked list of components under a given parent (do not modify directly)

nullId

  `public static const define int nullId`

  This value represents a null two byte id as 0xffff

parent

  `public short parent`

  Parent id or nullId if root App or unmounted (do not modify directly)

type

  `public const Type type`

  Reference to the Type instance which describes this Component.

watchFlags

  `public inline byte[] watchFlags`

  Bitmask for each watch's subscriptions and events

allowChildExecute

  `public virtual bool allowChildExecute()`

  allowChildExecute returns false if child components of this should not have execute() called this app cycle.

changed

  `public virtual void changed(Slot slot)`

  The changed method must be called when a slot is modified. It is automatically called whenever setting a property field with a primitive type (bool, byte, short, int, and float). However it must be manually called after updating the contents of a Buf property. If you override this method, you MUST call super!

childEvent

  `public virtual int childEvent(int eType, Component child)`

  Called on parent when a child event occurs. Only called if app is running.

  Defined event types are:

  REMOVED - notification that child has been removed from component.

        Should always return 0.  Called after stop() on child.

  ADDED - notification that child has been added to component.

        Should always return 0.   Called prior to loaded() / start() on child.

  REORDERED - notification that component's children have been reordered.

        Should always return 0.   Called after the reordering is complete.
        Only called once per reorder event; child arg is always null.

  Future event types may make use of return code.

execute

  `public virtual void execute()`

  Execute is called once every scan using the simple round-robin scan engine.

fireLinksChanged

  `public void fireLinksChanged()`

  Fire the links changed event on this component by marking the link event bit for each watch's bitmask.

fireTreeChanged

  `public void fireTreeChanged()`

  Fire a tree changed event on this component by marking the tree event bit for each watch's bitmask.

getBool

  `public native bool getBool(Slot slot)`

  Get a bool property using reflection.

getBuf

  `public native Buf getBuf(Slot slot)`

  Get a Buf property using reflection.

getDouble

  `public native double getDouble(Slot slot)`

  Get a double property using reflection.

getFloat

  `public native float getFloat(Slot slot)`

  Get a float property using reflection.

getInt

  `public native int getInt(Slot slot)`

  Get an integer (byte, short, or int) property using reflection.

getLong

  `public native long getLong(Slot slot)`

  Get a long property using reflection.

invokeAction

  `public void invokeAction(InStream in, Slot slot)`

  Decode a value from the input stream and invoke for the specified action.

invokeBool

  `public native void invokeBool(Slot slot, bool arg)`

  Invoke an action which takes a boolean argument.

invokeBuf

  `public native void invokeBuf(Slot slot, Buf arg)`

  Invoke an action which takes a Buf argument.

invokeDouble

  `public native void invokeDouble(Slot slot, double arg)`

  Invoke an action which takes a double argument.

invokeFloat

  `public native void invokeFloat(Slot slot, float arg)`

  Invoke an action which takes a float argument.

invokeInt

  `public native void invokeInt(Slot slot, int arg)`

  Invoke an action which takes an int argument.

invokeLong

  `public native void invokeLong(Slot slot, long arg)`

  Invoke an action which takes a long argument.

invokeVoid

  `public native void invokeVoid(Slot slot)`

  Invoke an action which takes no arguments.

linkEvent

  `public virtual int linkEvent(int eType, Link link)`

  Called on a component when a link event occurs. Only called if app is running.

  Defined event types are:

  REMOVED - link has been removed from the component.

        Should always return 0

  ADDED - link has been added to the component.

        Should always return 0.

  Future event types may make use of return code.

loadAppComp

  `public int loadAppComp(InStream in)`

  Load the component's configuration from a binary format input stream - see saveAppComp() for format. We assume component id and type id have already been read. Return 0 on success or non-zero on error.

loadProp

  `public void loadProp(InStream in, Slot slot)`

  Decode a value from the input stream and set for the specified property.

loadProps

  `public void loadProps(InStream in, int filter)`

  Load the property values to the output stream. Filter:

        0   = all
        'c' = config only
        'r' = runtime only

loaded

  `public virtual void loaded()`

  Callback when component is loaded into an app. This occurs before the start phase. Only called if app is running.

lookupByName

  `public Component lookupByName(Str name)`

  Lookup a child by name or return null.

parentEvent

  `public virtual int parentEvent(int eType, Component parent)`

  Called on a child when a parent event occurs. Only called if app is running.

  Defined event types are:

  REMOVED - notification that child has been removed/unparented.

        Should always return 0.  Called after stop() on child.

  ADDED - notification this child has been parented.

        Should always return 0.  Called prior to loaded() / start() on child.

  Future event types may make use of return code.

path

  `public Component[] path()`

  Get the path of this component from the root App. The end of the path is denoted by null. The list is a shared static buffer. Return null on error or if not mounted under an Sys.app.

saveAppComp

  `public void saveAppComp(OutStream out)`

  Save the component's application information in binary format to the output stream:

        appComp
        {
          u2      id
          u1      kitId
          u1      typeId
          str     name
          u2      parent
          u2      children
          u2      nextSibling
          val[]   configProps
          u1      ';' end marker
        }

saveProp

  `public void saveProp(OutStream out, Slot prop)`

  Save a property value to the output stream.

saveProps

  `public void saveProps(OutStream out, int filter)`

  Save the property values to the output stream. Filter:

        0   = all
        'c' = config only
        'r' = runtime only

setBool

  `public void setBool(Slot slot, bool val)`

  Set a bool property using reflection.

setDouble

  `public void setDouble(Slot slot, double val)`

  Set a double property using reflection.

setFloat

  `public void setFloat(Slot slot, float val)`

  Set a float property using reflection.

setInt

  `public void setInt(Slot slot, int val)`

  Set an integer (byte, short, or int) property using reflection.

setLong

  `public void setLong(Slot slot, long val)`

  Set a long property using reflection.

setToDefault

  `public virtual void setToDefault(Slot slot)`

  Set property to a default value. Called when a link is removed from an input slot.

start

  `public virtual void start()`

  Callback when component is first started in an app. This occurs only after all components have had their loaded callback invoked. Only called if app is running

stop

  `public virtual void stop()`

  Callback when component is first stopped in an app. Only called if app is running.