swing/src/net/sf/xframe/swing JXTable.java,1.12,1.13
Kurt Riede <[email protected]> Sat, 09 Apr 2005 12:48:15 +0000
| Newsgroups | gmane.text.xml.xframe.xsddoc.devel |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/xframe/swing/src/net/sf/xframe/swing
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5698/src/net/sf/xframe/swing
Modified Files:
JXTable.java
Log Message:
fix for bug [1178013] Wrong isCellEditable concept
support for cell renderers thru new class DefaultJXTableCellRenderer
Index: JXTable.java
===================================================================
RCS file: /cvsroot/xframe/swing/src/net/sf/xframe/swing/JXTable.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** JXTable.java 7 Apr 2005 17:30:04 -0000 1.12
--- JXTable.java 9 Apr 2005 12:48:13 -0000 1.13
***************
*** 126,133 ****
/** the table with the locked columns. */
! private final JTable lockedTable;
/** The table with the scrollable columns. */
! private final JTable scrollTable;
/** Scroll pane adjuster. */
--- 126,133 ----
/** the table with the locked columns. */
! private final KTable lockedTable;
/** The table with the scrollable columns. */
! private final KTable scrollTable;
/** Scroll pane adjuster. */
***************
*** 269,274 ****
}
// create the two tables
! lockedTable = new KTable(model, cm1, sm);
! scrollTable = new KTable(model, cm2, sm);
lockedHeader = new ColumnGroupHeader(lockedTable.getColumnModel());
scrollHeader = new ColumnGroupHeader(scrollTable.getColumnModel());
--- 269,274 ----
}
// create the two tables
! lockedTable = new KTable(model, cm1, sm, KTable.TYPE_LOCKED);
! scrollTable = new KTable(model, cm2, sm, KTable.TYPE_SCROLL);
lockedHeader = new ColumnGroupHeader(lockedTable.getColumnModel());
scrollHeader = new ColumnGroupHeader(scrollTable.getColumnModel());
***************
*** 901,918 ****
}
}
/**
* Returns true if the cell at <code>row</code> and <code>column</code>
! * is editable. Otherwise, invoking <code>setValueAt</code> on the cell
* will have no effect.
* <p>
! * <b>Note</b>: The column is specified in the table view's display
! * order, and not in the <code>TableModel</code>'s column
! * order. This is an important distinction because as the
! * user rearranges the columns in the table,
! * the column at a given index in the view will change.
! * Meanwhile the user's actions never affect the model's
! * column ordering.
! *
! *
* @param row the row whose value is to be queried
* @param column the column whose value is to be queried
--- 901,915 ----
}
}
+
/**
* Returns true if the cell at <code>row</code> and <code>column</code>
! * is editable. Otherwise, invoking <code>setValueAt</code> on the cell
* will have no effect.
* <p>
! * <b>Note</b>: The column is specified in the table view's display order,
! * and not in the <code>TableModel</code>'s column order. This is an
! * important distinction because as the user rearranges the columns in the
! * table, the column at a given index in the view will change. Meanwhile the
! * user's actions never affect the model's column ordering.
* @param row the row whose value is to be queried
* @param column the column whose value is to be queried
***************
*** 921,929 ****
*/
public boolean isCellEditable(final int row, final int column) {
! if (column < frozenColumns) {
! return lockedTable.isCellEditable(row, column);
! } else {
! return scrollTable.isCellEditable(row, column - frozenColumns);
! }
}
--- 918,922 ----
*/
public boolean isCellEditable(final int row, final int column) {
! return getModel().isCellEditable(row, convertColumnIndexToModel(column));
}
***************
*** 1573,1593 ****
* where 0 is the first column
* @return the <code>Component</code> under the event location
*/
public Component prepareRenderer(final TableCellRenderer renderer, final int row, final int column) {
if (column < frozenColumns) {
! return lockedTable.prepareRenderer(renderer, row, column);
} else {
! return scrollTable.prepareRenderer(renderer, row, column - frozenColumns);
}
}
/**
! * Removes <code>aColumn</code> from this <code>JTable</code>'s
! * array of columns. Note: this method does not remove the column
! * of data from the model; it just removes the <code>TableColumn</code>
! * that was responsible for displaying it.
! *
! * @param aColumn the <code>TableColumn</code> to be removed
! * @see #addColumn
*/
public void removeColumn(final TableColumn aColumn) {
--- 1566,1586 ----
* where 0 is the first column
* @return the <code>Component</code> under the event location
+ * TODO handle the renderer correctly across the KTables
*/
public Component prepareRenderer(final TableCellRenderer renderer, final int row, final int column) {
if (column < frozenColumns) {
! return lockedTable.prepareRendererSuper(renderer, row, column);
} else {
! return scrollTable.prepareRendererSuper(renderer, row, column - frozenColumns);
}
}
/**
! * Removes <code>aColumn</code> from this <code>JTable</code>'s array
! * of columns. Note: this method does not remove the column of data from the
! * model; it just removes the <code>TableColumn</code> that was
! * responsible for displaying it.
! * @param aColumn the <code>TableColumn</code> to be removed
! * @see #addColumn
*/
public void removeColumn(final TableColumn aColumn) {
***************
*** 2708,2712 ****
return adjuster;
}
!
/**
* Sets the <code>transferHandler</code> property,
--- 2701,2705 ----
return adjuster;
}
!
/**
* Sets the <code>transferHandler</code> property,
***************
*** 2715,2723 ****
* <p>
* If <code>newHandler</code> is not null, and the system property
! * <code>suppressSwingDropSupport</code> is not true, this will
* install a <code>DropTarget</code> on the <code>JComponent</code>.
* The default for the system property is false, so that a
* <code>DropTarget</code> will be added.
! *
* @param newHandler mechanism for transfer of data to
* and from the component
--- 2708,2716 ----
* <p>
* If <code>newHandler</code> is not null, and the system property
! * <code>suppressSwingDropSupport</code> is not true, this will
* install a <code>DropTarget</code> on the <code>JComponent</code>.
* The default for the system property is false, so that a
* <code>DropTarget</code> will be added.
! *
* @param newHandler mechanism for transfer of data to
* and from the component
***************
*** 2726,2731 ****
* @see javax.swing.JComponent#setTransferHandler(javax.swing.TransferHandler)
*/
! public void setTransferHandler(TransferHandler newHandler)
! {
//The KTables are the ones that need the handler
getLockedTable().setTransferHandler(newHandler);
--- 2719,2723 ----
* @see javax.swing.JComponent#setTransferHandler(javax.swing.TransferHandler)
*/
! public void setTransferHandler(final TransferHandler newHandler) {
//The KTables are the ones that need the handler
getLockedTable().setTransferHandler(newHandler);
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click