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;
|
}
|
|
|
}
|