|
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.JPanel com.jidesoft.swing.JideSplitPane com.jidesoft.list.TextFieldList
public class TextFieldList
TextFieldList
is a pane that contains a JTextField on the left and a JList on the right and a bunch
of buttons. The customer can input new items in the JTextField on the left and press the transfer button to move it to the list
on the right.
isInputValid(String)
to control which kind of inputs are allowed to be transferred to the list.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jidesoft.swing.JideSplitPane |
---|
JideSplitPane.AccessibleJideSplitPane |
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
JPanel.AccessibleJPanel |
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 | |
---|---|
JComponent |
_originalFieldPane
|
protected DefaultListModelWrapper |
_selectedListModel
|
JComponent |
_selectedListPane
|
String |
CLIENT_PROPERTY_ALWAYS_DISABLED
|
static String |
COMMAND_MOVE_DOWN
|
static String |
COMMAND_MOVE_LEFT
|
static String |
COMMAND_MOVE_RIGHT
|
static String |
COMMAND_MOVE_TO_BOTTOM
|
static String |
COMMAND_MOVE_TO_TOP
|
static String |
COMMAND_MOVE_UP
|
static int |
FIELD_TRANSFERRED_CLEAR_TEXT
|
static int |
FIELD_TRANSFERRED_NO_ACTION
|
static int |
FIELD_TRANSFERRED_SELECT_ALL
|
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 | |
---|---|
TextFieldList()
Constructs a JList with an empty model. |
|
TextFieldList(DefaultListModel listModel)
Constructs a JList with a list with existing list data in the right. |
Method Summary | |
---|---|
protected void |
addButtonPanel(Container container,
Component buttonPanel)
Adds ButtonPanel to DualList. |
void |
addSelectedText(String text)
Adds the designated text to the selected list. |
protected AbstractButton |
createButton(Action action)
Creates the button. |
protected Container |
createButtonPanel()
|
protected JList |
createList(ListModel model)
Creates the right JList. |
protected JTextComponent |
createTextField()
|
protected DefaultListModelWrapper |
createWrapperListModel(DefaultListModel listModel)
Create a DefaultListModelWrapper to wrap the original list model. |
ListCellRenderer |
getCellRenderer()
Gets the list cell renderer for the left list. |
ListCellRenderer |
getDisabledCellRenderer()
Returns the disabled cell renderer. |
int |
getFieldTransferredMode()
Get the field transferred mode. |
JTextComponent |
getOriginalField()
Get the original JTextField. |
JComponent |
getOriginalFieldPane()
Gets the component containing the original JList. |
Dimension |
getPreferredSize()
|
protected String |
getResourceString(String key)
Gets the localized string from resource bundle. |
ListCellRenderer |
getSelectedCellRenderer()
Gets the list cell renderer for the right list. |
JList |
getSelectedList()
Get the selected JList. |
JComponent |
getSelectedListPane()
Gets the component containing the selected JList. |
Object[] |
getSelectedValues()
Gets the selected indices. |
String |
getStartString()
Get the default start string for the JTextField. |
int |
getVisibleRowCount()
Returns the value of the visibleRowCount from the list. |
protected void |
installKeyboardAction()
|
boolean |
isAllowDuplicates()
Get the flag if duplicate selection is allowed in the TextFieldTransferBox. |
boolean |
isButtonEnabled(String command)
Checks if the button is always disabled. |
boolean |
isButtonVisible(String command)
Checks if the button is visible. |
protected boolean |
isInputValid(String text)
Check if current input in the JTextField is valid so that the "move to right" button will be enabled. |
void |
moveDown()
Moves the selected items in the right list down by one. |
void |
moveLeft()
Moves the selected items in the right list to the left list. |
void |
moveRight()
Moves the selected items in the left list to the right list. |
void |
moveToBottom()
Moves the selected items in the right list to the bottom. |
void |
moveToTop()
Moves the selected items in the right list to the top. |
void |
moveUp()
Moves the selected items in the right list up by one. |
protected void |
performAction(String command)
Performs the action. |
void |
removeSelectedText(String text)
Removes the designated text from the selected list. |
void |
setAllowDuplicates(boolean allowDuplicates)
Set the flag if duplicate selection is allowed in the DualList. |
void |
setButtonEnabled(String command,
boolean enabled)
Sets the button to always disabled. |
void |
setButtonVisible(String command,
boolean visible)
Sets the button visible or invisible. |
void |
setCellRenderer(ListCellRenderer cellRenderer)
Sets the list cell renderer for the list on the left. |
void |
setDisabledCellRenderer(ListCellRenderer disabledCellRenderer)
Sets the disabled cell renderer. |
void |
setEnabled(boolean enabled)
|
void |
setFieldTransferredMode(int fieldTransferredMode)
Set the field transferred mode. |
void |
setSelectedCellRenderer(ListCellRenderer selectedCellRenderer)
Sets the list cell renderer for the list on the right. |
void |
setStartString(String startString)
Set the default start string for the JTextField. |
protected void |
setupList(JList list)
Customizes the JList. |
void |
setVisibleRowCount(int visibleRowCount)
Sets the visible row count in the two lists. |
void |
valueChanged(ListSelectionEvent e)
|
Methods inherited from class javax.swing.JPanel |
---|
getUI, getUIClassID, paramString, setUI |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String COMMAND_MOVE_LEFT
public static final String COMMAND_MOVE_RIGHT
public static final String COMMAND_MOVE_UP
public static final String COMMAND_MOVE_DOWN
public static final String COMMAND_MOVE_TO_TOP
public static final String COMMAND_MOVE_TO_BOTTOM
public JComponent _originalFieldPane
public JComponent _selectedListPane
public final String CLIENT_PROPERTY_ALWAYS_DISABLED
protected DefaultListModelWrapper _selectedListModel
public static final int FIELD_TRANSFERRED_NO_ACTION
public static final int FIELD_TRANSFERRED_CLEAR_TEXT
public static final int FIELD_TRANSFERRED_SELECT_ALL
Constructor Detail |
---|
public TextFieldList()
JList
with an empty model.
public TextFieldList(DefaultListModel listModel)
JList
with a list with existing list data in the right.
listModel
- the list modelMethod Detail |
---|
protected DefaultListModelWrapper createWrapperListModel(DefaultListModel listModel)
listModel
- the original list model
protected JList createList(ListModel model)
model
- the list model
protected void setupList(JList list)
list
- the selected JList.protected JTextComponent createTextField()
public JTextComponent getOriginalField()
public JList getSelectedList()
public JComponent getOriginalFieldPane()
public JComponent getSelectedListPane()
protected void addButtonPanel(Container container, Component buttonPanel)
container
- the container between the two JLists.buttonPanel
- the button panelpublic Dimension getPreferredSize()
getPreferredSize
in class JComponent
protected Container createButtonPanel()
public void valueChanged(ListSelectionEvent e)
valueChanged
in interface ListSelectionListener
protected AbstractButton createButton(Action action)
protected AbstractButton createButton(Action action) {
AbstractButton button = new JideButton(action);
action.addPropertyChangeListener(new PropertyChangeListener() {
public void propertyChange(PropertyChangeEvent evt) {
if ("disabledIcon".equals(evt.getPropertyName())) {
button.setDisabledIcon((Icon) action.getValue("disabledIcon"));
}
}
});
button.setName("" + action.getValue(Action.ACTION_COMMAND_KEY));
button.setDisabledIcon((Icon) action.getValue("disabledIcon"));
button.setRequestFocusEnabled(false);
return button;
}
action
- the action for the button.
public void setEnabled(boolean enabled)
setEnabled
in class JComponent
protected boolean isInputValid(String text)
text
- the input text
public Object[] getSelectedValues()
DualListModel.getSelectedIndices()
protected void installKeyboardAction()
public void setButtonVisible(String command, boolean visible)
command
- the name defined in DualList. They are constants starting with "COMMAND_" such as
COMMAND_MOVE_LEFT.visible
- true to show the button and false to hide.public boolean isButtonVisible(String command)
command
- the name defined in DualList. They are constants starting with "COMMAND_" such as
COMMAND_MOVE_LEFT.
public void setButtonEnabled(String command, boolean enabled)
command
- the name defined in DualList. They are constants starting with "COMMAND_" such as
COMMAND_MOVE_LEFT.enabled
- false to always disable the button.public boolean isButtonEnabled(String command)
command
- the name defined in DualList. They are constants starting with "COMMAND_" such as
COMMAND_MOVE_LEFT.
public ListCellRenderer getCellRenderer()
public void setCellRenderer(ListCellRenderer cellRenderer)
setSelectedCellRenderer(javax.swing.ListCellRenderer)
is never called, the same renderer will be used for the list on the right too.
cellRenderer
- the new list cell rendererpublic ListCellRenderer getSelectedCellRenderer()
getCellRenderer()
.
public void setSelectedCellRenderer(ListCellRenderer selectedCellRenderer)
selectedCellRenderer
- the new list cell rendererpublic ListCellRenderer getDisabledCellRenderer()
public void setDisabledCellRenderer(ListCellRenderer disabledCellRenderer)
disabledCellRenderer
- the new disabled cell renderer.public void removeSelectedText(String text)
text
- the designated textpublic void addSelectedText(String text)
text
- the designated textpublic void moveLeft()
public void moveRight()
public void moveUp()
public void moveDown()
public void moveToTop()
public void moveToBottom()
public void setVisibleRowCount(int visibleRowCount)
visibleRowCount
- an integer specifying the preferred number of rows to display without requiring scrollingpublic int getVisibleRowCount()
visibleRowCount
from the list.
visibleRowCount
property.setVisibleRowCount(int)
public int getFieldTransferredMode()
setFieldTransferredMode(int)
public void setFieldTransferredMode(int fieldTransferredMode)
fieldTransferredMode
- the field transferred modegetStartString()
public String getStartString()
setStartString(String)
public void setStartString(String startString)
startString
- the default start string.protected String getResourceString(String key)
key
- the key
protected void performAction(String command)
command
- the commandpublic boolean isAllowDuplicates()
setAllowDuplicates(boolean)
public void setAllowDuplicates(boolean allowDuplicates)
allowDuplicates
- the flag
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |