|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ilog.webui.dhtml.IlxWContainer ilog.webui.dhtml.IlxWComponent ilog.webui.dhtml.components.IlxWLabelWrapper ilog.webui.dhtml.components.IlxWComboBox
public class IlxWComboBox
A combo box component.
The combo box component relies on a model, instance of
javax.swing.ComboBoxModel
. It may be rendered in several
modes, determined by the value of the "mode
" CSS style.
Possible values for the mode
style are:
system
: renders the combo box as a <select> HTML
element. This mode is not supported if the combo box has a renderer
or an editor. In this case, the component tries to render itself
in the "arrow
" mode.link
: renders the combo box as a hyperlink which, once
clicked pops up a menu just under the link. If the combo box has an
editor, this mode is not supported, and the component tries to
render itself in "arrow" mode. The combo box may also not support this mode
with some Web browsers (Netscape 3 & Netscape 4.7 for instance). In this
case, the component tries render itself in the "linkdialog
"
mode.arrow
: renders the combo box as Swing combo box:
the current renderer or the current editor is displayed, and an arrow
button is displayed to the right. A click on the arrow button pops up
a menu with the possible items. The combo box may not support this mode
with some Web browsers (Netscape 3 & Netscape 4.7 for instance). In this
case, the component tries render itself in the "arrowdialog
"
mode.linkdialog
: Same as the link
mode but
a dialog box is popped up displaying the available items, instead of a
drop down list.arrowdialog
: Same as the arrow
mode but
a dialog box is popped up displaying the available items, instead of a
drop down list.system
mode.
To set the current mode, you can either write a CSS style sheet:
ComboBox { mode: arrow; }... or dynamically set the style on the object:
myComboBox.getStyle().set("mode", "arrow");
Nested Class Summary |
---|
Nested classes/interfaces inherited from class ilog.webui.dhtml.IlxWComponent |
---|
IlxWComponent.DynamicStyleMap |
Field Summary | |
---|---|
static String |
ACTION_PROPERTY
The action bound property name. |
protected String |
actionCommand
|
static String |
EDITABLE_PROPERTY
The editable bound property name. |
protected IlxWComboBoxEditor |
editor
|
static String |
EDITOR_PROPERTY
The editor bound property name. |
static String |
ENABLED_PROPERTY
The enabled bound property name. |
protected boolean |
isEditable
|
protected ComboBoxModel |
model
|
static String |
MODEL_PROPERTY
The model bound property name. |
protected IlxWListCellRenderer |
renderer
|
static String |
RENDERER_PROPERTY
The renderer bound property name. |
protected ilog.webui.dhtml.components.IlxWComboBox.ComboBoxUI |
ui
Access to allow another UI to the combo box (JSF) |
Fields inherited from class ilog.webui.dhtml.components.IlxWLabelWrapper |
---|
cssDescriptor, label |
Fields inherited from class ilog.webui.dhtml.IlxWContainer |
---|
listenerList |
Constructor Summary | |
---|---|
IlxWComboBox()
Creates an IlxWComboBox with a default data model. |
|
IlxWComboBox(ComboBoxModel aModel)
Creates an IlxWComboBox that takes its items from an existing
ComboBoxModel. |
|
IlxWComboBox(Object[] items)
Creates an IlxWComboBox that contains the elements in the specified array. |
|
IlxWComboBox(Vector items)
Creates an IlxWComboBox that contains the elements in the specified Vector. |
Method Summary | |
---|---|
void |
actionPerformed(ActionEvent e)
|
void |
addActionListener(ActionListener l)
Adds an action listener. |
void |
addItemListener(ItemListener listener)
Adds an item listener. |
void |
configureEditor(IlxWComboBoxEditor anEditor,
Object anItem)
Initializes the editor with the specified item. |
void |
contentsChanged(ListDataEvent e)
|
protected void |
fireActionEvent()
Notify all listeners that have registered interest for notification on this event type. |
protected void |
fireItemStateChanged(ItemEvent e)
Notify all listeners that have registered interest for notification on this event type. |
IlxWAction |
getAction()
Gets the action that will be called when the user selects an item in the combo box. |
String |
getActionCommand()
Returns the action command that is included in the event sent to action listeners. |
ActionListener[] |
getActionListeners()
|
IlxWComboBoxEditor |
getEditor()
Returns the editor used to render and edit the selected item in the IlxWComboBox field. |
Object |
getItemAt(int index)
Returns the list item at the specified index. |
int |
getItemCount()
Returns the number of items in the list. |
ItemListener[] |
getItemListeners()
|
ComboBoxModel |
getModel()
Returns the data model currently used by the IlxWComboBox . |
String |
getOnChangeJSAction()
|
IlxWListCellRenderer |
getRenderer()
Returns the renderer used to display the selected item in the IlxWComboBox field. |
int |
getSelectedIndex()
Returns the index of the currently selected item in the list. |
Object |
getSelectedItem()
Returns the currently selected item. |
Object[] |
getSelectedObjects()
Returns an array containing the selected item. |
protected ilog.webui.dhtml.components.IlxWComboBox.ComboBoxUI |
getUI()
|
protected ilog.webui.dhtml.components.IlxWComboBox.ComboBoxUI |
getUI(IlxWPort port)
|
protected IlxWCSSRuleset |
getUserAgentRules()
Gets the "user-agent" CSS rules. |
void |
intervalAdded(ListDataEvent e)
|
void |
intervalRemoved(ListDataEvent e)
|
boolean |
isEditable()
Returns True if the IlxWComboBox is editable. |
boolean |
isEnabled()
Determines whether this component is enabled. |
void |
notifyDependencies(IlxWPort port)
|
protected void |
printComponent(IlxWPort port)
Prints the HTML code that will display the graphical representation of this component. |
void |
removeActionListener(ActionListener l)
Removes an action listener. |
void |
removeItemListener(ItemListener listener)
Removes an item listener. |
protected void |
selectedItemChanged()
This method is called when the selected item changes. |
void |
setAction(IlxWAction action)
Sets the action that will be called when the user selects an item in the combo box. |
void |
setActionCommand(String aCommand)
Sets the action command that should be included in the event sent to action listeners. |
void |
setEditable(boolean aFlag)
Determines whether the IlxWComboBox field is editable. |
void |
setEditor(IlxWComboBoxEditor editor)
Sets the editor used to paint and edit the selected item in the IlxWComboBox field. |
void |
setEnabled(boolean b)
Enables the combo box so that items can be selected. |
void |
setModel(ComboBoxModel model)
Sets the data model that the IlxWComboBox uses to obtain the list of
items. |
void |
setOnChangeJSAction(String onChangeAction)
|
void |
setRenderer(IlxWListCellRenderer renderer)
Sets the renderer that paints the item selected from the list in the IlxWComboBox field. |
void |
setSelectedIndex(int index)
Selects the item at index anIndex . |
void |
setSelectedItem(Object anObject)
Sets the selected item in the IlxWComboBox by specifying the object in
the list. |
void |
update(Element elt)
|
Methods inherited from class ilog.webui.dhtml.components.IlxWLabelWrapper |
---|
getCSSModel, getIconPath, getIcoPath, getLabel, getText, setIconPath, setText |
Methods inherited from class ilog.webui.dhtml.IlxWComponent |
---|
addPropertyChangeListener, addPropertyChangeListener, detach, doPrint, firePropertyChange, firePropertyChange, getName, getRealHtmlTagName, getStyle, invalidate, isInvalidated, print, removePropertyChangeListener, removePropertyChangeListener, setName, validate |
Methods inherited from class ilog.webui.dhtml.IlxWContainer |
---|
add, add, getAttribute, getAttributeNames, getComponent, getComponentCount, getComponentNamed, getComponents, getManager, getParent, indexOf, isAncestorOf, remove, remove, removeAll, removeAttribute, setAttribute, setAuthorRules, setFinalizer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String MODEL_PROPERTY
public static final String EDITOR_PROPERTY
public static final String EDITABLE_PROPERTY
public static final String ENABLED_PROPERTY
public static final String ACTION_PROPERTY
public static final String RENDERER_PROPERTY
protected ComboBoxModel model
protected IlxWListCellRenderer renderer
protected IlxWComboBoxEditor editor
protected boolean isEditable
protected String actionCommand
protected ilog.webui.dhtml.components.IlxWComboBox.ComboBoxUI ui
Constructor Detail |
---|
public IlxWComboBox(ComboBoxModel aModel)
IlxWComboBox
that takes its items from an existing
ComboBoxModel.
aModel
- The ComboBoxModel that provides the displayed list of
items.public IlxWComboBox(Object[] items)
IlxWComboBox
that contains the elements in the specified array.
public IlxWComboBox(Vector items)
IlxWComboBox
that contains the elements in the specified Vector.
public IlxWComboBox()
IlxWComboBox
with a default data model.
Use addItem
to add items.
Method Detail |
---|
public void setModel(ComboBoxModel model)
IlxWComboBox
uses to obtain the list of
items.
model
- The combo box model that provides the displayed list of items.public ComboBoxModel getModel()
IlxWComboBox
.
public void setEditable(boolean aFlag)
IlxWComboBox
field is editable.
An editable IlxWComboBox
allows the user to type into the field or select an item
from the list to initialize the field, after which it can be edited.
A non editable IlxWComboBox
displays the selected item in the field, but
the selection cannot be modified.
aFlag
- A boolean value, where true indicates that the field is
editable.public boolean isEditable()
IlxWComboBox
is editable.
true
if the combo box can be edited; false
otherwise.public void setRenderer(IlxWListCellRenderer renderer)
IlxWComboBox
field.
The renderer is used if the IlxWComboBox
is not
editable, otherwise the editor is used to render and edit the selected item.
The default renderer displays a string, obtained
by calling the selected object's toString
method.
Other renderers can handle graphic images and composite items.
To display the selected item,
aRenderer.getListCellRendererComponent
is called, passing
the list object and an index of -1.
renderer
- The ListCellRenderer
that displays the selected item.setEditor(ilog.webui.dhtml.components.IlxWComboBoxEditor)
public IlxWListCellRenderer getRenderer()
IlxWComboBox
field.
public void setEditor(IlxWComboBoxEditor editor)
IlxWComboBox
field.
The editor is used only if the receiving IlxWComboBox
is editable.
If not editable, the combo box uses the renderer to render the selected
item.
editor
- The IlxWComboBoxEditor
that displays the selected item.setRenderer(ilog.webui.dhtml.components.IlxWListCellRenderer)
public IlxWComboBoxEditor getEditor()
IlxWComboBox
field.
public void configureEditor(IlxWComboBoxEditor anEditor, Object anItem)
anEditor
- The IlxWComboBoxEditor
that displays the list item in the
combo box field and allows it to be edited.anItem
- The object to display and edit in the field.public void setSelectedItem(Object anObject)
IlxWComboBox
by specifying the object in
the list.
If anObject
is in the list, the list displays with
anObject
selected. If the object does not exist in the list,
the default data model selects the first item in the list.
anObject
- The list object to select.public Object getSelectedItem()
public void setSelectedIndex(int index)
anIndex
.
index
- An int specifying the list item to select,
where 0 specifies the first item in the list.public int getSelectedIndex()
The result is not always defined if the IlxWComboBox
box allows
selected items that are not in the list.
Returns -1 if there is no selected item or if the user specified an item
which is not in the list.
public void addItemListener(ItemListener listener)
aListener
will receive an event when
the selected item changes.
addItemListener
in interface ItemSelectable
listener
- The item listener that is to be notified.public void removeItemListener(ItemListener listener)
removeItemListener
in interface ItemSelectable
listener
- The item listener to remove.public void addActionListener(ActionListener l)
The listener will receive an action event the user finishes making a selection.
l
- The action listener that is to be notified.public void removeActionListener(ActionListener l)
l
- The action listener to remove.public void setActionCommand(String aCommand)
aCommand
- A string containing the "command" that is sent
to action listeners. The same listener can then
do different things depending on the command it receives.public String getActionCommand()
protected void fireItemStateChanged(ItemEvent e)
EventListenerList
public ItemListener[] getItemListeners()
protected void fireActionEvent()
public ActionListener[] getActionListeners()
protected void selectedItemChanged()
Its default implementation notifies the item listeners.
public Object[] getSelectedObjects()
getSelectedObjects
in interface ItemSelectable
public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
protected ilog.webui.dhtml.components.IlxWComboBox.ComboBoxUI getUI(IlxWPort port)
port
- The current port.
protected ilog.webui.dhtml.components.IlxWComboBox.ComboBoxUI getUI()
public void intervalAdded(ListDataEvent e)
intervalAdded
in interface ListDataListener
public void intervalRemoved(ListDataEvent e)
intervalRemoved
in interface ListDataListener
public void contentsChanged(ListDataEvent e)
contentsChanged
in interface ListDataListener
public void setEnabled(boolean b)
When the combo box is disabled, items cannot be selected and values cannot be typed into its field (if it is editable).
b
- A boolean value, where true enables the component and
false disables it.public boolean isEnabled()
true
if this component is enabled.setEnabled(boolean)
public int getItemCount()
public Object getItemAt(int index)
index
- An int indicating the list position, where the first
item starts at zero.
public IlxWAction getAction()
By default, this action is a Java action (IlxWJavaAction
)
of which the perform
method calls
setSelectedItem
on the combo box.
If the given action is a Java action (IlxWJavaAction
),
the argument array passed to the perform
method is a 1-length array containing the selected item.
If the given action is a JS action (IlxWJSAction
),
the argument array passed when calling the associated function
is a 1-length array containing the string representation
of the selected item.
setAction(ilog.webui.dhtml.components.IlxWAction)
public void setAction(IlxWAction action)
action
- The action to perform when the user selects an item from the
list.getAction()
public void setOnChangeJSAction(String onChangeAction)
public String getOnChangeJSAction()
public void update(Element elt)
protected void printComponent(IlxWPort port) throws IOException
IlxWComponent
IlxWComponent.print(ilog.webui.dhtml.IlxWPort)
method.
printComponent
in class ilog.webui.dhtml.components.IlxWLabelWrapper
IOException
port
- The port on which the component will be printed.IlxWComponent.print(ilog.webui.dhtml.IlxWPort)
protected IlxWCSSRuleset getUserAgentRules()
IlxWContainer
setAuthorRules
method.
This method returns null
by default but is intended
to be redefined by subclasses.
getUserAgentRules
in class IlxWContainer
IlxWContainer.setAuthorRules(ilog.webui.dhtml.IlxWCSSRuleset)
public void notifyDependencies(IlxWPort port)
notifyDependencies
in interface ilog.webui.dhtml.IlxWDependencyProvider
notifyDependencies
in class IlxWComponent
|
Decision Center API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |