Framework Customization: Hide Elements (Tags) in AuthorView using Stylesfilter.
Having trouble installing Oxygen? Got a bug to report? Post it all here.
-
- Posts: 16
- Joined: Wed Jan 12, 2022 6:17 pm
Framework Customization: Hide Elements (Tags) in AuthorView using Stylesfilter.
Hi,
i want to hide several XML-Tags ( and their children) , from the AuthorView.
I used the following approach:
In a Stylesfilter, i check for the AuthorNode which i want to hide. I then use the according Styles object which i receive in the filter Method and do
I aussme this sets the CSS-Property display to value none, which i would expect that this hides the Element.
But it seems that setting this property has no effect at all.
If i use the Tags get invisibile, but of course the Element still takes its space in the Layout.
Does someone know how i can hide Elements completly from AuthorView, including that they dont need any space in the Layout?
Greetings
Stevee
i want to hide several XML-Tags ( and their children) , from the AuthorView.
I used the following approach:
In a Stylesfilter, i check for the AuthorNode which i want to hide. I then use the according Styles object which i receive in the filter Method and do
Code: Select all
styles.setProperty(Styles.KEY_DISPLAY, "none");
But it seems that setting this property has no effect at all.
If i use
Code: Select all
styles.setProperty(Styles.KEY_VISIBILITY, "hidden");
Does someone know how i can hide Elements completly from AuthorView, including that they dont need any space in the Layout?
Greetings
Stevee
-
- Posts: 16
- Joined: Wed Jan 12, 2022 6:17 pm
Re: Framework Customization: Hide Elements (Tags) in AuthorView using Stylesfilter.
Sorry, i forgot to add some additional Information about my used Oxygen Version:
I am using:
<oXyygen/> XML Author 23.1 , build: 2021030206
Eclipse Plugin.
I am using:
<oXyygen/> XML Author 23.1 , build: 2021030206
Eclipse Plugin.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Framework Customization: Hide Elements (Tags) in AuthorView using Stylesfilter.
Hi Steeve,
I tried this on my side:
1) An XML document looking like this:
2) With the StylesFilter implementation I attempt to hide its entire "prolog":
and this seems to work for me. That "ro.sync.ecss.css.CSS.NONE" is equivalent to the literal "none" that you are using.
Can you try something similar on your side? Does your StylesFilter's "filter" method actually get called?
How did you set up the StylesFilter on your side?
Regards,
Radu
I tried this on my side:
1) An XML document looking like this:
Code: Select all
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "topic.dtd">
<topic id="topic_vfq_mbq_x5b">
<title>T</title>
<prolog>
<author>hidden</author>
<resourceid/>
</prolog>
<body>
<p>para</p>
</body>
</topic>
Code: Select all
new StylesFilter() {
@Override
public String getDescription() {
return "abc";
}
@Override
public Styles filter(Styles styles, AuthorNode authorNode) {
if("prolog".equals(authorNode.getName())) {
styles.setProperty(Styles.KEY_DISPLAY, ro.sync.ecss.css.CSS.NONE);
}
return styles;
}
}
Can you try something similar on your side? Does your StylesFilter's "filter" method actually get called?
How did you set up the StylesFilter on your side?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 16
- Joined: Wed Jan 12, 2022 6:17 pm
Re: Framework Customization: Hide Elements (Tags) in AuthorView using Stylesfilter.
Hi Radu,
thanks for your reply.
My code gets called. If i set another CSS-Property like the visibility - hidden, that works, and the style is applied to the authorNode that i expect that it has to.
My Stylesfilter Method looks like this:
I also checked for other Styling Information. There is a CSS-Associated with the Document that is currently in editing (and for which the Stylesfilter is applyed for), but even if i remove the CSS-Files from the Document that does not work.
If i use the CSS-Property (display:none) directly in an associated CSS-File, it works.
thanks for your reply.
My code gets called. If i set another CSS-Property like the visibility - hidden, that works, and the style is applied to the authorNode that i expect that it has to.
My Stylesfilter Method looks like this:
Code: Select all
@Override
public Styles filter(Styles styles, AuthorNode authorNode) {
if (authorNode.getType() == AuthorNode.NODE_TYPE_ELEMENT) {
if (shouldHideElement(authorNode)) { //Determines if a element should be visibile
styles.setProperty(Styles.KEY_DISPLAY, "none");
// styles.setProperty(Styles.KEY_VISIBILITY, "hidden"); //This would take effect if it is not a comment.
}
}
return styles;
}
If i use the CSS-Property (display:none) directly in an associated CSS-File, it works.
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Framework Customization: Hide Elements (Tags) in AuthorView using Stylesfilter.
Hi,
Can you also answer the questions I asked in my previous post:
Does your StylesFilter's "filter" method actually get called?
- Maybe here you can add some logging in the "if" clause like "System.err.println(authorNode);" to see if the node is actually matched by your "shouldHideElement" method.
How did you set up the StylesFilter on your side?
Regards,
Radu
Can you also answer the questions I asked in my previous post:
Does your StylesFilter's "filter" method actually get called?
- Maybe here you can add some logging in the "if" clause like "System.err.println(authorNode);" to see if the node is actually matched by your "shouldHideElement" method.
How did you set up the StylesFilter on your side?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
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