OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Loading xdl (dialog) file in java extension

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
plehal
Newbie
Newbie


Joined: 28 Oct 2009
Posts: 3

PostPosted: Mon Nov 02, 2009 6:26 am    Post subject: Loading xdl (dialog) file in java extension Reply with quote

I want to open a dialog from within the extension written in java. Can someone please, let me know the URL for making this call. e.g loading dialog from a script has a url like

"vnd.sun.star.script:mylibrary?location=application"

I need to know the url in case of an extension.
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Mon Nov 02, 2009 9:23 am    Post subject: Reply with quote

See:
.oxt package creation http://www.oooforum.org/forum/viewtopic.phtml?t=72633

and then use css.awt.DialogProvider service to make the instance of the dialog:
Opening a Basic Dialog in Python http://www.oooforum.org/forum/viewtopic.phtml?t=69898&highlight=dialogprovider
createDialog method of the css.awt.XDialogProvider interface can be process "file:///" protocol as well as vnd.sun.star.script:.
Back to top
View user's profile Send private message
plehal
Newbie
Newbie


Joined: 28 Oct 2009
Posts: 3

PostPosted: Mon Nov 02, 2009 1:02 pm    Post subject: Loading xdl (dialog) file in java extension Reply with quote

I already know to create dialog using XDialogProvider2 like

theDialog = xDialogProvider.createDialogWithHandler( "vnd.sun.star.script:putil.PunjabiUtilities?location=application", this);


The problem I have is that I am trying to create java extension which is little different from creating java macro. All I need to know is the url to call in case of extension and location of dialogs in oxt file.

Sorry, if my question is really dumb but I am kind of stuck on this. Right now I am using Swing frame for dialog. The extension in case is http://extensions.services.openoffice.org/project/PunjabiUtilities
Back to top
View user's profile Send private message
hanya
Super User
Super User


Joined: 04 May 2005
Posts: 543
Location: Japan

PostPosted: Mon Nov 02, 2009 5:53 pm    Post subject: Re: Loading xdl (dialog) file in java extension Reply with quote

plehal wrote:
The problem I have is that I am trying to create java extension which is little different from creating java macro. All I need to know is the url to call in case of extension and location of dialogs in oxt file.

Put your dialog.xdl file into a directory in the extension package and get its url like the following written in the OOoBasic:
Code:
Sub CreateDialogPlacedInTheExtension
  sExtension_Id = "org.hoge.Something"
  sDirURL = GetPackageDirURL(sExtension_Id)
  sDialogURL = sDirURL & "/dialogs/dialog.xdl"
  oDialog = CreateUnoService("com.sun.star.awt.DialogProvider").createDialog(sDialogURL)
  oDialog.execute()
End Sub

Function GetPackageDirURL( sIdentifier As String ) As String
  Dim oPIP As Object
  oPIP = GetDefaultContext().getByName( _
    "/singletons/com.sun.star.deployment.PackageInformationProvider")
  GetPackageDirURL = oPIP.getPackageLocation(sIdentifier)
End Function


css.deployment.PackageInformationProvider can be used after OOo 2.3 and it causes version dependent problem. If you want to make your extension that can be used with earlier 2.3, try /singletons/com.sun.star.deployment.thePackageManagerFactory to find your extension installed directory.

I mention about the way with a dialog installed with a basic library or a dialog included into a dialog library. Put your dialog in the extension package as a menber of a basic or a dialog library. In this case, you can point the dialog with "vnd.sun.star.script:Library_NAME.Dialog_NAME?location=application".
In this way, your dialog is shown in the basic library and it may be modified if the dialog library is not readonly.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group