|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JLayeredPane
workspace.Workspace
public class Workspace
The Workspace is the main block area, where blocks are manipulated and assembled. This class governs the blocks, the world, the view, drawing, dragging, animating.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JLayeredPane |
---|
javax.swing.JLayeredPane.AccessibleJLayeredPane |
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 |
Field Summary | |
---|---|
static java.lang.Integer |
BLOCK_HIGHLIGHT_LAYER
|
static java.lang.Integer |
BLOCK_LAYER
|
static java.lang.Integer |
DRAGGED_BLOCK_HIGHLIGHT_LAYER
|
static java.lang.Integer |
DRAGGED_BLOCK_LAYER
|
static boolean |
everyPageHasDrawer
|
static java.lang.Integer |
PAGE_LAYER
|
static java.lang.Integer |
WIDGET_LAYER
|
Fields inherited from class javax.swing.JLayeredPane |
---|
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYER |
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 |
Method Summary | |
---|---|
void |
addPage(Page page)
Adds the specified page to the Workspace at the right end of the canvas |
void |
addPage(Page page,
int position)
Adds the specified page to the Workspace at the specified position on the canvas |
void |
addToBlockLayer(java.awt.Component c)
RBParent implemented methods |
void |
addToHighlightLayer(java.awt.Component c)
Add this Component to the HighlightLayer, which is understood to be directly and completely beneath the BlockLayer, such that all Components on the HighlightLayer are rendered behind ALL Components on the BlockLayer. |
void |
addWidget(WorkspaceWidget widget,
boolean addGraphically,
boolean floatOverCanvas)
Adds the specified widget to this Workspace |
void |
addWorkspaceListener(WorkspaceListener listener)
Adds the specified WorkspaceListener |
void |
cleanUpAllBlocks()
Cleans up all the blocks within the block canvas using the default arrangement algorithm. |
void |
copyBlocks()
calls TypeBlockManager to copy the highlighted blocks on the canvas |
void |
disableMiniMap()
Disables the MiniMap from canvas |
void |
enableTypeBlocking(boolean enabled)
Enables TypeBLocking if and only if enabled == true |
void |
explorerEventOccurred(ExplorerEvent event)
|
java.lang.Iterable<SearchableContainer> |
getAllSearchableContainers()
Returns an unmodifiable Iterable of all the SearchableContainers within this workspace. |
BlockCanvas |
getBlockCanvas()
|
java.lang.Iterable<Block> |
getBlocks()
Returns the set of all Blocks in the Workspace. |
java.lang.Iterable<Block> |
getBlocksFromGenus(java.lang.String genusName)
Returns all the Blocks of the specified genus. |
java.awt.Dimension |
getCanvasOffset()
|
java.awt.Dimension |
getCanvasSize()
|
Page |
getCurrentPage(RenderableBlock block)
Find the page that lies underneath this block CAN RETURN NULL |
double |
getCurrentWorkspaceZoom()
Returns the current workspace zoom |
FactoryManager |
getFactoryManager()
|
FocusTraversalManager |
getFocusManager()
Returns the FocusTraversalManager instance |
static Workspace |
getInstance()
Returns the one Workspace instance |
MiniMap |
getMiniMap()
|
int |
getNumPages()
Returns the number of pages contained within this. |
Page |
getPageNamed(java.lang.String pageName)
|
java.lang.Iterable<RenderableBlock> |
getRenderableBlocks()
Returns the set of all RenderableBlocks in the Workspace. |
java.lang.Iterable<RenderableBlock> |
getRenderableBlocksFromGenus(java.lang.String genusName)
Returns all the RenderableBlocks of the specified genus. |
java.lang.String |
getSaveString()
Returns the save String of this. |
java.lang.Object |
getState()
|
java.lang.Iterable<RenderableBlock> |
getTopLevelBlocks()
Returns the top level blocks in the Workspace (blocks that are parents of stacks) |
WorkspaceWidget |
getWidgetAt(java.awt.Point point)
Returns the WorkspaceWidget currently at the specified point |
java.lang.Iterable<WorkspaceWidget> |
getWorkspaceWidgets()
Returns an unmodifiable Iterable over all the WorkspaceWidgets |
void |
loadState(java.lang.Object memento)
|
void |
loadWorkspaceFrom(org.w3c.dom.Element newRoot,
org.w3c.dom.Element originalLangRoot)
Loads the workspace with the following content: - RenderableBlocks and their associated Block instances that reside within the BlockCanvas |
void |
notifyListeners(WorkspaceEvent event)
Notifies all Workspace listeners of the workspace event |
void |
pageSelected(Page page,
boolean byUser)
Marks the page of the specified name as being selected. |
void |
pasteBlocks()
calls TypeBlockManager to pastes the highlighted blocks on the canvas |
void |
putPage(Page page,
int position)
Places the specified page at the specified index. |
void |
redo()
|
void |
removePage(Page page)
Removes the specified page from the Workspace |
void |
removePageAt(int position)
Removes the specified page from the Workspace at the specified position, where position 0 is the left most page |
void |
removeWidget(WorkspaceWidget widget)
Removes the specified widget from this Workspace |
void |
removeWorkspaceListener(WorkspaceListener listener)
Removes the specified WorkspaceListener |
void |
renamePage(java.lang.String oldName,
java.lang.String newName)
Renames the page with the specified oldName to the specified newName. |
void |
reset()
Clears the Workspace of: - all the live blocks in the BlockCanvas. |
void |
scrollToComponent(javax.swing.JComponent c)
|
void |
setupSubsets(java.util.Collection<Subset> subsets,
boolean usingSys,
boolean usingSubs)
Sets up the subsets by clearing all subsets and installing the new collection of subsets. |
void |
setWorkspaceZoom(double newZoom)
Sets the Workspace zoom at the specified zoom level |
void |
setWorkspaceZoomToDefault()
Resets the workspace zoom to the default level |
void |
stateChanged(javax.swing.event.ChangeEvent e)
|
void |
undo()
|
Methods inherited from class javax.swing.JLayeredPane |
---|
addImpl, getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getComponentToLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getObjectForLayer, getPosition, highestLayer, insertIndexForLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, paramString, putLayer, remove, removeAll, setLayer, setLayer, setPosition |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, 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, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, 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, updateUI |
Methods inherited from class java.awt.Container |
---|
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, processContainerEvent, processEvent, remove, 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 |
Field Detail |
---|
public static boolean everyPageHasDrawer
public static final java.lang.Integer PAGE_LAYER
public static final java.lang.Integer BLOCK_HIGHLIGHT_LAYER
public static final java.lang.Integer BLOCK_LAYER
public static final java.lang.Integer WIDGET_LAYER
public static final java.lang.Integer DRAGGED_BLOCK_HIGHLIGHT_LAYER
public static final java.lang.Integer DRAGGED_BLOCK_LAYER
Method Detail |
---|
public void explorerEventOccurred(ExplorerEvent event)
explorerEventOccurred
in interface ExplorerListener
public static Workspace getInstance()
Workspace
instance
Workspace
instancepublic java.awt.Dimension getCanvasSize()
public java.awt.Dimension getCanvasOffset()
public Page getPageNamed(java.lang.String pageName)
public BlockCanvas getBlockCanvas()
public MiniMap getMiniMap()
public FocusTraversalManager getFocusManager()
public void disableMiniMap()
public WorkspaceWidget getWidgetAt(java.awt.Point point)
point
- the Point2D
to get the widget at, given
in Workspace (i.e. window) coordinates
public void addWidget(WorkspaceWidget widget, boolean addGraphically, boolean floatOverCanvas)
widget
- the desired widget to addfloatOverCanvas
- if true, the Workspace will add and render this widget such that it "floats"
above the canvas and its set of blocks. If false, the widget will be laid out beside the canvas. This feature
only applies if the specified widget is added graphically to the workspace (addGraphically = true)addGraphically
- a Swing dependent parameter to tell the Workspace whether or not to add
the specified widget as a child component. This parameter should be false for widgets that have a
parent already specifiedpublic void removeWidget(WorkspaceWidget widget)
widget
- the desired widget to removepublic java.lang.Iterable<WorkspaceWidget> getWorkspaceWidgets()
public java.lang.Iterable<RenderableBlock> getRenderableBlocks()
public java.lang.Iterable<Block> getBlocks()
public java.lang.Iterable<RenderableBlock> getRenderableBlocksFromGenus(java.lang.String genusName)
genusName
- - the genus name of the blocks to return
public java.lang.Iterable<Block> getBlocksFromGenus(java.lang.String genusName)
genusName
- - the genus name of the blocks to return
public java.lang.Iterable<RenderableBlock> getTopLevelBlocks()
public void cleanUpAllBlocks()
public void copyBlocks()
public void pasteBlocks()
public void addWorkspaceListener(WorkspaceListener listener)
public void removeWorkspaceListener(WorkspaceListener listener)
listener
- public void notifyListeners(WorkspaceEvent event)
event
- public void enableTypeBlocking(boolean enabled)
public void setWorkspaceZoom(double newZoom)
newZoom
- the desired zoom levelpublic double getCurrentWorkspaceZoom()
public void setWorkspaceZoomToDefault()
public void scrollToComponent(javax.swing.JComponent c)
public void stateChanged(javax.swing.event.ChangeEvent e)
stateChanged
in interface javax.swing.event.ChangeListener
public void addPage(Page page)
page
- the desired page to addpublic void addPage(Page page, int position)
page
- the desired page to addpublic void putPage(Page page, int position)
page
- the Page to placeposition
- - the position to place the specified page,
where 0 is the leftmost pagepublic void removePageAt(int position)
position
- public void removePage(Page page)
page
- the desired page to removepublic void renamePage(java.lang.String oldName, java.lang.String newName)
oldName
- the oldName of the page to renamenewName
- the String name to change the page name topublic int getNumPages()
public Page getCurrentPage(RenderableBlock block)
block
- public void pageSelected(Page page, boolean byUser)
page
- the Page selectedbyUser
- true if Page was selected by the Userpublic FactoryManager getFactoryManager()
public java.lang.Iterable<SearchableContainer> getAllSearchableContainers()
public void setupSubsets(java.util.Collection<Subset> subsets, boolean usingSys, boolean usingSubs)
subsets
- - collection of subsetsusingSys
- - true for factory and myblocksusingSubs
- - true for subsetspublic java.lang.String getSaveString()
public void loadWorkspaceFrom(org.w3c.dom.Element newRoot, org.w3c.dom.Element originalLangRoot)
newRoot
- the XML Element containing the new desired content. Some of the
content in newRoot may override the content in originalLangRoot. (For now,
pages are automatically overwritten. In the future, will allow drawers
to be optionally overriden or new drawers to be inserted.)originalLangRoot
- the original language/workspace specification contentpublic void reset()
public java.lang.Object getState()
getState
in interface ISupportMemento
public void loadState(java.lang.Object memento)
loadState
in interface ISupportMemento
public void undo()
public void redo()
public void addToBlockLayer(java.awt.Component c)
addToBlockLayer
in interface RBParent
c
- the Component to addpublic void addToHighlightLayer(java.awt.Component c)
RBParent
addToHighlightLayer
in interface RBParent
c
- the Component to add
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |