StylesFilter issue when reopening document
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 240
- Joined: Wed Jun 17, 2015 12:46 pm
StylesFilter issue when reopening document
Hi,
I am using oxygen SDK 19.1.0.3 and I have a problem with the StylesFilter class.
The goal is to add programmatically a combobox at a particular node. I want to do this programmatically because the labels and the values of this combobx are not fixed.
For this purpose, I added this kind of code in MyStylesFilter :
When I launch my application and open the document, I see the combobox perfectly.
But, if I close the document and re-open the same document, the combobox does not appear.
If I press F5, the combobox re-appears.
In the same way, if the combobox is not visible, if I collapse and expand the block in which the combobox is located, the combobox re-appears.
It's like the page didn't want to render...
Can you help me on this ?
Thanks,
Johann
I am using oxygen SDK 19.1.0.3 and I have a problem with the StylesFilter class.
The goal is to add programmatically a combobox at a particular node. I want to do this programmatically because the labels and the values of this combobx are not fixed.
For this purpose, I added this kind of code in MyStylesFilter :
Code: Select all
if (AuthorNode.NODE_TYPE_ELEMENT == authorNode.getType() && ("myElement".equals(authorNode.getName()))) {
Map<String, Object> formControlArgs = new HashMap<>();
formControlArgs.put(InplaceEditorArgumentKeys.PROPERTY_TYPE,
InplaceEditorArgumentKeys.TYPE_COMBOBOX);
formControlArgs.put(InplaceEditorArgumentKeys.PROPERTY_EDIT_QUALIFIED, "@myAttribute");
formControlArgs.put(InplaceEditorArgumentKeys.PROPERTY_VALUES, "value1,vale2,value3");
formControlArgs.put(InplaceEditorArgumentKeys.PROPERTY_LABELS, "label1,label2,label3");
formControlArgs.put(InplaceEditorArgumentKeys.PROPERTY_EDITABLE, "false");
StaticContent[] mixedContent = new StaticContent[]{new EditorContent(formControlArgs)};
styles.setProperty(Styles.KEY_MIXED_CONTENT, mixedContent);
return styles;
}
But, if I close the document and re-open the same document, the combobox does not appear.
If I press F5, the combobox re-appears.
In the same way, if the combobox is not visible, if I collapse and expand the block in which the combobox is located, the combobox re-appears.
It's like the page didn't want to render...
Can you help me on this ?
Thanks,
Johann
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: StylesFilter issue when reopening document
Post by alex_jitianu »
Hi Johann,
Does it work better if you put it on a BEFORE?
By the way, the value of PROPERTY_EDIT_QUALIFIED should be the attribute name (no @) is the attribute is from no-namespace.
If the attribute is from a namespace, then it should be {namespace.uri}attributeLocalName .
Unfortunately I didn't managed to reproduce such a behavior myself. Here is how I tried:
1. I've created the sample SDK project
2. Inside oxygen-sample-framework, I've added your sample code inside simple.documentation.framework.extensions.SDFStylesFilter
3. I've built the project (mvn install) and unzipped the resulting artifact inside bundle-framework/oxygen-frameworks directory
4. I've built the bundle-framework project (mvn install)
5. Finally, inside the project oxygen-sample-swing-component I've run the main class com.oxygenxml.sdksamples.AuthorComponentSample
I've opened an XML document like the one below (is the sort of document on which the sample framework matches on):
I've reproduced the steps you've described (open another file, open the sample file again) but in my case the form control is always presented.
Best regards,
Alex
Does it work better if you put it on a BEFORE?
Code: Select all
if(authorNode.getType() == AuthorNode.NODE_TYPE_PSEUDO_ELEMENT
&& "before".equals(authorNode.getName())) {
authorNode = authorNode.getParent();
if ("myElement".equals(authorNode.getName())) {
..................
}
}
Code: Select all
formControlArgs.put(InplaceEditorArgumentKeys.PROPERTY_EDIT_QUALIFIED, "myAttribute");
Unfortunately I didn't managed to reproduce such a behavior myself. Here is how I tried:
1. I've created the sample SDK project
2. Inside oxygen-sample-framework, I've added your sample code inside simple.documentation.framework.extensions.SDFStylesFilter
3. I've built the project (mvn install) and unzipped the resulting artifact inside bundle-framework/oxygen-frameworks directory
4. I've built the bundle-framework project (mvn install)
5. Finally, inside the project oxygen-sample-swing-component I've run the main class com.oxygenxml.sdksamples.AuthorComponentSample
I've opened an XML document like the one below (is the sort of document on which the sample framework matches on):
Code: Select all
<article
xmlns="http://www.oxygenxml.com/sample/documentation"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<title></title>
<section>
<title/>
<para>
<country/>
</para>
<para/>
<myElement myAttribute="value1"/>
</section>
</article>
Best regards,
Alex
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service