MinimalConfigurator configuration idea

32 views
Skip to first unread message

Jerome

unread,
Feb 2, 2011, 10:34:04 AM2/2/11
to MinimalComps
Hello,

I use MinimalConfigurator and I really enjoy it. However I think it
could be more usable. Let me explain :

We can have an heavy, unreadable XML config like this :
var xml:XML = <comps>
<VBox id="vbox">
<HUISlider id="tx" label="x" width="300" labelPrecision="0"
tick="1" minimum="-50" maximum="150" value={test.x}
event="change:onSliderChange"/>
<HUISlider id="ty" label="y" width="300" labelPrecision="0"
tick="1" minimum="-50" maximum="150" value={test.y}
event="change:onSliderChange"/>
<HUISlider id="twidth" label="width" width="300"
labelPrecision="0" tick="1" minimum="-20" maximum="400"
value={test.width} event="change:onSliderChange"/>
<HUISlider id="theight" label="height" width="300"
labelPrecision="0" tick="1" minimum="-20" maximum="200"
value={test.height} event="change:onSliderChange"/>
</VBox>
</comps>;

configurator = new MinimalConfigurator(this);
configurator.parseXML(xml);

//

You can see that I create here 4 HUISlider. And each override basic
values like width, labelPrecision, tick, ...

A cool idea could be to define an optional XML that can set default
value for each component. For example :

var default:XML = <comps>
<HUISlider width="300" labelPrecision="0" tick="1" minimum="-50"
maximum="150" event="change:onSliderChange"/>
</comps>;

then create the config XML :
var xml:XML = <comps>
<VBox id="vbox">
<HUISlider id="tx" label="x" value={test.x} />
<HUISlider id="ty" label="y"value={test.y} />
<HUISlider id="twidth" label="width" minimum="-20" maximum="400"
value={test.width} />
<HUISlider id="theight" label="height" minimum="-20" maximum="200"
value={test.height} />
</VBox>
</comps>;

then initialize like that :
configurator = new MinimalConfigurator(this, default);
configurator.parseXML(xml);

with a signature like that :
MinimalConfigurator(DisplayObjectContainer, default:XML = null);

The default XML is just stored. When you parse the configXML to create
the Components. If the node name exists in the default XML stored, and
if the attibutes stored doesn't exists in the current parsed node of
the config file, you use it for the setup.

What do you think ?

Vic

unread,
Feb 2, 2011, 11:39:49 PM2/2/11
to MinimalComps
I am not a fan of anything xml.
Reminds me of MXML or HTML DOM, slowness, memory use, hard to debug,
etc, etc. XML memories to me are negative.

Vic

FlashBoy

unread,
Feb 3, 2011, 12:45:35 AM2/3/11
to MinimalComps
Thats the good idea..... whether these kind of option is there in
MXML?

also we can have additional attribute whether default need to applied
or not.... default="true" or default="false"

I think we can implement this idea in MinimalConfigurator ourself....
and tell Keith....

FlashBoy

unread,
Feb 3, 2011, 12:46:16 AM2/3/11
to MinimalComps
not default... applyDefault="true" or "false"

FlashBoy

unread,
Feb 3, 2011, 12:50:00 AM2/3/11
to MinimalComps
Also we can have different different default along with a id say
"default_1"...."default_2".....

In component, we can add a attribute defaultID="default_1"
Reply all
Reply to author
Forward
0 new messages