Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/fudaa/fudaa/vag/VagFilleGraphe.java


1   /*
2    * @file         VagFilleGraphe.java
3    * @creation     1999-02-23
4    * @modification $Date: 2001/11/22 16:02:50 $
5    * @license      GNU General Public License 2
6    * @copyright    (c)1998-2001 CETMEF 2 bd Gambetta F-60231 Compiegne
7    * @mail         devel@fudaa.org
8    */
9   
10  package org.fudaa.fudaa.vag;
11  
12  
13  import java.awt.*;
14  import java.awt.event.*;
15  import java.awt.print.*;
16  import javax.swing.*;
17  import javax.swing.event.*;
18  import java.beans.*;
19  
20  import com.memoire.bu.*;
21  
22  import org.fudaa.ebli.graphe.*;
23  import org.fudaa.ebli.impression.EbliPageable;
24  import org.fudaa.ebli.impression.EbliPageableDelegate;
25  import org.fudaa.ebli.impression.EbliPageFormat;
26  import org.fudaa.ebli.impression.EbliPrinter;
27  
28  
29  import org.fudaa.fudaa.commun.FudaaProjetInformations;
30  /**
31   * Une fenetre fille pour les graphes.
32   *
33   * @version      $Revision: 1.16 $ $Date: 2001/11/22 16:02:50 $ by $Author: deniger $
34   * @author       Axel von Arnim 
35   */
36  public class VagFilleGraphe
37         extends EbliFilleGraphe
38         implements ActionListener, PropertyChangeListener
39  {
40    //private BGraphe graphe_;
41    private BuToggleButton btPerso_;
42    private JInternalFrame popup_;
43  
44    public VagFilleGraphe(BuCommonInterface _app,BuInformationsDocument _id)
45    {
46      super("Graphe", true, false, true, true,_app,_id);
47      addInternalFrameListener(new InternalFrameAdapter() {
48        public void internalFrameClosing(InternalFrameEvent e)
49        {
50          if( popup_.isVisible() ) popup_.setVisible(false);
51          JDesktopPane pn=getDesktopPane();
52          if( pn !=null ) pn.remove(popup_);
53        }
54      });
55  
56      btPerso_=new BuToggleButton(BuResource.BU.getIcon("configurer"), "Graphe");
57      btPerso_.setToolTipText("Paramètres du graphe");
58      btPerso_.addActionListener(this);
59      popup_=new JInternalFrame("", false, false, false, false);
60      popup_.setOpaque(true);
61  
62      setBackground(Color.white);
63      graphe_=new BGraphe();
64      setPreferredSize(new Dimension(640, 480));
65      getContentPane().setLayout(new BorderLayout());
66      getContentPane().add(graphe_, BorderLayout.CENTER);
67    }
68    
69    public BGraphe getGraphe() { return graphe_; }
70    public void setGraphe(BGraphe _graphe) {
71      getContentPane().removeAll();
72      graphe_=_graphe;
73      getContentPane().add(graphe_, BorderLayout.CENTER);
74    }
75  
76    public String[] getEnabledActions()
77    {
78      String[] r=new String[] { "IMPRIMER","PREVISUALISER","MISEENPAGE" };
79      return r;
80    }
81    
82    public JComponent[] getSpecificTools()
83    {
84      JComponent[] r=new JComponent[1];
85      r[0]=btPerso_;
86      return r;
87    }
88    
89    public void actionPerformed(ActionEvent e)
90    {
91      Object src=e.getSource();
92      if( src==btPerso_ ) {
93        Graphe g=graphe_.getGraphe();
94        if( g==null ) return;
95        if( btPerso_.isSelected() ) {
96          BGraphePersonnaliseur p=new BGraphePersonnaliseur(g);
97          p.addPropertyChangeListener(this);
98          p.setOpaque(true);
99          popup_.getContentPane().removeAll();
100         popup_.getContentPane().add(p);
101         popup_.pack();
102         popup_.setVisible(true);
103         getDesktopPane().add(popup_);
104         try {
105           popup_.setSelected(true);
106         } catch( PropertyVetoException pve ) {}
107       } else {
108         popup_.setVisible(false);
109         getDesktopPane().remove(popup_);
110       }
111     }
112   }
113   
114   public void propertyChange(PropertyChangeEvent e)
115   {
116     Object src=e.getSource();
117     if( src instanceof BGraphePersonnaliseur ) {
118       graphe_.fullRepaint();
119     }
120   }
121 
122 /*   public void print(PrintJob _job,Graphics _g)
123   {
124     BuPrinter.INFO_DOC     =new BuInformationsDocument();
125     BuPrinter.INFO_DOC.name=getTitle();
126     BuPrinter.INFO_DOC.logo=null;//BuResource.BU.getIcon("tableau",24);
127     BuPrinter.printComponent(_job,_g,graphe_);
128   }
129 
130 
131   public int print(Graphics _g,PageFormat _format, int _page)
132   { 
133     if(_page!=0) return Printable.NO_SUCH_PAGE;
134     EbliPrinter.printBGraphe(_g,_format,graphe_);
135     return Printable.PAGE_EXISTS;
136   }
137   
138   public int getNumberOfPages()
139   {    
140     return 1;
141   }*/
142   
143 }