Page 1 of 1

Autocompletion: Attributes list

Posted: Wed Oct 23, 2013 11:49 am
by sebastienlavandier
Hi,
I work with the author component.

I created a button/action for add an specific attribute to a specific node.
Now, I want list all the possible "ID" (all the alredy referenced ID) in a list like It's do when I write a new attribute in text/author mode.

Could you help me ?
Thanks in advance for you r help.

Sébastien

Re: Autocompletion: Attributes list

Posted: Wed Oct 23, 2013 12:33 pm
by Radu
Hi Sébastien,

You can run XPaths over the entire document using API like this:

ro.sync.ecss.extensions.api.AuthorDocumentController.evaluateXPath(String, boolean, boolean, boolean)

So you can run an XPath which lists all IDs in the document and then add them to a list which is presented to the user.

Regards,
Radu

Re: Autocompletion: Attributes list

Posted: Wed Oct 23, 2013 2:51 pm
by sebastienlavandier
I can't implemented an existing action to access to the Oxygen list ?

Sébastien

Re: Autocompletion: Attributes list

Posted: Wed Oct 23, 2013 3:12 pm
by Radu
Hi,

You could also try something like this:

Code: Select all

AuthorSchemaManager sm = authorAccess.getDocumentController().getAuthorSchemaManager();
AuthorElement currentElement = ....;
WhatPossibleValuesHasAttributeContext ctxt = sm.createWhatPossibleValuesHasAttributeContext(currentElement, "id");
List<CIValue> vals = sm.whatPossibleValuesHasAttribute(ctxt);
Regards,
Radu