What is an ApplicationPart
A part is a part of an application or an application
itself. This sounds confusing. There are a couple of reasons
why everything is called a part :
-
There is one way of sepcifying the gui via xml.
-
Allows easy restructure of an application, turning
a part into an application and the other way around.
How do I create an ApplicationPart?
The ideal situation is that there will be an eclipse
plugin to create parts, preferrably created via nyx
itself (eating your own dogfood). It isn't that far
yet, since nyx isn't ready for that yet.
I believe however that ide integration is an essential
part of nyx, so developers don't have to be bothered
with gui design or make that task as easy as possible!
So let me explain how to handle that currently.
Nyx uses xml to handle everything. It is an own
flexible xml without dtd's or schema's, to leave
you room to extend the components nyx uses by default.
This way you can add new functionality in a new tag,
without too much problems. Nyx is property based,
which means if it encounters a property that it doesn't
know by default, it will add it as a property, which in your
turn you can request from the widget (getProperty(key)) and do
your magic.
Creating the xml
An application part is made out of xml as said before.
Here is the most basic part I can think of :
<part name="Part" prefix="Example" application="false" />
This part doesn't contain any widgets as you can see.
- The attribute name specifies the name of the part.
- The attribute prefix specifies the prefix the part has.
- All children of this part will inherit this prefix.
Other to-figure-out info
-
The name specifies the name of the part. You can get hold
of the part via the ApplicationContext
-
The prefix is to make this part unique.
There is still no way of overriding this, so a part
cannot be reused yet, withouth fucking up the Application
Context.
-
the application specifies if this part is the application.
I still must add functionality to launch other parts
based on actions. Normally a part that is an application will
be a window with children like menus, toolbars, etc, from
where the rest of the application is controlled.
-
If you include other parts under a main menu entry
an item will be added automatically to the menu
using the <label> element, which should be a
direct child of the part. Other functionality will be
added, so you can specify icons to be added to the
toolbar, avaialbilty on the right mouse button,etc.
-
Of course you can add rules to the menu items,
which are contained in the part that adds itself
as a menu.