|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.openswing.swing.client.BaseInputControl
org.openswing.swing.client.ListControl
Title: OpenSwing Framework
Description: List input control: its items are retrieved through ClientSettings.getDomain method, that uses domainId property to identify the correct domain to use. If this control is linked to a Form, then ListSelectionModel.SINGLE_SELECTION_MODE is allowed: other selection modes are not permitted. If this control is not linked to a Form, then it is possible to select more than one item.
Copyright: Copyright (C) 2006 Mauro Carniel
This file is part of OpenSwing Framework. This library is free software; you can redistribute it and/or modify it under the terms of the (LGPL) Lesser General Public License as published by the Free Software Foundation; GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author may be contacted at: maurocarniel@tin.it
Nested Class Summary |
Nested classes inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Field Summary |
Fields inherited from class javax.swing.JComponent |
TOOL_TIP_TEXT_KEY, 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 | |
ListControl()
Contructor. |
Method Summary | |
void |
addFocusListener(java.awt.event.FocusListener l)
Adds the specified focus listener to receive focus events from this component when this component gains input focus. |
void |
addListSelectionListener(javax.swing.event.ListSelectionListener listener)
Adds a listener to the list that's notified each time a change to the selection occurs. |
void |
addMouseListener(java.awt.event.MouseListener l)
Adds the specified mouse listener to receive mouse events from this textfield. |
void |
addNotify()
|
boolean |
disableListener()
|
javax.swing.JComponent |
getBindingComponent()
|
javax.swing.JComponent |
getComponent()
|
Domain |
getDomain()
|
java.lang.String |
getDomainId()
|
int |
getFixedCellHeight()
Returns the fixed cell height value -- the value specified by setting the fixedCellHeight property,
rather than that calculated from the list elements. |
int |
getFixedCellWidth()
Returns the fixed cell width value -- the value specified by setting the fixedCellWidth property, rather than that calculated
from the list elements. |
int |
getLayoutOrientation()
Returns JList.VERTICAL if the layout is a single
column of cells, or JList.VERTICAL_WRAP if the layout
is "newspaper style" with the content flowing vertically then
horizontally or JList.HORIZONTAL_WRAP if the layout is
"newspaper style" with the content flowing horizontally then
vertically. |
int |
getRowCount()
|
int |
getSelectedIndex()
|
java.awt.Color |
getSelectionBackground()
Returns the background color for selected cells. |
java.awt.Color |
getSelectionForeground()
Returns the selection foreground color. |
int |
getSelectionMode()
Returns whether single-item or multiple-item selections are allowed. |
java.awt.ComponentOrientation |
getTextOrientation()
|
java.lang.Object |
getValue()
|
java.lang.String |
getValueAt(int index)
|
boolean |
getValueIsAdjusting()
Returns the value of the data model's isAdjusting property.
|
int |
getVisibleRowCount()
Returns the preferred number of visible rows. |
boolean |
isEnabled()
|
boolean |
isNullAsDefaultValue()
|
boolean |
isReadOnly()
|
boolean |
isShowCheckBoxes()
|
boolean |
isTranslateItemDescriptions()
|
void |
removeFocusListener(java.awt.event.FocusListener l)
Removes the specified focus listener so that it no longer receives focus events from this component. |
void |
removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
Removes a listener from the list that's notified each time a change to the selection occurs. |
void |
removeMouseListener(java.awt.event.MouseListener l)
Removes the specified mouse listener so that it no longer receives mouse events from this textfield. |
int |
search(java.lang.String textToSeach)
Method invoked by SearchWindowManager when the specified "textToSeach" pattern has not matchings in the current content of binded control. |
void |
setDomain(Domain domain)
Set the specified domain and retrieve the list items from the domain. |
void |
setDomainId(java.lang.String domainId)
Set the domain identifier, so the control can retrieve its items from the domain. |
void |
setEnabled(boolean enabled)
Set current input control abilitation. |
void |
setFixedCellHeight(int height)
Sets the height of every cell in the list. |
void |
setFixedCellWidth(int width)
Sets the width of every cell in the list. |
void |
setLayoutOrientation(int layoutOrientation)
Defines the way list cells are layed out. |
void |
setNullAsDefaultValue(boolean nullAsDefaultValue)
Define if in insert mode list has no item selected. |
void |
setSelectedIndex(int index)
Select the list item related to the specified index. |
void |
setSelectedIndices(int[] indices)
Select the list item related to the specified index. |
void |
setSelectionBackground(java.awt.Color selectionBackground)
Sets the background color for selected cells. |
void |
setSelectionForeground(java.awt.Color selectionForeground)
Sets the foreground color for selected cells. |
void |
setSelectionMode(int selectionMode)
Determines whether single-item or multiple-item selections are allowed. |
void |
setShowCheckBoxes(boolean showCheckBoxes)
Define if a check-box must be showed for each node. |
void |
setTextOrientation(java.awt.ComponentOrientation o)
Set the component orientation: from left to right or from right to left. |
void |
setTranslateItemDescriptions(boolean translateItemDescriptions)
Define if description in list items must be translated; default value: true . |
void |
setValue(java.lang.Object code)
Select an item from the list starting from the specified code (with ListSelectionModel.SINGLE_SELECTION) or select a list of items starting from the specified java.util.List of codes (without ListSelectionModel.SINGLE_SELECTION) or |
void |
setValueIsAdjusting(boolean b)
Sets the data model's isAdjusting property to true,
so that a single event will be generated when all of the selection
events have finished (for example, when the mouse is being
dragged over the list in selection mode). |
void |
setVisibleRowCount(int visibleRowCount)
Sets the preferred number of rows in the list that can be displayed without a scrollbar, as determined by the nearest JViewport ancestor, if any.
|
Methods inherited from class org.openswing.swing.client.BaseInputControl |
addValueChangedListener, getAttributeName, getFont, getLinkLabel, getTextAlignment, getToolTipText, getValueChangeListeners, isCanCopy, isChanged, isEnabledOnEdit, isEnabledOnInsert, isRequired, removeValueChangedListener, requestFocus, setAttributeName, setCanCopy, setChanged, setEnabledOnEdit, setEnabledOnInsert, setFont, setLinkLabel, setRequired, setTextAlignment, setToolTipText |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.openswing.swing.client.InputControl |
addValueChangedListener, getAttributeName, getLinkLabel, getValueChangeListeners, isCanCopy, isChanged, isEnabledOnEdit, isEnabledOnInsert, isRequired, removeValueChangedListener, setAttributeName, setCanCopy, setChanged, setEnabledOnEdit, setEnabledOnInsert, setLinkLabel |
Constructor Detail |
public ListControl()
Method Detail |
public final void addNotify()
public final void setDomainId(java.lang.String domainId)
domainId
- domain identifierpublic final void setDomain(Domain domain)
domain
- domain to use to retrieve the list itemspublic final java.lang.String getDomainId()
public final void setValue(java.lang.Object code)
setValue
in interface InputControl
setValue
in class BaseInputControl
code
- used to retrieve the corresponding item and to select that item in the list (with ListSelectionModel.SINGLE_SELECTION) or java.util.List of codes (without ListSelectionModel.SINGLE_SELECTION)public final void setSelectedIndex(int index)
setSelectedIndex
in interface SearchControl
index
- index to retrieve the corresponding item and to select that item in the listpublic final void setSelectedIndices(int[] indices)
indices
- interval of indices to retrieve the corresponding item and to select that item in the listpublic final int getFixedCellHeight()
fixedCellHeight
property,
rather than that calculated from the list elements.
setFixedCellHeight(int)
public final void setFixedCellHeight(int height)
height
is -1, cell
heights are computed by applying getPreferredSize
to the cellRenderer
component for each list element.
The default value of this property is -1.
This is a JavaBeans bound property.
height
- an integer giving the height, in pixels, for all cells
in this list#getPrototypeCellValue
,
setFixedCellWidth(int)
,
JComponent.addPropertyChangeListener(java.beans.PropertyChangeListener)
public final int getFixedCellWidth()
fixedCellWidth
property, rather than that calculated
from the list elements.
setFixedCellWidth(int)
public final void setFixedCellWidth(int width)
width
is -1,
cell widths are computed by applying getPreferredSize
to the cellRenderer
component for each list element.
The default value of this property is -1.
This is a JavaBeans bound property.
width
- the width, in pixels, for all cells in this list#getPrototypeCellValue
,
setFixedCellWidth(int)
,
JComponent.addPropertyChangeListener(java.beans.PropertyChangeListener)
public final int getVisibleRowCount()
setVisibleRowCount(int)
public final void setVisibleRowCount(int visibleRowCount)
JViewport
ancestor, if any.
The value of this property only affects the value of
the JList
's preferredScrollableViewportSize
.
The default value of this property is 8.
This is a JavaBeans bound property.
visibleRowCount
- an integer specifying the preferred number of
visible rowsgetVisibleRowCount()
,
JComponent.getVisibleRect()
,
JViewport
public final int getLayoutOrientation()
JList.VERTICAL
if the layout is a single
column of cells, or JList.VERTICAL_WRAP
if the layout
is "newspaper style" with the content flowing vertically then
horizontally or JList.HORIZONTAL_WRAP
if the layout is
"newspaper style" with the content flowing horizontally then
vertically.
setLayoutOrientation(int)
public final void setLayoutOrientation(int layoutOrientation)
JList
with four cells, this can be layed out in one of the following ways:
0 1 2 3
0 1 2 3
0 2 1 3
These correspond to the following values:
Value | Description |
---|---|
JList.VERTICAL
| The cells should be layed out vertically in one column. |
JList.HORIZONTAL_WRAP
| The cells should be layed out horizontally, wrapping to
a new row as necessary. The number
of rows to use will either be defined by
getVisibleRowCount if > 0, otherwise the
number of rows will be determined by the width of the
JList .
|
JList.VERTICAL_WRAP
| The cells should be layed out vertically, wrapping to a
new column as necessary. The number
of rows to use will either be defined by
getVisibleRowCount if > 0, otherwise the
number of rows will be determined by the height of the
JList .
|
JList.VERTICAL
.
This will throw an IllegalArgumentException
if
layoutOrientation
is not one of
JList.HORIZONTAL_WRAP
or JList.VERTICAL
or
JList.VERTICAL_WRAP
layoutOrientation
- New orientation, one of
JList.HORIZONTAL_WRAP
, JList.VERTICAL
or JList.VERTICAL_WRAP
.getLayoutOrientation()
,
setVisibleRowCount(int)
,
#getScrollableTracksViewportHeight
public final void setSelectionMode(int selectionMode)
selectionMode
values are allowed:
ListSelectionModel.SINGLE_SELECTION
Only one list index can be selected at a time. In this
mode the setSelectionInterval
and
addSelectionInterval
methods are equivalent, and only the second index
argument is used.
ListSelectionModel.SINGLE_INTERVAL_SELECTION
One contiguous index interval can be selected at a time.
In this mode setSelectionInterval
and
addSelectionInterval
are equivalent.
ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
In this mode, there's no restriction on what can be selected.
This is the default.
selectionMode
- an integer specifying the type of selections
that are permissiblegetSelectionMode()
public final int getSelectionMode()
selectionMode
propertysetSelectionMode(int)
public final void setValueIsAdjusting(boolean b)
isAdjusting
property to true,
so that a single event will be generated when all of the selection
events have finished (for example, when the mouse is being
dragged over the list in selection mode).
b
- the boolean value for the property valueListSelectionModel.setValueIsAdjusting(boolean)
public final boolean getValueIsAdjusting()
isAdjusting
property.
This value is true if multiple changes are being made.
ListSelectionModel.getValueIsAdjusting()
public java.awt.Color getSelectionForeground()
Color
object for the foreground propertysetSelectionForeground(java.awt.Color)
,
setSelectionBackground(java.awt.Color)
public final void setSelectionForeground(java.awt.Color selectionForeground)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
selectionForeground
- the Color
to use in the foreground
for selected list itemsgetSelectionForeground()
,
setSelectionBackground(java.awt.Color)
,
JComponent.setForeground(java.awt.Color)
,
JComponent.setBackground(java.awt.Color)
,
BaseInputControl.setFont(java.awt.Font)
public final java.awt.Color getSelectionBackground()
Color
used for the background of
selected list itemssetSelectionBackground(java.awt.Color)
,
setSelectionForeground(java.awt.Color)
public void setSelectionBackground(java.awt.Color selectionBackground)
The default value of this property is defined by the look and feel implementation.
This is a JavaBeans bound property.
selectionBackground
- the Color
to use for the
background of selected cellsgetSelectionBackground()
,
setSelectionForeground(java.awt.Color)
,
JComponent.setForeground(java.awt.Color)
,
JComponent.setBackground(java.awt.Color)
,
BaseInputControl.setFont(java.awt.Font)
public final void addListSelectionListener(javax.swing.event.ListSelectionListener listener)
JList
will have their ListSelectionEvent.getSource() ==
this JList
(instead of the ListSelectionModel
).
listener
- the ListSelectionListener
to add#getSelectionModel
,
#getListSelectionListeners
public final void removeListSelectionListener(javax.swing.event.ListSelectionListener listener)
listener
- the ListSelectionListener
to removeaddListSelectionListener(javax.swing.event.ListSelectionListener)
,
#getSelectionModel
public final java.lang.Object getValue()
getValue
in interface InputControl
getValue
in class BaseInputControl
public void setEnabled(boolean enabled)
InputControl
setEnabled
in interface InputControl
setEnabled
in class BaseInputControl
public final boolean isEnabled()
isEnabled
in interface InputControl
isEnabled
in class BaseInputControl
public javax.swing.JComponent getBindingComponent()
getBindingComponent
in class BaseInputControl
public final void addFocusListener(java.awt.event.FocusListener l)
l
is null
,
no exception is thrown and no action is performed.
addFocusListener
in interface InputControl
l
- the focus listenerFocusEvent
,
FocusListener
,
removeFocusListener(java.awt.event.FocusListener)
,
Component.getFocusListeners()
public final void removeFocusListener(java.awt.event.FocusListener l)
l
is null
,
no exception is thrown and no action is performed.
removeFocusListener
in interface InputControl
l
- the focus listenerFocusEvent
,
FocusListener
,
addFocusListener(java.awt.event.FocusListener)
,
Component.getFocusListeners()
public final void addMouseListener(java.awt.event.MouseListener l)
l
- the mouse listener to be addedpublic final void removeMouseListener(java.awt.event.MouseListener l)
l
- the mouse listener to be removedpublic final boolean isNullAsDefaultValue()
public final void setNullAsDefaultValue(boolean nullAsDefaultValue)
nullAsDefaultValue
- define if in insert mode list has no item selectedpublic final Domain getDomain()
public final int getSelectedIndex()
getSelectedIndex
in interface SearchControl
public final int getRowCount()
getRowCount
in interface SearchControl
public final java.lang.String getValueAt(int index)
getValueAt
in interface SearchControl
public final javax.swing.JComponent getComponent()
getComponent
in interface SearchControl
public final boolean isReadOnly()
isReadOnly
in interface SearchControl
true
if the input control is in read only mode (so search is enabled), false
otherwisepublic final boolean isShowCheckBoxes()
public final void setShowCheckBoxes(boolean showCheckBoxes)
showCheckBoxes
- define if a check-box must be showed for each nodepublic final boolean disableListener()
disableListener
in interface SearchControl
true
to disable key listening on input control (for instance, in case of nested grids), false
to listen for key eventspublic final boolean isTranslateItemDescriptions()
public final void setTranslateItemDescriptions(boolean translateItemDescriptions)
true
.
translateItemDescriptions
- flag used to define if description in list items must be translatedpublic final int search(java.lang.String textToSeach)
search
in interface SearchControl
textToSeach
- patten of text to search
public final void setTextOrientation(java.awt.ComponentOrientation o)
o
- component orientationpublic final java.awt.ComponentOrientation getTextOrientation()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |