Class FieldSelection
java.lang.Object
docking.widgets.fieldpanel.support.FieldSelection
- All Implemented Interfaces:
Iterable<FieldRange>
This class represents a selection in a field viewer.
A FieldSelection
may be within a single layout or may cross multiple layouts. To
determine if a selection crosses multiple layouts, you can get the range
of
the selection. You can then use the range's start and end locations to determine if the
selection spans multiple layouts. If the start and end indexes of the range are the same, then
the selection is within a single layout; otherwise, the selection spans multiple layouts.
- See Also:
-
Constructor Summary
ConstructorDescriptionConstruct a new empty FieldSelection.FieldSelection
(FieldSelection selection) Construct a new FieldSelection with the same selection as the given FieldSelection. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRange
(int startIndex, int endIndex) Add the all the indexes from startIndex to endIndex to the selection.void
addRange
(int startIndex, int startFieldNum, int endIndex, int endFieldNum) void
addRange
(FieldLocation start, FieldLocation end) Adds a field range to this selection.void
addRange
(FieldRange range) void
addRange
(BigInteger startIndex, int startFieldNum, BigInteger endIndex, int endFieldNum) void
addRange
(BigInteger startIndex, BigInteger endIndex) void
clear()
Removes all indexes from the list.boolean
contains
(FieldLocation loc) Returns true if the given Field at the given index is in the selection.boolean
containsEntirely
(FieldRange range) boolean
containsEntirely
(BigInteger index) Returns true if the all the fields in the layout with the given index are included in this selection.final void
delete
(FieldSelection selection) Delete all fields in the ranges in the given field selection from this one.boolean
boolean
excludesEntirely
(FieldRange range) boolean
excludesEntirely
(BigInteger index) final FieldSelection
findIntersection
(FieldSelection selection) Computes the intersection of this field selection and the given field selection.getFieldRange
(int rangeNum) Returns the i'th Field Range in the selection.int
Returns the current number of ranges in the list.Returns the range if the given Field at the given index is in the selection.int
hashCode()
final void
insert
(FieldSelection selection) Insert all fields in the ranges in the given field selection from this one.intersect
(int index) intersect
(FieldRange range) final void
intersect
(FieldSelection selection) Compute the intersection of this field selection and another one.intersect
(BigInteger index) boolean
isEmpty()
iterator()
void
void
removeRange
(int startIndex, int endIndex) Removes the all the fields in the index range from the selection.void
removeRange
(FieldLocation start, FieldLocation end) Removes the given field range from the current selection.void
removeRange
(BigInteger startIndex, BigInteger endIndex) void
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
FieldSelection
public FieldSelection()Construct a new empty FieldSelection. -
FieldSelection
Construct a new FieldSelection with the same selection as the given FieldSelection.- Parameters:
selection
- the FieldSelection to copy.
-
-
Method Details
-
clear
public void clear()Removes all indexes from the list. -
contains
Returns true if the given Field at the given index is in the selection.- Parameters:
loc
- the field location.- Returns:
- true if the field selection contains the specified location.
-
getRangeContaining
Returns the range if the given Field at the given index is in the selection. Otherwise returns null.- Parameters:
loc
- location to find the range for.- Returns:
- the range
-
containsEntirely
Returns true if the all the fields in the layout with the given index are included in this selection.- Parameters:
index
- index of the layout to test.- Returns:
- true if the all the fields in the layout with the given index are included in this selection.
-
containsEntirely
-
excludesEntirely
-
excludesEntirely
-
addRange
Adds a field range to this selection.- Parameters:
start
- the starting field location.end
- the ending field location.
-
addRange
public void addRange(int startIndex, int endIndex) Add the all the indexes from startIndex to endIndex to the selection. The added range includes the startIndex, but not the endIndex.- Parameters:
startIndex
- the start index of the layouts to includeendIndex
- the end index(not inclusive) of the layouts to include
-
addRange
-
addRange
public void addRange(int startIndex, int startFieldNum, int endIndex, int endFieldNum) -
addRange
public void addRange(BigInteger startIndex, int startFieldNum, BigInteger endIndex, int endFieldNum) -
removeRange
Removes the given field range from the current selection.- Parameters:
start
- the starting field location.end
- the ending field location.
-
removeRange
public void removeRange(int startIndex, int endIndex) Removes the all the fields in the index range from the selection.- Parameters:
startIndex
- the first index in the range to remove.endIndex
- the last index in the range to remove.
-
removeRange
-
getNumRanges
public int getNumRanges()Returns the current number of ranges in the list.- Returns:
- the current number of ranges in the list.
-
getFieldRange
Returns the i'th Field Range in the selection.- Parameters:
rangeNum
- the index of the range to retrieve.- Returns:
- the range
-
intersect
Compute the intersection of this field selection and another one. The intersection of two field selections is all fields existing in both selections.Note: This field selection becomes the intersection.
- Parameters:
selection
- field selection to intersect.
-
findIntersection
Computes the intersection of this field selection and the given field selection.- Parameters:
selection
- the selection to intersect with.- Returns:
- the selection
-
delete
Delete all fields in the ranges in the given field selection from this one.- Parameters:
selection
- the field selection fields to remove from this field selection.
-
insert
Insert all fields in the ranges in the given field selection from this one.- Parameters:
selection
- the field selection fields to add to this field selection.
-
toString
-
hashCode
public int hashCode() -
equals
-
save
-
load
-
isEmpty
public boolean isEmpty() -
intersect
-
intersect
-
intersect
-
addRange
-
iterator
- Specified by:
iterator
in interfaceIterable<FieldRange>
-