Like
any other Reusable GUI-Classes,
using the GUI-Class for the TAB component
is simple
// Create the subcomponents to display under each Tab
AgileTemplate CCG1 = new SomeComponentFactory1(ACi,Param1);
AgileTemplate CCG2 = new SomeComponentFactory2(ACi,Param2);
--- --- --- --- --- --- --- ---
--- --- --- --- --- --- --- ---
AgileTemplate CCG6 = new SomeComponentFactory6(ACi,Param6);
//We may INPUT any GUI-Objects as Subcomponents
AgileTemplate CCG_List[] = {CCG1,
CCG2, CCG3, CCG4, CCG5, CCG6};
String Tab_names[] = {"Pie",
"Balanced Tree", "Scroller", "Step",
"Bar", "Multi bar"};
//Instantiate and initialize the TAB GUI-class:
AgileTemplate TAB_Obj = new TAB_Template ( ACi, CCG_List,
Tab_names, 6, x_size, y_size);
// Now TAB_Obj.CGM() is ready to generate the Component's code.
// One may Call TAB_Obj.CGM(Out) To write the component code; Or
// This TAB_Obj may be passed to yet other large component
|
The above code can be
encapsulated into a Replaceable Component handler (i.e. Component Factory - CGM given below).
Then the TAB and its subcomponent (CC1, CCG2, - - - , CCG6) can be included by
defining just the one variable.
//Include the Component:
Instantiate & initialize the Component Factory:
AgileTemplate TAB_Obj = new
TAB_ComponentFactory (ACi, Parameters);
Also
the TAB and all its subcomponent can be removed by removing all the references to
the variable. If it needs to exchange data with other components, the variable
may be referred few (on average 2) times to loosely couple the component.
|
//
CGM (Code Generation Method) for
TAB_ComponentFactory:
int CGM(Out) {
// Create the subcomponents to display under each Tab
AgileTemplate CCG1 = new SomeComponentFactory1(ACi,Param1);
AgileTemplate CCG2 = new SomeComponentFactory2(ACi,Param2);
--- --- --- --- --- --- --- ---
--- --- --- --- --- --- --- ---
AgileTemplate CCG6 = new SomeComponentFactory6(ACi,Param6);
//We may INPUT any GUI-Objects as Subcomponents
AgileTemplate CCG_List[] = {CCG1,
CCG2, CCG3, CCG4, CCG5, CCG6};
String Tab_names[] = {"Pie",
"Balanced Tree", "Scroller", "Step",
"Bar", "Multi bar"};
//Instantiate and initialize the TAB GUI-class:
AgileTemplate TAB_Obj = new TAB_Template ( ACi, CCG_List,
Tab_names, 6, x_size, y_size);
TAB_Obj.CGM(Out);
// Call the CGM of the TAB-Object
}
|
Implementation of the
reusable GUI Class for TAB component can be simple. The Java-class places each Subcomponent in a Group element as shown in the pseudo code below: <g id='Tab_id1_UNQ'
style='visibility:visible;' >
<% CCG_List[1].CGM(Out); // Include the Sub-component's code %>
</g>
<g id='Tab_id2_UNQ' style='visibility:hidden;' >
<% CCG_List[2].CGM(Out); // Include the Sub-component's code %>
</g>
The TAB SVG code registers a "onclick" method on each Tab-string:
onclick='Tab_QID.display_tab(2)'. Tab JavaScript function may display (or Hide) each component by updating the value of the VISIBILITY
attribute. Note: The prototype presented here may not be following this exact method, but we could do better. This component's code may be similar to RotateBanner component code, which will been presented later.
|