public class GraphView extends javax.swing.JDesktopPane implements Controllable, java.util.Observer
Modifier and Type | Field and Description |
---|---|
static int |
FRAME_RATE |
static int |
TUTORIAL_FRAME_WIDTH |
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Constructor and Description |
---|
GraphView() |
GraphView(PuzzleInstance thePuzzle,
java.lang.String theTitle)
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkWithinBox(java.awt.Point p)
Checks to see if a point is within the area defined by the selection box
|
void |
cleanup()
What should I do when I am no longer needed?
|
void |
closeBox()
Used when a selection box should not be drawn any more.
|
void |
displayInternalFrame(java.lang.String title,
java.lang.String contents,
java.util.ArrayList<java.awt.Point> pointsOfInterest,
boolean showNextButton) |
javax.swing.JComponent |
getComponent()
Implement as:
return this;
Stupid, but only way to get the job done.
|
int |
getMinHeight() |
int |
getMinWidth() |
java.awt.Point |
getVertexCenter() |
int |
getVertexHeight()
Return the scale of this jTableView: the complete height of the drawn vertex image
|
int |
getVertexWidth()
Return the scale of this jTableView: the complete width of the drawn vertex image
|
double |
getZoom() |
void |
init(PuzzleInstance thePuzzle,
java.lang.String theTitle) |
boolean |
isStillAnimating() |
void |
resizeCanvas(boolean adjustTutorialDialog)
Resize the area of the canvas to fit the layout of the vertices.
|
void |
setCurrentPoint(java.awt.Point p)
Sets the current point that the mouse is at in drawing a selection box
|
void |
setInitialPoint(java.awt.Point p)
Sets the initial point that the mouse was at for drawing the selection box
|
void |
setPuzzle(PuzzleInstance game) |
void |
start()
What should I do when I am first displayed?
|
void |
startTimer() |
void |
stop()
What should I do when I am not being displayed?
|
void |
stopTimer()
Stops the timer.
|
void |
tick() |
java.awt.Point |
transformPointFromGraphCoordinatesToView(java.awt.Point p) |
java.awt.Point |
transformPointFromViewToGraphCoordinates(java.awt.Point p)
Transform the point according to the current transform.
|
void |
update(java.util.Observable o,
java.lang.Object arg)
This is the method that is called when an object that this class is listening to, fires an event.
|
void |
zoomHome() |
void |
zoomIn() |
void |
zoomOut() |
getAccessibleContext, getAllFrames, getAllFramesInLayer, getDesktopManager, getDragMode, getSelectedFrame, getUI, getUIClassID, remove, remove, removeAll, selectFrame, setComponentZOrder, setDesktopManager, setDragMode, setSelectedFrame, setUI, updateUI
getComponentCountInLayer, getComponentsInLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getPosition, highestLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, setLayer, setLayer, setPosition
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, removeContainerListener, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, 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, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public static final int FRAME_RATE
public static final int TUTORIAL_FRAME_WIDTH
public GraphView()
public GraphView(PuzzleInstance thePuzzle, java.lang.String theTitle)
currentlySelectedPuzzle
- The game instance you want to have associated with this jTableViewthemeName
- The theme name that this jTableView should use to drawpublic void init(PuzzleInstance thePuzzle, java.lang.String theTitle)
public void displayInternalFrame(java.lang.String title, java.lang.String contents, java.util.ArrayList<java.awt.Point> pointsOfInterest, boolean showNextButton)
public void setPuzzle(PuzzleInstance game)
public void tick()
public void stopTimer()
public void startTimer()
public void update(java.util.Observable o, java.lang.Object arg)
update
in interface java.util.Observer
public void setInitialPoint(java.awt.Point p)
p
- The initial point that the mouse was at when the selection box started being drawnpublic void setCurrentPoint(java.awt.Point p)
p
- The current point the mouse is at in drawing the selection boxpublic void closeBox()
public boolean checkWithinBox(java.awt.Point p)
p
- The point that you want check against the boxes selection areapublic int getVertexWidth()
public int getVertexHeight()
public java.awt.Point getVertexCenter()
public void resizeCanvas(boolean adjustTutorialDialog)
adjustTutorialDialog
- TODOwidth
- The desired widthheight
- The desired heightpublic void zoomHome()
public void zoomIn()
public void zoomOut()
public java.awt.Point transformPointFromViewToGraphCoordinates(java.awt.Point p)
p
- public java.awt.Point transformPointFromGraphCoordinatesToView(java.awt.Point p)
public double getZoom()
public boolean isStillAnimating()
public void cleanup()
Controllable
cleanup
in interface Controllable
public javax.swing.JComponent getComponent()
Controllable
getComponent
in interface Controllable
public void start()
Controllable
start
in interface Controllable
public void stop()
Controllable
stop
in interface Controllable
public int getMinWidth()
public int getMinHeight()