|
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.TreeExComboBox
public class TreeExComboBox
TreeComboBox
is just like a normal JComboBox which you can choose a value from a drop-down tree.
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 Object |
_object
|
protected TreeModel |
_treeModel
|
protected int |
maximumRowCount
This protected field is implementation specific. |
protected TreeCellRenderer |
renderer
This protected field is implementation specific. |
static String |
TREE_MODEL_PROPERTY
|
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, 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 | |
---|---|
TreeExComboBox()
|
|
TreeExComboBox(Hashtable<?,?> objects)
Creates a new TreeComboBox . |
|
TreeExComboBox(Object[] objects)
Creates a new TreeComboBox . |
|
TreeExComboBox(TreeModel model)
Creates a new TreeComboBox . |
|
TreeExComboBox(TreeNode root)
Creates a new TreeComboBox . |
|
TreeExComboBox(TreeNode root,
boolean asksAllowsChildren)
Creates a new TreeComboBox . |
|
TreeExComboBox(Vector<?> objects)
Creates a new TreeComboBox . |
Method Summary | |
---|---|
String |
convertElementToString(Object object)
Converts the element from object to string so that i can display in the text field of TreeComboBox. |
PopupPanel |
createPopupComponent()
Subclass should implement this method to create the actual popup component. |
protected JTree |
createTree(TreeModel model)
Creates the tree. |
protected TreeChooserPanel |
createTreeChooserPanel(TreeModel model)
Creates the TreeChooserPanel. |
TreeCellRenderer |
getCellRenderer()
Returns the renderer used to display the selected item in the JComboBox field. |
protected JComponent |
getDelegateTarget(PopupPanel panel)
|
int |
getMaximumRowCount()
Returns the maximum number of items the combo box can display without a scrollbar. |
JTree |
getTree()
Gets the underlying JTree. |
TreeModel |
getTreeModel()
Gets the tree model that will be used by the tree in the popup. |
protected void |
initComboBox()
|
boolean |
isDoubleClickExpand()
Get the flag indicating if the mouse double click would expand the tree path instead of just select it. |
boolean |
isSearchUserObjectToSelect()
Gets the flag indicating if TreeExComboBox will search all its tree path's userObject to make the selection if the selected object is set to a non-TreePath value. |
protected boolean |
isValidSelection(TreePath path)
Checks if a given tree path is a valid selection for combobox. |
protected List<TreePath> |
populateTreePaths(JTree tree)
|
void |
setCellRenderer(TreeCellRenderer aRenderer)
Sets the renderer that paints the list items and the item selected from the list in the JComboBox field. |
void |
setDoubleClickExpand(boolean doubleClickExpand)
Set the flag indicating if the mouse double click would expand the tree path instead of just select it. |
void |
setMaximumRowCount(int count)
Sets the maximum number of rows the JComboBox displays. |
void |
setPopupVisible(boolean v)
|
void |
setSearchUserObjectToSelect(boolean searchUserObjectToSelect)
Sets the flag indicating if TreeExComboBox will search all its tree path's userObject to make the selection if the selected object is set to a non-TreePath value. |
void |
setTreeModel(TreeModel treeModel)
Sets the tree model that will be used by the tree in the popup. |
protected void |
setupTree(JTree tree)
Setups the JTree for the tree used in the popup panel. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected TreeCellRenderer renderer
getCellRenderer()
,
setCellRenderer(javax.swing.tree.TreeCellRenderer)
protected int maximumRowCount
getMaximumRowCount()
,
setMaximumRowCount(int)
protected Object _object
protected TreeModel _treeModel
public static final String TREE_MODEL_PROPERTY
Constructor Detail |
---|
public TreeExComboBox()
public TreeExComboBox(Object[] objects)
TreeComboBox
.
objects
- the objectspublic TreeExComboBox(Vector<?> objects)
TreeComboBox
.
objects
- the objectspublic TreeExComboBox(Hashtable<?,?> objects)
TreeComboBox
.
objects
- the objectspublic TreeExComboBox(TreeNode root)
TreeComboBox
.
root
- the root nodepublic TreeExComboBox(TreeNode root, boolean asksAllowsChildren)
TreeComboBox
.
root
- the root nodeasksAllowsChildren
- the flag indicating if allows childrenpublic TreeExComboBox(TreeModel model)
TreeComboBox
.
model
- the tree modelMethod Detail |
---|
protected void initComboBox()
initComboBox
in class ExComboBox
protected List<TreePath> populateTreePaths(JTree tree)
public PopupPanel createPopupComponent()
ExComboBox
createPopupComponent
in class ExComboBox
protected TreeChooserPanel createTreeChooserPanel(TreeModel model)
TreeChooserPanel panel = new TreeChooserPanel(object) {
protected void setupTree(final JTree tree) {
super.setupTree(tree);
tree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() {
public void valueChanged(TreeSelectionEvent e) {
if (e.getPath() != null && !Boolean.TRUE.equals(tree.getClientProperty(PopupPanel.SELECTED_BY_MOUSE_ROLLOVER)))
{
if (isValidSelection(e.getPath())) {
setSelectedObject(item, false);
getEditor().setItem(e.getPath());
getEditor().selectAll();
}
}
}
});
TreeComboBox.this.setupTree(tree);
}
protected boolean isValidSelection(TreePath path) {
return TreeComboBox.this.isValidSelection(path);
}
};
model
- the tree model
protected JTree createTree(TreeModel model)
model
- the tree model.
protected void setupTree(JTree tree)
tree
- the JTree instancepublic void setMaximumRowCount(int count)
JComboBox
displays. If the number of objects in the model is
greater than count, the combo box uses a scrollbar.
setMaximumRowCount
in class JComboBox
count
- an integer specifying the maximum number of items to display in the list before using a scrollbar
description: The maximum number of rows the popup should havepublic int getMaximumRowCount()
getMaximumRowCount
in class JComboBox
public void setCellRenderer(TreeCellRenderer aRenderer)
aRenderer.getListCellRendererComponent
is called, passing the list
object and an index of -1.
aRenderer
- the ListCellRenderer
that displays the selected item expert: true description: The
renderer that paints the item selected in the list.JComboBox.setEditor(javax.swing.ComboBoxEditor)
public TreeCellRenderer getCellRenderer()
JComboBox
field.
ListCellRenderer
that displays the selected item.public JTree getTree()
createTreeChooserPanel(javax.swing.tree.TreeModel)
method and create your own TreeChooserPanel and JTree.
If you want to programmatically set selected row on the JTree, you can use this method. However do not keep the
returned value and use it later because combobox may create a new JTree if the popup is volatile.
Please note, this method will show the popup automatically if the combobox itself is showing (isShowing returns
true). Otherwise, it could return null if the popup was never shown before.
public void setPopupVisible(boolean v)
setPopupVisible
in class JComboBox
protected JComponent getDelegateTarget(PopupPanel panel)
getDelegateTarget
in class ExComboBox
public String convertElementToString(Object object)
convertElementToString
in class ExComboBox
object
- the object
protected boolean isValidSelection(TreePath path)
path
- the tree path
public TreeModel getTreeModel()
public void setTreeModel(TreeModel treeModel)
treeModel
- the tree modelpublic boolean isDoubleClickExpand()
public void setDoubleClickExpand(boolean doubleClickExpand)
doubleClickExpand
- the flagisDoubleClickExpand()
public boolean isSearchUserObjectToSelect()
setSearchUserObjectToSelect(boolean)
public void setSearchUserObjectToSelect(boolean searchUserObjectToSelect)
searchUserObjectToSelect
- the flag
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |