Hi Bartolomeo,
I have some problem with listener on MasterField. I would know when a
UserField value changes.
I write the following code but it don't work, event isn't generated.
What's wrong?
/*my listener structure*/
public class ListenerChange implements XPropertyChangeListener
{
public void propertyChange(PropertyChangeEvent arg0) {
System.out.println("propertyChange");
}
public void disposing(EventObject arg0) {
System.out.println("disposing");
}
}
/* code to register the listener*/
XMultiServiceFactory mxDocFactory =
(XMultiServiceFactory)UnoRuntime.queryInterface(
XMultiServiceFactory.class, xTextDocument);
XText xText = xTextDocument.getText();
XDependentTextField
xUserField = (XDependentTextField) UnoRuntime.queryInterface (
XDependentTextField.class,
mxDocFactory.createInstance(
"com.sun.star.text.TextField.User"));
// Create a fieldmaster for our newly created User
Text field, and access it's
// XPropertySet interface
XPropertySet xMasterPropSet = (XPropertySet)
UnoRuntime.queryInterface(
XPropertySet.class, mxDocFactory.createInstance(
"com.sun.star.text.FieldMaster.User"));
// Set the name and value of the FieldMaster
xMasterPropSet.setPropertyValue
("Name", "UserEmperor");
xMasterPropSet.setPropertyValue ("Value", new
Integer(42));
xMasterPropSet.addPropertyChangeListener("Value",listenerChange);
// Attach the
field master to the user field
xUserField.attachTextFieldMaster(xMasterPropSet);
xText.insertTextContent
(xText.createTextCursor(),xUserField, false );
The PropertyChangeListener is only called for Bound-properties ... as
for as I know those only exist in the area of FormControls ... so a
PropertyChangedEvent won't be fired for "your" Property.
Regards
Stephan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]