IdentifiantMot de passe
Loading...
Mot de passe oubliι ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les rιponses en temps rιel, voter pour les messages, poser vos propres questions et recevoir la newsletter

AWT/Swing Java Discussion :

Imprimante sort des pages noires


Sujet :

AWT/Swing Java

Vue hybride

Message prιcιdent Message prιcιdent   Message suivant Message suivant
  1. #1
    Membre confirmι
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    204
    Dιtails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 204
    Par dιfaut Imprimante sort des pages noires
    Bonjour ΰ tous.

    Dans une vieille appli, non documentιe dιveloppιe avec le JDK 1.1.8, toutes mes sorties imprimante me donnent des pages totalement noires.
    Je n'arrive pas ΰ m'en sortir, n'ιtant pas encore assez aguerri.
    Je joins ci-aprθs le code source, comme si je jetais une bouteille ΰ la mer...
    Des fois qu'un oeil expert trouve le schmurz..

    Merci.

    Code : Sιlectionner tout - Visualiser dans une fenκtre ΰ part
    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
     
    import java.awt.Frame;
    import java.awt.Graphics;
    import java.awt.PrintJob;
    import java.awt.Toolkit;
    import java.util.Properties;
     
     
    public class JobMan implements Runnable {
     
    		LdtPrintManager pm;
    		boolean done=false;
    		boolean end=false;
    		PrintJob pjob = null;
     
    	public JobMan(LdtPrintManager pm) {
    		this.pm=pm;
    		Thread t = new Thread(this);
    		t.start();
    		while (!done) { Thread.yield();}
     
    	}
     
    	public PrintJob getPjob(){
    		if (pjob==null) end=true;
    		return pjob;
    	}
     
    	public void end() {
    		end=true;
    	}
     
    	LdtPage page = null;
    	LdtRowCursor documentCursor=null;
    	LdtRowCursor pageCursor=null;
    	public void printPage(LdtPage _page, LdtRowCursor documentCursor, LdtRowCursor pageCursor) {
    		while (page != null) { Thread.yield();}
    		this.documentCursor=documentCursor;
    		this.pageCursor=pageCursor;
    		page = _page;
    		while (page!=null) { Thread.yield();}
    	}
     
    	private void printPage() {
    		synchronized(page){
    			page.displayRowCursor(documentCursor,pageCursor);
    			Graphics pg = null;
    			pg = pjob.getGraphics();
    			pg.clearRect(0,0,1000, 2000);
    			page.printAll(pg);
    			pg.dispose();
    			page = null;
    		}
    	}
     
    	String documentName = "";
    	public void run() {
    		Properties properties = new Properties();
    		try {
    			Thread.sleep(2000);
    			pjob=Toolkit.getDefaultToolkit().getPrintJob(new Frame(),documentName, properties);
    		}
    		catch (Throwable t) {
    		}
    		done=true;
    		try{
    		while (!end) {Thread.yield();
    			if (page!=null) {
    				printPage();
    			}
    		}
    		} catch (Throwable t)
    		{	page = null;
    		}
    		if (pjob!=null) {
    			pjob.end();
    			pjob.finalize();
    		}
    	}
    }

  2. #2
    Rιdacteur/Modιrateur

    Avatar de bouye
    Homme Profil pro
    Information Technologies Specialist (Scientific Computing)
    Inscrit en
    Aoϋt 2005
    Messages
    6 905
    Dιtails du profil
    Informations personnelles :
    Sexe : Homme
    Βge : 48
    Localisation : Nouvelle-Calιdonie

    Informations professionnelles :
    Activitι : Information Technologies Specialist (Scientific Computing)
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Aoϋt 2005
    Messages : 6 905
    Billets dans le blog
    54
    Par dιfaut
    Yerk ! Alors difficile de tester quoi que ce soit sans les classes LdtPrintManager , LdtPage et LdtRowCursor.

    Sinon tu peux essayer de :
    - commenter :
    -et/ou, remplacer :
    Code : Sιlectionner tout - Visualiser dans une fenκtre ΰ part
    pg.clearRect(0,0,1000, 2000);
    par :
    Code : Sιlectionner tout - Visualiser dans une fenκtre ΰ part
    1
    2
    pg.setColor(Color.white) //ou Color.WHITE si tu es sur un JRE plus recent.
    pg.fillRect(0,0,1000, 2000);
    Sinon, faudrai peut-etre voir s'il est possible de remplacer certains trucs par des appels a des classes plus recentes (enfin ca depend de ce que font les classes non-documentees en question).
    Merci de penser au tag quand une rιponse a ιtι apportιe ΰ votre question. Aucune rιponse ne sera donnιe ΰ des messages privιs portant sur des questions d'ordre technique. Les forums sont lΰ pour que vous y postiez publiquement vos problθmes.

    suivez mon blog sur Dιveloppez.

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. ~ Rich Cook

  3. #3
    Membre confirmι
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    204
    Dιtails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 204
    Par dιfaut imprimante sort des pages blanches
    merci bouye d'avoir rιpondu.
    mon problθme est que ce programme tourne sans problθme depuis 10 ans, mais si je recompile aujourd'hui, les impressions ne marchent pas.

    j'ai donc remplacι
    Code : Sιlectionner tout - Visualiser dans une fenκtre ΰ part
    1
    2
     
                pg.clearRect(0, 0, 1000, 2000);
    par
    Code : Sιlectionner tout - Visualiser dans une fenκtre ΰ part
    1
    2
    3
     
                pg.setColor(Color.WHITE);
                pg.fillRect(0,0,600,800);
    et de toutes noires mes pages sont devenue toutes blanches !!

    a tout hazard, je joins les classes qui vont avec:
    Code : Sιlectionner tout - Visualiser dans une fenκtre ΰ part
    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
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    package LDT;
    
    
    import java.awt.Adjustable;
    import java.awt.CardLayout;
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Event;
    import java.awt.Frame;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Panel;
    import java.awt.PrintJob;
    import java.awt.ScrollPane;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterJob;
    import java.sql.Connection;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Properties;
    import java.util.Vector;
    
    
    //**************************************************************************************
    public class LdtPrintManager extends Frame implements LdtRowObserver, Runnable
    //**************************************************************************************
    { 
    	
    	LdtRowCursor paramCursor;
    	LdtRowCursor documentCursor=null;
    	LdtRowCursor pageCursor;
    	
    	ScrollPane scrollPane;
    	StatusView statusView;
    	Panel cardPane;
    	
    	Connection connectionEdition;
    	Connection connectionData;
    	Statement statementEdition;
    	
    	Statement dataStatement;
    	
    	private String documentName;
    	
    	private static String lastDocumentName = "???";
    	private static LdtRowCursor lastDocumentCursor;
    	private static Vector lastPages;
    	
    	private Vector pages;
    	private LdtRow documentRow;		// definiton du document
    	
    	int currentDocumentPageNumber = 0;
    	
    	boolean doNotUpdateOnNotify = false;
    	
    	private boolean stopPrintJob = false;
    	
    	Thread thread;
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public LdtPrintManager(String title, LdtRowCursor paramCursor, String documentName)	//,Statement dataStatement
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{	super("Impression "+title);
    		addWindowListener(new LdtWindowAdapter());
    		
    		
    		this.paramCursor = paramCursor.duplicate();	// duplicate it if any change while printing (on ne sait pas d'ou vient le curseur, il peut κtre modifiι)
    		
    		this.documentName = documentName;
    		
    		statementEdition = getStatement();
    		dataStatement = getDataStatement();
    		
    		setLayout(new LdtBorderLayout());
    		
    		scrollPane = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS);
    		scrollPane.setBackground(Color.WHITE);
    		add(scrollPane,"Center");
    		
    		cardPane = new Panel();
    		cardPane.setLayout(new CardLayout());
    		scrollPane.add(cardPane);
    		
    		add(statusView = (new StatusView()),"North");
    		
    		setSize(630,440);
    
    
    		cardPane.setSize(850,850);
    
    		show();
    		
    		initDocument();
    		
    		updateAdjustable(scrollPane.getVAdjustable());
    		
    		statusView.setStatus("Pret a imprimer");
    		statusView.enableButtons();
    		
    	}
    	
    	// mise a jour de l'ajusteur vertical
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private void updateAdjustable(Adjustable adj)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		adj.setUnitIncrement(adj.getBlockIncrement()/20);
    	}
    	
    	// lecture de la dιfinition du document et prιparation des pages
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private void initDocument()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		if (statementEdition != null)
    		{
    			synchronized (this)
    			{
    				
    				// recherche des info's du document
    				LdtRowCursor documentCursor;
    				if (!lastDocumentName.equals(documentName))
    				{	String sqlSelect = "select * from documents where nomdocument = '"+LdtUtilities.ensureSqlValue(documentName)+"'";
    					documentCursor = new LdtRowCursor(statementEdition,sqlSelect,true);
    				}
    				else
    				{	documentCursor=lastDocumentCursor;
    					documentCursor.setPosition(0);
    				}
    				
    				if (documentCursor.size()==0)
    				{	LdtUtilities.notify(this,"Impression","Le document "+documentName+" est introuvable.");
    					return;
    				}
    				
    				// lecture de la definition du document
    				documentRow = documentCursor.getRow(0);
    				
    				pages = getAllPages(documentName);
    				showFirstPage();			
    				lastDocumentName = documentName;
    				lastDocumentCursor = documentCursor;
    			}
    		}
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private Vector getAllPages(String documentName)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		Vector vector = new Vector();
    		cardPane.removeAll();
    		
    		LdtRowCursor curs;
    		int i;
    		LdtPage page;
    		
    		if (!lastDocumentName.equals(documentName))
    		{
    			String sqlSelect = "select * from pages where nomdocument = '"+LdtUtilities.ensureSqlValue(documentName)+"' order by n_page";
    			curs = new LdtRowCursor(statementEdition,sqlSelect,true);
    			for (i=0; i<curs.size(); i++)
    			{
    				page = new LdtPage(statementEdition,curs.getRow(i),getToolkit().getScreenResolution(),210,297);
    	//			fillPage(false,page,curs.getRow(i));
    				vector.addElement(page);
    				cardPane.add(page,i+"");	//***
    			}
    			lastPages = vector;
    		}
    		else
    		{	vector = lastPages;
    			for (i=0; i<vector.size(); i++)
    			{	page=((LdtPage)vector.elementAt(i));
    				page.displayRowCursor(null, null);
    				cardPane.add(page,i+"");
    				page.setVisible(false);
    			}
    		}
    		
    		return vector;
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void addNotify()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{	super.addNotify();
    		LdtRowChangeListener.addObserver("documents",this);
    		LdtRowChangeListener.addObserver("pages",this);
    		LdtRowChangeListener.addObserver("compositions",this);
    		LdtRowChangeListener.addObserver("composants",this);
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void removeNotify()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{	super.removeNotify();
    		LdtRowChangeListener.removeObserver(this);
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void rowInserted(Object source, String rowClassName, LdtRow row)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		if (doNotUpdateOnNotify) return;
    		initDocument();
    	}
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void rowUpdated(Object source, String rowClassName, LdtRow row)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{	
    		if (doNotUpdateOnNotify) return;
    		initDocument();
    	}
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void rowDeleted(Object source, String rowClassName, LdtRow row)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		if (doNotUpdateOnNotify) return;
    		initDocument();
    	}
    	
    //	Rectangle scrollPaneDimension = null;
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public boolean action(Event e, Object arg)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		if (arg.equals(" > "))
    			showNextPage();
    		else if (arg.equals("<<"))
    			showFirstPage();
    		else if (arg.equals("Imprimer"))
    		{
    
    
    			if ((thread != null) && thread.isAlive())
    				thread.stop();
    			thread = new Thread(this);
    			onScreen = false;
    			thread.start();
    		}	
    		else if (arg.equals("Annuler"))
    		{
    			statusView.setStatus("Annulation en cours...");
    			dispose();
    		}
    		
    		else return false;
    		
    		return true;
    	}
    
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private void getDocumentCursor()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{	
    		if (documentRow.isFilled("traiteUnLot"))
    		{
    			documentCursor = paramCursor;
    			documentCursor.setStatement(dataStatement);
    		}
    		else
    		{
    			if (documentRow.isFilled("sqlquery"))
    			{
    				documentCursor = new LdtRowCursor(dataStatement, documentRow.getColumn("sqlquery"),paramCursor.getRow(),true);
    				if (documentCursor.size()==0) LdtUtilities.notify(this,"Impression","ATTENTION, les informations n'ont pas pu etre recuperees pour l'enregistrement "+paramCursor.getRow());
    			}
    			else
    			{
    				documentCursor = new LdtRowCursor(dataStatement);
    				documentCursor.addRow(paramCursor.getRow());
    			}
    		}
    	}
    	
    	boolean onScreen = true;
    	boolean pageStep = false;
    	boolean lastPage = false;
    	
    	// ne pas imprimer les pages suivantes
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void setLastPage(boolean last)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		lastPage = last;
    	}
    	
    	// imprimer les pages
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void printDocument()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{	
    		
    		
    		PrintJob pjob = null;
    		JobMan jobMan = null;
    
    		int pageResolution;
    		Dimension pageDimension;
    		
    		int numeroDePage = 0;
    		
    		doNotUpdateOnNotify = true;
    		
    		boolean firstTime = true;
    		
    		int firstPage=1;
    		int toPage=9999;
    		
    		try {
    		if (!statusView.fromPage.getText().equals("")) firstPage = Integer.parseInt(statusView.fromPage.getText());
    		} catch (Exception ex) {};
    		
    		try {
    		if (!statusView.toPage.getText().equals("")) toPage = Integer.parseInt(statusView.toPage.getText());
    		} catch (Exception ex) {};
    		
    		Properties properties = new Properties();
    		
    		try
    		{
    //			boolean onScreen = false;
    			if (!onScreen)
    			{
                    statusView.setStatus("Recherche de l'imprimante...");
    				try{		
                    jobMan = new JobMan(this);
                    pjob=jobMan.getPjob();
    				}
    				catch (Exception e) {
    					LdtUtilities.notify(this,"Impression","Desole, il n'est pas possible d'imprimer. ("+e.getMessage()+")");
    					onScreen = true;
    				}
    				catch (java.lang.Error e) {
    				}
    				if (pjob == null)
    				{	onScreen=true;
    
                    statusView.setStatus("Impression annulee!");
                    statusView.enableButtons();
                    return;
    				}
    				
    			}
    			
    			if (onScreen || (pjob != null)) {
    				if (pjob == null)
    				{
    					pageResolution = 72;				
    					pageDimension = new Dimension(600,800);
    				}
    				else
    				{
                        cardPane.setVisible(false);	//** 
    					pageResolution = pjob.getPageResolution();
    					pageDimension = pjob.getPageDimension();
    
    					pageResolution = 72;
    				}
    
    					for (int i=0; i<pages.size(); i++)	//** 
    					{												
    						((LdtPage)pages.elementAt(i)).setPageResolution(pageResolution);	 
    					}
    				LdtRow row;
    				
    				int printedPages = 0;
    				
    				paramCursor.setPosition(0);
    				int r;
    	        	
    				while ((paramCursor.getRow() != null) && !stopPrintJob)
                	{
    					
    					statusView.setStatus("Recherche en cours...");
    		
                		getDocumentCursor();	// valorise documentCursor
    					// foreach document datarow
    					while ((documentCursor.getRow() != null) && !stopPrintJob)
    					{
    						// foreach page
    						lastPage = false;
    						boolean toPrint;
    						int i,j;
    						for (i=0; (i<pages.size()) && !stopPrintJob && !lastPage;i++)
    						{
    							LdtPage page = (LdtPage)pages.elementAt(i);
    							//page.setBackground(Color.WHITE);
    
    							
    							pageCursor = page.getPageCursor(dataStatement,documentCursor);	// valorise le pageCursor
    							
    							
    							if (pageCursor.getRow() != null)
    								((CardLayout)cardPane.getLayout()).show(cardPane,i+"");
    							
    							while ((pageCursor.getRow() != null) && !stopPrintJob && !lastPage)
    							{
    								numeroDePage ++;
    								toPrint = (numeroDePage >= firstPage) && (numeroDePage <= toPage);
    								
    
    								if (onScreen || (jobMan != null) || !toPrint) 
    								{	
     									{
    									page.displayRowCursor(documentCursor,pageCursor);
    									
    								if (toPrint)
    								{
    									
    									if (pjob != null)
    									{											
    											// each 201 pages ask for a new printJob
    											if (printedPages>=3) {
    												//	c'est ici que se tient le nombre de pages qui dιconne							
    												printedPages = 0;
    												jobMan.end();
    												jobMan = new JobMan(this);
    												// il faut se repositionner ΰ la page 202 !!						
    												pjob = jobMan.getPjob();
    												if (pjob == null)
    												{	onScreen=true;
    													statusView.setStatus("Impression annulee!");
    													statusView.enableButtons();
    													return;
    												}
    											
    											}
    
    											jobMan.printPage(page, documentCursor, pageCursor);
    											
    											printedPages++;
    
    									}
    //									else page.repaint();
    									else
    									{
                                        page.displayRowCursor(documentCursor,pageCursor);
    										if (firstTime)
    										{
    											page.setPageResolution(pageResolution);
    											firstTime = false;
    										}
    //										else page.repaint();
    										page.repaint();
    									}
    								}
    	}								
     	statusView.setStatus("Page "+numeroDePage);
    
    
     	if (onScreen && toPrint)
     	{
    		
    	doNotUpdateOnNotify = false;
    	scrollPane.doLayout();			// pour rafraichir les scrollbars
    	statusView.enableButtons();
    	while ((!pageStep) && (!stopPrintJob))
    	synchronized(this)
    	{
    		try {
    			Thread.sleep(200);
    		}
    		catch (Exception exThread) { return; }
    	}
    	statusView.disableButtons(true);
    		firstPage = 1;
    		toPage = 9999;
    		try {
    		if (!statusView.fromPage.getText().equals("")) firstPage = Integer.parseInt(statusView.fromPage.getText());
    		} catch (Exception ex) {};
    		
    		try {
    		if (!statusView.toPage.getText().equals("")) toPage = Integer.parseInt(statusView.toPage.getText());
    		} catch (Exception ex) {};
    		doNotUpdateOnNotify = true;
    		pageStep = false;
    	}
    									
    								}
    								
    								if (numeroDePage == toPage) break;
    								if (!page.pageDefinition.getColumn("TraiteUnLot").equals("O"))
    									pageCursor.move(1);
    							}
    							
    							if (numeroDePage == toPage) break;
    						} // next page
    
    						//System.out.println("page suivante");
    					if (numeroDePage == toPage) break;
    
    						if (!documentRow.getColumn("TraiteUnLot").equals("O"))
    							documentCursor.move(1);
    
    					} // next documentCursor
    					if (numeroDePage == toPage) break;
    					paramCursor.move(1);
    
    				} // next paramCursor
    				if (numeroDePage-firstPage+1>1)
    					statusView.setStatus("Cette page est la derniere des "+(numeroDePage-firstPage+1)+" pages");
    				else statusView.setStatus("Cette page est la derniere");
    				if (pjob != null)
    				{
    						jobMan.end();
    				}
    			}
    		}
    		catch (Exception ex) { ex.printStackTrace();
    		LdtUtilities.notify(this, "Impression","L'impression n'est pas possible: "+ex.toString());}
    		doNotUpdateOnNotify = false;
            cardPane.setVisible(true);	//** 
    	}
    	
    	public void run()
    	{
    		statusView.disableButtons(false);
    		
    		printDocument();
    		
    		statusView.enableButtons();
    
    	}
    	
    	// montre la page suivante
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private void showNextPage()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    
    		synchronized(this)
    		{	
    			if ((thread != null) && thread.isAlive())
    				pageStep = true;
    			else getToolkit().beep();
    		}
    	}
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private void showFirstPage()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		
    		// should be called showFirstPage
    			if ((thread != null) && thread.isAlive())
    				thread.stop();
    			thread = new Thread(this);
    			onScreen = true;
    			thread.start();
    		
    	}
    	
    	// montre la page n
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private void showPage(int pageNumber)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		LdtPage page = (LdtPage)pages.elementAt(pageNumber);
    //		scrollPane.add(page);
            ((CardLayout)cardPane.getLayout()).show(cardPane,pageNumber+""); //***
    
    		page.displayRowCursor(null,null);
    		
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private Statement getStatement()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    //		connectionEdition = LdtUtilities.getConnection("Documents");
    		
    		connectionEdition = LdtUtilities.getRegisteredConnection("EDITConnection");
    		
    		if (connectionEdition == null)
    		{	LdtUtilities.notify(this,"Impression","La connection aux documents d'edition n'a pas pu etre etablie.");
    			return null;
    		}
    		Statement stat = null;
    		try { stat = connectionEdition.createStatement();}
    		catch (SQLException ex) { LdtUtilities.notify(this,"Impression",ex);}
    		return stat;
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private Statement getDataStatement()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    
    		
    		connectionData = LdtUtilities.getRegisteredConnection("AGILConnectionRO");
    		
    		if (connectionData == null)
    		{	LdtUtilities.notify(this,"Impression","La connection aux donnees n'a pas pu etre etablie.");
    			return null;
    		}
    		Statement stat = null;
    		try { stat = connectionData.createStatement();}
    		catch (SQLException ex) { LdtUtilities.notify(this,"Impression",ex);}
    		return stat;
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private LdtRow getPage(String documentName, String pageNumber)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		String sqlSelect = "select * from pages where nomdocument = '"+LdtUtilities.ensureSqlValue(documentName)+"' and n_page = "+pageNumber;
    		LdtRowCursor curs = new LdtRowCursor(statementEdition,sqlSelect,true);
    		return curs.getRow(0);
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void dispose()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{	
    		
    		if ((thread != null) && thread.isAlive())
    			stopPrintJob = true;
    		
    		while ((thread != null) && thread.isAlive())
    			Thread.yield();
    		
    		closeStatements();
    		
    		super.dispose();		
    	}
    	
    	private void closeStatements()
    	{
    		if (statementEdition != null)
    			try { statementEdition.close();} catch (SQLException ex) {};
    		
    		
    		if (dataStatement != null)
    			try { dataStatement.close();} catch (SQLException ex) {};
    		
    		
    	}
    	
    	
    	
    }
    
    package LDT;
    
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Panel;
    import java.awt.PrintJob;
    import java.awt.Rectangle;
    import java.awt.print.PageFormat;
    import java.awt.print.Printable;
    import java.awt.print.PrinterException;
    import java.awt.print.PrinterJob;
    import java.sql.Statement;
    import java.util.Properties;
    import java.util.Vector;
    
    
    //**************************************************************************************
    class LdtPage extends Panel  /*LdtRowCursorViewer, LdtRowDrawer*/ 
    //**************************************************************************************
    {
    	int width=0;
    	int height=0;
    	
    	int pageResolution;
    	
    	public LdtRow pageDefinition;
    	public Vector composantsDeFond;
    	public Vector composants;
    	
    	LdtRowCursor pageCursor;
    	Statement statementEdition;
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	LdtPage(Statement statementEdition, LdtRow pageDefinition, int pageResolution, int width, int height)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{	super();
    		setLayout(null);
    		this.pageDefinition = pageDefinition;
    		this.statementEdition = statementEdition;
    		setPreferredSize(width,height);
    		setPageResolution(pageResolution);
    		composantsDeFond = new Vector();
    		composants = new Vector();
    		
    		String documentName = pageDefinition.getColumn("nomDocument");
    		String pageNumber = pageDefinition.getColumn("n_page");
    		fillPage(false, documentName, pageNumber);
    		
    		if (pageDefinition.isFilled("n_pageDeFond"))
    		{
    			String nPageDeFond = pageDefinition.getColumn("n_pageDeFond");
    			fillPage(true, "FONDS DE PAGES", nPageDeFond);
    		}		
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	private void fillPage(boolean pageDeFond, String documentName, String pageNumber)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		
    		String sqlSelect =
    			"select 	p.n_ordre,p.conditionAffichage, p.nouveauX, p.nouveauY, p.modifiable, p.sqlSelect, p.consommateur,"+
    					"	c.designation, c.typecomposant, c.texte, c.x, c.y, c.largeur, c.hauteur, c.police, c.taille, c.style, c.alignement "+
    			" from compositions p, composants c " +
    			" where	p.nomDocument = '"+LdtUtilities.ensureSqlValue(documentName)+"' and p.N_Page = " + pageNumber +
    			" and p.nomComposant = c.nomComposant order by p.n_ordre";
    		
    		LdtRowCursor curs = new LdtRowCursor(statementEdition,sqlSelect,true);
    		
    		int i;
    		for (i=0; i<curs.size(); i++)
    		{
    			LdtRow row = curs.getRow(i);
    			
    			Component c = null;
    			
    			
    			if ((!row.isFilled("typecomposant")) || (row.getColumn("typecomposant")).equals("T"))
    				c = (Component) new LdtDrawTextComponent(row,getPageResolution());
    			else if ( (row.getColumn("typecomposant")).equals("C") )
    			{	Class compClass;
    				try{
    					// LDT 18-mar-2006 ajoutι "LDT." pour nouveau nom de package des classes de composants
    					compClass = Class.forName("LDT."+row.getColumn("designation"));
    					c = (Component)compClass.newInstance();
    					((LdtRowDrawer)c).setComponentDefinition(row);
    				}
    				catch (Exception ex)
    				{	ex.printStackTrace();
    					LdtUtilities.notify(this,"Chargement de composant","Le composant '"+row.getColumn("designation")+"' n' a pas ete trouve.");
    				}
    			}
    			
    			if (c!= null)
    			{
    				add(c);                    // c'est ici que ηa se tient !!!
    				
    				if (pageDeFond){
    					composantsDeFond.addElement(c);
    					// System.out.println(composantsDeFond.lastElement());
    				}
    				else composants.addElement(c);
    			}
    		}		
    
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public Dimension getPreferredSize()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		int k = pageResolution*100;
    		int _k = 2540;					// facteur de conversion mm -> pitch f(pageResolution)
    		return new Dimension ((width*k)/_k, (height*k)/_k);
    	}
    	
    	// set page size in mm NOT IN pixels
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
        public void setPreferredSize(int w, int h)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
        {
        	width = w;
        	height = h;
        }
        
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
        public int getPageResolution()
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
        {
        	return pageResolution;
        }
        
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void setPageResolution(int pageResolution)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		this.pageResolution = pageResolution;
    		setSize(getPreferredSize());
    		
    		int i;
    		for (i=0;i<getComponentCount() ;i++)
    		{
    			if (getComponent(i) instanceof LdtRowDrawer)
    				((LdtRowDrawer)getComponent(i)).setPageResolution(pageResolution);
    		}
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public LdtRowCursor getPageCursor(Statement dataStatement, LdtRowCursor pagesCursor)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		
    		LdtRowCursor pageCursor;
    		if (pageDefinition.getColumn("traiteUnLot").equals("O"))
    			pageCursor = pagesCursor;
    		else
    		{
    			if (pageDefinition.isFilled("sqlSelect"))
    			{
    				pageCursor = new LdtRowCursor(dataStatement, pageDefinition.getColumn("sqlSelect"), pagesCursor.getRow(),true);
    				if (pageCursor.size()==0) LdtUtilities.notify(this,"Impression","ATTENTION, les informations de la page "+pageDefinition.getColumn("titrePage")+" n'ont pas pu etre recuperees pour l'enregistrement "+pagesCursor.getRow());
    			}
    			else
    			{
    				pageCursor = new LdtRowCursor(dataStatement);
    				pageCursor.addRow(pagesCursor.getRow());
    			}
    		}
    		return pageCursor;
    	}
    	
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	public void displayRowCursor(LdtRowCursor documentCursor, LdtRowCursor pageCursor)
    	//ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ
    	{
    		int i;
    		for (i=0;i<composantsDeFond.size() ;i++)
    		{
    			((LdtRowCursorViewer)composantsDeFond.elementAt(i)).displayRowCursor(pageCursor);
    
    		}
    		for (i=0;i<composants.size() ;i++)
    		{
    			((LdtRowCursorViewer)composants.elementAt(i)).displayRowCursor(pageCursor);
    		}
    		
    	}
    	
    }

  4. #4
    Rιdacteur/Modιrateur

    Avatar de bouye
    Homme Profil pro
    Information Technologies Specialist (Scientific Computing)
    Inscrit en
    Aoϋt 2005
    Messages
    6 905
    Dιtails du profil
    Informations personnelles :
    Sexe : Homme
    Βge : 48
    Localisation : Nouvelle-Calιdonie

    Informations professionnelles :
    Activitι : Information Technologies Specialist (Scientific Computing)
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Aoϋt 2005
    Messages : 6 905
    Billets dans le blog
    54
    Par dιfaut
    C'est pas gagne... je ne comprend pas du tout pourquoi il imprime de cette maniere... celui qui avait fait ca avait des problemes avec l'utilisation de PrinterJob et de Printable ? Il utilise PrintJob a la place, une classe que je n'ai jamais manipule.

    Bon LdtPrintManager est la Frame chargee de recuperer et afficher le document et d'effectuer la mise en page en LdtPage (le tout entierement base en composants AWT).

    Bizarre quand meme, normalement ce qui est dessine dans le Graphics devrait l'etre apres les lignes que tu as modifie, hors a moins que la couleur ne soit jamais specifiee on devrait voir quelque chose ? Peux-tu essayer de rajouter un pg.setColor(Color.BLACK) juste apres ces deux lignes juste au cas ? Mais bon normalement c'est la methode d'impression de Component qui est appellee (LdtPage est un Panel - les classes commentees dans la declaration du extends l'etaient deja a l'origine ?) donc normalement elle devrait faire ca d'elle-meme.

    D'apres la doc de la methode getGraphics() dans PrintJob il faut effectivement faire pg.dispose(); car cela envoie la page sur l'imprimante. Au lieu de dessiner la page courante dedans, peux-tu essaye de dessiner ou d'ecrire du texte et voir si quelques chose en sort ? Si ca marche c'est que le probleme vient alors de la page.

    Code : Sιlectionner tout - Visualiser dans une fenκtre ΰ part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    Graphics pg = null;
    pg = pjob.getGraphics();
    pg.setColor(Color.WHITE);
    pg.fillRect(0,0,1000, 2000);
    //page.printAll(pg);
    pg.setColor(Color.BLUE);
    pg.drawRec(50, 50, 100, 100);
    pg.setColor(Color.BLACK);
    pg.drawString("blablablablablablablablablablablablablablablablabla", 20, 20);
    pg.dispose();
    page = null;
    Egalement l'ensemble est composee de composants AWT mais ceux-ci sont manipules dans une Thread a part. Mais bon c'est peut-etre normal (encore une fois je n'ai jamais manipule PrintJob)

    Concernant le probleme, il est apparu car :
    - vous avez change de JVM ?
    - vous change d'OS ?
    - vous avez change d'imprimante ou de pilotes d'imprimante ?
    - comme ca du jour au lendemain sans raison ?
    Merci de penser au tag quand une rιponse a ιtι apportιe ΰ votre question. Aucune rιponse ne sera donnιe ΰ des messages privιs portant sur des questions d'ordre technique. Les forums sont lΰ pour que vous y postiez publiquement vos problθmes.

    suivez mon blog sur Dιveloppez.

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning. ~ Rich Cook

  5. #5
    Membre confirmι
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    204
    Dιtails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 204
    Par dιfaut
    Non, nous n'avons pas changι d'OS, ni de pilotes d'imprimante, mais comme partout notre appli a besoin d'ιvoluer pour s'adapter, comme par exemple l'adresse E-mail du client qu'il nous faut stocker, alors qu'ΰ l'ιpoque cela n'ιtait pas considιrι comme important, et aussi pouvoir gιnιrer automatiquement des mails ΰ tout un groupe de clients, etc...
    De plus il y a 10 ans le standard des ιcrans ιtait le VGA ou encore le 800x600. Aujourd'hui on en est au 22 pouces et on peut afficher deux pages A4 en mκme temps. Donc faut ιvoluer.

    Autre chose, la base de donnιes est en POSTGRESQL 7.2. si je mouline l'appli avec le JRE 1.1, ηa marche.
    Si je passe la base en POSTGRESQL 7.4, avec le driver adιquat, et j'utilise le JRE 1.4, je n'ai plus d'impressions !!
    Il y a de quoi se la prendre et se la mordre !!
    (mais faut κtre souple, et moi qui ai commencι dans l'informatique avec les cartes perforιes, j'ai un peu de mal !)

    Encore merci bouye de t'κtre penchι sur mon problθme.

  6. #6
    Membre confirmι
    Profil pro
    Inscrit en
    Octobre 2006
    Messages
    204
    Dιtails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2006
    Messages : 204
    Par dιfaut
    PS j'ai oubliι de mentionner que ton rajout des lignes "blablabla...." fonctionne et que le problθme vient surement de la page.

Discussions similaires

  1. [CANON] Imprimante sort des pages blanches
    Par neo2k2 dans le forum Pιriphιriques
    Rιponses: 2
    Dernier message: 03/12/2008, 11h23
  2. Imprimante sort des pages blanches
    Par zaineb.z dans le forum Pιriphιriques
    Rιponses: 1
    Dernier message: 08/11/2008, 13h03
  3. [Imprimante HP EPL5800L] imprime des pages blanches toute seule
    Par devlopassion dans le forum Pιriphιriques
    Rιponses: 6
    Dernier message: 21/10/2007, 15h45
  4. [Sιrieux] Imprimante: page noire
    Par Asdorve dans le forum La taverne du Club : Humour et divers
    Rιponses: 4
    Dernier message: 22/02/2007, 10h59
  5. Rιponses: 2
    Dernier message: 03/10/2002, 17h24

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo