1 Reply Latest reply on Jul 3, 2007 10:29 AM by Koen Aers

    semantic element creation

    Matthew Sandoz Newbie

      i am trying to figure out the least intrusive way to code in creation of a hierarchy of semantic elements from a new node dropped from the palette. here's my scenario (the first two steps work fine)

      1. user selects a palette entry for my node.
      2. a semantic element and adapter are created
      3. an action and data for the action are created with the node and adapters and xml nodes are created

      what is the preferred way of making sure multiple levels of defaults exist both in the xml and model? the model constructor? initialize() in the adapter? getDefaultValue() in the adapter? or is there a better way?

        • 1. Re: semantic element creation
          Koen Aers Master

          Hi Matthew,

          I opt for the semantic element constructor. This guy is the master, the xml and notation element are nothing but observers of this master.
          The initialize in the xml adapter is used to make sure the values of the different attributes on the model are being set on the xml, so you have to implement this initialization step as well.
          The getDefaultValue() in the adapter serves only to remove attributes in the xml that have their default value. e.g. if the default value of an attribute is 'abc', specifying this in the getDefaultValue() method will make sure that the attribute disappears from the xml if the model has the value 'abc' for this particular property.

          Regards,
          Koen