com.iisc.jwc.jsheet
Class JSClientSession

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended bycom.iisc.jwc.jsheet.JSClient
                      extended bycom.iisc.jwc.jsheet.JSClientSession
All Implemented Interfaces:
javax.accessibility.Accessible, BookListener, java.awt.datatransfer.ClipboardOwner, java.util.EventListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, SessionListener, SheetListener

public final class JSClientSession
extends JSClient
implements SessionListener, BookListener, SheetListener

See Also:
Serialized Form

Field Summary
 
Fields inherited from class com.iisc.jwc.jsheet.JSClient
PROTECTION_GRANT, PROTECTION_LOCKED, PROTECTION_READ, PROTECTION_SAVE, PROTECTION_WRITE
 
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
 
Constructor Summary
JSClientSession()
          Constructs a JSClient and adds self to instances.
 
Method Summary
 JSDatabase _dbConnect(java.lang.String dbName, java.lang.String userName, java.lang.String password)
          Connects to a database through JSServer.
 short _getActiveSheet()
          Returns the current active sheet.
 java.awt.Color _getBGColor()
          Returns the background color of the current sheet.
 java.lang.String _getCellDisplay(Cell cell)
          Returns the displayed text of the cell at row, column.
 java.lang.String _getCellEntry(Cell cell)
          Returns the value of the cell at row, column.
 java.lang.String _getCellHTML(Cell cell, int flags)
          Returns the data in this cell as HTML.
 CellStyle _getCellStyle(Cell cell)
          Returns the CellStyle object of the specified cell.
 JSValue _getCellValue(Cell cell)
          Returns the data in this cell as a JSValue object.
 byte[] _getChartAsBytes(java.lang.String name, int imgType, short sheetIdx)
          Returns chart bytes based on the chart name.
 int _getColWidth(int col)
          Returns the column width, in pixels, for the specified column in the specified sheet.
 com.iisc.jwc.orb.CSheet _getCSheet(short sheetIndex)
          Returns the CORBA CSheetView class
 com.iisc.jwc.orb.CSheetView _getCSheetView(short sheetIndex)
          Returns the CORBA CSheetView class
 Cell _getLastCell(short sheetIndex, int type, int roworcol)
          Returns the largest cell that is needed to contain all of the data in the sheet.
 int _getMyPermissionOnCell(Cell cell)
          Returns the permission settings for the current user for a specified cell within a specified sheet.
 Range _getNamedRange(java.lang.String name)
          Returns the range for the specified named range.
 java.lang.String[] _getRangeDisplay(Range range)
          Returns the displayed text of the range.
 int _getRowHeight(int row)
          Returns the row height, in pixels, for the specified row, in the specified sheet.
 com.iisc.jwc.jsheet.ISheet _getSheet(short sheetIndex)
          Returns the requested sheet interface class
 int _getSheetCount()
          Returns the number of sheets in this book.
 short _getSheetIndex(java.lang.String sheet)
          Returns the sheet index based on the current sheet attribute.
 short _getSheetIndexForName(java.lang.String sheetname)
          Returns the sheet index for a sheet name.
 byte[] _newChartAsBytes(java.lang.String cdfFileName, java.lang.String cdfText, Range range, int width, int height)
          Creates a new chart based on the chart definition file.
 void _setActiveSheet(short sheet)
          Sets the current active sheet.
 void _setActiveSheetUsingString(java.lang.String sheetname)
          Sets the current active sheet.
 void _setCellEntry(Cell cell, java.lang.String data)
          Sets the value of the cell.
 void activeCellChanged(SheetEvent e)
          Invoked when the user selects a new cell.
 void activeSheetChanged(BookEvent e)
          Invoked when the active sheet is changed.
 void bookClosed(BookEvent e)
          Invoked when this book is closed on the server while this client is still accessing it.
 void bookClosed(SessionEvent e)
          Invoked when a book is closed by this client.
 void bookOpened(SessionEvent e)
          Invoked when a book is opened by this client.
 void bookSaved(BookEvent e)
          Invoked when the book is saved on the server.
 void cellStyleUpdated(SheetEvent e)
          Invoked when the style of a cell that is being observed changes on the server.
 void cellValueUpdated(SheetEvent e)
          Invoked when the value of a cell that is being observed changes on the server.
 void clientJoined(BookEvent e)
          Invoked when another user first accesses this shared book.
 void clientLeft(BookEvent e)
          Invoked when another user stops accessing this book.
 void colWidthUpdated(SheetEvent e)
          Invoked when a column size is changed.
 void connect(java.lang.String host, java.lang.String user, java.lang.String pwd)
          Connects to the server.
 void deletedLeft(SheetEvent e)
          Invoked when a cell or column is deleted.
 void deletedUp(SheetEvent e)
          Invoked when a cell or row is deleted.
 void disconnect()
          Disconnects from JSServer and remove self from instances.
 void doubleClicked(SheetEvent e)
          Invoked when the user double-clicks in a cell.
 java.lang.String echo(java.lang.String echo)
          Sends the string passed from the client back.
 void finalize()
          Removes self from instances.
 java.lang.Object getAttribute(java.lang.String name)
          Returns the object bound with the specified name
 java.lang.String getCellHTML(Cell cell, java.lang.Integer flags)
          Wrapper for getCellHTML.
 java.io.ByteArrayOutputStream getEvents()
          Returns the ByteArrayOutputStream containing the events that have been sent from JSServer.
static JSClientSession getInstance(java.lang.Object instanceID)
          Get the instance of JSClient identified by the instance ID.
 java.lang.Object getInstanceID()
          Get the instance ID of this JSClient.
 void insertedDown(SheetEvent e)
          Invoked when a cell or row is inserted.
 void insertedRight(SheetEvent e)
          Invoked when a cell or column is inserted.
 long jdate2wzdate(long jdate)
           
 void killClient(SessionEvent e)
          Invoked when a terminate message is sent from the server.
 void leftColChanged(SheetEvent e)
          Invoked when the user scrolls the sheet left or right.
 boolean lockJSClient(java.lang.Object who)
          Try and "lock" JSClient so no other instance can use this one by accident.
 void messageReceived(SessionEvent e)
          Invoked when a message is sent from the server to this client.
 void rangeStyleUpdated(SheetEvent e)
          Invoked when a range of values that is being observed changes on the server.
 void removeAttribute(java.lang.String name)
          Removes the object bound with the specified name.
 void removeInstance()
          Remove this instance of JSClient from the list of JSClients.
static JSClientSession removeInstance(java.lang.Object instanceID)
          Remove the instance of JSClient identified from the list of JSClients being maintained.
 void resetSheets()
          Resets the internal information kept about "Sheets"
 java.lang.String reverseEcho(java.lang.String echo)
          Sends the string passed from the client back, reverse.
 void rowHeightUpdated(SheetEvent e)
          Invoked when a row size is changed.
 void setAttribute(java.lang.String name, java.lang.Object value)
          Binds an object, using the name specified.
 void sheetInserted(BookEvent e)
          Invoked when a new sheet is inserted into the book.
 void sheetMoved(BookEvent e)
          Invoked when a sheet is moved in the book.
 void sheetNameChanged(BookEvent e)
          Invoked when a sheet name changes in the book.
 void sheetPropertiesUpdated(SheetEvent e)
          Invoked when one of the sheet properties has changed.
 void sheetRemoved(BookEvent e)
          Invoked when a sheet is removed from the book.
 void start(boolean interactive)
          Over-ridden to attach our listeners and prepare the event stream.
 void styleIndexCleared(SheetEvent e)
          Invoked when a style is no longer being used.
 void textModified(SheetEvent e)
          Invoked when the value of the cell is being edited.
 void topRowChanged(SheetEvent e)
          Invoked when the user scrolls the sheet down or up.
 boolean unlockJSClient(java.lang.Object who)
          Unlock the client so other instances can use this one.
 void valueBound(HttpSessionBindingEvent event)
          Notifies the object that it is being bound to a session and identifies the session.
 void valueUnbound(HttpSessionBindingEvent event)
          Notifies the object that it is being unbound from a session and identifies the session.
 long wzdate2jdate(double wzdate)
           
 
Methods inherited from class com.iisc.jwc.jsheet.JSClient
aboutDlg, addBookListener, addBookProtection, addNotify, addPropertyChangeListener, addProtection, addSessionListener, addSheetListener, addSheetObserver, addSheetObserver, addSheetProtection, broadcastMessage, chartsDlg, clear, clearData, clearDlg, clearFormat, clearFormula, closeBook, closeBookChecked, closeBookCheckedSelectableDlg, colorToHTMLColor, connectDlg, convertDBRowSetToDBRow, copy, copy, copyDown, copyDown, copyRight, createObject, createObject, cut, dbConnect, dbDisconnect, deleteBook, deleteChart, deleteLeft, deleteSheet, deleteUp, destroy, determinant, disconnectDlg, distribute, errorMsg, errorMsgForException, errorMsgForException, evaluate, executeScript, find, findAgain, formatCellsDlg, getActiveCell, getActiveSheet, getBGColor, getBGColorBlue, getBGColorGreen, getBGColorRed, getBookName, getBookPassword, getCacheSize, getCallTimeout, getCellDisplay, getCellEntry, getCellHTML, getCellNumber, getCellStyle, getCellText, getCellValue, getChartAsBytes, getChartAsImage, getChartList, getChartListAsVector, getColWidth, getColWidth, getConnectAtStartup, getDatabases, getDatabasesAsVector, getDefaultColWidth, getDefaultRowHeight, getFileList, getFileListAsVector, getFileName, getFreezePaneCell, getGridLineColor, getHeadingStyleR1C1, getHostName, getInitialSheet, getInputCell, getLastCell, getLoadbalance, getMyPermissionOnBook, getMyPermissionOnCell, getMyPermissionOnSheet, getNamedRange, getNamedRanges, getNamedRangesAsVector, getOpenBookList, getOpenBookListAsVector, getOpenMode, getOpenNewBook, getOpenSheet, getPermissionsOnBook, getPermissionsOnSheet, getPermissionsVectorOnBook, getPermissionsVectorOnSheet, getPort, getPrintableSheet, getRangeDisplay, getRangeDisplayAsVector, getRangeHTML, getRecalcIterationNumber, getRecalcMode, getRecalcType, getRowHeight, getRowHeight, getSelection, getSelections, getSelectionsAsVector, getSheetCount, getSheetIndexForName, getSheetName, getSheetNameAt, getSheetNames, getSheetNamesAsVector, getSheetWorkArea, getShowCellGrid, getShowExceptions, getShowFormatBar, getShowFormulaBar, getShowFreezePane, getShowGridComponents, getShowHeadings, getShowInfoDialogs, getShowPopupMenu, getShowStatusBar, getSortKeys, getSortKeysAsVector, getSortRange, getTableRange, getThrowExceptions, getTimeout, getTopLeftCell, getTracking, getTrackingDownColor, getTrackingDuration, getTrackingUpColor, getUserList, getUserListAsVector, getUserName, getUserPassword, getUsersForBook, getUsersForBookAsVector, init, insertBeforeSheet, insertDown, insertRight, insertSheetAt, invert, isBookOpen, isConnected, isLoggedOn, isPasswordSet, isPasteAble, isRedoAble, isSpecialPasteAble, isUndoAble, lostOwnership, main, messageSender, messageSenderSelectRecipient, modifySheetObserver, moveSheetDlg, moveSheetTo, multiply, newBook, newBook, newBookDlg, newBookFromTemplate, newBookFromTemplate, newCachedBook, newCachedBookFromTemplate, newChart, newChartAsBytes, newChartAsImage, nsolve, openBook, openBookDlg, openBookGetPwd, openCachedBook, paste, pasteArray, pasteSpecial, pasteSpecial, pasteSpecialDlg, pasteVector, print, printSelectedSheetRange, printSheet, processBookEvent, processSessionEvent, processSheetEvent, propsDlg, recalc, recalcNow, recalcRange, recalcTable, redo, regress, releaseCallback, removeBookListener, removeBookProtection, removePropertyChangeListener, removeProtection, removeRangeName, removeSessionListener, removeSheetListener, removeSheetObserver, removeSheetProtection, removeSortKeys, renameRangeName, renameSheetDlg, replaceAll, resetCallTimeout, saveAsDlg, saveBook, saveBookAsType, scrollToView, setActiveCell, setActiveSheet, setActiveSheetUsingString, setBGColor, setBGColor, setBookPassword, setCacheSize, setCallTimeout, setCellEntry, setCellNumber, setCellStyleForCell, setCellStyleForRange, setCellText, setCellValue, setColWidth, setConnectAtStartup, setFileName, setFreezePaneCell, setGridLineColor, setHeadingStyleR1C1, setHostName, setInitialSheet, setInputCell, setLoadbalance, setMessageSenderPopupState, setMessageViewerPopupState, setNamedRange, setOpenMode, setOpenNewBook, setOpenSheet, setPassword, setPort, setRangeEntryUsingArray, setRangeEntryUsingVector, setRangeNumberUsingArray, setRangeNumberUsingVector, setRangeTextUsingArray, setRangeTextUsingVector, setRangeValuesUsingArray, setRangeValuesUsingVector, setRecalcIterationNumber, setRecalcIterationRange, setRecalcMode, setRecalcType, setRowHeight, setSelectionUsingRange, setSelectionUsingRanges, setSheetNameAt, setSheetWorkArea, setShowCellGrid, setShowExceptions, setShowFormatBar, setShowFormatBarFlag, setShowFormulaBar, setShowFormulaBarFlag, setShowFreezePane, setShowGridComponents, setShowHeadings, setShowInfoDialogs, setShowPopupMenu, setShowStatusBar, setShowStatusBarFlag, setSortKeys, setSortRange, setStatusMsg, setTableRange, setThrowExceptions, setTimeout, setTopLeftCell, setTracking, setTrackingDownColor, setTrackingDuration, setTrackingUpColor, setUserName, setUserPassword, sortNow, start, stop, throwException, throwException, transpose, undo, warningMsg
 
Methods inherited from class java.applet.Applet
getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSClientSession

public JSClientSession()
Constructs a JSClient and adds self to instances.

Method Detail

_dbConnect

public JSDatabase _dbConnect(java.lang.String dbName,
                             java.lang.String userName,
                             java.lang.String password)
                      throws JSDbException
Connects to a database through JSServer.

Parameters:
dbName - The name of the database to which to connect.
userName - The name of the user to use when connecting.
password - The password for this user.
Returns:
the instance of JSDatabase created.
Throws:
JSDbException - An exception occurred while communicating with the server.

_getActiveSheet

public short _getActiveSheet()
                      throws JSException
Returns the current active sheet.

Returns:
The index of the active sheet.
Throws:
JSException - An exception occurred while communicating with the server.

_getBGColor

public java.awt.Color _getBGColor()
                           throws JSException
Returns the background color of the current sheet. Note that there's a known bug in returning objects from Java back to a calling method in JavaScript. Thus, this method should not be called from JavaScript. Instead, use the getBGColorRed/Green/Blue methods to retrieve the three colors as int's and then recreate the Color object using the createObject method. NOTE: _getCSheetView() must be called before this method.

Returns:
The background color of the current sheet.
Throws:
JSException - An exception occurred while communicating with the server.

_getCellDisplay

public java.lang.String _getCellDisplay(Cell cell)
                                 throws JSException
Returns the displayed text of the cell at row, column. If the cell contains a formula, then its result is returned. If the cell value is numeric, the returned value is a string form of the numeric. NOTE: _getCSheet() must be called before this method.

Parameters:
cell - The cell reference.
Returns:
The text displayed in the cell.
Throws:
JSException - An exception occurred while communicating with the server.

_getCellEntry

public java.lang.String _getCellEntry(Cell cell)
                               throws JSException
Returns the value of the cell at row, column. If the cell contains a formula, then the formula (not the resulting value) is returned. NOTE: _getSheet() must be called before this method.

Parameters:
cell - The cell reference.
Returns:
The cell value.
Throws:
JSException - An exception occurred while communicating with the server.

_getCellHTML

public java.lang.String _getCellHTML(Cell cell,
                                     int flags)
                              throws JSException
Returns the data in this cell as HTML. NOTE: _getSheet() must be called before this method.

Parameters:
cell - The cell reference.
flags - 0 = No HTML table tags, 1 = HTML table tags.
Returns:
The cell value as HTML.
Throws:
JSException - An exception occurred while communicating with the server.

_getCellStyle

public CellStyle _getCellStyle(Cell cell)
                        throws JSException
Returns the CellStyle object of the specified cell. NOTE: _getSheet() must be called before this method.

Parameters:
cell - The cell reference.
Returns:
The cell style for the specified cell.
Throws:
JSException - An exception occurred while communicating with the server.

_getCellValue

public JSValue _getCellValue(Cell cell)
                      throws JSException
Returns the data in this cell as a JSValue object.

Parameters:
cell - The cell reference.
Returns:
The data in this cell as a JSValue object.
Throws:
JSException - An exception occurred while communicating with the server.

_getChartAsBytes

public byte[] _getChartAsBytes(java.lang.String name,
                               int imgType,
                               short sheetIdx)
                        throws JSException
Returns chart bytes based on the chart name.

Parameters:
name - The name of the chart.
imgType - The image type to use. 1: GIF, 2: JPEG
sheetIdx - The sheet index.
Returns:
The byte array of the image.
Throws:
JSException - An exception occurred while communicating with the server.

_getColWidth

public int _getColWidth(int col)
                 throws JSException
Returns the column width, in pixels, for the specified column in the specified sheet. Col index 0 is used for row headers. NOTE: _getCSheetView() must be called before this method.

Parameters:
col - The column whose width is to be retrieved.
Returns:
The column width for the specified column.
Throws:
JSException - An exception occurred while communicating with the server.

_getCSheet

public com.iisc.jwc.orb.CSheet _getCSheet(short sheetIndex)
                                   throws JSException
Returns the CORBA CSheetView class

Throws:
JSException - An exception occurred while communicating with the server.

_getCSheetView

public com.iisc.jwc.orb.CSheetView _getCSheetView(short sheetIndex)
                                           throws JSException
Returns the CORBA CSheetView class

Throws:
JSException - An exception occurred while communicating with the server.

_getLastCell

public Cell _getLastCell(short sheetIndex,
                         int type,
                         int roworcol)
                  throws JSException
Returns the largest cell that is needed to contain all of the data in the sheet.

Parameters:
sheetIndex - The index of the sheet to reference.
type - 1: last row, 2: last col, 3: last row with data, 4: last col with data, 5: last cell, 6: last cell with data
roworcol - The column for last row (types 1 and 3), row for last column (types 2 and 4), and unused for types 5 and 6
Returns:
The cell reference of the last cell according to type given.
Throws:
JSException - An exception occurred while communicating with the server.

_getMyPermissionOnCell

public int _getMyPermissionOnCell(Cell cell)
                           throws JSException
Returns the permission settings for the current user for a specified cell within a specified sheet. A user must have read permission to view a cell and write permission to change a cell. Locked cells have no write permission. NOTE: _getSheet() must be called before this method.

Parameters:
cell - The cell on which to return protection information.
Returns:
The protection setting, which represents a combination of the following bit flags: PROTECTION_READ, PROTECTION_WRITE, PROTECTION_SAVE, PROTECTION_LOCK, and PROTECTION_GRANT.
Throws:
JSException - An exception occurred while communicating with the server.

_getNamedRange

public Range _getNamedRange(java.lang.String name)
                     throws JSException
Returns the range for the specified named range.

Parameters:
name - The name of the range.
Returns:
The range for the specified named range.
Throws:
JSException - An exception occurred while communicating with the server.

_getRangeDisplay

public java.lang.String[] _getRangeDisplay(Range range)
                                    throws JSException
Returns the displayed text of the range.

Parameters:
range - The range reference.
Returns:
The text displayed in the range.
Throws:
JSException - An exception occurred while communicating with the server.

_getRowHeight

public int _getRowHeight(int row)
                  throws JSException
Returns the row height, in pixels, for the specified row, in the specified sheet. Row index 0 is used for column headers. NOTE: _getCSheetView() must be called before this method.

Parameters:
row - The row whose height is to be retrieved.
Returns:
The height for the specified row.
Throws:
JSException - An exception occurred while communicating with the server.

_getSheet

public com.iisc.jwc.jsheet.ISheet _getSheet(short sheetIndex)
                                     throws JSException
Returns the requested sheet interface class

Parameters:
sheetIndex - the index of the sheet
Throws:
JSException - An exception occurred while communicating with the server.

_getSheetCount

public int _getSheetCount()
Returns the number of sheets in this book.

Returns:
The number of sheet in this book.

_getSheetIndex

public short _getSheetIndex(java.lang.String sheet)
                     throws JSException
Returns the sheet index based on the current sheet attribute.

Parameters:
sheet - the value of the sheet attribute.
Returns:
The sheet index.
Throws:
JSException - An exception occurred while communicating with the server.

_getSheetIndexForName

public short _getSheetIndexForName(java.lang.String sheetname)
                            throws JSException
Returns the sheet index for a sheet name.

Parameters:
sheetname - The name of the sheet for which an index is desired.
Returns:
The index for the sheet name.
Throws:
JSException - An exception occurred while communicating with the server.

_newChartAsBytes

public byte[] _newChartAsBytes(java.lang.String cdfFileName,
                               java.lang.String cdfText,
                               Range range,
                               int width,
                               int height)
                        throws JSException
Creates a new chart based on the chart definition file.

Parameters:
cdfFileName - The name of the chart definition file.
cdfText - The chart definition description.
range - The range to use for the data.
width - The width of the chart, in pixels.
height - The height of the chart, in pixels.
Returns:
A byte array of the image.
Throws:
JSException - An exception occurred while communicating with the server.

_setActiveSheet

public void _setActiveSheet(short sheet)
                     throws JSException
Sets the current active sheet.

Parameters:
sheet - The index of the sheet that is to be made active.
Throws:
JSException - An exception occurred while communicating with the server.

_setActiveSheetUsingString

public void _setActiveSheetUsingString(java.lang.String sheetname)
                                throws JSException
Sets the current active sheet. Note that setActiveSheet is not overloaded because JavaScript cannot handle overloaded methods that have the same number of parameters.

Parameters:
sheetname - The name of the sheet that is to be made active.
Throws:
JSException - An exception occurred while communicating with the server.

_setCellEntry

public void _setCellEntry(Cell cell,
                          java.lang.String data)
                   throws JSException
Sets the value of the cell. The server will determine what type of data was entered.

Parameters:
cell - The cell reference.
data - The data value.
Throws:
JSException - An exception occurred while communicating with the server.

activeCellChanged

public void activeCellChanged(SheetEvent e)
Invoked when the user selects a new cell.

Specified by:
activeCellChanged in interface SheetListener
Parameters:
e - getCell() returns the new active cell.

activeSheetChanged

public void activeSheetChanged(BookEvent e)
Invoked when the active sheet is changed.

Specified by:
activeSheetChanged in interface BookListener
Parameters:
e - getSheetIndex() returns the index of the new active sheet.

bookClosed

public void bookClosed(BookEvent e)
Invoked when this book is closed on the server while this client is still accessing it.

Specified by:
bookClosed in interface BookListener
Parameters:
e - the BookEvent, no extra parameters.

bookClosed

public void bookClosed(SessionEvent e)
Invoked when a book is closed by this client.

Specified by:
bookClosed in interface SessionListener
Parameters:
e - getName() returns the name of the book that was closed.

bookOpened

public void bookOpened(SessionEvent e)
Invoked when a book is opened by this client.

Specified by:
bookOpened in interface SessionListener
Parameters:
e - getName() returns the name of the book that was opened.

bookSaved

public void bookSaved(BookEvent e)
Invoked when the book is saved on the server.

Specified by:
bookSaved in interface BookListener
Parameters:
e - getName() returns the name of the user that saved the book.

cellStyleUpdated

public void cellStyleUpdated(SheetEvent e)
Invoked when the style of a cell that is being observed changes on the server.

Specified by:
cellStyleUpdated in interface SheetListener
Parameters:
e - getRange() returns the range and getStyleIndexes() returns array of indices for the styles applied.

cellValueUpdated

public void cellValueUpdated(SheetEvent e)
Invoked when the value of a cell that is being observed changes on the server.

Specified by:
cellValueUpdated in interface SheetListener
Parameters:
e - getSheetIndex() returns the sheet index and getCellData() returns the CCellData changed.

clientJoined

public void clientJoined(BookEvent e)
Invoked when another user first accesses this shared book.

Specified by:
clientJoined in interface BookListener
Parameters:
e - getName() returns the user name.

clientLeft

public void clientLeft(BookEvent e)
Invoked when another user stops accessing this book.

Specified by:
clientLeft in interface BookListener
Parameters:
e - getName() returns the user name.

colWidthUpdated

public void colWidthUpdated(SheetEvent e)
Invoked when a column size is changed.

Specified by:
colWidthUpdated in interface SheetListener
Parameters:
e - getSheetIndex() returns the sheet index, getStart() returns the starting row, getEnd() returns the ending row, and getSizes() returns an array of sizes for each of those columns.

connect

public void connect(java.lang.String host,
                    java.lang.String user,
                    java.lang.String pwd)
             throws JSException
Connects to the server.

Overrides:
connect in class JSClient
Parameters:
host - Hostname to which to connect.
user - User name to connect as.
pwd - User password.
Throws:
JSException - An exception occurred while connecting to the server.

deletedLeft

public void deletedLeft(SheetEvent e)
Invoked when a cell or column is deleted.

Specified by:
deletedLeft in interface SheetListener
Parameters:
e - getRange() returns the range that was deleted.

deletedUp

public void deletedUp(SheetEvent e)
Invoked when a cell or row is deleted.

Specified by:
deletedUp in interface SheetListener
Parameters:
e - getRange() returns the range that was deleted.

disconnect

public void disconnect()
                throws JSException
Disconnects from JSServer and remove self from instances.

Overrides:
disconnect in class JSClient
Throws:
JSException - An exception occurred while disconnecting from the server.

doubleClicked

public void doubleClicked(SheetEvent e)
Invoked when the user double-clicks in a cell.

Specified by:
doubleClicked in interface SheetListener
Parameters:
e - getCell() returns the cell that is double-clicked.

echo

public java.lang.String echo(java.lang.String echo)
Sends the string passed from the client back. This is for testing purposes.

Parameters:
echo - The string to return to the client.
Returns:
The string sent.

finalize

public void finalize()
Removes self from instances. Just in case.


getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the object bound with the specified name

Parameters:
name - A string specifying the name of the object.
Returns:
The object with the specified name.

getCellHTML

public java.lang.String getCellHTML(Cell cell,
                                    java.lang.Integer flags)
                             throws JSException
Wrapper for getCellHTML. This is here because getCellHTML takes a primative instead of an object. This makes the JSProxyClient not be able to call getCellHTML because of the method signatures needing to be objects.

Parameters:
cell - The cell reference.
flags - 0 = No HTML table tags, 1 = HTML table tags.
Returns:
The cell value as HTML.
Throws:
JSException - An exception occurred while communicating with the server.

getEvents

public java.io.ByteArrayOutputStream getEvents()
Returns the ByteArrayOutputStream containing the events that have been sent from JSServer. NOTE: If you change this name, change it in JSClientProxy servlet.

Returns:
the ByteArrayOutputStream containing the events.

getInstance

public static JSClientSession getInstance(java.lang.Object instanceID)
Get the instance of JSClient identified by the instance ID.

Parameters:
instanceID - the instance ID of the JSClient to return.
Returns:
the instance of JSClient.

getInstanceID

public java.lang.Object getInstanceID()
Get the instance ID of this JSClient.

Returns:
the instance ID.

insertedDown

public void insertedDown(SheetEvent e)
Invoked when a cell or row is inserted.

Specified by:
insertedDown in interface SheetListener
Parameters:
e - getRange() returns the range that was inserted.

insertedRight

public void insertedRight(SheetEvent e)
Invoked when a cell or column is inserted.

Specified by:
insertedRight in interface SheetListener
Parameters:
e - getRange() returns the range that was inserted.

jdate2wzdate

public long jdate2wzdate(long jdate)

killClient

public void killClient(SessionEvent e)
Invoked when a terminate message is sent from the server.

Specified by:
killClient in interface SessionListener
Parameters:
e - getFlag() returns true if the server has already cleaned up, and false if the client should clean up as quickly as possible.

leftColChanged

public void leftColChanged(SheetEvent e)
Invoked when the user scrolls the sheet left or right.

Specified by:
leftColChanged in interface SheetListener
Parameters:
e - getSheetIndex() returns the sheet index and getValue() returns the new left column.

lockJSClient

public boolean lockJSClient(java.lang.Object who)
Try and "lock" JSClient so no other instance can use this one by accident. NOTE: Only the object who locked this instance can unlock it, others will be ignored.

Returns:
true to indicate a "successful" lock, false to indicate that this instance is already in use.
See Also:
unlockJSClient(java.lang.Object)

messageReceived

public void messageReceived(SessionEvent e)
Invoked when a message is sent from the server to this client.

Specified by:
messageReceived in interface SessionListener
Parameters:
e - getSender() returns the name of the sender and getMsg() returns the message sent.

rangeStyleUpdated

public void rangeStyleUpdated(SheetEvent e)
Invoked when a range of values that is being observed changes on the server.

Specified by:
rangeStyleUpdated in interface SheetListener
Parameters:
e - getRange() returns the range and getStyleIndexes() returns array of indices for the styles applied.

removeAttribute

public void removeAttribute(java.lang.String name)
Removes the object bound with the specified name.

Parameters:
name - The name of the object to be removed.

removeInstance

public void removeInstance()
Remove this instance of JSClient from the list of JSClients.


removeInstance

public static JSClientSession removeInstance(java.lang.Object instanceID)
Remove the instance of JSClient identified from the list of JSClients being maintained.

Parameters:
instanceID - the instance ID of the JSClient to remove.

resetSheets

public void resetSheets()
Resets the internal information kept about "Sheets"


reverseEcho

public java.lang.String reverseEcho(java.lang.String echo)
Sends the string passed from the client back, reverse. This is for testing purposes.

Parameters:
echo - The string to send to the server.
Returns:
The string sent reversed.

rowHeightUpdated

public void rowHeightUpdated(SheetEvent e)
Invoked when a row size is changed.

Specified by:
rowHeightUpdated in interface SheetListener
Parameters:
e - getSheetIndex() returns the sheet index, getStart() returns the starting row, getEnd() returns the ending row, and getSizes() returns an array of sizes for each of those rows.

setAttribute

public void setAttribute(java.lang.String name,
                         java.lang.Object value)
Binds an object, using the name specified. If an object of the same name is already bound, the object is replaced.

Parameters:
name - The name to which the object is bound; cannot be null.
value - The object to be bound; cannot be null.

sheetInserted

public void sheetInserted(BookEvent e)
Invoked when a new sheet is inserted into the book.

Specified by:
sheetInserted in interface BookListener
Parameters:
e - getName(), getSheetIndex(), and getNameID() returns the new sheet name, new sheet index and net sheet internal ID.

sheetMoved

public void sheetMoved(BookEvent e)
Invoked when a sheet is moved in the book.

Specified by:
sheetMoved in interface BookListener
Parameters:
e - getFrom() and getTo() return the moved indices of the sheets.

sheetNameChanged

public void sheetNameChanged(BookEvent e)
Invoked when a sheet name changes in the book.

Specified by:
sheetNameChanged in interface BookListener
Parameters:
e - getName() and, getSheetIndex() return the new sheet name and the new sheet index.

sheetPropertiesUpdated

public void sheetPropertiesUpdated(SheetEvent e)
Invoked when one of the sheet properties has changed.

Specified by:
sheetPropertiesUpdated in interface SheetListener
Parameters:
e - getSheetIndex() reutnrs the sheet index and getSheetProperties() returns the CSheetProperties that have changed.

sheetRemoved

public void sheetRemoved(BookEvent e)
Invoked when a sheet is removed from the book.

Specified by:
sheetRemoved in interface BookListener
Parameters:
e - getSheetIndex() returns the index of the removed sheet.

start

public void start(boolean interactive)
Over-ridden to attach our listeners and prepare the event stream.


styleIndexCleared

public void styleIndexCleared(SheetEvent e)
Invoked when a style is no longer being used.

Specified by:
styleIndexCleared in interface SheetListener
Parameters:
e - getRange() returns the range and getStyleIndex() returns the index for the style that was cleared.

textModified

public void textModified(SheetEvent e)
Invoked when the value of the cell is being edited.

Specified by:
textModified in interface SheetListener
Parameters:
e - getCell() returns the cell and getEntryString() returns the new string in the cell.

topRowChanged

public void topRowChanged(SheetEvent e)
Invoked when the user scrolls the sheet down or up.

Specified by:
topRowChanged in interface SheetListener
Parameters:
e - getSheetIndex() returns the sheet index and getValue() returns the new top row.

unlockJSClient

public boolean unlockJSClient(java.lang.Object who)
Unlock the client so other instances can use this one. NOTE: Only the object who locked this instance can unlock it, others will be ignored.

Parameters:
who - the object that wants to unlock this JSClientSession.
Returns:
true if successfully unlock JSClient, false if failure.
See Also:
lockJSClient(java.lang.Object)

valueBound

public void valueBound(HttpSessionBindingEvent event)
Notifies the object that it is being bound to a session and identifies the session.

Parameters:
event - the event that identifies the session

valueUnbound

public void valueUnbound(HttpSessionBindingEvent event)
Notifies the object that it is being unbound from a session and identifies the session.

Parameters:
event - the event that identifies the session

wzdate2jdate

public long wzdate2jdate(double wzdate)

Email JSheet Support

www.jsheet.com
Copyright 1995 - 2003 Investment Intelligence Systems Limited.