Alejandro Acuña
2025-04-29 d1d736e487d9eb104dcae9def948066037afd2f0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
package art.client.GUI.components.devices.window.colors.rtz32.tables.trolley;
 
import art.client.GUI.components.devices.window.colors.rtz32.tables.Table;
import art.library.gui.FlatGUI;
import art.library.gui.flat.FlatPanel;
import art.library.gui.flat.FlatSplitPane;
import art.library.gui.flat.FlatTitle;
import art.library.gui.flat.table.FlatTable;
import art.library.gui.flat.table.Model.TableDataColumn;
import art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerConfiguration;
import art.servers.Shared;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import javax.swing.JSplitPane;
import javax.swing.ListSelectionModel;
import javax.swing.SwingConstants;
 
public class Table80 extends Table
{
    public Table80(RTZ32_ControllerConfiguration configuration)
    {
        super(configuration, "table80.html");
        initialise();
        reload(configuration);
    }
    
    
    public void reload(RTZ32_ControllerConfiguration configuration)
    {
        super.reload(configuration);
    
        try
        {
 
            TableData[] data = new TableData[configuration.rtz32.programs.length];
            
            for (int i=0; i<configuration.rtz32.programs.length; i++)
            {
                data[i] = new TableData();
                data[i].program = i + 1;
                data[i].correlation1 = configuration.rtz32.programs[i].trolley.correlationsMaster[0].time;
                data[i].correlation2 = configuration.rtz32.programs[i].trolley.correlationsMaster[1].time;
                data[i].correlation3 = configuration.rtz32.programs[i].trolley.correlationsMaster[2].time;
                data[i].correlation4 = configuration.rtz32.programs[i].trolley.correlationsMaster[3].time;
                data[i].timeout1 = configuration.rtz32.programs[i].trolley.correlationsSlave[0].time;
                data[i].timeout2 = configuration.rtz32.programs[i].trolley.correlationsSlave[1].time;
                data[i].timeout3 = configuration.rtz32.programs[i].trolley.correlationsSlave[2].time;
                data[i].timeout4 = configuration.rtz32.programs[i].trolley.correlationsSlave[3].time;
            }
            
            table.tableData.setData(data);
 
        }
        catch (Exception exception)
        {
            table.tableData.clearData();
        }
    }
 
 
    private void initialise()
    {
        FlatPanel panel1 = new FlatPanel();
        {
            table = new FlatTable("table");
            {
                table.tableData.addTableColumn(TableDataColumn.newTableDataColumnNumeric(Shared.getMessage("Program"), "program", 0.12f, false, true, SwingConstants.CENTER));
                
                for (int i=0; i<4; i++)
                {
                    table.tableData.addTableColumn(newTableDataColumn(Shared.getMessage("Correlation") + " " + (i+1), "correlation" + (i+1), 0.11f, true, true, SwingConstants.CENTER, 0, 255));
                }
                
                for (int i=0; i<4; i++)
                {
                    table.tableData.addTableColumn(newTableDataColumn(Shared.getMessage("Timeout") + " " + (i+1), "timeout" + (i+1), 0.11f, true, true, SwingConstants.CENTER, 0, 255));
                }
 
                table.initialise();
                table.getLook().colorBackground = FlatGUI.lookDesign.getColor("panel.color.background");
                table.revalidate();
                table.tableData.properties.sortNameColumn = Shared.getMessage("Program");
                table.tableData.properties.sortAscendent = true;
                table.table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
                table.allowEditing(false);        
                table.setEditable(false);
 
                MyTableCellRenderHeader myTableCellRender1 = new MyTableCellRenderHeader(table, new Insets(0, 0, 1, 1));
                MyTableCellRenderValue myTableCellRender2 = new MyTableCellRenderValue(table, new Insets(0, 0, 1, 1));
                table.setFlatCellRender(Shared.getMessage("Program"), myTableCellRender1);
                
                for (int i=0; i<4; i++)
                {
                    table.setFlatCellRender(Shared.getMessage("Correlation") + " " + (i+1), myTableCellRender2);
                    table.setFlatCellRender(Shared.getMessage("Timeout") + " " + (i+1), myTableCellRender2);
                }
            }
            
            panel1.setLayout(new BorderLayout());
            panel1.add(table, BorderLayout.CENTER);
        }
        
        
        FlatSplitPane flatSplitPane1 = new FlatSplitPane();
        {
            panel1.setMinimumSize(new Dimension(0, 0));
            panel1.setPreferredSize(new Dimension(900,0));
            scrollpane.setMinimumSize(new Dimension(0, 0));
            scrollpane.setPreferredSize(new Dimension(0,0));
 
            flatSplitPane1.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
            flatSplitPane1.setOneTouchExpandable();
            flatSplitPane1.changeDividerSize(16);
            flatSplitPane1.setLeftComponent(panel1);
            flatSplitPane1.setRightComponent(scrollpane);
            
            flatSplitPane1.addComponentListener(new ComponentAdapter() 
            {
                public void componentResized(ComponentEvent e) 
                {
                    FlatSplitPane flatSplitPane1 = (FlatSplitPane)e.getSource();
                    flatSplitPane1.setDividerLocation(900);
                }       
            });   
                            
        }
        
        this.setLayout(new BorderLayout());
        this.add(new FlatTitle(Shared.getMessage("Correlations"), 32), BorderLayout.NORTH);
        this.add(flatSplitPane1, BorderLayout.CENTER);
        
    }
    
  
    
    private class TableData 
    {
        public int program;
        
        public int correlation1;
        public int correlation2;
        public int correlation3;
        public int correlation4;
 
        public int timeout1;
        public int timeout2;
        public int timeout3;
        public int timeout4;
    }  
 
    
}