Class zebkit.ui.StatePan
extends <zebkit.ui.ViewPan>

State panel class. The class is UI component that allows to customize the component face, background and border depending on the component state. Number and names of states the component can have is defined by developers. To bind a view to the specified state use zebkit.draw.ViewSet class. For instance if a component has to support two states : "state1" and "state2" you can do it as following:

// create state component
var p = new zebkit.ui.StatePan();

// define border view that contains views for "state1" and "state2"
    "state1": new zebkit.draw.Border("red", 1),
    "state1": new zebkit.draw.Border("blue", 2)

// define background view that contains views for "state1" and "state2"
    "state1": "yellow",
    "state1": "green"

// set component state

State component children components can listening when the state of the component has been updated by implementing "parentStateUpdated(o,n,id)" method. It gets old state, new state and a view id that is mapped to the new state. The feature is useful if we are developing a composite components whose children component also should react to a state changing.

zebkit.ui.StatePan ( )

public void setState (s)
public void stateUpdated (o, n)
protected void syncState ( )
public <String> toViewId (s)

Inherited methods:
$setConstraints(c)    add(constr, d)    byConstraints([p], c)    byPath(path, [cb])    calcPreferredSize(t)    doLayout( )    fire(event, [path], [params])    focused( )    getBottom( )    getCanvas( )    getComponentAt(x, y)    getHorPadding( )    getLeft( )    getPreferredSize( )    getRight( )    getTop( )    getVerPadding( )    hasFocus( )    indexOf(c)    insert(i, constr, d)    invalidate( )    invalidateLayout( )    kidAdded(index, constr, l)    kidRemoved(i, l)    laidout( )    load(JSON)    off([eventName], [path], [cb])    on([eventName], [path], cb)    paintComponent(g)    paintViewAt(g, ax, ay, v)    properties([path], props)    property([path], name, value)    recalc( )    relocated(px, py)    remove(c)    removeAll( )    removeAt(i)    removeByConstraints(ctr)    removeMe([after])    repaint([x], [y], [w], [h])    requestFocus( )    requestFocusIn([timeout])    resized(pw, ph)    setAt(i, d)    setBackground(v)    setBorder([v])    setBottomPadding(bottom)    setBounds(x, y, w, h)    setByConstraints(constr, c)    setConstraints(ctr)    setEnabled(b)    setId(id)    setKids(a)    setLayout(m)    setLeftPadding(left)    setLocation(xx, yy)    setPadding(v)    setParent(o)    setPreferredSize(w, h)    setProperties([path], props)    setRightPadding(right)    setSize(w, h)    setTopPadding(top)    setView(v)    setVisible(b)    toBack( )    toFront( )    toPreferredHeight( )    toPreferredSize( )    toPreferredWidth( )    toView(target)    validate( )    validateMetric( )    vrp( )   

public chainable setState (s)

Set the component state

public void stateUpdated (o, n)

Called every time the component state has been updated

  • o <Integer>

    a previous component state

  • n <Integer>

    a new component state

protected void syncState ( )

Refresh state

public <String> toViewId (s)

Define the method if the state value has to be somehow converted to a view id. By default the state value itself is used as a view id.

  • s <Object>

    a state to be converted

Returns: <String>

a view ID

Inherited attributes:
public zebkit.draw.View bg    public zebkit.draw.View border    public Boolean canHaveFocus    public Object constraints    public Integer height    public Boolean isEnabled    public Boolean isValid    public Boolean isVisible    public Array kids    public zebkit.layout.Layout layout    public zebkit.layout.Layoutable parent    public zebkit.draw.View view    public Integer width    public Integer x    public Integer y   

public <Object> state

Current component state