I've recently begun working on a project regarding GUI building using some form of declarative language. What i mean is that i need to describe an hierarchy of objects, without specifying the type of GUI widgets that will be used to "show" that hierarchy. For example, for some existing hierarchy H, using JSON notation (or something like that):
H =
{
"title" : "Label_1"
"children" :
[
{
"title" : "Label_2"
"children":
[
{
"title": "Field_A"
"type": "Integer"
"value": 10
},
{
"title": "Field_B"
"type": "String"
"value": "YES"
}
]
}
]
}
Someone could build a simple window, that would be shown to the user by pressing a button labeled "Label_1". The window could be then titled "Label_2" and have two fields labeled "Field_A" and "Field_B" accepting integer and boolean values respectively.
Someone else, could put this hierarchy on a tree list, e.g
--------------------------------------------------------
>Label_1 |
>Label_2 |
>Field_A | 10
>Field_B | YES
My first question is, well, do i have to build some form of a language parser to achieve something like this ? Could i use JSON then ? Though i don't need to support complex hierarchies, there is need to support mutually exclusive hierarchies (something like radio buttons enabling/disabling options). I have the feeling that it looks like some form of language parsing with a couple of operators. Don't get me wrong, i am of a Mechanical Engineering background, and i am not an experienced programmer.
Thank you in advance for your comments and help.