HOME

com.ultraswing
Class CListReportCtrl

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended bycom.ultraswing.CPanel
                      extended bycom.ultraswing.CSplitPane
                          extended bycom.ultraswing.CListReportCtrl
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Orientation, Serializable

public class CListReportCtrl
extends CSplitPane

This class is an component embedded in CListView container. It provides a table like interface similar to the Outlook's message list. This component can't be created directly, you need to create a CListView instance, then get this object from CListView instance.

Usage example:

        CListView listview = new CListView();
        CListReportCtrl ctrl = listview.getReportCtrl();
        ctrl.setSortEnabled(true);
        ctrl.setHorizontalScrollBarEnabled(true);
        ctrl.addColumnHeader("Name", SwingConstants.LEFT, 120);
        ctrl.addItem("1GB", null, SwingConstants.RIGHT);
 

See Also:
CListView, Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int MULTIPLE_SELECTION
          Allows multiple selection
static int SINGLE_SELECTION
          Only one selection is allowed at a time
 
Fields inherited from class com.ultraswing.CSplitPane
HORIZONTAL_SPLIT, VERTICAL_SPLIT
 
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
 
Method Summary
 void addColumnHeader(String text)
          Adds column header text
 void addColumnHeader(String text, Icon icon, int alignment, int width)
          Adds column header text
 void addColumnHeader(String text, int alignment)
          Adds column header text
 void addColumnHeader(String text, int alignment, int width)
          Adds column header text
 void addEmptyItem()
          Adds an empty item
 void addEventListener(CListReportCtrlEventListener listener)
          Adds an event listener
 void addItem(JComponent item, int alignment)
          Adds an item
 void addItem(String text, Icon icon)
          Adds an item
 void addItem(String text, Icon icon, int alignment)
          Adds an item
 void clearSelection()
          Deselects all selected rows.
 void deselectAllRows(int exclude)
          Deselects all selected rows except for the passed exclude
 void deselectRow(int row)
          Deselects passed row
 void disableAlternate()
          Disables alternate coloring
 void ensureVisible(int rowIndex)
          Ensures that the passed row is visible
 Component getCellAt(int row, int column)
           
 Component getCellAt(int row, String columnName)
           
 Dimension getMinimumSize()
           
 Dimension getPreferredSize()
           
 int getRowCount()
          Returns number of rows
 int getSelectedRow()
          Returns the index of first occurrence of selected row
 int getSelectedRowCount()
          Returns the number of selected rows
 int[] getSelectedRows()
          Returns the select rows in an integer array
 int getSelectionMode()
          Returns the selection mode.
 boolean hasFocus()
           
 boolean isDroppable(Component comp)
          Tests if the passed comp can be dropped into this pane
 boolean isHorizontalScrollBarEnabled()
          Tests if the horizontal scroll bar is enabled
 int isRowVisible(int index)
           
protected  void notifyListeners(CListReportCtrlEvent event)
           
protected  void onResize()
          NOTE: enableEvents(ComponentEvent.COMPONENT_RESIZED); should be called to enable resize event
 void removeEventListener(CListReportCtrlEventListener listener)
          Removes an event listener
 void scrollOneRow(boolean goDown)
          Scrolls one row
 void selectRow(int index, boolean select)
          Select or deselect the passed row
 void setAlternate(Color c1, Color c2, boolean isRowAlternate)
          Alternates colors for rows or columns.
 void setColorSortColumn(boolean b, Color c)
          Turns the coloring of the sorted column on or off.
 Color setColumnColor(int index, Color color)
          Sets the background color of column at specified index.
 void setFixedWidth(int index, boolean b)
          Sets a column's width to be fixed or not
 void setHorizontalScrollBarEnabled(boolean b)
          If passed b is true, horizontal scroll bar will be enabled
 Color setRowColor(int index, Color color)
          Sets the background color of row at specified index.
 void setSelectionMode(int selectionMode)
          Determines whether single-item or multiple-item selections are allowed.
 void setSortEnabled(boolean b)
          If passed b is true, sorting will be enabled
 void setSortEnabled(int columnIndex, boolean b)
          If passed b is true, sorting will be enabled for the passed columnIndex
 
Methods inherited from class com.ultraswing.CSplitPane
addFirst, addFirst, addLast, addLast, addPane, addPane, addPaneAfter, addPaneAfter, addPaneBefore, addPaneBefore, getComponentAt, getComponentAt, getCurrentWeight, getDividerSize, getNext, getOrientation, getPaneCount, getPanes, getPrevious, getTotalWeight, getWeight, isRemoveFromParent, removePane, setDividerSize, setDividerTransparent, setFlat, setRemoveFromParent, updateWeight
 
Methods inherited from class com.ultraswing.CPanel
contains, getPrefferedSize, paintBorder, processComponentEvent, setBackground, setBackgroundImage, setGradientBackground
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, 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, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MULTIPLE_SELECTION

public static final int MULTIPLE_SELECTION
Allows multiple selection

See Also:
Constant Field Values

SINGLE_SELECTION

public static final int SINGLE_SELECTION
Only one selection is allowed at a time

See Also:
Constant Field Values
Method Detail

addEventListener

public void addEventListener(CListReportCtrlEventListener listener)
Adds an event listener


removeEventListener

public void removeEventListener(CListReportCtrlEventListener listener)
Removes an event listener


notifyListeners

protected void notifyListeners(CListReportCtrlEvent event)

setSelectionMode

public void setSelectionMode(int selectionMode)
Determines whether single-item or multiple-item selections are allowed. The following selectionMode values are allowed:

Parameters:
selectionMode - an integer specifying the type of selections that are permissible
See Also:
getSelectionMode()

getSelectionMode

public int getSelectionMode()
Returns the selection mode. One of { CListReportCtrl.MULTIPLE_SELECTION, CListReportCtrl.SINGLE_SELECTION }


isDroppable

public boolean isDroppable(Component comp)
Tests if the passed comp can be dropped into this pane

Overrides:
isDroppable in class CSplitPane

setHorizontalScrollBarEnabled

public void setHorizontalScrollBarEnabled(boolean b)
If passed b is true, horizontal scroll bar will be enabled


isHorizontalScrollBarEnabled

public boolean isHorizontalScrollBarEnabled()
Tests if the horizontal scroll bar is enabled


setFixedWidth

public void setFixedWidth(int index,
                          boolean b)
Sets a column's width to be fixed or not

Parameters:
index - initial column index

hasFocus

public boolean hasFocus()

scrollOneRow

public void scrollOneRow(boolean goDown)
Scrolls one row

Parameters:
goDown - true, scroll down; false, scroll up

isRowVisible

public int isRowVisible(int index)
Returns:
-1 : invisible, hidden on the top; 1: invisible, hidden on the bottom; 0: visible

ensureVisible

public void ensureVisible(int rowIndex)
Ensures that the passed row is visible


selectRow

public void selectRow(int index,
                      boolean select)
Select or deselect the passed row

Parameters:
index - row index
select - true to select this row; false to deselect it

clearSelection

public void clearSelection()
Deselects all selected rows.


deselectAllRows

public void deselectAllRows(int exclude)
Deselects all selected rows except for the passed exclude

Parameters:
exclude - the index of row to be excluded from deselecting

deselectRow

public void deselectRow(int row)
Deselects passed row

Parameters:
row - row index

getCellAt

public Component getCellAt(int row,
                           int column)
Parameters:
row - current row index on screen
column - current column index on screen

getCellAt

public Component getCellAt(int row,
                           String columnName)
Parameters:
columnName - column name
row - current row index on screen

getSelectedRow

public int getSelectedRow()
Returns the index of first occurrence of selected row

Returns:
the index of selected row. or -1 if none is selected

getSelectedRowCount

public int getSelectedRowCount()
Returns the number of selected rows


getSelectedRows

public int[] getSelectedRows()
Returns the select rows in an integer array


addColumnHeader

public void addColumnHeader(String text)
Adds column header text

Parameters:
text - column header text

addColumnHeader

public void addColumnHeader(String text,
                            int alignment)
Adds column header text

Parameters:
alignment - One of the following constants defined in SwingConstants: LEFT, CENTER (the default for image-only labels), RIGHT, LEADING (the default for text-only labels) or TRAILING

addColumnHeader

public void addColumnHeader(String text,
                            int alignment,
                            int width)
Adds column header text

Parameters:
width - width of this column, in pixels
alignment - One of the following constants defined in SwingConstants: LEFT, CENTER (the default for image-only labels), RIGHT, LEADING (the default for text-only labels) or TRAILING

addColumnHeader

public void addColumnHeader(String text,
                            Icon icon,
                            int alignment,
                            int width)
Adds column header text

Parameters:
icon - the icon object on the left side
width - width of this column, in pixels
alignment - One of the following constants defined in SwingConstants: LEFT, CENTER (the default for image-only labels), RIGHT, LEADING (the default for text-only labels) or TRAILING

setSortEnabled

public void setSortEnabled(boolean b)
If passed b is true, sorting will be enabled


setSortEnabled

public void setSortEnabled(int columnIndex,
                           boolean b)
If passed b is true, sorting will be enabled for the passed columnIndex

Parameters:
columnIndex - initial column index

setColorSortColumn

public void setColorSortColumn(boolean b,
                               Color c)
Turns the coloring of the sorted column on or off. This method also enables sorting (setSortEnabled(boolean b)) Note: This method conflicts with setAlternate method in some cases.


setAlternate

public void setAlternate(Color c1,
                         Color c2,
                         boolean isRowAlternate)
Alternates colors for rows or columns. It should be called before adding items.
Note: It 's NOT possbile to have both alternative rows and columns at the same time

Parameters:
c1 - The color for row/column where row/column number is even
c2 - The color for row/column where row/column number is odd
isRowAlternate - Alternates colors on rows (true) or columns (false)

disableAlternate

public void disableAlternate()
Disables alternate coloring


setColumnColor

public Color setColumnColor(int index,
                            Color color)
Sets the background color of column at specified index. If it's applied for a CListReportCtrl with alternative row/column colors, this control can't return to its original state. When this method is invoked, make sure that the number of columns is larger than the passed index.

Parameters:
index - initial column index
Returns:
the old color of the first cell in this column

setRowColor

public Color setRowColor(int index,
                         Color color)
Sets the background color of row at specified index. If it's applied for a CListReportCtrl with alternative row/column colors, this control can't return to its original state. When this method is invoked, make sure that the number of rows is larger than the passed index.

Returns:
the old color of the first cell in this row

addItem

public void addItem(String text,
                    Icon icon)
Adds an item

Parameters:
text - new item's text string
icon - new item's icon object

addItem

public void addItem(String text,
                    Icon icon,
                    int alignment)
Adds an item

Parameters:
text - new item's text string
icon - new item's icon object
alignment - possible values are {SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT}

addEmptyItem

public void addEmptyItem()
Adds an empty item


addItem

public void addItem(JComponent item,
                    int alignment)
Adds an item

Parameters:
item - new item object
alignment - possible values are {SwingConstants.LEFT, SwingConstants.CENTER, SwingConstants.RIGHT}

getRowCount

public int getRowCount()
Returns number of rows


onResize

protected void onResize()
Description copied from class: CPanel
NOTE: enableEvents(ComponentEvent.COMPONENT_RESIZED); should be called to enable resize event

Overrides:
onResize in class CPanel

getMinimumSize

public Dimension getMinimumSize()

getPreferredSize

public Dimension getPreferredSize()

HOME

Copyright © 2002 iReasoning Inc. All Rights Reserved.