diff options
8 files changed, 200 insertions, 157 deletions
diff --git a/swext/mediawiki/dialogs/EditSetting.xdl b/swext/mediawiki/dialogs/EditSetting.xdl index 4b75c1866adc..21ab2a793ba0 100644 --- a/swext/mediawiki/dialogs/EditSetting.xdl +++ b/swext/mediawiki/dialogs/EditSetting.xdl @@ -5,9 +5,9 @@ * * $RCSfile: EditSetting.xdl,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: mav $ $Date: 2008-02-04 08:52:17 $ + * last change: $Author: mav $ $Date: 2008-02-05 16:35:53 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -34,25 +34,24 @@ * ************************************************************************ --> <!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd"> -<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="EditSetting" dlg:left="180" dlg:top="89" dlg:width="186" dlg:height="156" dlg:closeable="true" dlg:moveable="true" dlg:title="TOREPLACE"> +<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="EditSetting" dlg:tab-index="1" dlg:left="180" dlg:top="89" dlg:width="198" dlg:height="141" dlg:closeable="true" dlg:moveable="true" dlg:title="TOREPLACE"> <dlg:bulletinboard> - <dlg:text dlg:id="UrlLabel" dlg:tab-index="4" dlg:left="6" dlg:top="33" dlg:width="50" dlg:height="8" dlg:value="TOREPLACE" dlg:tabstop="false"/> - <dlg:textfield dlg:id="UrlField" dlg:tab-index="5" dlg:left="58" dlg:top="31" dlg:width="122" dlg:height="12" dlg:help-url="HID:31696"/> - <dlg:textfield dlg:id="UsernameField" dlg:tab-index="7" dlg:left="58" dlg:top="91" dlg:width="122" dlg:height="12" dlg:help-url="HID:31697"/> - <dlg:textfield dlg:id="PasswordField" dlg:tab-index="9" dlg:left="58" dlg:top="107" dlg:width="122" dlg:height="12" dlg:help-url="HID:31698" dlg:echochar="*"/> - <dlg:button dlg:id="OkButton" dlg:tab-index="12" dlg:left="77" dlg:top="139" dlg:width="50" dlg:height="14" dlg:help-url="HID:31700" dlg:default="true" dlg:value="TOREPLACE"> + <dlg:text dlg:id="UrlLabel" dlg:tab-index="3" dlg:left="6" dlg:top="26" dlg:width="50" dlg:height="8" dlg:value="TOREPLACE" dlg:tabstop="false"/> + <dlg:textfield dlg:id="UrlField" dlg:tab-index="4" dlg:left="58" dlg:top="23" dlg:width="122" dlg:height="12" dlg:help-url="HID:31696"/> + <dlg:textfield dlg:id="UsernameField" dlg:tab-index="6" dlg:left="58" dlg:top="68" dlg:width="122" dlg:height="12" dlg:help-url="HID:31697"/> + <dlg:textfield dlg:id="PasswordField" dlg:tab-index="8" dlg:left="58" dlg:top="84" dlg:width="122" dlg:height="12" dlg:help-url="HID:31698" dlg:echochar="*"/> + <dlg:button dlg:id="OkButton" dlg:tab-index="11" dlg:left="89" dlg:top="122" dlg:width="50" dlg:height="14" dlg:help-url="HID:31700" dlg:default="true" dlg:value="TOREPLACE"> <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:OK" script:language="UNO"/> </dlg:button> - <dlg:button dlg:id="CancelButton" dlg:tab-index="13" dlg:left="130" dlg:top="139" dlg:width="50" dlg:height="14" dlg:help-url="HID:31701" dlg:button-type="cancel"> - </dlg:button> - <dlg:button dlg:id="HelpButton" dlg:tab-index="11" dlg:left="6" dlg:top="139" dlg:width="50" dlg:height="14" dlg:help-url="HID:31702" dlg:value="TOREPLACE"> + <dlg:button dlg:id="CancelButton" dlg:tab-index="12" dlg:left="143" dlg:top="122" dlg:width="50" dlg:height="14" dlg:help-url="HID:31701" dlg:button-type="cancel"/> + <dlg:button dlg:id="HelpButton" dlg:tab-index="10" dlg:left="5" dlg:top="122" dlg:width="50" dlg:height="14" dlg:help-url="HID:31702" dlg:value="TOREPLACE"> <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:Help" script:language="UNO"/> </dlg:button> - <dlg:text dlg:id="UsernameLabel" dlg:tab-index="6" dlg:left="6" dlg:top="93" dlg:width="46" dlg:height="8" dlg:value="TOREPLACE" dlg:tabstop="false"/> - <dlg:text dlg:id="PasswordLabel" dlg:tab-index="8" dlg:left="6" dlg:top="109" dlg:width="46" dlg:height="8" dlg:value="TOREPLACE" dlg:tabstop="false"/> - <dlg:checkbox dlg:id="SaveBox" dlg:tab-index="10" dlg:left="58" dlg:top="123" dlg:width="116" dlg:height="8" dlg:help-url="HID:31699" dlg:value="TOREPLACE" dlg:checked="false"/> - <dlg:fixedline dlg:id="BottomLine" dlg:tab-index="1" dlg:left="0" dlg:top="131" dlg:width="186" dlg:height="8"/> - <dlg:fixedline dlg:id="AccountLine" dlg:tab-index="2" dlg:left="3" dlg:top="80" dlg:width="180" dlg:height="8" dlg:value="TOREPLACE"/> - <dlg:fixedline dlg:id="WikiLine" dlg:tab-index="3" dlg:left="3" dlg:top="4" dlg:width="180" dlg:height="8" dlg:value="TOREPLACE"/> + <dlg:text dlg:id="UsernameLabel" dlg:tab-index="5" dlg:left="6" dlg:top="69" dlg:width="46" dlg:height="8" dlg:value="TOREPLACE" dlg:tabstop="false"/> + <dlg:text dlg:id="PasswordLabel" dlg:tab-index="7" dlg:left="6" dlg:top="85" dlg:width="46" dlg:height="8" dlg:value="TOREPLACE" dlg:tabstop="false"/> + <dlg:checkbox dlg:id="SaveBox" dlg:tab-index="9" dlg:left="58" dlg:top="100" dlg:width="116" dlg:height="8" dlg:help-url="HID:31699" dlg:value="TOREPLACE" dlg:checked="false"/> + <dlg:fixedline dlg:id="BottomLine" dlg:tab-index="0" dlg:left="-4" dlg:top="113" dlg:width="205" dlg:height="8"/> + <dlg:fixedline dlg:id="AccountLine" dlg:tab-index="1" dlg:left="3" dlg:top="54" dlg:width="193" dlg:height="8" dlg:value="TOREPLACE"/> + <dlg:fixedline dlg:id="WikiLine" dlg:tab-index="2" dlg:left="3" dlg:top="5" dlg:width="193" dlg:height="8" dlg:value="TOREPLACE"/> </dlg:bulletinboard> </dlg:window> diff --git a/swext/mediawiki/dialogs/SendToMediaWiki.xdl b/swext/mediawiki/dialogs/SendToMediaWiki.xdl index dfb9b9e1032b..142a05fb65b0 100644 --- a/swext/mediawiki/dialogs/SendToMediaWiki.xdl +++ b/swext/mediawiki/dialogs/SendToMediaWiki.xdl @@ -5,9 +5,9 @@ * * $RCSfile: SendToMediaWiki.xdl,v $ * - * $Revision: 1.7 $ + * $Revision: 1.8 $ * - * last change: $Author: mav $ $Date: 2008-02-04 08:52:17 $ + * last change: $Author: mav $ $Date: 2008-02-05 16:35:53 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -34,31 +34,31 @@ * ************************************************************************ --> <!DOCTYPE dlg:window PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "dialog.dtd"> -<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="SendToMediaWiki" dlg:left="62" dlg:top="57" dlg:width="288" dlg:height="129" dlg:closeable="true" dlg:moveable="true" dlg:title="TOREPLACE"> +<dlg:window xmlns:dlg="http://openoffice.org/2000/dialog" xmlns:script="http://openoffice.org/2000/script" dlg:id="SendToMediaWiki" dlg:left="62" dlg:top="57" dlg:width="242" dlg:height="164" dlg:closeable="true" dlg:moveable="true" dlg:title="TOREPLACE"> <dlg:bulletinboard> - <dlg:text dlg:id="Label1" dlg:tab-index="0" dlg:left="9" dlg:top="10" dlg:width="62" dlg:height="10" dlg:value="TOREPLACE"/> - <dlg:text dlg:id="Label2" dlg:tab-index="2" dlg:left="9" dlg:top="27" dlg:width="62" dlg:height="10" dlg:value="TOREPLACE"/> - <dlg:text dlg:id="Label3" dlg:tab-index="4" dlg:left="9" dlg:top="43" dlg:width="62" dlg:height="10" dlg:value="TOREPLACE"/> - <dlg:menulist dlg:id="WikiList" dlg:tab-index="1" dlg:left="73" dlg:top="7" dlg:width="142" dlg:height="14" dlg:spin="true"> + <dlg:text dlg:id="Label1" dlg:tab-index="0" dlg:left="5" dlg:top="8" dlg:width="65" dlg:height="10" dlg:value="TOREPLACE"/> + <dlg:text dlg:id="Label2" dlg:tab-index="2" dlg:left="11" dlg:top="38" dlg:width="59" dlg:height="10" dlg:value="TOREPLACE"/> + <dlg:text dlg:id="Label3" dlg:tab-index="4" dlg:left="11" dlg:top="57" dlg:width="59" dlg:height="10" dlg:value="TOREPLACE"/> + <dlg:menulist dlg:id="WikiList" dlg:tab-index="1" dlg:left="75" dlg:top="6" dlg:width="116" dlg:height="14" dlg:spin="true"> <script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:WikiListChange" script:language="UNO"/> </dlg:menulist> - <dlg:combobox dlg:id="ArticleText" dlg:tab-index="3" dlg:left="73" dlg:top="24" dlg:width="142" dlg:height="14" dlg:spin="true"> + <dlg:combobox dlg:id="ArticleText" dlg:tab-index="3" dlg:left="75" dlg:top="36" dlg:width="160" dlg:height="14" dlg:spin="true"> <script:event script:event-name="on-textchange" script:macro-name="vnd.sun.star.UNO:ArticleTextChange" script:language="UNO"/> </dlg:combobox> - <dlg:textfield dlg:id="CommentText" dlg:tab-index="5" dlg:left="73" dlg:top="41" dlg:width="142" dlg:height="20" dlg:multiline="true"/> - <dlg:button dlg:id="AddButton" dlg:tab-index="6" dlg:left="219" dlg:top="7" dlg:width="63" dlg:height="16" dlg:value="TOREPLACE"> + <dlg:textfield dlg:id="CommentText" dlg:tab-index="5" dlg:left="75" dlg:top="55" dlg:width="160" dlg:height="48" dlg:multiline="true"/> + <dlg:button dlg:id="AddButton" dlg:tab-index="6" dlg:left="195" dlg:top="6" dlg:width="40" dlg:height="14" dlg:value="TOREPLACE"> <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:AddWiki" script:language="UNO"/> </dlg:button> - <dlg:checkbox dlg:id="MinorCheck" dlg:tab-index="7" dlg:left="73" dlg:top="66" dlg:width="142" dlg:height="10" dlg:value="TOREPLACE" dlg:checked="false"/> - <dlg:checkbox dlg:id="BrowserCheck" dlg:tab-index="8" dlg:left="73" dlg:top="79" dlg:width="142" dlg:height="10" dlg:value="TOREPLACE" dlg:checked="false"/> - <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="9" dlg:left="-5" dlg:top="100" dlg:width="294" dlg:height="4"/> - <dlg:button dlg:id="CancelButton" dlg:tab-index="10" dlg:left="219" dlg:top="108" dlg:width="63" dlg:height="16" dlg:button-type="cancel"> - </dlg:button> - <dlg:button dlg:id="SendButton" dlg:tab-index="11" dlg:disabled="true" dlg:left="153" dlg:top="108" dlg:width="63" dlg:height="16" dlg:value="TOREPLACE" dlg:default="true"> + <dlg:checkbox dlg:id="MinorCheck" dlg:tab-index="7" dlg:left="75" dlg:top="109" dlg:width="141" dlg:height="10" dlg:value="TOREPLACE" dlg:checked="false"/> + <dlg:checkbox dlg:id="BrowserCheck" dlg:tab-index="8" dlg:left="75" dlg:top="122" dlg:width="141" dlg:height="10" dlg:value="TOREPLACE" dlg:checked="false"/> + <dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="9" dlg:left="-2" dlg:top="138" dlg:width="246" dlg:height="4"/> + <dlg:button dlg:id="CancelButton" dlg:tab-index="10" dlg:left="187" dlg:top="145" dlg:width="50" dlg:height="14" dlg:button-type="cancel"/> + <dlg:button dlg:id="SendButton" dlg:tab-index="11" dlg:disabled="true" dlg:left="134" dlg:top="145" dlg:width="50" dlg:height="14" dlg:default="true" dlg:value="TOREPLACE"> <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:Send" script:language="UNO"/> </dlg:button> - <dlg:button dlg:id="HelpButton" dlg:tab-index="12" dlg:left="6" dlg:top="108" dlg:width="63" dlg:height="16" dlg:value="TOREPLACE"> + <dlg:button dlg:id="HelpButton" dlg:tab-index="12" dlg:left="5" dlg:top="145" dlg:width="50" dlg:height="14" dlg:value="TOREPLACE"> <script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:Help" script:language="UNO"/> </dlg:button> + <dlg:fixedline dlg:id="FixedLine2" dlg:tab-index="13" dlg:left="5" dlg:top="25" dlg:width="234" dlg:height="6" dlg:value="TOREPLACE"/> </dlg:bulletinboard> </dlg:window> diff --git a/swext/mediawiki/src/com/sun/star/wiki/Helper.java b/swext/mediawiki/src/com/sun/star/wiki/Helper.java index 2e0c1fb4c30f..5edc638015b4 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/Helper.java +++ b/swext/mediawiki/src/com/sun/star/wiki/Helper.java @@ -4,9 +4,9 @@ * * $RCSfile: Helper.java,v $ * - * $Revision: 1.14 $ + * $Revision: 1.15 $ * - * last change: $Author: mav $ $Date: 2008-02-04 08:52:18 $ + * last change: $Author: mav $ $Date: 2008-02-05 16:35:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -96,7 +96,7 @@ public class Helper public final static int NOURL_ERROR = 5; public final static int DLG_SENDTITLE = 6; - // number 7 is RESERVED + public final static int DLG_WIKIARTICLE = 7; public final static int DLG_NO = 8; public final static int DLG_OK = 9; public final static int DLG_YES = 10; @@ -132,7 +132,7 @@ public class Helper "InvalidURL", "NoURL", "Dlg_SendTitle", - null, // reserved + "Dlg_WikiArticle", "Dlg_No", "Dlg_OK", "Dlg_Yes", diff --git a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java index 5f4dbf8aaf56..4ac064b51367 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java +++ b/swext/mediawiki/src/com/sun/star/wiki/MainThreadDialogExecutor.java @@ -4,9 +4,9 @@ * * $RCSfile: MainThreadDialogExecutor.java,v $ * - * $Revision: 1.2 $ + * $Revision: 1.3 $ * - * last change: $Author: mav $ $Date: 2007-12-14 09:40:43 $ + * last change: $Author: mav $ $Date: 2008-02-05 16:35:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -51,6 +51,7 @@ public class MainThreadDialogExecutor implements XCallback private XMessageBox m_xMessageBox; private boolean m_bResult = false; private boolean m_bCalled = false; + private boolean m_bClose = false; static public boolean Show( XComponentContext xContext, WikiDialog aWikiDialog ) { @@ -70,6 +71,12 @@ public class MainThreadDialogExecutor implements XCallback return GetCallback( xContext, aExecutor ); } + static public boolean Close( XComponentContext xContext, XDialog xDialog ) + { + MainThreadDialogExecutor aExecutor = new MainThreadDialogExecutor( xDialog, true ); + return GetCallback( xContext, aExecutor ); + } + static private boolean GetCallback( XComponentContext xContext, MainThreadDialogExecutor aExecutor ) { try @@ -126,6 +133,13 @@ public class MainThreadDialogExecutor implements XCallback m_xDialog = xDialog; } + private MainThreadDialogExecutor( XDialog xDialog, boolean bClose ) + { + m_xDialog = xDialog; + m_bClose = true; + m_bCalled = true; // no yielding, asynchronous closing + } + private MainThreadDialogExecutor( XMessageBox xMessageBox ) { m_xMessageBox = xMessageBox; @@ -141,7 +155,22 @@ public class MainThreadDialogExecutor implements XCallback if ( m_aWikiDialog != null ) m_bResult = m_aWikiDialog.show(); else if ( m_xDialog != null ) - m_bResult = ( m_xDialog.execute() == 1 ); + { + if ( !m_bClose ) + m_bResult = ( m_xDialog.execute() == 1 ); + else + { + try + { + m_xDialog.endExecute(); + } + catch( Exception e ) + { + e.printStackTrace(); + } + m_bResult = true; + } + } else if ( m_xMessageBox != null ) m_bResult = ( m_xMessageBox.execute() == 1 ); diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java index 6635fd813d91..533314e6f87f 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiDialog.java @@ -4,9 +4,9 @@ * * $RCSfile: WikiDialog.java,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: mav $ $Date: 2008-02-04 08:52:18 $ + * last change: $Author: mav $ $Date: 2008-02-05 16:35:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,16 +37,21 @@ package com.sun.star.wiki; import com.sun.star.awt.XControl; import com.sun.star.awt.XControlContainer; +import com.sun.star.awt.XControlModel; import com.sun.star.awt.XDialog; import com.sun.star.awt.XDialogEventHandler; import com.sun.star.awt.XDialogProvider2; +import com.sun.star.awt.XThrobber; import com.sun.star.beans.XPropertySet; import com.sun.star.lang.XMultiComponentFactory; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import com.sun.star.awt.XTopWindow; import com.sun.star.awt.XTopWindowListener; +import com.sun.star.awt.XWindow; +import com.sun.star.container.XNameContainer; import com.sun.star.lang.EventObject; +import com.sun.star.lang.XMultiServiceFactory; public class WikiDialog implements XDialogEventHandler, XTopWindowListener { @@ -182,6 +187,80 @@ public class WikiDialog implements XDialogEventHandler, XTopWindowListener return xResult; } + protected void InsertThrobber( int X, int Y, int Width, int Height ) + { + try + { + XControl xDialogControl = ( XControl ) UnoRuntime.queryInterface( XControl.class, m_xDialog ); + XControlModel xDialogModel = null; + if ( xDialogControl != null ) + xDialogModel = xDialogControl.getModel(); + + XMultiServiceFactory xDialogFactory = ( XMultiServiceFactory ) UnoRuntime.queryInterface( XMultiServiceFactory.class, xDialogModel ); + if ( xDialogFactory != null ) + { + XControlModel xThrobberModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, xDialogFactory.createInstance( "com.sun.star.awt.UnoThrobberControlModel" ) ); + XPropertySet xThrobberProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xThrobberModel ); + if ( xThrobberProps != null ) + { + xThrobberProps.setPropertyValue( "Name", "WikiThrobber" ); + xThrobberProps.setPropertyValue( "PositionX", new Integer( X ) ); + xThrobberProps.setPropertyValue( "PositionY", new Integer( Y ) ); + xThrobberProps.setPropertyValue( "Height", new Integer( Width ) ); + xThrobberProps.setPropertyValue( "Width", new Integer( Height ) ); + + XNameContainer xDialogContainer = (XNameContainer)UnoRuntime.queryInterface( XNameContainer.class, xDialogModel ); + xDialogContainer.insertByName( "WikiThrobber", xThrobberModel ); + } + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + + SetThrobberVisible( false ); + } + + public void SetThrobberActive( boolean bActive ) + { + if ( m_xControlContainer != null ) + { + try + { + XThrobber xThrobber = (XThrobber)UnoRuntime.queryInterface( XThrobber.class, m_xControlContainer.getControl( "WikiThrobber" ) ); + if ( xThrobber != null ) + { + if ( bActive ) + xThrobber.start(); + else + xThrobber.stop(); + } + } + catch( Exception e ) + { + e.printStackTrace(); + } + } + } + + public void SetThrobberVisible( boolean bVisible ) + { + if ( m_xControlContainer != null ) + { + try + { + XWindow xWindow = (XWindow)UnoRuntime.queryInterface( XWindow.class, m_xControlContainer.getControl( "WikiThrobber" ) ); + if ( xWindow != null ) + xWindow.setVisible( bVisible ); + } + catch ( Exception e ) + { + e.printStackTrace(); + } + } + } + public void DisposeDialog() { Helper.Dispose( m_xDialog ); diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java index ebdad860c75f..edb5c633b45b 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiEditSettingDialog.java @@ -4,9 +4,9 @@ * * $RCSfile: WikiEditSettingDialog.java,v $ * - * $Revision: 1.15 $ + * $Revision: 1.16 $ * - * last change: $Author: mav $ $Date: 2008-02-04 08:52:18 $ + * last change: $Author: mav $ $Date: 2008-02-05 16:35:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -37,6 +37,7 @@ package com.sun.star.wiki; import com.sun.star.awt.XDialog; import com.sun.star.awt.XWindowPeer; +import com.sun.star.awt.XThrobber; import com.sun.star.beans.XPropertySet; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; @@ -59,6 +60,7 @@ public class WikiEditSettingDialog extends WikiDialog private boolean addMode; private boolean m_bAllowURLChange = true; private Thread m_aLoginThread; + private boolean m_bThreadFinished = false; public WikiEditSettingDialog( XComponentContext xContext, String DialogURL ) { @@ -67,6 +69,7 @@ public class WikiEditSettingDialog extends WikiDialog setting = new Hashtable(); addMode = true; + InsertThrobber( 184, 24, 10, 10 ); InitStrings( xContext ); InitSaveCheckbox( xContext ); } @@ -92,12 +95,15 @@ public class WikiEditSettingDialog extends WikiDialog addMode = false; m_bAllowURLChange = bAllowURLChange; + InsertThrobber( 184, 24, 10, 10 ); InitStrings( xContext ); InitSaveCheckbox( xContext ); } public boolean show( ) { + SetThrobberVisible( false ); + m_bThreadFinished = false; EnableControls( true ); return super.show(); } @@ -259,7 +265,6 @@ public class WikiEditSettingDialog extends WikiDialog } m_bAction = true; - xDialog.endExecute(); } } } @@ -322,10 +327,14 @@ public class WikiEditSettingDialog extends WikiDialog if ( MethodName.equals( sOKMethod ) ) { EnableControls( false ); + SetThrobberVisible( true ); + SetThrobberActive( true ); if ( Helper.AllowThreadUsage( m_xContext ) ) { final XDialog xDialogForThread = xDialog; + final XComponentContext xContext = m_xContext; + final WikiEditSettingDialog aThis = this; // the thread name is used to allow the error dialogs m_aLoginThread = new Thread( "com.sun.star.thread.WikiEditorSendingThread" ) @@ -336,12 +345,12 @@ public class WikiEditSettingDialog extends WikiDialog { Thread.yield(); DoLogin( xDialogForThread ); - m_bAction = true; + m_bThreadFinished = true; } catch( java.lang.Exception e ) {} finally { - xDialogForThread.endExecute(); + MainThreadDialogExecutor.Close( xContext, xDialogForThread ); Helper.AllowConnection( true ); } } @@ -354,7 +363,7 @@ public class WikiEditSettingDialog extends WikiDialog try { DoLogin( xDialog ); - m_bAction = true; + m_bThreadFinished = true; } catch( java.lang.Exception e ) {} finally @@ -376,20 +385,23 @@ public class WikiEditSettingDialog extends WikiDialog public void windowClosed( EventObject e ) { - if ( m_aLoginThread != null ) + if ( m_aLoginThread != null && !m_bThreadFinished ) { - Helper.AllowConnection( false ); try { + Helper.AllowConnection( false ); m_aLoginThread.join(); } catch( Exception ex ) { ex.printStackTrace(); } - - m_aLoginThread = null; - Helper.AllowConnection( true ); + finally + { + m_aLoginThread = null; + Helper.AllowConnection( true ); + } } } } + diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java b/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java index df827e62aace..fc69f2f80108 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiOptionsEventHandlerImpl.java @@ -4,9 +4,9 @@ * * $RCSfile: WikiOptionsEventHandlerImpl.java,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: mav $ $Date: 2008-02-04 08:52:18 $ + * last change: $Author: mav $ $Date: 2008-02-05 16:35:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -196,7 +196,7 @@ public final class WikiOptionsEventHandlerImpl extends WeakBase try { GetPropSet( "AddButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( m_xContext, Helper.DLG_ADDBUTTON ) ); - GetPropSet( "EditButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( m_xContext, Helper.DLG_SENDBUTTON ) ); + GetPropSet( "EditButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( m_xContext, Helper.DLG_EDITBUTTON ) ); GetPropSet( "RemoveButton" ).setPropertyValue( "Label", Helper.GetLocalizedString( m_xContext, Helper.DLG_REMOVEBUTTON ) ); } catch( Exception e ) diff --git a/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java b/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java index 63d6367eb6d3..358faef4ac23 100644 --- a/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java +++ b/swext/mediawiki/src/com/sun/star/wiki/WikiPropDialog.java @@ -4,9 +4,9 @@ * * $RCSfile: WikiPropDialog.java,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: mav $ $Date: 2008-02-04 08:52:18 $ + * last change: $Author: mav $ $Date: 2008-02-05 16:35:54 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -56,12 +56,11 @@ public class WikiPropDialog extends WikiDialog{ private final String sSendMethod = "Send"; private final String sHelpMethod = "Help"; - private final String sLoadMethod = "Load"; private final String sWikiListMethod = "WikiListChange"; private final String sArticleTextMethod = "ArticleTextChange"; private final String sAddWikiMethod = "AddWiki"; - String[] m_pMethods = {sSendMethod, sHelpMethod, sLoadMethod, sWikiListMethod, sArticleTextMethod, sAddWikiMethod}; + String[] m_pMethods = {sSendMethod, sHelpMethod, sWikiListMethod, sArticleTextMethod, sAddWikiMethod}; private String m_sWikiTitle = ""; protected String m_sWikiEngineURL = ""; @@ -78,7 +77,7 @@ public class WikiPropDialog extends WikiDialog{ if ( aWikiEditorForThrobber != null ) { - InsertThrobber(); + InsertThrobber( 224, 122, 10, 10 ); m_aWikiEditor = aWikiEditorForThrobber; } @@ -92,6 +91,7 @@ public class WikiPropDialog extends WikiDialog{ { SetTitle( Helper.GetLocalizedString( xContext, Helper.DLG_SENDTITLE ) ); GetPropSet( "Label1" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_LABEL1 ) ); + GetPropSet( "FixedLine2" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_WIKIARTICLE ) ); GetPropSet( "Label2" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_LABEL2 ) ); GetPropSet( "Label3" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_LABEL3 ) ); GetPropSet( "MinorCheck" ).setPropertyValue( "Label", Helper.GetLocalizedString( xContext, Helper.DLG_SENDTOMEDIAWIKI_MINORCHECK ) ); @@ -238,12 +238,12 @@ public class WikiPropDialog extends WikiDialog{ ex.printStackTrace(); } - // TODO: In future the result of storing will be interesting - // TODO: do not do it in OOo2.2 final WikiPropDialog aThisDialog = this; final XDialog xDialogToClose = xDialog; + final XComponentContext xContext = m_xContext; // start spinning + SetThrobberVisible( true ); SetThrobberActive( true ); if ( Helper.AllowThreadUsage( m_xContext ) ) @@ -264,7 +264,7 @@ public class WikiPropDialog extends WikiDialog{ {} finally { - xDialogToClose.endExecute(); + MainThreadDialogExecutor.Close( xContext, xDialogToClose ); Helper.AllowConnection( true ); } } @@ -292,32 +292,8 @@ public class WikiPropDialog extends WikiDialog{ return true; } - else if ( MethodName.equals( sLoadMethod ) ) - { - try - { - short [] sel = (short[]) GetPropSet("WikiList").getPropertyValue("SelectedItems"); - String [] items = (String []) GetPropSet("WikiList").getPropertyValue("StringItemList"); - m_sWikiEngineURL = items[sel[0]]; - m_aSettings.setLastUsedWikiServer(sel[0]); - m_sWikiTitle = (String) GetPropSet("ArticleText").getPropertyValue("Text"); - } - catch (UnknownPropertyException ex) - { - ex.printStackTrace(); - } - catch (WrappedTargetException ex) - { - ex.printStackTrace(); - } - m_bAction = true; - xDialog.endExecute(); - return true; - } else if ( MethodName.equals( sHelpMethod ) ) { - m_bAction = false; - //xDialog.endExecute(); return true; } else if ( MethodName.equals( sWikiListMethod ) ) @@ -347,82 +323,30 @@ public class WikiPropDialog extends WikiDialog{ public void windowClosed( EventObject e ) { - if ( m_aSendingThread != null ) - { - Helper.AllowConnection( false ); - try { - m_aSendingThread.join(); - } catch ( Exception ex ) - { - ex.printStackTrace(); - } - - m_aSendingThread = null; - Helper.AllowConnection( true ); - - Helper.ShowError( m_xContext, - m_xDialog, - Helper.DLG_SENDTITLE, - Helper.CANCELSENDING_ERROR, - null, - false ); - } - } - - private void InsertThrobber() - { - try + if ( m_aSendingThread != null && !m_bAction ) { - XControl xDialogControl = ( XControl ) UnoRuntime.queryInterface( XControl.class, m_xDialog ); - XControlModel xDialogModel = null; - if ( xDialogControl != null ) - xDialogModel = xDialogControl.getModel(); - - XMultiServiceFactory xDialogFactory = ( XMultiServiceFactory ) UnoRuntime.queryInterface( XMultiServiceFactory.class, xDialogModel ); - if ( xDialogFactory != null ) + try { - XControlModel xThrobberModel = (XControlModel)UnoRuntime.queryInterface( XControlModel.class, xDialogFactory.createInstance( "com.sun.star.awt.UnoThrobberControlModel" ) ); - XPropertySet xThrobberProps = (XPropertySet)UnoRuntime.queryInterface( XPropertySet.class, xThrobberModel ); - if ( xThrobberProps != null ) - { - xThrobberProps.setPropertyValue( "Name", "WikiThrobber" ); - xThrobberProps.setPropertyValue( "PositionX", new Integer( 242 ) ); - xThrobberProps.setPropertyValue( "PositionY", new Integer( 42 ) ); - xThrobberProps.setPropertyValue( "Height", new Integer( 16 ) ); - xThrobberProps.setPropertyValue( "Width", new Integer( 16 ) ); - - XNameContainer xDialogContainer = (XNameContainer)UnoRuntime.queryInterface( XNameContainer.class, xDialogModel ); - xDialogContainer.insertByName( "WikiThrobber", xThrobberModel ); - } + Helper.AllowConnection( false ); + m_aSendingThread.join(); } - } - catch( Exception e ) - { - e.printStackTrace(); - } - } - - public void SetThrobberActive( boolean bActive ) - { - if ( m_xControlContainer != null ) - { - try + catch ( Exception ex ) { - XThrobber xThrobber = (XThrobber)UnoRuntime.queryInterface( XThrobber.class, m_xControlContainer.getControl( "WikiThrobber" ) ); - if ( xThrobber != null ) - { - if ( bActive ) - xThrobber.start(); - else - xThrobber.stop(); - } + ex.printStackTrace(); } - catch( Exception e ) + finally { - e.printStackTrace(); + m_aSendingThread = null; + Helper.AllowConnection( true ); + + Helper.ShowError( m_xContext, + m_xDialog, + Helper.DLG_SENDTITLE, + Helper.CANCELSENDING_ERROR, + null, + false ); } } } - } |