workspace
Class MiniMap
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
workspace.MiniMap
- All Implemented Interfaces:
- java.awt.event.MouseListener, java.awt.event.MouseMotionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, PageChangeListener, SearchableContainer, WorkspaceWidget
public class MiniMap
- extends javax.swing.JPanel
- implements WorkspaceWidget, java.awt.event.MouseListener, java.awt.event.MouseMotionListener, SearchableContainer, PageChangeListener
A MiniMap is a miniturized representation of the
current Workspace's block canvas. Each MiniMap may
only be associated with only one block canvas.
A MiniMap should display its associated set of
RenderableBlocks and Comments at their current position,
or render their motion in real time.
The Minimap must tranform the block canvas's width:height ratio
such that it would fit within the MiniMap's area.
This may warp the blocks to appear thinner/wider
than their real size.
The MiniMap should expand and shrink with some delay
as the user mouses over or moves the mouse out of focus.
blockCanvas : BlockCanvas //the block canvas that this MiniMap renders
blocks : Set //the set of blocks that this renders
comments : Set //the set of comments that this renders
mapwidth : Integer //this MiniMap's maximum width
mapheight: Integer //this MiniMap's maximum height
ratio : Double //the aspect ratio that this should maintain
// when rendering this.blocks and this.comments
- See Also:
- Serialized Form
Nested classes/interfaces inherited from class javax.swing.JPanel |
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Fields inherited from class javax.swing.JComponent |
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, 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 |
Methods inherited from class javax.swing.JPanel |
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, hide, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
MiniMap
public MiniMap()
hideMiniMap
public void hideMiniMap()
update
public void update()
- Description copied from interface:
PageChangeListener
- notifies this PageChangeListener that at least one
of the pages have changed states.
- Specified by:
update
in interface PageChangeListener
getSearchableElements
public java.lang.Iterable<RenderableBlock> getSearchableElements()
- Specified by codeblocks.workspace.SearchableContainer interface
- Specified by:
getSearchableElements
in interface SearchableContainer
- Returns:
- the SearchableElements contained within this SearchableContainer.
updateContainsSearchResults
public void updateContainsSearchResults(boolean containsSearchResults)
- Specified by codeblocks.workspace.SearchableContainer interface
- Specified by:
updateContainsSearchResults
in interface SearchableContainer
- Parameters:
containsSearchResults
- true when the SearchableContainer is part of the current results.
repositionMiniMap
public void repositionMiniMap()
paint
public void paint(java.awt.Graphics g)
- Overrides:
paint
in class javax.swing.JComponent
mouseDragged
public void mouseDragged(java.awt.event.MouseEvent e)
- When dragging along miniMap, zoom to new point
- Specified by:
mouseDragged
in interface java.awt.event.MouseMotionListener
mouseReleased
public void mouseReleased(java.awt.event.MouseEvent e)
- When releasing a mouse in a MiniMap, scroll to point
- Specified by:
mouseReleased
in interface java.awt.event.MouseListener
mouseMoved
public void mouseMoved(java.awt.event.MouseEvent e)
- MouseEvent methods not interested by this WorkspceWidget
- Specified by:
mouseMoved
in interface java.awt.event.MouseMotionListener
mousePressed
public void mousePressed(java.awt.event.MouseEvent e)
- Specified by:
mousePressed
in interface java.awt.event.MouseListener
mouseEntered
public void mouseEntered(java.awt.event.MouseEvent e)
- Specified by:
mouseEntered
in interface java.awt.event.MouseListener
mouseExited
public void mouseExited(java.awt.event.MouseEvent e)
- Specified by:
mouseExited
in interface java.awt.event.MouseListener
mouseClicked
public void mouseClicked(java.awt.event.MouseEvent e)
- Specified by:
mouseClicked
in interface java.awt.event.MouseListener
blockDragged
public void blockDragged(RenderableBlock block,
java.awt.Point WorkspacePoint)
- Parameters:
block
- WorkspacePoint
-
blockDropped
public void blockDropped(RenderableBlock block)
- Description copied from interface:
WorkspaceWidget
- Called by RenderableBlocks that get "dropped" onto this Widget
- Specified by:
blockDropped
in interface WorkspaceWidget
- Parameters:
block
-
blockEntered
public void blockEntered(RenderableBlock block)
- Block action methods not interested by MiniMap. Does nothing
- Specified by:
blockEntered
in interface WorkspaceWidget
- Parameters:
block
- the RenderableBlock being dragged
blockExited
public void blockExited(RenderableBlock block)
- Description copied from interface:
WorkspaceWidget
- Called when a RenderableBlock that was being dragged over this Widget
goes from being inside this Widget to being outside the Widget.
- Specified by:
blockExited
in interface WorkspaceWidget
- Parameters:
block
- the RenderableBlock being dragged
blockDragged
public void blockDragged(RenderableBlock block)
- Description copied from interface:
WorkspaceWidget
- Called by RenderableBlocks as they are dragged over this Widget.
- Specified by:
blockDragged
in interface WorkspaceWidget
- Parameters:
block
- the RenderableBlock being dragged
addBlock
public void addBlock(RenderableBlock block)
- Description copied from interface:
WorkspaceWidget
- Adds the specified block to this widget interally and graphically. The
difference between this method and blockDropped is that blockDropped is
activated by user actions, such as mouse drag and drop or typeblocking.
Use this method only for single blocks, as it may cause repainting! For
adding several blocks at once use addBlocks, which delays graphical updates
until after the blocks have all been added.
- Specified by:
addBlock
in interface WorkspaceWidget
- Parameters:
block
- the desired RenderableBlock to add to this
addBlocks
public void addBlocks(java.util.Collection<RenderableBlock> blocks)
- Description copied from interface:
WorkspaceWidget
- Adds a collection of blocks to this widget internally and graphically.
This method adds blocks internally first, and only updates graphically
once all of the blocks have been added. It is therefore preferable to
use this method rather than addBlock whenever multiple blocks will be added.
- Specified by:
addBlocks
in interface WorkspaceWidget
- Parameters:
blocks
- the Collection of RenderableBlocks to add
removeBlock
public void removeBlock(RenderableBlock block)
- Description copied from interface:
WorkspaceWidget
- Used by RenderableBlocks to tell their originating Widgets that
they're moving somewhere else and so should be removed.
- Specified by:
removeBlock
in interface WorkspaceWidget
- Parameters:
block
- the RenderableBlock
getJComponent
public javax.swing.JComponent getJComponent()
- JComponent representation of this
- Specified by:
getJComponent
in interface WorkspaceWidget
- Returns:
- the JComponent-ized cast of this widget.
contains
public boolean contains(int x,
int y)
- defined by JComponent.contains()
- Specified by:
contains
in interface WorkspaceWidget
- Overrides:
contains
in class javax.swing.JComponent
getBlocks
public java.util.Collection<RenderableBlock> getBlocks()
- Description copied from interface:
WorkspaceWidget
- Returns the set of blocks that abstract "lives" inside this widget.
Does not return all the blocks that exists in thsi component,
or return all the blocks that are handled by this widget. Rather,
the set of blocks returned all the blocks that "lives" in this widget.
- Specified by:
getBlocks
in interface WorkspaceWidget
animateAutoCenter
public void animateAutoCenter(RenderableBlock block)
- Animate A fly to block's location on the MiniMap and BlockCanvas
- Parameters:
block
-