com.iisc.jwc.jschart
Class JSChart

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended bycom.iisc.jwc.jschart.JSChart
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class JSChart
extends java.applet.Applet
implements java.awt.image.ImageObserver

JSChart is an applet to display charts from the JSServer.

See Also:
Serialized Form

Field Summary
 
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
JSChart()
          Constructs a JSChart applet.
JSChart(java.lang.String[] args)
          Constructs a JSChart with the specified paramaters.
 
Method Summary
 void connect()
          Attempts a connection to the server using the host, user, and password parameters provided by the set methods.
 void connect(java.lang.String host, java.lang.String user, java.lang.String password)
          Attempts a connection to the server using the host, user, and password parameters provided by the user.
 boolean connected()
          Returns true if JSChart is connected to the server or false if it is not connected.
 void deleteChart()
          Deletes a chart referenced from values contained in the set methods.
 void destroy()
          Called by the browser or applet viewer to inform this applet that it is being reclaimed and that it should destroy any resources that it has allocated.
 void disconnect()
          Disconnect from the server.
 void displayError(java.lang.String str)
          Display a message instead of a chart image.
 void drawChart()
          Draws a chart using information obtained from set methods.
 void drawNewChart()
          Allows the user to create a new chart using the information obtained from set methods.
 java.lang.String getBackgroundColor()
          Returns the background color string.
 java.lang.String getBookName()
          Returns the name of the book the chart references.
 java.lang.String getBookPassword()
          Returns the book's password.
 java.lang.String getChartName()
          Returns the name of the chart to reference.
 java.lang.String getHost()
          Returns the name of the host for this session.
 java.lang.String getPassword()
          Returns the user's password for this session.
 int getPort()
          Returns the host port number for this session.
 java.lang.String getRange()
          Returns the chart range the user specified.
 java.lang.String getSheetName()
          Returns the name of the sheet the chart references.
 boolean getSmartFit()
          Returns true or false depending on whether smart fit is enabled or not.
 java.lang.String getTemplateName()
          Returns the name of the chart template the user specified.
 int getThrottle()
          Returns the number of seconds the client will wait before responding to a server chart update.
 boolean getThrowExceptions()
          Returns true or false depending on whether exceptions are being thrown or not.
 java.lang.String getUser()
          Returns the name of the user for this session.
 boolean imageUpdate(java.awt.Image img, int infoflags, int x, int y, int width, int height)
          Repaints the component when the image has changed.
 void init()
          Called by the browser or applet viewer to inform this applet that it has been loaded into the system.
static void main(java.lang.String[] args)
          Launches JSChart as an application.
 void paint(java.awt.Graphics g)
          Paints this component.
 void setBackgroundColor(java.lang.String rgb)
          Specifies the background color using this method.
 void setBookName(java.lang.String bookname)
          Specify the book the chart is located in.
 void setBookPassword(java.lang.String password)
          Specifies the book password.
 void setChartName(java.lang.String chartname)
          Specifies the name of the chart.
 void setHost(java.lang.String host)
          Sets the hostname for this session.
 void setPassword(java.lang.String password)
          Sets the password for this session.
 void setPort(int port)
          Sets the port number for this session.
 void setRange(java.lang.String range)
          Specifies the range the chart should reference when creating a new chart.
 void setSheetName(java.lang.String sheetname)
          Specifies the sheet in which the chart is located.
 void setSmartFit(boolean smartfit)
          Specifies whether to attempt to smart fit the chart to the space available.
 void setTemplateName(java.lang.String templatename)
          Specifies the name and path of the chart template.
 void setThrottle(int secs)
          Sets the number of seconds the client will wait before responding to a server chart update.
 void setThrowExceptions(boolean throwexceptions)
          Specifies whether JSChart should throw exceptions to the calling application.
 void setUser(java.lang.String user)
          Sets the user for this session.
 void start()
          Called by the browser or applet viewer to inform this applet that it should start its execution.
 void stop()
          Called by the browser or applet viewer to inform this applet that it should stop its execution.
 void update(java.awt.Graphics g)
          The AWT calls the update method in response to a call to repaint.
 void updateImage()
           
 
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.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, 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, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, 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, 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, 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

JSChart

public JSChart()
Constructs a JSChart applet. The applet parameters are automatically detected.


JSChart

public JSChart(java.lang.String[] args)
        throws java.lang.Exception
Constructs a JSChart with the specified paramaters. The constructor is used when JSChart is a standalone application.

Parameters:
args - Command line arguments.
Throws:
java.lang.Exception - Used to indicate that the "usage" has been presented to the user or bad option(s).
Method Detail

connect

public void connect()
             throws com.iisc.jwc.jschart.ChartException
Attempts a connection to the server using the host, user, and password parameters provided by the set methods. If there is already a connection to the server, then the call is ignored. To reconnect the user should call the disconnect() method first.

Throws:
ChartException - An excption occured while connecting to the server.

connect

public void connect(java.lang.String host,
                    java.lang.String user,
                    java.lang.String password)
             throws com.iisc.jwc.jschart.ChartException
Attempts a connection to the server using the host, user, and password parameters provided by the user. If there is already a connection to the server, then the call is ignored. To reconnect, the user should call the disconnect() method first.

Parameters:
host - Name of JSServer machine.
user - JSServer user.
password - The user password.
Throws:
ChartException - An excption occured while connecting to the server.

connected

public boolean connected()
Returns true if JSChart is connected to the server or false if it is not connected.

Returns:
True if JSChart is connected to the server or false if it is not connected.

deleteChart

public void deleteChart()
                 throws com.iisc.jwc.jschart.ChartException
Deletes a chart referenced from values contained in the set methods.

Throws:
ChartException - An exception occured while deleting the chart.

destroy

public void destroy()
Called by the browser or applet viewer to inform this applet that it is being reclaimed and that it should destroy any resources that it has allocated. The stop method will always be called before destroy.


disconnect

public void disconnect()
                throws com.iisc.jwc.jschart.ChartException
Disconnect from the server.

Throws:
ChartException - An excption occured while disconnecting from the server.

displayError

public void displayError(java.lang.String str)
Display a message instead of a chart image.

Parameters:
str - The error message to display.

drawChart

public void drawChart()
               throws com.iisc.jwc.jschart.ChartException
Draws a chart using information obtained from set methods.

Throws:
ChartException - An exception occured while drawing the chart.

drawNewChart

public void drawNewChart()
                  throws com.iisc.jwc.jschart.ChartException
Allows the user to create a new chart using the information obtained from set methods.

Throws:
ChartException - An exception occured while drawing the chart.

getBackgroundColor

public java.lang.String getBackgroundColor()
Returns the background color string.

Returns:
The background color.

getBookName

public java.lang.String getBookName()
Returns the name of the book the chart references.

Returns:
The name of the book.

getBookPassword

public java.lang.String getBookPassword()
Returns the book's password.

Returns:
The book's password

getChartName

public java.lang.String getChartName()
Returns the name of the chart to reference.

Returns:
The name of the chart.

getHost

public java.lang.String getHost()
Returns the name of the host for this session.

Returns:
The host name.

getPassword

public java.lang.String getPassword()
Returns the user's password for this session.

Returns:
The user's password.

getPort

public int getPort()
Returns the host port number for this session. If the result is 0, then the default port will be used.

Returns:
The port number for the session.

getRange

public java.lang.String getRange()
Returns the chart range the user specified.

Returns:
The chart range

getSheetName

public java.lang.String getSheetName()
Returns the name of the sheet the chart references.

Returns:
The name of the sheet.

getSmartFit

public boolean getSmartFit()
Returns true or false depending on whether smart fit is enabled or not.

Returns:
True or false depending on whether smart fit is enabled or not.

getTemplateName

public java.lang.String getTemplateName()
Returns the name of the chart template the user specified.

Returns:
The name of the chart template.

getThrottle

public int getThrottle()
Returns the number of seconds the client will wait before responding to a server chart update.

Returns:
The number of seconds

getThrowExceptions

public boolean getThrowExceptions()
Returns true or false depending on whether exceptions are being thrown or not.

Returns:
True or false depending on whether exceptions are being thrown.

getUser

public java.lang.String getUser()
Returns the name of the user for this session.

Returns:
The user name.

imageUpdate

public boolean imageUpdate(java.awt.Image img,
                           int infoflags,
                           int x,
                           int y,
                           int width,
                           int height)
Repaints the component when the image has changed. This imageUpdate method of an ImageObserver is called when more information about an image which had been previously requested using an asynchronous routine such as the drawImage method of Graphics becomes available. See the definition of imageUpdate for more information on this method and its arguments. The imageUpdate method of Component incrementally draws an image on the component as more of the bits of the image are available. If the system property awt.image.incrementalDraw is missing or has the value true, the image is incrementally drawn, If the system property has any other value, then the image is not drawn until it has been completely loaded. Also, if incremental drawing is in effect, the value of the system property awt.image.redrawrate is interpreted as an integer to give the maximum redraw rate, in milliseconds. If the system property is missing or cannot be interpreted as an integer, the redraw rate is once every 100ms. The interpretation of the x, y, width, and height arguments depends on the value of the infoflags argument.

Specified by:
imageUpdate in interface java.awt.image.ImageObserver
Parameters:
img - The image being observed.
infoflags - The bitwise inclusive OR of the following flags: WIDTH, HEIGHT, PROPERTIES, SOMEBITS, FRAMEBITS, ALLBITS, ERROR, ABORT
x - The x coordinate.
y - The y coordinate.
width - The width.
height - The height.
Returns:
true if the flags indicate that the image is completely loaded; false otherwise.

init

public void init()
Called by the browser or applet viewer to inform this applet that it has been loaded into the system. It is always called before the first time that the start method is called.


main

public static void main(java.lang.String[] args)
Launches JSChart as an application.
Command Line ArgumentDescription
booknameThe workbook filename
bookpasswordThe workbook password
booknameThe workbook filename
sheetnameThe workbook sheet name
chartnameThe name of the chart on the sheet
charttemplateTemplate filename for creating new chart
chartrangeThe chart range when creating new chart
smartfitBest fit algorithm for available space
stretchfitChart stretched to fit application area
throttleNumber of seconds to throttle updates
backgroundBackground application color (html ref)
throwexceptionsEnable throwing exceptions

Parameters:
args - Command line arguments.

paint

public void paint(java.awt.Graphics g)
Paints this component. This method is called when the contents of the component should be painted in response to the component first being shown or damage needing repair. The clip rectangle in the Graphics parameter will be set to the area which needs to be painted.

Parameters:
g - The graphics context to use for painting. .

setBackgroundColor

public void setBackgroundColor(java.lang.String rgb)
Specifies the background color using this method. The background color is used if the chart is not stretched to fit the entire canvas.

Parameters:
rgb - Hexidecimal or octal string with defining background rgb.

setBookName

public void setBookName(java.lang.String bookname)
Specify the book the chart is located in.

Parameters:
bookname - The name of the book including the optional path.

setBookPassword

public void setBookPassword(java.lang.String password)
Specifies the book password.

Parameters:
password - The book password

setChartName

public void setChartName(java.lang.String chartname)
Specifies the name of the chart. The chart name may be specified in any case.

Parameters:
chartname - The name of the chart.

setHost

public void setHost(java.lang.String host)
Sets the hostname for this session. If a session already exists and the host differs, then the existing session will be closed.

Parameters:
host - The name of the host machine.

setPassword

public void setPassword(java.lang.String password)
Sets the password for this session. If a session already exists and the password differs, then the existing session will be closed.

Parameters:
password - The user password.

setPort

public void setPort(int port)
Sets the port number for this session. If a session already exists and the port differs, then the existing session will be closed. If the number supplied is 0, then the default port will be used.

Parameters:
port - The port number to connect to on the host machine.

setRange

public void setRange(java.lang.String range)
Specifies the range the chart should reference when creating a new chart.

Parameters:
range - The chart range

setSheetName

public void setSheetName(java.lang.String sheetname)
Specifies the sheet in which the chart is located. The sheet name may be specified in any case.

Parameters:
sheetname - The name of the sheet.

setSmartFit

public void setSmartFit(boolean smartfit)
Specifies whether to attempt to smart fit the chart to the space available. If smart fitting is enabled then the chart image will be centered in the available space. If the chart is larger than the available space, it will be stretched. If smart fitting is disabled, then the chart will be stretched to the available space.

Parameters:
smartfit - True if smart fit required, false if not.

setTemplateName

public void setTemplateName(java.lang.String templatename)
Specifies the name and path of the chart template.

Parameters:
templatename - The name of the chart template.

setThrottle

public void setThrottle(int secs)
Sets the number of seconds the client will wait before responding to a server chart update. There are two special values. If the user supplies a value of 0, then the client will perform no throttling. This means that as soon as the client is notified of an update the chart is updated. The other special value is -1 which will prevents any chart image updates.

Parameters:
secs - Number of seconds between chart updates.

setThrowExceptions

public void setThrowExceptions(boolean throwexceptions)
Specifies whether JSChart should throw exceptions to the calling application. If JSChart does not throw exceptions, it will still display the error on the chart area.

Parameters:
throwexceptions - True if chart exceptions should be thrown; false if not.

setUser

public void setUser(java.lang.String user)
Sets the user for this session. If a session already exists and the user differs, then the existing session will be closed.

Parameters:
user - The user name.

start

public void start()
Called by the browser or applet viewer to inform this applet that it should start its execution. It is called after the init method and each time the applet is revisited in a Web page.


stop

public void stop()
Called by the browser or applet viewer to inform this applet that it should stop its execution. It is called when the Web page that contains this applet has been replaced by another page, and also just before the applet is to be destroyed.


update

public void update(java.awt.Graphics g)
The AWT calls the update method in response to a call to repaint. The appearance of the component on the screen has not changed since the last call to update or paint. You can assume that the background is not cleared.

Parameters:
g - The specified context to use for updating.

updateImage

public void updateImage()

Email JSheet Support

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