List Info

Thread: how to dispatch ".uno:ClosePreview" from java ?




how to dispatch ".uno:ClosePreview" from java ?
user name
2006-08-07 16:56:31
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Andreas,

Am 07.08.2006 08:41 schrieb Andreas Schlüns:
> If you wish to force a synchronous execution of your
dispatch you should
> try the argument "Asynchron" as [bool] with
a valud "false".

are you sure, this works ?
I can see no difference ... the preview is not closed even
if I use

        xProps[0] = new PropertyValue();
        xProps[0].Name = "Asynchron";
        xProps[0].Value = Boolean.FALSE;

        Object oDispatch =
xDispatch.executeDispatch(xProvider,
".uno:ClosePreview"l, "", 0,
xProps);

Oliver
- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C
AB40 CFD0 4A45
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


iD8DBQFE13C+TiyrQM/QSkURAvx/AKCEoZChxyQqIRHG/uLM2Ysq0JUILQCg
xX6J
NiTJarJ+ikr96ToxHO5zqmk=
=+nMh
-----END PGP SIGNATURE-----

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

how to dispatch ".uno:ClosePreview" from java ?
user name
2006-08-17 07:08:22
Oliver Brinzing wrote:

> Am 07.08.2006 08:41 schrieb Andreas Schlüns:
>> If you wish to force a synchronous execution of
your dispatch you should
>> try the argument "Asynchron" as [bool]
with a valud "false".
> 
> are you sure, this works ?
> I can see no difference ... the preview is not closed
even if I use
> 
>         xProps[0] = new PropertyValue();
>         xProps[0].Name = "Asynchron";
>         xProps[0].Value = Boolean.FALSE;
> 
>         Object oDispatch =
xDispatch.executeDispatch(xProvider,
".uno:ClosePreview"l, "", 0,
xProps);

The name of the property is "SynchronMode" and
of course its value must
be set to "True" in case you want to have
synchronous execution.

Closing a view synchronously is a little bit risky. If the
code is
executed from a call stack that was started somewhere inside
a VCL
resource (e.g. a toolbar) it *could* lead to a crash. So you
have to try
out if it works.

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project
Lead
Please reply to the list only, nospamforMBAgmx.de is
a spam sink.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

how to dispatch ".uno:ClosePreview" from java ?
user name
2006-08-21 06:22:27
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Mathias,

> The name of the property is "SynchronMode"
and of course its value must
> be set to "True" in case you want to have
synchronous execution.

I tried it, without success, it seems, it's not possible to
close the preview from java ...

regards

Oliver
- --


GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C
AB40 CFD0 4A45
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


iD8DBQFE6VEjTiyrQM/QSkURAje2AKCd35SfCnSCL08eLm0C2EG9ig1/5QCg
kdp+
NovSq7qZNyf5XIy225PjavM=
=7Bbi
-----END PGP SIGNATURE-----

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

how to dispatch ".uno:ClosePreview" from java ?
user name
2006-08-24 07:14:48
Oliver Brinzing wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi Mathias,
> 
>> The name of the property is
"SynchronMode" and of course its value must
>> be set to "True" in case you want to
have synchronous execution.
> 
> I tried it, without success, it seems, it's not
possible to close the preview from java ...

What means "without success"? What exactly did
you do and what exactly
happened?

Best regards,
Mathias

-- 
Mathias Bauer - OpenOffice.org Application Framework Project
Lead
Please reply to the list only, nospamforMBAgmx.de is
a spam sink.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

how to dispatch ".uno:ClosePreview" from java ?
user name
2006-08-24 13:36:27
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Mathias,

> What means "without success"? What exactly
did you do and what exactly happened?

that means, the preview is not closed, if i open a message
box directly after the
excecuteDispatch(), it does not matter if i use the
SynchronMode or not ...
the message box is shown in preview mode, after closing it,
preview mode is still active ...
without showMessageBox() the preview is closed ...

here is a snippet of my code:

   PropertyValue[] xProps = new PropertyValue[1];

   xProps[0] = new PropertyValue();
   xProps[0].Name = "SynchronMode";
   xProps[0].Value = Boolean.TRUE;

  
executeDispatch(getModel().getCurrentController().getFrame()
, ".uno:ClosePreview", xProps);
   showMessageBox();


    public Object executeDispatch(XFrame xFrame, String
sUrl, PropertyValue xProp[]) {

        Object dispatchHelper = null;
        try {
            dispatchHelper =
xComponentContext.getServiceManager()
                   
.createInstanceWithContext("com.sun.star.frame.Dispatc
hHelper",
                            xComponentContext);
        } catch (Exception e) {
            return null;
        }

        XDispatchHelper xDispatch = (XDispatchHelper)
UnoRuntime
                .queryInterface(XDispatchHelper.class,
dispatchHelper);

        XDispatchProvider xProvider = (XDispatchProvider)
UnoRuntime
                .queryInterface(XDispatchProvider.class,
xFrame);

        Object oDispatch =
xDispatch.executeDispatch(xProvider, sUrl, "",
0, xProp);

        return oDispatch;
    }

    public void showMessageBox() {

        XWindow xParent = null;
        XFrame xFrame = xController.getFrame();
        XToolkit xToolkit = null;

        if (xFrame != null)
            xParent = xFrame.getContainerWindow();

        try {
            xToolkit = (XToolkit)
UnoRuntime.queryInterface(XToolkit.class,
                    xComponentContext.getServiceManager()
                            .createInstanceWithContext(
                                   
"com.sun.star.awt.Toolkit",
                                    xComponentContext));
        } catch (Exception e) {
            e.printStackTrace();
        }


Oliver
- --

GnuPG key 0xCFD04A45: 8822 057F 4956 46D3 352C 1A06 4E2C
AB40 CFD0 4A45
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


iD8DBQFE7atbTiyrQM/QSkURAp3RAJ0azSb+i4rboSD9ymm58sSGwA5l/ACe
PnYJ
aoXXQSB/o85j7PPL9UQKTd8=
=J1QP
-----END PGP SIGNATURE-----

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

how to dispatch ".uno:ClosePreview" from java ?
user name
2006-08-25 17:17:36
Oliver Brinzing wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Hi Mathias,
> 
>> What means "without success"? What
exactly did you do and what exactly happened?
> 
> that means, the preview is not closed, if i open a
message box directly after the
> excecuteDispatch(), it does not matter if i use the
SynchronMode or not ...
> the message box is shown in preview mode, after closing
it, preview mode is still active ...
> without showMessageBox() the preview is closed ...

This shows that closing is not done synchronously and so it
is prevented
by the dialog box that is opened before the view can be
exchanged. Of
course you can't close a view that contains a modal dialog!

Obviously there is an additional asynchronity in the code
that executes
the "ClosePreview" command, it's not the
dispatcher that works
asynchronously. I had a look into the Writer code and indeed
this is
what happens. The closing of the preview is done by creating
a new view
and replacing the preview in the same window by it, and this
is done
asynchronously. I assume this is done to protect against
possible
crashes in case execution of the dispatch calls is requested
by an
object inside the view that can't cope with being killed
itself before
the call returns.

So at least currently you can't do anything against it,
except writing
an issue of course asking the Writer developers for
switching to a
synchronous exchange of the View (though I don't know if
this is feasible).

Best regards,
Mathias Bauer

-- 
Mathias Bauer - OpenOffice.org Application Framework Project
Lead
Please reply to the list only, nospamforMBAgmx.de is
a spam sink.

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeapi.openoffice.org
For additional commands, e-mail: dev-helpapi.openoffice.org

[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )