df
Alejandro Acuña
2024-09-16 f56295b7f2c7282783589fb4903529b09e161daa
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
package art.client.GUI.components.devices.window.colors.rtz32.realtime.components.distribution;
 
import art.library.gui.FlatGUI;
import art.library.model.devices.colors.controller.RTZ32.RTZ32_Controller;
import art.library.model.devices.colors.controller.RTZ32.configuration.RTZ32_Configuration;
import art.library.model.devices.colors.controller.RTZ32.configuration.RTZ32_Configuration_Group;
import art.servers.Shared;
import java.awt.BasicStroke;
import java.awt.Font;
import java.awt.Graphics2D;
import java.awt.geom.Line2D;
import java.awt.geom.Rectangle2D;
import javax.swing.JPanel;
 
 
 
public class Diagram_Distribution_Realtime_Header_Y extends JPanel
{
    private RTZ32_Controller rtz32 = null;
 
    
    public Diagram_Distribution_Realtime_Header_Y(RTZ32_Controller rtz32)
    {
        this.rtz32 = rtz32;
        this.setLayout(null);
    }
    
 
    
    public void paintPhases (Graphics2D g2, int h)
    {
        try
        {
            int w = getWidth();
            double dy = (int)((double)h / 3); 
            
            g2.setColor(FlatGUI.lookDesign.getColor("label.color.foreground"));
            Font font = FlatGUI.lookDesign.getFont("label.font");
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Saturation zone"), new Rectangle2D.Double(10, dy, w, dy), font);
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Phase"), new Rectangle2D.Double(10, dy*2, w, dy), font);
            
            g2.setColor(FlatGUI.lookDesign.getColor("button.color.background").darker());
            g2.draw(new Line2D.Double(0, 0, w, 0));
            g2.draw(new Line2D.Double(0, dy, w, dy));
            g2.draw(new Line2D.Double(0, dy*2, w, dy*2));
            
        }
        catch (Exception e)
        {
        }
    }
    
    
    
    
    public void paintGroups (Graphics2D g2, int h)
    {
        try
        {
            RTZ32_Configuration configuration = rtz32.getDeviceConfiguration().rtz32;
                    
            int w = getWidth();
            g2.setStroke(new BasicStroke(1.0f));
            Font font = FlatGUI.lookDesign.getFont("label.font");
            int numberBars = configuration.getNumberValidGroups();
            double dy = (double)((double)h / (double)numberBars); 
 
            //////////////////////////////////////////////////////////////////////////////////////////////////
            // Quitar si no se quiere que ocupe toda la altura de pantalla
            //
            // dy = Math.min(dy, 36);
            // h = (int)(dy * configuration.groups.size());
            //
            //////////////////////////////////////////////////////////////////////////////////////////////////
 
            
            g2.setColor(FlatGUI.lookDesign.getColor("label.color.foreground"));
            g2.rotate(-Math.PI/2, 25, h/2);
            Diagram_Distribution_Realtime.drawCenteredString(g2, Shared.getMessage("Group"), new Rectangle2D.Double(0, 0, 50, h), font);
            g2.rotate((Math.PI/2), 25, h/2);
 
            
            double currenty = 0;
          
            for (int i=0; i<configuration.getNumberValidGroups(); i++)
            {
                RTZ32_Configuration_Group group = configuration.groups[i];
                Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("G") + group.number, new Rectangle2D.Double(60, currenty, w-150, dy), font);
                Diagram_Distribution_Realtime.drawCenteredString(g2, "" + group.getType(), new Rectangle2D.Double(90, currenty, 35, dy), font);
                Diagram_Distribution_Realtime.drawLeftString(g2, group.getTypeName(), new Rectangle2D.Double(135, currenty, w, dy), font);                    
                currenty = currenty + dy;
            }
 
            
            g2.setColor(FlatGUI.lookDesign.getColor("button.color.background").darker());            
            g2.draw(new Line2D.Double(0, 0, w, 0));
            g2.draw(new Line2D.Double(50, 0, 50, h));
            g2.draw(new Line2D.Double(90, 0, 90, h));
            g2.draw(new Line2D.Double(125, 0, 125, h));
            
            currenty = 0;
            
            for (int i=0; i<configuration.getNumberValidGroups(); i++)
            {
                currenty = currenty + dy;
                g2.draw(new Line2D.Double(50, currenty,  w, currenty));
            }
    
            g2.draw(new Line2D.Double(0, currenty,  w, currenty));
        }
        catch (Exception e)
        {
        }
    }
    
    
   
    
    public void paintFooter(Graphics2D g2, int h)
    {
        try
        {
            int w = getWidth();
            double dy = (int)((double)h / 9); 
            
            g2.setColor(FlatGUI.lookDesign.getColor("label.color.foreground"));
            Font font = FlatGUI.lookDesign.getFont("label.font");
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Cycle counter"), new Rectangle2D.Double(10, dy, w, dy), font);
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Real cycle counter"), new Rectangle2D.Double(10, dy*2, w-150, dy), font);
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Algorithm / Cancelation / Correlation"), new Rectangle2D.Double(10, dy*3, w-150, dy), font);
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Trolley demands"), new Rectangle2D.Double(10, dy*4, w, dy), font);
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Trolley detector 1"), new Rectangle2D.Double(10, dy*5, w, dy), font);
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Trolley detector 2"), new Rectangle2D.Double(10, dy*6, w, dy), font);
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Trolley detector 3"), new Rectangle2D.Double(10, dy*7, w, dy), font);
            Diagram_Distribution_Realtime.drawLeftString(g2, Shared.getMessage("Trolley detector 4"), new Rectangle2D.Double(10, dy*8, w, dy), font);
            
            g2.setColor(FlatGUI.lookDesign.getColor("button.color.background").darker());
            
            for (int i=2; i<=8; i++)
            {
                g2.draw(new Line2D.Double(0, dy*i, w, dy*i));
            }
            
        }
        catch (Exception e)
        {
        }
    } 
    
        
}