113efc523SAndrew Rist /**************************************************************
2*d3be6617Smseidel  *
313efc523SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
413efc523SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
513efc523SAndrew Rist  * distributed with this work for additional information
613efc523SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
713efc523SAndrew Rist  * to you under the Apache License, Version 2.0 (the
813efc523SAndrew Rist  * "License"); you may not use this file except in compliance
913efc523SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*d3be6617Smseidel  *
1113efc523SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*d3be6617Smseidel  *
1313efc523SAndrew Rist  * Unless required by applicable law or agreed to in writing,
1413efc523SAndrew Rist  * software distributed under the License is distributed on an
1513efc523SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
1613efc523SAndrew Rist  * KIND, either express or implied.  See the License for the
1713efc523SAndrew Rist  * specific language governing permissions and limitations
1813efc523SAndrew Rist  * under the License.
19*d3be6617Smseidel  *
2013efc523SAndrew Rist  *************************************************************/
2113efc523SAndrew Rist 
2213efc523SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir package com.sun.star.wiki;
25cdf0e10cSrcweir 
26cdf0e10cSrcweir import com.sun.star.awt.XControl;
27cdf0e10cSrcweir import com.sun.star.awt.XControlModel;
28cdf0e10cSrcweir import com.sun.star.awt.XDialog;
29cdf0e10cSrcweir import com.sun.star.awt.XWindowPeer;
30cdf0e10cSrcweir import com.sun.star.beans.UnknownPropertyException;
31cdf0e10cSrcweir import com.sun.star.beans.XPropertySet;
32cdf0e10cSrcweir import com.sun.star.container.XNameContainer;
33cdf0e10cSrcweir import com.sun.star.lang.WrappedTargetException;
34cdf0e10cSrcweir import com.sun.star.lang.XMultiComponentFactory;
35cdf0e10cSrcweir import com.sun.star.lang.XMultiServiceFactory;
36cdf0e10cSrcweir import com.sun.star.lang.EventObject;
37cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
38cdf0e10cSrcweir import com.sun.star.uno.XComponentContext;
39cdf0e10cSrcweir import java.util.Hashtable;
40cdf0e10cSrcweir 
41cdf0e10cSrcweir public class WikiPropDialog extends WikiDialog{
42*d3be6617Smseidel 
43cdf0e10cSrcweir     WikiEditorImpl m_aWikiEditor;
44cdf0e10cSrcweir 
45cdf0e10cSrcweir     private final String sSendMethod = "Send";
46cdf0e10cSrcweir     private final String sWikiListMethod = "WikiListChange";
47cdf0e10cSrcweir     private final String sArticleTextMethod = "ArticleTextChange";
48cdf0e10cSrcweir     private final String sAddWikiMethod = "AddWiki";
49*d3be6617Smseidel 
50cdf0e10cSrcweir     String[] m_pMethods = {sSendMethod, sWikiListMethod, sArticleTextMethod, sAddWikiMethod};
51*d3be6617Smseidel 
52cdf0e10cSrcweir     private String m_sWikiTitle = "";
53cdf0e10cSrcweir     protected String m_sWikiEngineURL = "";
54cdf0e10cSrcweir     protected String m_sWikiComment = "";
55cdf0e10cSrcweir     protected boolean m_bWikiMinorEdit = false;
56*d3be6617Smseidel 
57cdf0e10cSrcweir     /** Creates a new instance of WikiPropDialog */
WikiPropDialog(XComponentContext xContext, String DialogURL, WikiEditorImpl aWikiEditorForThrobber )58cdf0e10cSrcweir     public WikiPropDialog(XComponentContext xContext, String DialogURL, WikiEditorImpl aWikiEditorForThrobber )
59cdf0e10cSrcweir     {
60cdf0e10cSrcweir         super(xContext, DialogURL);
61cdf0e10cSrcweir         super.setMethods(m_pMethods);
62cdf0e10cSrcweir 
63cdf0e10cSrcweir         if ( aWikiEditorForThrobber != null )
64cdf0e10cSrcweir         {
65*d3be6617Smseidel             InsertThrobber( 244, 122, 10, 10 );
66cdf0e10cSrcweir             m_aWikiEditor = aWikiEditorForThrobber;
67cdf0e10cSrcweir         }
68cdf0e10cSrcweir 
69cdf0e10cSrcweir         InitStrings( xContext );
70cdf0e10cSrcweir         InitShowBrowser( xContext );
71cdf0e10cSrcweir         InitControls( xContext );
72cdf0e10cSrcweir     }
73cdf0e10cSrcweir 
InitControls( XComponentContext xContext )74cdf0e10cSrcweir     private void InitControls( XComponentContext xContext )
75cdf0e10cSrcweir     {
76cdf0e10cSrcweir         try
77cdf0e10cSrcweir         {
78cdf0e10cSrcweir             GetPropSet( "CommentText" ).setPropertyValue( "AutoVScroll", Boolean.TRUE );
79cdf0e10cSrcweir         }
80cdf0e10cSrcweir         catch( Exception e )
81cdf0e10cSrcweir         {
82cdf0e10cSrcweir             e.printStackTrace();
83cdf0e10cSrcweir         }
84cdf0e10cSrcweir     }
85*d3be6617Smseidel 
InitStrings( XComponentContext xContext )86cdf0e10cSrcweir     private void InitStrings( XComponentContext xContext )
87cdf0e10cSrcweir     {
88cdf0e10cSrcweir         try
89cdf0e10cSrcweir         {
90cdf0e10cSrcweir             SetTitle( Helper.GetLocalizedString( xContext, Helper.DLG_SENDTITLE ) );
91cdf0e10cSrcweir             GetPropSet( "Label1" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_LABEL1 ) );
92cdf0e10cSrcweir             GetPropSet( "FixedLine2" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_WIKIARTICLE ) );
93cdf0e10cSrcweir             GetPropSet( "Label2" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_LABEL2 ) );
94cdf0e10cSrcweir             GetPropSet( "Label3" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_LABEL3 ) );
95cdf0e10cSrcweir             GetPropSet( "MinorCheck" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_MINORCHECK ) );
96cdf0e10cSrcweir             GetPropSet( "BrowserCheck" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_BROWSERCHECK ) );
97cdf0e10cSrcweir             GetPropSet( "AddButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_ADDBUTTON ) );
98cdf0e10cSrcweir             GetPropSet( "SendButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDBUTTON ) );
99cdf0e10cSrcweir         }
100cdf0e10cSrcweir         catch( Exception e )
101cdf0e10cSrcweir         {
102cdf0e10cSrcweir             e.printStackTrace();
103cdf0e10cSrcweir         }
104cdf0e10cSrcweir     }
105*d3be6617Smseidel 
InitShowBrowser( XComponentContext xContext )106cdf0e10cSrcweir     private void InitShowBrowser( XComponentContext xContext )
107cdf0e10cSrcweir     {
108cdf0e10cSrcweir         try
109cdf0e10cSrcweir         {
110cdf0e10cSrcweir             GetPropSet( "BrowserCheck" ).setPropertyValue( "State", new Short( Helper.GetShowInBrowserByDefault( m_xContext ) ? (short)1 : (short)0 ) );
111cdf0e10cSrcweir         }
112cdf0e10cSrcweir         catch( Exception e )
113cdf0e10cSrcweir         {
114cdf0e10cSrcweir             e.printStackTrace();
115cdf0e10cSrcweir         }
116cdf0e10cSrcweir     }
117cdf0e10cSrcweir 
show()118cdf0e10cSrcweir     public boolean show()
119cdf0e10cSrcweir     {
120cdf0e10cSrcweir         EnableControls( true );
121cdf0e10cSrcweir         boolean bResult = super.show();
122cdf0e10cSrcweir 
123cdf0e10cSrcweir         if ( bResult && Helper.GetShowInBrowserByDefault( m_xContext ) )
124*d3be6617Smseidel            Helper.ShowURLInBrowser( m_xContext, m_sWikiEngineURL + "index.php?title=" + m_sWikiTitle );
125cdf0e10cSrcweir 
126cdf0e10cSrcweir         return bResult;
127cdf0e10cSrcweir     }
128cdf0e10cSrcweir 
ThreadStop( boolean bSelf )129cdf0e10cSrcweir     public synchronized void ThreadStop( boolean bSelf )
130cdf0e10cSrcweir     {
131cdf0e10cSrcweir         boolean bShowError = ( !bSelf && m_aThread != null && !m_bThreadFinished );
132cdf0e10cSrcweir 
133cdf0e10cSrcweir         super.ThreadStop( bSelf );
134cdf0e10cSrcweir 
135cdf0e10cSrcweir         if ( bShowError )
136cdf0e10cSrcweir             Helper.ShowError( m_xContext,
137cdf0e10cSrcweir                               m_xDialog,
138cdf0e10cSrcweir                               Helper.DLG_SENDTITLE,
139cdf0e10cSrcweir                               Helper.CANCELSENDING_ERROR,
140cdf0e10cSrcweir                               null,
141cdf0e10cSrcweir                               false );
142cdf0e10cSrcweir     }
143cdf0e10cSrcweir 
fillWikiList()144cdf0e10cSrcweir     public void fillWikiList()
145cdf0e10cSrcweir     {
146cdf0e10cSrcweir         String [] WikiList = m_aSettings.getWikiURLs();
147*d3be6617Smseidel 
148cdf0e10cSrcweir         try
149cdf0e10cSrcweir         {
150cdf0e10cSrcweir             XPropertySet xPS = GetPropSet("WikiList");
151cdf0e10cSrcweir             xPS.setPropertyValue("StringItemList", WikiList);
152cdf0e10cSrcweir             // short [] nSel = new short[1];
153cdf0e10cSrcweir             // nSel[0] = (short) m_aSettings.getLastUsedWikiServer();
154cdf0e10cSrcweir             // xPS.setPropertyValue("SelectedItems", sel);
155cdf0e10cSrcweir         }
156cdf0e10cSrcweir         catch (Exception ex)
157cdf0e10cSrcweir         {
158cdf0e10cSrcweir             ex.printStackTrace();
159*d3be6617Smseidel         }
160cdf0e10cSrcweir     }
161*d3be6617Smseidel 
fillDocList()162cdf0e10cSrcweir     public void fillDocList()
163cdf0e10cSrcweir     {
164cdf0e10cSrcweir         XPropertySet xPS = GetPropSet("ArticleText");
165cdf0e10cSrcweir         try
166cdf0e10cSrcweir         {
167cdf0e10cSrcweir             short [] sel = (short[]) GetPropSet("WikiList").getPropertyValue("SelectedItems");
168cdf0e10cSrcweir             xPS.setPropertyValue("StringItemList", m_aSettings.getWikiDocList(sel[0], 5));
169cdf0e10cSrcweir         }
170cdf0e10cSrcweir         catch (Exception ex)
171cdf0e10cSrcweir         {
172cdf0e10cSrcweir             ex.printStackTrace();
173cdf0e10cSrcweir         }
174cdf0e10cSrcweir     }
175*d3be6617Smseidel 
176*d3be6617Smseidel 
GetWikiTitle()177cdf0e10cSrcweir     public String GetWikiTitle()
178cdf0e10cSrcweir     {
179cdf0e10cSrcweir         return m_sWikiTitle;
180cdf0e10cSrcweir     }
181cdf0e10cSrcweir 
SetWikiTitle(String sArticle)182cdf0e10cSrcweir     public void SetWikiTitle(String sArticle)
183cdf0e10cSrcweir     {
184cdf0e10cSrcweir         m_sWikiTitle = sArticle;
185cdf0e10cSrcweir         try
186cdf0e10cSrcweir         {
187cdf0e10cSrcweir             XPropertySet xPS = GetPropSet("ArticleText");
188cdf0e10cSrcweir             xPS.setPropertyValue("Text", sArticle);
189cdf0e10cSrcweir         }
190cdf0e10cSrcweir         catch (Exception ex)
191cdf0e10cSrcweir         {
192cdf0e10cSrcweir             ex.printStackTrace();
193*d3be6617Smseidel         }
194cdf0e10cSrcweir     }
195*d3be6617Smseidel 
196cdf0e10cSrcweir 
switchSendButtonIfNecessary()197cdf0e10cSrcweir     public void switchSendButtonIfNecessary()
198cdf0e10cSrcweir     {
199cdf0e10cSrcweir         XPropertySet xSendButton = GetPropSet( "SendButton" );
200cdf0e10cSrcweir         if ( xSendButton != null )
201cdf0e10cSrcweir         {
202cdf0e10cSrcweir             XPropertySet xWikiListProps = GetPropSet( "WikiList" );
203cdf0e10cSrcweir             XPropertySet xArticleProps = GetPropSet( "ArticleText" );
204cdf0e10cSrcweir             if ( xWikiListProps != null && xArticleProps != null )
205cdf0e10cSrcweir             {
206cdf0e10cSrcweir                 try
207cdf0e10cSrcweir                 {
208cdf0e10cSrcweir                     short [] pSel = (short[]) GetPropSet("WikiList").getPropertyValue("SelectedItems");
209cdf0e10cSrcweir                     String sArticle = (String)xArticleProps.getPropertyValue( "Text" );
210cdf0e10cSrcweir                     if ( pSel != null && pSel.length > 0 && sArticle != null && sArticle.length() != 0 )
211cdf0e10cSrcweir                         xSendButton.setPropertyValue( "Enabled", Boolean.TRUE );
212cdf0e10cSrcweir                     else
213cdf0e10cSrcweir                         xSendButton.setPropertyValue( "Enabled", Boolean.FALSE );
214cdf0e10cSrcweir                 }
215cdf0e10cSrcweir                 catch (Exception ex)
216cdf0e10cSrcweir                 {
217cdf0e10cSrcweir                     ex.printStackTrace();
218cdf0e10cSrcweir                 }
219cdf0e10cSrcweir             }
220cdf0e10cSrcweir         }
221cdf0e10cSrcweir     }
222cdf0e10cSrcweir 
EnableControls( boolean bEnable )223cdf0e10cSrcweir     public void EnableControls( boolean bEnable )
224cdf0e10cSrcweir     {
225cdf0e10cSrcweir         try
226cdf0e10cSrcweir         {
227cdf0e10cSrcweir             String[] pControls = { "WikiList",
228cdf0e10cSrcweir                                    "ArticleText",
229cdf0e10cSrcweir                                    "CommentText",
230cdf0e10cSrcweir                                    "MinorCheck",
231cdf0e10cSrcweir                                    "BrowserCheck",
232cdf0e10cSrcweir                                    "HelpButton",
233cdf0e10cSrcweir                                    "AddButton" };
234cdf0e10cSrcweir 
235cdf0e10cSrcweir             for ( int nInd = 0; nInd < pControls.length; nInd++ )
236cdf0e10cSrcweir                 GetPropSet( pControls[nInd] ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
237cdf0e10cSrcweir 
238cdf0e10cSrcweir             if ( bEnable )
239cdf0e10cSrcweir             {
240cdf0e10cSrcweir                 SetFocusTo( "WikiList" );
241cdf0e10cSrcweir                 switchSendButtonIfNecessary();
242cdf0e10cSrcweir             }
243cdf0e10cSrcweir             else
244cdf0e10cSrcweir             {
245cdf0e10cSrcweir                 GetPropSet( "SendButton" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
246cdf0e10cSrcweir                 SetFocusTo( "CancelButton" );
247cdf0e10cSrcweir             }
248cdf0e10cSrcweir         }
249cdf0e10cSrcweir         catch (Exception ex)
250cdf0e10cSrcweir         {
251cdf0e10cSrcweir             ex.printStackTrace();
252cdf0e10cSrcweir         }
253cdf0e10cSrcweir     }
254*d3be6617Smseidel 
callHandlerMethod( XDialog xDialog, Object EventObject, String MethodName )255cdf0e10cSrcweir     public boolean callHandlerMethod( XDialog xDialog, Object EventObject, String MethodName )
256cdf0e10cSrcweir     {
257cdf0e10cSrcweir         if ( MethodName.equals( sSendMethod ) )
258cdf0e10cSrcweir         {
259cdf0e10cSrcweir             try
260cdf0e10cSrcweir             {
261cdf0e10cSrcweir                 XPropertySet aWikiListProps = GetPropSet( "WikiList" );
262cdf0e10cSrcweir                 XPropertySet aArticleTextProps = GetPropSet( "ArticleText" );
263cdf0e10cSrcweir                 XPropertySet aCommentTextProps = GetPropSet( "CommentText" );
264cdf0e10cSrcweir                 XPropertySet aMinorCheckProps = GetPropSet( "MinorCheck" );
265cdf0e10cSrcweir                 XPropertySet aBrowserCheckProps = GetPropSet( "BrowserCheck" );
266cdf0e10cSrcweir 
267cdf0e10cSrcweir                 short [] sel = (short[]) aWikiListProps.getPropertyValue("SelectedItems");
268cdf0e10cSrcweir                 String [] items = (String []) aWikiListProps.getPropertyValue("StringItemList");
269cdf0e10cSrcweir                 m_sWikiEngineURL = items[sel[0]];
270cdf0e10cSrcweir                 m_aSettings.setLastUsedWikiServer(sel[0]);
271cdf0e10cSrcweir                 m_sWikiTitle = (String) aArticleTextProps.getPropertyValue("Text");
272cdf0e10cSrcweir                 m_sWikiComment = (String) aCommentTextProps.getPropertyValue("Text");
273cdf0e10cSrcweir 
274cdf0e10cSrcweir                 short minorState = ((Short) aMinorCheckProps.getPropertyValue("State")).shortValue();
275cdf0e10cSrcweir                 if (minorState != 0)
276cdf0e10cSrcweir                     m_bWikiMinorEdit = true;
277*d3be6617Smseidel                 else
278cdf0e10cSrcweir                     m_bWikiMinorEdit = false;
279*d3be6617Smseidel 
280cdf0e10cSrcweir                 short nBrowserState = ((Short) aBrowserCheckProps.getPropertyValue("State")).shortValue();
281cdf0e10cSrcweir                 Helper.SetShowInBrowserByDefault( m_xContext, nBrowserState != 0 );
282cdf0e10cSrcweir 
283cdf0e10cSrcweir                 // allow to disable other buttons
284cdf0e10cSrcweir                 EnableControls( false );
285cdf0e10cSrcweir             }
286cdf0e10cSrcweir             catch (Exception ex)
287cdf0e10cSrcweir             {
288cdf0e10cSrcweir                 ex.printStackTrace();
289cdf0e10cSrcweir             }
290cdf0e10cSrcweir 
291cdf0e10cSrcweir             final WikiPropDialog aThisDialog = this;
292cdf0e10cSrcweir             final XDialog xDialogToClose = xDialog;
293cdf0e10cSrcweir             final XComponentContext xContext = m_xContext;
294cdf0e10cSrcweir 
295cdf0e10cSrcweir             // start spinning
296cdf0e10cSrcweir             SetThrobberVisible( true );
297cdf0e10cSrcweir             SetThrobberActive( true );
298*d3be6617Smseidel 
299cdf0e10cSrcweir             // the following method might show a dialog, should be used in main thread
300cdf0e10cSrcweir             final Hashtable aWikiSettings = m_aSettings.getSettingByUrl( m_sWikiEngineURL );
301cdf0e10cSrcweir             if ( Helper.AllowThreadUsage( m_xContext ) )
302cdf0e10cSrcweir             {
303cdf0e10cSrcweir                 m_aThread = new Thread( "com.sun.star.thread.WikiEditorSendingThread" )
304cdf0e10cSrcweir                 {
305cdf0e10cSrcweir                     public void run()
306cdf0e10cSrcweir                     {
307cdf0e10cSrcweir                         try
308cdf0e10cSrcweir                         {
309cdf0e10cSrcweir                             if ( m_aWikiEditor != null )
310cdf0e10cSrcweir                             {
311cdf0e10cSrcweir                                 Thread.yield();
312cdf0e10cSrcweir                                 m_bAction = m_aWikiEditor.SendArticleImpl( aThisDialog, aWikiSettings );
313cdf0e10cSrcweir                             }
314cdf0e10cSrcweir                         }
315cdf0e10cSrcweir                         finally
316cdf0e10cSrcweir                         {
317cdf0e10cSrcweir                             EnableControls( true );
318cdf0e10cSrcweir                             SetThrobberActive( false );
319cdf0e10cSrcweir                             SetThrobberVisible( false );
320cdf0e10cSrcweir 
321cdf0e10cSrcweir                             ThreadStop( true );
322cdf0e10cSrcweir                             if ( m_bAction )
323cdf0e10cSrcweir                                 MainThreadDialogExecutor.Close( xContext, xDialogToClose );
324cdf0e10cSrcweir                         }
325cdf0e10cSrcweir                     }
326cdf0e10cSrcweir                 };
327cdf0e10cSrcweir 
328cdf0e10cSrcweir                 m_aThread.start();
329cdf0e10cSrcweir             }
330cdf0e10cSrcweir             else
331cdf0e10cSrcweir             {
332cdf0e10cSrcweir                 try
333cdf0e10cSrcweir                 {
334cdf0e10cSrcweir                     if ( m_aWikiEditor != null )
335cdf0e10cSrcweir                     {
336cdf0e10cSrcweir                         m_bAction = m_aWikiEditor.SendArticleImpl( aThisDialog, aWikiSettings );
337cdf0e10cSrcweir                     }
338cdf0e10cSrcweir                 } catch( java.lang.Exception e )
339cdf0e10cSrcweir                 {}
340cdf0e10cSrcweir                 finally
341cdf0e10cSrcweir                 {
342cdf0e10cSrcweir                     EnableControls( true );
343cdf0e10cSrcweir                     SetThrobberActive( false );
344cdf0e10cSrcweir                     SetThrobberVisible( false );
345cdf0e10cSrcweir 
346cdf0e10cSrcweir                     if ( m_bAction )
347cdf0e10cSrcweir                         xDialogToClose.endExecute();
348cdf0e10cSrcweir                 }
349cdf0e10cSrcweir             }
350*d3be6617Smseidel 
351cdf0e10cSrcweir             return true;
352cdf0e10cSrcweir         }
353cdf0e10cSrcweir         else if ( MethodName.equals( sWikiListMethod ) )
354cdf0e10cSrcweir         {
355cdf0e10cSrcweir             fillDocList();
356cdf0e10cSrcweir             switchSendButtonIfNecessary();
357cdf0e10cSrcweir             return true;
358cdf0e10cSrcweir         }
359cdf0e10cSrcweir         else if ( MethodName.equals( sArticleTextMethod ) )
360cdf0e10cSrcweir         {
361cdf0e10cSrcweir             switchSendButtonIfNecessary();
362cdf0e10cSrcweir             return true;
363cdf0e10cSrcweir         }
364cdf0e10cSrcweir         else if ( MethodName.equals( sAddWikiMethod ) )
365cdf0e10cSrcweir         {
366cdf0e10cSrcweir             WikiEditSettingDialog xAddDialog = new WikiEditSettingDialog(m_xContext, "vnd.sun.star.script:WikiEditor.EditSetting?location=application");
367cdf0e10cSrcweir             if ( xAddDialog.show() )
368cdf0e10cSrcweir                 fillWikiList();
369cdf0e10cSrcweir 
370cdf0e10cSrcweir             xAddDialog.DisposeDialog();
371cdf0e10cSrcweir 
372cdf0e10cSrcweir             return true;
373cdf0e10cSrcweir         }
374cdf0e10cSrcweir 
375cdf0e10cSrcweir         return false;
376cdf0e10cSrcweir     }
377cdf0e10cSrcweir 
windowClosed( EventObject e )378cdf0e10cSrcweir     public void windowClosed( EventObject e )
379cdf0e10cSrcweir     {
380cdf0e10cSrcweir         ThreadStop( false );
381cdf0e10cSrcweir     }
382cdf0e10cSrcweir }
383cdf0e10cSrcweir 
384