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

Quick Search    Search Deep

Source code: com/memoire/bu/BuApplet.java


1   /**
2    * @modification $Date: 2001/12/03 16:28:07 $
3    * @statut       unstable
4    * @file         BuApplet.java
5    * @version      0.36
6    * @author       Guillaume Desnoix
7    * @email        guillaume@desnoix.com
8    * @license      GNU General Public License 2 (GPL2)
9    * @copyright    1998-2001 Guillaume Desnoix
10   */
11  
12  package com.memoire.bu;
13  
14  import com.memoire.bu.*;
15  import com.memoire.dnd.*;
16  import com.memoire.fu.*;
17  import com.memoire.re.*;
18  
19  
20  import java.applet.*;
21  import java.awt.*;
22  import java.awt.event.*;
23  import java.beans.*;
24  
25  import javax.swing.*;
26  import javax.swing.event.*;
27  import javax.swing.border.*;
28  
29  /**
30   * A root class for applets.
31   * Compatible with Bu et Swing.
32   * Delegates quite everything to BuCommonImplementation.
33   */
34  
35  public class BuApplet
36         extends JApplet
37         implements BuCommonInterface, WindowListener, InternalFrameListener
38  {
39    public BuApplet()
40    {
41      super();
42      getRootPane().putClientProperty
43        ("defeatSystemEventQueueCheck",Boolean.TRUE);
44      setImplementation(new BuCommonImplementation());
45    }
46  
47    public void init()
48    {
49      implementation_.init();
50    }
51  
52    public void start()
53    {
54      implementation_.start();
55    }
56  
57    // Implementation
58  
59    protected BuCommonImplementation implementation_;
60  
61    public BuCommonImplementation getImplementation()
62    { return implementation_; }
63  
64    public void setImplementation(BuCommonImplementation _implementation)
65    {
66      implementation_=_implementation;
67      implementation_.setApp(this);
68    }
69  
70    // App
71  
72    public BuCommonInterface getApp()
73    { return this; }
74  
75    // Main Panel
76  
77    public BuMainPanel getMainPanel()
78    { return implementation_.getMainPanel(); }
79  
80    public void setMainPanel(BuMainPanel _p)
81    { implementation_.setMainPanel(_p); }
82  
83    // Main MenuBar
84  
85    public BuMenuBar getMainMenuBar()
86    { return implementation_.getMainMenuBar(); }
87  
88    public void setMainMenuBar(BuMenuBar _mb)
89    { implementation_.setMainMenuBar(_mb); }
90  
91    // Main ToolBar
92  
93    public BuToolBar getMainToolBar()
94    { return implementation_.getMainToolBar(); }
95  
96    public void setMainToolBar(BuToolBar _tb)
97    { implementation_.setMainToolBar(_tb); }
98  
99    // Specific Bar
100 
101   public BuSpecificBar getSpecificBar()
102   { return implementation_.getSpecificBar(); }
103 
104   public void setSpecificBar(BuSpecificBar _sb)
105   { implementation_.setSpecificBar(_sb); }
106 
107   // Action
108 
109   public void actionPerformed(ActionEvent _evt)
110   { implementation_.actionPerformed(_evt); }
111 
112   // Divers
113 
114   public BuInformationsSoftware getInformationsSoftware()
115   { return implementation_.getInformationsSoftware(); }
116 
117   public void setTitle(String _s)
118   {
119     System.out.println("setTitle("+_s+")");
120     AppletContext ac=getAppletContext();
121     if(ac!=null) ac.showStatus(_s);
122   }
123 
124   public Frame getFrame()
125   {
126     Frame r=null;
127 
128     Component c=this;
129     do
130     {
131       c=c.getParent();
132       if(c instanceof Frame) { r=(Frame)c; break; }
133     }
134     while(c!=null);
135 
136     return r;
137   }
138 
139   public void setLookAndFeel(String _lnf)
140   { implementation_.setLookAndFeel(_lnf); }
141 
142   public void removeAction(String _cmd)
143   { implementation_.removeAction(_cmd); }
144 
145   public void setEnabledForAction(String _cmd, boolean _enabled)
146   { implementation_.setEnabledForAction(_cmd,_enabled); }
147 
148   public void setCheckedForAction(String _cmd, boolean _enabled)
149   { implementation_.setCheckedForAction(_cmd,_enabled); }
150 
151   public void showOrHide(String _cmd, JComponent _c)
152   { implementation_.showOrHide(_cmd,_c); }
153 
154   public boolean confirmExit()
155   { return implementation_.confirmExit(); }
156 
157   public void displayURL(String _url)
158   {
159     if(_url!=null)
160       getAppletContext().showDocument(getDocumentBase(),_url);
161   }
162 
163   public void setVisible(boolean _visible)
164   {
165     if(_visible)
166     {
167       BuLib.setDoubleBuffered(getMainMenuBar(),false);
168       BuLib.setDoubleBuffered(getMainToolBar(),false);
169       BuLib.setDoubleBuffered(getMainPanel  (),false);
170     }
171     super.setVisible(_visible);
172   }
173 
174   // Commands
175 
176   public void about()
177   { implementation_.about(); }
178 
179   public void cut()
180   { implementation_.cut(); }
181 
182   public void copy()
183   { implementation_.copy(); }
184 
185   public void exit()
186   { 
187     BuInformationsSoftware il=getInformationsSoftware();
188     BuDialogConfirmation   bd=new BuDialogConfirmation
189       (this,il,"Voulez-vous vraiment quitter ce logiciel ?");
190 
191     int r=bd.activate();
192     if(r==JOptionPane.YES_OPTION)
193       getAppletContext().showDocument(getDocumentBase(),"quitter.html");
194   }
195 
196   public void license()
197   { implementation_.license(); }
198 
199   public void duplicate()
200   { implementation_.duplicate(); }
201 
202   public void find()
203   { implementation_.find(); }
204 
205   public void paste()
206   { implementation_.paste(); }
207 
208   public void print()
209   {
210     BuInformationsSoftware il=getInformationsSoftware();
211     BuDialogError          bd=new BuDialogError
212       (this,il,"L'impression n'est pas disponible dans une appliquette.");
213   }
214 
215   public void redo()
216   { implementation_.redo(); }
217 
218   public void replace()
219   { implementation_.replace(); }
220 
221   public void select()
222   { implementation_.select(); }
223 
224   public void undo()
225   { implementation_.undo(); }
226 
227   // Window
228 
229   public void windowActivated(WindowEvent _evt)
230   { implementation_.windowActivated(_evt); }
231 
232   public void windowClosed(WindowEvent _evt)
233   { implementation_.windowClosed(_evt); }
234 
235   public void windowClosing(WindowEvent _evt)
236   { implementation_.windowClosing(_evt);  }
237 
238   public void windowDeactivated(WindowEvent _evt)
239   { implementation_.windowDeactivated(_evt); }
240 
241   public void windowDeiconified(WindowEvent _evt)
242   { implementation_.windowDeiconified(_evt); }
243 
244   public void windowIconified(WindowEvent _evt)
245   { implementation_.windowIconified(_evt); }
246 
247   public void windowOpened(WindowEvent _evt)
248   { implementation_.windowOpened(_evt); }
249 
250   // InternalFrame
251 
252   public void internalFrameActivated(InternalFrameEvent _evt)
253   { implementation_.internalFrameActivated(_evt); }
254 
255   public void internalFrameDeactivated(InternalFrameEvent _evt)
256   { implementation_.internalFrameDeactivated(_evt); }
257 
258   public void internalFrameClosed(InternalFrameEvent _evt)
259   { implementation_.internalFrameClosed(_evt); }
260 
261   public void internalFrameClosing(InternalFrameEvent _evt)
262   { implementation_.internalFrameClosing(_evt); }
263 
264   public void internalFrameDeiconified(InternalFrameEvent _evt)
265   { implementation_.internalFrameDeiconified(_evt); }
266 
267   public void internalFrameIconified(InternalFrameEvent _evt)
268   { implementation_.internalFrameIconified(_evt); }
269 
270   public void internalFrameOpened(InternalFrameEvent _evt)
271   { implementation_.internalFrameOpened(_evt); }
272 }
273