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 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237
| package Interface;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Label;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import javax.swing.BorderFactory;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.EtchedBorder;
import sources.ExtractionXLS;
import sources.ExtractionXML;
import sources.FormatageXML;
import Interface.Groudreport.GroundReportPnl;
import Interface.Groudreport.GroungReportInfos;
import Interface.Lastlegreport.LastLegReportInfos;
import Interface.Lastlegreport.LastLegReportPnl;
import Interface.Previouslegreport.PreviousLegReportInfos;
import Interface.Previouslegreport.PreviousLegReportPnl;
import Interface.Totalflighttime.TotalFlightTimePnl;
import Interface.Troubleshootdata.TroubleShootDataInfos;
import Interface.Troubleshootdata.TroubleShootDataPnl;
public class Visualisation extends JFrame implements ActionListener {
private JPanel MasterPnlVisu;
private int AppliWidth;
private int AppliHeight;
private JPanel PnlTitle;
private static Label PN;
private static Label SN;
private Label Titre;
private static Label DateDay;
private JPanel PnlInfos;
private JScrollPane ScrollInfos;
private TotalFlightTimePnl TotalFlightTime;
private static LastLegReportPnl LasLegReport;
private static PreviousLegReportPnl PreviousLegReport;
private static GroundReportPnl GroundReport;
private static TroubleShootDataPnl TroubleShootData;
private JPanel PnlBtn;
private JButton BtnPrint;
private Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
public Visualisation(String Type)
{
this.setTitle("aa");
AppliWidth = screenSize.width/2+425;
AppliHeight = screenSize.height-65;
/*-------------------------------Le panel de fond--------------------------------------*/
MasterPnlVisu = new JPanel();
MasterPnlVisu.setPreferredSize(new Dimension(AppliWidth,AppliHeight));
MasterPnlVisu.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
/*-------------------------Le panel de titre---------------------------------------*/
PnlTitle = new JPanel();
//PnlTitle.setComponentZOrder(MasterPnlVisu, 1);
PnlTitle.setLayout(new GridBagLayout());
PnlTitle.setPreferredSize(new Dimension(AppliWidth-10,(AppliHeight)*10/100));
PnlTitle.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 0;
MasterPnlVisu.add(PnlTitle,c);
if(Type.equals("XLS"))
{
PN = new Label("P/N: "+ExtractionXLS.GetPartNumber());
}
else
{
PN = new Label("P/N: "+ExtractionXML.GetPartNumber());
}
c.fill = c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 1;
c.gridy = 1;
PnlTitle.add(PN,c);
if(Type.equals("XLS"))
{
SN = new Label("S/N: "+ExtractionXLS.GetSerialNumber());
}
else
{
SN = new Label("S/N: "+ExtractionXML.GetSerialNumber());
}
c.fill = c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 1;
PnlTitle.add(SN,c);
Titre = new Label("AUTO SCAN REPORT");
c.fill = c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 1;
c.gridy = 0;
PnlTitle.add(Titre,c);
DateDay = new Label();
SimpleDateFormat dateStandard = new SimpleDateFormat("dd/MM/yyyy");
if(Type.equals("XLS"))
{
DateDay.setText(dateStandard.format(ExtractionXLS.GetDate()));
}
else
{
DateDay.setText(ExtractionXML.GetDate());
}
c.gridx = 2;
c.gridy = 1;
PnlTitle.add(DateDay,c);
/*----------------------------------------------------------------------------------*/
/*--------------------------Le panel pour les infos---------------------------------*/
PnlInfos = new JPanel();
ScrollInfos = new JScrollPane(PnlInfos);
//ScrollInfos.setComponentZOrder(MasterPnlVisu, 1);
ScrollInfos.setAutoscrolls(true);
ScrollInfos.setVisible(true);
ScrollInfos.setPreferredSize(new Dimension(AppliWidth-10,(AppliHeight-65)*89/100));
PnlInfos.setLayout(new BoxLayout(PnlInfos,BoxLayout.Y_AXIS));
c.fill = GridBagConstraints.HORIZONTAL;
c.gridx = 0;
c.gridy = 1;
MasterPnlVisu.add(ScrollInfos,c);
TotalFlightTime = new TotalFlightTimePnl();
PnlInfos.add(TotalFlightTime);
PnlInfos.add(LasLegReport);
PnlInfos.add(PreviousLegReport);
PnlInfos.add(GroundReport);
PnlInfos.add(TroubleShootData);
/*----------------------------------------------------------------------------------*/
/*----------------------Le panel pour les boutons print et quit---------------------*/
PnlBtn = new JPanel();
PnlBtn.setPreferredSize(new Dimension(AppliWidth-10,30));
PnlBtn.setLayout(new BorderLayout());
//PnlBtn.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
c.gridx = 0;
c.gridy = 2;
MasterPnlVisu.add(PnlBtn,c);
BtnPrint = new JButton("Imprimer");
BtnPrint.addActionListener(this);
BtnPrint.setActionCommand("Print");
PnlBtn.add(BtnPrint,BorderLayout.CENTER);
/*----------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------*/
getContentPane().add(MasterPnlVisu);
pack();
setVisible(true);
}
public static void CreatePreviousLegReport(ArrayList<PreviousLegReportInfos> sesInfos)
{
PreviousLegReport = new PreviousLegReportPnl(sesInfos);
}
public static void CreateLastLegReport(ArrayList<LastLegReportInfos> sesInfos)
{
LasLegReport = new LastLegReportPnl(sesInfos);
}
public static void CreateTroubleShootData(ArrayList<TroubleShootDataInfos> sesInfos)
{
TroubleShootData = new TroubleShootDataPnl(sesInfos);
}
public static void CreateGroungReport(ArrayList<GroungReportInfos> sesInfos)
{
GroundReport = new GroundReportPnl(sesInfos);
}
public static void SetPn(String text)
{
PN.setText(text);
}
public static void SetSN(String text)
{
SN.setText(text);
}
public static void SetDateDay(String text)
{
DateDay.setText(text);
}
public void actionPerformed(ActionEvent e)
{
if(e.getActionCommand().equals("Print"))
{
FormatageXML testxml = new FormatageXML();
}
}
} |
Partager