View Javadoc

1   package com.explosion.datastream.exql.gui.table.editandrender;
2   
3   /*
4    * =============================================================================
5    * 
6    * Copyright 2004 Stephen Cowx
7    * 
8    * Licensed under the Apache License, Version 2.0 (the "License"); you may not
9    * use this file except in compliance with the License. You may obtain a copy of
10   * the License at
11   * 
12   * http://www.apache.org/licenses/LICENSE-2.0
13   * 
14   * Unless required by applicable law or agreed to in writing, software
15   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
16   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
17   * License for the specific language governing permissions and limitations under
18   * the License.
19   * 
20   * =============================================================================
21   */
22  
23  import java.awt.Color;
24  import java.awt.Graphics;
25  import java.awt.font.TextAttribute;
26  import java.util.HashMap;
27  import java.util.Map;
28  
29  import javax.swing.JTable;
30  
31  import com.explosion.datastream.exql.EXQLConstants;
32  import com.explosion.datastream.exql.EXQLModuleManager;
33  import com.explosion.expfmodules.rdbmsconn.dbom.DBEntityColumn;
34  
35  
36  /***
37   * @author Steve.Cowx
38   * Used for rendering cells in rows that are scheduled for deletion
39   */
40  public class DeletedValueCellRenderer extends DisplayValueCellRenderer {
41  
42  	public DeletedValueCellRenderer(DBEntityColumn dbColumn, JTable table) {
43  		super(dbColumn, table);
44  		this.setFont(table.getFont());
45  
46  		fore = (Color) EXQLModuleManager.instance().getPreference(
47  				EXQLConstants.TABLE_EDIT_DELETED_COLORS_FOREGROUND).getValue();
48  		back = (Color) EXQLModuleManager.instance().getPreference(
49  				EXQLConstants.TABLE_EDIT_DELETED_COLORS_BACKGROUND).getValue();
50  		Map map = new HashMap();
51  		map.put(TextAttribute.POSTURE, TextAttribute.POSTURE_OBLIQUE);
52  
53  		this.setFont(this.getFont().deriveFont(map));
54  		this.setBackground(back);
55  		this.setForeground(fore);
56  	}
57  
58  	public void paint(Graphics g) {
59  		super.paint(g);
60  		Color fore = (Color) EXQLModuleManager.instance().getPreference(
61  				EXQLConstants.TABLE_EDIT_DELETED_COLORS_FOREGROUND).getValue();
62  		g.setColor(fore);
63  		g.drawLine(0, this.getHeight() / 2, this.getWidth(),
64  				this.getHeight() / 2);
65  	}
66  }