Pivot - change Fore-/Background RowHeaderTable

This is the forum for JIDE Common Layer which is open sourced at https://github.com/jidesoft/jide-oss. Please note, JIDE technical support doesn't monitor this forum as often as other forums. Please consider subscribe for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Moderator: JIDE Support

Forum rules
Community driven forum for open source JIDE Common Layer. JIDE technical support doesn't monitor this forum as often as other forums. If you only use JIDE Common Layer, please consider subscribing for technical support for JIDE Common Layer so that you can use customer only forum to get a timely response.

Pivot - change Fore-/Background RowHeaderTable

Postby wolfgang » Mon Mar 19, 2012 9:03 am

DataTable is next to RowHeaderTable. Select a cell of DataTable in row 1. The same row 1 of RowHeaderTable change Fore-/Background (for example Color.GREEN/Color.ORANGE).

Now select a cell of DataTable in row 0 and RowHeaderTable change Fore-/Background of row 0 to Color.GREEN/Color.ORANGE and row 1 of RowHeaderTable change Fore-/Background to default-Colors.

How can I change Fore-/Background of cells in each row of RowHeaderTable?
wolfgang
 
Posts: 25
Joined: Fri Dec 09, 2011 2:26 am

Re: Pivot - change Fore-/Background RowHeaderTable

Postby JIDE Support » Mon Mar 19, 2012 12:45 pm

Please give the following code a try. This is just to prove the concept. You will need do more job to improve the performance.
Code: Select all
        pivotDataModel.setCellStyleProvider(new PivotCellStyleProvider() {
            @Override
            public CellStyle getRowHeaderCellStyleAt(HeaderTableModel model, int rowIndex, int columnIndex) {
                int columnCount = _pivotTablePane.getDataTable().getColumnCount();
                for (int i = 0; i < columnCount; i++) {
                    if (_pivotTablePane.getDataTable().isCellSelected(rowIndex, i)) {
                        return HEADER_STYLE;
                    }
                }
                return null;
            }

            @Override
            public CellStyle getColumnHeaderCellStyleAt(HeaderTableModel model, int rowIndex, int columnIndex) {
                return null;
            }

            @Override
            public CellStyle getDataTableCellStyleAt(DataTableModel model, HeaderTableModel rowHeaderModel, HeaderTableModel columnHeaderModel, int rowIndex, int columnIndex) {
                return null;
            }
        });
        ((JideTable) _pivotTablePane.getDataTable()).getTableSelectionModel().addTableSelectionListener(new TableSelectionListener() {
            @Override
            public void valueChanged(TableSelectionEvent e) {
                if (!e.getValueIsAdjusting()) {
                    _pivotTablePane.getRowHeaderTable().invalidate();
                    _pivotTablePane.getRowHeaderTable().repaint();
                }
            }
        });

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36500
Joined: Sun Sep 14, 2003 10:49 am

Re: Pivot - change Fore-/Background RowHeaderTable

Postby wolfgang » Tue Mar 27, 2012 9:33 am

Thanks a lot.
wolfgang
 
Posts: 25
Joined: Fri Dec 09, 2011 2:26 am

Re: Pivot - change Fore-/Background RowHeaderTable

Postby wolfgang » Fri May 04, 2012 5:42 am

May I ask for change Fore-/Background in RowHeaderTable:

I have noticed, that
Code: Select all
            public CellStyle getRowHeaderCellStyleAt(HeaderTableModel model, int rowIndex, int columnIndex) {
                int columnCount = _pivotTablePane.getDataTable().getColumnCount();
                for (int i = 0; i < columnCount; i++) {
                    if (_pivotTablePane.getDataTable().isCellSelected(rowIndex, i)) {
                        return HEADER_STYLE;
                    }
                }
                return null;
            }

select row in RowHeaderTable. But not whole row of RowHeaderTable is colored. Because there is an aggregated cell with button [-], coloring of row ends at this cell. Left side of this cell with button [-] Fore-/Background of row in RowHeaderTable are default colors.
How can I set Fore-/Background of row in RowHeaderTable on left side of this cell with button [-], please?
wolfgang
 
Posts: 25
Joined: Fri Dec 09, 2011 2:26 am

Re: Pivot - change Fore-/Background RowHeaderTable

Postby JIDE Support » Fri May 04, 2012 9:01 am

May I ask how is your evaluating process going?

You could try to override HeaderTable#createCellRenderer() to have your customized cell renderer to paint whatever you want for those collapsible cells.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36500
Joined: Sun Sep 14, 2003 10:49 am

Re: Pivot - change Fore-/Background RowHeaderTable

Postby wolfgang » Mon May 07, 2012 12:28 am

DataTable is in own ScrollPane for horizontal scrolling. So selected cells of DataTable can be hidden and disappear. RowHeaderTable on left side is fixed and user should reconstruct which row is selected. So the code above works, but it would be fine, selection of rows of RowHeaderTable would use whole width of RowHeaderTable.

Thanks.
Attachments
test.png
Picture show RowHeaderTable and selected DataTable
test.png (5.93 KiB) Viewed 7816 times
wolfgang
 
Posts: 25
Joined: Fri Dec 09, 2011 2:26 am

Re: Pivot - change Fore-/Background RowHeaderTable

Postby JIDE Support » Mon May 07, 2012 8:45 am

You could invoke HeaderTableModel#getCellSpanAt() first to get the spanned rows for a cell in the row header table. Please then check all the rows in the DataTable to determine if the cell in the row header table should be selected.

Thanks,
JIDE Software Technical Support Team
JIDE Support
Site Admin
 
Posts: 36500
Joined: Sun Sep 14, 2003 10:49 am


Return to JIDE Common Layer Open Source Project Discussion (Community Driven)

Who is online

Users browsing this forum: No registered users and 5 guests

cron