|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectworkspace.Page
public class Page
A Page serves as both an abstract container of blocks and also a graphical panel that renders its collection of blocks. Abstractly, a page has seven abstract fields: a color, a name, a font, a drawer, width, a height, and a set of blocks. How it renders these abstract fields depends on the state of the page, including: zoom level, and minimumPixelWidth. A Page exists as a WorkspaceWidget, a SearchableContainer, ISupportMemento, an RBParent, a Zoomable object, and a JPanel. As a WorkspaceWidget, it can add, remove, blocks and manage block manipulations within itself. As a searchableContainer, it can notify users that certain blocks have been queried. As an ISupportMomento, it can undo the current values of abstract fields. As an RBParent, it can highlight blocks. Since a Page is both a Zoomable object and JPanel, Pages separate its abstract model and view by allowing clients to mutate its abstract fields directly. But clients must remember to reform the pages in order to synchronize the data between the model and view. A page’s abstract color is rendered the same no matter what state the page is in. A page’s abstract name is rendered thrice centered at every fourth of the page. The name is rendered with a size depending on the zoom level of that page (it tries to maintain a constant aspect ratio). The drawer name is not rendered. The width and height of the page is rendered differently depending on the zoom level and minimumPixelWidth. Using the zoom level, it tries to maintain a constant aspect ratio but the absolute sizes varies with a bigger/smaller zoom level. the minimumPixelWidth limits the width from going below a certain size, no matter what the system tries to set the abstract width to be. Finally the set of blocks are rendered directly onto the page with the same transformation as the ones imposed on the width and height of the page. As an implementation detail, a page tries to maintain a separation between its abstract states and its view. Clients of Pages should use reform*() methods to validate information between the abstract states and view. Clients of Pages are warned against accessing Page.getJComponent(), as the method provides clients a way to unintentionally mutate an implementation specific detail of Pages. A Page implements ExplorerListener i.e. it listens for possible changes in an explorer that affects the display of the page. When an explorer event happens the page changes its display accordingly
Field Summary | |
---|---|
static int |
DEFAULT_ABSTRACT_HEIGHT
The default abstract height |
(package private) static double |
zoom
this.zoomLevel: zoom level state |
Constructor Summary | |
---|---|
Page(java.lang.String name)
Constructs a new Page |
|
Page(java.lang.String name,
int pageWidth,
int pageHeight,
java.lang.String pageDrawer)
Constructs a new Page |
|
Page(java.lang.String name,
int pageWidth,
int pageHeight,
java.lang.String pageDrawer,
boolean inFullview,
java.awt.Color defaultColor)
|
Method Summary | |
---|---|
void |
addBlock(RenderableBlock block)
Adds the specified block to this widget interally and graphically. |
void |
addBlocks(java.util.Collection<RenderableBlock> blocks)
Adds a collection of blocks to this widget internally and graphically. |
void |
addLoadedBlocks(java.util.Collection<RenderableBlock> loadedBlocks,
boolean importingPage)
|
void |
addPixelWidth(int deltaPixelWidth)
|
void |
blockDragged(RenderableBlock block)
Called by RenderableBlocks as they are dragged over this Widget. |
void |
blockDropped(RenderableBlock block)
Called by RenderableBlocks that get "dropped" onto this Widget |
void |
blockEntered(RenderableBlock block)
Called when a RenderableBlock is being dragged and goes from being outside this Widget to being inside the Widget. |
void |
blockExited(RenderableBlock block)
Called when a RenderableBlock that was being dragged over this Widget goes from being inside this Widget to being outside the Widget. |
void |
clearPage()
Destructs this Page by setting its set of blocks to empty. |
boolean |
contains(int x,
int y)
Widgets must be able to report whether a given point is inside them |
boolean |
contains(java.awt.Point p)
|
void |
disableMinimize()
|
void |
enableMinimize()
|
double |
getAbstractHeight()
|
double |
getAbstractWidth()
|
static Page |
getBlankPage()
Constructs a new Page |
java.util.Collection<RenderableBlock> |
getBlocks()
Returns the set of blocks that abstract "lives" inside this widget. |
java.awt.Color |
getDefaultPageColor()
|
java.awt.Image |
getIcon()
|
javax.swing.JComponent |
getJComponent()
Very Java Swing dependent method |
java.awt.Color |
getPageColor()
|
java.lang.String |
getPageDrawer()
|
java.lang.String |
getPageId()
Returns this page's id. |
java.lang.String |
getPageName()
|
RBParent |
getRBParent()
|
java.lang.String |
getSaveString()
|
java.lang.Iterable<RenderableBlock> |
getSearchableElements()
Returns all of the searchable elements within this Searchable. |
java.lang.Object |
getState()
|
java.util.Collection<RenderableBlock> |
getTopLevelBlocks()
|
static double |
getZoomLevel()
|
boolean |
isInFullview()
|
java.util.ArrayList<RenderableBlock> |
loadPageFrom(org.w3c.dom.Node pageNode,
boolean importingPage)
|
void |
loadState(java.lang.Object memento)
|
void |
reformBlockOrdering()
|
void |
reformBlockPosition(RenderableBlock block)
|
int |
reformBounds(double pixelXCor)
|
void |
reformMinimumPixelWidth()
|
void |
removeBlock(RenderableBlock block)
Used by RenderableBlocks to tell their originating Widgets that they're moving somewhere else and so should be removed. |
void |
reset()
TODO: THIS METHOD NOT YET DOCUMENTED OR IMPLEMENTED Removes all the RenderableBlock content of this. |
void |
setHide(boolean hide)
|
void |
setIcon(java.awt.Image image)
|
void |
setPageColor(java.awt.Color newColor)
|
void |
setPageId(java.lang.String id)
Sets the page id. |
void |
setPageName(java.lang.String newName)
|
void |
setPixelWidth(int pixelWidth)
|
static void |
setZoomLevel(double newZoom)
|
java.lang.String |
toString()
Returns string representation of this |
void |
updateContainsSearchResults(boolean containsSearchResults)
Called by the search bar to update the Searchable of whether it currently belongs to the search bar's results. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_ABSTRACT_HEIGHT
static double zoom
Constructor Detail |
---|
public Page(java.lang.String name, int pageWidth, int pageHeight, java.lang.String pageDrawer)
name
- - name of this page (this.name)pageWidth
- - the abstract width of this page (this.width)pageHeight
- - the abstract height of this page (this.height)pageDrawer
- - the name of the page drawer that this page refers topublic Page(java.lang.String name, int pageWidth, int pageHeight, java.lang.String pageDrawer, boolean inFullview, java.awt.Color defaultColor)
public Page(java.lang.String name)
name
- - name of this page (this.name)Method Detail |
---|
public void disableMinimize()
public void enableMinimize()
public void setHide(boolean hide)
public static Page getBlankPage()
public void reset()
public void clearPage()
public void setPageId(java.lang.String id)
public java.util.Collection<RenderableBlock> getBlocks()
WorkspaceWidget
getBlocks
in interface WorkspaceWidget
public java.util.Collection<RenderableBlock> getTopLevelBlocks()
public java.lang.String getPageId()
public java.lang.String getPageName()
public java.awt.Color getPageColor()
public java.awt.Color getDefaultPageColor()
public double getAbstractWidth()
public double getAbstractHeight()
public java.lang.String getPageDrawer()
public java.awt.Image getIcon()
public boolean isInFullview()
public void setPageName(java.lang.String newName)
newName
- - the new name of this page.public void setIcon(java.awt.Image image)
image
- - the new icon of this. May be nullpublic void setPageColor(java.awt.Color newColor)
newColor
- - the new color of this pagepublic void addPixelWidth(int deltaPixelWidth)
deltaPixelWidth
- public void setPixelWidth(int pixelWidth)
public int reformBounds(double pixelXCor)
pixelXCor
- - the new X location of page's JComponent in terms of pixels
public void reformBlockPosition(RenderableBlock block)
block
- - the new block being added whose position must be revalidatedpublic void reformMinimumPixelWidth()
public void reformBlockOrdering()
public static void setZoomLevel(double newZoom)
newZoom
- - the new zoom levelpublic static double getZoomLevel()
public void blockDropped(RenderableBlock block)
WorkspaceWidget
blockDropped
in interface WorkspaceWidget
block
- the RenderableBlock that is "dropped" onto this Widgetpublic void blockDragged(RenderableBlock block)
WorkspaceWidget
blockDragged
in interface WorkspaceWidget
block
- the RenderableBlock being draggedpublic void blockEntered(RenderableBlock block)
WorkspaceWidget
blockEntered
in interface WorkspaceWidget
block
- the RenderableBlock being draggedpublic void blockExited(RenderableBlock block)
WorkspaceWidget
blockExited
in interface WorkspaceWidget
block
- the RenderableBlock being draggedpublic void addBlock(RenderableBlock block)
WorkspaceWidget
addBlock
in interface WorkspaceWidget
block
- the desired RenderableBlock to add to thispublic void addBlocks(java.util.Collection<RenderableBlock> blocks)
WorkspaceWidget
addBlocks
in interface WorkspaceWidget
blocks
- the Collection of RenderableBlocks to addpublic void removeBlock(RenderableBlock block)
WorkspaceWidget
removeBlock
in interface WorkspaceWidget
block
- the RenderableBlockpublic javax.swing.JComponent getJComponent()
WorkspaceWidget
getJComponent
in interface WorkspaceWidget
public RBParent getRBParent()
public boolean contains(int x, int y)
WorkspaceWidget
contains
in interface WorkspaceWidget
public boolean contains(java.awt.Point p)
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.Iterable<RenderableBlock> getSearchableElements()
SearchableContainer
getSearchableElements
in interface SearchableContainer
public void updateContainsSearchResults(boolean containsSearchResults)
SearchableContainer
updateContainsSearchResults
in interface SearchableContainer
containsSearchResults
- true when the SearchableContainer is part of the current results.public java.util.ArrayList<RenderableBlock> loadPageFrom(org.w3c.dom.Node pageNode, boolean importingPage)
public void addLoadedBlocks(java.util.Collection<RenderableBlock> loadedBlocks, boolean importingPage)
public java.lang.String getSaveString()
public 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 |