checkbox Action

Oxygen general issues.
dvezina
Posts: 23
Joined: Sat Mar 08, 2014 12:10 am

checkbox Action

Post by dvezina »

Hi,

I'm using a checkbox form control in my CSS. I want to launch an action when this is clicked.

Code: Select all

 oxy_editor(
type, check,
edit, "@ready",
values, "true",
uncheckedValues, "false",
labels, "")
My first thought was to catch the attribute change in the DocumentModificationsFilter setAttribute() method but I can't seem to get at AuthorAccess there.

Code: Select all


@Override
public void setAttribute(AuthorDocumentFilterBypass filterBypass, String attributeName, AttrValue value, AuthorElement element) {

if (attributeName.equals("ready")) {
// If value is true call Helpers.updateMetadata(authorAccess);

}
super.setAttribute(filterBypass, attributeName, value, element);
Is this the correct approach? If so, how do I pass AuthorAccess to my filter? If this is not the correct approach, please advise.

Thanks
alex_jitianu
Posts: 1008
Joined: Wed Nov 16, 2005 11:11 am

Re: checkbox Action

Post by alex_jitianu »

Hello,

Using an ro.sync.ecss.extensions.api.AuthorDocumentFilter to catch the event was also my first thought! It's true that its methods don't receive an AuthorAccess instance, but such a filter it's usually created and set in a context where an AuthorAccess is available. For example on a ro.sync.ecss.extensions.api.AuthorExtensionStateListener. So you could give an AuthorAccess on the constructor of the document filter:

Code: Select all


/**
* @see ro.sync.ecss.extensions.api.AuthorExtensionStateListener#activated(ro.sync.ecss.extensions.api.AuthorAccess)
*/
public void activated(AuthorAccess authorAccess) {
AuthorDocumentController documentController = authorAccess.getDocumentController();
documentController.setDocumentFilter(new AuthorDocumentFilter(authorAccess));
}
Please let me know if this works for you or we should look for another solution.

Best regards,
Alex
dvezina
Posts: 23
Joined: Sat Mar 08, 2014 12:10 am

Re: checkbox Action

Post by dvezina »

Thanks Alex. This was very helpful and worked perfectly!
Post Reply