Class FieldLocation

  • All Implemented Interfaces:
    java.lang.Comparable<FieldLocation>

    public class FieldLocation
    extends java.lang.Object
    implements java.lang.Comparable<FieldLocation>
    Class to represent Field locations within the field viewer.

    A field location represents a place within a Field. Fields live within a concept we call a layout. A layout represents an 'item', for example an address, along with a grouping of related information. Each layout will contain one or more Field objects. Further, each layout's fields may have varying shapes, such as single or multiple rows within the layout. Thusly, a layout could conceptually represent a single line of text or multiple groupings of text and images, similar to how a newspaper or web page is laid out.

    A layout lives in a larger collection of layouts, which are laid out vertically. The index of a layout is its position within that larger list. This class contains the index of the layout within which it lives.

    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.

    This location also contains row and column values. These values refer to the row and column of text within a single Field. Lastly, this class contains a field number, which represents the relative field number inside of the over layout, which may contain multiple fields.

    See Also:
    FieldSelection, FieldRange, Layout
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compareTo​(FieldLocation o)  
      boolean equals​(java.lang.Object obj)  
      int getCol()
      Returns the column within the Field for this location.
      org.jdom.Element getElement​(java.lang.String name)  
      int getFieldNum()
      Returns the number of the field for this location.
      java.math.BigInteger getIndex()
      Returns the index for this location.
      int getRow()
      Returns the row within the Field for this location.
      int hashCode()  
      void set​(FieldLocation loc)  
      void setIndex​(java.math.BigInteger index)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • fieldNum

        public int fieldNum
      • row

        public int row
      • col

        public int col
    • Constructor Detail

      • FieldLocation

        public FieldLocation()
      • FieldLocation

        public FieldLocation​(int index)
      • FieldLocation

        public FieldLocation​(int index,
                             int fieldNum)
      • FieldLocation

        public FieldLocation​(java.math.BigInteger index)
      • FieldLocation

        public FieldLocation​(java.math.BigInteger index,
                             int fieldNum)
      • FieldLocation

        public FieldLocation​(int index,
                             int fieldNum,
                             int row,
                             int col)
        Construct a new FieldLocation with the given index,fieldNum,row, and col.
        Parameters:
        index - the index of the layout containing the location
        fieldNum - the index of the field in the layout containing the location
        row - the text row in the field containing the location.
        col - the character position the row containing the location.
      • FieldLocation

        public FieldLocation​(java.math.BigInteger index,
                             int fieldNum,
                             int row,
                             int col)
      • FieldLocation

        public FieldLocation​(org.jdom.Element child)
      • FieldLocation

        public FieldLocation​(FieldLocation loc)
        Construct a new FieldLocation by copying from another FieldLocation.
        Parameters:
        loc - the FieldLocation to be copied.
    • Method Detail

      • getIndex

        public java.math.BigInteger getIndex()
        Returns the index for this location. The index corresponds to the layout that contains the field represented by this location. See the javadoc header for more details.
        Returns:
        the index for this location.
      • getFieldNum

        public int getFieldNum()
        Returns the number of the field for this location. This is the number of the field within a given layout. See the javadoc header for more details.
        Returns:
        the number of the field for this location.
      • getRow

        public int getRow()
        Returns the row within the Field for this location.
        Returns:
        the row within the Field for this location.
      • getCol

        public int getCol()
        Returns the column within the Field for this location.
        Returns:
        the column within the Field for this location.
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • compareTo

        public int compareTo​(FieldLocation o)
        Specified by:
        compareTo in interface java.lang.Comparable<FieldLocation>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getElement

        public org.jdom.Element getElement​(java.lang.String name)
      • setIndex

        public void setIndex​(java.math.BigInteger index)