package art.client.GUI.components.devices.window.colors.rtz32.configuration.components;
|
|
import art.library.gui.FlatGUI;
|
import art.library.gui.flat.FlatButton;
|
import art.library.gui.flat.FlatLabel;
|
import art.library.gui.flat.combobox.FlatComboBox;
|
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.Color;
|
import java.awt.Font;
|
import java.awt.Graphics2D;
|
import java.awt.geom.Ellipse2D;
|
import java.awt.geom.Line2D;
|
import java.awt.geom.Rectangle2D;
|
import javax.swing.JPanel;
|
|
|
|
public class Diagram_Distribution_Bars_Header_Groups extends JPanel
|
{
|
private RTZ32_Configuration configuration = null;
|
private int numberBars = 0;
|
private boolean editable = false;
|
private FlatComboBox[] combos1 = new FlatComboBox[0];
|
private FlatButton[] buttons2 = new FlatButton[0];
|
|
|
public Diagram_Distribution_Bars_Header_Groups(RTZ32_Configuration configuration)
|
{
|
this.configuration = configuration;
|
this.setLayout(null);
|
}
|
|
|
|
public void paint (Graphics2D g2, int currentBar)
|
{
|
try
|
{
|
int w = getWidth();
|
int h = getHeight();
|
g2.setStroke(new BasicStroke(1.0f));
|
Font font = new FlatLabel().getLook().font;
|
g2.setColor(new FlatButton().getLook().colorForeground);
|
numberBars = Diagram_Distribution.getNumberBars(configuration);
|
double dy = (int)((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.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];
|
|
if (group.type != 20)
|
{
|
Diagram_Distribution.drawLeftString(g2, Shared.getMessage("G") + group.number, new Rectangle2D.Double(60, currenty, w-150, dy), font);
|
Diagram_Distribution.drawCenteredString(g2, "" + group.getType(), new Rectangle2D.Double(90, currenty, 35, dy), font);
|
Diagram_Distribution.drawLeftString(g2, group.getTypeName(), new Rectangle2D.Double(135, currenty, w, dy), font);
|
currenty = currenty + dy;
|
}
|
else
|
{
|
Diagram_Distribution.drawLeftString(g2, Shared.getMessage("G") + group.number, new Rectangle2D.Double(60, currenty, w-150, (dy * 4)), font);
|
Diagram_Distribution.drawCenteredString(g2, "" + group.getType(), new Rectangle2D.Double(90, currenty, 35, (dy * 4)), font);
|
Diagram_Distribution.drawLeftString(g2, group.getTypeName(), new Rectangle2D.Double(135, currenty, w, (dy * 4)), font);
|
currenty = currenty + (4 * dy);
|
}
|
}
|
|
|
g2.setColor(new FlatButton().getLook().colorBackground.darker());
|
g2.draw(new Line2D.Double(0, 0, w, 0));
|
g2.draw(new Line2D.Double(50, 0, 50, h * 2));
|
g2.draw(new Line2D.Double(90, 0, 90, h * 2));
|
g2.draw(new Line2D.Double(125, 0, 125, h * 2));
|
|
currenty = 0;
|
|
for (int i=0; i<configuration.getNumberValidGroups(); i++)
|
{
|
RTZ32_Configuration_Group group = configuration.groups[i];
|
|
if (group.type != 20)
|
{
|
currenty = currenty + dy;
|
g2.draw(new Line2D.Double(50, currenty, w, currenty));
|
}
|
else
|
{
|
currenty = currenty + (4 * dy);
|
g2.draw(new Line2D.Double(50, currenty, w, currenty));
|
}
|
}
|
|
g2.setColor(Color.blue);
|
paintFocus(g2, currentBar);
|
}
|
catch (Exception e)
|
{
|
}
|
}
|
|
|
|
|
|
public void paintFocus (Graphics2D g2, int currentBar)
|
{
|
try
|
{
|
int w = getWidth();
|
int h = getHeight();
|
|
double dy = (int)((double)h / (double)numberBars);
|
|
if ((currentBar >= 1) && (currentBar <= numberBars))
|
{
|
g2.fill(new Ellipse2D.Double(w - 20, (dy * currentBar) - (dy/2) - (dy/4), dy/2, dy/2));
|
}
|
}
|
catch (Exception e)
|
{
|
}
|
}
|
|
|
|
|
|
|
}
|