To comment on the following update, log in, then open the issue:
http://www.openoffice.org/issues/show_bug.cgi?id=61522
Issue #:|61522
Summary:|changes on attributes added to DocumentInfo don't
|fire propertyChange/vetoableChange
Component:|framework
Version:|OOo 2.0.1
Platform:|All
URL:|
OS/Version:|Windows XP
Status:|UNCONFIRMED
Status whiteboard:|
Keywords:|
Resolution:|
Issue type:|DEFECT
Priority:|P3
Subcomponent:|code
Assigned to:|tm
Reported by:|leguff
------- Additional comments from [EMAIL PROTECTED] Thu Feb 2 04:17:34 -0800
2006 -------
Use the following java code to create an additional attribute stored at the
document (not you'll need jdk1.5 for it!).
After running the class (of course you have to ensure that the needed jars
are in the CLASSPATH) you'll see that the attribute was added to the document
but even setting the attribute of the property to BOUND and CONSTRAINED
don't lead into an event in case of a PropertyChange:
import com.sun.star.beans.*;
import com.sun.star.comp.helper.*;
import com.sun.star.document.*;
import com.sun.star.frame.*;
import com.sun.star.lang.*;
import com.sun.star.lang.EventObject;
import com.sun.star.uno.*;
import com.sun.star.uno.Exception;
public class Test {
@SuppressWarnings("unchecked")
public final static <T>T cast(Class<T> type, Object object) {
return (T) UnoRuntime.queryInterface(type, object);
}
public static void main(String[] args) throws BootstrapException,
Exception, InterruptedException {
XComponentContext context = Bootstrap.bootstrap();
XMultiComponentFactory factory = context.getServiceManager();
XDesktop desktop = cast(XDesktop.class,
factory.createInstanceWithContext("com.sun.star.frame.Desktop", context));
XPropertySet desktopProperties = cast(XPropertySet.class,
desktop);
XComponentLoader desktopLoader = cast
(XComponentLoader.class, desktop);
XComponent textDocumentComponent =
desktopLoader.loadComponentFromURL("private:factory/swriter", "_blank",
FrameSearchFlag.ALL, new PropertyValue[] {});
XDocumentInfoSupplier documentInfoSupplier = cast
(XDocumentInfoSupplier.class, textDocumentComponent);
XDocumentInfo documentInfo =
documentInfoSupplier.getDocumentInfo();
XPropertyContainer documentInfoContainer = cast
(XPropertyContainer.class, documentInfo);
XPropertySet documentProperties = cast
(XPropertySet.class, documentInfo);
System.out.println("setting document variable");
documentInfoContainer.addProperty("test", (short)
(PropertyAttribute.REMOVEABLE | PropertyAttribute.BOUND), "content");
documentProperties.addPropertyChangeListener("", new
XPropertyChangeListener() {
public void disposing(EventObject arg0) {
System.out.println("Disposing");
}
public void propertyChange(PropertyChangeEvent arg0) {
System.out.println("PropertyChanged: " +
arg0.PropertyName);
}
});
documentProperties.addVetoableChangeListener("", new
XVetoableChangeListener() {
public void disposing(EventObject arg0) {
System.out.println("Disposing");
}
public void vetoableChange(PropertyChangeEvent arg0)
throws PropertyVetoException {
System.out.println("PropertyVeto: " +
arg0.PropertyName);
}
});
Thread.sleep(1000); // just to be sure that listener
registration is finished
System.out.println("setting document variable again");
documentProperties.setPropertyValue("test", "lall");
}
}
---------------------------------------------------------------------
Please do not reply to this automatically generated notification from
Issue Tracker. Please log onto the website and enter your comments.
http://qa.openoffice.org/issue_handling/project_issues.html#notification
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]