OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

cgmo-webcgm message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re[6]: [cgmo-webcgm] ISSUE: what does 'get..' return? [2 of 2]


Hi Dieter,

See inline...

Thursday, April 28, 2005, 10:22:15 AM, Dieter wrote:

DW> Hi Benoit,

DW> First of all, I agree that an empty string should be returned.
DW> If I then follow your comments, I see the following challenges:

>> DW>   How do I return to the initial state?
>> DW>   I can delete the attribute, no problem.
>> We've made 'visibility' and 'interactivity' WebCGM APS attribute as
>> oppose to style attributes (like stroke, intensity, stroke-width
>> etc...), so the clearStyle() method doesn't work.
>>
>> You have to either:
>> - reload the file.
>> - remove the attribute.
>> - or your script has to remember the previous value.

DW> I can not set the previous value it was not "on" or "off", right?
What do you mean?

var prev = obj.getAppStructureAttr( "visibility" );
obj.setAppStructureAttr( "visibility", "off" );
if( prev == "" )
  obj.removeAppStructureAttr( "visibility" );
else
  obj.setAppStructureAttr( prev );
  
DW> Or is an empty string also a legal value for a set call?
No, empty string is not a legal value for a set call. (Note: there has
been numerous issues raised about this on multiple mailing lists, DOM,
SVG etc... I advise that we stay away from this).

DW> For an XCF value?
We have not defined what should happen.

DW> If this is the case then I have everything I need.
If this is what case?

DW> Otherwise we would need a value "inherit" to do this.
DW> There are use cases for this, e.g.

DW> - Make everything invisible on a layer by setting its visibility to "off"
DW> - Make one object on this layer visibible by setting it to "on"
DW> - after some other operations, I want to restore the previous state.
Are you talking of achieving this with xcf only or with scripts? Is
this not ok? 

var layerPrev = l.getAppStructureAttr( "visibility" );
var objPrev = o.getAppStructureAttr( "visibility" );

l.setAppStructureAttr( "visibility", "off" );
o.setAppStructureAttr( "visibility", "on" );

if( layerPrev == "" )
  l.removeAppStructureAttr( "visibility" );
else
  l.setAppStructureAttr( layerPrev );

if( objPrev == "" )
  o.removeAppStructureAttr( "visibility" );
else
  o.setAppStructureAttr( objPrev );

DW> Reloading the file is not a good option, since you would lose all changes
DW> applied by one/multiple XCFs and/or DOM calls.
Understood.

-- 
 Benoit   mailto:benoit@itedo.com

DW> Regards,
DW> Dieter





>> -----Original Message-----
>> From: Benoit Bezaire [mailto:benoit@itedo.com]
>> Sent: Thursday, April 28, 2005 3:21 PM
>> To: cgmo-webcgm@lists.oasis-open.org
>> Subject: Re[4]: [cgmo-webcgm] ISSUE: what does 'get..' return? [2 of 2]
>>
>>
>> Hi all,
>>
>> This thread is not using the right terminology and that's confusing
>> me. I don't like the word "undefined", there is no such word in the
>> DOM getAttribute() method. An attribute is either 'specified'
>> (explicitly written in the file, attName="value") or has a default
>> value (from a schema or DTD, ex: version="2.0").
>>
>> The DOM getAttribute() method returns an empty string if the attribute
>> is not specified or assigned a default value in the DTD. Not
>> "undefined".
>>
>> Question: Is there a big different between returning an empty string
>> or returning the "inherit" string?
>>
>> To me there isn't since they both mean that the attribute is not
>> specified on the object.
>>
>> More inline.
>>
>> Thursday, April 28, 2005, 5:38:04 AM, Dieter wrote:
>>
>> DW> Hi Lofton,
>>
>> DW> we are close.
>>
>> LH>> Here is our conceptual disagreement.  Because the 3.2.2.9
>> model (above)
>> LH>> says "Inherited: yes", you are interpreting that as meaning that the
>> LH>> initial value for an unspecified attribute must be
>> 'inherit'.  I don't
>> LH>> think that necessarily follows.  IMO, our model currently works
>> LH>> fine this way:
>> LH>>
>> LH>> 1.) if explicitly set value on particular node, that is it for
>> LH>> both display and DOM query (no dispute here);
>> DW> Agreed.
>>
>> LH>> 2.) if no explicitly set value on particular node, including on any
>> LH>> ancestors, then "Initial value" is used for display ("Initial
>> LH>> value: on" rules);
>> DW> Agreed.
>>
>> LH>> 3.) if no explicitly set value on particular node, but explicit on an
>> LH>> ancestor, then that ancestor value used for display ("Inherited: yes"
>> LH>> rules, overrides initial value);
>> DW> see comment below.
>>
>> LH>> 4.) if no explicitly set value on particular node, DOM query returns
>> LH>> "undefined" (standard DOM rule)
>> LH>>
>> DW> agreed. The behavior is inherit then, though.
>> I don't think we should re-invent an inheritance model with 1,2,3,4.
>> It is already defined in the spec, please read: 5.4.1.1 Specified
>> values. That particular wording talks about the CSS style attribute
>> which should be replaced to WebCGM Style attributes (or something
>> equivalent), but the concept is there.
>>
>> DW> I guess my confusion is based on my lack of understanding,
>> what "initial
>> DW> value" means. I have no problem with 4.), a programmer then knows
>> DW> that he has to walk up the tree to compute the actual behavior, if
>> DW> there is any specified on ancestors.
>>
>> DW> Questions:
>> DW> - initial value is used until an explicit value is set using
>> a DOM call,
>> DW> right?
>> Yes but note that initial value will not be used if the attribute
>> value is inherited.
>>
>> DW> - assume the following situation:
>> DW>    BEGAPS 'first'
>> DW>      'visibility' on
>> DW>      BEGAPS 'second'
>> DW>      ENDAPS;
>> DW>    ENDAPS;
>>
>> DW>   first is visible, second as well.
>> Yes.
>>
>> DW>   DOM get call on second returns "undefined" according to 4.)
>> I don't like that, I think it should return an empty string.
>>
>> DW>   Now assume a "set" call on "second"	set visibility to "off"
>> Ok.
>>
>> DW>   DOM get call on second now returns "off".
>> Yes.
>>
>> DW>   How do I return to the initial state?
>> DW>   I can delete the attribute, no problem.
>> We've made 'visibility' and 'interactivity' WebCGM APS attribute as
>> oppose to style attributes (like stroke, intensity, stroke-width
>> etc...), so the clearStyle() method doesn't work.
>>
>> You have to either:
>> - reload the file.
>> - remove the attribute.
>> - or your script has to remember the previous value.
>>
>> DW>   Then there may be one out of two situations:
>> DW> 	- ancestor has set value and controls visibility of
>> "second" from there on
>> DW> 	- no ancestor with set value.
>>
>> DW>   Does the latter case imply that "initial value" will be used,
>> DW> 	- after opening the file without modifications
>> Yes.
>>
>> DW> 	- after deleting a previously set attribute on the APS AND no
>> DW> ancestor has a set value
>> Yes.
>>
>> DW> 	- after deleting an attribute read from the WebCGM file AND no
>> DW> ancestor has a set value
>> Yes.
>>
>> DW> - how do I set the "undefined" state from within an XCF?
>> DW>    BEGAPS 'first'
>> DW>      'visibility' on
>> DW>    ENDAPS;
>> You cannot (not at the moment). Is this something you believe users
>> will want to do?
>>
>> DW> I can set visibility="on" or visibility="off". How do I delete the
>> DW> attribute, or in other words, how do I set this APS to inherit its
>> DW> behavior from its ancestors?
>> We would need the "inherit" value for that.
>>
>> --
>>  Benoit   mailto:benoit@itedo.com





[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]