[oXygen-user] Multiple but independent inline editors
Alex Jitianu
alex_jitianu at sync.ro
Tue Nov 12 04:02:15 CST 2013
Hi Felix,
It slipped my mind but you can get such a behavior by using the
"visible" property on a form control together with the oxy_xpath
function. If we take this XML example:
<root>
<elem attr1="test"></elem>
<elem attr1="test" attr2="test2"></elem>
<elem attr2="test2" attr3="test3"></elem>
</root>
You can write a CSS rule like so:
elem:before {
content:
oxy_label(text, "Attr1 ", styles, oxy_xpath("if (exists(.[@attr1]))
then 'display:inline' else 'display:none'")) oxy_textfield(edit,
'@attr1', visible, oxy_xpath('exists(.[@attr1])'))
oxy_label(text, "Attr2 ", styles, oxy_xpath("if (exists(.[@attr2]))
then 'display:inline' else 'display:none'")) oxy_textfield(edit,
'@attr2', visible, oxy_xpath('exists(.[@attr2])'))
oxy_label(text, "Attr3 ", styles, oxy_xpath("if (exists(.[@attr3]))
then 'display:inline' else 'display:none'")) oxy_textfield(edit,
'@attr3', visible, oxy_xpath('exists(.[@attr3])'))
}
Best regards,
Alex
On 12-Nov-13 11:15 AM, Alex Jitianu wrote:
> Hi Felix,
>
> Currently there is no way to write CSS rules that accumulate instead of
> override. And it's true that defining rules for all possible
> combinations can be quite cumbersome. From what I understand you only
> want to edit an attribute if it's already present in the XML instance.
> But how will you set a value for an attribute that is not yet present?
> Wouldn't be better to add form controls for all these attributes even if
> they are not yet specified in the CSS?
>
> span {
> content: form controls for translate, locNode, term etc
> }
>
> I'll add an issue to think on how we can achieve this use case.
> Meanwhile you could use our Java based API and write a StylesFilter. In
> this implementation you can take a look and see what attributes are set
> and dynamically add form controls for those attributes only. Of course
> you should also listen for attributes changes and reset the styles when
> an attribute is added or removed.
>
> http://oxygenxml.com/doc/ug-editor/#topics/api_faq_add_form_control_from_filter.html
> http://oxygenxml.com/doc/ug-editor/topics/dg-author-extension-state-listener.html
> http://www.oxygenxml.com/InstData/Editor/SDK/javadoc/ro/sync/ecss/extensions/api/AuthorListener.html
>
>
>
> Best regards,
> Alex
> --
> Alex Jitianu
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com
>
> On 11-Nov-13 6:13 PM, Felix Sasaki wrote:
>> Hi all,
>>
>> another newbie question I assume.
>>
>> I want to add a set of inline editors. With a dedicated CSS style and given
>> <span its:translate="no">...
>> an editor for editing the "translate" attribute, a combo box editor
>> should be available for editing the attribute.
>>
>> The issue is that there are many of such attributes, e.g.
>> <span its:translate="no" its:locNote="..." its:storageSize="..."
>> its:term="..."> ...
>>
>> First I thought of creating a combobox for each of these. But CSS
>> selectors don't allow you to match several rules at once. So if I have
>>
>> *[its|translate]:before { combobox def here }
>>
>> and later in the stylesheet
>>
>> *[its|term]:before { combobox def here }
>>
>> an element like above that contains both attributes will only show the
>> combox for "its:term". I can write
>>
>> *[its|translate][its|term]:before { combobox def here }
>>
>> but this will show comboxes for all attributes even if they are not present.
>>
>> I tried a workaround: defining CSS rules for all potential combinations,
>> that is: only translate, only term, both translate+term, ... but since
>> there are a lot of attributes to consider, the CSS stylesheet looks
>> really bad.
>>
>> Maybe there is a workaround that does not rely on CSS selectors?
>>
>> Thanks,
>>
>> Felix
>> _______________________________________________
>> oXygen-user mailing list
>> oXygen-user at oxygenxml.com
>> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>>
> _______________________________________________
> oXygen-user mailing list
> oXygen-user at oxygenxml.com
> http://www.oxygenxml.com/mailman/listinfo/oxygen-user
>
More information about the oXygen-user
mailing list