|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.xwiki.gwt.user.client.ui.rta.SelectionPreserver
public class SelectionPreserver
Most of the plugins alter the DOM document edited with the rich text area by executing commands on the current
selection (thus on the current range). In some cases, a plugin needs to get user input before executing such a
command. It can gather the needed information by opening a dialog, for instance. In some browsers this may lead to
loosing the selection on the rich text area. In this case the plugin has to saveSelection() before the
dialog is shown and restoreSelection() after the dialog is closed.
The selection preserver can be also used to restore the selection after executing commands like insert HTML. In this
particular case the restored selection will contain the HTML that replaced the previous selection.
| Constructor Summary | |
|---|---|
SelectionPreserver(RichTextArea rta)
Creates a new selection preserver for the specified rich text area. |
|
| Method Summary | |
|---|---|
void |
clearSelection()
Removes the markers from the document and clears the list of saved range place holders. |
boolean |
hasSelection()
|
void |
restoreSelection()
Restores the saved selection on the underlying rich text area and resets the state of the selection preserver. |
void |
restoreSelection(boolean reset)
If there is a saved selection restores it, otherwise restores the default selection on the underlying rich text area. |
void |
saveSelection()
Saves the current selection for later changes. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public SelectionPreserver(RichTextArea rta)
rta - The rich text area whose selection will be preserved.| Method Detail |
|---|
public void clearSelection()
public void saveSelection()
restoreSelection()public boolean hasSelection()
true if there is a saved selection, false otherwisepublic void restoreSelection()
saveSelection()public void restoreSelection(boolean reset)
saveSelection() before.
reset - true if you want to reset the state of the selection preserver, false otherwise.saveSelection()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||