Package com.portal.common
Class PrintableArrayList
java.lang.Object
java.util.AbstractCollection
java.util.AbstractList
java.util.ArrayList
com.portal.common.PrintableArrayList
- All Implemented Interfaces:
Printable
,Serializable
,Cloneable
,Iterable
,Collection
,List
,RandomAccess
,SequencedCollection
Implements the printable for the ArrayList.
The item in the ArrayList will be printed line by line. The toString() for
each item in the ArrayList will be called for the printing.
- Author:
- Dachywan Wu
- See Also:
-
Field Summary
Fields inherited from class java.util.AbstractList
modCount
Fields inherited from interface java.awt.print.Printable
NO_SUCH_PAGE, PAGE_EXISTS
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs an empty list with an initial capacity of ten.PrintableArrayList
(int initialCapacity) Constructs an empty list with the specified initial capacity.Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. -
Method Summary
Modifier and TypeMethodDescriptiongetDesc()
Get the description ArrayList.getFont()
Get the printing font.Get the page header.int
print
(Graphics g, PageFormat pf, int pageIndex) This method implements the Printable interface.void
Set the description for the array.void
Set the printing font.void
setPageHeader
(String header) Set the printing page header for the array.Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, ensureCapacity, equals, forEach, get, getFirst, getLast, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeFirst, removeIf, removeLast, removeRange, replaceAll, retainAll, set, size, sort, spliterator, subList, toArray, toArray, trimToSize
Methods inherited from class java.util.AbstractCollection
containsAll, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.List
containsAll, reversed
-
Constructor Details
-
PrintableArrayList
public PrintableArrayList()Constructs an empty list with an initial capacity of ten. -
PrintableArrayList
Constructs a list containing the elements of the specified collection, in the order they are returned by the collection's iterator. The ArrayList instance has an initial capacity of 110% the size of the specified collection.- Parameters:
c
- the collection whose elements are to be placed into this list.
-
PrintableArrayList
public PrintableArrayList(int initialCapacity) Constructs an empty list with the specified initial capacity.- Parameters:
initialCapacity
- the initial capacity of the list.
-
-
Method Details
-
print
This method implements the Printable interface. Used exclusively for printing.- Specified by:
print
in interfacePrintable
- Parameters:
g
- the graphics context.pf
- the PageFormat for printing.pageIndex
- the page index starting from 0.- Returns:
- PAGE_EXISTS, or NO_SUCH_PAGE if printing failed.
- Throws:
PrinterException
-
setPageHeader
Set the printing page header for the array.- Parameters:
header
- the header text.
-
getPageHeader
Get the page header.- Returns:
- the page header.
-
setDesc
Set the description for the array. Will be used in printing.- Parameters:
al
- the description array. The toString() for each item will be called for printing the description area.
-
getDesc
Get the description ArrayList.- Returns:
- the description array.
-
setFont
Set the printing font.- Parameters:
font
- the font for printing.
-
getFont
Get the printing font.- Returns:
- the printing font.
-