package javax.swing.plaf.synth;
import java.awt.*;
import java.beans.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import javax.swing.table.*;
import sun.swing.DefaultLookup;
import sun.swing.plaf.synth.*;
import sun.swing.table.*;
class extends BasicTableHeaderUI implements
PropertyChangeListener, SynthUI {
private TableCellRenderer = null;
private SynthStyle ;
public static ComponentUI (JComponent h) {
return new SynthTableHeaderUI();
}
protected void () {
prevRenderer = header.getDefaultRenderer();
if (prevRenderer instanceof UIResource) {
header.setDefaultRenderer(new HeaderRenderer());
}
updateStyle(header);
}
private void (JTableHeader c) {
SynthContext context = getContext(c, ENABLED);
SynthStyle oldStyle = style;
style = SynthLookAndFeel.updateStyle(context, this);
if (style != oldStyle) {
if (oldStyle != null) {
uninstallKeyboardActions();
installKeyboardActions();
}
}
context.dispose();
}
protected void () {
super.installListeners();
header.addPropertyChangeListener(this);
}
protected void () {
if (header.getDefaultRenderer() instanceof HeaderRenderer) {
header.setDefaultRenderer(prevRenderer);
}
SynthContext context = getContext(header, ENABLED);
style.uninstallDefaults(context);
context.dispose();
style = null;
}
protected void () {
header.removePropertyChangeListener(this);
super.uninstallListeners();
}
public void (Graphics g, JComponent c) {
SynthContext context = getContext(c);
SynthLookAndFeel.update(context, g);
context.getPainter().paintTableHeaderBackground(context,
g, 0, 0, c.getWidth(), c.getHeight());
paint(context, g);
context.dispose();
}
public void (Graphics g, JComponent c) {
SynthContext context = getContext(c);
paint(context, g);
context.dispose();
}
protected void (SynthContext context, Graphics g) {
super.paint(g, context.getComponent());
}
public void (SynthContext context, Graphics g, int x,
int y, int w, int h) {
context.getPainter().paintTableHeaderBorder(context, g, x, y, w, h);
}
public SynthContext (JComponent c) {
return getContext(c, getComponentState(c));
}
private SynthContext (JComponent c, int state) {
return SynthContext.getContext(SynthContext.class, c,
SynthLookAndFeel.getRegion(c), style, state);
}
private Region (JComponent c) {
return SynthLookAndFeel.getRegion(c);
}
private int (JComponent c) {
return SynthLookAndFeel.getComponentState(c);
}
public void (PropertyChangeEvent evt) {
if (SynthLookAndFeel.shouldUpdateStyle(evt)) {
updateStyle((JTableHeader)evt.getSource());
}
}
@Override
protected void rolloverColumnUpdated(int oldColumn, int newColumn) {
header.repaint(header.getHeaderRect(oldColumn));
header.repaint(header.getHeaderRect(newColumn));
}
private class extends DefaultTableCellHeaderRenderer {
() {
setHorizontalAlignment(JLabel.LEADING);
setName("TableHeader.renderer");
}
@Override
public Component (JTable table, Object value,
boolean isSelected,
boolean hasFocus,
int row, int column) {
boolean hasRollover = (column == getRolloverColumn());
if (isSelected || hasRollover || hasFocus) {
SynthLookAndFeel.setSelectedUI((SynthLabelUI)SynthLookAndFeel.
getUIOfType(getUI(), SynthLabelUI.class),
isSelected, hasFocus, table.isEnabled(),
hasRollover);
} else {
SynthLookAndFeel.resetSelectedUI();
}
RowSorter rs = table == null ? null : table.getRowSorter();
java.util.List<? extends RowSorter.SortKey> sortKeys = rs == null ? null : rs.getSortKeys();
if (sortKeys != null && sortKeys.size() > 0 && sortKeys.get(0).getColumn() ==
table.convertColumnIndexToModel(column)) {
switch(sortKeys.get(0).getSortOrder()) {
case ASCENDING:
putClientProperty("Table.sortOrder", "ASCENDING");
break;
case DESCENDING:
putClientProperty("Table.sortOrder", "DESCENDING");
break;
case UNSORTED:
putClientProperty("Table.sortOrder", "UNSORTED");
break;
default:
throw new AssertionError("Cannot happen");
}
} else {
putClientProperty("Table.sortOrder", "UNSORTED");
}
super.getTableCellRendererComponent(table, value, isSelected,
hasFocus, row, column);
return this;
}
@Override
public void (Border border) {
if (border instanceof SynthBorder) {
super.setBorder(border);
}
}
}
}