Class LinkedPositionGroup
All linked positions in a group should have the same content. Before 3.5.400, this was enforced. Now, if one position of a mixed group gets edited, the content of all other positions is replaced by the edited position's content.
Normally, new positions are given a sequence number
which can be used by
clients, e.g. in the UI as tab stop weight. If NO_STOP
is used as weight, a position will not be visited.
If NO_STOP
is used for all positions, the first position in a document is taken as
the only stop as to comply with the behavior of the old linked position
infrastructure.
Clients may instantiate this class.
- Since:
- 3.0
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Sequence number
constant declaring that a position should not be stopped by. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addPosition
(LinkedPosition position) Adds a position to this group.Returns the positions contained in the receiver as an array.boolean
isEmpty()
Returns whether this group contains any positions.boolean
isEmtpy()
Deprecated.
-
Field Details
-
NO_STOP
public static final int NO_STOPSequence number
constant declaring that a position should not be stopped by.- See Also:
-
-
Constructor Details
-
LinkedPositionGroup
public LinkedPositionGroup()
-
-
Method Details
-
addPosition
Adds a position to this group. The document region defined by the position should contain the same content as all of the other positions already in this group. All positions added must be valid and disjoint; otherwise aBadLocationException
is thrown.Positions added using this method are owned by this group afterwards and may not be updated or modified thereafter.
Once a group has been added to a
LinkedModeModel
, it becomes sealed and no positions may be added any more.- Parameters:
position
- the position to add- Throws:
BadLocationException
- if the position is invalid or conflicts with other positions in the groupIllegalStateException
- if the group has already been added to a model
-
isEmpty
public boolean isEmpty()Returns whether this group contains any positions.- Returns:
true
if this group is empty,false
otherwise- Since:
- 3.1
-
isEmtpy
Deprecated.As of 3.1, replaced byisEmpty()
Returns whether this group contains any positions.- Returns:
true
if this group is empty,false
otherwise
-
getPositions
Returns the positions contained in the receiver as an array. The positions are the actual positions and must not be modified; the array is a copy of internal structures.- Returns:
- the positions of this group in no particular order
-
isEmpty()