* [ 1619919 ] Add Sort Indicator for Table
This commit is contained in:
parent
476b8db71b
commit
b44d933df4
|
@ -74,6 +74,18 @@ public final class VHeaderRenderer implements TableCellRenderer
|
||||||
// Log.trace(this,10, "VHeaderRenderer.getTableCellRendererComponent", value==null ? "null" : value.toString());
|
// Log.trace(this,10, "VHeaderRenderer.getTableCellRendererComponent", value==null ? "null" : value.toString());
|
||||||
// indicator for invisible column
|
// indicator for invisible column
|
||||||
|
|
||||||
|
Icon icon = null;
|
||||||
|
if (table instanceof CTable)
|
||||||
|
{
|
||||||
|
CTable cTable = (CTable)table;
|
||||||
|
if (cTable.getSortColumn() == column)
|
||||||
|
{
|
||||||
|
icon = cTable.isSortAscending()
|
||||||
|
? Env.getImageIcon2("uparrow")
|
||||||
|
: Env.getImageIcon2("downarrow");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TableCellRenderer headerRenderer = table.getTableHeader().getDefaultRenderer();
|
TableCellRenderer headerRenderer = table.getTableHeader().getDefaultRenderer();
|
||||||
Component headerComponent = headerRenderer == null ? null :
|
Component headerComponent = headerRenderer == null ? null :
|
||||||
headerRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
headerRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
|
||||||
|
@ -85,6 +97,8 @@ public final class VHeaderRenderer implements TableCellRenderer
|
||||||
label.setPreferredSize(new Dimension(0,0));
|
label.setPreferredSize(new Dimension(0,0));
|
||||||
else
|
else
|
||||||
label.setText(value.toString());
|
label.setText(value.toString());
|
||||||
|
label.setIcon(icon);
|
||||||
|
label.setHorizontalTextPosition(SwingConstants.LEADING);
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
m_button.setBorder(((JComponent)headerComponent).getBorder());
|
m_button.setBorder(((JComponent)headerComponent).getBorder());
|
||||||
|
@ -98,6 +112,8 @@ public final class VHeaderRenderer implements TableCellRenderer
|
||||||
return m_button;
|
return m_button;
|
||||||
}
|
}
|
||||||
m_button.setText(value.toString());
|
m_button.setText(value.toString());
|
||||||
|
m_button.setIcon(icon);
|
||||||
|
m_button.setHorizontalTextPosition(SwingConstants.LEADING);
|
||||||
return m_button;
|
return m_button;
|
||||||
} // getTableCellRendererComponent
|
} // getTableCellRendererComponent
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 51 B |
Binary file not shown.
After Width: | Height: | Size: 52 B |
Loading…
Reference in New Issue