joergreichert / spray

Automatically exported from code.google.com/p/spray
1 stars 2 forks source link

Palette definition not intuitive #77

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When I first defined a diagram editor in the Spray DSL, I wrote something like 
that:

class State :
   container  (  ) 
   {
      text (  )  { name };          
   }

Then I opened the diagram editor and wondered, that there is no palette. I 
found out, that I have to define additionally

   behavior {
      create palette "PaletteName";
   }

I think this counterintuitive. First, an entry in the palette is essential. By 
default Graphiti defines the compartments Objects and Connections and put nodes 
in Objects and References in Connections. The Spray Generator always overrides 
the IPaletteCompartmentEntry[] getPalette() method in the 
ToolBehaviourProviderBase, so if you forget to define the palette, you get 
surprised. 
That the palette is managed as a behavior is a technical aspect of Graphiti and 
is not obvious to the user. 

I would suggest defining palette this way:

paletteCompartments {
   classes alias "The classes"
   references alias "The references"
} 

class State :
   paletteCompartment classes
   container  (  ) 
   {
      text (  )  { name };          
   }

If there is no palette compartments defined the getPalette() in 
ToolBehaviourProviderBase should not be overridden or at least the code in the 
overridden method should call super.getPalette().

This is just a proposal, have your thoughts on it.

Original issue reported on code.google.com by de.abg.r...@gmail.com on 10 Nov 2011 at 5:37

GoogleCodeExporter commented 9 years ago
Just a side note, the referenced attributes types there seems no way to define 
the palette compartment, they are always placed in a compartment named Create. 
With my proposal, you can write that:

paletteCompartments {
   ...
   attributes alias "The attributes"
} 

class ...:
   container ... {
      ...
      reference actions attribute name palette attributes
   }

Original comment by de.abg.r...@gmail.com on 10 Nov 2011 at 5:44