is this forum active any more

27 views
Skip to first unread message

janu

unread,
May 11, 2012, 4:13:42 PM5/11/12
to dockableflex
i have some questions, but i am not sure if this is right place to
post...

toshe

unread,
May 16, 2012, 10:24:26 AM5/16/12
to dockableflex
try to post and see

janu

unread,
May 17, 2012, 8:44:49 PM5/17/12
to dockableflex
i love your framework.. i am playing with it.. and loving it...
i just want to persist layouts that i create in database.

what is the best approach ? i want to read all user created layouts
and store that in database and retrieve it back.
also how can i make created layout non-draggable.. here is the
requirement.. once user saves layouts.. he is not allowed to change..

i just want some direction.. as i am ready to read and modify code...

thanks a lot..

toshe

unread,
May 18, 2012, 6:16:04 PM5/18/12
to dockableflex
I had similar problem and what I've done for saving:
1. Get the root element of all flexdockable components and go through
the whole hierarchy.
2. For every flexdockable component I create a simple as3 object and
save the following component properties "x", "y", "width", "height",
"label", "percentWidth", "percentHeight", "text", "selectedIndex" plus
its class name to it. This new object is then inserted into the
corresponding object of the parent of the component.
3. After this i can persist the root as3 object.
(4. In my case I need only to store the bytes in the local user
storage aka flash cookie, but you can store them in a DB)

On starting I load the as3 object and create the same hierarchy and
properties and the application is restored.
But In your case by restoring the user objects you can create
tabnavigator instead of dockabletabnavigator and hbox instead of
dockablehdividedbox. So the user will not have the possibility to
change anything.

Here the example code for saving:

static private const persistentFields:Array = ["x", "y", "width",
"height", "label",
"percentWidth", "percentHeight", "text", "selectedIndex"];

static private function
saveObject(obj:UIComponent):Object {
var o:* = {};
o.className = getQualifiedClassName(obj);
for each (var s:String in persistentFields)
if (obj.hasOwnProperty(s))
o[s] = obj[s];
o.children = [];
if (obj is Container && !isDockableComponent(obj))
for each (var childObj:DisplayObject in (obj as
Container).getChildren())
if (childObj is UIComponent)
o.children.push(saveObject(childObj as UIComponent));
return o;
}

You must also implement isDockableComponent as I use also a custom
function.
The code for loading is very customized for my case.

hope this can help.
Toshe
Reply all
Reply to author
Forward
0 new messages