|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.awt.Component | +--java.awt.Container | +--java.awt.Panel | +--com.ibm.richtext.textpanel.TextPanel
TextPanel is an implementation of MTextPanel in an AWT Panel.
MTextPanel
, Serialized FormInner classes inherited from class java.awt.Panel |
java.awt.Panel.AccessibleAWTPanel |
Inner classes inherited from class java.awt.Container |
java.awt.Container.AccessibleAWTContainer |
Inner classes inherited from class java.awt.Component |
java.awt.Component.AccessibleAWTComponent |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface com.ibm.richtext.textpanel.MTextPanel |
COPYRIGHT, MULTIPLE_VALUES |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
TextPanel(MConstText initialText,
java.awt.datatransfer.Clipboard clipboard)
Create a new TextPanel with the default settings. |
|
TextPanel(TextPanelSettings settings,
MConstText initialText,
java.awt.datatransfer.Clipboard clipboard)
Create a new TextPanel. |
Method Summary | |
void |
addListener(TextPanelListener listener)
Add the given TextPanelListener to the listeners which will receive update notifications from this TextPanel. |
void |
append(MConstText newText)
Append the given text to the end of the document. |
boolean |
canRedo()
Return true if there is a change which can be redone. |
boolean |
canUndo()
Return true if there is a change which can be undone. |
void |
clear()
Remove selected text from the document, without altering the clipboard. |
void |
clearCommandLog()
Remove all commands from the command log. |
boolean |
clipboardNotEmpty()
Return true if the clipboard contains contents which could be transfered into the text. |
void |
copy()
Place the selected text on the clipboard. |
void |
cut()
Remove the selected text from the document and place it on the clipboard. |
java.lang.Object |
getCharacterStyleOverSelection(java.lang.Object key)
This method inspects the character style runs in the selection range (or the typing style at the insertion point). |
int |
getCommandLogSize()
Return the number of commands the command log can hold. |
static TextPanelSettings |
getDefaultSettings()
Return a TextPanelSettings instance with all settings set to the default values. |
AttributeMap |
getDefaultValues()
Return an AttributeMap of keys with default values. |
int |
getFormatWidth()
Return the total format width, in pixels. |
KeyRemap |
getKeyRemap()
Return the KeyRemap used to process key events. |
java.lang.Object |
getParagraphStyleOverSelection(java.lang.Object key)
This method inspects the paragraph style runs in the selection range (or the typing style at the insertion point). |
int |
getSelectionEnd()
Return the offset of the end of the selection. |
int |
getSelectionStart()
Return the offset of the start of the selection. |
MConstText |
getText()
Return the text document in the TextPanel. |
int |
getTextLength()
Return the length of the text document in the TextPanel. |
void |
insert(MConstText newText,
int position)
Insert the given text into the document at the given position. |
boolean |
isModified()
Return the modification flag of the current text change. |
void |
modifyCharacterStyleOnSelection(StyleModifier modifier)
Modify the character styles on the selected characters. |
void |
modifyParagraphStyleOnSelection(StyleModifier modifier)
Modify the paragraph styles in paragraphs containing selected characters, or the paragraph containing the insertion point. |
boolean |
paragraphIsLeftToRight(int offset)
Return true if the paragraph at the given offset is left-to-right. |
void |
paste()
Replace the currently selected text with the text on the clipboard. |
void |
redo()
Redo the most recent text change. |
void |
removeListener(TextPanelListener listener)
Remove the given TextPanelListener from the listeners which will receive update notifications from this TextPanel. |
void |
replaceRange(MConstText newText,
int start,
int end)
Replace the given range with newText. |
void |
select(int selectionStart,
int selectionEnd)
Set the selection range to the given range. |
void |
selectAll()
Select all of the text in the document. |
void |
setCaretPosition(int position)
Set the selection range to an insertion point at the given offset. |
void |
setCommandLogSize(int size)
Set the number of commands the command log can hold. |
void |
setKeyRemap(KeyRemap remap)
Use the given KeyRemap to map key events to characters. |
void |
setModified(boolean modified)
Set the modification flag of the current text change. |
void |
setSelectionEnd(int selectionEnd)
Set the end of the selection range. |
void |
setSelectionStart(int selectionStart)
Set the beginning of the selection range. |
void |
setText(MConstText newText)
Set the document to newText. |
void |
undo()
Undo the most recent text change. |
Methods inherited from class java.awt.Panel |
addNotify, getAccessibleContext |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFont, setLayout, update, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public TextPanel(MConstText initialText, java.awt.datatransfer.Clipboard clipboard)
initialText
- the text document. If null document text is empty.clipboard
- the clipboard to use for cut, copy, and paste
operations. If null this panel will use a private clipboard.public TextPanel(TextPanelSettings settings, MConstText initialText, java.awt.datatransfer.Clipboard clipboard)
settings
- the settings for this TextPanelinitialText
- the text document. If null document text is empty.clipboard
- the clipboard to use for cut, copy, and paste
operations. If null this panel will use a private clipboard.TextPanelSettings
Method Detail |
public static TextPanelSettings getDefaultSettings()
TextPanelSettings
public void addListener(TextPanelListener listener)
addListener
in interface MTextPanel
listener
- the listener to addpublic void removeListener(TextPanelListener listener)
removeListener
in interface MTextPanel
listener
- the listener to removepublic void setText(MConstText newText)
setText
in interface MTextPanel
newText
- the text which will replace the current text.public void append(MConstText newText)
append
in interface MTextPanel
newText
- the text to append to the documentpublic void insert(MConstText newText, int position)
insert
in interface MTextPanel
newText
- the text to insert into the document.position
- the position in the document where the
text will be insertedpublic void replaceRange(MConstText newText, int start, int end)
replaceRange
in interface MTextPanel
newText
- the text with which to replace the rangestart
- the beginning of the range to replaceend
- the end of the range to replacepublic int getTextLength()
getTextLength
in interface MTextPanel
public MConstText getText()
getText
in interface MTextPanel
public int getSelectionStart()
getSelectionStart
in interface MTextPanel
public int getSelectionEnd()
getSelectionEnd
in interface MTextPanel
public void setSelectionStart(int selectionStart)
setSelectionStart
in interface MTextPanel
selectionStart
- the start of the new selection rangepublic void setSelectionEnd(int selectionEnd)
setSelectionEnd
in interface MTextPanel
selectionStart
- the start of the new selection rangepublic void setCaretPosition(int position)
setCaretPosition
in interface MTextPanel
position
- the offset of the new insertion pointpublic void select(int selectionStart, int selectionEnd)
select
in interface MTextPanel
selectionStart
- the beginning of the selection rangeselectionEnd
- the end of the selection rangepublic void selectAll()
selectAll
in interface MTextPanel
public int getFormatWidth()
getFormatWidth
in interface MTextPanel
public boolean paragraphIsLeftToRight(int offset)
paragraphIsLeftToRight
in interface MTextPanel
offset
- an offset in the textpublic boolean canUndo()
canUndo
in interface MTextPanel
public boolean canRedo()
canRedo
in interface MTextPanel
public boolean clipboardNotEmpty()
clipboardNotEmpty
in interface MTextPanel
public AttributeMap getDefaultValues()
getDefaultValues
in interface MTextPanel
public java.lang.Object getCharacterStyleOverSelection(java.lang.Object key)
getCharacterStyleOverSelection
in interface MTextPanel
key
- the key used to retrieve values for comparisonMTextPanel.MULTIPLE_VALUES
public java.lang.Object getParagraphStyleOverSelection(java.lang.Object key)
getParagraphStyleOverSelection
in interface MTextPanel
key
- the key used to retrieve values for comparisonMTextPanel.MULTIPLE_VALUES
public void cut()
cut
in interface MTextPanel
public void copy()
copy
in interface MTextPanel
public void paste()
paste
in interface MTextPanel
public void clear()
clear
in interface MTextPanel
public void undo()
undo
in interface MTextPanel
public void redo()
redo
in interface MTextPanel
public int getCommandLogSize()
getCommandLogSize
in interface MTextPanel
public void setCommandLogSize(int size)
setCommandLogSize
in interface MTextPanel
size
- the number of commands kept in the command logpublic void clearCommandLog()
clearCommandLog
in interface MTextPanel
public void modifyCharacterStyleOnSelection(StyleModifier modifier)
modifyCharacterStyleOnSelection
in interface MTextPanel
modifier
- the StyleModifier with which to modify the stylespublic void modifyParagraphStyleOnSelection(StyleModifier modifier)
modifyParagraphStyleOnSelection
in interface MTextPanel
modifier
- the StyleModifier with which to modify the stylespublic KeyRemap getKeyRemap()
getKeyRemap
in interface MTextPanel
setKeyRemap(com.ibm.richtext.textpanel.KeyRemap)
public void setKeyRemap(KeyRemap remap)
Do not pass null to this method to leave key events unmapped. Instead, use KeyRemap.getIdentityRemap()
setKeyRemap
in interface MTextPanel
remap
- the KeyRemap to use for mapping key events to charactersjava.lang.NullPointerException
- if parameter is nullKeyRemap
public boolean isModified()
isModified
in interface MTextPanel
setModified(boolean)
public void setModified(boolean modified)
setModified
in interface MTextPanel
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |