From b44d933df4b1a536fa2a1cf93ce3ae93f8dd4069 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Thu, 8 Feb 2007 06:39:29 +0000 Subject: [PATCH] * [ 1619919 ] Add Sort Indicator for Table --- .../org/compiere/grid/ed/VHeaderRenderer.java | 16 ++++++++++++++++ client/src/org/compiere/images/downarrow.gif | Bin 0 -> 51 bytes client/src/org/compiere/images/uparrow.gif | Bin 0 -> 52 bytes 3 files changed, 16 insertions(+) create mode 100644 client/src/org/compiere/images/downarrow.gif create mode 100644 client/src/org/compiere/images/uparrow.gif diff --git a/client/src/org/compiere/grid/ed/VHeaderRenderer.java b/client/src/org/compiere/grid/ed/VHeaderRenderer.java index 37fa918c2e..9ef1b06065 100644 --- a/client/src/org/compiere/grid/ed/VHeaderRenderer.java +++ b/client/src/org/compiere/grid/ed/VHeaderRenderer.java @@ -74,6 +74,18 @@ public final class VHeaderRenderer implements TableCellRenderer // Log.trace(this,10, "VHeaderRenderer.getTableCellRendererComponent", value==null ? "null" : value.toString()); // 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(); Component headerComponent = headerRenderer == null ? null : headerRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); @@ -85,6 +97,8 @@ public final class VHeaderRenderer implements TableCellRenderer label.setPreferredSize(new Dimension(0,0)); else label.setText(value.toString()); + label.setIcon(icon); + label.setHorizontalTextPosition(SwingConstants.LEADING); return label; } m_button.setBorder(((JComponent)headerComponent).getBorder()); @@ -98,6 +112,8 @@ public final class VHeaderRenderer implements TableCellRenderer return m_button; } m_button.setText(value.toString()); + m_button.setIcon(icon); + m_button.setHorizontalTextPosition(SwingConstants.LEADING); return m_button; } // getTableCellRendererComponent diff --git a/client/src/org/compiere/images/downarrow.gif b/client/src/org/compiere/images/downarrow.gif new file mode 100644 index 0000000000000000000000000000000000000000..206d7c19dd524614e18f807aef483c5ca6aab515 GIT binary patch literal 51 wcmZ?wbhEHbjEB<5wG8q|kKzxu40~2=-^YQ~-cX;OHA7Wy#1^_3P B3=RMQ literal 0 HcmV?d00001