01: /*
02: * ProcStatusRenderer.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.renderer;
13:
14: import java.awt.Component;
15: import javax.swing.JLabel;
16: import javax.swing.JTable;
17: import javax.swing.table.DefaultTableCellRenderer;
18: import workbench.db.JdbcProcedureReader;
19:
20: /**
21: *
22: * @author support@sql-workbench.net
23: */
24: public class ProcStatusRenderer extends DefaultTableCellRenderer
25: implements WbRenderer {
26: public ProcStatusRenderer() {
27: this .setHorizontalAlignment(JLabel.LEFT);
28: }
29:
30: public Component getTableCellRendererComponent(JTable table,
31: Object value, boolean isSelected, boolean hasFocus,
32: int row, int column) {
33: try {
34: Integer status = (Integer) value;
35: String display = JdbcProcedureReader.convertProcType(status
36: .intValue());
37: return super .getTableCellRendererComponent(table, display,
38: isSelected, hasFocus, row, column);
39: } catch (Exception e) {
40: return super .getTableCellRendererComponent(table, value,
41: isSelected, hasFocus, row, column);
42: }
43:
44: }
45:
46: public void setUseAlternatingColors(boolean flag) {
47: // not implemented
48: }
49:
50: public String getDisplayValue() {
51: return getText();
52: }
53:
54: }
|