S-PLUS Connect/Java v1.0

com.insightful.gdevice
Class SGui

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by com.insightful.gdevice.SGui
All Implemented Interfaces:
SCanvasPaneController.ContextMenuAccess, SCanvasPaneController.EmbeddedFileAccess, SCanvasPaneView, SCanvasPaneView2, ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class SGui
extends Panel
implements ActionListener, SCanvasPaneView2, SCanvasPaneController.EmbeddedFileAccess, SCanvasPaneController.ContextMenuAccess

See Also:
Serialized Form

Nested Class Summary
protected  class SGui.MessageDialog
          A MessageDialog gives information to the user.
static class SGui.SGuiPrintable
           
 
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
 boolean m_printMultiplePages
           
 boolean m_printSelectedRegions
           
 boolean m_printUnzoomedPages
           
 
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
SGui()
           
SGui(Applet app)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
           
 void addCanvas(SCanvasAWT canvas)
           
 void addCanvas(SCanvasAWT canvas, int num)
           
 void addPage()
           
 void addSelectedTag(String tag)
           
 void clearSelectedTags()
           
protected  void constructMenu(Menu menu, STreeNode rootLabels, STreeNode rootActions)
           
 boolean doContextMenu(int x, int y)
           
 void doExec(String code, String language)
           
 void doHitError(String action, String errorString)
           
 void doHitMenu(STreeNode rootLabels, STreeNode rootActions, int x, int y)
           
 void doHitMenu(String title, String[] labels, String[] actions, int x, int y)
           
 boolean doHitQueryWebService(XMLElement elt, STreeNode rootLabels, STreeNode rootActions, boolean bShowErrorDialog)
          Queries a web service to obtain menu items to display.
 void doHitURL(String urlString, String target)
           
 void doPrintJobPrint()
           
 Component getCanvasComponent()
           
static Color getColorFromString(String strColor)
          Creates a color object as specified by a string.
 SCanvasPaneController getController()
           
 int getCurrentPageNumber()
           
 String getCurrentPageTagName()
           
 Vector getEmbeddedCanvasVector(String embeddedFile)
           
 int getNumberPages()
           
 boolean getOptionDisplayMousePosition()
           
 boolean getOptionDisplayPageTabs()
           
 boolean getOptionEnableActiveRegions()
           
 int getOptionMousePositionDigits()
           
 boolean getOptionPrintMultiplePages()
           
 boolean getOptionPrintSelectedRegions()
           
 boolean getOptionPrintUnzoomedPage()
           
 String getPageTag(int num)
           
 String getPageTagName(int num)
           
 String getPageTitle(int num)
           
 int getPageWithTagName(String tag)
           
 Adjustable getScrollAdjustable(int orientation)
           
 Scrollbar getScrollbar(int orientation)
           
 boolean getScrollVisible(int orientation)
           
 String[] getSelectedTags()
          Returns the tags of the selected rectangles, if any.
 SCanvasRectangle getSelectionRect()
           
 boolean getSelectionRectControlDown()
           
 boolean getSelectionRectShiftDown()
           
protected  String getSoapFromAction(XMLElement elt)
          Constructs a SOAP query from a <query> action element.
 Component getTabComponent()
           
 int getTabCount()
           
 String[] getTagsInRect(SCanvasRectangle rect)
           
 Frame getTopLevelFrame()
           
protected  String getXsiType(String strType)
          Determines the xsi:type for the specified input type.
 double getZoom()
           
 void insertPage(int num)
           
 boolean isSelectedTag(String tag)
           
 void loadInputStream(InputStream graphStream)
           
protected  void parseSoapResponse(String strSoapResponse, STreeNode rootLabels, STreeNode rootActions, String strTarget)
          Parses the SOAP response.
 void prepareEmbeddedCanvas(SCanvasAWT canvas)
           
 boolean propContextMenu()
           
 boolean propGraphOnly()
           
protected  String queryWebService(String strURL, String strSoap, boolean bShowErrorDialog)
          Sends a soap request to the web service at the specified URL and returns the response.
 void removeAllPages()
           
 void removePage(int num)
           
 void removeSelectedTag(String tag)
           
 void selectTagsFromSelectionRect()
           
 void setCurrentPageBack()
           
 void setCurrentPageByNumber(int num)
           
 void setCurrentPageByTagName(String tag)
           
 void setCurrentPageForward()
           
 void setOptionDisplayMousePosition(boolean val)
           
 void setOptionDisplayPageTabs(boolean val)
           
 void setOptionEnableActiveRegions(boolean val)
           
 void setOptionMousePositionDigits(int val)
           
 void setOptionPrintMultiplePages(boolean val)
           
 void setOptionPrintSelectedRegions(boolean val)
           
 void setOptionPrintUnzoomedPage(boolean val)
           
 void setPageTag(int num, String tag)
           
 void setPageTitle(int num, String title)
           
 void setScrollVisible(int orientation, boolean visible)
           
 void setSelectedTags(String[] tags)
          Sets the tags of the selected rectangles.
 void setSelectionRect(SCanvasRectangle rect)
           
 void setSelectionRectControlDown(boolean val)
           
 void setSelectionRectShiftDown(boolean val)
           
 void setZoom(double val)
           
 void setZoomToRect(SCanvasRectangle rect)
           
 void showMessageDialog(String strTitle, Component strMessage)
           
 void showMessageDialog(String strTitle, String strMessage)
           
 void toggleSelectedTag(String tag)
           
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
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, getLocale, 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, resize, resize, 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_printMultiplePages

public boolean m_printMultiplePages

m_printUnzoomedPages

public boolean m_printUnzoomedPages

m_printSelectedRegions

public boolean m_printSelectedRegions
Constructor Detail

SGui

public SGui()

SGui

public SGui(Applet app)
Method Detail

getController

public SCanvasPaneController getController()

getCanvasComponent

public Component getCanvasComponent()
Specified by:
getCanvasComponent in interface SCanvasPaneView

getTabComponent

public Component getTabComponent()
Specified by:
getTabComponent in interface SCanvasPaneView

getScrollAdjustable

public Adjustable getScrollAdjustable(int orientation)
Specified by:
getScrollAdjustable in interface SCanvasPaneView

getScrollbar

public Scrollbar getScrollbar(int orientation)

getScrollVisible

public boolean getScrollVisible(int orientation)
Specified by:
getScrollVisible in interface SCanvasPaneView

setScrollVisible

public void setScrollVisible(int orientation,
                             boolean visible)
Specified by:
setScrollVisible in interface SCanvasPaneView

doHitURL

public void doHitURL(String urlString,
                     String target)
Specified by:
doHitURL in interface SCanvasPaneView

doHitMenu

public void doHitMenu(String title,
                      String[] labels,
                      String[] actions,
                      int x,
                      int y)
Specified by:
doHitMenu in interface SCanvasPaneView

doHitMenu

public void doHitMenu(STreeNode rootLabels,
                      STreeNode rootActions,
                      int x,
                      int y)
Specified by:
doHitMenu in interface SCanvasPaneView2

constructMenu

protected void constructMenu(Menu menu,
                             STreeNode rootLabels,
                             STreeNode rootActions)

doHitQueryWebService

public boolean doHitQueryWebService(XMLElement elt,
                                    STreeNode rootLabels,
                                    STreeNode rootActions,
                                    boolean bShowErrorDialog)
                             throws Exception
Queries a web service to obtain menu items to display. This method is in SGui rather than SCanvasPaneController as it is implemented only for the applet, not for the S-PLUS Java GUI.

Specified by:
doHitQueryWebService in interface SCanvasPaneView2
Parameters:
elt - the XML action string specifying the web service and the method to call.
rootLabels - tree of labels to display on menu.
rootActions - tree of actions associated with the labels.
bShowErrorDialog - whether to pop up a message box to inform the user if a network error occurs. (This will generally be true unless one has already popped up for the same overall menu.)
Returns:
true unless a network error prevented querying the web service.
Throws:
Exception - if elt contains an error or the web service returns an error.

getSoapFromAction

protected String getSoapFromAction(XMLElement elt)
                            throws Exception
Constructs a SOAP query from a <query> action element.

Returns:
the SOAP query as an XML string.
Throws:
Exception - if the method and namespace attributes are not both present.

getXsiType

protected String getXsiType(String strType)
Determines the xsi:type for the specified input type. For now we assume all inputs have type xsd:string, regardless what type was specified. We might change this in the future to allow more types.


queryWebService

protected String queryWebService(String strURL,
                                 String strSoap,
                                 boolean bShowErrorDialog)
                          throws MalformedURLException,
                                 NullPointerException,
                                 Exception
Sends a soap request to the web service at the specified URL and returns the response. If a network error prevents the SOAP query from working, this method displays a message box to inform the user. All other errors result in exceptions.

Parameters:
strURL - the URL for the web service.
strSoap - the SOAP string to for the query.
bShowErrorDialog - whether to pop up a message box to inform the user if a network error occurs. (This will generally be true unless one has already popped up for the same overall menu.)
Throws:
MalformedURLException - if the specified URL doesn't make sense.
NullPointerException - if a connection cannot be opened to the URL.
Exception - if the web service returns a SOAP fault.

parseSoapResponse

protected void parseSoapResponse(String strSoapResponse,
                                 STreeNode rootLabels,
                                 STreeNode rootActions,
                                 String strTarget)
                          throws Exception
Parses the SOAP response.

Throws:
Exception

doHitError

public void doHitError(String action,
                       String errorString)
Specified by:
doHitError in interface SCanvasPaneView

doExec

public void doExec(String code,
                   String language)
Specified by:
doExec in interface SCanvasPaneView2

addCanvas

public void addCanvas(SCanvasAWT canvas)

addCanvas

public void addCanvas(SCanvasAWT canvas,
                      int num)

getTabCount

public int getTabCount()

actionPerformed

public void actionPerformed(ActionEvent e)
Specified by:
actionPerformed in interface ActionListener

getTopLevelFrame

public Frame getTopLevelFrame()

showMessageDialog

public void showMessageDialog(String strTitle,
                              Component strMessage)

showMessageDialog

public void showMessageDialog(String strTitle,
                              String strMessage)

getOptionPrintMultiplePages

public boolean getOptionPrintMultiplePages()

setOptionPrintMultiplePages

public void setOptionPrintMultiplePages(boolean val)

getOptionPrintUnzoomedPage

public boolean getOptionPrintUnzoomedPage()

setOptionPrintUnzoomedPage

public void setOptionPrintUnzoomedPage(boolean val)

getOptionPrintSelectedRegions

public boolean getOptionPrintSelectedRegions()

setOptionPrintSelectedRegions

public void setOptionPrintSelectedRegions(boolean val)

doPrintJobPrint

public void doPrintJobPrint()
                     throws Exception
Throws:
Exception

loadInputStream

public void loadInputStream(InputStream graphStream)

getSelectedTags

public String[] getSelectedTags()
Returns the tags of the selected rectangles, if any. This method forwards the call to the canvas pane controller.

Returns:
tags of the selected rectangles.

setSelectedTags

public void setSelectedTags(String[] tags)
Sets the tags of the selected rectangles. This method forwards the call to the canvas pane controller.

Parameters:
tags - multiple tags, separated by commas.

getCurrentPageTagName

public String getCurrentPageTagName()

getCurrentPageNumber

public int getCurrentPageNumber()

getNumberPages

public int getNumberPages()

setCurrentPageByTagName

public void setCurrentPageByTagName(String tag)

setCurrentPageByNumber

public void setCurrentPageByNumber(int num)

setCurrentPageBack

public void setCurrentPageBack()

setCurrentPageForward

public void setCurrentPageForward()

propGraphOnly

public boolean propGraphOnly()

propContextMenu

public boolean propContextMenu()

getColorFromString

public static Color getColorFromString(String strColor)
Creates a color object as specified by a string. The string may be the hexadecimal RGB value for the color, e.g. "FF0000" for red, or a standard Java color name such as "white", "green".

Parameters:
strColor - color string.
Returns:
the specified color, or null if it is not recognized as a color.

getEmbeddedCanvasVector

public Vector getEmbeddedCanvasVector(String embeddedFile)
                               throws Exception
Specified by:
getEmbeddedCanvasVector in interface SCanvasPaneController.EmbeddedFileAccess
Throws:
Exception

prepareEmbeddedCanvas

public void prepareEmbeddedCanvas(SCanvasAWT canvas)
Specified by:
prepareEmbeddedCanvas in interface SCanvasPaneController.EmbeddedFileAccess

addPage

public void addPage()

insertPage

public void insertPage(int num)

removePage

public void removePage(int num)

removeAllPages

public void removeAllPages()

getPageWithTagName

public int getPageWithTagName(String tag)

getPageTagName

public String getPageTagName(int num)

getPageTag

public String getPageTag(int num)

getPageTitle

public String getPageTitle(int num)

setPageTag

public void setPageTag(int num,
                       String tag)

setPageTitle

public void setPageTitle(int num,
                         String title)

clearSelectedTags

public void clearSelectedTags()

addSelectedTag

public void addSelectedTag(String tag)

removeSelectedTag

public void removeSelectedTag(String tag)

toggleSelectedTag

public void toggleSelectedTag(String tag)

isSelectedTag

public boolean isSelectedTag(String tag)

getSelectionRect

public SCanvasRectangle getSelectionRect()

getOptionDisplayMousePosition

public boolean getOptionDisplayMousePosition()

setOptionDisplayMousePosition

public void setOptionDisplayMousePosition(boolean val)

getOptionMousePositionDigits

public int getOptionMousePositionDigits()

setOptionMousePositionDigits

public void setOptionMousePositionDigits(int val)

getOptionEnableActiveRegions

public boolean getOptionEnableActiveRegions()

setOptionEnableActiveRegions

public void setOptionEnableActiveRegions(boolean val)

getOptionDisplayPageTabs

public boolean getOptionDisplayPageTabs()

setOptionDisplayPageTabs

public void setOptionDisplayPageTabs(boolean val)

getZoom

public double getZoom()

setZoom

public void setZoom(double val)

setZoomToRect

public void setZoomToRect(SCanvasRectangle rect)

setSelectionRect

public void setSelectionRect(SCanvasRectangle rect)

getTagsInRect

public String[] getTagsInRect(SCanvasRectangle rect)

getSelectionRectShiftDown

public boolean getSelectionRectShiftDown()

setSelectionRectShiftDown

public void setSelectionRectShiftDown(boolean val)

getSelectionRectControlDown

public boolean getSelectionRectControlDown()

setSelectionRectControlDown

public void setSelectionRectControlDown(boolean val)

selectTagsFromSelectionRect

public void selectTagsFromSelectionRect()

doContextMenu

public boolean doContextMenu(int x,
                             int y)
Specified by:
doContextMenu in interface SCanvasPaneController.ContextMenuAccess

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.