/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* Provides the Synth L&F UI delegate for
* {@link javax.swing.JTable}.
*
* @author Philip Milne
* @since 1.7
*/
implements SynthUI, PropertyChangeListener {
//
// Instance Variables
//
private boolean useTableColors;
private boolean useUIBorder;
// TableCellRenderer installed on the JTable at the time we're installed,
// cached so that we can reinstall them at uninstallUI time.
//
// The installation/uninstall procedures and support
//
/**
* Creates a new UI object for the given component.
*
* @param c component to create UI object for
* @return the UI object
*/
return new SynthTableUI();
}
/**
* Initializes JTable properties, such as font, foreground, and background.
* The font, foreground, and background properties are only set if their
* current value is either null or a UIResource, other properties are set
* if the current value is null.
*
* @see #installUI
*/
protected void installDefaults() {
new SynthBooleanTableCellRenderer());
new SynthTableCellRenderer());
}
if (currentRenderer instanceof UIResource) {
}
return currentRenderer;
}
}
}
}
}
"Table.rendererUseTableColors", true);
"Table.rendererUseUIBorder", true);
}
if (!showGrid) {
table.setShowGrid(false);
}
// if (d == null || d instanceof UIResource) {
if (d != null) {
}
if (d != null) {
}
}
}
}
/**
* Attaches listeners to the JTable.
*/
protected void installListeners() {
super.installListeners();
table.addPropertyChangeListener(this);
}
/**
* @inheritDoc
*/
protected void uninstallDefaults() {
}
}
/**
* @inheritDoc
*/
protected void uninstallListeners() {
super.uninstallListeners();
}
//
// SynthUI
//
/**
* @inheritDoc
*/
}
}
//
// Paint methods and support
//
/**
* Notifies this UI delegate to repaint the specified component.
* This method paints the component background, then calls
* the {@link #paint(SynthContext,Graphics)} method.
*
* <p>In general, this method does not need to be overridden by subclasses.
* All Look and Feel rendering code should reside in the {@code paint} method.
*
* @param g the {@code Graphics} object used for painting
* @param c the component being painted
* @see #paint(SynthContext,Graphics)
*/
}
/**
* @inheritDoc
*/
int y, int w, int h) {
}
/**
* Paints the specified component according to the Look and Feel.
* <p>This method is not used by Synth Look and Feel.
* Painting is handled by the {@link #paint(SynthContext,Graphics)} method.
*
* @param g the {@code Graphics} object used for painting
* @param c the component being painted
* @see #paint(SynthContext,Graphics)
*/
}
/**
* Paints the specified component.
*
* @param context context for the component being painted
* @param g the {@code Graphics} object used for painting
* @see #update(Graphics,JComponent)
*/
// account for the fact that the graphics has already been translated
// into the table's bounds
// this check prevents us from painting the entire table
// when the clip doesn't intersect our bounds at all
paintDropLines(context, g);
return;
}
// This should never happen (as long as our bounds intersect the clip,
// which is why we bail above if that is the case).
if (rMin == -1) {
rMin = 0;
}
// If the table does not have enough rows to fill the view we'll get -1.
// (We could also get -1 if our bounds don't intersect the clip,
// which is why we bail above if that is the case).
// Replace this with the index of the last row.
if (rMax == -1) {
}
// This should never happen.
if (cMin == -1) {
cMin = 0;
}
// If the table does not have enough columns to fill the view we'll get -1.
// Replace this with the index of the last column.
if (cMax == -1) {
}
// Paint the cells.
// Paint the grid.
// it is important to paint the grid after the cells, otherwise the grid will be overpainted
// because in Synth cell renderers are likely to be opaque
paintDropLines(context, g);
}
return;
}
return;
}
int x = rect.x;
extendRect(rect, true);
}
g.setColor(shortColor);
}
}
int y = rect.y;
extendRect(rect, false);
}
g.setColor(shortColor);
}
}
}
if (!loc.isInsertRow()) {
return null;
}
col--;
}
row--;
}
if (rect.y == 0) {
rect.y = -1;
} else {
rect.y -= 2;
}
return rect;
}
if (!loc.isInsertColumn()) {
return null;
}
col--;
if (ltr) {
}
} else if (!ltr) {
}
if (rect.x == 0) {
rect.x = -1;
} else {
rect.x -= 2;
}
return rect;
}
return rect;
}
if (horizontal) {
rect.x = 0;
} else {
rect.y = 0;
} else {
}
}
return rect;
}
/*
* Paints the grid lines within <I>aRect</I>, using the grid
* color set with <I>setGridColor</I>. Paints vertical lines
* if <code>getShowVerticalLines()</code> returns true and paints
* horizontal lines if <code>getShowHorizontalLines()</code>
* returns true.
*/
context);
if (table.getShowHorizontalLines()) {
int y = damagedArea.y;
}
}
if (table.getShowVerticalLines()) {
int x;
x = damagedArea.x;
x += w;
}
} else {
x = damagedArea.x;
x += w;
tableHeight - 1);
}
}
}
}
return column;
}
}
return -1;
}
int columnWidth;
if (aColumn != draggedColumn) {
}
cellRect.x += columnWidth;
}
}
} else {
if (aColumn != draggedColumn) {
}
cellRect.x -= columnWidth;
if (aColumn != draggedColumn) {
}
}
}
}
// Paint the dragged column if we are dragging.
if (draggedColumn != null) {
}
// Remove any renderers that may be left in the rendererPane.
}
private void paintDraggedArea(SynthContext context, Graphics g, int rMin, int rMax, TableColumn draggedColumn, int distance) {
// Paint a gray well in place of the moving column.
// Move to the where the cell has been dragged.
vacatedColumnRect.x += distance;
// Fill the background.
context);
// Paint the vertical grid lines if necessary.
if (table.getShowVerticalLines()) {
int x1 = vacatedColumnRect.x;
int y1 = vacatedColumnRect.y;
// Left
// Right
}
// Render the cell value
r.x += distance;
// Paint the (lower) horizontal grid line if necessary.
if (table.getShowHorizontalLines()) {
}
}
}
}
else {
if ((b == null || b instanceof UIResource
|| component instanceof SynthBooleanTableCellRenderer)
}
}
}
}
/**
* @inheritDoc
*/
}
}
private boolean isRowSelected;
public SynthBooleanTableCellRenderer() {
setName("Table.cellRenderer");
}
if (isSelected) {
} else {
}
return this;
}
if (c instanceof UIResource) {
}
return c;
}
public boolean isOpaque() {
return isRowSelected ? true : super.isOpaque();
}
}
private boolean opaque;
}
public boolean isOpaque() {
return opaque;
}
return "Table.cellRenderer";
}
return name;
}
if (useUIBorder || b instanceof SynthBorder) {
super.setBorder(b);
}
}
}
else {
}
}
return this;
}
if (numberFormat == null) {
}
}
else if (columnClass == Number.class) {
// Super will have set value.
}
setText("");
}
else if (columnClass == Date.class) {
if (dateFormat == null) {
}
}
else {
}
}
super.paint(g);
}
}
}