edu.wpi.cs.cs509.clipboard
Class ClipboardGUI

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--edu.wpi.cs.cs509.clipboard.ClipboardGUI
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.lang.Runnable, java.io.Serializable

public class ClipboardGUI
extends java.awt.Frame
implements java.lang.Runnable

Provides an Office-like Clipboard that enables block components to connect to and process numerous copy/paste events over the same target.

Author:
George T. Heineman (heineman@cs.wpi.edu)
See Also:
Serialized Form

Field Summary
protected  java.awt.Image clearImage
          Image to store the clear GIF image.
protected  IClipboard clipboard
          Clipboard for retrieving typed information to show on screen.
protected  java.awt.Image copyImage
          Image to store the copy GIF image.
protected  IClipboardAccessor externalAccessor
          Agent to contact to request clipboard functionality.
protected  boolean imagesLoaded
          Determines if our images have been loaded.
protected  java.awt.Image pasteAllImage
          Image to store the pasteAll GIF image.
protected  java.lang.Thread thread
          Thread in which we will run.
protected  boolean visible
          Determines if we are visible.
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
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
ClipboardGUI()
          ClipboardGUI constructor comment.
ClipboardGUI(IClipboard clipboard)
          ClipboardGUI constructor comment.
 
Method Summary
 void activateFrame(boolean enabled)
          Bring Clipboard GUI to screen.
 void button_ActionPerformed(java.awt.event.ActionEvent actionEvent)
          Based on the label of the button, invoke the paste nth command.
 void clearPanel_MouseDragged()
          Process drag events over the clear panel.
 void clearPanel_MouseExited()
          Process exit events over the clear panel.
 void clearPanel_MouseMoved()
          Process moved events over the clear panel.
 void clearPanel_MousePressed()
          Process press events over the clear panel.
 void clearPanel_MouseReleased(java.awt.event.MouseEvent mouseEvent)
          Process release events over the clear panel.
 void copyPanel_MouseDragged()
          Process drag events over the copy panel.
 void copyPanel_MouseExited()
          Process exit events over the copy panel.
 void copyPanel_MouseMoved()
          Process moved events over the copy panel.
 void copyPanel_MousePressed()
          Process press events over the copy panel.
 void copyPanel_MouseReleased(java.awt.event.MouseEvent mouseEvent)
          Process release events over the copy panel.
 void loadImages()
          Load necessary clipboard GUI images from the resources directory.
 void pasteAllPanel_MouseDragged()
          Process drag events over the pasteAll panel.
 void pasteAllPanel_MouseExited()
          Process exit events over the pasteAll panel.
 void pasteAllPanel_MouseMoved()
          Process moved events over the pasteAll panel.
 void pasteAllPanel_MousePressed()
          Process press events over the pasteAll panel.
 void pasteAllPanel_MouseReleased(java.awt.event.MouseEvent mouseEvent)
          Process release events over the pasteAll panel.
 void run()
          Run the thread that launches the image loader.
 void setExternalAccessor(IClipboardAccessor externalAccessor)
          Informs ClipboardGUI of the external agent to whom requests should be sent.
 void start()
          Run the thread that launches the image loader.
 void update()
          Update button entries.
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getAccessibleContext, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, paramString, remove, removeNotify, setCursor, setExtendedState, setIconImage, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

visible

protected boolean visible
Determines if we are visible.


imagesLoaded

protected boolean imagesLoaded
Determines if our images have been loaded.


externalAccessor

protected IClipboardAccessor externalAccessor
Agent to contact to request clipboard functionality.


clipboard

protected IClipboard clipboard
Clipboard for retrieving typed information to show on screen.


thread

protected java.lang.Thread thread
Thread in which we will run.


clearImage

protected java.awt.Image clearImage
Image to store the clear GIF image.


copyImage

protected java.awt.Image copyImage
Image to store the copy GIF image.


pasteAllImage

protected java.awt.Image pasteAllImage
Image to store the pasteAll GIF image.

Constructor Detail

ClipboardGUI

public ClipboardGUI()
ClipboardGUI constructor comment.


ClipboardGUI

public ClipboardGUI(IClipboard clipboard)
ClipboardGUI constructor comment.

Method Detail

activateFrame

public void activateFrame(boolean enabled)
Bring Clipboard GUI to screen.


button_ActionPerformed

public void button_ActionPerformed(java.awt.event.ActionEvent actionEvent)
Based on the label of the button, invoke the paste nth command.


clearPanel_MouseDragged

public void clearPanel_MouseDragged()
Process drag events over the clear panel.

Since the mouse is down, we know that the button must be depressed. To ensure that the button is hilighted in case we have exited the region, we just turn the hilight on also.


clearPanel_MouseExited

public void clearPanel_MouseExited()
Process exit events over the clear panel.

Since the mouse has exited the region, we un-hilight the button. If it had already been depressed, the PaintableCanvas will retain the hilight while dispensing with the depressed state.


clearPanel_MouseMoved

public void clearPanel_MouseMoved()
Process moved events over the clear panel.

Since the mouse has moved over the region, we can safely hilight the area but that is all.


clearPanel_MousePressed

public void clearPanel_MousePressed()
Process press events over the clear panel.

Since the mouse was pressed over this region, we can mark it as depressed.


clearPanel_MouseReleased

public void clearPanel_MouseReleased(java.awt.event.MouseEvent mouseEvent)
Process release events over the clear panel.

Un-depress the button (since mouse is up).

Un-hilight the button (since mouse is up).

Note: parameter is never used.


copyPanel_MouseDragged

public void copyPanel_MouseDragged()
Process drag events over the copy panel.

Since the mouse is down, we know that the button must be depressed. To ensure that the button is hilighted in case we have exited the region, we just turn the hilight on also.


copyPanel_MouseExited

public void copyPanel_MouseExited()
Process exit events over the copy panel.

Since the mouse has exited the region, we un-hilight the button. If it had already been depressed, the PaintableCanvas will retain the hilight while dispensing with the depressed state.


copyPanel_MouseMoved

public void copyPanel_MouseMoved()
Process moved events over the copy panel.

Since the mouse has moved over the region, we can safely hilight the area but that is all.


copyPanel_MousePressed

public void copyPanel_MousePressed()
Process press events over the copy panel.

Since the mouse was pressed over this region, we can mark it as depressed.


copyPanel_MouseReleased

public void copyPanel_MouseReleased(java.awt.event.MouseEvent mouseEvent)
Process release events over the copy panel.

Un-depress the button (since mouse is up).

Un-hilight the button (since mouse is up).

Note: parameter is never used.


loadImages

public void loadImages()
Load necessary clipboard GUI images from the resources directory.


pasteAllPanel_MouseDragged

public void pasteAllPanel_MouseDragged()
Process drag events over the pasteAll panel.

Since the mouse is down, we know that the button must be depressed. To ensure that the button is hilighted in case we have exited the region, we just turn the hilight on also.


pasteAllPanel_MouseExited

public void pasteAllPanel_MouseExited()
Process exit events over the pasteAll panel.

Since the mouse has exited the region, we un-hilight the button. If it had already been depressed, the PaintableCanvas will retain the hilight while dispensing with the depressed state.


pasteAllPanel_MouseMoved

public void pasteAllPanel_MouseMoved()
Process moved events over the pasteAll panel.

Since the mouse has moved over the region, we can safely hilight the area but that is all.


pasteAllPanel_MousePressed

public void pasteAllPanel_MousePressed()
Process press events over the pasteAll panel.

Since the mouse was pressed over this region, we can mark it as depressed.


pasteAllPanel_MouseReleased

public void pasteAllPanel_MouseReleased(java.awt.event.MouseEvent mouseEvent)
Process release events over the pasteAll panel.

Un-depress the button (since mouse is up).

Un-hilight the button (since mouse is up).

Note: parameter is never used.


run

public void run()
Run the thread that launches the image loader.

Specified by:
run in interface java.lang.Runnable

setExternalAccessor

public void setExternalAccessor(IClipboardAccessor externalAccessor)
Informs ClipboardGUI of the external agent to whom requests should be sent.

Parameters:
externalAccessor - edu.wpi.cs.cs509.graph.clipboard.IClipboardAccessor

start

public void start()
Run the thread that launches the image loader.


update

public void update()
Update button entries.