/**
 * @(#)SortedHeaderRenderer.java
 * Copyright 2001 Nomura Research Institute, LTD. All rights reserved.
 * @author  Intelligent Technology Inc.
 * @version 1.00 2001/10/01-2002/03/26
 */
package	jp.co.nri.rid.table.editor;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.border.*;

import jp.co.nri.rid.table.*;

/**
 * Sorted Header Renderer 押下可能なテーブルカラムヘッダ。
 */
public class SortedHeaderRenderer extends JButton implements TableCellRenderer{
	protected Color		myBack;
//	protected Border	mySortedBorder;
	protected Border	myBorder;
	
	public SortedHeaderRenderer(){
//		myFore = getForeground();
		myBack = getBackground();
		setBorder(null);
//		myBorder		= new SoftBevelBorder(SoftBevelBorder.RAISED);
//		mySortedBorder	= new SoftBevelBorder(SoftBevelBorder.LOWERED);
//		setBorder(new LineBorder(getForeground()));
//		myBorder		= new LineBorder(getForeground());
//		mySortedBorder	= new LineBorder(getBackground());
	}
	
	/**
	 * TableCellRendererインターフェースの実装。
	 * @since	1.00
	 */
	public Component getTableCellRendererComponent(JTable table ,Object value ,boolean isSelected ,boolean hasFocus ,int row ,int column){
		setText(value.toString());
		int modelindex = table.getColumnModel().getColumn(column).getModelIndex();
		if(modelindex==((RTable)table).SortedModelIndex){
//			setForeground(table.getSelectionForeground());
			setBackground(table.getSelectionBackground());
//			setBorder(mySortedBorder);
		}
		else{
//			setForeground(myFore);
			setBackground(myBack);
//			setBorder(myBorder);
		}
		return this;
	}
}
