com.lowagie.text.pdf.events

## Class IndexEvents

- java.lang.Object
- - com.lowagie.text.pdf.PdfPageEventHelper
  - - com.lowagie.text.pdf.events.IndexEvents

All Implemented Interfaces:
  PdfPageEvent

    public class IndexEvents
    extends PdfPageEventHelper

Class for an index.

Author:
  Michael Niedermair

### Nested Class Summary

Nested Classes
`class` `IndexEvents.Entry` Class for an index entry.

### Field Summary

Fields
`private java.util.Comparator` `comparator` Comparator for sorting the index
`private long` `indexcounter` indexcounter
`private java.util.List` `indexentry` the list for the index entry
`private java.util.Map` `indextag` keeps the indextag with the pagenumber

### Constructor Summary

Constructors
Constructor and Description
`IndexEvents()`

### Method Summary

Methods
`void` `create(Chunk text, java.lang.String in1)` Create an index entry.
`void` `create(Chunk text, java.lang.String in1, java.lang.String in2)` Create an index entry.
`void` `create(Chunk text, java.lang.String in1, java.lang.String in2, java.lang.String in3)` Create an index entry.
`Chunk` `create(java.lang.String text, java.lang.String in1)` Create an index entry.
`Chunk` `create(java.lang.String text, java.lang.String in1, java.lang.String in2)` Create an index entry.
`Chunk` `create(java.lang.String text, java.lang.String in1, java.lang.String in2, java.lang.String in3)` Create an index entry.
`java.util.List` `getSortedEntries()` Returns the sorted list with the entries and the collected page numbers.
`void` `onGenericTag(PdfWriter writer, Document document, Rectangle rect, java.lang.String text)` All the text that is passed to this event, gets registered in the indexentry.
`void` `setComparator(java.util.Comparator aComparator)` Set the comparator.

### Methods inherited from class com.lowagie.text.pdf.PdfPageEventHelper

`onChapter, onChapterEnd, onCloseDocument, onEndPage, onOpenDocument, onParagraph, onParagraphEnd, onSection, onSectionEnd, onStartPage`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### indextag

    private java.util.Map indextag

keeps the indextag with the pagenumber

#### indexcounter

    private long indexcounter

indexcounter

#### indexentry

    private java.util.List indexentry

the list for the index entry

#### comparator

    private java.util.Comparator comparator

Comparator for sorting the index

### Constructor Detail

#### IndexEvents

    public IndexEvents()

### Method Detail

#### onGenericTag

    public void onGenericTag(PdfWriter writer,
                    Document document,
                    Rectangle rect,
                    java.lang.String text)

All the text that is passed to this event, gets registered in the indexentry.

Specified by:
  `onGenericTag` in interface `PdfPageEvent`
Overrides:
  `onGenericTag` in class `PdfPageEventHelper`
Parameters:
  `writer` - the `PdfWriter` for this document
  `document` - the document
  `rect` - the `Rectangle` containing the `Chunk`
  `text` - the text of the tag
See Also:
  `PdfPageEventHelper.onGenericTag( com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document, com.lowagie.text.Rectangle, java.lang.String)`

#### create

    public Chunk create(java.lang.String text,
               java.lang.String in1,
               java.lang.String in2,
               java.lang.String in3)

Create an index entry.

Parameters:
  `text` - The text for the Chunk.
  `in1` - The first level.
  `in2` - The second level.
  `in3` - The third level.
Returns:
  Returns the Chunk.

#### create

    public Chunk create(java.lang.String text,
               java.lang.String in1)

Create an index entry.

Parameters:
  `text` - The text for the Chunk.
  `in1` - The first level.
Returns:
  Returns the Chunk.

#### create

    public Chunk create(java.lang.String text,
               java.lang.String in1,
               java.lang.String in2)

Create an index entry.

Parameters:
  `text` - The text for the Chunk.
  `in1` - The first level.
  `in2` - The second level.
Returns:
  Returns the Chunk.

#### create

    public void create(Chunk text,
              java.lang.String in1,
              java.lang.String in2,
              java.lang.String in3)

Create an index entry.

Parameters:
  `text` - The text.
  `in1` - The first level.
  `in2` - The second level.
  `in3` - The third level.

#### create

    public void create(Chunk text,
              java.lang.String in1)

Create an index entry.

Parameters:
  `text` - The text.
  `in1` - The first level.

#### create

    public void create(Chunk text,
              java.lang.String in1,
              java.lang.String in2)

Create an index entry.

Parameters:
  `text` - The text.
  `in1` - The first level.
  `in2` - The second level.

#### setComparator

    public void setComparator(java.util.Comparator aComparator)

Set the comparator.

Parameters:
  `aComparator` - The comparator to set.

#### getSortedEntries

    public java.util.List getSortedEntries()

Returns the sorted list with the entries and the collected page numbers.

Returns:
  Returns the sorted list with the entries and the collected page numbers.