borland Packages  Class Hierarchy  jbcl.control Package  Index 

ListControl component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----com.sun.java.swing.JComponent
                           +----com.sun.java.swing.JScrollPane
                                   +----borland.jbcl.view.ListView
                                           +----borland.jbcl.control.ListControl

About the ListControl component

Variables  Constructors  Properties  Methods  Event Listeners

Implements AccessListener, ColumnAware, DataChangeListener, DataSetAware, NavigationListener, VectorModel, VectorSubfocusListener, BlackBox, VectorView, Accessible, ScrollPaneConstants, ImageObserver, MenuContainer, Serializable, EventListener

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 jbuilder\samples\borland\samples\jbcl\cardlayout directory of your JBuilder installation. This sample uses a CardLayout panel that is controlled by a ChoiceControl, ListControl, and TabsetControl.


ListControl variables

Variables implemented in this class

Variables implemented in com.sun.java.swing.JComponent

Variables implemented in com.sun.java.swing.JScrollPane

Variables implemented in java.awt.Component

ListControl constructors

ListControl properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in borland.jbcl.view.ListView

Properties implemented in com.sun.java.swing.JComponent

Properties implemented in com.sun.java.swing.JScrollPane

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.lang.Object

ListControl methods

Methods implemented in this class

Methods implemented in borland.jbcl.view.ListView

Methods implemented in com.sun.java.swing.JComponent

Methods implemented in com.sun.java.swing.JScrollPane

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.lang.Object

ListControl event listeners


ListControl variables

addNotifyCalled

  protected boolean addNotifyCalled

autoInsert

  protected boolean autoInsert

columnName

  protected String columnName

dataSet

  protected DataSet dataSet

dsNavigating

  protected boolean dsNavigating

multiSelect

  protected boolean multiSelect

navigateDataSet

  protected boolean navigateDataSet

textureName

  protected String textureName

topIndex

  protected int topIndex

userSetNavigate

  protected boolean userSetNavigate

ListControl constructors

ListControl()

  public ListControl()

Constructs a ListControl with all properties set to their default values.


ListControl properties

autoInsert

 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.

columnName

 public String getColumnName()
 public void setColumnName(java.lang.String newColumnName)

The columnName property specifies a column name in the dataSet object to fill the list contents.

count

 public int getCount()

Read-only property that returns the number of items in the list.

dataSet

 public DataSet getDataSet()
 public void setDataSet(borland.jbcl.dataset.DataSet newDataSet)

When connecting a ListControl to a DataSet component, the dataSet property specifies a borland.jbcl.dataset.DataSet object to fill the list contents.

items

 public synchronized String[] getItems()
 public synchronized void setItems(java.lang.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.

model

 public void setModel(borland.jbcl.model.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().

multiSelect

 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.

navigateWithDataSet

 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.

textureName

 public String getTextureName()
 public void setTextureName(java.lang.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.

topIndex

 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.

variableSize

 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().


ListControl methods

addItem(int, java.lang.Object)

  public void addItem(int aheadOf, java.lang.Object object)
Inserts an item into the list.

Parameters:

aheadOf
The position in the list ahead of which the item is inserted. For example, if aheadOf is 1, the item is inserted in position 0, the first position in the list.
object
The item being inserted.

addItem(java.lang.Object)

  public void addItem(java.lang.Object object)
Appends an item to the list.

Parameters:

object
The item appened to the list.

addNotify()

  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()

canSet(int, boolean)

  public boolean canSet(int index, boolean startEdit)
Determine whether the specified item can be modified.

Parameters:

index
The position of the item in the list.
startEdit
Determines whether an edit session begins when the user selects the item. If startEdit is true, an edit session begins.

enableModelEvents(boolean)

  public void enableModelEvents(boolean enable)
Enables model events.

Parameters:

enable
If true, model events are enabled.

removeAllItems()

  public void removeAllItems()
Removes all items in the list.

removeItem(int)

  public void removeItem(int index)
Removes the specified item from the list.

Parameters:

index
The position of the item in the list to be removed.

set(int, java.lang.Object)

  public void set(int index, java.lang.Object object)
Sets the specified item in the list to a new value.

Parameters:

index
The position of the item in the list that receives a new value.
object
The new value.

setItems(borland.jbcl.dataset.DataSet, java.lang.String)

  public void setItems(borland.jbcl.dataset.DataSet dataSet, java.lang.String columnName)

Sets the contents of a Column in a dataSet to the list's contents (strings).

Parameters:

dataSet
The dataSet to use.
columnName
The column in the specified dataSet.

touched(int)

  public void touched(int index)

ListControl event listeners

This component is a source for the following event sets. For information on the standard AWT event sets, see Standard Java events. For information on the JBCL event sets, see Events in JBCL.

action

 public void addActionListener(java.awt.event.ActionListener l)
 public void removeActionListener(java.awt.event.ActionListener l)

ancestor

 public void addAncestorListener(com.sun.java.swing.event.AncestorListener )
 public void removeAncestorListener(com.sun.java.swing.event.AncestorListener )

component

 public synchronized void addComponentListener(java.awt.event.ComponentListener )
 public synchronized void removeComponentListener(java.awt.event.ComponentListener )

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener )
 public void removeContainerListener(java.awt.event.ContainerListener )

customItem

 public void addCustomItemListener(borland.jbcl.view.CustomItemListener l)
 public void removeCustomItemListener(borland.jbcl.view.CustomItemListener l)

focus

 public void addFocusListener(java.awt.event.FocusListener l)
 public void removeFocusListener(java.awt.event.FocusListener l)

key

 public void addKeyListener(java.awt.event.KeyListener l)
 public void removeKeyListener(java.awt.event.KeyListener l)

model

 public void addModelListener(borland.jbcl.model.VectorModelListener listener)
 public void removeModelListener(borland.jbcl.model.VectorModelListener listener)

mouse

 public void addMouseListener(java.awt.event.MouseListener l)
 public void removeMouseListener(java.awt.event.MouseListener l)

mouseMotion

 public void addMouseMotionListener(java.awt.event.MouseMotionListener l)
 public void removeMouseMotionListener(java.awt.event.MouseMotionListener l)

propertyChange

 public synchronized void addPropertyChangeListener(java.beans.PropertyChangeListener )
 public synchronized void removePropertyChangeListener(java.beans.PropertyChangeListener )

selection

 public void addSelectionListener(borland.jbcl.model.VectorSelectionListener listener)
 public void removeSelectionListener(borland.jbcl.model.VectorSelectionListener listener)

subfocus

 public void addSubfocusListener(borland.jbcl.model.VectorSubfocusListener listener)
 public void removeSubfocusListener(borland.jbcl.model.VectorSubfocusListener listener)

vetoableChange

 public synchronized void addVetoableChangeListener(java.beans.VetoableChangeListener )
 public synchronized void removeVetoableChangeListener(java.beans.VetoableChangeListener )