What's up with nifty?

I don't demand widgets… what you are doing is similar to XAML and I've been playing with WPF and Silverlight recently.



what I would like to see is some sort of system for sub-screens… Most of my UI is pretty fixed, but there are parts that I will want to be able to switch out depending on the application state… showing, for instance, a property list for a selected item in one case, or showing a list of system event notifications in another.



I'm planning to make and contribute some controls that are going to support my app, but I really need the ability to switch out parts of the gui on demand (think like UserControls in C#… where each nifty xml document is an entity that can be added and removed from the screen at need)



(and dont forget to work on the editor – nudge nudge !!)


Well, I show a tendency to misunderstand feature request on this forum so I'm not quite sure if this will help you…



BUT



you already can remove nifty elements from a screen with java code and replace them with some other, dynamically created element. I think this could already solve your request. you can't specifiy the switch on and off mechanism (!) in nifty xml but you can do that well from java already. which probably makes more sense since encoding logic in xml might get a bit cumbersome.



if you take the "multiplayer" example in the nifty-examples project for instance then the panels for each "player" are dynamically added and removed from the scene. you can probably use that mechanism for your problem too.



you can see the <controlDefinition> tag as a form of a template for a sub nifty xml tree too. you can define a secrion of your nifty xml as a <controlDefinition> and then dynamically remove and add that part to the nifty screen at runtime from java. the tutorial/demo is doing the same btw: the screen itself is fixed and only the middle part (the actual text pages you can flip through) are replaced.



I had the idea to make an alias element for <controlDefinition> and call it <template> or <subtree> or <part-of-the-xml-for-later-use> but I think I havent found an appropriate name and stuck with using the <controlDefinition> as is :wink: this name is a bit misleading tho I admit. you're not defining a control at all you just take a bunch of xml and give it a name for later use in the xml.



edit: and you can of course use this <controldefintion> later in the xml too. define it first <controlDefinition id="cool-part"> and then use it later <control name="cool-part" />

My bad :slight_smile: I haven't looked at the examples all that much yet, just been reading the website docs. I'll dig in a little more in the next few days.


The examples are the most important to get a clue about nifty…