S-PLUS Connect/Java v1.0

com.insightful.gdevice
Class SApplet

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by java.applet.Applet
                  extended by com.insightful.gdevice.SApplet
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class SApplet
extends Applet

The SApplet class displays S-PLUS Graphlets. This class draws the border, opens a stream to the Graphlet file, and provides information to JavaScript on the surrounding HTML page. It delegates most of the work to the SGui class.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.applet.Applet
Applet.AccessibleApplet
 
Nested classes/interfaces inherited from class java.awt.Panel
Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int BORDER_SIZE
           
protected  SGui m_gui
          The main panel that does most of the applet's work.
 
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
SApplet()
          Constructs an SApplet object (does nothing).
 
Method Summary
 void addPage()
          Add a new empty page at the end of the existing pages.
 void addSelectedTag(String tag)
          Select the specified tag.
 void clearSelectedTags()
          Clear all selected tags
 int getCurrentPageNumber()
          Get the page number for the currently-selected page.
 String getCurrentPageTag()
          Get the tag name for the currently-selected page.
 String getCurrentPageTagName()
          Get the tag name for the currently-selected page.
 String getGraphletVersionString()
           
 int getNumberPages()
          Return the number of pages/tabs in the graphlet.
 String getOption(String optionName)
           
 String getPageTag(int num)
          Get full page tag (which may be XML) for a given page number (1-based).
 String getPageTagName(int num)
          Get page tag name for a given page number (1-based).
 String getPageTitle(int num)
          Get page title for a given page number (1-based).
 int getPageWithTagName(String name)
          Get page number (1-based) with a given tag name.
 String getRectTags(String rectString)
          Return all tags within the specified rectangle.
 String getSelectedTags()
          Returns the tags of the selected active regions, if any.
 String getSelectionRect()
          Returns a string giving the last rectangle swept within the current page.
 String getSelectionRectKeys()
          Return whether the shift and/or control keys were pressed during the last selection rectangle.
 String getSelectionRectTags()
          Return all tags within the current selection rectangle.
 double getZoom()
          Return current zoom factor.
 void init()
          Initializes the applet.
 void insertPage(int num)
          Add a new empty page at a specified page number (1-based).
 boolean isSelectedTag(String tag)
          Returns true is the specified tag is selected.
protected  InputStream openGraphStream(String spjFileName)
          Opens an input stream to the specified Graphlet file.
 void removeAllPages()
          Remove all pages.
 void removePage(int num)
          Remove a specified page (1-based).
 void removeSelectedTag(String tag)
          Unselect the specified tag
 void selectTagsFromSelectionRect()
          select tags according to last selection rectangle and modifier keys.
 void setCurrentPageBack()
          Switch the currently-selected page to the last one viewed.
 void setCurrentPageByNumber(int num)
          Set the currently-selected page to the one with the given number.
 void setCurrentPageByTag(String name)
          Set the current-selected page to the one with the given tag name.
 void setCurrentPageByTagName(String name)
          Set the current-selected page to the one with the given tag name.
 void setCurrentPageForward()
          Switch the currently-selected page to the next one viewed.
protected  void setGraphics2DFlag()
           
 void setOption(String optionName, String optionValue)
          Set options from option dialog.
 void setPageTag(int num, String tag)
          Set full page tag (which may be XML) for a given page number (1-based).
 void setPageTitle(int num, String title)
          Set page title for a given page number (1-based).
 void setSelectedTags(String tags)
          Sets the tags of the selected active regions.
 void setSelectionRect(String rectString)
          Set selection rectangle.
 void setSelectionRectKeys(String keyString)
          Sets the key flags for the current selection rectangle.
 void setZoom(double factor)
          Set zoom factor.
 void setZoomToRect(String rectString)
          Zoom to show specified rectangle.
 void setZoomToSelectionRect()
          Zoom to last selection rectangle.
 void showHelpDialog()
          Display popup help dialog.
 void showOptionsDialog()
          Display popup dialog showing the options.
 void showPrintDialog()
          Display popup print dialog.
 void toggleSelectedTag(String tag)
          Toggle the state of the specified tag
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start, stop
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, 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, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, 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

m_gui

protected SGui m_gui
The main panel that does most of the applet's work.


BORDER_SIZE

public static final int BORDER_SIZE
See Also:
Constant Field Values
Constructor Detail

SApplet

public SApplet()
Constructs an SApplet object (does nothing).

Method Detail

init

public void init()
Initializes the applet. Specifically, this method draws a black border and places an SGui object in the center. It then opens an input stream to the Graphlet file and passes it to the SGui object.

Overrides:
init in class Applet

setGraphics2DFlag

protected void setGraphics2DFlag()

openGraphStream

protected InputStream openGraphStream(String spjFileName)
Opens an input stream to the specified Graphlet file. The methods looks in three places for the file and uses the first file it finds with the specified name. The three places it looks are the code base (where the applet came from), the document base (where the HTML page came from), and the downloaded jar file.

(gsn) The method now checks the code base before checking the document base. This order seems to be more convenient in Analytic Server Web applications.

Parameters:
spjFileName - name of the Graphlet file.
Returns:
an input stream to the file, or null if the file could not be found.

getGraphletVersionString

public String getGraphletVersionString()

getSelectedTags

public String getSelectedTags()
Returns the tags of the selected active regions, if any. These tags are consolidated into a single string, separated by commas. JavaScript on the surrounding HTML page can call this method to get the tags, and perhaps return them to the server in an HTTP POST command to run another analytic.

Returns:
tags of the selected rectangles.

setSelectedTags

public void setSelectedTags(String tags)
Sets the tags of the selected active regions. These tags are consolidated into a single string, separated by commas. JavaScript on the surrounding HTML page can call this method to set the tags.

Parameters:
tags - multiple tags, separated by commas.

getCurrentPageTag

public String getCurrentPageTag()
Get the tag name for the currently-selected page.

Returns:
tag string.

getCurrentPageTagName

public String getCurrentPageTagName()
Get the tag name for the currently-selected page.

Returns:
tag string.

getCurrentPageNumber

public int getCurrentPageNumber()
Get the page number for the currently-selected page. This is 1-based: the first page is 1.

Returns:
current page number.

getNumberPages

public int getNumberPages()
Return the number of pages/tabs in the graphlet.

Returns:
number of pages.

setCurrentPageByTag

public void setCurrentPageByTag(String name)
Set the current-selected page to the one with the given tag name.

Parameters:
name - page name.

setCurrentPageByTagName

public void setCurrentPageByTagName(String name)
Set the current-selected page to the one with the given tag name.

Parameters:
name - page name.

setCurrentPageByNumber

public void setCurrentPageByNumber(int num)
Set the currently-selected page to the one with the given number. This is 1-based: the first page is 1.

Parameters:
num - page number.

setCurrentPageBack

public void setCurrentPageBack()
Switch the currently-selected page to the last one viewed. A list of previously-selected pages is kept.


setCurrentPageForward

public void setCurrentPageForward()
Switch the currently-selected page to the next one viewed. This does nothing unless we switched to the current page via the setCurrentPageBack() function.


getPageWithTagName

public int getPageWithTagName(String name)
Get page number (1-based) with a given tag name. Returns 0 if no page has the specified tag name.

Parameters:
name - page tag name.
Returns:
1-based page number.

getPageTagName

public String getPageTagName(int num)
Get page tag name for a given page number (1-based). Returns "" if num is not an existing page number.

Parameters:
num - 1-based page number.
Returns:
page tag name.

getPageTag

public String getPageTag(int num)
Get full page tag (which may be XML) for a given page number (1-based). Returns "" if num is not an existing page number.

Parameters:
num - 1-based page number.
Returns:
page tag string.

getPageTitle

public String getPageTitle(int num)
Get page title for a given page number (1-based). Returns "" if num is not an existing page number.

Parameters:
num - 1-based page number.
Returns:
page tab title.

setPageTag

public void setPageTag(int num,
                       String tag)
Set full page tag (which may be XML) for a given page number (1-based). Does nothing if num is not an existing page number.

Parameters:
num - 1-based page number.
tag - page tag string.

setPageTitle

public void setPageTitle(int num,
                         String title)
Set page title for a given page number (1-based). Does nothing if num is not an existing page number.

Parameters:
num - 1-based page number.
title - page tab title.

removePage

public void removePage(int num)
Remove a specified page (1-based).

Parameters:
num - 1-based page number.

removeAllPages

public void removeAllPages()
Remove all pages.


insertPage

public void insertPage(int num)
Add a new empty page at a specified page number (1-based). The new page will have page number num. if num<1 or num>#pages+1, will add page at beginning or end respectively.

Parameters:
num - 1-based page number.

addPage

public void addPage()
Add a new empty page at the end of the existing pages.


clearSelectedTags

public void clearSelectedTags()
Clear all selected tags


addSelectedTag

public void addSelectedTag(String tag)
Select the specified tag.

Parameters:
tag - single string tag.

removeSelectedTag

public void removeSelectedTag(String tag)
Unselect the specified tag

Parameters:
tag - single string tag.

toggleSelectedTag

public void toggleSelectedTag(String tag)
Toggle the state of the specified tag

Parameters:
tag - single string tag.

isSelectedTag

public boolean isSelectedTag(String tag)
Returns true is the specified tag is selected.

Parameters:
tag - single string tag.
Returns:
true if the tag is selected.

getSelectionRect

public String getSelectionRect()
Returns a string giving the last rectangle swept within the current page.

Returns:
last rectangle coordinates (as a par-fig string)

setSelectionRect

public void setSelectionRect(String rectString)
Set selection rectangle.

Parameters:
rectString - new selection rectangle (as a par-fig string)

getZoom

public double getZoom()
Return current zoom factor. Value 1.0 is the initial fill size.

Returns:
Current zoom factor.

setZoom

public void setZoom(double factor)
Set zoom factor. If f==1, resize to initial size, filling graphlet with no scrollbars. When zoom factor is changed, tries to zoom in/out of center of window. "In button" ==> setZoom(getZoom()*1.5) "Out button" ==> setZoom(getZoom()/1.5)

Parameters:
factor - Zoom factor.

setZoomToRect

public void setZoomToRect(String rectString)
Zoom to show specified rectangle. Can also be used to pan.

Parameters:
rectString - rectangle to zoom to (as a par-fig string)

setZoomToSelectionRect

public void setZoomToSelectionRect()
Zoom to last selection rectangle.


getSelectionRectTags

public String getSelectionRectTags()
Return all tags within the current selection rectangle.

Returns:
comma-separated tags.

getRectTags

public String getRectTags(String rectString)
Return all tags within the specified rectangle.

Parameters:
rectString - a rectangle (as a par-fig string)
Returns:
comma-separated tags.

getSelectionRectKeys

public String getSelectionRectKeys()
Return whether the shift and/or control keys were pressed during the last selection rectangle.

Returns:
The string "shift", "control", "shift,control", or "".

setSelectionRectKeys

public void setSelectionRectKeys(String keyString)
Sets the key flags for the current selection rectangle. If the argument contains "shift" and/or "control", the corresponding flags are set.

Parameters:
keyString - keys to select.

selectTagsFromSelectionRect

public void selectTagsFromSelectionRect()
select tags according to last selection rectangle and modifier keys.


showOptionsDialog

public void showOptionsDialog()
Display popup dialog showing the options.


setOption

public void setOption(String optionName,
                      String optionValue)
Set options from option dialog. option: value: displayMousePosition "true", "false" mousePositionDigits integer (default 2) enableActiveRegions "true", "false" displayPageTabs "true", "false" printSelectedRegions "true", "false" printPage "view", "one", "all" view ==> print zoomed view of current page. one ==> print unzoomed view of current page. all ==> print unzoomed view of all pages

Parameters:
optionName - option name.
optionValue - value, as a string.

getOption

public String getOption(String optionName)

showPrintDialog

public void showPrintDialog()
Display popup print dialog.


showHelpDialog

public void showHelpDialog()
Display popup help dialog.


S-PLUS Connect/Java v1.0

Copyright © 2000, 2002 Insightful Corporation
Warning: Classes not documented in the S-PLUS Programmer's Guide may change in future releases.