# Presentation: 175963

## SGT Beans

- Easy-To-Use Graphics Toolkit for Java Applications

- Donald W. Denbo
*UW/JISAO-NOAA/PMEL*

## Introduction

- The Scientific Graphics Toolkit JavaBeans (SGT Beans) is a collection of Java classes that provide JavaBeans compatible access to SGT.

- JavaBeans makes SGT’s capabilities more accessible to developers.

- SGT Beans reduces the learning curve needed to produce graphics applications.

- SGT Beans can be used with several Java IDEs (NetBeans, JBuilder, etc.).

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## History

- SGT was developed to allow a NOAAServer user to interactively preview data and overlay plots.

- SGT presently used with ...
- OceanShare, a collaborative tool for in situ data visualization
- ncBrowse, a netCDF file browser
- Climate Data Portal client, an application for browsing distributed data

- SGT has had ~17,000 downloads from 5,800 unique sites in 70 countries.

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Other Users of SGT

- Buoy Data, Morska Bioloska Postaja *(Marine Biology Station)*
- Computational Physics Laboratory, University of Edinburgh
- A Utility in _[JOELib](http://www-ra.informatik.uni-tuebingen.de/forschung/sol/joelib/)_, Computational Chemistry, University of Tübingen
- “_[Coordinated, Interactive Data Visualization for Neutron Scattering Data](http://arxiv.org/pdf/physics/0210082)_”, Mikkelson et. al.
- Dezo.org has created SGT applet _[plots.](http://www.dezo.org/plots/)_
- “_[An Interactive Program for Determining Junction Depths in Diffused Silicon Devices](http://www.mse.vt.edu/faculty/hendricks/publications/%20IEEE_IrvinCurve_paper.pdf)_”, Myers et. al.
- Übungsunterlagen 2002, Wasserspeicher

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Outline

- SGT Bean design goals

- Demonstration of SGT Bean application.

- Architecture
*Page*
*DataModel*
*PanelModel*

- SGT Bean code examples
- Time series. Plotting data from a netCDF file.
- Add grid plot.  Refactor netCDF reader.
- Overlay vectors and add printing, *PanelModel* edit, etc.

- What Next?

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Design Goals

- Create easy-to-use JavaBeans from the SGT classes.

- JavaBeans will enable beginner and intermediate developers a quick entry into SGT graphics.

- SGT Beans will handle most events and provide tools to easily customize the appearance of the plot.

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## SGT Beans Demonstration

- Start Demonstration

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Architecture

- The SGT Beans architecture consists of *Page*, *DataModel*, and *PanelModel* JavaBeans.  The *DataModel* and *PanelModel* beans provide the “state” information necessary for *Page* to create a graphic display.

- Page

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Page JavaBean

- Visual JavaBean.  *Page* can be added to any swing container.

*Page* can have any number of *Panel*s placed inside it.  Each *Panel* provides an independent graphical display of data from the *DataModel*.

- The location and size of the *Panel*s are specified in the *PanelModel*.

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Page

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## PanelModel JavaBean

- Non-visual JavaBean.

*PanelModel** *maintains:

- location and size of *Panel*s on *Page*

*AxisGroup*s and their positions on a *Panel*

*Legend* position on a *Panel*

- Titles and annotation positions on a *Panel*

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## PanelModel

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## DataModel JavaBean

- Non-visual JavaBean.

*DataModel* uses information from the *PanelModel* to specify the connection between data and *Panel*/*AxisGroup*.

- Contains the *SGTData* and *Attribute* objects.

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## DataModel

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## SGT Beans Code Examples

- _[Example 1](http://www.epic.noaa.gov/java/sgt/src/SBExample1.html)_: Time Series
- _[Read time series ](http://www.epic.noaa.gov/java/sgt/src/NcSimpleReader1.html)_from netCDF file into *SimpleLine* object.
- Create graph using *Page*, *DataModel*, and *PanelModel*.
- Load *PanelModel* from _[SBExample1.xml.](http://www.epic.noaa.gov/java/sgt/src/SBExample1XML.html)_

- Example 2: Add Grid Plot
- Read grid from netCDF file into *SimpleGrid* object.
- Load *PanelModel* from SBExample2.xml.

- Example 3: Overlay Vectors and Add Interactivity
- Read vector from netCDF file into *SGTVector* object.
- Load *PanelModel* from SBExample3.xml.
- Add color map *Legend*.
- Add printing, class browsing, zoom reset, *PanelModel* edit.

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Example 1: Time Series 

- Example 1: Time Series

- _[SBExample1.xml](http://www.epic.noaa.gov/java/sgt/src/SBExample1XML.html)_

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## SBExample1 class

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Constuctor

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## createGraphic()

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## createGraphic() (cont)

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## NcSimpleReader1

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## getTimeSeries() implementation

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Set shape and read Arrays

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Extract variable and axis values

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Parse time units.

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Parse time offset, create GeoDateArray

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Create SimpleLine and return

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Slide 28

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Example 2: Add Grid Plot

- _[SBExample2.xml](http://www.epic.noaa.gov/java/sgt/src/SBExample2XML.html)_

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## SBExample2 modifications

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Add Grid to Page

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Add createGridAttribute()

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## NcSimpleReader2 - Add getGrid()

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Get shape and x & y axis data

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Adjust shape and get data grid

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Create SimpleGrid and return

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Slide 37

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Example 3: Overlay Vectors and Add Interactivity

- _[SBExample3.xml](http://www.epic.noaa.gov/java/sgt/src/SBExample3XML.html)_

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## SBExample3 modifications

- _[SBExample3](http://www.epic.noaa.gov/java/sgt/src/SBExample3.html)__ modifications_

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Add Grid Legend

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Add Printing

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Reset Zoom and Open JClassTree

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Edit Printer Layout and PanelModel

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## NcSimpleReader3 - Add getVector()

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Modify getGeoDateArray

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## Slide 46

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## What next?

- Add *LayoutManager* support to position *Panel*s when *Page* is resized.  This requires creating a graphical wizard to set *SpringLayout* properties.

- Add *Annotation* object support. *Annotation*s include line, oval, point, text, and rectangle objects.

- Enhance IDE compatibility with popular tools.

- Continue fixing bugs, as they are found, and adding new useful features.

- NOAATech 2004, Silver Spring, MD

- 2003-10-23

## References

- SGT Beans
- _[“Plug and Play Scientific Graphics with SGT”, ](http://www.epic.noaa.gov/talks/dwd/WebShop2003/sgt.htm)_NOAAResearch WebShop 2003, Longmont, CO
- _[SGT home page](http://www.epic.noaa.gov/java/sgt)_
- ncBrowse
- _[“ncBrowse: A Graphical netCDF/OPeNDAP Browser”, ](http://www.epic.noaa.gov/talks/dwd/ESIP2003/ncBrowse-ESIP.htm)_11th ESIP Technical Meeting - OPeNDAP Session, Boulder, CO
- _[ncBrowse home page](http://www.epic.noaa.gov/java/ncBrowse)_
- OceanShare
- _[“Fisheries Oceanography Collaboration Software”,  ](http://www.epic.noaa.gov/talks/dwd/ams2002/FOCI_10.3_files/v3_document.htm)_18th AMS International Conference on IIPS, Orlando, FL
- _[Collaboration home page](http://www.epic.noaa.gov/colab)_
- Climate Data Portal
- _[Climate Data Portal home page](http://www.epic.noaa.gov/cdp/)_

- NOAATech 2004, Silver Spring, MD

- 2003-10-23