Template classes for user defined complex item instances (re-usable)
Posted: Wed Apr 10, 2019 12:32 pm
Regarding elements which are made of multiple other elements (compound objects) it would be wonderful to be able to define a "template class" for such elements in order to instance them multiple times. Changing the template would also change all instances of this compound object.
This would allow to define "classes" with a user defined layout and inner logic and then create multiple instances of these. Each template would be made of all available other elements (including other template classes = nesting of template elements!) in LL and allow to manage this compound object as if it was a "native" element in LL.
Each template class shall really inherit its layout and behavior to all instanciated items of this template. So in a sense it acts like a real class.
The advantages are great:
- behavior and properties of a user defined design have only to be defined once and can be re-used multiple times
- changing the template "class" automatically changes all instances across LL = saves time and is really powerful
- the inner logic of a class would include scripts, variables, properties and events and defines the layout and behavior of a template class
Defining a template class would not even require a separate editor. All that's required would be a method to combine a selection of multiple elements in a template class. This class then is bound together as if it was one object.
Each template class would define some properties for the "outside" world so that you can still configure it. So a list of "exposed" propeties and methods as they exist for Java classes as well would be perfect to control an instance of the template class.
A additional page "public properties" and "public scripts" or something would make sense. All other properties and scripts are used internally only in the template class. So the user can define what should be exposed, including new user-defined properties that are used internally for calculations etc.
As an example a exspose "public property" could be a color. This color could be aplied to multiple elements inside of the instance. Variants of this color could be claculated inside the instance to generate shades of this color. But from "outside" the user only has to define one color and the rest is part of the template class.
Changing a template class would open the elements of the compound object as if it was on a separate desktop. There these elements live in their own local coordiante system and you can add an remove elements as desired and define the behavior of the template class through scripts, properties and variables.
I believe LL already has a lot of mechanisms to support such a template system. And it would be really very powerful.
I hope you like it
This would allow to define "classes" with a user defined layout and inner logic and then create multiple instances of these. Each template would be made of all available other elements (including other template classes = nesting of template elements!) in LL and allow to manage this compound object as if it was a "native" element in LL.
Each template class shall really inherit its layout and behavior to all instanciated items of this template. So in a sense it acts like a real class.
The advantages are great:
- behavior and properties of a user defined design have only to be defined once and can be re-used multiple times
- changing the template "class" automatically changes all instances across LL = saves time and is really powerful
- the inner logic of a class would include scripts, variables, properties and events and defines the layout and behavior of a template class
Defining a template class would not even require a separate editor. All that's required would be a method to combine a selection of multiple elements in a template class. This class then is bound together as if it was one object.
Each template class would define some properties for the "outside" world so that you can still configure it. So a list of "exposed" propeties and methods as they exist for Java classes as well would be perfect to control an instance of the template class.
A additional page "public properties" and "public scripts" or something would make sense. All other properties and scripts are used internally only in the template class. So the user can define what should be exposed, including new user-defined properties that are used internally for calculations etc.
As an example a exspose "public property" could be a color. This color could be aplied to multiple elements inside of the instance. Variants of this color could be claculated inside the instance to generate shades of this color. But from "outside" the user only has to define one color and the rest is part of the template class.
Changing a template class would open the elements of the compound object as if it was on a separate desktop. There these elements live in their own local coordiante system and you can add an remove elements as desired and define the behavior of the template class through scripts, properties and variables.
I believe LL already has a lot of mechanisms to support such a template system. And it would be really very powerful.
I hope you like it