|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.jidesoft.combobox.AbstractComboBox com.jidesoft.combobox.MultiSelectListComboBox
public class MultiSelectListComboBox
MultiSelectListComboBox
is ComboBox which you can choose a value from a drop-down JList which allows
multiple selections.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
protected int |
_selectionMode
|
protected int |
maximumRowCount
This protected field is implementation specific. |
static String |
PROPERTY_SELECTION_MODE
|
Fields inherited from class com.jidesoft.combobox.AbstractComboBox |
---|
_dialog, _editable, _editor, _listDataListener, _oldSelectedItemReminder, _popupButton, _popupPanel, _renderer, actionCommand, CLIENT_PROPERTY_HIDE_POPUP_ON_LIST_DATA_CHANGED, CLIENT_PROPERTY_TABLE_CELL_EDITOR, CLIENT_PROPERTY_TABLE_CELL_RENDERER, COMMIT, COMMIT_OR_RESET, COMMIT_OR_REVERT, dataModel, DIALOG, DROPDOWN, HIDE_POPUP_KEY, PERSIST, PROPERTY_SELECTED_ITEM, RESET, REVERT, selectedItemReminder |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
MultiSelectListComboBox()
|
|
MultiSelectListComboBox(ComboBoxModel model)
Creates a new MultiSelectListComboBox . |
|
MultiSelectListComboBox(ComboBoxModel model,
Class<?> clazz)
Creates a new MultiSelectListComboBox . |
|
MultiSelectListComboBox(Object[] objects)
Creates a new MultiSelectListComboBox . |
|
MultiSelectListComboBox(Object[] objects,
Class<?> clazz)
Creates a new MultiSelectListComboBox . |
|
MultiSelectListComboBox(Vector<?> objects)
Creates a new MultiSelectListComboBox . |
|
MultiSelectListComboBox(Vector<?> objects,
Class<?> clazz)
Creates a new MultiSelectListComboBox . |
Method Summary | |
---|---|
Object |
convertArrayType(Object anObject)
Converts an array from any component type to the type that can accepted by this combobox. |
AbstractComboBox.EditorComponent |
createEditorComponent()
Subclass should implement this method to create the actual editor component. |
protected MultiSelectListChooserPanel |
createListChooserPanel(ComboBoxModel dataModel,
Class<?> clazz,
ConverterContext converterContext)
Creates the MultiSelectListChooserPanel. |
PopupPanel |
createPopupComponent()
Subclass should implement this method to create the actual popup component. |
protected JComponent |
getDelegateTarget()
|
JList |
getList()
Gets the underlying JList. |
int |
getMaximumRowCount()
Returns the maximum number of items the combo box can display without a scrollbar. |
int |
getSelectedIndex()
Returns the first item in the list that matches the given item. |
int[] |
getSelectedIndices()
Returns an array of indices where each integer is the index of the item in the list |
Object |
getSelectedItem()
Delegates getSelectedObjects() instead. |
Object[] |
getSelectedObjects()
Gets the selected objects. |
int |
getSelectionMode()
Returns the current selection mode. |
boolean |
isUpdateOnChange()
Checks if the editor area will be updated when the selection is changed in the drop down list. |
void |
setMaximumRowCount(int count)
Sets the maximum number of rows the JComboBox displays. |
void |
setSelectedIndex(int anIndex)
Selects the item at index anIndex . |
void |
setSelectedIndices(int[] indices)
Selects the items at the specified index array. |
void |
setSelectedItem(Object anObject,
boolean fireEvent)
Sets the selected item. |
void |
setSelectedObjects(Object[] objects)
Sets the selected objects. |
void |
setSelectionMode(int selectionMode)
Sets the selection mode. |
void |
setUpdateOnChange(boolean updateOnChange)
Sets the flag if the editor area will be updated when the selection is changed in the drop down list. |
protected void |
setupList(JList list)
Setups the JList for the tree used in the popup panel. |
protected boolean |
validateValueForNonEditable(Object value)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int maximumRowCount
getMaximumRowCount()
,
setMaximumRowCount(int)
protected int _selectionMode
public static final String PROPERTY_SELECTION_MODE
Constructor Detail |
---|
public MultiSelectListComboBox()
public MultiSelectListComboBox(Object[] objects)
MultiSelectListComboBox
.
objects
- the objectspublic MultiSelectListComboBox(Vector<?> objects)
MultiSelectListComboBox
.
objects
- the objectspublic MultiSelectListComboBox(ComboBoxModel model)
MultiSelectListComboBox
.
model
- the combo box modelpublic MultiSelectListComboBox(Object[] objects, Class<?> clazz)
MultiSelectListComboBox
.
objects
- the objectsclazz
- the class of the datapublic MultiSelectListComboBox(Vector<?> objects, Class<?> clazz)
MultiSelectListComboBox
.
objects
- the objectsclazz
- the class of the datapublic MultiSelectListComboBox(ComboBoxModel model, Class<?> clazz)
MultiSelectListComboBox
.
model
- the combo box modelclazz
- the class of the dataMethod Detail |
---|
public AbstractComboBox.EditorComponent createEditorComponent()
AbstractComboBox
createEditorComponent
in class AbstractComboBox
public PopupPanel createPopupComponent()
AbstractComboBox
createPopupComponent
in class AbstractComboBox
protected MultiSelectListChooserPanel createListChooserPanel(ComboBoxModel dataModel, Class<?> clazz, ConverterContext converterContext)
return new MultiSelectListChooserPanel(dataModel, clazz, converterContext,
getDefaultOKAction(), getDefaultCancelAction()) {
protected void setupList(final JList list) {
super.setupList(list);
MultiSelectListComboBox.this.setupList(list);
}
};
dataModel
- the combo box modelclazz
- the classconverterContext
- the converter context
public void setMaximumRowCount(int count)
JComboBox
displays. If the number of objects in the model is
greater than count, the combo box uses a scrollbar.
count
- an integer specifying the maximum number of items to display in the list before using a scrollbar
preferred: true description: The maximum number of rows the popup should havepublic int getMaximumRowCount()
public void setSelectedIndex(int anIndex)
anIndex
.
anIndex
- an integer specifying the list item to select, where 0 specifies the first item in the list and -1
indicates no selection
IllegalArgumentException
- if anIndex
< -1 or anIndex
is greater than or equal to
size description: The item at index is selected.public int getSelectedIndex()
JComboBox
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 setSelectedIndices(int[] indices)
indices
- an array of integer specifying the item to select.
IllegalArgumentException
- if the integer in the array < -1 or is greater than or equal to sizepublic int[] getSelectedIndices()
setSelectedIndices(int[])
public void setSelectedItem(Object anObject, boolean fireEvent)
setSelectedItem
in class AbstractComboBox
anObject
- the object selectedfireEvent
- the flag indicating if an event should be firedpublic Object convertArrayType(Object anObject)
anObject
- an array
public void setSelectedObjects(Object[] objects)
AbstractComboBox.setSelectedItem(Object)
as that method already supports
an array. We added this method just to make it clear if user wants to select multiple objects. People tend to
think AbstractComboBox.setSelectedItem(Object)
will only select one object.
objects
- an array of objects you want to select.public Object getSelectedItem()
getSelectedObjects()
instead.
getSelectedItem
in class AbstractComboBox
AbstractComboBox.setSelectedItem(java.lang.Object)
public Object[] getSelectedObjects()
CheckBoxListChooserPanel
, the selected object is an array
of elements that are checked in the MultiSelectListComboBox. This method will always return an array of Objects.
You can also use getSelectedItem()
method which will return an array of the type you specified in the
class parameter of the constructors such as MultiSelectListComboBox(Object[],Class)
.
getSelectedObjects
in interface ItemSelectable
getSelectedObjects
in class AbstractComboBox
setSelectedObjects(Object[])
public JList getList()
createListChooserPanel(javax.swing.ComboBoxModel,Class,com.jidesoft.converter.ConverterContext)
method and create your own CheckBoxListChooserPanel and JList.
If you want to programmatically set selected index on the list, you can use this method. However do not keep the
returned value and use it later because combobox may create a new JList if the popup is volatile.
Please note, this method will show the popup automatically. Otherwise, the JList is not even created.
protected JComponent getDelegateTarget()
getDelegateTarget
in class AbstractComboBox
protected boolean validateValueForNonEditable(Object value)
validateValueForNonEditable
in class AbstractComboBox
protected void setupList(JList list)
list
- the list used by ListChooserPanel.public void setSelectionMode(int selectionMode)
ListSelectionModel.SINGLE_SELECTION
- Only one list index can be selected at a time. In this mode, setSelectionInterval
and addSelectionInterval
are equivalent, both replacing the current selection with
the index represented by the second argument (the "lead"). ListSelectionModel.SINGLE_INTERVAL_SELECTION
- Only one contiguous interval can be selected at a time. In this mode, addSelectionInterval
behaves like
setSelectionInterval
(replacing the current selection), unless the given interval is immediately adjacent
to or overlaps the existing selection, and can therefore be used to grow it. ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
- In this mode, there's no restriction on what can be selected.
selectionMode
- the new selection mode.
IllegalArgumentException
- if the selection mode isn't one of those allowedgetSelectionMode()
public int getSelectionMode()
setSelectionMode(int)
public boolean isUpdateOnChange()
setUpdateOnChange(boolean)
public void setUpdateOnChange(boolean updateOnChange)
updateOnChange
- true or false.
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |