S-PLUS Connect/Java v1.0

com.insightful.gdevice
Class SCanvasPaneController

java.lang.Object
  extended by com.insightful.gdevice.SCanvasPaneController

public class SCanvasPaneController
extends Object

An SCanvasPaneController object coordinates the display and UI logic for a multi-page canvas display. The actual UI elements are represented by an SCanvasPaneView object. The separation is done so that the same display/UI logic can be used with either heavy-weight AWT objects (in an applet) or Swing objects (in the Splus GUI).


Nested Class Summary
static interface SCanvasPaneController.ContextMenuAccess
           
static interface SCanvasPaneController.EmbeddedFileAccess
           
 
Field Summary
protected  Color m_backgroundColor
          if non-null, used as the background color for all canvases.
protected  boolean m_bXorSelectedRegions
          Whether to XOR the highlight color with the graph to highlight selected regions.
protected  Color m_clrSelectionHighlight
          Color for highlighting selected regions.
protected  boolean m_debug
           
static boolean m_debugFirehose
           
static int m_debugFirehoseCheckSleep
           
static int m_debugFirehosePaintCount
           
protected  boolean m_highlightOutline
           
protected  boolean m_showQueryErrorDialog
          Whether to pop up a message box if a network error prevents a query to a web service.
protected  com.insightful.gdevice.TagSet m_tagset
          Tags of the selected rectangles.
 
Constructor Summary
SCanvasPaneController(SCanvasPaneView view)
           
 
Method Summary
 void addCanvas(SCanvasAWT canvas)
           
 void addCanvas(SCanvasAWT canvas, int index)
           
 void addSelectedTag(String tag)
           
 void addSelectedTagArray(String[] tagArray)
           
protected  void callOnSelectChanged()
           
 void clearSelectedTags()
           
 void clearSetSelectedTag(String tag)
           
 void clearSetSelectedTagArray(String[] tagArray)
           
protected  boolean collectMenuInfo(XMLElement elt, STreeNode rootLabels, STreeNode rootActions)
          Parses the XML for a menu and store the label and action information in tree structures for later use to construct the actual menu.
 boolean doContextMenu(int x, int y)
           
 void doExec(SCanvasPaneView view, String code, String language)
           
 void doHitAction(String action)
           
 void doHitAction(String action, int x, int y, boolean bControlDown, boolean bShiftDown)
          Handles a mouse hit on an active region.
 void doHitAction(String action, int x, int y, boolean bLeft, boolean bMiddle, boolean bRight, boolean bControlDown, boolean bShiftDown)
          Handles a mouse hit on an active region.
 void doHitAction(XMLElement elt, String action, int x, int y, boolean bLeft, boolean bMiddle, boolean bRight, boolean bControlDown, boolean bShiftDown)
           
 void doHitMenu(SCanvasPaneView view, STreeNode rootLabels, STreeNode rootActions, int x, int y)
           
 boolean doHitQueryWebService(SCanvasPaneView view, XMLElement elt, STreeNode rootLabels, STreeNode rootActions, boolean bShowErrorDialog)
          added methods to handle SCanvasPaneView2 methods.
protected  void doHitSelect(String strTag, boolean bControlDown, boolean bShiftDown)
          Selects the active region receiving the mouse hit.
protected  void doHitSelect(String strTag, String selectOp, boolean bControlDown, boolean bShiftDown)
          Selects the active region receiving the mouse hit, according to the value of selectOp: If selectOp is "KEY", add or toggle the region, depending on the control and shift keys: If the SHIFT key is down, the method adds the region's tag to the tag set.
static Color getAnnotationColor(com.insightful.gdevice.SCanvasPaneController.CanvasPage page)
           
static int getAnnotationTextColor()
           
 boolean getAutoZoom()
           
static boolean getBackgroundBorders()
          Returns whether to display borders around graph with graph background color, or gray.
 Color getBackgroundColor()
           
 SCanvasAWT getCanvas()
           
 SCanvasAWT getCanvas(int i)
           
 Dimension getCanvasComponentSize()
           
 Point getCanvasPointFromMouse(Point pt)
           
 int getCurrentPageNumber()
           
 String getCurrentPageTagName()
           
 boolean getDebug()
           
 boolean getHighlightOutline()
           
static int getLocatorFractionDigits()
          Returns the number of digits that will be printed after the decimal point when displaying the mouse position.
 int getNumberPages()
           
 int getSelectedTab()
           
 String[] getSelectedTags()
          Returns the tags of the selected rectangles, if any.
 SCanvasRectangle getSelectionRect()
           
 boolean getSelectionRectControlDown()
           
 boolean getSelectionRectShiftDown()
           
static boolean getShowActiveRegions()
           
static boolean getShowMouseLocation()
           
 int getTabCount()
           
 int getTabNumber(int x, int y)
           
 int getTabNumberFromTagName(String tag)
           
 String getTabTag(int i)
           
 String getTabTagName(int i)
           
 String getTabTitle(int i)
           
 String[] getTagsInRect(SCanvasRectangle rect)
           
 SCanvasPaneView getView()
           
 double getZoom()
           
protected  void invalidateAllSelectionImages()
          Throws away all buffered images in which selected active regions are highlighted.
 boolean isSelectedTag(String tag)
           
 void paintCanvas(Graphics g)
          Paints the main canvas.
 void paintTabs(Graphics g)
           
 void printCanvas(Graphics g)
          Prints the main canvas.
 void printPage(int index, Graphics g, Dimension printPageSize, boolean printAll, boolean printSelections)
          print one page to a printer with a given page size.
 void printPage(int index, Graphics g, Dimension printPageSize, boolean printAll, boolean printSelections, boolean indentRegion)
           
 void printTabs(Graphics g)
           
 void printTabsApplet(Graphics g)
           
 void releaseMemory()
           
 void removeAllPages()
           
 void removeSelectedTag(String tag)
           
 void removeTabAt(int index)
           
 void retrieveEmbeddedSPJFile()
          Get embedded SPJ file for current canvas, if this is in an applet, and the canvas has an embedded file specified.
 void selectRect()
           
static void setAnnotationTextColor(int val)
           
 void setAutoZoom(boolean newVal)
           
static void setBackgroundBorders(boolean backgroundBorders)
          Sets the m_backgroundBorders flag that determines whether to display borders around graph with graph background color, or gray.
 void setBackgroundColor(Color col)
           
 void setCurrentPageBack()
           
 void setCurrentPageByNumber(int num)
           
 void setCurrentPageByTagName(String tag)
           
 void setCurrentPageForward()
           
 void setDebug(boolean val)
           
static void setDebugFirehose(boolean val)
           
static void setDebugFirehoseCheckSleep(int val)
           
 void setHighlightOutline(boolean val)
           
static void setLabelColor(Color col)
           
static void setLocatorFractionDigits(int val)
          Sets the number of digits that will be printed after the decimal point when displaying the mouse position.
 void setSelectedTab(int i)
           
 void setSelectedTabBack()
           
 void setSelectedTabForward()
           
 void setSelectedTags(String[] tags)
          Sets the tags of the selected rectangles.
 void setSelectionHighlightColor(Color col)
          Sets the color for highlighting selected regions.
 void setSelectionHighlightMode(String strMode)
          Sets the drawing mode for highlighting selected active regions.
 void setSelectionRect(SCanvasRectangle rect)
           
 void setSelectionRectControlDown(boolean val)
           
 void setSelectionRectShiftDown(boolean val)
           
static void setShowActiveRegions(boolean val)
           
static void setShowMouseLocation(boolean val)
           
 void setTabTag(int i, String tag)
           
 void setTabTitle(int i, String title)
           
 void setZoom(double val)
           
 void setZoomToRect(SCanvasRectangle rect)
           
 void showSelectedTab()
           
 void toggleSelectedTag(String tag)
           
 void toggleSelectedTagArray(String[] tagArray)
           
 void updateCanvas()
           
 void updateCanvas(int i)
           
 void updateTabs()
           
 void zoom(double zoomFactor)
           
 void zoomToRect()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_showQueryErrorDialog

protected boolean m_showQueryErrorDialog
Whether to pop up a message box if a network error prevents a query to a web service. This is relevant only for menus that contain multiple <query> elements, each of which queries a web service to construct a submenu. Only the first failure for each overall menu should cause a message box to be displayed.


m_clrSelectionHighlight

protected Color m_clrSelectionHighlight
Color for highlighting selected regions.


m_bXorSelectedRegions

protected boolean m_bXorSelectedRegions
Whether to XOR the highlight color with the graph to highlight selected regions. The alternative is to paint the highlight color over the graph.


m_backgroundColor

protected Color m_backgroundColor
if non-null, used as the background color for all canvases.


m_highlightOutline

protected boolean m_highlightOutline

m_debug

protected boolean m_debug

m_tagset

protected com.insightful.gdevice.TagSet m_tagset
Tags of the selected rectangles.


m_debugFirehose

public static boolean m_debugFirehose

m_debugFirehosePaintCount

public static int m_debugFirehosePaintCount

m_debugFirehoseCheckSleep

public static int m_debugFirehoseCheckSleep
Constructor Detail

SCanvasPaneController

public SCanvasPaneController(SCanvasPaneView view)
Method Detail

setSelectionHighlightColor

public void setSelectionHighlightColor(Color col)
Sets the color for highlighting selected regions.


setSelectionHighlightMode

public void setSelectionHighlightMode(String strMode)
Sets the drawing mode for highlighting selected active regions. The options are XOR mode (the default), for XOR'ing the selected regions with the graph, and paint mode, for painting the selected regions over the graph.

Parameters:
strMode - The new selection highlight drawing mode. The value is case insensitive. If the value is "paint", the drawing mode is set to paint mode; otherwise it is set to XOR mode.

setBackgroundColor

public void setBackgroundColor(Color col)

getBackgroundColor

public Color getBackgroundColor()

getBackgroundBorders

public static boolean getBackgroundBorders()
Returns whether to display borders around graph with graph background color, or gray.


setBackgroundBorders

public static void setBackgroundBorders(boolean backgroundBorders)
Sets the m_backgroundBorders flag that determines whether to display borders around graph with graph background color, or gray.


getLocatorFractionDigits

public static int getLocatorFractionDigits()
Returns the number of digits that will be printed after the decimal point when displaying the mouse position.


setLocatorFractionDigits

public static void setLocatorFractionDigits(int val)
Sets the number of digits that will be printed after the decimal point when displaying the mouse position.


getShowMouseLocation

public static boolean getShowMouseLocation()

setShowMouseLocation

public static void setShowMouseLocation(boolean val)

getShowActiveRegions

public static boolean getShowActiveRegions()

setShowActiveRegions

public static void setShowActiveRegions(boolean val)

getAnnotationTextColor

public static int getAnnotationTextColor()

setAnnotationTextColor

public static void setAnnotationTextColor(int val)

setLabelColor

public static void setLabelColor(Color col)

getAnnotationColor

public static Color getAnnotationColor(com.insightful.gdevice.SCanvasPaneController.CanvasPage page)

getHighlightOutline

public boolean getHighlightOutline()

setHighlightOutline

public void setHighlightOutline(boolean val)

getDebug

public boolean getDebug()

setDebug

public void setDebug(boolean val)

getView

public SCanvasPaneView getView()

paintCanvas

public void paintCanvas(Graphics g)
Paints the main canvas. The actual canvas in the AWT or Swing GUI forwards paint calls to this method, which in turn sends them on to the CanvasComponentListener object's paint() method.

Parameters:
g - Graphics device.
See Also:
SCanvasPaneController.CanvasComponentListener#paint

printCanvas

public void printCanvas(Graphics g)
Prints the main canvas. The actual canvas in the AWT or Swing GUI forwards print calls to this method, which in turn sends them on to the CanvasComponentListener object's print() method.

Parameters:
g - Graphics device.
See Also:
SCanvasPaneController.CanvasComponentListener#print

paintTabs

public void paintTabs(Graphics g)

printTabs

public void printTabs(Graphics g)

printTabsApplet

public void printTabsApplet(Graphics g)

getTabNumberFromTagName

public int getTabNumberFromTagName(String tag)

getTabNumber

public int getTabNumber(int x,
                        int y)

setSelectedTab

public void setSelectedTab(int i)

setSelectedTabBack

public void setSelectedTabBack()

setSelectedTabForward

public void setSelectedTabForward()

showSelectedTab

public void showSelectedTab()

getSelectedTab

public int getSelectedTab()

getTabCount

public int getTabCount()

removeTabAt

public void removeTabAt(int index)

getTabTitle

public String getTabTitle(int i)

getTabTagName

public String getTabTagName(int i)

getTabTag

public String getTabTag(int i)

setTabTitle

public void setTabTitle(int i,
                        String title)

setTabTag

public void setTabTag(int i,
                      String tag)

zoom

public void zoom(double zoomFactor)

zoomToRect

public void zoomToRect()

selectRect

public void selectRect()

updateTabs

public void updateTabs()

updateCanvas

public void updateCanvas(int i)

updateCanvas

public void updateCanvas()

getCanvas

public SCanvasAWT getCanvas(int i)

getCanvas

public SCanvasAWT getCanvas()

releaseMemory

public void releaseMemory()

doHitAction

public void doHitAction(String action)

doHitAction

public void doHitAction(String action,
                        int x,
                        int y,
                        boolean bControlDown,
                        boolean bShiftDown)
Handles a mouse hit on an active region.


doHitAction

public void doHitAction(String action,
                        int x,
                        int y,
                        boolean bLeft,
                        boolean bMiddle,
                        boolean bRight,
                        boolean bControlDown,
                        boolean bShiftDown)
Handles a mouse hit on an active region.


doHitAction

public void doHitAction(XMLElement elt,
                        String action,
                        int x,
                        int y,
                        boolean bLeft,
                        boolean bMiddle,
                        boolean bRight,
                        boolean bControlDown,
                        boolean bShiftDown)

doContextMenu

public boolean doContextMenu(int x,
                             int y)

doHitQueryWebService

public boolean doHitQueryWebService(SCanvasPaneView view,
                                    XMLElement elt,
                                    STreeNode rootLabels,
                                    STreeNode rootActions,
                                    boolean bShowErrorDialog)
                             throws Exception
added methods to handle SCanvasPaneView2 methods.

Throws:
Exception

doHitMenu

public void doHitMenu(SCanvasPaneView view,
                      STreeNode rootLabels,
                      STreeNode rootActions,
                      int x,
                      int y)

doExec

public void doExec(SCanvasPaneView view,
                   String code,
                   String language)

collectMenuInfo

protected boolean collectMenuInfo(XMLElement elt,
                                  STreeNode rootLabels,
                                  STreeNode rootActions)
                           throws Exception
Parses the XML for a menu and store the label and action information in tree structures for later use to construct the actual menu.

Returns:
true unless the menu is empty.
Throws:
Exception

doHitSelect

protected void doHitSelect(String strTag,
                           boolean bControlDown,
                           boolean bShiftDown)
Selects the active region receiving the mouse hit. If the SHIFT key is down, the method adds the region's tag to the tag set. If the CNTL key is down, this method adds the tag only if it isn't already in the set; otherwise it removes it. Otherwise this method clears the tag set before adding the new tag.

Parameters:
strTag - Tag of the selectable active region clicked.
bControlDown - Whether the CTRL key was down.
bShiftDown - Whether the SHIFT key was down.

doHitSelect

protected void doHitSelect(String strTag,
                           String selectOp,
                           boolean bControlDown,
                           boolean bShiftDown)
Selects the active region receiving the mouse hit, according to the value of selectOp: If selectOp is "KEY", add or toggle the region, depending on the control and shift keys: If the SHIFT key is down, the method adds the region's tag to the tag set. If the CTRL key is down, this method adds the tag only if it isn't already in the set; otherwise it removes it. Otherwise this method clears the tag set before adding the new tag. If selectOp is "SET", this clears the tag set and adds the tag. If selectOp is "ADD", this adds the tag. If selectOp is "REMOVE", this removes the tag. If selectOp is "TOGGLE", this toggles the region.

Parameters:
strTag - Tag of the selectable active region clicked.
selectOp - select operation.
bControlDown - Whether the CTRL key was down.
bShiftDown - Whether the SHIFT key was down.

getCanvasComponentSize

public Dimension getCanvasComponentSize()

addCanvas

public void addCanvas(SCanvasAWT canvas)

addCanvas

public void addCanvas(SCanvasAWT canvas,
                      int index)

getCanvasPointFromMouse

public Point getCanvasPointFromMouse(Point pt)

setAutoZoom

public void setAutoZoom(boolean newVal)

getAutoZoom

public boolean getAutoZoom()

removeAllPages

public void removeAllPages()

invalidateAllSelectionImages

protected void invalidateAllSelectionImages()
Throws away all buffered images in which selected active regions are highlighted.


getSelectedTags

public String[] getSelectedTags()
Returns the tags of the selected rectangles, if any.

Returns:
tags of the selected rectangles.

setSelectedTags

public void setSelectedTags(String[] tags)
Sets the tags of the selected rectangles.

Parameters:
tags - array of tags.

clearSelectedTags

public void clearSelectedTags()

addSelectedTag

public void addSelectedTag(String tag)

clearSetSelectedTag

public void clearSetSelectedTag(String tag)

removeSelectedTag

public void removeSelectedTag(String tag)

toggleSelectedTag

public void toggleSelectedTag(String tag)

toggleSelectedTagArray

public void toggleSelectedTagArray(String[] tagArray)

addSelectedTagArray

public void addSelectedTagArray(String[] tagArray)

clearSetSelectedTagArray

public void clearSetSelectedTagArray(String[] tagArray)

callOnSelectChanged

protected void callOnSelectChanged()

isSelectedTag

public boolean isSelectedTag(String tag)

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()

printPage

public void printPage(int index,
                      Graphics g,
                      Dimension printPageSize,
                      boolean printAll,
                      boolean printSelections)
print one page to a printer with a given page size. if printAll is true, it prints the entire page, otherwise just the visible zoomed region. if printSelections is true, prints the selected regions.


printPage

public void printPage(int index,
                      Graphics g,
                      Dimension printPageSize,
                      boolean printAll,
                      boolean printSelections,
                      boolean indentRegion)

retrieveEmbeddedSPJFile

public void retrieveEmbeddedSPJFile()
Get embedded SPJ file for current canvas, if this is in an applet, and the canvas has an embedded file specified.


getZoom

public double getZoom()

setZoom

public void setZoom(double val)

setZoomToRect

public void setZoomToRect(SCanvasRectangle rect)

getSelectionRect

public SCanvasRectangle getSelectionRect()

setSelectionRect

public void setSelectionRect(SCanvasRectangle rect)

getSelectionRectShiftDown

public boolean getSelectionRectShiftDown()

setSelectionRectShiftDown

public void setSelectionRectShiftDown(boolean val)

getSelectionRectControlDown

public boolean getSelectionRectControlDown()

setSelectionRectControlDown

public void setSelectionRectControlDown(boolean val)

getTagsInRect

public String[] getTagsInRect(SCanvasRectangle rect)

setDebugFirehose

public static void setDebugFirehose(boolean val)

setDebugFirehoseCheckSleep

public static void setDebugFirehoseCheckSleep(int val)

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.