com.klg.jclass.table
Class JCPrintTable
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--com.klg.jclass.table.JCTable
|
+--com.klg.jclass.table.JCPrintTable
- All Implemented Interfaces:
- ActionListener, EventListener, FocusListener, ImageObserver, MenuContainer, Printable, Serializable
- public class JCPrintTable
- extends JCTable
- implements Printable
The JCPrintTable
class controls paging, header and footers, and
print layout for JClass LiveTable.
- See Also:
- Serialized Form
Fields inherited from class com.klg.jclass.table.JCTable |
actions, adjustmentHandler, allow_cell_resize, allow_resize_by, auto_edit, auto_scroll, cell_border_width, cellAreaHandler, cellDisplayListeners, cellLayout, cellRendererPane, cellStyles, column_label_display, column_label_offset, column_label_placement, columnWidths, component_border_width, current_column, current_row, dataView, default_cell_style, default_label_style, edit_height_policy, edit_width_policy, editCellListeners, focus_color, focus_indicator, focusManager, frame_border, frame_border_width, frozen_column_placement, frozen_columns, frozen_row_placement, frozen_rows, hsb, hsb_attach, hsb_display, hsb_offset, hsb_position, hsb_track, hsb_track_row, ignore_container_size, jump_mode, keyHandler, left_column, margin_height, margin_width, min_cell_visibility, mouseHandler, mouseWheelListener, moveables, needs_initial_set_left_check, needs_initial_set_top_check, needs_initial_traverse, oldFocusOwner, paintListeners, pointer_traverse_forces_edit, popupMenu, popupMenuEnabled, repaint_enabled, resize_even, resize_interactive, resizeListeners, resizeMotionListeners, row_label_display, row_label_offset, row_label_placement, rowHeights, scrolling, scrollListeners, select_include_labels, selected_background, selected_background_mode, selected_foreground, selected_foreground_mode, selectionHandler, selectListeners, set_initial_left, set_initial_top, set_left_column, set_top_row, sort_column, sort_direction, sort_series, sortListeners, spanHandler, store_image, store_image_enabled, store_origin, tableChangeHandler, tableLayout, top_row, track_background, track_cursor, track_foreground, track_size, traverse_cycle, traverseListeners, userData, variable_estimate_count, visible_columns, visible_rows, vsb, vsb_attach, vsb_display, vsb_offset, vsb_position, vsb_track, vsb_track_column |
Constructor Summary |
JCPrintTable(com.klg.jclass.table.JCTable table)
Creates a new JCPrintTable . |
Methods inherited from class com.klg.jclass.table.JCTable |
actionPerformed, addAction, addAction, addCellDisplayListener, addColumnSelection, addEditCellListener, addNotify, addPaintListener, addResizeCellListener, addResizeCellMotionListener, addRowSelection, addScrollListener, addSelection, addSelectListener, addSortListener, addSpannedRange, addTableMouseWheelListener, addToMoveables, addTraverseCellListener, beginEdit, cancelEdit, clearSelectedCells, clearSelection, clearSpannedRanges, cloneCellStyles, commitEdit, createCellStyle, createDefaultCellLayout, createDefaultCellStyleSeries, createDefaultColumnWidthSeries, createDefaultDataSource, createDefaultDataView, createDefaultRowHeightSeries, createDefaultSelectionModel, createDefaultSpanHandler, createDefaultUserDataSeries, createPopupMenu, dispose, doLayout, doResizeEvents, dragColumn, dragRow, findMethod, fireJCCellDisplayEvent, fireJCEditCellEvent, fireJCPaintEvent, fireJCResizeCellEvent, fireJCResizeCellMotionEvent, fireJCScrollEvent, fireJCSelectEvent, fireJCSortEvent, fireJCTraverseCellEvent, focusGained, focusLost, getAction, getAllowCellResize, getAllowResizeBy, getAutoScroll, getCellAreaHandler, getCellBorderWidth, getCellBounds, getCellLayout, getCellPosition, getCellStyle, getCellStyleRanges, getCellStyles, getCellStyleValues, getCharHeight, getCharWidth, getColumnCellSize, getColumnClass, getColumnLabelOffset, getColumnLabelPlacement, getColumnPixelWidth, getColumnWidthValues, getComponent, getComponentBorderWidth, getComponentModel, getCurrentCell, getCurrentColumn, getCurrentRow, getDataSource, getDataView, getDefaultCellStyle, getDefaultLabelStyle, getEditHeightPolicy, getEditingComponent, getEditTraverseHandler, getEditWidthPolicy, getFocusColor, getFocusIndicator, getFocusManager, getFrameBorder, getFrameBorderWidth, getFrozenColumnPlacement, getFrozenColumns, getFrozenRowPlacement, getFrozenRows, getHorizSB, getHorizSBAttachment, getHorizSBDisplay, getHorizSBOffset, getHorizSBPosition, getHorizSBTrack, getHorizSBTrackRow, getJumpScroll, getKeyInputHandler, getLeftColumn, getLicense, getMarginHeight, getMarginWidth, getMaxHeight, getMaxWidth, getMinCellVisibility, getMinHeight, getMinimumSize, getMinWidth, getMouseInputHandler, getNumColumns, getNumRows, getNumVisibleColumns, getNumVisibleRows, getPixelHeight, getPixelWidth, getPointerTraverseForcesEdit, getPosition, getPreferredSize, getRowCellSize, getRowHeightValues, getRowLabelOffset, getRowLabelPlacement, getRowPixelHeight, getSelectedBackground, getSelectedBackgroundMode, getSelectedCells, getSelectedForeground, getSelectedForegroundMode, getSelectIncludeLabels, getSelectionModel, getSelectionPolicy, getSpanHandler, getSpannedRange, getSpannedRanges, getTableLayout, getTextHeightOffset, getTextWidthOffset, getTopRow, getTrackBackground, getTrackForeground, getTrackSize, getUI, getUIClassID, getUniqueCellStyle, getUserData, getVariableEstimateCount, getVertSB, getVertSBAttachment, getVertSBDisplay, getVertSBOffset, getVertSBPosition, getVertSBTrack, getVertSBTrackColumn, getVisibleCells, getVisibleColumns, getVisibleRows, goToRow, hasComponent, hasComponents, hideShowColumns, isAutoEdit, isCell, isCellVisible, isColumnHidden, isColumnLabel, isColumnLabelDisplay, isColumnVisible, isContentClipped, isCurrentCell, isEditable, isFocusTraversable, isIgnoreContainerSize, isLabel, isPopupMenuEnabled, isRecalcRequired, isRelayoutRequired, isRepaintEnabled, isRepaintRequired, isResizable, isResizeEven, isResizeInteractive, isRowHidden, isRowLabel, isRowLabelDisplay, isRowVisible, isSelected, isSeriesDataSorted, isStoreImageEnabled, isTrackCursor, isTracking, isTraversable, isTraverseCycle, isValidCell, keyPressed, keyReleased, keyTyped, layoutAreas, makeColumnVisible, makeRowVisible, makeVisible, mouseClicked, mouseDragged, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, paintComponent, processKeyEvent, processMouseEvent, processMouseMotionEvent, removeAction, removeAction, removeAction, removeAllActions, removeCellDisplayListener, removeEditCellListener, removePaintListener, removeResizeCellListener, removeResizeCellMotionListener, removeScrollListener, removeSelectListener, removeSortListener, removeSpannedRange, removeTableMouseWheelListener, removeTraverseCellListener, repaintSelected, requestChange, requestChange, requestChange, requestFocus, resetSortedRows, resetSwappedColumns, resetSwappedRows, reshape, selectAll, setAllowCellResize, setAllowResizeBy, setAutoEdit, setAutoScroll, setCellBorderWidth, setCellEditor, setCellEditor, setCellEditorMapping, setCellLayout, setCellRenderer, setCellRenderer, setCellRendererMapping, setCellStyle, setCellStyle, setCellStyles, setCharHeight, setCharWidth, setColumnCellSize, setColumnHidden, setColumnLabelDisplay, setColumnLabelOffset, setColumnLabelPlacement, setColumnSelection, setColumnWidthChanged, setComponent, setComponent, setComponentBorderWidth, setCurrentCell, setCurrentCell, setCurrentCell, setCursor, setDataSource, setDataView, setEditHeightPolicy, setEditWidthPolicy, setFocusColor, setFocusIndicator, setFocusManager, setFrameBorder, setFrameBorderWidth, setFrozenColumnPlacement, setFrozenColumns, setFrozenRowPlacement, setFrozenRows, setHorizSB, setHorizSBAttachment, setHorizSBDisplay, setHorizSBOffset, setHorizSBPosition, setHorizSBTrack, setHorizSBTrackRow, setIgnoreContainerSize, setJumpScroll, setLeftColumn, setLicense, setMarginHeight, setMarginWidth, setMaxHeight, setMaxWidth, setMinCellVisibility, setMinHeight, setMinWidth, setPixelHeight, setPixelWidth, setPointerTraverseForcesEdit, setPopupMenuEnabled, setRecalcRequired, setRelayoutRequired, setRepaintEnabled, setRepaintRequired, setResizeEven, setResizeInteractive, setRowCellSize, setRowHeightChanged, setRowHidden, setRowLabelDisplay, setRowLabelOffset, setRowLabelPlacement, setRowSelection, setSelectedBackground, setSelectedBackgroundMode, setSelectedCells, setSelectedCells, setSelectedForeground, setSelectedForegroundMode, setSelectIncludeLabels, setSelection, setSelectionModel, setSelectionPolicy, setSeriesDataSorted, setSpanHandler, setSpannedRanges, setStoreImageEnabled, setTopRow, setTrackBackground, setTrackCursor, setTrackForeground, setTrackSize, setTraverseCycle, setUI, setUserData, setUserData, setVariableEstimateCount, setVertSB, setVertSBAttachment, setVertSBDisplay, setVertSBOffset, setVertSBPosition, setVertSBTrack, setVertSBTrackColumn, setVisibleColumns, setVisibleRows, showPopupMenu, sortByColumn, sortByColumn, sortByColumn, sortByColumn, swapColumns, swapRows, traverse, traverse, updateUI, XtoColumn, XYToCell, YtoRow |
Methods inherited from class javax.swing.JComponent |
addAncestorListener, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle |
MARGIN_IN_INCHES
public static final int MARGIN_IN_INCHES
- See Also:
- Constant Field Values
MARGIN_IN_PIXELS
public static final int MARGIN_IN_PIXELS
- See Also:
- Constant Field Values
table
protected com.klg.jclass.table.JCTable table
page_width
protected int page_width
page_height
protected int page_height
page_resolution
protected int page_resolution
table_width
protected int table_width
table_height
protected int table_height
margin
protected Insets margin
margin_unit
protected int margin_unit
current_page
protected int current_page
ALL_PAGES
public static final int ALL_PAGES
- See Also:
- Constant Field Values
print_page
protected int print_page
page_format
protected PageFormat page_format
printListeners
protected com.klg.jclass.util.JCListenerList printListeners
JCPrintTable
public JCPrintTable(com.klg.jclass.table.JCTable table)
- Creates a new
JCPrintTable
. This class creates a
"copy" of the table's visible properties and links to the same data source.
Cell height and width is copied by pixel size. Scrollbars and components are
not part of the printed table and are not copied.
- Parameters:
table
-
showPrintPreview
public void showPrintPreview(String caption)
- Displays a print preview screen with the specified caption.
- Parameters:
caption
-
print
public void print()
- Prints all pages using the default settings.
setPageFormat
public void setPageFormat(PageFormat format)
- Sets the page format. Table printing only supports a single
page format for all pages.
setPrintPage
public void setPrintPage(int page)
- Sets the page to print. Use
JCTableEnum.ALL_PAGES
to print
everything.
- Parameters:
page
-
getPageFormat
public PageFormat getPageFormat()
- Gets the page format. Table printing only supports a single
page format for all pages.
print
public int print(Graphics gc,
PageFormat pageFormat,
int pageIndex)
- Prints the given page using the specified page format.
This method is used internally by JClass LiveTable and
should not be used by applications.
- Specified by:
print
in interface Printable
loadSettings
protected void loadSettings(com.klg.jclass.table.JCTable table)
- Loads/copies settings from the source table.
- Parameters:
table
-
printPage
public void printPage(Graphics gc,
int page)
- Generates a new page.
- Parameters:
gc
- page
-
printPage
public void printPage(Graphics gc,
com.klg.jclass.table.JCCellRange cr)
- Draws the table for a given cell range.
- Parameters:
cr
- The cell rangegc
- The graphics context to use
getMarginUnits
public int getMarginUnits()
- Returns the units for margins.
- Returns:
- units for margins
setMarginUnits
public void setMarginUnits(int mu)
- Sets the units for margin calculations.
- Parameters:
mu
-
getNumHorizontalPages
public int getNumHorizontalPages()
throws com.klg.jclass.table.JCPrintTable.IllegalSizeException
- Returns the number of horizontal pages.
- Returns:
- number of horizontal pages
- Throws:
IllegalSizeException
com.klg.jclass.table.JCPrintTable.IllegalSizeException
getNumPages
public int getNumPages()
throws com.klg.jclass.table.JCPrintTable.IllegalSizeException
- Returns the number of pages required to print the table.
- Returns:
- number of pages required to print the table
- Throws:
IllegalSizeException
com.klg.jclass.table.JCPrintTable.IllegalSizeException
getNumVerticalPages
public int getNumVerticalPages()
- Returns the number of vertical pages.
- Returns:
- number of vertical pages
getPageCellRange
public com.klg.jclass.table.JCCellRange getPageCellRange(int page)
throws com.klg.jclass.table.JCPrintTable.IllegalSizeException
- Returns the cell range that defines the boundary of cells that are on
a page. The size of the cell range considers labels and frozen
cells, but does not include them in the range itself.
- Parameters:
page
-
- Returns:
- cell range
- Throws:
IllegalSizeException
com.klg.jclass.table.JCPrintTable.IllegalSizeException
getPageDimensions
public Dimension getPageDimensions()
- Returns the page dimensions.
- Returns:
- page dimensions
setPageDimensions
public void setPageDimensions(int page_width,
int page_height)
- Sets the dimensions of a page.
- Parameters:
page_height
- page_width
-
getPageHeight
public int getPageHeight()
- Returns the height of a page.
- Returns:
- height of a page
setPageHeight
public void setPageHeight(int page_height)
- Sets the height of a page.
- Parameters:
page_height
-
getPageMargins
public Insets getPageMargins()
- Returns the page margins.
- Returns:
- page margins
getDefaultPageMargins
public Insets getDefaultPageMargins()
- Returns the default margins.
- Returns:
- default margins
setPageMargins
public void setPageMargins(Insets margin)
- Sets the page margins. Passing null sets the margins to the default 1".
- Parameters:
margin
-
getPageResolution
public int getPageResolution()
- Returns the page resolution.
- Returns:
- page resolution
setPageResolution
public void setPageResolution(int page_resolution)
- Sets the page resolution in pixels/inch.
- Parameters:
page_resolution
-
getPageWidth
public int getPageWidth()
- Returns the width of a page.
- Returns:
- width of a page
setPageWidth
public void setPageWidth(int page_width)
- Sets the width of a page.
- Parameters:
page_width
-
getBounds
public Point getBounds(int row,
int column)
- Replaces
Table.getPosition
to provide for pixel placement of
any cell or label on a print page independent from the standard clip logic.
- Parameters:
column
- row
-
- Returns:
getTableDimensions
public Dimension getTableDimensions(int page)
- Returns the Dimensions that JClass LiveTable uses on a given page.
- Parameters:
page
-
- Returns:
- Dimensions used on a given page
fireJCPrintEvent
protected void fireJCPrintEvent(com.klg.jclass.table.JCPrintEvent event)
- Convenience method for firing
JCPrintEvents
.
- Parameters:
event
-
addPrintListener
public void addPrintListener(com.klg.jclass.table.JCPrintListener l)
- Adds the specified listener to receive instances
of
JCPrintEvent
objects.
- Parameters:
l
- - See Also:
JCPrintEvent
removePrintListener
public void removePrintListener(com.klg.jclass.table.JCPrintListener l)
- Removes the specified listener so it no longer receives
JCPrintEvent
objects.
- Parameters:
l
- - See Also:
addPrintListener(com.klg.jclass.table.JCPrintListener)