com.hp.hpl.guess.piccolo
Class GFrame

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byedu.umd.cs.piccolo.PCanvas
                  extended bycom.hp.hpl.guess.piccolo.GFrame
All Implemented Interfaces:
FrameListener, ImageObserver, MenuContainer, PComponent, Serializable

public class GFrame
extends PCanvas
implements FrameListener

The frame for the Piccolo interface. This provides the high level interface window, canvas, and camera. It is currently implemented as a singleton

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
static int BROWSE_MODE
           
static int DRAW_CREATE_MODE
           
static int DRAW_EDIT_MODE
           
static int EDGE_EDIT_MODE
           
 int fileCounter
           
static int HULL_EDIT_MODE
           
static int NODE_EDIT_MODE
           
static int ZOOM_SIZE
           
 
Fields inherited from class edu.umd.cs.piccolo.PCanvas
CURRENT_ZCANVAS, INTERATING_CHANGED_NOTIFICATION
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
GFrame()
           
 
Method Summary
 void center()
           
 void center(double minx, double miny, double maxx, double maxy)
           
 void center(double minx, double miny, double maxx, double maxy, long t)
           
 void center(Object o)
           
 void center(Object o, long t)
           
 void center(Rectangle2D r2, long t)
           
 void centerFast()
           
 void centerOn(GuessPNode gpn)
           
 void centerOn(GuessPNode n1, GuessPNode n2)
           
 void exportCGM(String filename)
           
 void exportEMF(String filename)
           
 void exportEPS(String filename)
           
 void exportGIF(String filename)
           
 void exportJAVA(String filename)
           
 void exportJPG(String filename)
           
 void exportPDF(String filename)
           
 void exportPNG(String filename)
           
 void exportPS(String filename)
           
 void exportSVG(String filename)
           
 void exportSWF(String filename)
           
 void flushBuffer()
          flushes the movie buffer.
 Color getDisplayBackground()
          gets the display background color
 PLayer getEdges()
           
 BufferedImage getFullImage()
          returns a buffered image for the full image scaled to 1
 BufferedImage getFullImage(double scale)
           
 BufferedImage getFullImage(double maxWidth, double maxHeight)
          returns a buffered image scaled to fit some coordinates
 BufferedImage getFullImage(Rectangle2D fis)
           
 BufferedImage getFullImage(Rectangle2D trans, double scale)
           
 BufferedImage getFullImage(Rectangle2D fis, double maxWidth, double maxHeight)
           
 Dimension getFullImageDimensions()
           
 Dimension getFullImageDimensions(double scale)
           
 Rectangle2D getFullImageSize()
           
 PCamera getGCamera()
          returns the camera viewing the canvas in the frame
 PLayer getHulls()
           
 Point2D getLastClickedPosition()
           
 int getMode()
           
 PLayer getNodes()
           
 Collection getSelected()
           
 void initialize()
          an init routine...
 void loadState(String filename)
           
 void overlayText(String s)
           
 void paint(Graphics g)
           
 void paintImmediately()
           
 void paintImmediately(int x, int y, int width, int height)
           
 void paintImmediately(Rectangle r)
           
 void removeBackgroundImage()
           
 void returnToRegular()
           
 void saveState(String filename)
           
 void setBackgroundImage(String filename)
           
 void setBackgroundImage(String filename, double x, double y)
           
 void setDisplayBackground(Color bg)
          sets the background color
 void setDisplayBackground(String bg)
           
 void setFrozen(boolean state)
           
 void startMovie(int fps, String filename)
           
 void startMovie(int fps, String filename, boolean auto)
           
 void stopMovie()
          basically dumps the movie to disk
 void switchHandler(int i)
           
 void unselectAll()
           
 void writeFullImage(String name, int itype, double maxWidth, double maxHeight, Properties props)
          returns a buffered image scaled to fit some coordinates
 void writeFullImage(String name, int itype, double scale, Properties props)
           
 void writeFullImage(String name, int itype, Properties props)
           
 void writeFullImage(String name, int itype, Rectangle2D fis, double maxWidth, double maxHeight, Properties props)
           
 void writeFullImage(String name, int itype, Rectangle2D trans, double scale, Properties props)
           
 void writeFullImage(String name, int itype, Rectangle2D fis, Properties props)
           
 
Methods inherited from class edu.umd.cs.piccolo.PCanvas
addInputEventListener, createTimer, getAnimating, getCamera, getInteracting, getLayer, getPanEventHandler, getRoot, getZoomEventHandler, paintComponent, popCursor, pushCursor, removeInputEventListener, repaint, setAnimatingRenderQuality, setBounds, setCamera, setDefaultRenderQuality, setEnabled, setInteracting, setInteractingRenderQuality, setPanEventHandler, setZoomEventHandler
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hp.hpl.guess.ui.FrameListener
repaint
 

Field Detail

fileCounter

public int fileCounter

BROWSE_MODE

public static final int BROWSE_MODE
See Also:
Constant Field Values

NODE_EDIT_MODE

public static final int NODE_EDIT_MODE
See Also:
Constant Field Values

EDGE_EDIT_MODE

public static final int EDGE_EDIT_MODE
See Also:
Constant Field Values

HULL_EDIT_MODE

public static final int HULL_EDIT_MODE
See Also:
Constant Field Values

DRAW_CREATE_MODE

public static final int DRAW_CREATE_MODE
See Also:
Constant Field Values

DRAW_EDIT_MODE

public static final int DRAW_EDIT_MODE
See Also:
Constant Field Values

ZOOM_SIZE

public static int ZOOM_SIZE
Constructor Detail

GFrame

public GFrame()
Method Detail

setFrozen

public void setFrozen(boolean state)
Specified by:
setFrozen in interface FrameListener

paintImmediately

public void paintImmediately()
Specified by:
paintImmediately in interface PComponent

paintImmediately

public void paintImmediately(int x,
                             int y,
                             int width,
                             int height)

paintImmediately

public void paintImmediately(Rectangle r)

startMovie

public void startMovie(int fps,
                       String filename)

startMovie

public void startMovie(int fps,
                       String filename,
                       boolean auto)

stopMovie

public void stopMovie()
basically dumps the movie to disk


flushBuffer

public void flushBuffer()
flushes the movie buffer. Right now it only gets called when we're done with a move, but maybe the right thing is to do it when the framebuffer gets too big


paint

public void paint(Graphics g)

getMode

public int getMode()

returnToRegular

public void returnToRegular()

switchHandler

public void switchHandler(int i)

getNodes

public PLayer getNodes()

getEdges

public PLayer getEdges()

getHulls

public PLayer getHulls()

getGCamera

public PCamera getGCamera()
returns the camera viewing the canvas in the frame

Returns:
the camera for this canvas

center

public void center()
Specified by:
center in interface FrameListener

centerFast

public void centerFast()

center

public void center(Object o)
Specified by:
center in interface FrameListener

center

public void center(Object o,
                   long t)

center

public void center(double minx,
                   double miny,
                   double maxx,
                   double maxy)

center

public void center(double minx,
                   double miny,
                   double maxx,
                   double maxy,
                   long t)

center

public void center(Rectangle2D r2,
                   long t)

setBackgroundImage

public void setBackgroundImage(String filename)
Specified by:
setBackgroundImage in interface FrameListener

setBackgroundImage

public void setBackgroundImage(String filename,
                               double x,
                               double y)
Specified by:
setBackgroundImage in interface FrameListener

removeBackgroundImage

public void removeBackgroundImage()
Specified by:
removeBackgroundImage in interface FrameListener

initialize

public void initialize()
an init routine... called when the frame is created. currently it only adds the layers to the canvas


getFullImage

public BufferedImage getFullImage()
returns a buffered image for the full image scaled to 1

Specified by:
getFullImage in interface FrameListener

getFullImage

public BufferedImage getFullImage(double scale)

getFullImage

public BufferedImage getFullImage(Rectangle2D fis)

getFullImage

public BufferedImage getFullImage(double maxWidth,
                                  double maxHeight)
returns a buffered image scaled to fit some coordinates


getFullImage

public BufferedImage getFullImage(Rectangle2D fis,
                                  double maxWidth,
                                  double maxHeight)

getFullImageDimensions

public Dimension getFullImageDimensions()

getFullImageDimensions

public Dimension getFullImageDimensions(double scale)

getFullImageSize

public Rectangle2D getFullImageSize()

getFullImage

public BufferedImage getFullImage(Rectangle2D trans,
                                  double scale)

getLastClickedPosition

public Point2D getLastClickedPosition()

getSelected

public Collection getSelected()

unselectAll

public void unselectAll()

overlayText

public void overlayText(String s)

setDisplayBackground

public void setDisplayBackground(Color bg)
sets the background color

Specified by:
setDisplayBackground in interface FrameListener
Parameters:
bg - the background color

setDisplayBackground

public void setDisplayBackground(String bg)

getDisplayBackground

public Color getDisplayBackground()
gets the display background color

Specified by:
getDisplayBackground in interface FrameListener
Returns:
the background color

exportGIF

public void exportGIF(String filename)
Specified by:
exportGIF in interface FrameListener

exportJPG

public void exportJPG(String filename)
Specified by:
exportJPG in interface FrameListener

exportPDF

public void exportPDF(String filename)
Specified by:
exportPDF in interface FrameListener

exportPS

public void exportPS(String filename)
Specified by:
exportPS in interface FrameListener

exportEPS

public void exportEPS(String filename)
Specified by:
exportEPS in interface FrameListener

exportSVG

public void exportSVG(String filename)
Specified by:
exportSVG in interface FrameListener

exportSWF

public void exportSWF(String filename)
Specified by:
exportSWF in interface FrameListener

exportJAVA

public void exportJAVA(String filename)
Specified by:
exportJAVA in interface FrameListener

exportCGM

public void exportCGM(String filename)
Specified by:
exportCGM in interface FrameListener

exportEMF

public void exportEMF(String filename)
Specified by:
exportEMF in interface FrameListener

exportPNG

public void exportPNG(String filename)
Specified by:
exportPNG in interface FrameListener

centerOn

public void centerOn(GuessPNode gpn)

centerOn

public void centerOn(GuessPNode n1,
                     GuessPNode n2)

saveState

public void saveState(String filename)

loadState

public void loadState(String filename)

writeFullImage

public void writeFullImage(String name,
                           int itype,
                           Properties props)

writeFullImage

public void writeFullImage(String name,
                           int itype,
                           double scale,
                           Properties props)

writeFullImage

public void writeFullImage(String name,
                           int itype,
                           Rectangle2D fis,
                           Properties props)

writeFullImage

public void writeFullImage(String name,
                           int itype,
                           double maxWidth,
                           double maxHeight,
                           Properties props)
returns a buffered image scaled to fit some coordinates


writeFullImage

public void writeFullImage(String name,
                           int itype,
                           Rectangle2D fis,
                           double maxWidth,
                           double maxHeight,
                           Properties props)

writeFullImage

public void writeFullImage(String name,
                           int itype,
                           Rectangle2D trans,
                           double scale,
                           Properties props)