Pools class (Swimlane)

Pools(oSurfaceView)

new Pools(oSurfaceView)

The Pools object holds a collection of Pool objects, each representing a pool in the control. A pool is a container for elements and links and can be divided into horizontal lanes and vertical phases. The control can have multiple pools, and each pool can contain zero or more lanes and phases. The Pools class provides methods to manage pools, including adding, removing, and retrieving them. You can use OnCreate(oPoolOpts) to customize a new pool created via drag-and-drop, and OnCreateLane(oLaneOpts) or OnCreatePhase(oPhaseOpts) to customize newly created lanes or phases. The Pools class is accessible through the control's Pools property. For example, oSwimlane.Pools.Add() creates and adds a new pool, while oSwimlane.Pools.Item(0) retrieves the first pool.
Parameters:
Name Type Description
oSurfaceView SV Indicates an object of exontrol.Surface.SV type.

Members

(readonly) Count :number

The Count property gets the number of pools in the collection. The Add(), Remove(), and Clear() methods automatically update this count. The Item property retrieves a pool by its index, key, or reference and can be used to check if a pool exists. For example, oSwimlane.Pools.Item("Pool1") returns null if no pool with the key "Pool1" exists, or the pool object if it does.
Type:
  • number
Example
The following sample code displays the number of pools within the control:

 oSwimlane.Pools.GetCount() {number}, gets the number of pools within the control
 oSwimlane.Pools.Count {number}, gets the number of pools within the control

where oSwimlane is an object of Swimlane type
Count

Methods

Add(oPoolOptsopt) → {Pool}

The Add() method creates and adds a new pool to the control. A pool is a container for elements and links and can be divided into horizontal lanes and vertical phases. The method accepts a PoolOptions object to specify the new pool's options. A user can create a pool via drag-and-drop, in which case the control calls the OnCreate(pPoolOpts) method to allow customizing the pool's options. Alternatively, a pool can be created programmatically by calling Add() and passing a PoolOptions object.
Parameters:
Name Type Attributes Description
oPoolOpts PoolOptions <optional>
Specifies the options to create the new pool as an object of PoolOptions type.
Returns:
Returns the newly created pool, as an object of Pool type
Type
Pool
Example
oSwimlane.Pools.Add({client: [0,0,256,128], headers: "left[size=48][shape=Button],top[size=24]", lanes: "Lane 1,Lane 2", phases: "Phase 1,Phase 2"}), creates and adds a new pool with specified client area, headers, lanes and phases.
Add

Clear()

The Clear() method removes all pools of the control. Deleting a pool does not delete its elements from the control. The Pool.Objects property gets the pool and all objects it contains, including elements and inner-pools. The Swimlane.Clear() method clears the pools, elements and the links. The Pool.Visible property shows or hides the pool. The Pool.Remove method is an alias for Pools.Remove(). The Clear() method removes all pools from the control and initializes the control's scroll-bars. The Count property returns the number of pools in the collection. The Item property retrieves a pool by its index, key, or reference, and can also be used to check if a pool exists. For example, oSwimlane.Pools.Item("Pool1") returns null if no pool with the key "Pool1" exists, or the pool object if it does.
Example
The following sample code removes all pools from the control:

 oSwimlane.Pools.Clear();

The following sample code removes all objects of all pools including the pools themselves:

 oSwimlane.feP(function(oPool)
 {
  oPool.Objects.forEach(function(oObject)
  {
    oObject.Remove();
  })
 })
Clear

Item(id) → {Pool}

The Item() method gets the pool giving its index, identifier/key or reference. The Count property returns the number of pools in the collection. The Add(), Remove(), and Clear() methods automatically update this count. The Item property retrieves a pool by its index, key, or reference and can be used to check if a pool exists. For example, oSwimlane.Pools.Item("Pool1") returns null if no pool with the key "Pool1" exists, or the pool object if it does. The Item() method is equivalent with the Swimlane.Pool() method.
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the pool to request
  • id {string}, specifies a string expression that defines the identifier/key/plain-caption of the pool to request
  • id {Pool}, specifies the object reference to the pool to request for
Returns:
Returns null if the pool is not found, or an object of Pool type, if the pools collection contains the giving id.
Type
Pool
Example
The following statements are equivalent:

 oSwimlane.Pool(0) {Pool}, gets the first pool of the control
 oSwimlane.Pools.Item(0) {Pool}, gets the first pool of the control

where oSwimlane is an object of Swimlane type
Item

Load(value)

The Load() method loads the control's pools from a string representation. The Spools property uses Load() and Save() to serialize and deserialize the control's pools. Similarly, Elements.Load() and Elements.Save() provide serialization and deserialization for the control's elements, while Links.Load() and Links.Save() handle serialization and deserialization of the control's links.
Parameters:
Name Type Description
value string Indicates a string to load pools from.

The format of the property is (everything between () refers to children, and everything between [] refers to flags):

"pool1[flag=value]...[flag=value](sub-pool1[flag=value]...[flag=value],...,sub-pooln[flag=value]...[flag=value]),...,pooln[flag=value]...[flag=value](sub-pool1[flag=value]...[flag=value],...,sub-pooln[flag=value]...[flag=value])"
The pool1, sub-pool1 ... pooln defines the caption for each pool. The string representation supports the following flags:
  • [key] {string}, specifies the pool's key (Key/GetKey()/SetKey(value) methods of exontrol.Swimlane.Pool). For instance, [key=pool], specifies that the pool's key is "pool"
  • [vis]/[hid] {number}, shows or hides the pool (Visible/GetVisible()/SetVisible(value) methods of exontrol.Swimlane.Pool). For instance, [hid] or [vis=0], hides the pool, while [vis=1] shows the pool
  • [dis] {number}, enables or disables the pool (Enabled/GetEnabled()/SetEnabled(value) methods of exontrol.Swimlane.Pool). For instance, [dis] or [dis=0], disables the pool, while [dis=1] enables the pool
  • [pos] {number}, changes the pool's position (0-based) (Position/GetPosition()/SetPosition(value) methods of exontrol.Swimlane.Pool). For instance, [pos=0] indicates that the pool should be displayed first
  • [client] {string}, specifies the pool's client-rectangle as a string of "x,y,width,height" type (without quotes) (Client/GetClient()/SetClient(value) methods of exontrol.Swimlane.Pool). For instance, [client=0,0,128,128] specifies the pool's client are to [0,0,128,128]
  • [shape] {string}, defines the shape for individual pool (Shape/GetShape()/SetShape(value) methods of exontrol.Swimlane.Pool). For instance, [shape=Button] specifies that the pool is shown as a "button".
  • [cursor] {string}, defines the mouse-cursor for individual pool (Cursor/GetCursor()/SetCursor(value) methods of exontrol.Swimlane.Pool). For instance, [cursor=wait] indicates that the "wait" mouse-cursor is displayed while the cursor hovers the pool
  • [headers] {string}, defines the headers of the pool (Headers/GetHeaders()/SetHeaders(value) methods of exontrol.Swimlane.Pool). The format of the headers is:
    [headers=type[flag=value]...[flag=value],...,type[flag=value]...[flag=value]]
    where:
    • "type", defines the type of the header, which can be any of the following:
      • "left", defines the pool's header anchored to the left-side
      • "top", defines the pool's header anchored to the top-side
      • "right", defines the pool's header anchored to the right-side
      • "bottom", defines the pool's header anchored to the right-side
    • "flag", defines the property of the header such as:
      • [size=value], defines the size of the header, where value is a numeric value. If 0 or negative, the header is not shown
      • [shape=value], defines the shape of the header.
    For instance: [headers=left,top[size=24][shape=Button]], shows the pool's left-header with size 0, and top-header of the pool with specified size and shape.
  • [exclhead]/[inclhead] {number}, indicates whether the pool's lanes and phases excludes or includes the pool's headers (ExcludeHeaders/GetExcludeHeaders()/SetExcludeHeaders(value) methods of exontrol.Swimlane.Pool). For instance, [inclhead] or [exclhead=0], indicates that the pool's lanes and phases includes the pool's headers, while [exclhead=1] excludes the pool's headers from lanes and phases.
  • [lanes] {string}, defines the lanes of the pool (the lanes goes vertically from top to bottom side of the pool) (Lanes/GetLanes()/SetLanes(value) methods of exontrol.Swimlane.Pool). The format of lanes field is:
    "caption[flag=value]...[flag=value],...,caption[flag=value]...[flag=value]"
    where:
    • "caption", defines the lane's ex-HTML caption (shown into the pool's header)
    • "flag", defines a property of the lane such as:
      • [size=value], defines the size of the lane (in percent), where value is a numeric value. 0 or negative value hides the lane
      • [shape=value], defines the shape of the lane.
    For instance: [lanes=Lane 1[size=20],Lane 2,Lane 3,Lane 4[shape=FrameSel]], displays four-lanes where Lane 1 takes 20% from the pool, while the rest of lanes shares equaly the available space on the pool. The Lane 4 displays the FrameSel shape.
  • [phases] {string}, defines the phases of the pool (the phases goes horizontally from left to right side of the pool) (Phases/GetPhases()/SetPhases(value) methods of exontrol.Swimphase.Pool). The format of phases field is:
    "caption[flag=value]...[flag=value],...,caption[flag=value]...[flag=value]"
    where:
    • "caption", defines the phase's ex-HTML caption (shown into the pool's header)
    • "flag", defines a property of the phase such as:
      • [size=value], defines the size of the phase (in percent), where value is a numeric value. 0 or negative value hides the phase
      • [shape=value], defines the shape of the phase.
    For instance: [phases=Phase 1[size=20],Phase 2,Phase 3,Phase 4[shape=FrameSel]], displays four-phases where Phase 1 takes 20% from the pool, while the rest of phases shares equaly the available space on the pool. The Phase 4 displays the FrameSel shape.
Example
oSwimlane.Pools.Load("Pool 1[key=pool1][vis=0],Pool 2[client=0,0,256,128][key=pool2][dis=1][pos=0][headers=left[size=58],top[size=24]][lanes=Lane 1,Lane 2][phases=Phase 1,Phase 2]"), loads two pools with specified options
Load

OnCreate(oPoolOpts) → {boolean}

The OnCreate() method customizes the options for the newly created pool by drag. The oPoolOpts parameter is an object of PoolOptions type that contains the options to create the new pool. You can set any of the PoolOptions attributes within the OnCreate(oPoolOpts) method to customize the new pool's options. For instance, you can set oPoolOpts.shape = "FrameSel" to assign a new shape for the newly created pool.

The available options are:

  • visible {boolean}, indicates whether the pool is visible or hidden
  • enabled {boolean}, indicates whether the pool is enabled or disabled(unselectable)
  • key {string}, specifies the key associated with the pool
  • shape {any}, defines the shape for individual pool
  • cursor {string}, defines the mouse-cursor for individual pool
  • client {array}, defines the pool's client area as an array of [x,y,width,height] type
  • headers {string}, defines the pool's headers
  • excludeHeaders {boolean}, indicates whether pool's lanes and phases are not shown over the pool's headers
  • lanes {string}, defines the pool's lanes (the lanes goes vertically from top to bottom side of the pool)
  • phases {string}, defines the phases of the pool (the phases goes horizontally from left to right side of the pool)
Parameters:
Name Type Description
oPoolOpts PoolOptions Specifies the options to create the new pool as an object of PoolOptions type. The oPoolOpts contains "client" field, that defines the pool's client area as an array of [x,y,width,height] type.
Returns:
Returns false to create the pool, or true to prevent creating a new pool
Type
boolean
Example
The following sample code assigns new lanes, phases, headers and client area for the newly created pool by drag:

 oSwimlane.Pools.OnCreate = function(oPoolOpts)
 {
   oPoolOpts.lanes = "1,2,3"
   oPoolOpts.phases = "A,B";
   oPoolOpts.headers = "left[size=24],top[size=24]";
   return false; // false -&gt;continue, true -&gt; cancel
 }

where oSwimlane is an object of Swimlane type
OnCreate

OnCreateLane(oLaneOpts) → {boolean}

The OnCreateLane() method allows you to customize the options for a lane created by drag-and-drop. The oLaneOpts parameter is a LaneOptions object containing the new lane's settings. You can modify any LaneOptions attribute within the method. For example, oLaneOpts.caption = "New Lane" to set a caption. Users can create a lane by dragging the ... button at the bottom of the lanes header, which is usually positioned on the left side of the pool.

The available options are:

  • pool {Pool}, indicates the owner pool of the lane (read-only)
  • caption {string}, defines the caption of the lane
  • size {number}, indicates the size of the lane or null if the [size] flag is missing
  • shape {string}, specifies the shape to be applied on the lane
  • index {number}, specifies the index of the lane (read-only)
  • lanes {object}, defines the pool's lanes (read-only)
Parameters:
Name Type Description
oLaneOpts LaneOptions Indicates an object that specifies options for the pool's lane such as caption and shape.
Properties
Name Type Description
pool Pool indicates the owner pool as an object of Pool type (read-only).
caption string defines the ex-HTML caption of the lane.
size number indicates the size of the lane or null if the [size] flag is missing.
shape string specifies the shape to be applied on the lane as one of the following:
  • {null}, no custom-shape is applied
  • the shape's name within the exontrol.Shapes.Swimlane or exontrol.Shapes namespace
  • a CSS color
  • a JSON string-representation of an object of exontrol.Def.Shape type
  • an object of {normal,hover,click,disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.Shape type
index number specifies the index of the lane (read-only).
lanes PoolSplitter defines the pool's lanes (read-only).
Returns:
Returns false to create the lane, or true to prevent creating a new lane
Type
boolean
Example
The following sample code assigns a new shape for the newly created lane by drag:

 oSwimlane.Pools.OnCreateLane = function(oLaneOpts)
 {
   oLaneOpts.shape = 
   {
     fillColor: "rgba(0,255,0,0.25)",
     frameColor: "rgb(0,128,0)",
     pattern: exontrol.PatternEnum.exPatternBDiagonal,
     patternColor: "lightgray"
   }
   return false; // false -&gt;continue, true -&gt; cancel
 }

where oSwimlane is an object of Swimlane type
OnCreateLane

OnCreatePhase(oPhaseOpts) → {boolean}

The OnCreatePhase() method customizes the options for the newly created phase by drag. The oPhaseOpts parameter is an object of PhaseOptions type that contains the options to create the new phase. You can set any of the PhaseOptions attributes within the OnCreatePhase(oPhaseOpts) method to customize the new phase's options. For instance, you can set oPhaseOpts.caption = "New Phase" to assign a new caption for the newly created phase. Users can create a phase by dragging the ... button at the right of the phases header, which is usually positioned on the top side of the pool.

The available options are:

  • pool {Pool}, indicates the owner pool of the phase (read-only)
  • caption {string}, defines the caption of the phase
  • size {number}, indicates the size of the phase or null if the [size] flag is missing
  • shape {string}, specifies the shape to be applied on the phase
  • index {number}, specifies the index of the phase (read-only)
  • phases {object}, defines the pool's phases (read-only)
Parameters:
Name Type Description
oPhaseOpts PhaseOptions Indicates an object that specifies options for the pool's phase such as caption and shape.
Properties
Name Type Description
pool Pool indicates the owner pool as an object of Pool type (read-only).
caption string defines the ex-HTML caption of the phase.
size number indicates the size of the phase or null if the [size] flag is missing.
shape string specifies the shape to be applied on the phase as one of the following:
  • {null}, no custom-shape is applied
  • the shape's name within the exontrol.Shapes.Swimlane or exontrol.Shapes namespace
  • a CSS color
  • a JSON string-representation of an object of exontrol.Def.Shape type
  • an object of {normal,hover,click,disabled} type. The normal, hover, click and disabled are objects of exontrol.Def.Shape type
index number specifies the index of the phase (read-only).
phases PoolSplitters defines the pool's phases (read-only).
Returns:
Returns false to create the phase, or true to prevent creating a new phase
Type
boolean
Example
The following sample code assigns a new shape for the newly created phase by drag:

 oSwimlane.Pools.OnCreatePhase = function(oPhaseOpts)
 {
   oPhaseOpts.shape = 
   {
     fillColor: "rgba(0,0,255,0.25)",
     frameColor: "rgb(0,0,128)",
     pattern: exontrol.PatternEnum.exPatternF2Diagonal,
     patternColor: "lightgray"
   }
   return false; // false -&gt;continue, true -&gt; cancel
 }

where oSwimlane is an object of Swimlane type
OnCreatePhase

Remove(id)

The Remove() method removes a pool from the collection, but it does not remove the pool's elements from the control. The Pool.Visible property shows or hides the pool. The Pool.Remove method is an alias for Pools.Remove(). The RemoveRange() method removes multiple pools at once. The Clear() method removes all pools from the control and initializes the control's scroll-bars. The Count property returns the number of pools in the collection. The Item property retrieves a pool by its index, key, or reference, and can also be used to check if a pool exists. The Pool.Objects property gets the pool and all objects it contains, including elements and inner-pools. For example, oSwimlane.Pools.Item("Pool1") returns null if no pool with the key "Pool1" exists, or the pool object if it does.
Parameters:
Name Type Description
id any The id parameter could be any of the following:
  • id {number}, indicates a numeric value that defines the index of the pool to request
  • id {string}, specifies a string expression that defines the identifier/key/plain-caption of the pool to request
  • id {Pool}, specifies the object reference to the pool to request for
Example
The following statements are equivalent:

 oSwimlane.Pools.Remove(0), removes the first pool from the collection
 oSwimlane.Pool(0).Remove(), removes the first pool from the collection

The following sample code removes all objects of the first pool including the pool itself:

 oSwimlane.Pool(0).Objects.forEach(function(oObject)
 {
   oObject.Remove();
 })   

where oSwimlane is an object of Swimlane type
Remove

RemoveRange(range)

The RemoveRange() method removes multiple-pools at once. Deleting a pool does not delete its elements from the control. The Pool.Visible property shows or hides the pool. The Pool.Remove method is an alias for Pools.Remove(). The Pool.Objects property gets the pool and all objects it contains, including elements and inner-pools. The Clear() method removes all pools from the control and initializes the control's scroll-bars. The Count property returns the number of pools in the collection. The Item property retrieves a pool by its index, key, or reference, and can also be used to check if a pool exists. For example, oSwimlane.Pools.Item("Pool1") returns null if no pool with the key "Pool1" exists, or the pool object if it does.
Parameters:
Name Type Description
range Pool | Array.<Pool> Indicates an object of Pool type, an array [Pool] type, or exontrol.Arr.
Example
The following sample removes the first and second pools from the collection:

 oSwmilane.Pools.RemoveRange([oSwimlane.Pool(0), oSwimlane.Pool(1)]);

The following sample removes all objects of the first and second pools including the pools themselves:

 [oSwimlane.Pool(0), oSwimlane.Pool(1)].forEach(function(oPool)
 {
   oPool.Objects.forEach(function(oObject)
   {
     oObject.Remove();
   })
 })

where oSwimlane is an object of Swimlane type
RemoveRange

Save() → {string}

The Save() method saves the control's pools to a string representation. The Spools property uses Load() and Save() to serialize and deserialize the control's pools. Similarly, Elements.Load() and Elements.Save() provide serialization and deserialization for the control's elements, while Links.Load() and Links.Save() handle serialization and deserialization of the control's links.
Returns:
Returns the control's pool into a string representation.

The format of the property is (everything between () refers to children, and everything between [] refers to flags):

"pool1[flag=value]...[flag=value](sub-pool1[flag=value]...[flag=value],...,sub-pooln[flag=value]...[flag=value]),...,pooln[flag=value]...[flag=value](sub-pool1[flag=value]...[flag=value],...,sub-pooln[flag=value]...[flag=value])"
The pool1, sub-pool1 ... pooln defines the caption for each pool. The string representation supports the following flags:
  • [key] {string}, specifies the pool's key (Key/GetKey()/SetKey(value) methods of exontrol.Swimlane.Pool). For instance, [key=pool], specifies that the pool's key is "pool"
  • [vis]/[hid] {number}, shows or hides the pool (Visible/GetVisible()/SetVisible(value) methods of exontrol.Swimlane.Pool). For instance, [hid] or [vis=0], hides the pool, while [vis=1] shows the pool
  • [dis] {number}, enables or disables the pool (Enabled/GetEnabled()/SetEnabled(value) methods of exontrol.Swimlane.Pool). For instance, [dis] or [dis=0], disables the pool, while [dis=1] enables the pool
  • [pos] {number}, changes the pool's position (0-based) (Position/GetPosition()/SetPosition(value) methods of exontrol.Swimlane.Pool). For instance, [pos=0] indicates that the pool should be displayed first
  • [client] {string}, specifies the pool's client-rectangle as a string of "x,y,width,height" type (without quotes) (Client/GetClient()/SetClient(value) methods of exontrol.Swimlane.Pool). For instance, [client=0,0,128,128] specifies the pool's client are to [0,0,128,128]
  • [shape] {string}, defines the shape for individual pool (Shape/GetShape()/SetShape(value) methods of exontrol.Swimlane.Pool). For instance, [shape=Button] specifies that the pool is shown as a "button".
  • [cursor] {string}, defines the mouse-cursor for individual pool (Cursor/GetCursor()/SetCursor(value) methods of exontrol.Swimlane.Pool). For instance, [cursor=wait] indicates that the "wait" mouse-cursor is displayed while the cursor hovers the pool
  • [headers] {string}, defines the headers of the pool (Headers/GetHeaders()/SetHeaders(value) methods of exontrol.Swimlane.Pool). The format of the headers is:
    [headers=type[flag=value]...[flag=value],...,type[flag=value]...[flag=value]]
    where:
    • "type", defines the type of the header, which can be any of the following:
      • "left", defines the pool's header anchored to the left-side
      • "top", defines the pool's header anchored to the top-side
      • "right", defines the pool's header anchored to the right-side
      • "bottom", defines the pool's header anchored to the right-side
    • "flag", defines the property of the header such as:
      • [size=value], defines the size of the header, where value is a numeric value. If 0 or negative, the header is not shown
      • [shape=value], defines the shape of the header.
    For instance: [headers=left,top[size=24][shape=Button]], shows the pool's left-header with size 0, and top-header of the pool with specified size and shape.
  • [exclhead]/[inclhead] {number}, indicates whether the pool's lanes and phases excludes or includes the pool's headers (ExcludeHeaders/GetExcludeHeaders()/SetExcludeHeaders(value) methods of exontrol.Swimlane.Pool). For instance, [inclhead] or [exclhead=0], indicates that the pool's lanes and phases includes the pool's headers, while [exclhead=1] excludes the pool's headers from lanes and phases.
  • [lanes] {string}, defines the lanes of the pool (the lanes goes vertically from top to bottom side of the pool) (Lanes/GetLanes()/SetLanes(value) methods of exontrol.Swimlane.Pool). The format of lanes field is:
    "caption[flag=value]...[flag=value],...,caption[flag=value]...[flag=value]"
    where:
    • "caption", defines the lane's ex-HTML caption (shown into the pool's header)
    • "flag", defines a property of the lane such as:
      • [size=value], defines the size of the lane (in percent), where value is a numeric value. 0 or negative value hides the lane
      • [shape=value], defines the shape of the lane.
    For instance: [lanes=Lane 1[size=20],Lane 2,Lane 3,Lane 4[shape=FrameSel]], displays four-lanes where Lane 1 takes 20% from the pool, while the rest of lanes shares equaly the available space on the pool. The Lane 4 displays the FrameSel shape.
  • [phases] {string}, defines the phases of the pool (the phases goes horizontally from left to right side of the pool) (Phases/GetPhases()/SetPhases(value) methods of exontrol.Swimphase.Pool). The format of phases field is:
    "caption[flag=value]...[flag=value],...,caption[flag=value]...[flag=value]"
    where:
    • "caption", defines the phase's ex-HTML caption (shown into the pool's header)
    • "flag", defines a property of the phase such as:
      • [size=value], defines the size of the phase (in percent), where value is a numeric value. 0 or negative value hides the phase
      • [shape=value], defines the shape of the phase.
    For instance: [phases=Phase 1[size=20],Phase 2,Phase 3,Phase 4[shape=FrameSel]], displays four-phases where Phase 1 takes 20% from the pool, while the rest of phases shares equaly the available space on the pool. The Phase 4 displays the FrameSel shape.
Type
string
Example
The following statements are equivalent:

 var s = oSwimlane.Spools, saves the control's pools into a string representation
 var s = oSwimlane.Pools.Save(), saves the control's pools into a string representation

where oSwimlane is an object of Swimlane type
Save