public final class StatusBarPlugin extends java.lang.Object implements java.awt.event.ActionListener, javax.swing.event.ChangeListener, EditorPlugin, FeedbackManager
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
. Modifier and Type | Class and Description |
---|---|
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.) |
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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. |
Modifier and Type | Method and Description |
---|---|
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.
|
public static final javax.swing.border.Border EMPTY_PIXEL_BORDER
public static final javax.swing.border.Border EMPTY_BORDER
public static final javax.swing.border.Border ETCHED_BORDER
public static final javax.swing.border.Border BEVEL_BORDER
public static final java.lang.String BLANK_MESSAGE
public static final java.lang.String INSERT_MODE
public static final java.lang.String OVERWRITE_MODE
public static final java.lang.String LINE_COLUMN
public static final java.lang.String EOL_MACINTOSH
public static final java.lang.String EOL_UNIX
public static final java.lang.String EOL_WINDOWS
public static final java.lang.String MODIFIED
public static final java.lang.String READ_ONLY
public static final java.lang.String PROTECTED
public static final java.lang.String[] INSERT_OVERWRITE_CELL_STRINGS
public static final java.lang.String[] EOL_CELL_STRINGS
public static final java.lang.String[] MODIFIED_CELL_STRINGS
public static final java.lang.String[] LINE_NUMBER_CELL_STRINGS
public StatusBarPlugin()
StatusBarPlugin
instance that
is not currently associated with an editor or document, and which
uses the default border.public StatusBarPlugin(java.awt.Font font)
StatusBarPlugin
instance that
is not currently associated with an editor or document, and which
uses the default border, and the specified font.font
- the font to usepublic StatusBarPlugin(javax.swing.border.Border border)
StatusBarPlugin
that is not
currently associated with any editor or document. Uses the
specified border for all cells.border
- the cell border to usepublic StatusBarPlugin(javax.swing.border.Border border, java.awt.Font font)
StatusBarPlugin
that is not
currently associated with any editor or document. Uses the
specified border and font for all cells.border
- the cell border to usefont
- the font to usepublic void install(BasicEditorPane editor)
install
in interface EditorPlugin
editor
- the editor panepublic void deinstall(BasicEditorPane editor)
deinstall
in interface EditorPlugin
editor
- the editor panepublic void propertyChange(java.beans.PropertyChangeEvent event)
propertyChange
in interface java.beans.PropertyChangeListener
event
- A PropertyChangeEvent object describing the event source
and the property that has changed.public void stateChanged(javax.swing.event.ChangeEvent event)
stateChanged
in interface javax.swing.event.ChangeListener
event
- the change eventpublic void showFeedback(BasicEditorPane editorPane, java.lang.String feedbackMessage)
showFeedback
in interface FeedbackManager
editorPane
- the editor pane the message is associated withfeedbackMessage
- the message to displaypublic void showFeedback(BasicEditorPane editorPane, java.lang.String feedbackMessage, int milliSeconds)
showFeedback
in interface FeedbackManager
editorPane
- the editor pane the message is associated withfeedbackMessage
- the message to displaymilliSeconds
- the length of time to display the messagepublic void hideFeedback(BasicEditorPane editorPane)
hideFeedback
in interface FeedbackManager
editorPane
- the editor pane the last message was associated withpublic void actionPerformed(java.awt.event.ActionEvent event)
actionPerformed
in interface java.awt.event.ActionListener
event
- the action eventpublic javax.swing.JPanel getPanel()
protected static java.lang.String getLineColumnText(java.lang.String template, int line, int column)
template
- the template for the text, i.e.,
"Line {0} Column {1}"line
- the line numbercolumn
- the column number