gUpdateViewMessage-class {iSPlot}R Documentation

Class "gUpdateViewMessage": A class to represent an update view message

Description

gUpdateViewMessage is a class to represent an update view message. Thus, when either the controller or the model (i.e. the control window or the data) want to update the view(s), a gUpdateViewMessage object is created. gUpdateViewMessage is inherited from the class, gUpdateMessage, which inherits from the virtual class, gMessage. Whenever a gUpdateViewMessage is created (initialized), the next step is to call the handleMessage method to act upon that message and update the views.

Objects from the Class

Objects can be created by calls of the form new("gUpdateViewMessage", type, ...). When creating a gUpdateViewMessage, the type parameter can be one of the four following options: "add", "reset", "modify", or "delete". This parameter shows what type of update occurred on the data. If the type is "modify" or "delete", then an extra parameter is needed and this extra parameter is Rname to indicate which row names or indices have changed in the data.

Slots

type:
the type of update to be performed, will be one of the following character strings: "updatePoint" or "replot"
mData:
the data needed to perform the update; if the type is "replot", then mData will be an empty list, if the type is "updatePoints", then mData will be a list with one element, Rname, to indicate which rows have changed

Extends

Class "gUpdateMessage", directly. Class "gMessage", by class "gUpdateMessage".

Methods

handleMessage
Depending on which data set was changed, it updates any views (plots or spreadsheets) that depend on that data by calling the functions, updatePlots and updateSpread
initialize
Creates a gUpdateViewMessage object

Author(s)

Elizabeth Whalen

See Also

updatePlots, updateSpread, gMessage-class, gUpdateMessage-class, gUpdateDataMessage-class

Examples

  if (interactive())
  {
    createControlWindow()
    # should load data through Open Data or Open File under the File menu
    data(USArrests)
    loadDFData(USArrests,"USArrests")
    # plotting the data should occur through Plot Data under the 
    # Display menu
    createView(type = "plotView", dataName = "USArrests", 
               plotType = "sPlotView", dfRows = 1:nrow(USArrests), 
               dfColumns = 1:2)    
    # should modify using the control window (by choosing the view mode and
    # then clicking on a plot)
    # by interacting with a plot when the view mode is color, these 
    # functions will be called automatically
    modify("USArrests", Rname=c("Massachusetts","Ohio"), 
           Cname=c("color","color"), data=c("red","green")) 
    # create an update view message and then dispatch it so the points
    # that have changed will be replot
    plMessage<-new("gUpdateViewMessage",type="modify",Rname=c("Massachusetts",
                   "Ohio"))
    handleMessage(plMessage,dataName="USArrests")

    # now see if the message is inherited from gMessage
    is(plMessage,"gUpdateViewMessage")
  }

[Package iSPlot version 1.0.3 Index]