Hi all,
I've downloaded the sample OptionsPageDemo Netbeans project and I've
been able to successfully install the add-on and I also see the Options
dialog. But when I create my own add-on and want to add an Options page
I don't see it! There are no errors while installing my add-on, but the
options button (in the Extension manager) is not enabled, which suggests
that the Options dialog functionality is not present for my add-on.
I'm attaching my OptionsDialog.xcu file, and my EventHandler java
file (which doesn't do much really), along with the .xdl file I've
created for the testing purposes, with a simple server url, username and
password fields. The EventHandler is appropriately placed in the
com.example package and the DLDialog.xdl file is in the dialogs
directory and it is present in the dialogs directory at the root of the
final .oxt file created, i.e., all the files are at the appropriate
places they are supposed to be.
Can someone please help me with this? I don't know what exactly I'm
doing wrong here.
Regards,
Karthik
<?xml version="1.0" encoding="UTF-8"?>
<!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="DocumentLibraryConfig" dlg:left="221" dlg:top="98" dlg:width="201" dlg:height="164" dlg:closeable="true" dlg:moveable="true">
<dlg:styles>
<dlg:style dlg:style-id="0" dlg:text-color="0xff" dlg:font-name="Verdana" dlg:font-height="10" dlg:font-stylename="Regular" dlg:font-family="swiss"/>
</dlg:styles>
<dlg:bulletinboard>
<dlg:text dlg:style-id="0" dlg:id="label1" dlg:tab-index="0" dlg:left="14" dlg:top="19" dlg:width="72" dlg:height="12" dlg:value="Configuration Details"/>
<dlg:text dlg:id="Label1" dlg:tab-index="2" dlg:left="12" dlg:top="58" dlg:width="29" dlg:height="9" dlg:value="Server URL"/>
<dlg:textfield dlg:id="serverURL" dlg:tab-index="1" dlg:left="47" dlg:top="54" dlg:width="126" dlg:height="14" dlg:value="http://localhost:8080"/>
<dlg:fixedline dlg:id="FixedLine1" dlg:tab-index="4" dlg:left="86" dlg:top="24" dlg:width="99" dlg:height="2"/>
<dlg:text dlg:id="Label3" dlg:tab-index="3" dlg:left="12" dlg:top="78" dlg:width="29" dlg:height="9" dlg:value="Username"/>
<dlg:textfield dlg:id="emailId" dlg:tab-index="5" dlg:left="47" dlg:top="74" dlg:width="126" dlg:height="14" dlg:value="t...@example.com"/>
<dlg:text dlg:id="Label4" dlg:tab-index="6" dlg:left="12" dlg:top="96" dlg:width="29" dlg:height="9" dlg:value="Password"/>
<dlg:textfield dlg:id="password" dlg:tab-index="7" dlg:left="47" dlg:top="92" dlg:width="126" dlg:height="14" dlg:value="test" dlg:echochar="*"/>
<dlg:fixedline dlg:id="FixedLine2" dlg:tab-index="8" dlg:left="185" dlg:top="24" dlg:width="4" dlg:height="102" dlg:align="vertical"/>
<dlg:fixedline dlg:id="FixedLine3" dlg:tab-index="9" dlg:left="8" dlg:top="124" dlg:width="181" dlg:height="2"/>
<dlg:fixedline dlg:id="FixedLine4" dlg:tab-index="10" dlg:left="6" dlg:top="24" dlg:width="2" dlg:height="100" dlg:align="vertical"/>
<dlg:fixedline dlg:id="FixedLine5" dlg:tab-index="11" dlg:left="6" dlg:top="24" dlg:width="8" dlg:height="2"/>
</dlg:bulletinboard>
</dlg:window>
<?xml version="1.0" encoding="UTF-8"?>
<oor:component-data oor:name="OptionsDialog" oor:package="com.example"
xmlns:oor="http://openoffice.org/2001/registry"
xmlns:xs="http://www.w2.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="Nodes">
<node oor:name="Writer" oor:op="fuse">
<node oor:name="Leaves">
<node oor:name="com.example.leaf" oor:op="fuse">
<prop oor:name="Id">
<value>com.example.leaf</value>
</prop>
<prop oor:name="Label">
<value xml:lang="en-US">Demo Options</value>
</prop>
<prop oor:name="OptionsPage">
<value>%origin%/dialogs/DLDialog.xdl</value>
</prop>
<prop oor:name="EventHandlerService">
<value>com.example.EventHandler</value>
</prop>
</node>
</node>
</node>
</node>
</oor:component-data>
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.example;
import com.sun.star.awt.XContainerWindowEventHandler;
import com.sun.star.lang.WrappedTargetException;
import com.sun.star.uno.AnyConverter;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
/**
*
* @author Karthik
*/
public class EventHandler implements XContainerWindowEventHandler {
public boolean callHandlerMethod(com.sun.star.awt.XWindow aWindow,
Object aEventObject, String sMethod)
throws WrappedTargetException {
if (sMethod.equals("external_event")) {
try {
return handleExternalEvent(aWindow,
aEventObject);
} catch (com.sun.star.uno.RuntimeException re) {
throw re;
} catch (com.sun.star.uno.Exception e) {
throw new WrappedTargetException(sMethod, this,
e);
}
} else if (sMethod.equals("another_method_name")) {
}
return false;
}
private boolean handleExternalEvent(com.sun.star.awt.XWindow aWindow,
Object aEventObject)
throws com.sun.star.uno.Exception {
try {
String sMethod = AnyConverter.toString(aEventObject);
if (sMethod.equals("ok")) {
JOptionPane.showMessageDialog(new JFrame(), "Ok
clicked");
} else if (sMethod.equals("back") ||
sMethod.equals("initialize")) {
JOptionPane.showMessageDialog(new JFrame(),
"Back clicked");
}
return true;
} catch (com.sun.star.lang.IllegalArgumentException e) {
throw new com.sun.star.lang.IllegalArgumentException(
"Method external_event requires a string in the
event object argument.", this,
(short) -1);
}
}
public String[] getSupportedMethodNames() {
return new String[]{"demo"};
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@openoffice.org
For additional commands, e-mail: dev-h...@openoffice.org