org.ceryle.ui
Class View
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.ceryle.ui.View
- All Implemented Interfaces:
- ImageObserver, MenuContainer, Serializable, Accessible
- Direct Known Subclasses:
- DocumentView, GraphView, ProjectView
public abstract class View
- extends JPanel
An abstract class for JPanel extensions that serve as
ViewFrame contents, such as DocumentView, GraphView,
ProjectView, etc.
Note:
This is not to be confused with Java's
javax.swing.text.View class.
- Version:
- $Id: View.java,v 3.13 2007-06-20 01:28:19 altheim Exp $
- Author:
- Murray Altheim
- See Also:
- Serialized Form
|
Constructor Summary |
View(ViewFrame viewframe,
int type)
Abstract constructor with a reference to the parent
ViewFrame viewframe, and the View type. |
|
Method Summary |
abstract void |
closing()
This indicates to the View that it is imminently closing,
and should do whatever is necessary to shut down cleanly. |
void |
deactivate()
Disable any components of the View based upon deactivation. |
abstract boolean |
fileClose(boolean forced)
Closes the current document, first checking to be sure
that the content is not modified. |
abstract boolean |
fileImport(Object source)
Import the provided source of an understood notation into the current
View. |
abstract boolean |
fileNew()
Creates a new, empty Document. |
abstract boolean |
fileOpen(File file)
Opens the selected File into the current View. |
boolean |
fileSave()
If the systemId of this View has been set, saves the current Document
to that systemId. |
abstract boolean |
fileSave(File file)
If the systemId of this View has been set (eg., by an earlier file
open or import), displays a file selection dialog box with the
existing filepath (otherwise uses the current default directory),
returns the selected path, then exports the contents of the current
Document to the chosen path. |
boolean |
fileSaveAs(File file)
Save the current document as a different file than the
current system identifier. |
Desktop |
getDesktop()
Returns the parent Desktop. |
abstract String |
getSelectedResource()
Returns the URI (as a String) of the selected resource, within
the context of its View type, null if unavailable or inappropriate. |
String |
getSystemId()
Returns the value of the last-opened file as a String,
null if unavailable. |
String |
getTitle()
Returns the title of this ViewFrame. |
int |
getType()
Returns the View type as an int. |
static String |
getTypeName(int type)
Return the name of this View's type, i.e., "project", "note",
"document", or "graph". |
ViewFrame |
getViewFrame()
Return the parent ViewFrame of this View. |
ViewManager |
getViewManager()
Return the parent ViewFrame of this View. |
static boolean |
hasDatabase(int type)
Returns true if the provided type type is a
View.PROJECT or View.DOCUMENT. |
static boolean |
hasEditing(int type)
Returns true if the provided type type is a
View.PROJECT, View.NOTE or View.DOCUMENT. |
static boolean |
hasGraph(int type)
Returns true if the provided type type is a
View.PROJECT, or View.GRAPH. |
abstract boolean |
isDirty()
Returns an indication of true if the current document has
been edited. |
static boolean |
isDocumentOrNoteView(int type)
Returns true if the provided type type is a
View.NOTE or View.DOCUMENT, the former being a mode of the latter. |
static boolean |
isDocumentView(int type)
Returns true if the provided type type is a
DocumentView in editor mode (type is View.DOCUMENT). |
static boolean |
isGraphView(int type)
Returns true if the provided type type is a
GraphView (type is View.GRAPH). |
static boolean |
isNoteView(int type)
Returns true if the provided type type is a
DocumentView in note mode (type is View.NOTE). |
static boolean |
isProjectView(int type)
Returns true if the provided type type is a
ProjectView (type is View.PROJECT). |
abstract void |
packView()
Causes subcomponents of this View to be laid out to their
preferred sizes. |
abstract void |
refresh()
Refresh any components of the View based upon activation or reactivation. |
abstract void |
requestFocus()
Sets the current focus to an appropriate user work area. |
void |
setSystemId(String systemId)
Stores the value of the last-opened file's pathname as a String. |
void |
setTitle(String title)
Sets the title of this ViewFrame's View to the String title. |
void |
setTitle(String title,
boolean query)
Sets the title of this View to the String title. |
void |
setViewFrame(int type,
ViewFrame viewframe)
Set the type and parent ViewFrame of this View to the provided values. |
| Methods inherited from class javax.swing.JComponent |
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, 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, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
| Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, 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, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
| Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, 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, hide, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, transferFocusUpCycle |
PROJECT
public static final int PROJECT
- An int used to indicate a document view in editor mode.
- See Also:
- Constant Field Values
NOTE
public static final int NOTE
- An int used to indicate a document view in note mode.
- See Also:
- Constant Field Values
DOCUMENT
public static final int DOCUMENT
- An int used to indicate a document view in editor mode.
- See Also:
- Constant Field Values
GRAPH
public static final int GRAPH
- An int used to indicate a graph view.
- See Also:
- Constant Field Values
m_desktop
protected Desktop m_desktop
vmgr
protected ViewManager vmgr
vf
protected ViewFrame vf
srvs
protected Services srvs
mh
protected MessageHandler mh
pm
protected PropertyManager pm
isClosing
protected boolean isClosing
m_verbose
protected boolean m_verbose
View
public View(ViewFrame viewframe,
int type)
- Abstract constructor with a reference to the parent
ViewFrame viewframe, and the View type.
Note that no checking of the type value is done.
getViewManager
public final ViewManager getViewManager()
- Return the parent ViewFrame of this View.
getViewFrame
public final ViewFrame getViewFrame()
- Return the parent ViewFrame of this View.
setViewFrame
public final void setViewFrame(int type,
ViewFrame viewframe)
- Set the type and parent ViewFrame of this View to the provided values.
getType
public int getType()
- Returns the View type as an int.
- See Also:
PROJECT,
NOTE,
DOCUMENT,
GRAPH
getTypeName
public static String getTypeName(int type)
- Return the name of this View's type, i.e., "project", "note",
"document", or "graph".
isProjectView
public static boolean isProjectView(int type)
- Returns true if the provided type type is a
ProjectView (type is View.PROJECT).
This is a convenience method.
isNoteView
public static boolean isNoteView(int type)
- Returns true if the provided type type is a
DocumentView in note mode (type is View.NOTE).
This is a convenience method.
isDocumentView
public static boolean isDocumentView(int type)
- Returns true if the provided type type is a
DocumentView in editor mode (type is View.DOCUMENT).
This is a convenience method.
isDocumentOrNoteView
public static boolean isDocumentOrNoteView(int type)
- Returns true if the provided type type is a
View.NOTE or View.DOCUMENT, the former being a mode of the latter.
This is a convenience method.
hasEditing
public static boolean hasEditing(int type)
- Returns true if the provided type type is a
View.PROJECT, View.NOTE or View.DOCUMENT. All have editing features.
(This is mostly used for menu compliance.)
This is a convenience method.
hasDatabase
public static boolean hasDatabase(int type)
- Returns true if the provided type type is a
View.PROJECT or View.DOCUMENT. Both have database features.
(This is mostly used for menu compliance.)
This is a convenience method.
isGraphView
public static boolean isGraphView(int type)
- Returns true if the provided type type is a
GraphView (type is View.GRAPH).
This is a convenience method.
hasGraph
public static boolean hasGraph(int type)
- Returns true if the provided type type is a
View.PROJECT, or View.GRAPH. All have graph
features. (This is mostly used for menu compliance.)
This is a convenience method.
getSelectedResource
public abstract String getSelectedResource()
- Returns the URI (as a String) of the selected resource, within
the context of its View type, null if unavailable or inappropriate.
setSystemId
public void setSystemId(String systemId)
- Stores the value of the last-opened file's pathname as a String.
Clear by setting to null.
getSystemId
public String getSystemId()
- Returns the value of the last-opened file as a String,
null if unavailable.
setTitle
public void setTitle(String title,
boolean query)
- Sets the title of this View to the String title. If
query is true, the user is queried for the title,
using the provided value as default.
setTitle
public void setTitle(String title)
- Sets the title of this ViewFrame's View to the String title.
This also registers the title as a menu item under the View menu.
getTitle
public String getTitle()
- Returns the title of this ViewFrame. If the value is null or "untitled",
null is returned.
getDesktop
public Desktop getDesktop()
- Returns the parent Desktop.
fileNew
public abstract boolean fileNew()
- Creates a new, empty Document.
- Returns:
- true if able to close any existing content and establish a new document
fileOpen
public abstract boolean fileOpen(File file)
- Opens the selected File into the current View.
If file is null, displays a FileChooser allowing user selection.
- Returns:
- true if opened
fileImport
public abstract boolean fileImport(Object source)
- Import the provided source of an understood notation into the current
View. This may require transformation for the specific viewing context.
If source is null, displays a FileChooser allowing user selection.
- Returns:
- true if opened
fileSave
public boolean fileSave()
- If the systemId of this View has been set, saves the current Document
to that systemId. If the systemId is not set, this acts the same as
fileSave(null).
- Returns:
- false if the user cancels the file selection dialog
or chooses not to overwrite an existing file. Returns true
if the save was successful or the source document (content) is empty
(i.e., we didn't need to save).
fileSave
public abstract boolean fileSave(File file)
- If the systemId of this View has been set (eg., by an earlier file
open or import), displays a file selection dialog box with the
existing filepath (otherwise uses the current default directory),
returns the selected path, then exports the contents of the current
Document to the chosen path.
- Returns:
- false if the user cancels the file selection dialog
or chooses not to overwrite an existing file. Returns true
if the save was successful or the source document (content) is empty
(i.e., we didn't need to save).
fileSaveAs
public boolean fileSaveAs(File file)
- Save the current document as a different file than the
current system identifier. If file is null, a
file chooser is displayed.
fileClose
public abstract boolean fileClose(boolean forced)
- Closes the current document, first checking to be sure
that the content is not modified. If the boolean forced
is true, provides only a "yes" or "no" option for the save dialog
if the existing content is dirty, "cancel" as well if false.
- Returns:
- true if closed
isDirty
public abstract boolean isDirty()
- Returns an indication of true if the current document has
been edited. For View types that do not allow editing, this
always returns false.
refresh
public abstract void refresh()
- Refresh any components of the View based upon activation or reactivation.
deactivate
public void deactivate()
- Disable any components of the View based upon deactivation.
requestFocus
public abstract void requestFocus()
- Sets the current focus to an appropriate user work area.
- Overrides:
requestFocus in class JComponent
packView
public abstract void packView()
- Causes subcomponents of this View to be laid out to their
preferred sizes.
closing
public abstract void closing()
- This indicates to the View that it is imminently closing,
and should do whatever is necessary to shut down cleanly.
The Ceryle Project. Copyright ©2001-2007 Murray Altheim, All Rights Reserved. See LICENSE included with distribution.