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 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
|
/*
* Page3.java
*
* Created on 28 juin 2007, 09:07
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package BNG.Application;
//implements Printable
/**Déclaration de la classe Page3**/
public class Page3 extends JPanel implements Printable{
public static JEditorPane editorPane=new JEditorPane("text/html","");
/**Déclaration des méthodes utilisées pour créer la page "Page3"**/
protected JPanel pano = new JPanel();
/**
* JPanel
*/
protected JPanel panos = new JPanel(new GridLayout(20,1));
/**
* JPanel
*/
protected JPanel panoSud = new JPanel(new GridLayout(1,0));
/**
* JPanel
*/
protected JPanel panoSud1 = new JPanel();
/**
* JPanel
*/
protected JPanel panoSud2 = new JPanel();
protected JTextArea console = new JTextArea();
protected JScrollPane scrollPane;
/**
* JLabel de recherche
*/
protected JLabel lSearch = new JLabel("Rechercher : ");
/**
* Layout
*/
protected GridLayout layout = new GridLayout(20,1);
/**
* Layout
*/
//protected BoxLayout layoutSud = new BoxLayout(panoSud,BoxLayout.Y_AXIS);
// protected GridLayout layoutSud = new GridLayout(2,1);
protected JSplitPane splitPane;
/**
* Layout
*/
// protected BoxLayout layoutSud1 = new BoxLayout(panoSud1,BoxLayout.X_AXIS);
/**
* Layout
*/
// protected BoxLayout layoutSud2 = new BoxLayout(panoSud2,BoxLayout.X_AXIS);
/**
* JButton d'ajout de TPS
*/
protected JButton addTPS = new JButton("Add TPS");
/**
* JButton d'installation
*/
protected JButton installer = new JButton("Installer");
// protected JButton imprimer = new JButton("Imprimer");
/**
* Champs de recherche
*/
protected JTextField search = new JTextField();
/**
* Champs d'ajout de TPS
*/
protected JTextField fAddTPS = new JTextField();
/**
* JTable
*/
protected JTable table;
/**
* JScroll
*/
protected JScrollPane scroll ;
/**
* Variable de DEBUG
*/
private boolean DEBUG = false;
/**
* TableRowSorter
*/
private TableRowSorter sorter;
/**
* MyTableModel
*/
private MyTableModel model;
/**Déclaration de classe extèrieures pour permettre leur appel**/
protected Acceuil retouracceuil;
static PageFormat set;
public static Object[] etatName;
// /**
// * Initialise la table
// */
public void initTable(){
Variable.out.println("0");
model=new MyTableModel(retouracceuil);
sorter=new TableRowSorter(model);
table = new JTable(model);
scroll = new JScrollPane(table);
// if(model.getRowCount()!=0){
for(int i=3;i<model.getColumnCount()-4;i++){ // TO DO -3
// Ajout d'une méthode de comparaison entre les TPS
//ùùùù sorter.setComparator(i,new Comparator<Object[]>(){
sorter.setComparator(i,new Comparator<Cell>(){
public int compare(Cell o1, Cell o2){
int temp=Variable.calcul((String)(o2.o[0]))-Variable.calcul((String)(o1.o[0]));
return temp;
// return indice(o2)-indice(o1);
}
});
}
if(model.getColumnCount()-6!=0)
sorter.setMaxSortKeys(model.getColumnCount()-6);
Vector<SortKey> vsk=new Vector<SortKey>();
Variable.out.println("1000");
for(int i=3;i<model.getColumnCount()-3;i++){
SortKey sk=new SortKey(i,SortOrder.ASCENDING);
vsk.add(sk);
}
sorter.setSortKeys(vsk);
if(model.getColumnCount()-6!=0)
sorter.setMaxSortKeys(model.getColumnCount()-6);
table.setRowSorter(sorter);
// }
this.table.setDefaultRenderer(Cell.class,new MyTableRender());
this.table.setDefaultEditor(Cell.class,new TpsEditor(retouracceuil));
this.table.getColumnModel().getColumn(2).setCellRenderer(new PNTableRender());
//table.getTableHeader().setReorderingAllowed(false);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
Variable.out.println("2000");
table.setDragEnabled(true);
table.setTransferHandler(new CopieHandler());
Variable.out.println("0");
}
/**
* Méthode constructeur de Page3
* @param a Acceuil
*/
public Page3(Acceuil a) {
retouracceuil = a;
/** Utilise la méthode "borderlayout" qui sert à l'aménagement de panneaux **/
setLayout(new BorderLayout());
// JPanel a DROITE
JLabel green = new JLabel("");
JLabel red = new JLabel("");
JLabel orange = new JLabel("");
JLabel gray = new JLabel("");
JLabel cyan = new JLabel("");
JLabel magenta = new JLabel("");
JLabel white = new JLabel("");
// panos.setLayout(layout);
red.setOpaque(true);red.setBackground(Color.RED);red.setToolTipText("TO INSTALL");red.setText("TO INSTALL");
red.addMouseListener(new ColorClick("^ROUGE$",this.search));
panos.add(red);
magenta.setOpaque(true);magenta.setBackground(Color.MAGENTA);magenta.setToolTipText("NO EXEC");magenta.setText("NO EXEC");
magenta.addMouseListener(new ColorClick("^MAGENTA$",this.search));
panos.add(magenta);
orange.setOpaque(true);orange.setBackground(Color.ORANGE);orange.setToolTipText("ARCHIVE");orange.setText("ARCHIVE");
orange.addMouseListener(new ColorClick("^ORANGE$",this.search));
panos.add(orange);
gray.setOpaque(true);gray.setBackground(Color.GRAY);gray.setToolTipText("PAS DANS REF");gray.setText("PAS DANS REF");
panos.add(gray);
gray.addMouseListener(new ColorClick("^GRIS$",this.search));
cyan.setOpaque(true);cyan.setBackground(Color.CYAN);cyan.setToolTipText("IN REF (NON ARCHIVE)");cyan.setText("IN REF (NON ARCHIVE)");
cyan.addMouseListener(new ColorClick("^CYAN$",this.search));
panos.add(cyan);
white.setOpaque(true);white.setBackground(Color.WHITE);white.setToolTipText("NO INSTALL");white.setText("NO INSTALL");
white.addMouseListener(new ColorClick("^BLANC$",this.search));
panos.add(white);
green.setOpaque(true);green.setBackground(Color.GREEN);green.setToolTipText("OK");green.setText("OK");
green.addMouseListener(new ColorClick("^VERT$",this.search));
panos.add(green);
// panos.add(exporter);
// exporter.addActionListener(new GestionExporter()); /**De même pour le bouton 'Exporter'**/
// panos.add(installer);
// installer.addActionListener(new GestionInst());
panos.add(installer);
installer.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
Variable.out.println("10000");
installerAll();
}
});
// JButton imprimer=new JButton("Imprimer");
// panos.add(imprimer);
// imprimer.addActionListener(new ActionListener() {
//
// public void actionPerformed(ActionEvent ev) {
// Variable.out.println("10");
// PrinterJob pj = PrinterJob.getPrinterJob();
// Variable.out.println("11");
// pj.setPrintable(Page3.this);
// Variable.out.println("12");
// if(pj.printDialog()){
//
// try {
// Variable.out.println("13");
// pj.print();
// Variable.out.println("14");
// } catch (Exception PrintException) {
// }
// }
// }
//
// });
add(panos,BorderLayout.EAST);
JScrollPane areaScrollPane = new JScrollPane(editorPane);
areaScrollPane.setVerticalScrollBarPolicy(
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
areaScrollPane.setPreferredSize(new Dimension(250,100));
areaScrollPane.setBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createTitledBorder("Console"),
BorderFactory.createEmptyBorder(5,5,5,5)),
areaScrollPane.getBorder()));
/** Ecriture d'un titre en dur sur le paneau de la fenêtre **/
panoSud1.setMinimumSize(new Dimension(10,25));
panoSud1.setLayout(new BoxLayout(panoSud1,BoxLayout.X_AXIS));
panoSud1.add(lSearch);
panoSud1.add(search);
JPanel empty=new JPanel();
empty.setBorder(new EmptyBorder(0,20,0,0));
panoSud1.add(empty);
panoSud1.add(addTPS);
panoSud1.add(fAddTPS);
splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT,panoSud1, areaScrollPane);
splitPane.setOneTouchExpandable(true);
splitPane.setResizeWeight(0.5);
add(splitPane,BorderLayout.SOUTH);
setBorder(BorderFactory.createTitledBorder("Listing des programmes"));
/** Ajout des différents composants sur les panneaux respectifs ainsi que l'évènement de bouton **/
initTable();
add(scroll);
// Listener de recharcher sur les tps
search.getDocument().addDocumentListener(
new DocumentListener() {
public void changedUpdate(DocumentEvent e) {
newFilter();
}
public void insertUpdate(DocumentEvent e) {
newFilter();
}
public void removeUpdate(DocumentEvent e) {
newFilter();
}
});
// La mise a jour du background du champ d'ajout de tps
fAddTPS.getDocument().addDocumentListener(new DocumentListener() {
public void insertUpdate(DocumentEvent e) {
fAddTPS.setBackground(Color.WHITE);
}
public void removeUpdate(DocumentEvent e) {
fAddTPS.setBackground(Color.WHITE);
}
public void changedUpdate(DocumentEvent e) {
fAddTPS.setBackground(Color.WHITE);
}
});
// Bouton d'ajout de TPS
addTPS.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
addTps();
}
});
sortTable();
}
/** Récupere l'ordre des colonnes sous la forme "2,0,1"
* Donne l'ordre courant par rapport à l'ordre d'origine de la TableModel
* @return Ordre courant des colonnes (ex: "2,0,1")
**/
public String getTableOrder(JTable table) {
Variable.out.println("3000");
String Result = "";
int nbrColumns = table.getColumnCount();
for(int i = 0 ; i < nbrColumns ; i++) {
int realColumn = table.getColumnModel().getColumn(i).getModelIndex();
Result += realColumn;
if(i < nbrColumns - 1) Result +=",";
}
return Result;
}
/** Réordonne les colonnes d'une table
* IMPORTANT les numero dans "2,0,1" se refere à la position d'origine du TableModel
* @param order Ordre souhaité par rapport à l'origine
* @param table La JTable à réordonner
**/
public void setTableOrder(String order,JTable table) {
Variable.out.println("4000");
ArrayList expected = makeOrderList(order);
ArrayList having = makeOrderList( getTableOrder(table) );
for(int i = 0 ; i < table.getColumnCount() ; i++) {
Integer valExpected = (Integer)expected.get(i);
Integer valHaving = (Integer)having.get(0);
if( valExpected.intValue() == valHaving.intValue() ) {
having.remove(0);
continue;
}
int posExpectedOnCurrent = having.indexOf(valExpected);
System.out.println("Move column " + (posExpectedOnCurrent + i) + " to " + i);
having.remove(posExpectedOnCurrent);
table.moveColumn( posExpectedOnCurrent + i , i );
}
}
/** Restaure les colonnes à leur position d'origine
* @param table JTable dont ont veux restaurer la position des colonnes
**/
public void restoreTableOrder(JTable table) {
Variable.out.println("5000");
String strOrder = "";
for(int i = 0 ; i < table.getColumnCount() ; i++) {
strOrder += i;
if(i < table.getColumnCount() -1 ) strOrder += ",";
}
setTableOrder(strOrder,table);
}
/** Méthode interne pour générer une liste d'ordre **/
public ArrayList makeOrderList(String strList) {
ArrayList result = new ArrayList();
StringTokenizer tokenizer = new StringTokenizer(strList, ",");
while(tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
Integer value = new Integer( Integer.parseInt(token) );
result.add(value);
}
return result;
}
public void sortTable(){
Variable.out.println("6000");
String ordre="0,1,2";
TreeMap<String,Integer> tri=new TreeMap<String,Integer>(new Comparator<String>() {
public int compare(String o1, String o2) {
if(o1.length()>o2.length())
return 1;
else if(o2.length()>o1.length())
return -1;
return o1.compareTo(o2);
}
public boolean equals(Object obj) {
return super.equals(obj);
}
});
for(int i=3;i<table.getColumnCount()-4;i++){
tri.put(table.getColumnName(i),i);
System.out.println(table.getColumnName(i)+" "+i);
}
for(Iterator<Integer> j=tri.values().iterator();j.hasNext();){
ordre+=","+j.next();
}
ordre+=","+(table.getColumnCount()-4)+","+(table.getColumnCount()-3)+","+(table.getColumnCount()-2)+","+(table.getColumnCount()-1);
System.out.println(ordre);
setTableOrder(ordre,table);
}
/**
* Ajout de tps dans la table
*/
public void addTps(){
boolean find=false;
for(Enumeration<TpsRef> en=Variable.baseTps.elements();en.hasMoreElements();){
boolean ok=false;
TpsRef r=en.nextElement();
String name = r.getNameTps().toUpperCase();
String produit = r.getProduit().toUpperCase();
String PN = r.getPN().toUpperCase();
String CMM = r.getCMM().toUpperCase();
String etat = Variable.etatName[r.getEtat()].toUpperCase();
if(!(((MyTableModel)table.getModel()).getSelect().containsKey(name))){
if(fAddTPS.getText().toUpperCase().equals("")){
ok=true;
}else{
StringTokenizer s=new StringTokenizer(fAddTPS.getText().toUpperCase(),"|");
while(s.hasMoreTokens()&&!ok){
boolean and=true;
String regex="";
StringTokenizer st=new StringTokenizer(s.nextToken(),"#&");
while(st.hasMoreTokens()&&and){
regex=st.nextToken();
if(!(name.contains(regex)||
produit.contains(regex)||
PN.contains(regex)||
CMM.contains(regex)||
etat.contains(regex))){
and=false;
}
}
if(and){
ok=true;
}
}
}
if(ok){
if(!find){
find=true;
fAddTPS.setBackground(Color.GREEN);
}
((MyTableModel)table.getModel()).addRow(name);
}
}
}
if(!find) fAddTPS.setBackground(Color.RED);
else ((MyTableModel)table.getModel()).fireTableDataChanged();
}
/**
* Fonction de scan des TPS (fonction du champ search)
*/
public void newFilter(){
Variable.out.println("13000");
// Filtre les mauvais caractères
String test = search.getText().replaceAll("[\\[\\(\\)]","");
//search.setText(test);
RowFilter<MyTableModel, Object> rf = null;
Vector<RowFilter<Object, Object>> v = new Vector<RowFilter<Object, Object>>();
StringTokenizer st=new StringTokenizer(test,"#&");
while(st.hasMoreTokens()){
String temp=st.nextToken();
v.add(RowFilter.regexFilter("(?i)"+temp));
}
sorter.setRowFilter(RowFilter.andFilter(v));
// try {
// rf = RowFilter.regexFilter(search.getText());
// } catch (java.util.regex.PatternSyntaxException e) {
// return;
// }
// sorter.setRowFilter(rf);
}
/**Fonction permettant de faire appel à un programme qui sera créé par une autre personne, se sera un programme d'installation automatique**/
public void initExec() {
String cmd;
cmd="cmd /C C:\\chemin_et_nom du programme";
try{
Runtime run = Runtime.getRuntime();
Process p = run.exec(cmd);
p.waitFor(); /**Attendre le fin du processus du programme lancé**/
}catch (Exception e){
Variable.out.println("Erreur d'éxécution :"+cmd+e.toString());
}
}
/**
* Class de gestion d'exportation
*/
// public class GestionExporter implements ActionListener /**Evènement du bouton 'Exporter'**/
// {
/**
* Methode d'exportation
* @param ev ActionEvent
*/
public void actionPerformedOne(ActionEvent ev) {
Variable.out.println("Le bouton 'Exporter' a été cliquer");
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
WritableWorkbook workbook = Workbook.createWorkbook(new File("sortie.xls"));
WritableSheet sheet = workbook.createSheet("Premier classeur", 0);
int nbRow = table.getRowCount();
int nbCol = table.getColumnCount();
for(int i=0;i<nbCol-2;i++){
sheet.addCell(new Label(i,0,(String)table.getModel().getColumnName(table.convertColumnIndexToModel(i))));
sheet.setColumnView(i,17);
}
Hashtable<Color,Colour> couleur = new Hashtable<Color,Colour>();
couleur.put(Color.RED,Colour.RED);
couleur.put(Color.GREEN,Colour.GREEN);
couleur.put(Color.BLUE,Colour.BLUE);
couleur.put(Color.CYAN,Colour.CORAL);
couleur.put(Color.WHITE,Colour.WHITE);
couleur.put(Color.GRAY,Colour.GRAY_50);
couleur.put(Color.LIGHT_GRAY,Colour.GRAY_25);
couleur.put(Color.MAGENTA,Colour.ROSE);
couleur.put(Color.ORANGE,Colour.ORANGE);
// for(int i=0;i<table.getModel().getRowCount();i++){
for(int i=0;i<nbRow;i++){
for(int j=0;j<nbCol-2;j++){
int ireal=table.convertRowIndexToModel(i);
int jreal=table.convertColumnIndexToModel(j);
if(!table.getValueAt(i,j).getClass().getName().equals("java.lang.String")){
Component c = table.getCellRenderer(ireal,j).getTableCellRendererComponent(table,table.getValueAt(i,j),false,false,i,j);
WritableFont w = new WritableFont(WritableFont.ARIAL, 10,WritableFont.BOLD, true, UnderlineStyle.NO_UNDERLINE,Colour.WHITE, ScriptStyle.NORMAL_SCRIPT);
WritableCellFormat wc = new WritableCellFormat(w);
wc.setBackground(couleur.get(c.getBackground()));
sheet.addCell(new Label(j,i+1,"",wc));
}else{
sheet.addCell(new Label(j,i+1,(String)table.getValueAt(i,j)));
}
}
}
workbook.write();
workbook.close();
setCursor(null);
Runtime run= Runtime.getRuntime();
String cmd = "cmd /C start excel \"" + new File("sortie.xls").getAbsoluteFile()+"\"";
Runtime.getRuntime().exec(cmd);
} catch (RowsExceededException e1) {
e1.printStackTrace();
} catch (WriteException e1) {
e1.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
Variable.out.println("Le fichier \"sortie.xls\" à été généré correctement.");
}
}
// }
public int print(Graphics g, PageFormat pageFormat, int pageIndex)throws PrinterException {
Variable.out.println("100");
Graphics2D g2 = (Graphics2D)g;
Variable.out.println("101");
g2.setColor(Color.black);
Variable.out.println("102");
int fontHeight = g2.getFontMetrics().getHeight();
int fontDescent = g2.getFontMetrics().getDescent();
Variable.out.println("103");
// laisser de l'espace pour le numero de page
double pageHeight = pageFormat.getImageableHeight() - fontHeight;
Variable.out.println("104");
double pageWidth = pageFormat.getImageableWidth();
Variable.out.println("105");
double tableWidth = (double)table.getColumnModel().getTotalColumnWidth();
Variable.out.println("106");
double scale = 1;
if (tableWidth >= pageWidth) {
scale = pageWidth / tableWidth;
}
Variable.out.println("107");
double headerHeightOnPage = table.getTableHeader().getHeight()*scale;
Variable.out.println("108");
double tableWidthOnPage = tableWidth * scale;
Variable.out.println("109");
double oneRowHeight = (table.getRowHeight() + table.getRowMargin())*scale;
Variable.out.println("110");
int numRowsOnAPage = (int)((pageHeight-headerHeightOnPage) / oneRowHeight);
Variable.out.println("111");
double pageHeightForTable = oneRowHeight * numRowsOnAPage;
Variable.out.println("112");
int totalNumPages = (int)Math.ceil(((double)table.getRowCount()) / numRowsOnAPage);
if (pageIndex >= totalNumPages)
return NO_SUCH_PAGE;
Variable.out.println("113");
g2.translate(pageFormat.getImageableX(), pageFormat.getImageableY());
Variable.out.println("114");
// en bas au centre
g2.drawString("Page: " + (pageIndex +1),(int)pageWidth/2 - 35, (int)(pageHeight + fontHeight - fontDescent));
Variable.out.println("115");
g2.translate(0f, headerHeightOnPage);
g2.translate(0f, -pageIndex*pageHeightForTable);
Variable.out.println("116");
// si cette partie de la page est plus petite
// que la taille disponible, alors découper les contours appropriés
if (pageIndex + 1 == totalNumPages) {
int lastRowPrinted = numRowsOnAPage * pageIndex;
int numRowsLeft = table.getRowCount() - lastRowPrinted;
g2.setClip(0, (int)(pageHeightForTable * pageIndex),(int)Math.ceil(tableWidthOnPage),(int)Math.ceil(oneRowHeight * numRowsLeft));
}
// sinon découper la zone disponible toute entière
else {
g2.setClip(0, (int)(pageHeightForTable * pageIndex),(int)Math.ceil(tableWidthOnPage),(int)Math.ceil(pageHeightForTable));
}
Variable.out.println("117");
g2.scale(scale, scale);
table.paint(g2);
Variable.out.println("118");
// dessiner les entêtes en haut
g2.scale(1/scale, 1/scale);
g2.translate(0f, pageIndex*pageHeightForTable);
g2.translate(0f, -headerHeightOnPage);
g2.setClip(0, 0,(int)Math.ceil(tableWidthOnPage),(int)Math.ceil(headerHeightOnPage));
g2.scale(scale, scale);
Variable.out.println("119");
table.getTableHeader().paint(g2);
Variable.out.println("120");
return Printable.PAGE_EXISTS;
}
}/**Fin de la classe Page3**/ |
Partager