gWidgetsrJava-package: Toolkit implementation of gWidgets for rJava

Description Details Note Author(s) References See Also Examples

Description

Port of gWidgets API to rJava. The gWidgets API is an abstract, lightweight means to interact with GUI toolkits. In this case, the JAVA toolkit.

Details

This file documents differences between gWidgetsrJava and the gWidgets API. Currently, gWidgetsrJava only provides a no-frills version of gWidgets, as compared to gWidgetsRGtk2.

Notes on this implementation:

First, although the widgets can be constructed from the R commandline, they can only be given handlers (or a response to mouse events) if the package is run with the JGR environment. This is a limitation of the rJava package which provides the interface to the Java libraries from within R.

Containers:

To speed up the display of complicated GUIs, the visible=FALSE argument to the gwindow constructor can be used to suppress the showing of the window and its child components. The method visible can then be used to show the GUI.

gframe() no markup in title

glayout() has two additional arguments: expand=TRUE is like expand= for ggroup(), in that the attached widget expands to fill the possible space in the container. If this isn't given the anchor= argument can be used to adjust the location of the widget withing the cell. A value of c(-1,1) is the lower left, c(-1,1) the upper left (the default), c(1,-1) the lower right, and c(1,1) the upper right. The value 0 for either is also possible.

ggroup() also has the expand= and anchor= arguments. If expand=TRUE the widget takes up as much space as possible. The anchor= argument adjusts a widget left or right, up or down, within its space. Only one component works at a time for the anchor argument. In a horizontal box, only the y component can be used to move a value up or down. In a vertical box, only the x component can be used to move a value left or right. The default is c(-1,1) so that horizontal layouts are towards the top, and vertical layouts towards the left.

Components:
gcalendar() is mostly implemented. It uses a calendar widget from http://java.sun.com/developer/JDCTechTips/2005/tt0601.html, a now defunct project. The return value of svalue() is a Date object, not a character string, formatted by the format= string.

gcommandline() is implemented, but could definitely be improved. The console in JGR is much better.

gdf() works, looks bad. It is slow

gdfnotebook() needs to be changed to run. Not implemented

gedit(), unlike the gWidgetsRGtk2 widget, has no type-ahead support via drop down boxes. The method addHandlerKeystroke does not have the key returned through the h\$key component.

ghelpbrowser() just uses the one from JGR, its methods are not implemented.

gimage() size argument is ignored. It seems that images get cached. If you try something like svalue(gimageInstance)<-file; update(file); svalue(gimageInstance)<-file then the updated file won't be loaded.

gfile() no filtering is implemented.

gmenu() adds only to the top window, not any container. This is a Java limitation. Use a popupmenu instead.

gstatusbar() is just a glabel instance in disguise.

gradio() has an extra argument coerce.with=, as otherwise it would treat everything as a character vector. It tries to guess when instantiated, if not explicitly given.

gslider() in rJava works with integer steps only. If the by= argument is less than 1 a gspinbutton() is used in place.

Handlers:

There is no support for adddropsource(), adddroptarget() and adddropmotion(). Drag and drop basically works as typical, you drag it and it adds where dropped.

Note

This package uses Java source code from several GPL projects: xnap-common, the Java tutorial, iWidgets, javadesktop.org.

Author(s)

John Verzani, although based on the iWidgets package of Simon Urbanek, incorporating some GPL and LGPL software from the eclipse project, the javadesktop.org project, the scigraphics project and code from the Java Tutorial by SUN.

Maintainer: John Verzani <gwidgetsrgtk@gmail.com>

References

See JGR's website at www.rosuda.org.

See Also

The JGR package: www.rosuda.org

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Not run: 
##
options(guiToolkit="rJava")
## select CRAN miror example
  win = gwindow("Select a CRAN mirror")
  size(win) = c(600,400)
  tbl = gtable(utils:::getCRANmirrors(), 
  container=win,
  chosencol=4, 
  handler = function(h,...) {
    URL = svalue(h$obj)
    repos = getOption("repos")
    repos["CRAN"] = gsub("/$", "", URL[1])
    options(repos = repos)
    dispose(win)
  })
##

## End(Not run)

gWidgetsrJava documentation built on May 2, 2019, 6:41 p.m.