The following is an example for a Drawing Area (or Canvas). This GUI-Class may take many GUI-Objects and presents the Objects at given location. This illustrates the
simple steps for creating component hierarchy! Note: Please scroll right (in all SVG canvases in below hierarchy) to see other subcomponents. The canvas (or Drawing) area may contain other Canvas-areas as subcomponents. The Scroll-bars may be dynamical appear if the Canvas size is bigger than the allotted size to display the component. |
Sample Pseudo Code to use the GUI-Class for Canvas | ||
int x_size,
y_size; // This gives the size of the Canvas or
Drawing Area int width, height; // This gives the area allocated on the screen. //Note: Scroll bars appear, if Canvas size is bigger than area allocated on the screen. // The following
statement instantiates the Canvas's GUI-Object. //Now, to
add each component to the Canvas's Object, use its methods. For
example: | ||
Sample Pseudo Code: Implementation of a simple Canvas-class | ||
| ||
Note:
Most SVG programmers could see how this works. Building component
hierarchy is very simple, as you could see in this example. Each
"G" (or SVG) tag creates a NODE for the DOM-tree, which in turn contain
many other sub-trees.
As you can see above: some of the subcomponents to the Drawing-Area are in-turn other Drawing-areas, and so on.
| ||
As you can see below, the Code-generator objects (e.g. GUI or CF) can be assembled in minutes to build an application. Then, if requirements change they can be disassembled and reassembled again in minutes. Any CF at any DOM-Tree node may be removed in minutes. Try to do this on any of your favorite desktop GUI platform and you shell quickly realize that it is not possible to pass large subcomponents (i.e. if the subcomponent contains subcomponents of it's own). Hence, it is impossible to build traditional GUI applications by assembling "loosely coupled" components. This is Extremely Important Point. | ||
Now a Larger
canvas to use this and other Canvas as subcomponents: int x_sz, y_sz; // This gives the size of the Canvas or Drawing Area int width, height; // This gives the area allocated on the screen. //Note: Scroll bars appear, if Canvas size is bigger than area allocated on the screen. // The following
statement instantiates the Canvas's GUI-Object. //Now, to
add each component to the Canvas's Object, use its methods. For
example: | ||
Now this larger component "LargerCanvas1" and other components can be used by any other container components, for example a Tab-GUI Object (e.g. BigTAB_Obj). Even Chart component may use this BigTAB_Obj as a subcomponent, for example in place of its Title. Notice how simple it is to build DOM-Tree for XML-GUI components. | ||
Likewise, we may use "DIV" tag to create DOM-tree for the component-hierarchy in IE/DTHML as shown in links at 3 and 4 in this demo web page | ||