Alejandro Acuña
2024-08-12 831c7bd85763b5eb5ef46664c65f0181824f9e13
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
 
import art.library.model.devices.Device;
import art.library.model.devices.DeviceStatus;
import com.kitfox.svg.SVGDiagram;
 
public class DeviceGraphicsRuntime_Inforpark_ParkingSymbolLittle extends DeviceGraphicsRuntime {
 
    public DeviceGraphicsRuntime_Inforpark_ParkingSymbolLittle(art.library.model.devices.Device device, SVGDiagram diagram) {
        super(device, diagram);
    }
 
    public void status() {
        Device device = getDevice();
        art.library.model.devices.parking.ParkingInformation information = (art.library.model.devices.parking.ParkingInformation) device.getDeviceInformation();
        art.library.model.devices.parking.ParkingStatus status = (art.library.model.devices.parking.ParkingStatus) device.getDeviceStatus();
        art.library.model.devices.parking.ParkingAlarms alarm = (art.library.model.devices.parking.ParkingAlarms) device.getDeviceAlarms();
        String color1 = "#000000";
        String color2 = "#000000";
        switch (status.status) {
            case DeviceStatus.STATUS_ONLINE:
            case DeviceStatus.STATUS_WARNING:
            case DeviceStatus.STATUS_ALARM:
                color1 = "#00FF00";
                color2 = "#007C00";
                if (alarm.alarm_complete > 0) {
                    color1 = "#FF0000";
                    color2 = "#7C0000";
                } else if (alarm.alarm_almost_complete > 0) {
                    color1 = "#FFFF00";
                    color2 = "#7C7C00";
                }
                break;
            case DeviceStatus.STATUS_INVALID:
                color1 = "#B97A57";
                color2 = "#5A3B2A";
                break;
            case DeviceStatus.STATUS_DISABLE:
                color1 = "#7C7C7C";
                color2 = "#3E3E3E";
                break;
            case DeviceStatus.STATUS_SIMULATION:
                color1 = "#0000FF";
                color2 = "#00007C";
                break;
            case DeviceStatus.STATUS_OFFLINE:
                color1 = "#FF00FF";
                color2 = "#7C007C";
                break;
            case DeviceStatus.STATUS_UNKNOWN:
                color1 = "#FF00FF";
                color2 = "#7C007C";
                break;
        }
        setAttribute("Background", "fill", color1);
        setAttribute("Border", "stroke", color2);
        setAttribute("Icon", "display", "inline");
        setAttribute("Icon", "fill", color2);
    }
 
    public void commands()
    {
       String commandsBackgroundColor = "#00FF00";
        
        setAttribute("Background", "fill", commandsBackgroundColor);
        
    }
 
    //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);                        
}