public class BlockCanvas extends java.lang.Object implements PageChangeListener, ISupportMemento
| Modifier and Type | Class and Description |
|---|---|
class |
BlockCanvas.Canvas
The graphical representation of the block canvas's Swng Container of pages.
|
| Constructor and Description |
|---|
BlockCanvas(Workspace workspace)
Constructs BlockCanvas and subscribes
this BlockCanvas to PageChange events
|
| Modifier and Type | Method and Description |
|---|---|
void |
addPage(Page page) |
void |
addPage(Page page,
int position) |
void |
arrangeAllBlocks() |
java.lang.Iterable<RenderableBlock> |
getBlocks() |
javax.swing.JComponent |
getCanvas() |
int |
getHeight() |
javax.swing.BoundedRangeModel |
getHorizontalModel() |
javax.swing.JComponent |
getJComponent()
Warning: Please take special care in useing this method, as it exposes
implementation details.
|
java.util.List<Page> |
getLeftmostPages(int left) |
Page |
getPageNamed(java.lang.String name) |
java.util.List<Page> |
getPages() |
org.w3c.dom.Node |
getSaveNode(org.w3c.dom.Document document)
Returns an XML node describing all the blocks and pages within
the BlockCanvas
|
java.lang.Object |
getState() |
java.lang.Iterable<RenderableBlock> |
getTopLevelBlocks() |
javax.swing.BoundedRangeModel |
getVerticalModel() |
int |
getWidth() |
int |
getX() |
int |
getY() |
boolean |
hasPageAt(int position) |
void |
loadState(java.lang.Object memento) |
int |
numOfPages() |
void |
reformBlockCanvas() |
Page |
removePage(int position) |
Page |
removePage(Page page) |
Page |
renamePage(java.lang.String oldName,
java.lang.String newName) |
void |
reset() |
void |
scrollToComponent(javax.swing.JComponent c) |
void |
scrollToShowBlock(RenderableBlock block) |
void |
switchViewToPage(Page page) |
java.lang.String |
toString() |
void |
update()
notifies this PageChangeListener that at least one
of the pages have changed states.
|
public BlockCanvas(Workspace workspace)
public void reset()
public int getX()
public int getY()
public int getWidth()
public int getHeight()
public javax.swing.BoundedRangeModel getVerticalModel()
public javax.swing.BoundedRangeModel getHorizontalModel()
public javax.swing.JComponent getCanvas()
public javax.swing.JComponent getJComponent()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.List<Page> getLeftmostPages(int left)
public java.lang.Iterable<RenderableBlock> getBlocks()
public void arrangeAllBlocks()
public java.lang.Iterable<RenderableBlock> getTopLevelBlocks()
public void scrollToShowBlock(RenderableBlock block)
block - - the RenderableBlock to make sure is shown in the viewportpublic void scrollToComponent(javax.swing.JComponent c)
public int numOfPages()
public boolean hasPageAt(int position)
position - - 0 is the left most positionpublic Page getPageNamed(java.lang.String name)
name - - name of pagepublic java.util.List<Page> getPages()
public void addPage(Page page)
page - the page to add to the BlockCanvaspublic void addPage(Page page, int position)
page - - page to be addedposition - - the index at which to add the page where 0 is rightmostjava.lang.RuntimeException - if (position < 0 || position > pages.size() || page == null)public Page removePage(int position)
position - - 0 is the left most pagepublic void switchViewToPage(Page page)
page - the desired page to switch view topublic Page renamePage(java.lang.String oldName, java.lang.String newName)
oldName - - the original name of the pagenewName - - the String name to rename the page topublic void update()
PageChangeListenerupdate in interface PageChangeListenerpublic void reformBlockCanvas()
public org.w3c.dom.Node getSaveNode(org.w3c.dom.Document document)
null if there are no pagespublic java.lang.Object getState()
getState in interface ISupportMementopublic void loadState(java.lang.Object memento)
loadState in interface ISupportMemento