|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectworkspace.BlockCanvas
public class BlockCanvas
A BlockCanvas is a container of Pages and is a scrollable panel. When a page is added to a BlockCanvas, that particular new page must be added to both the data structure holding the set of pages and the scrollable panel that renders the page. A BlockCanvas is also a PageChangeListener. When any pages are changed, the Blockcanvas must update itself appropriately to reflect this change. As of the current implementation, the BlockCanvas must have at least one Page when it becomes visible (that is, when it’s viewable JComponent becomes visible).
Nested Class Summary | |
---|---|
class |
BlockCanvas.Canvas
The graphical representation of the block canvas's Swng Container of pages. |
Constructor Summary | |
---|---|
BlockCanvas()
Constructs BlockCanvas and subscribes this BlockCanvas to PageChange events |
Method Summary | |
---|---|
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()
|
java.util.List<Page> |
getLeftmostPages(int left)
|
protected Page |
getPageAt(int position)
|
Page |
getPageNamed(java.lang.String name)
|
java.util.List<Page> |
getPages()
|
java.lang.String |
getSaveString()
Returns an XML String 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)
|
protected void |
loadSaveString(org.w3c.dom.Element root)
Loads all the RenderableBlocks and their associated Blocks that reside within the block canvas. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public BlockCanvas()
Method Detail |
---|
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.Object
public 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 position
protected Page getPageAt(int position)
position
- - 0 is the left most position
public Page getPageNamed(java.lang.String name)
name
- - name of page
public 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 rightmost
java.lang.RuntimeException
- if (position < 0 || position > pages.size() || page == null)public Page removePage(Page page)
page
- - the page to be removedpublic 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 to
public void update()
PageChangeListener
update
in interface PageChangeListener
public void reformBlockCanvas()
public java.lang.String getSaveString()
protected void loadSaveString(org.w3c.dom.Element root)
root
- the Document Element containing the desired informationpublic java.lang.Object getState()
getState
in interface ISupportMemento
public void loadState(java.lang.Object memento)
loadState
in interface ISupportMemento
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |