public class Workspace extends javax.swing.JLayeredPane implements ISupportMemento, RBParent, javax.swing.event.ChangeListener, ExplorerListener
| Modifier and Type | Field and Description |
|---|---|
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 |
DEFAULT_LAYER, DRAG_LAYER, FRAME_CONTENT_LAYER, LAYER_PROPERTY, MODAL_LAYER, PALETTE_LAYER, POPUP_LAYERTOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW| Constructor and Description |
|---|
Workspace() |
| Modifier and Type | Method and Description |
|---|---|
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
|
WorkspaceEnvironment |
getEnv() |
FactoryManager |
getFactoryManager() |
FocusTraversalManager |
getFocusManager()
Returns the FocusTraversalManager 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.
|
org.w3c.dom.Node |
getSaveNode(org.w3c.dom.Document document)
Returns the node 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)
|
TypeBlockManager |
getTypeBlockManager()
The type block manager, if defined.
|
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() |
getAccessibleContext, getComponentCountInLayer, getComponentsInLayer, getIndexOf, getLayer, getLayer, getLayeredPaneAbove, getPosition, highestLayer, isOptimizedDrawingEnabled, lowestLayer, moveToBack, moveToFront, paint, putLayer, remove, removeAll, setLayer, setLayer, setPositionaddAncestorListener, 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, getUIClassID, 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, updateUIadd, 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, remove, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validateaction, 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, transferFocusUpCyclepublic 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
public WorkspaceEnvironment getEnv()
public void explorerEventOccurred(ExplorerEvent event)
explorerEventOccurred in interface ExplorerListenerpublic 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) coordinatespublic 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 returnpublic java.lang.Iterable<Block> getBlocksFromGenus(java.lang.String genusName)
genusName - - the genus name of the blocks to returnpublic 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 TypeBlockManager getTypeBlockManager()
enableTypeBlocking(boolean)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.ChangeListenerpublic 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 org.w3c.dom.Node getSaveNode(org.w3c.dom.Document document)
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 ISupportMementopublic void loadState(java.lang.Object memento)
loadState in interface ISupportMementopublic void undo()
public void redo()
public void addToBlockLayer(java.awt.Component c)
addToBlockLayer in interface RBParentc - the Component to addpublic void addToHighlightLayer(java.awt.Component c)
RBParentaddToHighlightLayer in interface RBParentc - the Component to add