edu.neu.ccs.gui
Class StringViewer

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjavax.swing.JComponent
              extended byjavax.swing.JPanel
                  extended byedu.neu.ccs.gui.DisplayPanel
                      extended byedu.neu.ccs.gui.StringViewer
All Implemented Interfaces:
Accessible, AlertListener, Displayable, EventListener, Fragile, GeneralView, ImageObserver, JPTConstants, MalformedDataListener, MenuContainer, Serializable, SwingConstants, TypedView

public class StringViewer
extends DisplayPanel
implements GeneralView, Fragile, JPTConstants

Class StringViewer provides static tools for viewing a String in a GUI.

As of 2.6.0e, this class can also instantiate a StringViewer object that may be embedded in a GUI and manipulated by the caller. A StringViewer object embeds a TextAreaView which is placed in a JPTScrollPane which is placed in this object viewed as a DisplayPanel.

The caller can control the preferred size of the viewport in the scroll pane via the width and height parameters to the constructor. If these parameters are omitted, the width defaults to 800 and the height to 600. The minimum width and height is forced to be 100.

As of 2.6.0f, this class implements TypedView by delegating method calls to an internal TextAreaView. The goal is to permit this class to integrate with other JPT tools.

In effect, StringViewer now enables the creation of a text area in a scroll pane whose viewport size is controlled. This enables the use of a TypedView for multi-line text in a context where the screen real estate in the GUI will be predictable.

Upon further reflection, we decided that it would be helpful to implement GeneralView in addition to TypedView so those methods were added in 2.6.0g.

This class does not implement action listeners because they are not supported by the underlying JTextArea class. This class also does not implement property change listeners.

Since:
2.6.0
Version:
2.6.0g
See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
protected  GeneralViewSupport delegate
          The GeneralViewSupport object.
static String FONTNAME
          The default monospaced font name.
static int H_ALWAYS
          The horizontal scroll bar policy of ALWAYS.
static int HEIGHT
          The default scroll pane viewport height = 600.
static int MINIMUM
          The minimum width and height = 100.
protected  JPTScrollPane scrollpane
          The internal JPTScrollPane.
private static Font staticFont
          The display font for the static calls which uses the default font name, the default font size, and BOLD as the style.
private static int staticFontSize
          The default font size.
protected  TextAreaView textarea
          The internal TextAreaView.
static int V_ALWAYS
          The vertical scroll bar policy of ALWAYS.
static int WIDTH
          The default scroll pane viewport width = 800.
 
Fields inherited from class edu.neu.ccs.gui.DisplayPanel
background, codec, CODEC
 
Fields inherited from class javax.swing.JPanel
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface edu.neu.ccs.gui.TypedView
DATA_TYPE
 
Fields inherited from interface edu.neu.ccs.gui.Displayable
DEFAULT_VIEW_STATE, VIEW_STATE
 
Fields inherited from interface edu.neu.ccs.util.JPTConstants
ABOVE, ALIGNMENT, BELOW, BOTTOM_LEFT, BOTTOM_RIGHT, DEFAULT, FONT, INPUT_PROPERTIES, MANDATORY, OPTIONAL, ORIENTATION, TOP_LEFT, TOP_RIGHT, VALUE
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, PROPERTIES, SOMEBITS
 
Constructor Summary
StringViewer()
          The default constructor that uses empty initial text, a width of 800, a height of 600, and the default static font.
StringViewer(Font font)
          The constructor that uses empty initial text, a width of 800, a height of 600, and the given font.
StringViewer(int width, int height)
          The constructor that uses empty initial text, the given width and height, and the default static font.
StringViewer(int width, int height, Font font)
          The constructor that uses empty initial text, the given width and height, and the given font.
StringViewer(String text)
          The default constructor that uses the given initial text, a width of 800, a height of 600, and the default static font.
StringViewer(String text, Font font)
          The constructor that uses the given initial text, a width of 800, a height of 600, and the given font.
StringViewer(String text, int width, int height)
          The constructor that uses the given initial text, the given width and height, and the default static font.
StringViewer(String text, int width, int height, Font font)
          The constructor that uses the given initial text, the given width and height, and the given font.
 
Method Summary
 void addActionListener(ActionListener listener)
          This method is required by the GeneralView interface but the implementation does nothing since the underlying JTextArea does not fire action events.
 void addMalformedDataListener(MalformedDataListener l)
          Registers the given MalformedDataListener to receive MalformedDataEvents when the view state data is found to be malformed and when the view state data is returned to a well-formed value.
 void append(String text)
          Append the given text in the text area.
 void appendWithNewline(String text)
          Append the given text in the text area and then append a newline.
 Stringable demandObject()
          Returns a Stringable object based on the view state of the view using the mandatory model.
 Stringable demandObject(Class dataType, StringableFilter filter)
          Returns a Stringable object based on the view state of the view, the temporary data type and filter, and the mandatory model.
 Stringable demandObject(StringableFilter filter)
          Returns a Stringable object based on the view state of the view, the temporary filter, and the mandatory model.
 Class getDataType()
          Returns the current class of objects returned when a model object is demanded or requested.
static Font getDefaultFont()
          Returns the current default static font.
 String getDefaultViewState()
          Returns a String representation of the default view state for this object.
 StringableFilter getFilter()
          Returns the current filter used by this view.
 InputProperties getInputProperties()
          Returns the input properties for this view.
 JPTScrollPane getScrollPane()
          Returns the internal JPTScrollPane.
 String getText()
          Returns the text in the text area.
 TextAreaView getTextArea()
          Returns the internal TextAreaView.
 int getTextLength()
          Returns the length of the text in the text area.
 String getViewState()
          Equivalent to getText.
protected  void initialize(String text, int width, int height, Font font)
          The common constructor initialization code.
 void insert(int position, String text)
          Insert the given text in the text area at the given position.
 void insert(String text, int position)
          Insert the given text in the text area at the given position.
 GeneralView makeCopy()
          Returns a copy of this GeneralView.
static JPTScrollPane makeScrollView(String string)
          Wraps the given String in a TextAreaView object; then wraps the text area in a JPTScrollPane object whose viewport is bounded by 800-by-600; this scroll pane is returned.
static JPTScrollPane makeScrollView(String string, int width, int height)
          Wraps the given String in a TextAreaView object; then wraps the text area in a JPTScrollPane object whose viewport is bounded by the given width and height; this scroll pane is returned.
 void removeActionListener(ActionListener listener)
          This method is required by the GeneralView interface but the implementation does nothing since the underlying JTextArea does not fire action events.
 void removeMalformedDataListener(MalformedDataListener l)
          De-registers the given MalformedDataListener from receiving MalformedDataEvents when the view state data is found to be malformed and when the view state data is returned to a well-formed value.
 Stringable requestObject()
          Returns a Stringable object based on the view state of the view using the optional model; throws an exception if the input operation is cancelled by the user.
 Stringable requestObject(Class dataType, StringableFilter filter)
          Returns a Stringable object based on the view state of the view, the temporary data type and filter, and the optional model.
 Stringable requestObject(StringableFilter filter)
          Returns a Stringable object based on the view state of the view, the temporary filter, and the optional model.
 void reset()
          Resets the view state of this object to the default view state for this object.
 void setDataType(Class dataType)
          Sets the current class of objects returned when a model object is demanded or requested.
static void setDefaultFont(Font newfont)
          Sets the default static font.
 void setDefaultViewState(String data)
          Sets the default view state for this object to the data state represented by the given String data.
 void setErrorPromptTitleSuggestion(String errorPrompt, String dialogTitle, String suggestion)
          Sets the three input property Strings for an error dialog in a single method.
 void setFilter(StringableFilter filter)
          Sets the current filter used by the view to the given StringableFilter.
 void setInputProperties(InputProperties properties)
          Sets the input properties for this view to the provided input properties.
 void setText(String text)
          Sets the text in the text area.
 void setTextWithNewline(String text)
          Sets the text in the text area and adds a newline.
 void setViewState(String data)
          Equivalent to setText.
static void showStringInDialog(String string)
          Shows the given string in an OK dialog that contains a scroll pane bounded by 800-by-600.
static void showStringInDialog(String string, int width, int height)
          Shows the given string in an OK dialog that contains a scroll pane bounded by the given width and height.
static void showStringInFrame(String string)
          Shows the given string in a frame that contains a scroll pane whose viewport is bounded by 800-by-600.
static void showStringInFrame(String string, int width, int height)
          Shows the given string in a frame that contains a scroll pane whose viewport is bounded by the given width and height.
 
Methods inherited from class edu.neu.ccs.gui.DisplayPanel
add, add, add, add, add, addBorder, addObject, addObject, addObject, addObject, bevelBorderLowered, bevelBorderLowered, bevelBorderLowered, bevelBorderLowered, bevelBorderLowered, bevelBorderRaised, bevelBorderRaised, bevelBorderRaised, bevelBorderRaised, bevelBorderRaised, compoundBorder, compoundBorder, dataMalformed, emptyBorder, emptyBorder, emptyBorder, endAlert, etchBorderLowered, etchBorderLowered, etchBorderLowered, etchBorderRaised, etchBorderRaised, etchBorderRaised, frame, frame, frame, frame, frame, frame, generalDialog, generalDialog, generalDialog, generalDialog, getCodec, getDefaultViewStates, getDisplayables, getViewStates, lineBorder, lineBorder, lineBorder, lineBorder, makeComponent, matteBorder, matteBorder, matteBorder, matteBorder, matteBorder, matteBorder, OKCancelDialog, OKCancelDialog, OKDialog, OKDialog, refreshComponent, remove, remove, removeAll, removeBorder, sandwichBorder, setCodec, setDeepBackground, setDeepBackground, setDefaultViewStates, setEnabled, setViewStates, startAlert, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, titleBorder, uniformizeHeight, uniformizeSize, uniformizeWidth, YesNoCancelDialog, YesNoCancelDialog
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, 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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.neu.ccs.gui.Displayable
setEnabled
 

Field Detail

WIDTH

public static final int WIDTH
The default scroll pane viewport width = 800.

See Also:
Constant Field Values

HEIGHT

public static final int HEIGHT
The default scroll pane viewport height = 600.

See Also:
Constant Field Values

MINIMUM

public static final int MINIMUM
The minimum width and height = 100.

See Also:
Constant Field Values

V_ALWAYS

public static final int V_ALWAYS
The vertical scroll bar policy of ALWAYS.

See Also:
Constant Field Values

H_ALWAYS

public static final int H_ALWAYS
The horizontal scroll bar policy of ALWAYS.

See Also:
Constant Field Values

FONTNAME

public static final String FONTNAME
The default monospaced font name.


staticFontSize

private static int staticFontSize

The default font size.

    14 + (int) LookAndFeelTools.getNetFontSizeAdjustment()


staticFont

private static Font staticFont

The display font for the static calls which uses the default font name, the default font size, and BOLD as the style.

This data is intentionally not final so it may be changed by the method setDefaultFont.

As of 2.6.0e, this font is also the default font for StringViewer objects if no font is provided in a constructor.


textarea

protected TextAreaView textarea
The internal TextAreaView.


scrollpane

protected JPTScrollPane scrollpane
The internal JPTScrollPane.


delegate

protected GeneralViewSupport delegate
The GeneralViewSupport object.

Constructor Detail

StringViewer

public StringViewer()

The default constructor that uses empty initial text, a width of 800, a height of 600, and the default static font.


StringViewer

public StringViewer(int width,
                    int height)

The constructor that uses empty initial text, the given width and height, and the default static font.

Parameters:
width - the viewport width
height - the viewport height

StringViewer

public StringViewer(Font font)

The constructor that uses empty initial text, a width of 800, a height of 600, and the given font.

Parameters:
font - the font for the text area

StringViewer

public StringViewer(int width,
                    int height,
                    Font font)

The constructor that uses empty initial text, the given width and height, and the given font.

Parameters:
width - the viewport width
height - the viewport height
font - the font for the text area

StringViewer

public StringViewer(String text)

The default constructor that uses the given initial text, a width of 800, a height of 600, and the default static font.

Parameters:
text - the initial text

StringViewer

public StringViewer(String text,
                    int width,
                    int height)

The constructor that uses the given initial text, the given width and height, and the default static font.

Parameters:
text - the initial text
width - the viewport width
height - the viewport height

StringViewer

public StringViewer(String text,
                    Font font)

The constructor that uses the given initial text, a width of 800, a height of 600, and the given font.

Parameters:
text - the initial text
font - the font for the text area

StringViewer

public StringViewer(String text,
                    int width,
                    int height,
                    Font font)

The constructor that uses the given initial text, the given width and height, and the given font.

Parameters:
text - the initial text
width - the viewport width
height - the viewport height
font - the font for the text area
Method Detail

initialize

protected void initialize(String text,
                          int width,
                          int height,
                          Font font)
The common constructor initialization code.


getTextArea

public TextAreaView getTextArea()

Returns the internal TextAreaView.


getScrollPane

public JPTScrollPane getScrollPane()

Returns the internal JPTScrollPane.


getText

public String getText()

Returns the text in the text area.


getTextLength

public int getTextLength()

Returns the length of the text in the text area.


setText

public void setText(String text)

Sets the text in the text area.

If the given text is null, clears the text area.

Parameters:
text - the text to set

setTextWithNewline

public void setTextWithNewline(String text)

Sets the text in the text area and adds a newline.

If the given text is null, sets the text to a newline.

Parameters:
text - the text to set

append

public void append(String text)

Append the given text in the text area.

If the given text is null, then does nothing.

Parameters:
text - the text to set

appendWithNewline

public void appendWithNewline(String text)

Append the given text in the text area and then append a newline.

If the given text is null, then append a newline.

Parameters:
text - the text to set

insert

public void insert(String text,
                   int position)

Insert the given text in the text area at the given position.

If the given text is null, then does nothing.

If the insert position is not between 0 and getTextLength(), then inserts at the nearest valid position.

Parameters:
text - the text to set
position - the insert position

insert

public void insert(int position,
                   String text)

Insert the given text in the text area at the given position.

Calls:

    insert(text, position)

Parameters:
position - the insert position
text - the text to set

setViewState

public void setViewState(String data)
Equivalent to setText.

Specified by:
setViewState in interface Displayable
Overrides:
setViewState in class DisplayPanel
Parameters:
data - the encoded String data

getViewState

public String getViewState()
Equivalent to getText.

Specified by:
getViewState in interface Displayable
Overrides:
getViewState in class DisplayPanel

setDefaultViewState

public void setDefaultViewState(String data)
Description copied from interface: Displayable
Sets the default view state for this object to the data state represented by the given String data.

Specified by:
setDefaultViewState in interface Displayable
Overrides:
setDefaultViewState in class DisplayPanel
Parameters:
data - the encoded default String data

getDefaultViewState

public String getDefaultViewState()
Description copied from interface: Displayable
Returns a String representation of the default view state for this object.

Specified by:
getDefaultViewState in interface Displayable
Overrides:
getDefaultViewState in class DisplayPanel

reset

public void reset()
Description copied from interface: Displayable

Resets the view state of this object to the default view state for this object.

Equivalent to: setViewState(getDefaultViewState()).

Specified by:
reset in interface Displayable
Overrides:
reset in class DisplayPanel

makeCopy

public GeneralView makeCopy()
Description copied from interface: GeneralView

Returns a copy of this GeneralView.

The purpose of this method is to provide a copy of the view that may be used in error handling dialogs. The copy should, as far as possible, have the same screen size and internal settings. Each GeneralView should describe what its makeCopy method actually does.

The copy should NOT share its internal document model with the original view. This will allow the copy to operate in an independent fashion from the original.

Specified by:
makeCopy in interface GeneralView
Returns:
a copy of this view

setDataType

public void setDataType(Class dataType)
Description copied from interface: GeneralView
Sets the current class of objects returned when a model object is demanded or requested.

Specified by:
setDataType in interface GeneralView
Parameters:
dataType - the new class of objects for model objects

getDataType

public Class getDataType()
Description copied from interface: TypedView
Returns the current class of objects returned when a model object is demanded or requested.

Specified by:
getDataType in interface TypedView
Returns:
the current class of a model object

setFilter

public void setFilter(StringableFilter filter)
Description copied from interface: GeneralView
Sets the current filter used by the view to the given StringableFilter.

Specified by:
setFilter in interface GeneralView
Parameters:
filter - the filter to be used

getFilter

public StringableFilter getFilter()
Description copied from interface: GeneralView
Returns the current filter used by this view.

Specified by:
getFilter in interface GeneralView
Returns:
the current filter

demandObject

public Stringable demandObject()
Description copied from interface: TypedView
Returns a Stringable object based on the view state of the view using the mandatory model.

Specified by:
demandObject in interface TypedView
Returns:
a Stringable model object
See Also:
TypedView.requestObject()

requestObject

public Stringable requestObject()
                         throws CancelledException
Description copied from interface: TypedView
Returns a Stringable object based on the view state of the view using the optional model; throws an exception if the input operation is cancelled by the user.

Specified by:
requestObject in interface TypedView
Returns:
a Stringable model object
Throws:
CancelledException
See Also:
TypedView.demandObject()

demandObject

public Stringable demandObject(StringableFilter filter)
Description copied from interface: GeneralView
Returns a Stringable object based on the view state of the view, the temporary filter, and the mandatory model.

Specified by:
demandObject in interface GeneralView
Parameters:
filter - the temporary filter to use
Returns:
a Stringable model object
See Also:
TypedView.demandObject(), GeneralView.requestObject(Class, StringableFilter)

requestObject

public Stringable requestObject(StringableFilter filter)
                         throws CancelledException
Description copied from interface: GeneralView
Returns a Stringable object based on the view state of the view, the temporary filter, and the optional model.

Specified by:
requestObject in interface GeneralView
Parameters:
filter - the temporary filter to use
Returns:
a Stringable model object
Throws:
CancelledException
See Also:
TypedView.requestObject(), GeneralView.demandObject(Class, StringableFilter)

demandObject

public Stringable demandObject(Class dataType,
                               StringableFilter filter)
Description copied from interface: GeneralView
Returns a Stringable object based on the view state of the view, the temporary data type and filter, and the mandatory model.

Specified by:
demandObject in interface GeneralView
Returns:
a Stringable model object
See Also:
TypedView.demandObject(), GeneralView.requestObject(Class, StringableFilter)

requestObject

public Stringable requestObject(Class dataType,
                                StringableFilter filter)
                         throws CancelledException
Description copied from interface: GeneralView
Returns a Stringable object based on the view state of the view, the temporary data type and filter, and the optional model.

Specified by:
requestObject in interface GeneralView
Returns:
a Stringable model object
Throws:
CancelledException
See Also:
TypedView.requestObject(), GeneralView.demandObject(Class, StringableFilter)

setInputProperties

public void setInputProperties(InputProperties properties)
Description copied from interface: TypedView

Sets the input properties for this view to the provided input properties.

If the given input properties list is null, the property list for this view is set to the base property list containing default property values.

Specified by:
setInputProperties in interface TypedView
Parameters:
properties - the new input properties for the view
See Also:
TypedView.getInputProperties()

getInputProperties

public InputProperties getInputProperties()
Description copied from interface: TypedView
Returns the input properties for this view.

Specified by:
getInputProperties in interface TypedView
Returns:
the input properties
See Also:
TypedView.setInputProperties(InputProperties)

setErrorPromptTitleSuggestion

public void setErrorPromptTitleSuggestion(String errorPrompt,
                                          String dialogTitle,
                                          String suggestion)
Description copied from interface: GeneralView
Sets the three input property Strings for an error dialog in a single method.

Specified by:
setErrorPromptTitleSuggestion in interface GeneralView
Parameters:
errorPrompt - the error prompt of an error dialog
dialogTitle - the dialog title of an error dialog
suggestion - the suggestion for an error dialog

addMalformedDataListener

public void addMalformedDataListener(MalformedDataListener l)
Description copied from interface: Fragile
Registers the given MalformedDataListener to receive MalformedDataEvents when the view state data is found to be malformed and when the view state data is returned to a well-formed value.

Specified by:
addMalformedDataListener in interface Fragile
Parameters:
l - the listener to register
See Also:
Fragile.removeMalformedDataListener(MalformedDataListener)

removeMalformedDataListener

public void removeMalformedDataListener(MalformedDataListener l)
Description copied from interface: Fragile
De-registers the given MalformedDataListener from receiving MalformedDataEvents when the view state data is found to be malformed and when the view state data is returned to a well-formed value.

Specified by:
removeMalformedDataListener in interface Fragile
Parameters:
l - the listener to de-register
See Also:
Fragile.addMalformedDataListener(MalformedDataListener)

addActionListener

public void addActionListener(ActionListener listener)
This method is required by the GeneralView interface but the implementation does nothing since the underlying JTextArea does not fire action events.

Specified by:
addActionListener in interface GeneralView
Parameters:
listener - the ActionListener that is to be notified
See Also:
GeneralView.removeActionListener(ActionListener)

removeActionListener

public void removeActionListener(ActionListener listener)
This method is required by the GeneralView interface but the implementation does nothing since the underlying JTextArea does not fire action events.

Specified by:
removeActionListener in interface GeneralView
Parameters:
listener - the ActionListener to remove
See Also:
GeneralView.addActionListener(ActionListener)

makeScrollView

public static JPTScrollPane makeScrollView(String string,
                                           int width,
                                           int height)

Wraps the given String in a TextAreaView object; then wraps the text area in a JPTScrollPane object whose viewport is bounded by the given width and height; this scroll pane is returned.

If the given string is null, the scroll pane will show an error message.

The width and height are forced to be at least the value of MINIMUM = 100.

Parameters:
string - the string to view
width - the viewport width bound
height - the viewport height bound

makeScrollView

public static JPTScrollPane makeScrollView(String string)

Wraps the given String in a TextAreaView object; then wraps the text area in a JPTScrollPane object whose viewport is bounded by 800-by-600; this scroll pane is returned.

If the given string is null, the scroll pane will show an error message.

Parameters:
string - the string to view

showStringInFrame

public static void showStringInFrame(String string,
                                     int width,
                                     int height)

Shows the given string in a frame that contains a scroll pane whose viewport is bounded by the given width and height.

If the given string is null, the frame will show an error message.

Parameters:
string - the string to view
width - the viewport width bound
height - the viewport height bound

showStringInFrame

public static void showStringInFrame(String string)

Shows the given string in a frame that contains a scroll pane whose viewport is bounded by 800-by-600.

If the given string is null, the frame will show an error message.

Parameters:
string - the string to view

showStringInDialog

public static void showStringInDialog(String string,
                                      int width,
                                      int height)

Shows the given string in an OK dialog that contains a scroll pane bounded by the given width and height.

If the given string is null, the dialog will show an error message.

Parameters:
string - the string to view
width - the viewport width bound
height - the viewport height bound

showStringInDialog

public static void showStringInDialog(String string)

Shows the given string in an OK dialog that contains a scroll pane bounded by 800-by-600.

If the given string is null, the dialog will show an error message.

Parameters:
string - the string to view

getDefaultFont

public static Font getDefaultFont()
Returns the current default static font.


setDefaultFont

public static void setDefaultFont(Font newfont)

Sets the default static font.

Does nothing if newfont is null.

Parameters:
newfont - the new default static font