01: package org.airtodo.headers;
02:
03: import java.awt.Component;
04:
05: import javax.swing.Icon;
06: import javax.swing.JLabel;
07: import javax.swing.table.DefaultTableCellRenderer;
08:
09: import org.air.framework.core.ColumnDecorations;
10: import org.air.framework.core.Header;
11: import org.air.framework.core.Registry;
12: import org.air.framework.core.Utils;
13: import org.air.framework.gui.table_view.table.Table;
14: import org.air.framework.properties.Icons;
15: import org.airtodo.records.Employees;
16: import org.airtodo.records.Initiators;
17:
18: public class Employee extends Header {
19: public Employee() {
20: put(Employees.NAME, new ColumnDecorations(true, 150));
21: put(Employees.ADDRESS, new ColumnDecorations(false, 80));
22: put(Employees.PHONE, new ColumnDecorations(false, 20));
23: put(Employees.EMAIL, new ColumnDecorations(false, 20));
24: put(Employees.COMMENT, new ColumnDecorations(true, 300));
25: }
26:
27: @Override
28: public Class getRecordClass() {
29: return Employees.class;
30: }
31:
32: public Component getCellRendererComponent(
33: DefaultTableCellRenderer defaultTableCellRenderer,
34: Object columnIdentifier, Object recordId, Table table,
35: Object value, boolean isSelected, int row, int column) {
36: if (columnIdentifier.equals(Utils
37: .getColumnIdentifier(Employees.NAME))) {
38: defaultTableCellRenderer
39: .setHorizontalAlignment(JLabel.LEFT);
40: Object defaultId_Employees = Registry.getDefaultId().get(
41: Employees.class);
42: Object defaultId_Authors = Registry.getDefaultId().get(
43: Initiators.class);
44: Icon icon;
45: if (defaultId_Employees != null
46: && recordId.equals(defaultId_Employees)
47: || //
48: defaultId_Authors != null
49: && recordId.equals(defaultId_Authors)) //
50: icon = Icons.CIRCLE_BLUE;
51: else
52: icon = Icons.CIRCLE_WHITE;
53: defaultTableCellRenderer.setIcon(icon);
54: }
55: return null;
56: }
57: }
|