|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjavax.swing.DefaultDesktopManager
org.ceryle.ui.ViewManager
public class ViewManager
ViewManager extends javax.swing.DefaultDesktopManager to handle maintenance of various views, and keeping the menubar in sync with the selected window's state.
Provides an processor for managing ViewFrame Notes. In earlier incarnations the 'NoteProcessor' class imported and exported all Notes from a single XHTML file, which stored positioning and style information as metadata. That proved a bit fragile, and didn't take advantage of the metadata capabilities in the internal database. This version now stores the note content and its metadata in the internal XML database, and uses a separate XNode for each note. All specialized support for notes is now done in the ViewManager class, which is also more appropriate.
| Field Summary | |
|---|---|
static Cursor |
dropCursor
Cursors supporting drag and drop. |
static int |
hTileLimit
The maximum number of views to tile horizontally. |
protected DatabaseUtils |
m_dbutils
The DatabaseUtils (re-)used as the Views. |
protected JDesktopPane |
m_dtp
The JDesktopPane used as the container for most of the UI. |
protected Action |
newNote
The Actions used to create new Views. |
static Cursor |
noDropCursor
Cursors supporting drag and drop. |
protected Action |
openDocumentView
The Actions used to create new Views. |
protected Action |
openGraphView
The Actions used to create new Views. |
protected Action |
openProjectView
The Actions used to create new Views. |
protected static boolean |
useKeyBindings
When true, set up and use key bindings on the desktop. |
static int |
vTileLimit
The maximum number of views to tile vertically. |
| Constructor Summary | |
|---|---|
ViewManager(Desktop desktop)
Constructor for ViewManager with the parent Desktop desktop. |
|
| Method Summary | |
|---|---|
void |
activateFrame(JInternalFrame jif)
Indicates JInternalFrame jif has focus, updating the menubar appropriately. |
boolean |
activateViewFrame(ViewFrame vf)
This brings the ViewFrame vf to the front. |
void |
addPopUpFrame(PopUpWindow popup)
Adds the PopUpWindow popup to the desktop, setting its size and displaying it. |
View |
addViewFrame(ViewFrame vf,
String title,
Rectangle bounds)
Supplied with a View (e.g., DocumentView, GraphView, etc.), adds the View to a ViewFrame and registers it with this ViewManager. |
ProjectView |
asProject(View view)
Embed the provided GraphView or DocumentView within a new ProjectView. |
View |
backgroundView(int type,
String title,
Rectangle bounds)
Does exactly the same thing as createView(int,String,Rectangle)
except that it does not set the resulting View as visible. |
void |
closeAllFrames()
Closes any open ViewFrames. |
void |
closeFrame()
Remove the current JInternalFrame from the registry and update View menu. |
void |
closeFrame(JInternalFrame jif)
Remove JInternalFrame jif from the registry and update View menu. |
View |
createView(int type)
Creates a new ViewFrame of the type specified, returning a reference to its internal JPanel extension (e.g., DocumentView, GraphView, etc.). |
View |
createView(int type,
String title)
Depending on the int type, creates a new DocumentView (View.NOTE or View.DOCUMENT), or GraphView (View.GRAPH) whose title is title, adds it to the desktop and the menu-based list of views, and finally, displays it. |
View |
createView(int type,
String title,
Rectangle bounds)
Depending on the int type, creates a new DocumentView (View.NOTE or View.DOCUMENT), or GraphView (View.GRAPH), whose title is title, adds it to the desktop and the menu-based list of views, and finally, displays it. |
void |
cycleViewFrames(boolean forward)
Cycle to the previous or next ViewFrame, depending on the boolean next, skipping null slots. |
void |
editCopy()
Copy. |
void |
editCut()
Cut. |
void |
editFind()
Edit Find. |
void |
editFindNext()
Edit Find Next. |
void |
editPaste()
Paste. |
void |
editRedo()
Redo. |
void |
editReplace()
Edit Replace. |
void |
editSelectAll()
Select All. |
void |
editUndo()
Undo. |
void |
fileClose(boolean forced)
Close the current document. |
void |
fileImport()
Import an external file of an understood notation. |
void |
fileNew()
Open a new document. |
void |
fileOpen()
Open an external document. |
void |
fileSave()
Save the current document to a file. |
void |
fileSave(File file)
Save the current document to File file. |
void |
fileSetTitle()
Sets the title of the current document. |
void |
find(boolean next)
Calls the appropriate find method based on the current view. |
ViewFrame |
findViewFrame(String systemId)
Return a ViewFrame whose systemId matches the provided value. |
DocumentView |
getAnyDocumentView()
Return any DocumentView window, null if there are none available. |
GraphView |
getAnyGraphView()
Return any GraphView window, null if there are none available. |
View |
getCurrentView()
Returns the topmost ViewFrame's content View, null if none are available. |
protected ViewFrame |
getCurrentViewFrame()
Returns the topmost ViewFrame currently not iconified, null if none are available. |
int |
getCurrentViewType()
Return the type of the current view View.NOTE, View.DOCUMENT, or View.GRAPH. |
DatabaseUtils |
getDatabaseUtils()
Returns the DatabaseUtils made available by this ViewManager. |
JDesktopPane |
getDesktop()
Returns the JDesktopPane used by this ViewManager. |
Point |
getDesktopGridLocation(int x,
int y)
Return the location on the desktop of the upper-left corner of the quadrant specified by the grid coordinate (x,y), at the current grid resolution. |
DocumentView |
getDocumentView()
Return the DocumentView contents of the current front ViewFrame if it is a ProjectView, DocumentView (in either mode), null if some other View type is selected (ie., in front). |
EditView |
getEditingView()
Return the EditView API contents of the current front ViewFrame if it is a ProjectView, DocumentView, or NoteView, null if some other View type is selected (ie., in front). |
EditView |
getEditingView(boolean focusOnly)
Return the EditView API contents of the current front ViewFrame if it is a ProjectView, DocumentView, or NoteView, null if some other View type is selected (ie., in front). |
Iterator |
getEditingViews()
Return an Iterator over all EditView-compatible Views. |
int |
getFrontViewType()
Returns the type of the frontmost View, ignoring Notes. |
GraphView |
getGraphView()
Return the current front GraphView window, null if some other window type is selected (ie., in front). |
GraphView |
getGraphView(boolean focusOnly)
Return the current front GraphView window, null if some other window type is selected (ie., in front). |
Iterator |
getGraphViews()
Return an Iterator over all GraphViews. |
Point |
getGridCoordinate(Point loc)
Return the closest grid coordinate of a provided Point loc on the desktop. |
IDFactory |
getIDFactory(String cid)
Returns a lazily-created IDFactory. |
protected int |
getNextNoteNumber()
Returns the next note number in sequence, permanently incrementing the note counter. |
int |
getNoteCount()
Returns the current number of Notes. |
String |
getNotesCollectionID()
Returns the Collection ID used for notes. |
String |
getNotesCollectionID(boolean query)
Returns the Collection ID used for notes. |
DocumentView |
getNoteView()
Return the DocumentView contents of the current front ViewFrame only if it is in Note mode. |
Rectangle |
getPopUpBounds()
Returns a recommended bounds rectangle (size and location) for PopUpWindows, using the current desktop as a guide. |
ProjectView |
getProjectView()
Return the ProjectView contents of the current front ViewFrame, null if some other View type is selected (ie., in front). |
int |
getViewCount(int type)
Return the number of ViewFrames of int type. |
ViewFrame |
getViewFrame(String systemId)
Returns the first ViewFrame matching the provided systemId, null if none match. |
Iterator |
getViews(int type)
Return a Iterator over all ViewFrames of int type, an empty Iterator if there are none. |
static int |
getViewType(ViewFrame viewframe)
Provided a ViewFrame, returns the type of its internal View. |
void |
iconifyFrame()
Indicates the selected JInternalFrame is to be iconified, and selects the next current front frame. |
void |
iconifyFrame(JInternalFrame jif)
Indicates JInternalFrame jif is to be iconified, and selects the current front frame. |
boolean |
isEmpty()
Returns true if this ViewManager contains no ViewFrames. |
DocumentView |
isNoteOpen(String nid)
Returns the corresponding View if a note having the provided ID is open, null if not. |
View |
isOpen(String systemId)
If there is an open View whose systemId matches the parameter, returns the View, otherwise null. |
void |
maximizeFrame()
Maximizes the currently selected JInternalFrame. |
void |
maximizeFrame(JInternalFrame jif)
Indicates JInternalFrame jif is to be maximized. |
void |
minimizeFrame()
Indicates JInternalFrame jif is to be minimized (ie., un-maximized). |
void |
minimizeFrame(JInternalFrame jif)
Indicates JInternalFrame jif is to be minimized (ie., un-maximized). |
void |
newNote()
Creates a new Note, querying for a title, which is used to generate the XNode ID. |
boolean |
notesVisible()
Returns true if there are any visible Notes. |
void |
openNote()
Open a Note by its ID nid, stored as an XNode in the XNodeStore's default 'notes' Collection. |
void |
openNote(String nid)
Open a Note by its ID nid, stored as an XNode in the XNodeStore's default 'notes' Collection. |
void |
parseBoundsInfo(DocumentView dv,
String s)
Parse the bounds data to set characteristics of the DocumentView. |
void |
parseStyleInfo(DocumentView dv,
String s)
Parse the style data to set characteristics of the DocumentView. |
void |
registerFrameTitle(ViewFrame vf)
Registers a change to the title of the ViewFrame vf, updating the View menu accordingly. |
void |
scrollToLine(int line)
Scroll To Line. |
void |
setDatabaseToolsVisible(boolean visible)
Toggle Database ToolBar visibility. |
void |
setDesktopImage()
Sets an image used as the background of the JDesktopPane. |
void |
setGridResolution(int resolution)
Set the grid resolution, i.e., the number of grid squares in which to divide the desktop (x and y resolution is always the same). |
void |
setNotesVisible(boolean visible)
Set the visibility of any Notes to the boolean visible. |
void |
setViewBounds(ViewFrame vf)
Sets the bounds (size and location) of ViewFrame vf, using the slot number and current desktop size as a guide. |
void |
tileHorizontally()
Tiles the current Views horizontally. |
void |
tileVertically()
Tiles the current Views vertically. |
void |
toggleGraphToolsVisibility()
Toggle Graph ToolBar visibility. |
void |
toggleQueryToolsVisibility()
Toggle ToolBar visibility. |
void |
toggleToolsVisibility()
Set Tool Visiblity. |
void |
updateDocumentViews()
Causes any editing views to re-index their collection and node lists. |
int |
viewCount(boolean includeNotes)
Returns the number of ViewFrames, including those iconified. |
| Methods inherited from class javax.swing.DefaultDesktopManager |
|---|
beginDraggingFrame, beginResizingFrame, deactivateFrame, deiconifyFrame, dragFrame, endDraggingFrame, endResizingFrame, getBoundsForIconOf, getPreviousBounds, openFrame, removeIconFor, resizeFrame, setBoundsForFrame, setPreviousBounds, setWasIcon, wasIcon |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static int hTileLimit
public static int vTileLimit
protected final JDesktopPane m_dtp
protected DatabaseUtils m_dbutils
protected static boolean useKeyBindings
public static Cursor dropCursor
public static Cursor noDropCursor
protected Action newNote
protected Action openProjectView
protected Action openDocumentView
protected Action openGraphView
| Constructor Detail |
|---|
public ViewManager(Desktop desktop)
| Method Detail |
|---|
public JDesktopPane getDesktop()
public DatabaseUtils getDatabaseUtils()
public String getNotesCollectionID()
public String getNotesCollectionID(boolean query)
public void setDesktopImage()
public View createView(int type)
type - the type of View to be created
public View createView(int type,
String title)
type - the type of View to be createdtitle - the View title
public View createView(int type,
String title,
Rectangle bounds)
type - the type of View to be createdtitle - the View titlebounds - the optional bounding rectangle of the created View
public ProjectView asProject(View view)
public View addViewFrame(ViewFrame vf,
String title,
Rectangle bounds)
vf - the ViewFrame to be addedtitle - the View titlebounds - the optional bounding rectangle of the created View
public View backgroundView(int type,
String title,
Rectangle bounds)
createView(int,String,Rectangle)
except that it does not set the resulting View as visible.
type - the type of View to be createdtitle - the View titlebounds - the optional bounding rectangle of the created View
public void registerFrameTitle(ViewFrame vf)
public void addPopUpFrame(PopUpWindow popup)
public ViewFrame getViewFrame(String systemId)
public ViewFrame findViewFrame(String systemId)
getViewFrame(String), this tries various alterations
of the systemId. Returns null if not found. Note that this locates
the first match only.
public void activateFrame(JInternalFrame jif)
activateFrame in interface DesktopManageractivateFrame in class DefaultDesktopManagerpublic void iconifyFrame()
public void iconifyFrame(JInternalFrame jif)
iconifyFrame in interface DesktopManagericonifyFrame in class DefaultDesktopManagerpublic void maximizeFrame()
public void maximizeFrame(JInternalFrame jif)
maximizeFrame in interface DesktopManagermaximizeFrame in class DefaultDesktopManagerpublic void minimizeFrame()
public void minimizeFrame(JInternalFrame jif)
minimizeFrame in interface DesktopManagerminimizeFrame in class DefaultDesktopManagerpublic void closeFrame()
public void closeFrame(JInternalFrame jif)
closeFrame in interface DesktopManagercloseFrame in class DefaultDesktopManagerpublic void closeAllFrames()
public void tileHorizontally()
public void tileVertically()
public void setViewBounds(ViewFrame vf)
public Rectangle getPopUpBounds()
public void setGridResolution(int resolution)
public Point getGridCoordinate(Point loc)
public Point getDesktopGridLocation(int x,
int y)
public void cycleViewFrames(boolean forward)
public boolean activateViewFrame(ViewFrame vf)
public int viewCount(boolean includeNotes)
public boolean isEmpty()
public void newNote()
public int getNoteCount()
public int getFrontViewType()
public View isOpen(String systemId)
protected int getNextNoteNumber()
public boolean notesVisible()
public void setNotesVisible(boolean visible)
public DocumentView isNoteOpen(String nid)
public void openNote()
public void openNote(String nid)
public void parseStyleInfo(DocumentView dv,
String s)
public void parseBoundsInfo(DocumentView dv,
String s)
public void updateDocumentViews()
protected ViewFrame getCurrentViewFrame()
public View getCurrentView()
public Iterator getViews(int type)
public int getViewCount(int type)
public EditView getEditingView()
public EditView getEditingView(boolean focusOnly)
public Iterator getEditingViews()
public Iterator getGraphViews()
public ProjectView getProjectView()
public DocumentView getDocumentView()
public DocumentView getNoteView()
public DocumentView getAnyDocumentView()
Note that this will return DocumentView frames in either editor or note mode, and if the front window is a ProjectView, its DocumentView content is returned.
This is a convenience method.
public GraphView getGraphView()
public GraphView getGraphView(boolean focusOnly)
public GraphView getAnyGraphView()
This is a convenience method.
public static int getViewType(ViewFrame viewframe)
View.NOTE,
View.DOCUMENT,
View.GRAPH,
View.PROJECTpublic int getCurrentViewType()
View.NOTE,
View.DOCUMENT,
View.GRAPH,
View.PROJECTpublic void find(boolean next)
public IDFactory getIDFactory(String cid)
public void fileNew()
public void fileOpen()
public void fileImport()
public void fileSave()
public void fileSave(File file)
public void fileClose(boolean forced)
public void fileSetTitle()
public void editUndo()
public void editRedo()
public void editCut()
public void editCopy()
public void editPaste()
public void editSelectAll()
public void editFind()
public void editFindNext()
public void editReplace()
public void scrollToLine(int line)
public void toggleToolsVisibility()
public void setDatabaseToolsVisible(boolean visible)
public void toggleQueryToolsVisibility()
public void toggleGraphToolsVisibility()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||