|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.barracudamvc.core.comp.AbstractBComponent
org.barracudamvc.core.comp.BComponent
org.barracudamvc.core.comp.BList
org.barracudamvc.core.comp.BSelect
public class BSelect
A BSelect element is used to render a list of items, and to indicate which element(s) are selected. It is typically used to manipulate <select> elements.
In most cases you will not actually need to bind the component to a view in order to use it--if you return it from a model, this will be done for you automatically. If however, you intend to use the component standalone (ie. manually attaching it to a specific node in the DOM) or inline (ie. in a toString()), then you MUST BIND IT TO A VIEW before rendering, or an error will be generated.
Field Summary | |
---|---|
protected BAction |
baction
|
protected boolean |
disableBackButton
|
protected List |
listeners
|
protected static org.apache.log4j.Logger |
logger
|
protected org.barracudamvc.core.comp.BSelect.LocalModelListener |
scallback
|
protected ListSelectionModel |
selectionModel
|
protected Integer |
viewSize
|
Fields inherited from class org.barracudamvc.core.comp.BList |
---|
model |
Fields inherited from class org.barracudamvc.core.comp.BComponent |
---|
DEFAULT_ENCODING, enabled, enc, name, rs, VISIBILITY_MARKER, visible |
Fields inherited from class org.barracudamvc.core.comp.AbstractBComponent |
---|
attrs, children, dvc, isStepChild, parent, statemap, stepChildren, tempViews, validated, views |
Constructor Summary | |
---|---|
BSelect()
Public noargs constructor |
|
BSelect(ListModel imodel)
Public constructor which creates the component and associates it with a ListModel |
Method Summary | |
---|---|
BSelect |
addEventListener(ListenerFactory lf)
Add an event listener to this component. |
BSelect |
addEventListener(ListenerFactory lf,
boolean idisableBackButton)
Add an event listener to this component. |
void |
destroyCycle()
Destroy cycle. |
BAction |
getAction()
Returns the action associated with this component (if any) |
int |
getSelectedIndex()
Convenience method to get the selected index (if the component allows multiple selections, this will return the index of the first selected item). |
int[] |
getSelectedIndexes()
Convenience method to return an int array containing all selected indexes. |
ListSelectionModel |
getSelectionModel()
Get the selection model that backs the list |
Integer |
getViewSize()
Get the size of the component. |
protected void |
preRender(ViewContext vc,
int depth)
Here in the pre-render phase we actually add BAction step children for any of the listeners that might have been added to this component |
BSelect |
removeEventListener(ListenerFactory lf)
Remove an event listener from this component |
BSelect |
setAction(BAction ibaction)
Specify an action for this component (rather than adding an even listener) |
BSelect |
setSelectedIndex(int i)
Convenience method to set the selected index. |
BSelect |
setSelectionModel(ListSelectionModel imodel)
Set the selection model that backs the list. |
BSelect |
setViewSize(Integer iviewSize)
Set the view size of the component (heighth in rows). |
Methods inherited from class org.barracudamvc.core.comp.BList |
---|
getModel, setListData, setListData, setModel |
Methods inherited from class org.barracudamvc.core.comp.BComponent |
---|
addView, decodeStr, encodeStr, getEncoding, getFirstView, getName, getRenderStrategy, getViews, isEnabled, isVisible, postRender, removeAllViews, removeView, render, render, renderView, renderView, setEnabled, setEnabled, setEncoding, setName, setRenderStrategy, setView, setVisible, setVisible, supports |
Methods inherited from class org.barracudamvc.core.comp.AbstractBComponent |
---|
addChild, addStepChild, addStepChild, addTempView, clearState, findComponentMap, findRendererFactory, getAttr, getAttrMap, getChild, getChildren, getDefaultViewContext, getParent, getRenderer, getRenderer, getRendererFactory, getRootComponent, getState, getStateKeys, getStateStore, hasChildren, hasViews, initCycle, installRendererFactory, invalidate, isStepChild, printStackTrace, printStackTrace, printStackTrace, putState, removeAll, removeAllStepChildren, removeChild, removeChild, removeState, setAttr, setDefaultViewContext, setParent, toRef, toString, toString, validate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.log4j.Logger logger
protected ListSelectionModel selectionModel
protected org.barracudamvc.core.comp.BSelect.LocalModelListener scallback
protected List listeners
protected Integer viewSize
protected boolean disableBackButton
protected BAction baction
Constructor Detail |
---|
public BSelect()
public BSelect(ListModel imodel)
imodel
- the specific model to back this componentMethod Detail |
---|
public BSelect setSelectionModel(ListSelectionModel imodel)
imodel
- the model that backs the listpublic ListSelectionModel getSelectionModel()
public int getSelectedIndex()
public BSelect setSelectedIndex(int i)
i
- the index to be selectedpublic int[] getSelectedIndexes()
public BSelect setViewSize(Integer iviewSize)
iviewSize
- an integer value representing the size.public Integer getViewSize()
public BSelect setAction(BAction ibaction)
ibaction
- the action to be fired when the BSelect is activated on the clientpublic BAction getAction()
public BSelect addEventListener(ListenerFactory lf, boolean idisableBackButton)
lf
- the event listener to be addedidisableBackButton
- true if the back button should be
disabled when the action occurspublic BSelect addEventListener(ListenerFactory lf)
lf
- the event listener to be addedpublic BSelect removeEventListener(ListenerFactory lf)
lf
- the event listener to be removedprotected void preRender(ViewContext vc, int depth)
preRender
in class BComponent
public void destroyCycle()
destroyCycle
in class BList
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |