public void uninstallUI(JComponent c) { if ((header != null) && (header.getTable() != null)) { if (header.getDefaultRenderer() instanceof BaseDefaultHeaderRenderer) { header.setDefaultRenderer(originalHeaderRenderer); } } super.uninstallUI(c); }
public void installUI(JComponent c) { super.installUI(c); if (XPStyle.getXP() != null) { originalHeaderRenderer = header.getDefaultRenderer(); if (originalHeaderRenderer instanceof UIResource) { header.setDefaultRenderer(new XPDefaultRenderer()); } } }
public void installUI(JComponent c) { super.installUI(c); if ((header != null) && header.getTable() != null) { originalHeaderRenderer = header.getDefaultRenderer(); if ((originalHeaderRenderer != null) && "sun.swing.table.DefaultTableCellHeaderRenderer" .equals(originalHeaderRenderer.getClass().getName())) { header.setDefaultRenderer(new BaseDefaultHeaderRenderer()); } } }
public void installListeners() { super.installListeners(); myMouseAdapter = new MouseAdapter() { public void mouseReleased(MouseEvent e) { if ((header == null) || (header.getTable() == null)) { return; } boolean rolloverEnabled = Boolean.TRUE.equals(header.getClientProperty("rolloverEnabled")); boolean sortingAllowed = false; if (JTattooUtilities.getJavaVersion() >= 1.6) { sortingAllowed = header.getTable().getRowSorter() != null; } if (rolloverEnabled || sortingAllowed || header.getReorderingAllowed()) { if (header.getBounds().contains(e.getPoint())) { int oldRolloverCol = rolloverCol; rolloverCol = header.getColumnModel().getColumnIndexAtX(e.getX()); updateRolloverColumn(oldRolloverCol, rolloverCol); } else { int oldRolloverCol = rolloverCol; rolloverCol = -1; updateRolloverColumn(oldRolloverCol, rolloverCol); } } } public void mouseEntered(MouseEvent e) { if ((header == null) || (header.getTable() == null)) { return; } boolean rolloverEnabled = Boolean.TRUE.equals(header.getClientProperty("rolloverEnabled")); boolean sortingAllowed = false; if (JTattooUtilities.getJavaVersion() >= 1.6) { sortingAllowed = header.getTable().getRowSorter() != null; } if (rolloverEnabled || sortingAllowed || header.getReorderingAllowed()) { int oldRolloverCol = rolloverCol; rolloverCol = header.getColumnModel().getColumnIndexAtX(e.getX()); updateRolloverColumn(oldRolloverCol, rolloverCol); } } public void mouseExited(MouseEvent e) { if ((header == null) || (header.getTable() == null)) { return; } boolean rolloverEnabled = Boolean.TRUE.equals(header.getClientProperty("rolloverEnabled")); boolean sortingAllowed = false; if (JTattooUtilities.getJavaVersion() >= 1.6) { sortingAllowed = header.getTable().getRowSorter() != null; } if (rolloverEnabled || sortingAllowed || header.getReorderingAllowed()) { int oldRolloverCol = rolloverCol; rolloverCol = -1; updateRolloverColumn(oldRolloverCol, rolloverCol); } } }; myMouseMotionAdapter = new MouseMotionAdapter() { public void mouseMoved(MouseEvent e) { if ((header == null) || (header.getTable() == null)) { return; } boolean rolloverEnabled = Boolean.TRUE.equals(header.getClientProperty("rolloverEnabled")); boolean sortingAllowed = false; if (JTattooUtilities.getJavaVersion() >= 1.6) { sortingAllowed = header.getTable().getRowSorter() != null; } if (rolloverEnabled || sortingAllowed || header.getReorderingAllowed()) { if (header.getDraggedColumn() == null) { int oldRolloverCol = rolloverCol; rolloverCol = header.getColumnModel().getColumnIndexAtX(e.getX()); updateRolloverColumn(oldRolloverCol, rolloverCol); } } } public void mouseDragged(MouseEvent e) { if ((header == null) || (header.getTable() == null)) { return; } boolean rolloverEnabled = Boolean.TRUE.equals(header.getClientProperty("rolloverEnabled")); boolean sortingAllowed = false; if (JTattooUtilities.getJavaVersion() >= 1.6) { sortingAllowed = header.getTable().getRowSorter() != null; } if (rolloverEnabled || sortingAllowed || header.getReorderingAllowed()) { if (header.getDraggedColumn() != null && header.getDraggedColumn().getIdentifier() != null) { rolloverCol = header .getColumnModel() .getColumnIndex(header.getDraggedColumn().getIdentifier()); } else if (header.getResizingColumn() != null) { rolloverCol = -1; } } } }; header.addMouseListener(myMouseAdapter); header.addMouseMotionListener(myMouseMotionAdapter); }
public void uninstallListeners() { header.removeMouseListener(myMouseAdapter); header.removeMouseMotionListener(myMouseMotionAdapter); super.uninstallListeners(); }
public void uninstallUI(JComponent c) { if (header.getDefaultRenderer() instanceof XPDefaultRenderer) { header.setDefaultRenderer(originalHeaderRenderer); } super.uninstallUI(c); }