package Rtz;
|
|
|
import art.library.model.devices.DeviceGraphicsRuntime;
|
import com.kitfox.svg.SVGDiagram;
|
import com.kitfox.svg.SVGElement;
|
|
public class RtzMapMiddle extends DeviceGraphicsRuntime
|
{
|
|
public RtzMapMiddle(art.library.model.devices.Device device, SVGDiagram diagram)
|
{
|
super(device, diagram);
|
}
|
|
public RtzMapMiddle(art.library.model.devices.Device device, art.library.model.devices.DeviceCommands commands, SVGDiagram diagram)
|
{
|
super(device, commands, diagram);
|
}
|
|
public void status()
|
{
|
try
|
{
|
statusSubcontroller();
|
} catch (Exception e)
|
{
|
}
|
}
|
|
public void statusSubcontroller()
|
{
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller controller = (art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller) getDevice();
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerStatus controllerStatus = (art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerStatus) controller.getDeviceStatus();
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation controllerInformation = (art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation) controller.getDeviceInformation();
|
art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status subcontrollerStatus = controllerStatus.rtz32;
|
|
SVGElement background = getElement("Background");
|
SVGElement border = getElement("Border");
|
SVGElement icon = getElement("Icon container");
|
|
setText("Text number", String.format("%05d", controllerInformation.number));
|
|
setAttribute(border, "stroke", "#800080",999);
|
setAttribute(border, "display", "inline",999);
|
setAttribute(background, "fill", "#FF80FF",999);
|
|
switch (controllerStatus.status)
|
{
|
case art.library.model.devices.DeviceStatus.STATUS_ONLINE:
|
break;
|
case art.library.model.devices.DeviceStatus.STATUS_WARNING:
|
break;
|
case art.library.model.devices.DeviceStatus.STATUS_ALARM:
|
break;
|
case art.library.model.devices.DeviceStatus.STATUS_DISABLE:
|
setAttribute(background, "fill", "#404040",999);
|
setAttribute(border, "stroke", "#808080",999);
|
setAttribute(border, "display", "inline",999);
|
return;
|
case art.library.model.devices.DeviceStatus.STATUS_SIMULATION:
|
setAttribute(background, "fill", "#0000FF",999);
|
setAttribute(icon, "fill", "#000080",999);
|
setAttribute(border, "stroke", "#000080",999);
|
setAttribute(border, "display", "inline",999);
|
break;
|
case art.library.model.devices.DeviceStatus.STATUS_INVALID:
|
case art.library.model.devices.DeviceStatus.STATUS_OFFLINE:
|
case art.library.model.devices.DeviceStatus.STATUS_UNKNOWN:
|
setAttribute(background, "fill", "#FF00FF",999);
|
setAttribute(icon, "fill", "#7C007C",999);
|
setAttribute(border, "stroke", "#7C007C",999);
|
setAttribute(border, "display", "inline",999);
|
return;
|
}
|
|
|
switch (subcontrollerStatus.general.state)
|
{
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.STATE_UNKNOWN:
|
setAttribute(background, "fill", "#808080",999);
|
setAttribute(icon, "fill", "#808080",999);
|
setAttribute(border, "stroke", "#808080",999);
|
return;
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.STATE_FLASHING:
|
java.util.Calendar calendardate = java.util.Calendar.getInstance();
|
calendardate.set(java.util.Calendar.MILLISECOND, 0);
|
long seconds = calendardate.getTimeInMillis() / 1000;
|
if ((seconds % 2) == 0)
|
{
|
setAttribute(background, "fill", "#FFFF00",999);
|
setAttribute(icon, "fill", "#7C7C00",999);
|
setAttribute(border, "stroke", "#7C7C00",999);
|
} else
|
{
|
setAttribute(background, "fill", "#808000",999);
|
setAttribute(icon, "fill", "#808000",999);
|
setAttribute(border, "stroke", "#808000",999);
|
}
|
break;
|
case art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.STATE_COLORS:
|
if (subcontrollerStatus.general.emergency == true)
|
{
|
setAttribute(background, "fill", "#FF8000",999);
|
setAttribute(icon, "fill", "#FF8000",999);
|
setAttribute(border, "stroke", "#7C8000",999);
|
}
|
else if (subcontrollerStatus.general.control == art.library.model.devices.colors.controller.RTZ32.status.RTZ32_Status_General.CONTROL_LOCAL)
|
{
|
setAttribute(background, "fill", "#008000",999);
|
setAttribute(icon, "fill", "#008000",999);
|
setAttribute(border, "stroke", "#007C00",999);
|
} else
|
{
|
setAttribute(background, "fill", "#00FF00", 999);
|
setAttribute(icon, "fill", "#007C00", 999);
|
setAttribute(border, "stroke", "#007C00", 999);
|
}
|
break;
|
}
|
|
if (controller.getDeviceAlarms().getServerityAlarm() > 0)
|
{
|
setAttribute(border, "display", "inline", 999);
|
setAttribute(border, "stroke", "#FF0000", 999);
|
}
|
}
|
public void paintNoStatusAvailable()
|
{
|
art.library.model.devices.colors.controller.M.M_Controller controller = (art.library.model.devices.colors.controller.M.M_Controller) getDevice();
|
SVGElement thunderbolt = getElement("Thunderbolt");
|
SVGElement emergency = getElement("Emergency");
|
SVGElement lock = getElement("Lock");
|
SVGElement calendar = getElement("Calendar");
|
SVGElement run = getElement("Run");
|
SVGElement remote = getElement("Remote");
|
SVGElement background = getElement("Background");
|
SVGElement border = getElement("Border");
|
SVGElement ribbon = getElement("Ribbon");
|
SVGElement elapsed1 = getElement("Elapsed1");
|
SVGElement elapsed2 = getElement("Elapsed2");
|
setAttribute(thunderbolt, "fill-opacity", "1.0", 999);
|
setAttribute(emergency, "fill-opacity", "1.0", 999);
|
setAttribute(lock, "fill-opacity", "1.0", 999);
|
setAttribute(calendar, "fill-opacity", "1.0", 999);
|
setAttribute(run, "fill-opacity", "1.0", 999);
|
setAttribute(remote, "fill-opacity", "1.0", 999);
|
setAttribute(thunderbolt, "fill", "#804080", 999);
|
setAttribute(emergency, "fill", "#804080", 999);
|
setAttribute(lock, "fill", "#804080", 999);
|
setAttribute(calendar, "fill", "#804080", 999);
|
setAttribute(run, "fill", "#804080", 999);
|
setAttribute(remote, "fill", "#804080", 999);
|
setText("Text number", String.format("%05d", controller.getDeviceInformation().number));
|
setText("Text information", "");
|
setText("Text offset", "");
|
setText("Text cycle", "");
|
setText("Text elapsed", "");
|
setAttribute(elapsed1, "display", "none");
|
setAttribute(elapsed2, "display", "none");
|
setAttribute(ribbon, "stroke-opacity", 0.50);
|
setAttribute(background, "fill", "#FF00FF");
|
setAttribute(ribbon, "stroke", "#FF00FF");
|
setAttribute(border, "stroke", "#FF00FF");
|
setAttribute(border, "display", "inline");
|
setAttribute(border, "stroke-width", 6.5);
|
setAttribute(border, "stroke-opacity", 1.0);
|
}
|
|
public void commands()
|
{
|
final String colorNoCommandsBorder = "#00007C";
|
final String colorNoCommandsBackground = "#7C7CFA";
|
|
final String colorCommandsBorder = "#007C00";
|
final String colorCommandsBackground = "#7CFA7C";
|
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller controller = (art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller) getDevice();
|
art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation controllerInformation = (art.library.model.devices.colors.controller.RTZ32.RTZ32_ControllerInformation) controller.getDeviceInformation();
|
|
SVGElement background = getElement("Background");
|
SVGElement border = getElement("Border");
|
SVGElement icon = getElement("Icon container");
|
|
try
|
{
|
setAttribute(border, "stroke", getDeviceCommands().isEmpty() ? colorNoCommandsBorder : colorCommandsBorder, 999);
|
setAttribute(border, "display", "inline", 999);
|
setAttribute(background, "fill", getDeviceCommands().isEmpty() ? colorNoCommandsBackground : colorCommandsBackground, 999);
|
setAttribute(icon, "fill", getDeviceCommands().isEmpty() ? colorNoCommandsBorder : colorCommandsBorder, 999);
|
|
setText("Text number", String.format("%05d", controllerInformation.number));
|
}
|
catch (Exception ex){}
|
|
}
|
// java.io.StringWriter sw = new java.io.StringWriter();
|
// art.library.gui.flat.FlatDialog.showDialog(null, "Error", e.getMessage() + "\n\n" + sw.toString(), true, art.library.gui.flat.FlatDialog.DIALOG_ERROR);
|
//
|
}
|