package Asf;
|
|
|
import art.library.model.devices.Device;
|
import art.library.model.devices.DeviceGraphicsRuntime;
|
import com.kitfox.svg.SVGDiagram;
|
import com.kitfox.svg.SVGElement;
|
|
|
public class DeviceGraphicsRuntime_Asf_action_aspect extends DeviceGraphicsRuntime
|
{
|
|
public DeviceGraphicsRuntime_Asf_action_aspect(art.library.model.devices.Device device, SVGDiagram diagram)
|
{
|
super(device, diagram);
|
}
|
|
private boolean flashOn = false;
|
|
public void timer()
|
{
|
flashOn = !flashOn;
|
status();
|
}
|
|
public void status()
|
{
|
try
|
{
|
Device device = getDevice();
|
art.library.model.devices.vms.asf.AsfStatus status = (art.library.model.devices.vms.asf.AsfStatus) device.getDeviceStatus();
|
art.library.model.devices.vms.asf.AsfAlarms alarms = (art.library.model.devices.vms.asf.AsfAlarms) device.getDeviceAlarms();
|
art.library.model.devices.vms.asf.AsfConfiguration configuration = (art.library.model.devices.vms.asf.AsfConfiguration) device.getDeviceConfiguration();
|
SVGElement arrow = getElement("arrow");
|
SVGElement cross = getElement("cross");
|
SVGElement arrowRight = getElement("arrow-right");
|
SVGElement arrowLeft = getElement("arrow-left");
|
SVGElement dynamicElements = getElement("elements");
|
setAttribute(dynamicElements, "display", "none", 999);
|
for (int i = 0; i <= 5; i++)
|
{
|
setAttribute("alarm-" + i, "display", (alarms.getServerityAlarm() == i) ? "inline" : "none", 999);
|
}
|
setAttribute("lock-on", "display", "inline", 999);
|
setAttribute("brightness-icon-on", "display", "inline", 999);
|
setAttribute("lock-on", "display", "inline", 999);
|
setAttribute("lock-off", "display", "inline", 999);
|
setAttribute("light-on", "display", "inline", 999);
|
setAttribute("Auto", "display", "inline", 999);
|
setAttribute("Manual", "display", "inline", 999);
|
SVGElement showElement = null;
|
switch (status.state)
|
{
|
case art.library.model.devices.vms.asf.AsfStatus.STATE_ARROW:
|
showElement = arrow;
|
break;
|
case art.library.model.devices.vms.asf.AsfStatus.STATE_CROSS:
|
showElement = cross;
|
break;
|
case art.library.model.devices.vms.asf.AsfStatus.STATE_OFF:
|
break;
|
case art.library.model.devices.vms.asf.AsfStatus.STATE_LEFT:
|
showElement = arrowLeft;
|
break;
|
case art.library.model.devices.vms.asf.AsfStatus.STATE_RIGHT:
|
showElement = arrowRight;
|
break;
|
case art.library.model.devices.vms.asf.AsfStatus.STATE_FLASHING_LEFT:
|
showElement = (flashOn) ? arrowLeft : null;
|
break;
|
case art.library.model.devices.vms.asf.AsfStatus.STATE_FLASHING_RIGHT:
|
showElement = (flashOn) ? arrowRight : null;
|
break;
|
}
|
if (showElement != null)
|
{
|
setAttribute(showElement, "display", "inline", 999);
|
}
|
if (status.priority < 256)
|
{
|
setAttribute("lock-on", "display", "none", 999);
|
}
|
switch (configuration.brightnessMode)
|
{
|
case art.library.model.devices.vms.asf.AsfConfiguration.BRIGHTNESS_MODE_AUTO:
|
setAttribute("Manual", "display", "none", 999);
|
break;
|
case art.library.model.devices.vms.asf.AsfConfiguration.BRIGHTNESS_MODE_MANUAL:
|
setAttribute("Auto", "display", "none", 999);
|
break;
|
default:
|
setAttribute("Auto", "display", "none", 999);
|
setAttribute("Manual", "display", "none", 999);
|
setAttribute("light-on", "display", "none", 999);
|
break;
|
}
|
} catch (Exception ex)
|
{
|
}
|
}
|
|
public void commands()
|
{
|
art.library.model.devices.vms.asf.AsfCommands deviceCommands = (art.library.model.devices.vms.asf.AsfCommands) getDeviceCommands();
|
SVGElement arrow = getElement("arrow");
|
SVGElement cross = getElement("cross");
|
SVGElement arrowRight = getElement("arrow-right");
|
SVGElement arrowLeft = getElement("arrow-left");
|
SVGElement dynamicElements = getElement("elements");
|
setAttribute("lock-on", "display", "inline", 999);
|
setAttribute("restart", "display", "inline", 999);
|
setAttribute("unlock", "display", "inline", 999);
|
setAttribute(dynamicElements, "display", "none", 999);
|
SVGElement showElement = null;
|
switch (deviceCommands.state)
|
{
|
case art.library.model.devices.vms.asf.AsfCommands.STATE_ARROW:
|
showElement = arrow;
|
break;
|
case art.library.model.devices.vms.asf.AsfCommands.STATE_CROSS:
|
showElement = cross;
|
break;
|
case art.library.model.devices.vms.asf.AsfCommands.STATE_OFF:
|
break;
|
case art.library.model.devices.vms.asf.AsfCommands.STATE_LEFT:
|
showElement = arrowLeft;
|
break;
|
case art.library.model.devices.vms.asf.AsfCommands.STATE_RIGHT:
|
showElement = arrowRight;
|
break;
|
case art.library.model.devices.vms.asf.AsfCommands.STATE_FLASHING_LEFT:
|
showElement = (flashOn) ? arrowLeft : null;
|
break;
|
case art.library.model.devices.vms.asf.AsfCommands.STATE_FLASHING_RIGHT:
|
showElement = (flashOn) ? arrowRight : null;
|
break;
|
}
|
if (showElement != null)
|
{
|
setAttribute(showElement, "display", "inline", 999);
|
}
|
if (deviceCommands.reset != art.library.model.devices.vms.asf.AsfCommands.CONDITION_YES)
|
{
|
setAttribute("restart", "display", "none", 999);
|
}
|
if (deviceCommands.liberate != art.library.model.devices.vms.asf.AsfCommands.CONDITION_YES)
|
{
|
setAttribute("unlock", "display", "none", 999);
|
}
|
if (deviceCommands.priority < 256)
|
{
|
setAttribute("lock-on", "display", "none", 999);
|
}
|
}
|
|
// 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);
|
//
|
}
|