package art.servers.rtzserver.gui;
|
|
import art.client.GUI.components.ArticPanel;
|
import art.client.GUI.components.devices.window.Abstract.Actions.AbstractPanelDeviceActions;
|
import art.client.GUI.components.devices.window.DeviceWindow;
|
import art.client.GUI.components.devices.window.colors.rtz.actions.PanelRTZ32Commands;
|
import art.client.GUI.components.devices.window.colors.rtz32.configuration.RTZ32_PanelConfiguration;
|
import art.client.GUI.components.devices.window.colors.rtz32.working.RTZ32_PanelWorkings;
|
import art.client.models.ModelGUI.Icons;
|
import art.library.gui.flat.FlatPanel;
|
import art.library.gui.flat.FlatTabbedPane;
|
import art.library.model.devices.Device;
|
import art.library.model.devices.DeviceCommands;
|
import art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller;
|
import art.library.utils.resources.Resources;
|
import art.servers.Shared;
|
import java.awt.BorderLayout;
|
import java.awt.event.ComponentAdapter;
|
import java.awt.event.ComponentEvent;
|
import javax.swing.event.ChangeEvent;
|
import javax.swing.event.ChangeListener;
|
|
public class RTZ32_Window extends DeviceWindow
|
{
|
private RTZ32_PanelConfiguration panelConfiguration = null;
|
private RTZ32_PanelWorkings panelWorkings = null;
|
private AbstractPanelDeviceActions panelActions = null;
|
|
|
/*
|
public RTZ32_Window(Device device)
|
{
|
super(device);
|
}
|
|
@Override
|
protected String getWindowIcon()
|
{
|
return Icons.SEMAPHORE_24x24;
|
}
|
|
|
@Override
|
protected void initialise()
|
{
|
this.addTab(RTZ32_PanelInformation.class, AbstractDeviceWindow.PANEL_TYPE.INFORMATION);
|
this.addTab(RTZ32_PanelStatus.class, AbstractDeviceWindow.PANEL_TYPE.STATUS);
|
this.addTab(RTZ32_PanelConfiguration.class, AbstractDeviceWindow.PANEL_TYPE.CONFIGURATION);
|
this.addTab(RTZ32_PanelCommands.class, AbstractDeviceWindow.PANEL_TYPE.ACTION);
|
}
|
*/
|
|
public RTZ32_Window(Device device, DeviceCommands commands)
|
{
|
super(device);
|
this.setIcon(Resources.getResourceURL(Icons.SEMAPHORE_24x24));
|
this.setTitle(String.format("%05d", device.information.number) + " - " + device.getDeviceInformation().getName());
|
initialise(commands);
|
|
}
|
|
|
public void reload()
|
{
|
if (panelConfiguration != null) panelConfiguration.reload();
|
if (panelWorkings != null) panelWorkings.reload();
|
if (panelActions != null) panelActions.reload();
|
}
|
|
|
public void timer()
|
{
|
super.timer();
|
if (panelConfiguration != null) panelConfiguration.timer();
|
if (panelWorkings != null) panelWorkings.timer();
|
if (panelActions != null) panelActions.timer();
|
}
|
|
|
protected void selection()
|
{
|
try
|
{
|
if (panelSelected != null) panelSelected.deselection();
|
panelSelected = (ArticPanel)flatTabbedPane.getSelectedComponent();
|
if (panelSelected != null) panelSelected.selection();
|
}
|
catch (Exception e)
|
{
|
}
|
}
|
|
|
@Override
|
public void help()
|
{
|
}
|
|
@Override
|
public void dispose()
|
{
|
super.dispose();
|
}
|
|
|
|
|
private void initialise(DeviceCommands commands)
|
{
|
RTZ32_Controller controller = (RTZ32_Controller) getDevice();
|
|
FlatPanel panel = new FlatPanel();
|
{
|
flatTabbedPane = new FlatTabbedPane();
|
{
|
panelConfiguration = new RTZ32_PanelConfiguration(controller);
|
panelWorkings = new RTZ32_PanelWorkings(controller);
|
panelActions = new AbstractPanelDeviceActions(controller, null, PanelRTZ32Commands.class);
|
|
flatTabbedPane.addTab(Shared.getMessage("Configuration"), panelConfiguration);
|
flatTabbedPane.addTab(Shared.getMessage("Working"), panelWorkings);
|
|
flatTabbedPane.allowTitleChange(false);
|
flatTabbedPane.setSelectedIndex(flatTabbedPane.getTabCount() - 1);
|
flatTabbedPane.addChangeListener(new ChangeListener()
|
{
|
public void stateChanged(ChangeEvent e)
|
{
|
selection();
|
}
|
});
|
|
}
|
}
|
|
panel.setLayout(new BorderLayout());
|
panel.add(flatTabbedPane);
|
|
this.addComponentListener(new ComponentAdapter()
|
{
|
public void componentShown(ComponentEvent event)
|
{
|
selection();
|
}
|
});
|
|
setContent(panel);
|
flatTabbedPane.setSelectedIndex(0);
|
panelConfiguration.selection();
|
}
|
|
|
|
}
|