SilverStream
Application Server 3.5

com.sssw.rt.form
Class AgcView

java.lang.Object
 |
 +--java.awt.Component
       |
       +--java.awt.Container
             |
             +--javax.swing.JComponent
                   |
                   +--javax.swing.JPanel
                         |
                         +--com.sssw.rt.atlas.AtPanel
                               |
                               +--com.sssw.rt.tview.TView
                                     |
                                     +--com.sssw.rt.form.AgcView
All Implemented Interfaces:
Accessible, AgiControl, AgiHelpInfo, ImageObserver, MenuContainer, Serializable
Direct Known Subclasses:
AgcTreeControl, AgcViewDownloadable

public class AgcView
extends TView
implements AgiControl

The base class for the Tree Control and SilverStream Java views.

Properties:
Control Type, Enabled, Height, Help Page, Left, Name, Tool Tip, Top, Visible, Width
Events:
focusGained, focusLost, keyPressed, keyReleased, keyTyped, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, viewColumnResize, viewDoubleClick, viewHeaderRowClick, viewRowCollapse, viewRowExpand, viewSelectionChange
See Also:
Serialized Form

Inner classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Fields inherited from class com.sssw.rt.atlas.AtPanel
BGIMAGE_DRAW_CENTERED, BGIMAGE_DRAW_NORMAL, BGIMAGE_DRAW_STRETCH, BGIMAGE_DRAW_TILED
 
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 com.sssw.rt.form.AgiControl
IMAGE_MODE_CENTERED, IMAGE_MODE_NORMAL, IMAGE_MODE_STRETCH, IMAGE_MODE_TILED
 
Constructor Summary
AgcView()
          AgcView constructor.
 
Method Summary
 void clearSelection()
          Clears the current selection set.
 void collapseNode(AgiRowCursor dc)
          Collapse (hides the children of) a specified node.
 void expandNode(AgiRowCursor dc)
          Expands (shows the children of) a specified node.
 Object getColumnValue(String name)
          Gets a property from a parent of the row pointed to by the current row cursor.
 String getCursorBandName(AgiRowCursor dc)
          Returns the name of the band for the row represented by this row cursor
 int getMultiSelectType()
          Returns the currrent multiselect type.
 AgiRowCursor getRootRowCursor()
          Gets a data object representing the data in the view.
 AgoRowEnumerator getRowSelection()
          Gets an enumeration object (AgoRowEnumerator) which encapsulates all the currently selected rows in the view.
 int getSelectedColumnIndex()
          Returns the index (zero-based) of the column containing the caret.
 AgiRowCursor getSelectedRowCursor()
          Returns a navigation object (AgiRowCursor) associated with this view.
 AgiRowCursor getTopRowCursor()
          Gets a navigation object which initially points to the topmost visible row in the view.
 void initView(AgiRowCursor rowCursor, AgoViewFormat viewFormat)
          Associates the AgcView object with a navigation object (AgiRowCursor) which will provide the data for the view, and a format object (AgoViewFormat) which describes how the data is to be presented.
 void setMultiSelectType(int type)
          Enables or disables the ability to select multiple rows simultaneously.
 void setSelection(AgiRowCursor dc)
          Sets the currently selected row in the view to be the current row in the supplied AgiRowCursor object.
 void sort(int column, boolean descending)
          Sorts the view by the specified column.
 void sort(String bandname, int[] cols, boolean[] desc)
          Sorts the view.
 
Methods inherited from class com.sssw.rt.tview.TView
getAgoViewFormat, getSearchable, reload, scrollHome, setAgoViewFormat, setSearchable
 
Methods inherited from class com.sssw.rt.atlas.AtPanel
addImpl, addNotify, clientPaint, clientPaint, deliverMouseEvent, deliverMouseMoveEvent, doAtCommand, drawTiledImage, enableAtCommands, getBackgroundImage, getBackgroundImageMode, getHelper, getTransparent, hide, hideToolTip, imageUpdate, isFocusTraversable, isOptimizedDrawingEnabled, ownedImage, paintBorder, paintComponent, paintImmediately, paintImmediately, paintNow, preprocessKeyEvent, processEvent, reshape, setBackgroundImage, setBackgroundImageMode, setTransparent, show, showToolTip
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUIClassID, paramString, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getAlignmentX, getAlignmentY, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getGraphics, getHeight, getInsets, getInsets, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getVisibleRect, getWidth, getX, getY, grabFocus, hasFocus, isDoubleBuffered, isFocusCycleRoot, isLightweightComponent, isManagingFocus, isOpaque, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, print, printAll, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, revalidate, scrollRectToVisible, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDoubleBuffered, setEnabled, setFont, setForeground, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setUI, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getLayout, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setCursor, setLayout, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, inside, isDisplayable, isEnabled, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processInputMethodEvent, processMouseEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setDropTarget, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods implemented from interface com.sssw.rt.form.AgiControl
getComponent, getHelpInfo, setHelpInfo
 

Constructor Detail

AgcView

public AgcView()
AgcView constructor.
Method Detail

initView

public void initView(AgiRowCursor rowCursor,
                     AgoViewFormat viewFormat)
Associates the AgcView object with a navigation object (AgiRowCursor) which will provide the data for the view, and a format object (AgoViewFormat) which describes how the data is to be presented.
Parameters:
rowCursor - the navigation object, which must implement the AgiRowCursor interface, which will provide the data for the view. This may be, for example, an AgcData object, or a user-written class.
viewFormat - the format object which describes how the view is displayed
Example:
  agcView.initView(myAgcData, viewFmt);
 
See Also:
AgiRowCursor, AgoViewFormat

getRootRowCursor

public AgiRowCursor getRootRowCursor()
Gets a data object representing the data in the view. When initially created, this data object points to the root of the view - to get to the first row, call gotoChild() on the row cursor that this call returns.
See Also:
AgiRowCursor

getSelectedRowCursor

public AgiRowCursor getSelectedRowCursor()
Returns a navigation object (AgiRowCursor) associated with this view.
Usage:

If there is no currently selected row (this is possible only in a view which supports multi-selection), this method returns null. If an AgiRowCursor is returned, it points to the currently selected row.

Example:
  AgiRowCursor selectedRow;
 
  selectedRow = agcView.getSelectedRowCursor();
 	 if (selectedRow != null)
 	 {
 		// do something interesting
 	 }
 
See Also:
AgiRowCursor

getTopRowCursor

public AgiRowCursor getTopRowCursor()
Gets a navigation object which initially points to the topmost visible row in the view.
Example:
  AgiRowCursor topRow;
 
  topRow = agcView.getTopRowCursor();
 
See Also:
AgiRowCursor

getRowSelection

public AgoRowEnumerator getRowSelection()
Gets an enumeration object (AgoRowEnumerator) which encapsulates all the currently selected rows in the view.
Example:
 AgoRowEnumerator enum = agcView.getRowSelection();
 

setSelection

public void setSelection(AgiRowCursor dc)
Sets the currently selected row in the view to be the current row in the supplied AgiRowCursor object.
Parameters:
dc - an AgiRowCursor
Usage:

The AgiRowCursor object must have been obtained by calling the getSelectedRowCursor() method on the object. The setSelection() method fires the valueChanged event and sets the event's info argument to AgoValueChangedInfo.SOURCE_PROG

Example:

This is an example showing how to select the row following the currently selected row:

  AgiRowCursor cursor = agcView.getSelectedRowCursor();
 	 if (cursor != null && cursor.gotoNext())
 	     agcView.setSelection(cursor);	// this now pointing to the following row
 
See Also:
AgcView.clearSelection(), AgiRowCursor

getCursorBandName

public String getCursorBandName(AgiRowCursor dc)
Returns the name of the band for the row represented by this row cursor
Parameters:
dc - an AgiRowCursor which will be used to find the corresopnding band name
See Also:
AgiRowCursor

expandNode

public void expandNode(AgiRowCursor dc)
Expands (shows the children of) a specified node.
Parameters:
dc - an AgiRowCursor which specifies the node to expand
Example:
  AgiRowCursor cursor = agcView.getSelectedRowCursor();
  agcView.expandNode(cursor);
 
See Also:
AgcView.collapseNode(AgiRowCursor), AgiRowCursor

collapseNode

public void collapseNode(AgiRowCursor dc)
                  throws AgoException
Collapse (hides the children of) a specified node.
Parameters:
dc - an AgiRowCursor which specifies the node to collapse
Example:
  AgiRowCursor cursor = agcView.getSelectedRowCursor();
 
     try {
          agcView.collapseNode(cursor);
     }
     catch (AgoApiException e) {
             agDialog.displayError(e);
     }
 
See Also:
AgcView.expandNode(AgiRowCursor), AgiRowCursor, AgoApiException

getSelectedColumnIndex

public int getSelectedColumnIndex()
Returns the index (zero-based) of the column containing the caret.
Usage:

The caret is the cursor (normally a rectangular outline) used to show the row or column on which the user has most recently clicked. This method applies only to views whose columns are marked as selectable or editable. If there isn't a column containing the caret, for any reason, the return value is -1.

Example:
  int columnIndex;
  columnIndex = agcView.getSelectedColumnIndex();
 

getColumnValue

public Object getColumnValue(String name)
Gets a property from a parent of the row pointed to by the current row cursor. The name argument must be in the form bandName.propertyName. The function will start with the current row and progress to successive parents until it finds one whose band name matches the first part of the supplied name. It then extracts the property that matches the second part of the supplied name from the row it has found. The band name may be the name of the band for the current row or any of its parents. If the specified band is not found, the function will return null.
Parameters:
name - a String in the form bandName.propertyName

clearSelection

public void clearSelection()
Clears the current selection set.
Usage:

The selection set is the set of rows currently selected. In multi-select mode, there may be a number of rows selected simultaneously. This method unselects all the selected rows. After this method has been called, no row is selected.

Example:
 	agcView.clearSelection();
 
See Also:
AgcView.setSelection(AgiRowCursor)

setMultiSelectType

public void setMultiSelectType(int type)
Enables or disables the ability to select multiple rows simultaneously. Here are the values for the constants:
NO_MULTI_SELECT = 0;
ROW_SELECT = 1;
CELL_SELECT = 2;
NO_EXPANDABLE_SELECT = 4;
MULTI_SELECT_DISABLED = 8;

So for multiselect, set it to ROW_SELECT. For multiselect with no expandable select set it to TView.ROW_SELECT + TView.NO_EXPANDABLE_SELECT.

Example:

This example shows how to enable multiple selection:

 	 agcView.setMultiSelectType(1);
 

This example shows how to disable multiple selection:

 	 agcView.setMultiSelectType(0);
 

The final example illustrates how to disallow multiple selection of expandable rows (i.e. those which have children), while still allowing multiple selection of rows which have no children:

 	agcView.setMultiSelectType(5);
 
See Also:
AgcView.getMultiSelectType(), AgcView.clearSelection(), AgcView.setSelection(AgiRowCursor)

getMultiSelectType

public int getMultiSelectType()
Returns the currrent multiselect type.
Example:
 	 int multiselType = agcView.getMultiSelectType();
 
See Also:
AgcView.setMultiSelectType(int), AgcView.clearSelection(), AgcView.setSelection(AgiRowCursor)

sort

public void sort(int column,
                 boolean descending)
          throws AgoSecurityException,
                 AgoTransientSystemException,
                 AgoUnrecoverableSystemException
Sorts the view by the specified column.
Parameters:
column - The (0-based) index of the column to sort by.
descending - True if the column should be sorted in descending order.
Usage:

This method sorts the view at the application level. Use the alternative sort() method in this class to specify that sorting be done in the view's underlying data source.

Example:
 	// this sorts the view in ascending order on the third column
 	agcView.sort(2, false);
 

sort

public void sort(String bandname,
                 int[] cols,
                 boolean[] desc)
          throws AgoSecurityException,
                 AgoTransientSystemException,
                 AgoUnrecoverableSystemException
Sorts the view. Note that the actual sorting is done in the view's underlying data source. If the data source does not support sorting, then no sorting occurs.
Parameters:
bandname - The band to sort. If null, sorts the top level
cols - The indices of the columns to sort (in the band). The rows are first sorted by cols[0], then subsorted by cols[1], etc.
desc - Descending flags for each column
Usage:

This method actually sorts the underlying data source. Use the alternative sort() method in this class to sort the view at the application level by a specified column.

Example:
 	// this sorts the underlying data source in ascending order on the third column
 	// and within that, in descending order on the fourth column, in the band named
 	// 'customer_data'
 
 	int colnums[] = {2, 3};
 	boolean direction[] = {false, true};
 	agcView.sort("customer_data", colnums, direction);
 

SilverStream
Application Server 3.5