org.odftoolkit.simple.common.navigation
public class FieldSelection extends Selection
Fields
,
AuthorField
,
ChapterField
,
ConditionField
,
DateField
,
PageCountField
,
PageNumberField
,
ReferenceField
,
SubjectField
,
TimeField
,
TitleField
,
VariableField
Constructor and Description |
---|
FieldSelection(TextSelection selection)
Construct a FieldSelection with TextSelection.
|
Modifier and Type | Method and Description |
---|---|
void |
applyStyle(OdfStyleBase style)
Apply a style to the selection so that the text style of this selection
will append the specified style.
|
void |
cut()
Delete the selection from the document the other matched selection in the
same container element will be updated automatically because the start
index of the following selections will be changed when the previous
selection has been deleted.
|
void |
pasteAtEndOf(Selection positionItem)
Paste this selection just after a specific selection.
|
void |
pasteAtFrontOf(Selection positionItem)
Paste this selection just before a specific selection.
|
protected void |
refresh(int offset)
A quick method to update the index of this
Selection . |
protected void |
refreshAfterFrontalDelete(Selection deletedItem)
When a selected item has been deleted, the
Selection s after
this deleted Selection should be refreshed, as these
Selection s index have been changed. |
protected void |
refreshAfterFrontalInsert(Selection insertedItem)
When a selected item has been inserted, the
Selection after
the inserted item should be refresh, as these Selection s
index have been changed. |
void |
replaceWith(String newText)
Replace the text content of selection with a new string.
|
ConditionField |
replaceWithConditionField(String condition,
String trueText,
String falseText)
Replace the content with a condition field.
|
ConditionField |
replaceWithHiddenTextField(String condition,
String text)
Replace the content with a hidden text field.
|
void |
replaceWithReferenceField(ReferenceField field,
ReferenceField.DisplayType type)
Replace the content with a reference field.
|
Field |
replaceWithSimpleField(Field.FieldType fieldType)
Replace the content with a simple field, such as author field, page
number field, date field and so on.
|
void |
replaceWithVariableField(VariableField field)
Replace the content with a variable field.
|
getElement, getIndex, getNavigation
public FieldSelection(TextSelection selection)
selection
- the TextSelection to be decorated.public Field replaceWithSimpleField(Field.FieldType fieldType)
fieldType
- the simple field type to replace.public void replaceWithReferenceField(ReferenceField field, ReferenceField.DisplayType type)
field
- the reference field to replace.public void replaceWithVariableField(VariableField field)
field
- the variable field to replace.public ConditionField replaceWithConditionField(String condition, String trueText, String falseText)
condition
- the condition that determines which of the two text strings is
displayed.trueText
- the text string to display if a condition
is
true.falseText
- the text string to display if a condition
is
false.public ConditionField replaceWithHiddenTextField(String condition, String text)
condition
- the condition that determines whether the text string is
displayed or not.text
- the text string to display.public void applyStyle(OdfStyleBase style) throws InvalidNavigationException
style
- the style can be from the current document or user definedInvalidNavigationException
- if the selection is unavailable.public void cut() throws InvalidNavigationException
cut
in class Selection
InvalidNavigationException
- if the selection is unavailable.public void replaceWith(String newText) throws InvalidNavigationException
newText
- the replace text StringInvalidNavigationException
- if the selection is unavailable.public void pasteAtEndOf(Selection positionItem) throws InvalidNavigationException
pasteAtEndOf
in class Selection
positionItem
- a selection that is used to point out the positionInvalidNavigationException
- if the selection is unavailable.public void pasteAtFrontOf(Selection positionItem) throws InvalidNavigationException
pasteAtFrontOf
in class Selection
positionItem
- a selection that is used to point out the positionInvalidNavigationException
- if the selection is unavailable.protected void refresh(int offset)
Selection
Selection
.protected void refreshAfterFrontalDelete(Selection deletedItem)
Selection
Selection
s after
this deleted Selection
should be refreshed, as these
Selection
s index have been changed.refreshAfterFrontalDelete
in class Selection
deletedItem
- the deleted Selection
protected void refreshAfterFrontalInsert(Selection insertedItem)
Selection
Selection
after
the inserted item should be refresh, as these Selection
s
index have been changed.refreshAfterFrontalInsert
in class Selection
insertedItem
- the inserted Selection
Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.