Kaydet (Commit) e9a361bc authored tarafından Mikhail Voitenko's avatar Mikhail Voitenko

react on actions

üst ce303590
......@@ -5,9 +5,9 @@
*
* $RCSfile: Settings.xdl,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: mav $ $Date: 2008-01-21 12:57:52 $
* last change: $Author: mav $ $Date: 2008-01-30 19:02:05 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -47,6 +47,7 @@
</dlg:button>
<dlg:menulist dlg:id="WikiList" dlg:tab-index="0" dlg:left="6" dlg:top="6" dlg:width="188" dlg:height="150" dlg:help-url="HID:31681" dlg:multiselection="true">
<script:event script:event-name="on-itemstatechange" script:macro-name="vnd.sun.star.UNO:ListStatus" script:language="UNO"/>
<script:event script:event-name="on-performaction" script:macro-name="vnd.sun.star.UNO:ListEdit" script:language="UNO"/>
</dlg:menulist>
</dlg:bulletinboard>
</dlg:window>
......@@ -4,9 +4,9 @@
*
* $RCSfile: Helper.java,v $
*
* $Revision: 1.12 $
* $Revision: 1.13 $
*
* last change: $Author: mav $ $Date: 2008-01-30 16:08:26 $
* last change: $Author: mav $ $Date: 2008-01-30 19:02:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -1052,5 +1052,27 @@ public class Helper
return null;
}
protected static boolean AllowThreadUsage( XComponentContext xContext )
{
if ( xContext != null )
{
try
{
XMultiComponentFactory xFactory = xContext.getServiceManager();
if ( xFactory == null )
throw new com.sun.star.uno.RuntimeException();
Object oCheckCallback = xFactory.createInstanceWithContext( "com.sun.star.awt.AsyncCallback", xContext );
return ( oCheckCallback != null );
}
catch( Exception e )
{
e.printStackTrace();
}
}
return false;
}
}
......@@ -4,9 +4,9 @@
*
* $RCSfile: WikiArticle.java,v $
*
* $Revision: 1.3 $
* $Revision: 1.4 $
*
* last change: $Author: mav $ $Date: 2008-01-29 11:01:28 $
* last change: $Author: mav $ $Date: 2008-01-30 19:02:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -103,7 +103,7 @@ public class WikiArticle
while( bLogin && !bGotLogin && !Login() )
{
// TODO: be sure that this is no main thread
WikiEditSettingDialog wd = new WikiEditSettingDialog(m_xContext, "vnd.sun.star.script:WikiEditor.EditSetting?location=application", wikiSettings );
WikiEditSettingDialog wd = new WikiEditSettingDialog(m_xContext, "vnd.sun.star.script:WikiEditor.EditSetting?location=application", wikiSettings, false );
if ( aPropDialog != null )
aPropDialog.SetThrobberActive( false );
......
......@@ -4,9 +4,9 @@
*
* $RCSfile: WikiEditSettingDialog.java,v $
*
* $Revision: 1.11 $
* $Revision: 1.12 $
*
* last change: $Author: mav $ $Date: 2008-01-30 14:27:32 $
* last change: $Author: mav $ $Date: 2008-01-30 19:02:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -63,6 +63,7 @@ public class WikiEditSettingDialog extends WikiDialog
{sOKMethod, sCancelMethod, sHelpMethod};
private Hashtable setting;
private boolean addMode;
private boolean m_bAllowURLChange = true;
public WikiEditSettingDialog( XComponentContext xContext, String DialogURL )
{
......@@ -75,7 +76,7 @@ public class WikiEditSettingDialog extends WikiDialog
InitSaveCheckbox( xContext );
}
public WikiEditSettingDialog( XComponentContext xContext, String DialogURL, Hashtable ht )
public WikiEditSettingDialog( XComponentContext xContext, String DialogURL, Hashtable ht, boolean bAllowURLChange )
{
super( xContext, DialogURL );
super.setMethods( Methods );
......@@ -85,7 +86,6 @@ public class WikiEditSettingDialog extends WikiDialog
XPropertySet xUrlField = GetPropSet( "UrlField" );
xUrlField.setPropertyValue( "Text", ht.get( "Url" ) );
xUrlField.setPropertyValue( "Enabled", Boolean.FALSE );
GetPropSet( "UsernameField" ).setPropertyValue( "Text", ht.get( "Username" ));
GetPropSet( "PasswordField" ).setPropertyValue( "Text", ht.get( "Password" ));
}
......@@ -93,12 +93,42 @@ public class WikiEditSettingDialog extends WikiDialog
{
ex.printStackTrace();
}
addMode = false;
m_bAllowURLChange = bAllowURLChange;
InitStrings( xContext );
InitSaveCheckbox( xContext );
}
public boolean show( )
{
EnableControls( true );
return super.show();
}
private void EnableControls( boolean bEnable )
{
try
{
GetPropSet( "UrlField" ).setPropertyValue( "Enabled", new Boolean( m_bAllowURLChange ) );
GetPropSet( "UsernameField" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
GetPropSet( "PasswordField" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
GetPropSet( "OkButton" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
GetPropSet( "HelpButton" ).setPropertyValue( "Enabled", new Boolean( bEnable ) );
if ( bEnable )
GetPropSet( "SaveBox" ).setPropertyValue( "Enabled", new Boolean( Helper.PasswordStoringIsAllowed( m_xContext ) ) );
else
GetPropSet( "SaveBox" ).setPropertyValue( "Enabled", Boolean.FALSE );
}
catch ( Exception ex )
{
ex.printStackTrace();
}
}
private void InitStrings( XComponentContext xContext )
{
try
......@@ -134,9 +164,7 @@ public class WikiEditSettingDialog extends WikiDialog
}
}
public boolean callHandlerMethod( XDialog xDialog, Object EventObject, String MethodName )
{
if ( MethodName.equals( sOKMethod ) )
public void DoLogin( XDialog xDialog )
{
String sRedirectURL = "";
String sURL = "";
......@@ -285,10 +313,61 @@ public class WikiEditSettingDialog extends WikiDialog
false );
ex.printStackTrace();
}
}
public boolean callHandlerMethod( XDialog xDialog, Object EventObject, String MethodName )
{
if ( MethodName.equals( sOKMethod ) )
{
EnableControls( false );
if ( Helper.AllowThreadUsage( m_xContext ) )
{
final XDialog xDialogForThread = xDialog;
// the thread name is used to allow the error dialogs
Thread aLoginThread = new Thread( "com.sun.star.thread.WikiEditorSendingThread" )
{
public void run()
{
try
{
Thread.yield();
DoLogin( xDialogForThread );
m_bAction = true;
} catch( java.lang.Exception e )
{}
finally
{
xDialogForThread.endExecute();
Helper.AllowConnection( true );
}
}
};
aLoginThread.start();
}
else
{
try
{
DoLogin( xDialog );
m_bAction = true;
} catch( java.lang.Exception e )
{}
finally
{
xDialog.endExecute();
Helper.AllowConnection( true );
}
}
return true;
}
else if ( MethodName.equals( sCancelMethod ) )
{
Helper.AllowConnection( false );
xDialog.endExecute();
return true;
}
......
......@@ -4,9 +4,9 @@
*
* $RCSfile: WikiOptionsEventHandlerImpl.java,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: mav $ $Date: 2008-01-21 12:57:53 $
* last change: $Author: mav $ $Date: 2008-01-30 19:02:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -61,6 +61,7 @@ public final class WikiOptionsEventHandlerImpl extends WeakBase
static final String sEdit = "Edit";
static final String sRemove = "Remove";
static final String sListStatus = "ListStatus";
static final String sListEdit = "ListEdit";
static final String sInitialize = "initialize";
static final String sOk = "ok";
static final String sBack = "back";
......@@ -158,7 +159,7 @@ public final class WikiOptionsEventHandlerImpl extends WeakBase
ex.printStackTrace();
}
WikiEditSettingDialog aSettingDialog = new WikiEditSettingDialog(m_xContext, "vnd.sun.star.script:WikiEditor.EditSetting?location=application", ht);
WikiEditSettingDialog aSettingDialog = new WikiEditSettingDialog(m_xContext, "vnd.sun.star.script:WikiEditor.EditSetting?location=application", ht, true );
if ( aSettingDialog.show() )
RefreshView();
}
......@@ -279,7 +280,7 @@ public final class WikiOptionsEventHandlerImpl extends WeakBase
{
AddSetting();
}
else if ( sMethod.equals( sEdit ) )
else if ( sMethod.equals( sEdit ) || sMethod.equals( sListEdit ) )
{
EditSetting();
}
......
......@@ -4,9 +4,9 @@
*
* $RCSfile: WikiPropDialog.java,v $
*
* $Revision: 1.8 $
* $Revision: 1.9 $
*
* last change: $Author: mav $ $Date: 2008-01-29 11:01:28 $
* last change: $Author: mav $ $Date: 2008-01-30 19:02:16 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -244,25 +244,10 @@ public class WikiPropDialog extends WikiDialog{
final WikiPropDialog aThisDialog = this;
final XDialog xDialogToClose = xDialog;
boolean bAllowThreadUsage = false;
try
{
XMultiComponentFactory xFactory = m_xContext.getServiceManager();
if ( xFactory == null )
throw new com.sun.star.uno.RuntimeException();
Object oCheckCallback = xFactory.createInstanceWithContext( "com.sun.star.awt.AsyncCallback", m_xContext );
bAllowThreadUsage = ( oCheckCallback != null );
}
catch( Exception e )
{
e.printStackTrace();
}
// start spinning
SetThrobberActive( true );
if ( bAllowThreadUsage )
if ( Helper.AllowThreadUsage( m_xContext ) )
{
m_aSendingThread = new Thread( "com.sun.star.thread.WikiEditorSendingThread" )
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment