Extension SDK 10.1.2

oracle.javatools.editor.plugins
Class StatusBarPlugin

java.lang.Object
  extended byoracle.javatools.editor.plugins.StatusBarPlugin
All Implemented Interfaces:
java.awt.event.ActionListener, javax.swing.event.ChangeListener, EditorPlugin, java.util.EventListener, FeedbackManager, java.beans.PropertyChangeListener

public final class StatusBarPlugin
extends java.lang.Object
implements java.awt.event.ActionListener, javax.swing.event.ChangeListener, EditorPlugin, FeedbackManager

The StatusBarPlugin provides a status bar UI component that works with the BasicEditorPane. It is implemented as a plugin as a convenient way to attach to the editor pane. To use this plugin, install it into the editor pane by calling installPlugin() on the BasicEditorPane.


Nested Class Summary
protected static class StatusBarPlugin.StatusBarCell
          The StatusBarCell is just a label that can be added to our status bar which takes care of making sure that its size remains fairly constant for the types of strings which can contain it (otherwise, it looks pretty bad for the cells to be changing in width, say when you switch between insert and overwrite mode.)
 
Field Summary
static javax.swing.border.Border BEVEL_BORDER
          This is a bevel border that can be used for the status bar cells.
static java.lang.String BLANK_MESSAGE
          An empty message just to set the height of the status bar.
static javax.swing.border.Border EMPTY_BORDER
          This is just an empty border w/ left & right insets.
static javax.swing.border.Border EMPTY_PIXEL_BORDER
          This is just an empty border that is 1 pixel all around.
static java.lang.String[] EOL_CELL_STRINGS
          The array of strings for the EOL type cell for sizing.
static java.lang.String EOL_MACINTOSH
          String for file with Macintosh-style EOL terminators (single CR.)
static java.lang.String EOL_UNIX
          String for file with UNIX-style EOL terminators (single LF.)
static java.lang.String EOL_WINDOWS
          String for file with Windows-style EOL terminators (CR/LF pair.)
static javax.swing.border.Border ETCHED_BORDER
          This is an etched border that can be used for the status bar cells.
static java.lang.String INSERT_MODE
          String for insert mode.
static java.lang.String[] INSERT_OVERWRITE_CELL_STRINGS
          The array of cell strings for the InsertOverwrite cell for sizing.
static java.lang.String LINE_COLUMN
          String for the line and column info.
static java.lang.String[] LINE_NUMBER_CELL_STRINGS
          The array of strings for the line number cell for sizing.
static java.lang.String MODIFIED
          String for modified label.
static java.lang.String[] MODIFIED_CELL_STRINGS
          The array of strings for the Modified cell for sizing.
static java.lang.String OVERWRITE_MODE
          String for overwrite mode.
static java.lang.String PROTECTED
          String for the protected label.
static java.lang.String READ_ONLY
          String for read only label.
 
Constructor Summary
StatusBarPlugin()
          Constructs a new StatusBarPlugin instance that is not currently associated with an editor or document, and which uses the default border.
StatusBarPlugin(javax.swing.border.Border border)
          Constructs a new StatusBarPlugin that is not currently associated with any editor or document.
StatusBarPlugin(javax.swing.border.Border border, java.awt.Font font)
          Constructs a new StatusBarPlugin that is not currently associated with any editor or document.
StatusBarPlugin(java.awt.Font font)
          Constructs a new StatusBarPlugin instance that is not currently associated with an editor or document, and which uses the default border, and the specified font.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent event)
          This is invoked when an action is performed.
 void deinstall(BasicEditorPane editor)
          Called when the plugin is being removed from the BasicEditorPane (for example when the editor is closed.) This is used to notify plugins that they should unregister any listeners that were attached.
protected static java.lang.String getLineColumnText(java.lang.String template, int line, int column)
          Utility routine for building up the "Line 1 Column 5" text.
 javax.swing.JPanel getPanel()
          Fetches the panel that is the UI for this status bar so that it can be added somewhere and displayed.
 void hideFeedback(BasicEditorPane editorPane)
          Clears the text feedback message last displayed for the given editor pane.
 void install(BasicEditorPane editor)
          Called when this plugin is being installed into the BasicEditorPane.
 void propertyChange(java.beans.PropertyChangeEvent event)
          This method gets called when a bound property is changed.
 void showFeedback(BasicEditorPane editorPane, java.lang.String feedbackMessage)
          Displays a text feedback message to the user associated with the given editor pane.
 void showFeedback(BasicEditorPane editorPane, java.lang.String feedbackMessage, int milliSeconds)
          Displays a text feedback message to the user associated with the given editor pane.
 void stateChanged(javax.swing.event.ChangeEvent event)
          Invoked when the target of the listener has changed its state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_PIXEL_BORDER

public static final javax.swing.border.Border EMPTY_PIXEL_BORDER
This is just an empty border that is 1 pixel all around.


EMPTY_BORDER

public static final javax.swing.border.Border EMPTY_BORDER
This is just an empty border w/ left & right insets.


ETCHED_BORDER

public static final javax.swing.border.Border ETCHED_BORDER
This is an etched border that can be used for the status bar cells.


BEVEL_BORDER

public static final javax.swing.border.Border BEVEL_BORDER
This is a bevel border that can be used for the status bar cells.


BLANK_MESSAGE

public static final java.lang.String BLANK_MESSAGE
An empty message just to set the height of the status bar.

See Also:
Constant Field Values

INSERT_MODE

public static final java.lang.String INSERT_MODE
String for insert mode.


OVERWRITE_MODE

public static final java.lang.String OVERWRITE_MODE
String for overwrite mode.


LINE_COLUMN

public static final java.lang.String LINE_COLUMN
String for the line and column info.


EOL_MACINTOSH

public static final java.lang.String EOL_MACINTOSH
String for file with Macintosh-style EOL terminators (single CR.)


EOL_UNIX

public static final java.lang.String EOL_UNIX
String for file with UNIX-style EOL terminators (single LF.)


EOL_WINDOWS

public static final java.lang.String EOL_WINDOWS
String for file with Windows-style EOL terminators (CR/LF pair.)


MODIFIED

public static final java.lang.String MODIFIED
String for modified label.


READ_ONLY

public static final java.lang.String READ_ONLY
String for read only label.


PROTECTED

public static final java.lang.String PROTECTED
String for the protected label.


INSERT_OVERWRITE_CELL_STRINGS

public static final java.lang.String[] INSERT_OVERWRITE_CELL_STRINGS
The array of cell strings for the InsertOverwrite cell for sizing.


EOL_CELL_STRINGS

public static final java.lang.String[] EOL_CELL_STRINGS
The array of strings for the EOL type cell for sizing.


MODIFIED_CELL_STRINGS

public static final java.lang.String[] MODIFIED_CELL_STRINGS
The array of strings for the Modified cell for sizing.


LINE_NUMBER_CELL_STRINGS

public static final java.lang.String[] LINE_NUMBER_CELL_STRINGS
The array of strings for the line number cell for sizing.

Constructor Detail

StatusBarPlugin

public StatusBarPlugin()
Constructs a new StatusBarPlugin instance that is not currently associated with an editor or document, and which uses the default border.


StatusBarPlugin

public StatusBarPlugin(java.awt.Font font)
Constructs a new StatusBarPlugin instance that is not currently associated with an editor or document, and which uses the default border, and the specified font.

Parameters:
font - the font to use

StatusBarPlugin

public StatusBarPlugin(javax.swing.border.Border border)
Constructs a new StatusBarPlugin that is not currently associated with any editor or document. Uses the specified border for all cells.

Parameters:
border - the cell border to use

StatusBarPlugin

public StatusBarPlugin(javax.swing.border.Border border,
                       java.awt.Font font)
Constructs a new StatusBarPlugin that is not currently associated with any editor or document. Uses the specified border and font for all cells.

Parameters:
border - the cell border to use
font - the font to use
Method Detail

install

public void install(BasicEditorPane editor)
Called when this plugin is being installed into the BasicEditorPane.

Specified by:
install in interface EditorPlugin
Parameters:
editor - the editor pane

deinstall

public void deinstall(BasicEditorPane editor)
Called when the plugin is being removed from the BasicEditorPane (for example when the editor is closed.) This is used to notify plugins that they should unregister any listeners that were attached.

Specified by:
deinstall in interface EditorPlugin
Parameters:
editor - the editor pane

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
event - A PropertyChangeEvent object describing the event source and the property that has changed.

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent event)
Invoked when the target of the listener has changed its state.

Specified by:
stateChanged in interface javax.swing.event.ChangeListener
Parameters:
event - the change event

showFeedback

public void showFeedback(BasicEditorPane editorPane,
                         java.lang.String feedbackMessage)
Displays a text feedback message to the user associated with the given editor pane.

Specified by:
showFeedback in interface FeedbackManager
Parameters:
editorPane - the editor pane the message is associated with
feedbackMessage - the message to display

showFeedback

public void showFeedback(BasicEditorPane editorPane,
                         java.lang.String feedbackMessage,
                         int milliSeconds)
Displays a text feedback message to the user associated with the given editor pane. The message will only be displayed for the time period specified.

Specified by:
showFeedback in interface FeedbackManager
Parameters:
editorPane - the editor pane the message is associated with
feedbackMessage - the message to display
milliSeconds - the length of time to display the message

hideFeedback

public void hideFeedback(BasicEditorPane editorPane)
Clears the text feedback message last displayed for the given editor pane. This is meant to be used in conjunction with the non-timeout version of showFeedback() to clear the feedback area.

Specified by:
hideFeedback in interface FeedbackManager
Parameters:
editorPane - the editor pane the last message was associated with

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent event)
This is invoked when an action is performed. In this case, it should only be a Timer event.

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
event - the action event

getPanel

public javax.swing.JPanel getPanel()
Fetches the panel that is the UI for this status bar so that it can be added somewhere and displayed.

Returns:
a JPanel that is the status bar

getLineColumnText

protected static java.lang.String getLineColumnText(java.lang.String template,
                                                    int line,
                                                    int column)
Utility routine for building up the "Line 1 Column 5" text.

Parameters:
template - the template for the text, i.e., "Line {0} Column {1}"
line - the line number
column - the column number
Returns:
the display text for the line and column cell

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.