JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.page
Class JCPageTableFromJTable

java.lang.Object
  |
  +--com.klg.jclass.page.JCPageTableFromJTable

public class JCPageTableFromJTable
extends Object

Creates a JCPageTable from a swing JTable.


Field Summary
protected static int[][] alignment_map
           
protected static int defaultColumnWidth
           
 
Constructor Summary
JCPageTableFromJTable()
           
 
Method Summary
protected static int convertSwingToTextStyleAlignment(int alignment)
          Converts the SwingConstants alignment to a JCTextStyle alignment.
static com.klg.jclass.page.JCPageTable createTable(com.klg.jclass.page.JCDocument doc, JTable jTable, boolean populate)
          Creates a JCPageTable from a swing JTable.
static com.klg.jclass.page.JCPageTable createTable(com.klg.jclass.page.JCDocument doc, TableModel tableModel, boolean populate)
          Creates a JCPageTable from a swing TableModel.
protected static com.klg.jclass.page.JCPageTable createTable(com.klg.jclass.page.JCDocument doc, TableModel tableModel, JTable jTable, boolean populate)
          Creates a JCPageTable from either a swing TableModel or a swing JTable.
protected static JLabel getLabelComponent(Component comp)
          Searches for a JLabel and returns it.
static void populateTable(com.klg.jclass.page.JCPageTable table, JTable jTable)
          Populates an empty JCPageTable from the view of the specified JTable, copying certain style elements (alignment, font).
static void populateTable(com.klg.jclass.page.JCPageTable table, JTable jTable, boolean applyJTableStyles)
          Populates an empty JCPageTable from the view of the specified JTable.
static void populateTable(com.klg.jclass.page.JCPageTable table, TableModel tableModel)
          Populates an empty JCPageTable from the specified TableModel.
protected static void populateTable(com.klg.jclass.page.JCPageTable table, TableModel tableModel, JTable jTable)
          Populates an empty JCPageTable from the specified TableModel or JTable.
protected static void populateTable(com.klg.jclass.page.JCPageTable table, TableModel tableModel, JTable jTable, boolean applyJTableStyles)
          Populates an empty JCPageTable from the specified TableModel or JTable.
protected static com.klg.jclass.page.JCTextStyle setFontAndAlignment(TableCellRenderer renderer, com.klg.jclass.page.JCTextStyle currentStyle, JTable jTable, Object object, int rowIdx, int colIdx)
          Given a renderer, the font and alignment will be set in the style.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultColumnWidth

protected static int defaultColumnWidth

alignment_map

protected static int[][] alignment_map
Constructor Detail

JCPageTableFromJTable

public JCPageTableFromJTable()
Method Detail

createTable

public static com.klg.jclass.page.JCPageTable createTable(com.klg.jclass.page.JCDocument doc,
                                                          JTable jTable,
                                                          boolean populate)
Creates a JCPageTable from a swing JTable. The JCPageTable will have the same number of columns and the same column widths as the list of columns in the JTable view.

Parameters:
doc - current JCDocument instance
jTable - JTable instance being converted to JCPageTable
populate - if true, the created JCPageTable is immediately populated with the contents and certain style elements (alignment, font) of the JTable; if false, a JCPageTable is created but no data is placed within it
Returns:

createTable

public static com.klg.jclass.page.JCPageTable createTable(com.klg.jclass.page.JCDocument doc,
                                                          TableModel tableModel,
                                                          boolean populate)
Creates a JCPageTable from a swing TableModel. The JCPageTable will have the same number of columns as the TableModel and will use the default column size.

Parameters:
doc - current JCDocument instance
tableModel - TableModel instance being converted to JCPageTable
populate - if true, the created JCPageTable is immediately populated with the contents of the TableModel; if false, a JCPageTable is created but no data is placed within it
Returns:

createTable

protected static com.klg.jclass.page.JCPageTable createTable(com.klg.jclass.page.JCDocument doc,
                                                             TableModel tableModel,
                                                             JTable jTable,
                                                             boolean populate)
Creates a JCPageTable from either a swing TableModel or a swing JTable. If the JTable is non-null, the number of columns and column widths are determined from the JTable view. If JTable is null, the number of columns are determined from the TableModel and the default column width is used.

Parameters:
doc - current JCDocument instance
tableModel - TableModel instance being converted to JCPageTable
jTable - JTable instance being converted to JCPageTable
populate - if true, the created JCPageTable is immediately populated with the contents of either the JTable or the TableModel (if the JTable is non-null, certain style elements (alignment, font) are also copied); if false, a JCPageTable is created but no data is placed within it
Returns:

populateTable

public static void populateTable(com.klg.jclass.page.JCPageTable table,
                                 JTable jTable)
Populates an empty JCPageTable from the view of the specified JTable, copying certain style elements (alignment, font).

Parameters:
table - JCPageTable instance to populate
jTable - JTable instance to populate from

populateTable

public static void populateTable(com.klg.jclass.page.JCPageTable table,
                                 JTable jTable,
                                 boolean applyJTableStyles)
Populates an empty JCPageTable from the view of the specified JTable.

Parameters:
table - JCPageTable instance to populate
jTable - JTable instance to populate from
applyJTableStyles - true if certain style elements (alignment, font) should be applied to the JCPageTable cells from the JTable cells

populateTable

public static void populateTable(com.klg.jclass.page.JCPageTable table,
                                 TableModel tableModel)
Populates an empty JCPageTable from the specified TableModel.

Parameters:
table - JCPageTable instance to populate
tableModel - TableModel instance to populate from

convertSwingToTextStyleAlignment

protected static int convertSwingToTextStyleAlignment(int alignment)
Converts the SwingConstants alignment to a JCTextStyle alignment.

Parameters:
alignment -
Returns:

getLabelComponent

protected static JLabel getLabelComponent(Component comp)
Searches for a JLabel and returns it. If no JLabel is found, null is returned.

Parameters:
comp -
Returns:

setFontAndAlignment

protected static com.klg.jclass.page.JCTextStyle setFontAndAlignment(TableCellRenderer renderer,
                                                                     com.klg.jclass.page.JCTextStyle currentStyle,
                                                                     JTable jTable,
                                                                     Object object,
                                                                     int rowIdx,
                                                                     int colIdx)
Given a renderer, the font and alignment will be set in the style.

Parameters:
colIdx -
currentStyle -
jTable -
object -
renderer -
rowIdx -
Returns:

populateTable

protected static void populateTable(com.klg.jclass.page.JCPageTable table,
                                    TableModel tableModel,
                                    JTable jTable)
Populates an empty JCPageTable from the specified TableModel or JTable. If both a JTable and TableModel are specified, the table will be populated as per the 'view' of the JTable, although data is obtained by querying the TableModel. If the JTable is non-null, certain style elements (alignment, font) will be copied to the JCPageTable. No longer used. Provided for backwards compatibility.

Parameters:
table - JCPageTable instance to populate
tableModel - TableModel instance to populate from
jTable - JTable instance to populate from

populateTable

protected static void populateTable(com.klg.jclass.page.JCPageTable table,
                                    TableModel tableModel,
                                    JTable jTable,
                                    boolean applyJTableStyles)
Populates an empty JCPageTable from the specified TableModel or JTable. If both a JTable and TableModel are specified, the table will be populated as per the 'view' of the JTable, although data is obtained by querying the TableModel. If the JTable is non-null and applyJTableStyles is true, certain style elements (alignment, font) will be copied to the JCPageTable.

Parameters:
table - JCPageTable instance to populate
tableModel - TableModel instance to populate from
jTable - JTable instance to populate from
applyJTableStyles - true if certain style elements (alignment, font) should be applied to the JCPageTable cells from the JTable cells

Copyright © 2004 Quest Software Inc..
All rights reserved.