borland.jbcl Packages  borland.jbcl Class Hierarchy  borland.jbcl.view 

ListView component

java.lang.Object
   +----java.awt.Component
           +----java.awt.Container
                   +----java.awt.ScrollPane
                           +----borland.jbcl.view.ListView
                                   +----borland.jbcl.control.ListControl

About the ListView component

Variables  Constructors  Properties  Methods  Event Listeners

Implements VectorView, MenuContainer, ImageObserver, Serializable

The ListView component is a list box view element for developing new composite components. It requires a VectorModel data model and a VectorViewManager view manager.

See also:
Understanding model-view architecture


ListView variables

Variables implemented in java.awt.Component

Variables implemented in java.awt.ScrollPane

ListView constructors

ListView properties

*Read-only properties **Write-only properties

Properties implemented in this class

Properties implemented in java.awt.Component

Properties implemented in java.awt.Container

Properties implemented in java.awt.ScrollPane

Properties implemented in java.lang.Object

ListView methods

Methods implemented in this class

Methods implemented in java.awt.Component

Methods implemented in java.awt.Container

Methods implemented in java.awt.ScrollPane

Methods implemented in java.lang.Object

ListView event listeners


ListView constructors

ListView()

  public ListView()
Constructs a ListView component with default property values.


ListView properties

alignment

 public int getAlignment()
 public void setAlignment(int alignment)
Specifies the alignment (right, left, center) of the items in the list. Accepted values for the align argument are listed in borland.jbcl.util.Alignment where they are defined.

alwaysEdit

 public boolean isAlwaysEdit()
 public void setAlwaysEdit(boolean alwaysEdit)
Specifies whether the component requires a special keystroke (or other event) to go into editing mode. If alwaysEdit is true, the item editor is instantiated wherever the subfocus moves.

autoEdit

 public boolean isAutoEdit()
 public void setAutoEdit(boolean autoEdit)
The autoEdit property enables/disables automatic item editing in the list. By default, this property is true, and a user can edit values in any item on the list by typing a character on the keyboard. If set to false, the user must press F2 or Ctrl+Enter, or double-click to start an edit session. By default, this property is true.

background

 public void setBackground(java.awt.Color color)

batchMode

 public boolean isBatchMode()
 public void setBatchMode(boolean batchMode)
The batchMode property enables or disables all painting in the list. This is used for programmatic mass updates to the list's model, selection, or other related objects, without triggering repaint messages.

coreComponent

 public Component getCoreComponent()
Returns the contained ListCore (non-public) class instance as a Component.

directDraw

 public boolean isDirectDraw()
 public void setDirectDraw(boolean directDraw)
The directDraw property enables or disables direct painting, circumventing the AWT paint queue.

doubleBuffer

 public boolean isDoubleBuffer()
 public void setDoubleBuffer(boolean doubleBuffer)
The doubleBuffer property enables or disables the double-buffered screen painting built into the list. The default is true, and the list paints all of the visible items onto an off-screen image before blitting the image onto the screen, to prevent flicker. Setting doubleBuffer to false will disable this functionality, and all ItemPainters will paint directly to the screen. This property is set to false when a user is placing a list onto a Panel (or some container) that has its own double-buffering, or if the user really likes things that flicker.

dragSubfocus

 public boolean isDragSubfocus()
 public void setDragSubfocus(boolean dragSubfocus)
The dragFocus property enables or disables dragging of the subfocus item when dragging the mouse pointer over the list (with the mouse button pressed). By default, this property is true.

editInPlace

 public boolean isEditInPlace()
 public void setEditInPlace(boolean editInPlace)
The editInPlace property enables or disables item editing in the list. By default, this property is true, and a user can edit values in any item on the list. If set to false, the vector data cannot by modified by the user - except through programmatic access to the list's model.

editing

 public boolean isEditing()
The editing property (read only) returns true if an item is currently being edited in the list.

font

 public void setFont(java.awt.Font font)

foreground

 public void setForeground(java.awt.Color color)

itemHeight

 public int getItemHeight()
 public void setItemHeight(int newHeight)
When set, the view need not scan through the entire list of items, examining the height of each, to determine which item has been clicked, selected, or edited. Instead, it calculates item vertical location based on the value of itemHeight. Setting itemHeight sets uniformHeight to true.

itemMargins

 public Insets getItemMargins()
 public void setItemMargins(java.awt.Insets margins)
Specifies the space allowed between the actual edge of the item and the edge of its region allotted in the list.

itemWidth

 public int getItemWidth()
 public void setItemWidth(int newWidth)
When set, the view need not scan through the entire list of items, examining the width of each, to determine which item has been clicked, selected, or edited. Instead, it calculates item horizontal location based on the value of itemWidth. Setting itemWidth sets uniformWidth to true.

model

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

postOnEndEdit

 public boolean isPostOnEndEdit()
 public void setPostOnEndEdit(boolean post)
Specifies whether to write changes to the model immediately upon the end of an edit. By default, postOnEndEdit is set to true.

preferredSize

 public Dimension getPreferredSize()

readOnly

 public boolean isReadOnly()
 public void setReadOnly(boolean ro)
Specifies whether the items in the list can be edited. The readOnly property returns false only if the component user sets it to false and the model being used is a WriteableVectorModel (WriteModel() returns a writable model object rather than null. Otherwise, getReadOnly returns true regardless of how it has been set.

selection

 public WritableVectorSelection getSelection()
 public void setSelection(borland.jbcl.model.WritableVectorSelection vs)
The selection property defines a WritableVectorSelection manager. This allows multiple vector viewers to share the same selection pool - and for the list to handle selection in a generic manner. This allows users to plug in their own implemention of a selection manager to have custom selection behavior.

showFocus

 public boolean isShowFocus()
 public void setShowFocus(boolean focus)
Specifies whether the component displays a dotted rectangle indicated the subfocus location.

snapOrigin

 public boolean isSnapOrigin()
 public void setSnapOrigin(boolean snapOrigin)
The snapOrigin property controls wether or not the list will automatically snap the scroll position to align the top item with the top edge of the list. If set to false, the list will not snap the scroll position, and it will scroll smoothly with changes to the subfocus item. By default, this property is true.

subfocus

 public int getSubfocus()
 public void setSubfocus(int index)
Specifies the item that has subfocus within the component.

topIndex

 public int getTopIndex()
 public void setTopIndex(int index)
The topIndex property represents which item index is at the top-most of the visible items in the list. Setting this property will not move the subfocus item within the list, but will scroll the list to the appropriate position.

uniformHeight

 public boolean isUniformHeight()
 public void setUniformHeight(boolean uniformHeight)

Indicates whether the items in the list share a single uniform height. If uniformHeight is true, and itemHeight is null (has not been set), the view assumes that the all items have the height of the first item in the list. Setting uniformHeight to true allows the view to calculate item vertical location based on the value of itemHeight (or the height of the first item) rather than scanning throught the entire list of items.

uniformWidth

 public boolean isUniformWidth()
 public void setUniformWidth(boolean uniformWidth)

Indicates whether the items in the list share a single uniform width. If uniformWidth is true, and itemWidth is null (has not been set), the view assumes that the all items have the width of the first item in the list. Setting uniformWidth to true allows the view to calculate item horizontal location based on the value of itemWidth (or the width of the first item) rather than scanning throught the entire list of items.

viewManager

 public VectorViewManager getViewManager()
 public void setViewManager(borland.jbcl.model.VectorViewManager vvm)
The viewManager property defines the VectorViewManager that will 'broker' ItemPainters and ItemEditors to this list.

writeModel

 public WritableVectorModel getWriteModel()

ListView methods

addNotify()

  public void addNotify()
Overrides:
java.awt.Container.addNotify()

endEdit()

  public void endEdit()
Ends the editing of an item, marking the item editor for garbage collection. Checks the postOnEndEdit property and, if it is true, writes the change to the model.

endEdit(boolean)

  public void endEdit(boolean post)
Ends the editing of an item, marking the item editor for garbage collection. Writes the change to the model if post is true.

getItemRect(int)

  public Rectangle getItemRect(int index)
Returns the Rectangle (in pixels) that bounds the item at the specified index. Coordinates are relative to the entire scrollable region inside of the ListView. Use getScrollPosition() and getViewportSize() to calculate relative point positions to external components.

Returns the bounding rectangle of the item.

Parameters:

index
The item index that you want the rectangle for.

hitTest(int)

  public int hitTest(int y)
Returns the index of the item at the Y coordinate specified. Coordinates are relative to the entire scrollable region inside of the ListView. Use getScrollPosition() and getViewportSize() to calculate relative point positions to external components.

Returns the hit index, or -1 if nothing was hit.

Parameters:

y
The y location.

repaintItem(int)

  public void repaintItem(int index)
Repaints the item at the passed index.

Parameters:

index
The index that you want repainted.

repaintItems()

  public void repaintItems()
Repaints all items in the list.

requestFocus()

  public void requestFocus()
Overrides:
java.awt.Component.requestFocus()

startEdit(int)

  public void startEdit(int index)
Starts an edit session at 'index'. If editInPlace is false or if readOnly is true, this method is a no-op.

Parameters:

index
The item index to start the edit session at.


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

component

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

container

 public synchronized void addContainerListener(java.awt.event.ContainerListener l)
 public void removeContainerListener(java.awt.event.ContainerListener 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)

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)