|
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 javax.swing.JComboBox com.jidesoft.combobox.ExComboBox com.jidesoft.combobox.TableExComboBox
public class TableExComboBox
TableComboBox
is just like a normal JComboBox which you can choose a value from a drop down table.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jidesoft.combobox.ExComboBox |
---|
ExComboBox.LazyDelegateAction |
Nested classes/interfaces inherited from class javax.swing.JComboBox |
---|
JComboBox.AccessibleJComboBox, JComboBox.KeySelectionManager |
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 |
_maximumRowCount
This protected field is implementation specific. |
Fields inherited from class com.jidesoft.combobox.ExComboBox |
---|
CLIENT_PROPERTY_HIDE_POPUP_ON_LIST_DATA_CHANGED, CLIENT_PROPERTY_POPUP_PANEL, CLIENT_PROPERTY_TABLE_CELL_EDITOR, CLIENT_PROPERTY_TABLE_CELL_RENDERER, COMMIT, COMMIT_OR_RESET, COMMIT_OR_REVERT, DIALOG, DOWN_KEY_BEHAVIOR_SELECT_NEXT, DOWN_KEY_BEHAVIOR_SHOW_POPUP, DROPDOWN, PERSIST, PROPERTY_BUTTON_VISIBLE, PROPERTY_SELECTED_ITEM, RESET, REVERT |
Fields inherited from class javax.swing.JComboBox |
---|
actionCommand, dataModel, editor, isEditable, keySelectionManager, lightWeightPopupEnabled, maximumRowCount, renderer, 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 | |
---|---|
TableExComboBox()
Creates a new TableComboBox . |
|
TableExComboBox(TableModel model)
Creates a new TableComboBox . |
|
TableExComboBox(TableModel model,
Class<?> clazz)
Creates a new TableComboBox . |
|
TableExComboBox(TableModel model,
Class<?> clazz,
int type)
Creates a new TableComboBox . |
|
TableExComboBox(TableModel model,
int type)
Creates a new TableComboBox . |
Method Summary | |
---|---|
void |
addItem(Object anObject)
Adds an item to the item table. |
PopupPanel |
createPopupComponent()
Subclass should implement this method to create the actual popup component. |
protected JTable |
createTable(TableModel model)
Creates the table. |
protected TableChooserPanel |
createTableChooserPanel(TableModel dataModel,
Class<?> clazz)
Creates the TableChooserPanel. |
void |
customizePopup(JidePopup popup,
PopupPanel panel)
Customizes the popup and the popup panel before actually showing them. |
List<KeyStroke> |
getDelegateKeyStrokes()
Overrides its super method to remove LEFT/RIGHT/HOME/END key. |
protected JComponent |
getDelegateTarget(PopupPanel panel)
|
int |
getMaximumRowCount()
Returns the maximum number of items the combo box can display without a scroll bar. |
int |
getSelectedIndex()
Returns the first item in the table that matches the given item. |
JTable |
getTable()
Gets the underlying JTable. |
TableModel |
getTableModel()
Gets the table model used by the table in the popup panel. |
int |
getValueColumnIndex()
Returns the value column index. |
void |
insertItemAt(Object anObject,
int index)
Inserts an item into the item table at a given index. |
boolean |
isToggleValueOnDoubleClick()
Checks if double click on the editor part will toggle the value. |
void |
removeAllItems()
Removes all items from the item table. |
void |
removeItem(Object anObject)
Removes an item from the item table. |
void |
removeItemAt(int anIndex)
Removes the item at anIndex This method works only if the TableComboBox uses a mutable
data model. |
boolean |
selectWithKeyChar(char keyChar)
|
void |
setMaximumRowCount(int count)
Sets the maximum number of rows the JComboBox displays. |
void |
setPopupType(int popupType)
Sets the popup type. |
void |
setSelectedIndex(int anIndex)
Selects the item at index anIndex . |
void |
setTableModel(TableModel tableModel)
Sets the table model used by the table in the popup panel. |
void |
setToggleValueOnDoubleClick(boolean toggleValueOnDoubleClick)
Sets the flag whether the value will be toggled when double clicking on the editor part. |
protected void |
setupTable(JTable table)
Configure the table that is created using createTable(javax.swing.table.TableModel) . |
void |
setValueColumnIndex(int valueColumnIndex)
Sets the value column index. |
void |
toggleValue(Component editorComponent,
int direction)
|
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)
Constructor Detail |
---|
public TableExComboBox()
TableComboBox
.
public TableExComboBox(TableModel model)
TableComboBox
.
model
- the table model.public TableExComboBox(TableModel model, Class<?> clazz)
TableComboBox
.
model
- the table model.clazz
- the type of the item set on the combobox.public TableExComboBox(TableModel model, int type)
TableComboBox
.
model
- the table model.type
- the type. It could be DROPDOWN or DIALOG as defined in AbstractComboBox.public TableExComboBox(TableModel model, Class<?> clazz, int type)
TableComboBox
.
model
- the table model.clazz
- the type of the item set on the combobox.type
- the type. It could be DROPDOWN or DIALOG as defined in AbstractComboBox.Method Detail |
---|
public void customizePopup(JidePopup popup, PopupPanel panel)
ExComboBox
customizePopup
in class ExComboBox
popup
- the JidePopuppanel
- the popup panelpublic PopupPanel createPopupComponent()
ExComboBox
createPopupComponent
in class ExComboBox
public void setPopupType(int popupType)
ExComboBox
setPopupType
in class ExComboBox
popupType
- the new popup type.public boolean selectWithKeyChar(char keyChar)
selectWithKeyChar
in class ExComboBox
public List<KeyStroke> getDelegateKeyStrokes()
getDelegateKeyStrokes
in class ExComboBox
protected JTable createTable(TableModel model)
model
- the table model.
protected void setupTable(JTable table)
createTable(javax.swing.table.TableModel)
. We had code to
setup the table to the way we want. You can subclass it and do future setup but make sure you call
super.setupTable(table) first.
table
- the table.protected TableChooserPanel createTableChooserPanel(TableModel dataModel, Class<?> clazz)
dataModel
- the data model.clazz
- the class.
public void setMaximumRowCount(int count)
JComboBox
displays. If the number of objects in the model is
greater than count, the combo box uses a scroll bar.
setMaximumRowCount
in class JComboBox
count
- an integer specifying the maximum number of items to display in the table before using a scroll bar
preferred: true description: The maximum number of rows the popup should havepublic int getMaximumRowCount()
getMaximumRowCount
in class JComboBox
public void setSelectedIndex(int anIndex)
anIndex
.
setSelectedIndex
in class JComboBox
anIndex
- an integer specifying the table item to select, where 0 specifies the first item in the table 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 table. Returns -1 if there is no selected item
or if the user specified an item which is not in the table.
getSelectedIndex
in class JComboBox
public JTable getTable()
createTableChooserPanel(javax.swing.table.TableModel,
Class)
method and create your own TableChooserPanel and JTable.
If you want to programmatically set selected index on the table, you can use this method. However do not keep the
returned value and use it later because combobox may create a new JTable if the popup is volatile.
Please note, this method will show the popup automatically. Otherwise, the JTable is not even created.
public void addItem(Object anObject)
TableComboBox
uses a mutable data
model.
Warning: Focus and keyboard navigation problems may arise if you add duplicate String objects. A
workaround is to add new objects instead of String objects and make sure that the toString() method is defined.
For example:
comboBox.addItem(makeObj("Item 1")); comboBox.addItem(makeObj("Item 1")); ... private Object makeObj(final String item) { return new Object() { public String toString() { return item; } }; }
addItem
in class JComboBox
anObject
- the Object to add to the tableMutableComboBoxModel
public void insertItemAt(Object anObject, int index)
TableComboBox
uses a mutable data model.
insertItemAt
in class JComboBox
anObject
- the Object
to add to the tableindex
- an integer specifying the position at which to add the itemMutableComboBoxModel
public void removeItem(Object anObject)
TableComboBox
uses a mutable data
model.
removeItem
in class JComboBox
anObject
- the object to remove from the item tableMutableComboBoxModel
public void removeItemAt(int anIndex)
anIndex
This method works only if the TableComboBox
uses a mutable
data model.
removeItemAt
in class JComboBox
anIndex
- an int specifying the index of the item to remove, where 0 indicates the first item in the tableMutableComboBoxModel
public void removeAllItems()
removeAllItems
in class JComboBox
public void setValueColumnIndex(int valueColumnIndex)
valueColumnIndex
- the new value column index.public int getValueColumnIndex()
public TableModel getTableModel()
public void setTableModel(TableModel tableModel)
tableModel
- the table modelprotected JComponent getDelegateTarget(PopupPanel panel)
getDelegateTarget
in class ExComboBox
public boolean isToggleValueOnDoubleClick()
public void setToggleValueOnDoubleClick(boolean toggleValueOnDoubleClick)
toggleValueOnDoubleClick
- the flagpublic void toggleValue(Component editorComponent, int direction)
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |