/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* This is the set of things needed by a text component
* to be a reasonably functioning editor for some <em>type</em>
* of text document. This implementation provides a default
* implementation which treats text as plain text and
* provides a minimal set of actions for a simple editor.
* <p>
* <dl>
* <dt><b><font size=+1>Newlines</font></b>
* <dd>
* There are two properties which deal with newlines. The
* system property, <code>line.separator</code>, is defined to be
* platform-dependent, either "\n", "\r", or "\r\n". There is also
* a property defined in <code>DefaultEditorKit</code>, called
* <a href=#EndOfLineStringProperty><code>EndOfLineStringProperty</code></a>,
* which is defined automatically when a document is loaded, to be
* the first occurrence of any of the newline characters.
* When a document is loaded, <code>EndOfLineStringProperty</code>
* is set appropriately, and when the document is written back out, the
* <code>EndOfLineStringProperty</code> is used. But while the document
* is in memory, the "\n" character is used to define a
* newline, regardless of how the newline is defined when
* the document is on disk. Therefore, for searching purposes,
* "\n" should always be used. When a new document is created,
* and the <code>EndOfLineStringProperty</code> has not been defined,
* it will use the System property when writing out the
* document.
* <p>Note that <code>EndOfLineStringProperty</code> is set
* on the <code>Document</code> using the <code>get/putProperty</code>
* methods. Subclasses may override this behavior.
*
* </dl>
*
* @author Timothy Prinzing
*/
/**
* default constructor for DefaultEditorKit
*/
public DefaultEditorKit() {
}
/**
* Gets the MIME type of the data that this
* kit represents support for. The default
*
* @return the type
*/
}
/**
* Fetches a factory that is suitable for producing
* views of any models that are produced by this
* kit. The default is to have the UI produce the
* factory, so this method has no implementation.
*
* @return the view factory
*/
return null;
}
/**
* Fetches the set of commands that can be used
* on a text component that is using a model and
* view produced by this kit.
*
* @return the command list
*/
return defaultActions;
}
/**
* Fetches a caret that can navigate through views
* produced by the associated ViewFactory.
*
* @return the caret
*/
return null;
}
/**
* Creates an uninitialized text storage model (PlainDocument)
* that is appropriate for this type of editor.
*
* @return the model
*/
return new PlainDocument();
}
/**
* Inserts content from the given stream which is expected
* to be in a format appropriate for this kind of content
* handler.
*
* @param in The stream to read from
* @param doc The destination for the insertion.
* @param pos The location in the document to place the
* content >= 0.
* @exception IOException on any I/O error
* @exception BadLocationException if pos represents an invalid
* location within the document.
*/
throws IOException, BadLocationException {
}
/**
* Writes content from a document to the given stream
* in a format appropriate for this kind of content handler.
*
* @param out The stream to write to
* @param doc The source for the write.
* @param pos The location in the document to fetch the
* content >= 0.
* @param len The amount to write out >= 0.
* @exception IOException on any I/O error
* @exception BadLocationException if pos represents an invalid
* location within the document.
*/
throws IOException, BadLocationException {
}
/**
* Gets the input attributes for the pane. This method exists for
* the benefit of StyledEditorKit so that the read method will
* pick up the correct attributes to apply to inserted text.
* This class's implementation simply returns null.
*
* @return null
*/
return null;
}
/**
* Inserts content from the given stream, which will be
* treated as plain text.
*
* @param in The stream to read from
* @param doc The destination for the insertion.
* @param pos The location in the document to place the
* content >= 0.
* @exception IOException on any I/O error
* @exception BadLocationException if pos represents an invalid
* location within the document.
*/
throws IOException, BadLocationException {
char[] buff = new char[4096];
int nch;
boolean lastWasCR = false;
boolean isCRLF = false;
boolean isCR = false;
int last;
// Read in a block at a time, mapping \r\n to \n, as well as single
// \r's to \n's. If a \r\n is encountered, \r\n will be set as the
// newline string for the document, if \r is encountered it will
// be set as the newline character, otherwise the newline property
// for the document will be removed.
last = 0;
case '\r':
if (lastWasCR) {
isCR = true;
if (counter == 0) {
pos++;
}
else {
}
}
else {
lastWasCR = true;
}
break;
case '\n':
if (lastWasCR) {
}
// else nothing to do, can skip \r, next write will
// write \n
lastWasCR = false;
isCRLF = true;
}
break;
default:
if (lastWasCR) {
isCR = true;
if (counter == 0) {
pos++;
}
else {
}
lastWasCR = false;
}
break;
}
}
if(lastWasCR) {
}
}
else {
}
}
}
if (lastWasCR) {
isCR = true;
}
if (wasEmpty) {
if (isCRLF) {
}
else if (isCR) {
}
else {
}
}
}
/**
* Writes content from a document to the given stream
* as plain text.
*
* @param out The stream to write to
* @param doc The source for the write.
* @param pos The location in the document to fetch the
* content from >= 0.
* @param len The amount to write out >= 0.
* @exception IOException on any I/O error
* @exception BadLocationException if pos is not within 0 and
* the length of the document.
*/
throws IOException, BadLocationException {
}
if (endOfLineProperty == null) {
try {
} catch (SecurityException se) { }
}
if (endOfLineProperty instanceof String) {
}
else {
}
// There is an end of line string that isn't \n, have to iterate
// through and find all \n's and translate to end of line string.
while (nleft > 0) {
}
}
}
if (maxCounter > last) {
}
offs += n;
nleft -= n;
}
}
else {
// Just write out text, will already have \n, no mapping to
// do.
while (nleft > 0) {
offs += n;
nleft -= n;
}
}
}
/**
* When reading a document if a CRLF is encountered a property
* with this name is added and the value will be "\r\n".
*/
// --- names of well-known actions ---------------------------
/**
* Name of the action to place content into the associated
* document. If there is a selection, it is removed before
* the new content is added.
* @see #getActions
*/
/**
* the document. If there is a selection, it is removed before
* the break is added.
* @see #getActions
*/
/**
* Name of the action to place a tab character into
* the document. If there is a selection, it is removed before
* the tab is added.
* @see #getActions
*/
/**
* Name of the action to delete the character of content that
* precedes the current caret position.
* @see #getActions
*/
/**
* Name of the action to delete the character of content that
* follows the current caret position.
* @see #getActions
*/
/**
* Name of the action to delete the word that
* follows the beginning of the selection.
* @see #getActions
* @see JTextComponent#getSelectionStart
* @since 1.6
*/
/**
* Name of the action to delete the word that
* precedes the beginning of the selection.
* @see #getActions
* @see JTextComponent#getSelectionStart
* @since 1.6
*/
/**
* Name of the action to set the editor into read-only
* mode.
* @see #getActions
*/
/**
* Name of the action to set the editor into writeable
* mode.
* @see #getActions
*/
/**
* Name of the action to cut the selected region
* and place the contents into the system clipboard.
* @see JTextComponent#cut
* @see #getActions
*/
/**
* Name of the action to copy the selected region
* and place the contents into the system clipboard.
* @see JTextComponent#copy
* @see #getActions
*/
/**
* Name of the action to paste the contents of the
* system clipboard into the selected region, or before the
* caret if nothing is selected.
* @see JTextComponent#paste
* @see #getActions
*/
/**
* Name of the action to create a beep.
* @see #getActions
*/
/**
* Name of the action to page up vertically.
* @see #getActions
*/
/**
* Name of the action to page down vertically.
* @see #getActions
*/
/**
* Name of the action to page up vertically, and move the
* selection.
* @see #getActions
*/
/**
* Name of the action to page down vertically, and move the
* selection.
* @see #getActions
*/
/**
* Name of the action to page left horizontally, and move the
* selection.
* @see #getActions
*/
/**
* Name of the action to page right horizontally, and move the
* selection.
* @see #getActions
*/
/**
* Name of the Action for moving the caret
* logically forward one position.
* @see #getActions
*/
/**
* Name of the Action for moving the caret
* logically backward one position.
* @see #getActions
*/
/**
* Name of the Action for extending the selection
* by moving the caret logically forward one position.
* @see #getActions
*/
/**
* Name of the Action for extending the selection
* by moving the caret logically backward one position.
* @see #getActions
*/
/**
* Name of the Action for moving the caret
* logically upward one position.
* @see #getActions
*/
/**
* Name of the Action for moving the caret
* logically downward one position.
* @see #getActions
*/
/**
* Name of the Action for moving the caret
* logically upward one position, extending the selection.
* @see #getActions
*/
/**
* Name of the Action for moving the caret
* logically downward one position, extending the selection.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the beginning of a word.
* @see #getActions
*/
/**
* Name of the Action for moving the caret
* to the end of a word.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the beginning of a word, extending the selection.
* @see #getActions
*/
/**
* Name of the Action for moving the caret
* to the end of a word, extending the selection.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret to the
* beginning of the previous word.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret to the
* beginning of the next word.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the selection to the
* beginning of the previous word, extending the selection.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the selection to the
* beginning of the next word, extending the selection.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the beginning of a line.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the end of a line.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the beginning of a line, extending the selection.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the end of a line, extending the selection.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the beginning of a paragraph.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the end of a paragraph.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the beginning of a paragraph, extending the selection.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the end of a paragraph, extending the selection.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the beginning of the document.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the end of the document.
* @see #getActions
*/
/**
* Name of the <code>Action</code> for moving the caret
* to the beginning of the document.
* @see #getActions
*/
/**
* Name of the Action for moving the caret
* to the end of the document.
* @see #getActions
*/
/**
* Name of the Action for selecting a word around the caret.
* @see #getActions
*/
/**
* Name of the Action for selecting a line around the caret.
* @see #getActions
*/
/**
* Name of the Action for selecting a paragraph around the caret.
* @see #getActions
*/
/**
* Name of the Action for selecting the entire document
* @see #getActions
*/
/**
* Name of the Action for removing selection
* @see #getActions
*/
/**
* Name of the Action for toggling the component's orientation.
* @see #getActions
*/
= "toggle-componentOrientation";
/**
* Name of the action that is executed by default if
* a <em>key typed event</em> is received and there
* is no keymap entry.
* @see #getActions
*/
// --- Action implementations ---------------------------------
new InsertContentAction(), new DeletePrevCharAction(),
new DeleteNextCharAction(), new ReadOnlyAction(),
new WritableAction(), new CutAction(),
new CopyAction(), new PasteAction(),
new PageAction(selectionPageLeftAction, true, true),
new PageAction(selectionPageRightAction, false, true),
new InsertBreakAction(), new BeepAction(),
new NextVisualPositionAction(forwardAction, false,
new NextVisualPositionAction(backwardAction, false,
new NextVisualPositionAction(selectionForwardAction, true,
new NextVisualPositionAction(selectionBackwardAction, true,
new NextVisualPositionAction(upAction, false,
new NextVisualPositionAction(downAction, false,
new NextVisualPositionAction(selectionUpAction, true,
new NextVisualPositionAction(selectionDownAction, true,
new BeginWordAction(beginWordAction, false),
new EndWordAction(endWordAction, false),
new BeginWordAction(selectionBeginWordAction, true),
new EndWordAction(selectionEndWordAction, true),
new PreviousWordAction(previousWordAction, false),
new NextWordAction(nextWordAction, false),
new PreviousWordAction(selectionPreviousWordAction, true),
new NextWordAction(selectionNextWordAction, true),
new BeginLineAction(beginLineAction, false),
new EndLineAction(endLineAction, false),
new BeginLineAction(selectionBeginLineAction, true),
new EndLineAction(selectionEndLineAction, true),
new BeginParagraphAction(beginParagraphAction, false),
new EndParagraphAction(endParagraphAction, false),
new BeginParagraphAction(selectionBeginParagraphAction, true),
new EndParagraphAction(selectionEndParagraphAction, true),
new BeginAction(beginAction, false),
new BeginAction(selectionBeginAction, true),
new EndAction(selectionEndAction, true),
new DefaultKeyTypedAction(), new InsertTabAction(),
new SelectWordAction(), new SelectLineAction(),
new SelectParagraphAction(), new SelectAllAction(),
new UnselectAction(), new ToggleComponentOrientationAction(),
new DumpModelAction()
};
/**
* The action that is executed by default if
* a <em>key typed event</em> is received and there
* is no keymap entry. There is a variation across
* different VM's in what gets sent as a <em>key typed</em>
* event, and this action tries to filter out the undesired
* events. This filters the control characters and those
* with the ALT modifier. It allows Control-Alt sequences
* through as these form legitimate unicode characters on
* some PC keyboards.
* <p>
* If the event doesn't get filtered, it will try to insert
* content into the text editor. The content is fetched
* from the command string of the ActionEvent. The text
* entry is done through the <code>replaceSelection</code>
* method on the target text component. This is the
* action that will be fired for most text entry tasks.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see DefaultEditorKit#defaultKeyTypedAction
* @see DefaultEditorKit#getActions
* @see Keymap#setDefaultAction
* @see Keymap#getDefaultAction
*/
/**
* Creates this object with the appropriate identifier.
*/
public DefaultKeyTypedAction() {
super(defaultKeyTypedAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
return;
}
int mod = e.getModifiers();
boolean isPrintableMask = true;
if (tk instanceof SunToolkit) {
}
if (isPrintableMask) {
if ((c >= 0x20) && (c != 0x7F)) {
}
}
}
}
}
}
/**
* Places content into the associated document.
* If there is a selection, it is removed before
* the new content is added.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see DefaultEditorKit#insertContentAction
* @see DefaultEditorKit#getActions
*/
/**
* Creates this object with the appropriate identifier.
*/
public InsertContentAction() {
super(insertContentAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
return;
}
} else {
}
}
}
}
/**
* If there is a selection, it is removed before
* the break is added.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see DefaultEditorKit#insertBreakAction
* @see DefaultEditorKit#getActions
*/
/**
* Creates this object with the appropriate identifier.
*/
public InsertBreakAction() {
super(insertBreakAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
return;
}
}
}
}
/**
* Places a tab character into the document. If there
* is a selection, it is removed before the tab is added.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see DefaultEditorKit#insertTabAction
* @see DefaultEditorKit#getActions
*/
/**
* Creates this object with the appropriate identifier.
*/
public InsertTabAction() {
super(insertTabAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
return;
}
}
}
}
/*
* Deletes the character of content that precedes the
* current caret position.
* @see DefaultEditorKit#deletePrevCharAction
* @see DefaultEditorKit#getActions
*/
/**
* Creates this object with the appropriate identifier.
*/
super(deletePrevCharAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
boolean beep = true;
try {
beep = false;
} else if (dot > 0) {
int delChars = 1;
if (dot > 1) {
delChars = 2;
}
}
beep = false;
}
} catch (BadLocationException bl) {
}
}
if (beep) {
}
}
}
/*
* Deletes the character of content that follows the
* current caret position.
* @see DefaultEditorKit#deleteNextCharAction
* @see DefaultEditorKit#getActions
*/
/* Create this object with the appropriate identifier. */
super(deleteNextCharAction);
}
/** The operation to perform when this action is triggered. */
boolean beep = true;
try {
beep = false;
int delChars = 1;
delChars = 2;
}
}
beep = false;
}
} catch (BadLocationException bl) {
}
}
if (beep) {
}
}
}
/*
* @see DefaultEditorKit#getActions
*/
super(name);
assert (name == deletePrevWordAction)
|| (name == deleteNextWordAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
return;
}
boolean beep = true;
try {
int end;
//last word in the paragraph
//for last position remove last \n
} else {
//remove to the end of the paragraph
}
}
} else {
//there is no previous word in the paragraph
if (start == startOfLine) {
//for first position remove previous \n
} else {
//remove to the start of the paragraph
end = startOfLine;
}
}
}
if (offs >= 0) {
beep = false;
}
} catch (BadLocationException ignore) {
}
if (beep) {
}
}
}
}
/*
* Sets the editor into read-only mode.
* @see DefaultEditorKit#readOnlyAction
* @see DefaultEditorKit#getActions
*/
/* Create this object with the appropriate identifier. */
ReadOnlyAction() {
super(readOnlyAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
target.setEditable(false);
}
}
}
/*
* Sets the editor into writeable mode.
* @see DefaultEditorKit#writableAction
* @see DefaultEditorKit#getActions
*/
/* Create this object with the appropriate identifier. */
WritableAction() {
super(writableAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
target.setEditable(true);
}
}
}
/**
* Cuts the selected region and place its contents
* into the system clipboard.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see DefaultEditorKit#cutAction
* @see DefaultEditorKit#getActions
*/
/** Create this object with the appropriate identifier. */
public CutAction() {
super(cutAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
}
}
}
/**
* Copies the selected region and place its contents
* into the system clipboard.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see DefaultEditorKit#copyAction
* @see DefaultEditorKit#getActions
*/
/** Create this object with the appropriate identifier. */
public CopyAction() {
super(copyAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
}
}
}
/**
* Pastes the contents of the system clipboard into the
* selected region, or before the caret if nothing is
* selected.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see DefaultEditorKit#pasteAction
* @see DefaultEditorKit#getActions
*/
/** Create this object with the appropriate identifier. */
public PasteAction() {
super(pasteAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
}
}
}
/**
* Creates a beep.
* <p>
* <strong>Warning:</strong>
* Serialized objects of this class will not be compatible with
* future Swing releases. The current serialization support is
* appropriate for short term storage or RMI between applications running
* the same version of Swing. As of 1.4, support for long term storage
* of all JavaBeans<sup><font size="-2">TM</font></sup>
* has been added to the <code>java.beans</code> package.
* Please see {@link java.beans.XMLEncoder}.
*
* @see DefaultEditorKit#beepAction
* @see DefaultEditorKit#getActions
*/
/** Create this object with the appropriate identifier. */
public BeepAction() {
super(beepAction);
}
/**
* The operation to perform when this action is triggered.
*
* @param e the action event
*/
}
}
/**
* the selection, instead of simply moving the caret.
*
* @see DefaultEditorKit#pageUpAction
* @see DefaultEditorKit#pageDownAction
* @see DefaultEditorKit#getActions
*/
/** Create this object with the appropriate identifier. */
super(nm);
}
/** The operation to perform when this action is triggered. */
int scrollAmount = direction *
if (selectedIndex != -1) {
try {
dotBounds.x;
if (h > 0) {
// We want to scroll by a multiple of caret height,
// rounding towards lower integer
scrollAmount = scrollAmount / h * h;
}
int newIndex;
// Dot is currently visible, base the new
// location off the old, or
}
else {
// Dot isn't visible, choose the top or the bottom
// for the new location.
if (direction == -1) {
x, newVis.y));
}
else {
}
}
if (newIndex != selectedIndex) {
// Make sure the new visible location contains
// the location of dot, otherwise Caret will
// cause an additional scroll.
// Change index and correct newVis.y only if won't cause scrolling upward
if (select) {
} else {
}
}
}
} catch (BadLocationException ble) { }
} else {
}
if (magicPosition != null) {
}
}
}
/**
* Makes sure <code>y</code> is a valid location in
* <code>target</code>.
*/
if (y < 0) {
y = 0;
}
}
return y;
}
/**
* Ensures that <code>offset</code> is a valid offset into the
* model for <code>text</code>.
*/
}
if (offset < 0) {
offset = 0;
}
return offset;
}
/**
* Returns adjustsed {@code y} position that indicates the location to scroll to
* after selecting <code>index</code>.
*/
try {
} else {
}
}
} catch (BadLocationException ble) {
}
return result;
}
/**
* Adjusts the Rectangle to contain the bounds of the character at
* <code>index</code> in response to a page up.
*/
private boolean select;
/**
* Direction to scroll, 1 is down, -1 is up.
*/
private int direction;
}
/**
* Pages one view to the left or right.
*/
/** Create this object with the appropriate identifier. */
super(nm);
}
/** The operation to perform when this action is triggered. */
int selectedIndex;
if (left) {
}
else {
}
if(selectedIndex != -1) {
if (left) {
}
else {
}
if ((selectedIndex != 0) &&
}
else if(selectedIndex < 0) {
selectedIndex = 0;
}
if (select)
else
}
}
}
private boolean select;
private boolean left;
}
DumpModelAction() {
super("dump-model");
}
if (d instanceof AbstractDocument) {
}
}
}
}
/*
* Action to move the selection by way of the
* getNextVisualPositionFrom method. Constructor indicates direction
* to use.
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(nm);
}
/** The operation to perform when this action is triggered. */
try {
if(magicPosition == null &&
bidiCaret.getDotBias()) :
magicPosition = new Point(r.x, r.y);
}
bidiCaret.getDotBias() :
}
else {
bidiCaret.getDotBias() :
}
}
if (select) {
} else {
}
}
else {
if (select) {
} else {
}
}
if(magicPosition != null &&
}
} catch (BadLocationException ex) {
}
}
}
private boolean select;
private int direction;
}
/*
* Position the caret to the beginning of the word.
* @see DefaultEditorKit#beginWordAction
* @see DefaultEditorKit#selectBeginWordAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(nm);
}
/** The operation to perform when this action is triggered. */
try {
if (select) {
} else {
}
} catch (BadLocationException bl) {
}
}
}
private boolean select;
}
/*
* Position the caret to the end of the word.
* @see DefaultEditorKit#endWordAction
* @see DefaultEditorKit#selectEndWordAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(nm);
}
/** The operation to perform when this action is triggered. */
try {
if (select) {
} else {
}
} catch (BadLocationException bl) {
}
}
}
private boolean select;
}
/*
* Position the caret to the beginning of the previous word.
* @see DefaultEditorKit#previousWordAction
* @see DefaultEditorKit#selectPreviousWordAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(nm);
}
/** The operation to perform when this action is triggered. */
boolean failed = false;
try {
// we should first move to the end of the
// previous paragraph (bug #4278839)
getEndOffset() - 1;
}
} catch (BadLocationException bl) {
if (offs != 0) {
offs = 0;
}
else {
failed = true;
}
}
if (!failed) {
if (select) {
} else {
}
}
else {
}
}
}
private boolean select;
}
/*
* Position the caret to the next of the word.
* @see DefaultEditorKit#nextWordAction
* @see DefaultEditorKit#selectNextWordAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(nm);
}
/** The operation to perform when this action is triggered. */
boolean failed = false;
try {
// we should first move to the end of current
// paragraph (bug #4278839)
}
} catch (BadLocationException bl) {
} else {
}
}
else {
failed = true;
}
}
if (!failed) {
if (select) {
} else {
}
}
else {
}
}
}
private boolean select;
}
/*
* Position the caret to the beginning of the line.
* @see DefaultEditorKit#beginLineAction
* @see DefaultEditorKit#selectBeginLineAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(nm);
}
/** The operation to perform when this action is triggered. */
try {
if (select) {
} else {
}
} catch (BadLocationException bl) {
}
}
}
private boolean select;
}
/*
* Position the caret to the end of the line.
* @see DefaultEditorKit#endLineAction
* @see DefaultEditorKit#selectEndLineAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(nm);
}
/** The operation to perform when this action is triggered. */
try {
if (select) {
} else {
}
} catch (BadLocationException bl) {
}
}
}
private boolean select;
}
/*
* Position the caret to the beginning of the paragraph.
* @see DefaultEditorKit#beginParagraphAction
* @see DefaultEditorKit#selectBeginParagraphAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(nm);
}
/** The operation to perform when this action is triggered. */
if (select) {
} else {
}
}
}
private boolean select;
}
/*
* Position the caret to the end of the paragraph.
* @see DefaultEditorKit#endParagraphAction
* @see DefaultEditorKit#selectEndParagraphAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(nm);
}
/** The operation to perform when this action is triggered. */
elem.getEndOffset());
if (select) {
} else {
}
}
}
private boolean select;
}
/*
* Move the caret to the beginning of the document.
* @see DefaultEditorKit#beginAction
* @see DefaultEditorKit#getActions
*/
/* Create this object with the appropriate identifier. */
super(nm);
}
/** The operation to perform when this action is triggered. */
if (select) {
} else {
}
}
}
private boolean select;
}
/*
* Move the caret to the end of the document.
* @see DefaultEditorKit#endAction
* @see DefaultEditorKit#getActions
*/
/* Create this object with the appropriate identifier. */
super(nm);
}
/** The operation to perform when this action is triggered. */
if (select) {
} else {
}
}
}
private boolean select;
}
/*
* Select the word around the caret
* @see DefaultEditorKit#endAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
SelectWordAction() {
super(selectWordAction);
}
/** The operation to perform when this action is triggered. */
start.actionPerformed(e);
end.actionPerformed(e);
}
}
/*
* Select the line around the caret
* @see DefaultEditorKit#endAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
SelectLineAction() {
super(selectLineAction);
}
/** The operation to perform when this action is triggered. */
start.actionPerformed(e);
end.actionPerformed(e);
}
}
/*
* Select the paragraph around the caret
* @see DefaultEditorKit#endAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
super(selectParagraphAction);
}
/** The operation to perform when this action is triggered. */
start.actionPerformed(e);
end.actionPerformed(e);
}
}
/*
* Select the entire document
* @see DefaultEditorKit#endAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
* @param nm the name of the action, Action.NAME.
* @param select whether to extend the selection when
* changing the caret position.
*/
SelectAllAction() {
super(selectAllAction);
}
/** The operation to perform when this action is triggered. */
}
}
}
/*
* Remove the selection, if any.
* @see DefaultEditorKit#unselectAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
*/
UnselectAction() {
super(unselectAction);
}
/** The operation to perform when this action is triggered. */
}
}
}
/*
* Toggles the ComponentOrientation of the text component.
* @see DefaultEditorKit#toggleComponentOrientationAction
* @see DefaultEditorKit#getActions
*/
/**
* Create this action with the appropriate identifier.
*/
super(toggleComponentOrientationAction);
}
/** The operation to perform when this action is triggered. */
else
}
}
}
}