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
| @Override
public void createControl(Composite parent) {
final Composite comp = new Composite(parent, SWT.NONE);
compo = comp;
GridDataFactory.swtDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(comp);
GridLayoutFactory.fillDefaults().spacing(LayoutConstants.getSpacing()).numColumns(3).equalWidth(false).applyTo(comp);
Label labelTitre = new Label(comp,SWT.CENTER);
labelTitre.setText("Informations concernants les numéros de configuration");
labelTitre.setFont(getFont("Arial-14"));
GridData titreGD = new GridData(SWT.FILL, SWT.CENTER, true, false);
titreGD.horizontalSpan = 4;
titreGD.heightHint = 40;
labelTitre.setLayoutData(titreGD);
final ScrolledComposite scrolledComposite = new ScrolledComposite (comp, SWT.V_SCROLL);
final ScrolledComposite scrolledCompOM = new ScrolledComposite(comp, SWT.V_SCROLL);
final ScrolledComposite scrolledCompOT = new ScrolledComposite(comp,SWT.V_SCROLL);
GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(false, false).applyTo(scrolledComposite);
GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(false, false).applyTo(scrolledCompOM);
GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(false, false).applyTo(scrolledCompOT);
groupTT = new Group(scrolledComposite,SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(false, false).applyTo(groupTT);
scrolledComposite.setContent(groupTT);
String banc = MyWizard.pDefMissAff.getBanc();
String lieuAff = MyWizard.one.getSelectedDirectory();
Label labelTTtitre = new Label(groupTT,SWT.NONE);
labelTTtitre.setText("Renommer les Tests Type");
labelTTtitre.setFont(getFont("Arial-10"));
GridData ttGridData = new GridData(GridData.FILL_HORIZONTAL);
ttGridData.horizontalSpan = 2;
labelTTtitre.setLayoutData(ttGridData);
InputStream ttFile = null;;
try {
ttFile = new FileInputStream(lieuAff + "\\ouate\\donnees\\entrees\\TestType.xls");
} catch (FileNotFoundException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
Workbook workbook = Workbook.getWorkbook(ttFile);
Sheet sheet = workbook.getSheet(0);
Cell[] row = sheet.getRow(0);
Cell[] rows = null;
Cell[] rowsTT = sheet.getColumn(0);
for(int i=0; i<row.length; i++){
if(banc.equals(row[i].getContents())){
rows = sheet.getColumn(i);
}
}
if(rows!=null){
List<String> listTT = new ArrayList<String>();
tabTT = new Table(groupTT, SWT.CHECK | SWT.BORDER);
tabTT.addSelectionListener(new TTSelectionListener(parametrageControllerPageSeven));
for(int ligne=1; ligne<rows.length; ligne++){
boolean exist = false;
for(int ligneBis=0; ligneBis<listTT.size(); ligneBis++){
if(rows[ligne].getContents().equals(listTT.get(ligneBis))){
exist = true;
}
}
if(!exist && !rows[ligne].getContents().equals("")){
TableItem line = new TableItem(tabTT,SWT.NONE);
line.setText(rowsTT[ligne].getContents() + "=" + rows[ligne].getContents()); line.setChecked(false);
listTT.add(rows[ligne].getContents());
}
}
}
} catch (BiffException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
groupOM = new Group(scrolledCompOM,SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(false, false).applyTo(groupOM);
scrolledCompOM.setContent(groupOM);
groupOT = new Group(scrolledCompOT,SWT.NONE);
GridDataFactory.fillDefaults().align(SWT.FILL,SWT.FILL).grab(false, false).applyTo(groupOT);
scrolledCompOT.setContent(groupOT);
GridLayout gridTT = new GridLayout(2,false);
groupTT.setLayout(gridTT);
scrolledComposite.setMinSize(groupTT.computeSize(SWT.DEFAULT, SWT.DEFAULT));
scrolledComposite.setExpandHorizontal(true);
scrolledComposite.setExpandVertical(true);
parent.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
((GridData)scrolledComposite.getLayoutData()).heightHint=
Math.max(0, comp.getShell().getSize().y/5);
comp.layout(true,true);
}
});
GridLayout gridOM = new GridLayout(2,false);
groupOM.setLayout(gridOM);
Label labelOMtitre = new Label(groupOM,SWT.NONE);
labelOMtitre.setText("Ordre de mesure :");
labelOMtitre.setFont(getFont("Arial-10"));
GridData omGridData = new GridData(GridData.FILL_HORIZONTAL);
omGridData.horizontalSpan = 2;
labelOMtitre.setLayoutData(omGridData);
scrolledCompOM.setMinSize(groupOM.computeSize(SWT.DEFAULT, SWT.DEFAULT));
scrolledCompOM.setExpandHorizontal(true);
scrolledCompOM.setExpandVertical(true);
parent.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
((GridData)scrolledCompOM.getLayoutData()).heightHint=
Math.max(0, comp.getShell().getSize().y/5);
comp.layout(true,true);
}
});
GridLayout gridOT = new GridLayout(2,false);
groupOT.setLayout(gridOT);
Label labelOTtitre = new Label(groupOT, SWT.NONE);
labelOTtitre.setText("Ordre de tri :");
labelOTtitre.setFont(getFont("Arial-10"));
GridData otGridData = new GridData(GridData.FILL_HORIZONTAL);
otGridData.horizontalSpan = 2;
labelOTtitre.setLayoutData(otGridData);
buttonSec = new Button(groupOT,SWT.CHECK);
buttonSec.setText("Par section");
buttonSec.addSelectionListener(new OtNumConfSelectionListener(parametrageControllerPageSeven));
buttonMiss = new Button(groupOT,SWT.CHECK);
buttonMiss.setText("Par mission");
buttonMiss.addSelectionListener(new OtNumConfSelectionListener(parametrageControllerPageSeven));
buttonAlpha = new Button(groupOT,SWT.CHECK);
buttonAlpha.setText("Par ordre alphabétique des équipements");
buttonAlpha.addSelectionListener(new OtNumConfSelectionListener(parametrageControllerPageSeven));
buttonAlphaSSI = new Button(groupOT,SWT.CHECK);
buttonAlphaSSI.setText("Par ordre alphabétique des SSI");
buttonAlphaSSI.addSelectionListener(new OtNumConfSelectionListener(parametrageControllerPageSeven));
buttonTypeGain = new Button(groupOT,SWT.CHECK);
buttonTypeGain.setText("Par type de gain");
buttonTypeGain.addSelectionListener(new OtNumConfSelectionListener(parametrageControllerPageSeven));
scrolledCompOT.setMinSize(groupOT.computeSize(SWT.DEFAULT, SWT.DEFAULT));
scrolledCompOT.setExpandHorizontal(true);
scrolledCompOT.setExpandVertical(true);
parent.addControlListener(new ControlAdapter() {
@Override
public void controlResized(ControlEvent e) {
((GridData)scrolledCompOT.getLayoutData()).heightHint=
Math.max(0, comp.getShell().getSize().y/3);
comp.layout(true,true);
}
});
comp.getShell().addShellListener(new ShellAdapter() {
@Override
public void shellActivated(ShellEvent e) {
comp.layout(true,true);
}
});
setControl(comp);
setPageComplete(false);
} |
Partager