SUI.control.ColorTablePicker

SUI.control.ColorTablePicker is a control that lets you select colors by pointing them out in color table. The color table needs to be provided when constructing the control.

Extends SUI.AnchorLayout
Defined in: control/ColorTablePicker.js


Constructor summary

Attr. Name / Description
public

SUI.control.ColorTablePicker(see, arg)

Create a color table picker control.

Member summary

Attr. Type Name Description
private SUI.Border

_border

The box's border.

private int

_bottom

The bottom position of the box.

private HTMLElementNode

_el

The box's element node.

private int

_height

The height of the box.

private int

_left

The left position of the box.

private int

_listeners

The listeners array.

private int

_maxHeight

The maximum height of the box.

private int

_maxWidth

The maximum width of the box.

private int

_minHeight

The minimum height of the box.

private int

_minWidth

The minimum width of the box.

private SUI.Padding

_padding

The box's padding.

private SUI.Box

_parent

The box's parent element.

private int

_right

The right position of the box.

private int

_top

The top position of the box.

private int

_width

The width of the box.

public SUI.Box[]

children

The list of children of this container.

public

COLBOX_HEIGHT

The height of the boxes in which the color an HTML color code are shown.

public

COLBOX_WIDTH

The Width of the boxes in which the color an HTML color code are shown.

public

HEIGHT

The total height of the control.

public

LABEL_LEFT

The left position of the labels.

public

LABEL_WIDTH

The width of the labels.

public

PADDING

The padding of the control.

public

ROW_HEIGHT

The row height for the rows with hue, saturation, value and color boxes.

public

WIDTH

The total width of the control.

Method summary

Attr. Type Name / Description
private

_layoutChildren()

Layout the children of the Container. Use the anchors of the children to place them on the client area of the Container.

public

absPos()

Get the absolute position (top/left) of this box on the page. Note: You can only use this function if the HTML content of the page is fully rendered.

public

add(child, parent)

Add an box to the container. Add it to the document tree and to the container's list of children.

public

addClass(cls)

Add a CSS class name to the class list of the HTML element associated with the box.

public

addListener(type, listener)

Add/register a listener function. This way it is possible to register more than one listener function on one target.

public SUI.Border

border(b)

Get or set the border definition of the box.

public int

bottom(b)

Get or set the bottom of the box.

public

callListener(type)

Call a listener function. Execute the default and additional listener functions. Note: the framework should not execute the default listeners directly but always through this method to ensure the execution of additional listener functions.

public int

clientHeight()

Get the client height of the box. The client height is the height of the box minus the top and bottom border and padding width.

public int

clientWidth()

Get the client width of the box. The client width is the width of the box minus the left and right border and padding width.

public String

colorCode(val)

Set or get the HTML color code selection of the control.

public

display()

Display the Container. Set the CSS positions of the element's box(es) and for the children of the box.

public

draw()

Draw the box on the screen. It executes a two phase process: a layout phase in which the size and positions of the box (and of it's contents, for more complex derivatives) is calculated and a display phase in which the CSS size and position of the box's (and possible it's child elements) is set.

public HTMLElementNode

el()

Get the HTML element node of the box.

public int

height(h)

Get or set the height of the box.

public

layOut()

Lay out the Container. Calculate the position of the Container and it's contents.

public int

left(l)

Get or set the left of the box.

public int

maxHeight(mh)

Get or set the maximum height of the box.

public int

maxWidth(mw)

Get or set the maximum width of the box.

public int

minHeight(mh)

Get or set the minimum height of the box.

public int

minWidth(mw)

Get or set the minimum width of the box.

public SUI.Padding

padding(p)

Get or set the padding definition of the box.

public SUI.Box

parent(p)

Get or set the parent box of the box. When setting the parent the box's element node will be appended to the parent box's HTML element node.

public

remove(child, parent)

Remove a child box.

public

removeBox()

Remove a box from the DOM tree.

public

removeClass(cls)

Remove a CSS class name from the class list of the HTML element associated with the box.

public int

right(r)

Get or set the right of the box.

public

setDim()

Set the CSS dimensions of this box and it's borders and padding. This is typically used in display functions to display boxes at the size and position that was calculated during layout.

public

setPos()

Set the CSS postion of this box. This is typically used in display functions to display boxes at position that was calculated during layout. Note: use setDim if you want to set the position and size of the box.

public

setRect(t, l, w, h)

Set the top, left, width and height of a box in one go.

public int

top(t)

Get or set the top of the box.

public int

width(w)

Get or set the width of the box.

 


Constructor

public SUI.control.ColorTablePicker(see, object arg)

Create a color table picker control.

Parameters:

Name Type Description
see base class
string[] arg.table The color table data: an array (1D) of color codes.
int arg.rows The number of rows in the color table
int arg.colums The number of columns in the color table
Function arg.onChange Listener function that is executed each time the control's color selection changes.

Members

private SUI.Border _border

The box's border.

Inherited From: SUI.AnchorLayout#_border

private int _bottom

The bottom position of the box.

Inherited From: SUI.AnchorLayout#_bottom

private HTMLElementNode _el

The box's element node.

Inherited From: SUI.AnchorLayout#_el

private int _height

The height of the box.

Inherited From: SUI.AnchorLayout#_height

private int _left

The left position of the box.

Inherited From: SUI.AnchorLayout#_left

private int _listeners

The listeners array.

Inherited From: SUI.AnchorLayout#_listeners

private int _maxHeight

The maximum height of the box.

Inherited From: SUI.AnchorLayout#_maxHeight

private int _maxWidth

The maximum width of the box.

Inherited From: SUI.AnchorLayout#_maxWidth

private int _minHeight

The minimum height of the box.

Inherited From: SUI.AnchorLayout#_minHeight

private int _minWidth

The minimum width of the box.

Inherited From: SUI.AnchorLayout#_minWidth

private SUI.Padding _padding

The box's padding.

Inherited From: SUI.AnchorLayout#_padding

private SUI.Box _parent

The box's parent element.

Inherited From: SUI.AnchorLayout#_parent

private int _right

The right position of the box.

Inherited From: SUI.AnchorLayout#_right

private int _top

The top position of the box.

Inherited From: SUI.AnchorLayout#_top

private int _width

The width of the box.

Inherited From: SUI.AnchorLayout#_width

public SUI.Box[] children

The list of children of this container.

Inherited From: SUI.AnchorLayout#children

public COLBOX_HEIGHT

The height of the boxes in which the color an HTML color code are shown.

public COLBOX_WIDTH

The Width of the boxes in which the color an HTML color code are shown.

public HEIGHT

The total height of the control.

public LABEL_LEFT

The left position of the labels.

public LABEL_WIDTH

The width of the labels.

public PADDING

The padding of the control.

public ROW_HEIGHT

The row height for the rows with hue, saturation, value and color boxes.

public WIDTH

The total width of the control.


Methods

private _layoutChildren()

Layout the children of the Container. Use the anchors of the children to place them on the client area of the Container.

Inherited From: SUI.AnchorLayout#_layoutChildren

public absPos()

Get the absolute position (top/left) of this box on the page. Note: You can only use this function if the HTML content of the page is fully rendered.

Inherited From: SUI.AnchorLayout#absPos

public add( SUI.AnchorLayout child, SUI.AnchorLayout parent)

Add an box to the container. Add it to the document tree and to the container's list of children.

Parameters:

Name Type Description
SUI.AnchorLayout child box to add
SUI.AnchorLayout parent Container to add box to (none for this)

Inherited From: SUI.AnchorLayout#add

public addClass( String cls)

Add a CSS class name to the class list of the HTML element associated with the box.

Parameters:

Name Type Description
String cls the CSS class name to add

Inherited From: SUI.AnchorLayout#addClass

public addListener( String type, Function listener)

Add/register a listener function. This way it is possible to register more than one listener function on one target.

Parameters:

Name Type Description
String type The listener type (i.e. "onClick", "onOK", etc).
Function listener The listener function.

Inherited From: SUI.AnchorLayout#addListener

public SUI.Border border( SUI.Border b)

Get or set the border definition of the box.

Parameters:

Name Type Argument Description
SUI.Border b <optional>
The new border definition (or none to use this method as a getter).

Returns:

SUI.Border the border definition of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#border

public int bottom( int b)

Get or set the bottom of the box.

Parameters:

Name Type Argument Description
int b <optional>
The new bottom of the box (or none to use this method as a getter).

Returns:

int The bottom of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#bottom

public callListener( String type)

Call a listener function. Execute the default and additional listener functions. Note: the framework should not execute the default listeners directly but always through this method to ensure the execution of additional listener functions.

Parameters:

Name Type Description
String type The listener type (i.e. "onClick", "onOK", etc).

Inherited From: SUI.AnchorLayout#callListener

public int clientHeight()

Get the client height of the box. The client height is the height of the box minus the top and bottom border and padding width.

Returns:

int The client height of the box.

Inherited From: SUI.AnchorLayout#clientHeight

public int clientWidth()

Get the client width of the box. The client width is the width of the box minus the left and right border and padding width.

Returns:

int The client width of the box.

Inherited From: SUI.AnchorLayout#clientWidth

public String colorCode( String val)

Set or get the HTML color code selection of the control.

Parameters:

Name Type Description
String val An HTML color code (#FF7700), or none to get the current color selection from the control.

Returns:

String An HTML color code (#FF7700), if no argument was given this method acts as a getter and value will be returned.

public display()

Display the Container. Set the CSS positions of the element's box(es) and for the children of the box.

Inherited From: SUI.AnchorLayout#display

public draw()

Draw the box on the screen. It executes a two phase process: a layout phase in which the size and positions of the box (and of it's contents, for more complex derivatives) is calculated and a display phase in which the CSS size and position of the box's (and possible it's child elements) is set.

Inherited From: SUI.AnchorLayout#draw

public HTMLElementNode el()

Get the HTML element node of the box.

Returns:

HTMLElementNode the HTML element node of the box.

Inherited From: SUI.AnchorLayout#el

public int height( int h)

Get or set the height of the box.

Parameters:

Name Type Argument Description
int h <optional>
The new height of the box (or none to use this method as a getter).

Returns:

int The height of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#height

public layOut()

Lay out the Container. Calculate the position of the Container and it's contents.

Inherited From: SUI.AnchorLayout#layOut

public int left( int l)

Get or set the left of the box.

Parameters:

Name Type Argument Description
int l <optional>
The new left of the box (or none to use this method as a getter).

Returns:

int The left of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#left

public int maxHeight( int mh)

Get or set the maximum height of the box.

Parameters:

Name Type Argument Description
int mh <optional>
The new maximum height of the box (or none to use this method as a getter).

Returns:

int The maximum height of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#maxHeight

public int maxWidth( int mw)

Get or set the maximum width of the box.

Parameters:

Name Type Argument Description
int mw <optional>
The new maximum width of the box (or none to use this method as a getter).

Returns:

int The maximum width of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#maxWidth

public int minHeight( int mh)

Get or set the minimum height of the box.

Parameters:

Name Type Argument Description
int mh <optional>
The new minimum height of the box (or none to use this method as a getter).

Returns:

int The minimum height of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#minHeight

public int minWidth( int mw)

Get or set the minimum width of the box.

Parameters:

Name Type Argument Description
int mw <optional>
The new minimum width of the box (or none to use this method as a getter).

Returns:

int The minimum width of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#minWidth

public SUI.Padding padding( SUI.Padding p)

Get or set the padding definition of the box.

Parameters:

Name Type Argument Description
SUI.Padding p <optional>
The new padding definition (or none to use this method as a getter).

Returns:

SUI.Padding The padding definition of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#padding

public SUI.Box parent( SUI.Box p)

Get or set the parent box of the box. When setting the parent the box's element node will be appended to the parent box's HTML element node.

Parameters:

Name Type Description
SUI.Box p The parent box for this box (or none to use this method as a getter).

Returns:

SUI.Box The parent box of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#parent

public remove( SUI.Box child, SUI.AnchorLayout parent)

Remove a child box.

Parameters:

Name Type Description
SUI.Box child a reference to the box to remove
SUI.AnchorLayout parent Container to remove box from (none for this)

Inherited From: SUI.AnchorLayout#remove

public removeBox()

Remove a box from the DOM tree.

Inherited From: SUI.AnchorLayout#removeBox

public removeClass( String cls)

Remove a CSS class name from the class list of the HTML element associated with the box.

Parameters:

Name Type Description
String cls The CSS class name to remove.

Inherited From: SUI.AnchorLayout#removeClass

public int right( int r)

Get or set the right of the box.

Parameters:

Name Type Description
int r The new right of the box (or none to use this method as a getter).

Returns:

int The right of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#right

public setDim()

Set the CSS dimensions of this box and it's borders and padding. This is typically used in display functions to display boxes at the size and position that was calculated during layout.

Inherited From: SUI.AnchorLayout#setDim

public setPos()

Set the CSS postion of this box. This is typically used in display functions to display boxes at position that was calculated during layout. Note: use setDim if you want to set the position and size of the box.

Inherited From: SUI.AnchorLayout#setPos

public setRect( int | SUI.Box t, int l, int w, int h)

Set the top, left, width and height of a box in one go.

Parameters:

Name Type Argument Description
int | SUI.Box t The new top of the box or another reference box to copy the values from.
int l <optional>
The new left of the box (if the t parameter wasn't a reference Box).
int w <optional>
The new width of the box (if the t parameter wasn't a reference Box).
int h <optional>
The new length of the box (if the t parameter wasn't a reference Box).

Inherited From: SUI.AnchorLayout#setRect

public int top( int t)

Get or set the top of the box.

Parameters:

Name Type Argument Description
int t <optional>
The new top of the box (or none to use this method as a getter).

Returns:

int The top of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#top

public int width( int w)

Get or set the width of the box.

Parameters:

Name Type Argument Description
int w <optional>
The new width of the box (or none to use this method as a getter).

Returns:

int The width of the box (or null if this method was used as a setter).

Inherited From: SUI.AnchorLayout#width