jbcl.control Package
java.lang.Object +----java.awt.Component +----java.awt.Container +----javax.swing.JComponent +----javax.swing.JScrollPane +----com.borland.jbcl.view.ListView +----com.borland.jbcl.control.ListControl
Variables Constructors Properties Methods Event Listeners
Implements AccessListener, ColumnAware, DataChangeListener, DataSetAware, NavigationListener, VectorModel, VectorSubfocusListener, BlackBox, VectorView, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, ScrollPaneConstants
The ListControl
component maintains a list of
objects.
If ListControl
is connected to a column in a data set
through the dataSet
and columnName
properties,
it displays the values in the specified column of the data set.
In this case ListControl
is a data-aware control.
If ListControl
is not being used as a data-aware
control, the data items displayed come from the items
property.
You can add and remove items in the list using the addItem()
,
removeItem(),
and removeAllItems()
methods. Use the count
property to determine the number of items in the list. The get()
method retrieves the data item specified with the argument, and
the set()
method sets the specified data item to the
specified Object
.
The value of the multiSelect
property determines
whether one or more items can be selected at a time. If multiSelect
is true, the use can select a range of items by
Shift+clicking items, or the user can select a noncontiguous set
of items by Ctrl+clicking items.
The topIndex
property determines which item in the
list appears at the top of the list.
When one or more items in the list control is selected, events
such as modelContentChanged
and selectionChanged
occur. The code that you write in response to one or more of
these events determines what happens with the selected data
items.
ListControl
extends ListView
, which provides
many of the visual attributes and behaviors of ListControl
.
For example, ListView's
alignment
property
determines how items are aligned with the control. See
ListView
for
a desciption of these properties and methods.
ListControl
is a composite component that
instantiates a default data model (VectorModel
)
and view manager (VectorViewManager
).
It also implements the WritableVectorModel
interface, and therefore can provide its items to another
component that uses a vector data model.
Note: The methods remove()
and removeAll()
have been deprecated in ListControl
. Use the removeItem()
and removeAllItems()
instead.
For an example that uses a ListControl
, see the project file
Cardlayout.jpr located in the samples directory of your JBuilder installation. This sample uses a
CardLayout
panel that is controlled by a ChoiceControl
, ListControl
, and TabsetControl
.
protected boolean addNotifyCalled
protected boolean autoInsert
protected String columnName
protected DataSet dataSet
protected boolean dsNavigating
protected boolean multiSelect
protected boolean navigateDataSet
protected String textureName
protected int topIndex
protected boolean userSetNavigate
public ListControl()
Constructs a ListControl
with all properties set to
their default values.
public boolean isAutoInsert() public void setAutoInsert(boolean auto)
Determines whether to automatically add an item to the list
control when a data item is added to the model. If auto
is true,
the data item is automatically added; if false, it isn't.
public String getColumnName() public void setColumnName(String newColumnName)
The columnName
property specifies a column name in
the dataSet
object to fill the list contents.
public int getCount()
Read-only property that returns the number of items in the list.
public DataSet getDataSet() public void setDataSet(DataSet newDataSet)
When connecting a ListControl
to a DataSet
component, the dataSet
property specifies a com.borland.dx.dataset.DataSet
object to fill the list contents.
public synchronized String[] getItems() public synchronized void setItems(String[] newItems)
Specifies the list of items for the ListControl
. If
your component requires only a simple list that is stored in the
component, with no complex functionality or database
connectivity, use setItems()
to specify an array of String
objects for your list.
public void setModel(VectorModel model)
Checks to prevent a recursive model assignment, then calls the
same setter in the superclass: jbcl.view.ListView.setModel()
.
The model
property defines the VectorModel
that this list is displaying data from. If the current model is
an instance of WritableVectorModel
, an external user can
get access to it using getWriteModel()
.
public boolean isMultiSelect() public void setMultiSelect(boolean select)
Specifies whether the user can select more than one item in the list. If true , more than one item can be selected; if false , only one item can be selected.
public boolean isNavigateWithDataSet() public void setNavigateWithDataSet(boolean navigate)
Specifies whether the ListControl
changes focus when
the DataSet
object specified in its dataSet
property navigates. When true, the DataSet
object navigates (and all controls bound to it change focus) when
the ListControl
changes focus. By default, navigateWithCursor
is true.
public String getTextureName() public void setTextureName(String path)Determines the name of the
Image
file that is tiled on the background of the control to give the appearance of texture. Specify the file name and directory using the path
parameter.
public void setTopIndex(int index)
Determines the item that appears at the top of the list
control. By setting the topIndex
value to the index of a
specific item within the list control, you can ensure that item
appears at the top of the list control. Setting topIndex
has an effect only if there so many items within the control that
the user must scroll to see them all. The first item in the list
has an index value of 0.
public boolean isVariableSize()
Stores whether the list control data items are stored in a
writeable vector model and the model is variable-size. To find
the latter, calls
jbcl.model.WritableVectorModel.variableSize()
.
public void addItem(int aheadOf, Object object)Inserts an item into the list.
Parameters:
aheadOf
aheadOf
is 1, the item is inserted in position 0, the first position in the list.
object
public void addItem(Object object)Appends an item to the list.
Parameters:
object
public void addNotify()
Creates the ListControl
component's peer. Also, if
the dataSet
property is set, and that cursor's autoOpen
property is set to true, opens the cursor.
Overrides: java.awt.ScrollPane.addNotify()
public boolean canSet(int index, boolean startEdit)Determine whether the specified item can be modified.
Parameters:
index
startEdit
startEdit
is true, an edit session begins.
public void enableModelEvents(boolean enable)Enables model events.
Parameters:
enable
public void removeAllItems()Removes all items in the list.
public void removeItem(int index)Removes the specified item from the list.
Parameters:
index
public void set(int index, Object object)Sets the specified item in the list to a new value.
Parameters:
index
object
public void setItems(DataSet dataSet, String columnName)
Sets the contents of a Column
in a dataSet
to the list's contents (strings).
Parameters:
dataSet
dataSet
to use.
columnName
dataSet
.
public void touched(int index)
public void addActionListener(ActionListener l) public void removeActionListener(ActionListener l)
public void addAncestorListener(javax.swing.event.AncestorListener ) public void removeAncestorListener(javax.swing.event.AncestorListener )
public synchronized void addComponentListener(java.awt.event.ComponentListener ) public synchronized void removeComponentListener(java.awt.event.ComponentListener )
public synchronized void addContainerListener(java.awt.event.ContainerListener ) public synchronized void removeContainerListener(java.awt.event.ContainerListener )
public void addCustomItemListener(CustomItemListener l) public void removeCustomItemListener(CustomItemListener l)
public void addFocusListener(FocusListener l) public void removeFocusListener(FocusListener l)
public synchronized void addInputMethodListener(java.awt.event.InputMethodListener ) public synchronized void removeInputMethodListener(java.awt.event.InputMethodListener )
public void addKeyListener(KeyListener l) public void removeKeyListener(KeyListener l)
public void addModelListener(VectorModelListener listener) public void removeModelListener(VectorModelListener listener)
public void addMouseListener(MouseListener l) public void removeMouseListener(MouseListener l)
public void addMouseMotionListener(MouseMotionListener l) public void removeMouseMotionListener(MouseMotionListener l)
public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener ) public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )
public void addSelectionListener(VectorSelectionListener listener) public void removeSelectionListener(VectorSelectionListener listener)
public void addSubfocusListener(VectorSubfocusListener listener) public void removeSubfocusListener(VectorSubfocusListener listener)
public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener ) public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )