Simple Integration Logic Examples

 

Controlling Rotate Banners using Radio Buttons

<%
PrintWriter Out = new PrintWriter(out, true);
AC_Info aci = new AC_Info(request, application);

String AC_list[] = { CCG1, CCG2, CCG3, CCG4};
   RotateBanner RB = new RotateBanner(aci, AC_list, 4);
   RB.CGM(Out);
%>
<script type='text/ecmascript'>  // Implement Callback
    function
change_banner(grp, num){
       <%Out.print(RB.getBannerUpdateMethodName());%>(num)
    }
</script>
<!--Display Check Boxes and control the Layers using the buttons-->
<%
  String RadioB_list[] = { "ORCL", "MSFT", "INTC", "SUNW" };
     RadioButtons RadioB = new RadioButtons (aci, RadioB_list, 4);
    // Register the Callback.
     RadioB.setCB_AddMe
thod("
change_banner");
     RadioB.CGM(Out,300, 30, null);  //Call Code generation method   
%>
 

 

 
<%
PrintWriter Out = new PrintWriter(out, true);
AC_Info aci = new AC_Info(request, application);

String AC_list[] = { CCG1, CCG2, CCG3, CCG4};
   RotateBanner RB = new RotateBanner(aci, AC_list, 4);

String RadioB_list[] = { "ORCL", "MSFT", "INTC", "SUNW" };
   RadioButtons RadioB = new RadioButtons (aci, RadioB_list, 4);

   //If user clicks on Rotate Banners, keep the Radio buttons insynk
   RB.setCallBackName(RadioB.getButtonSetMethodName());
%>

<script type='text/ecmascript'> // Implement Callback
    function
change_banner(grp, num) { 
        <% Out.print(RB.getBannerUpdateMethodName()); %>(num)
    }
</script>

<!--Display Check Boxes and control the Layers using the buttons-->
<%
    // Register the Callback.
     RadioB.setCB_AddMethod("
change_banner");
     RadioB.CGM(Out, 300, 30, null);  // Call Code generation method
     RB.CGM(Out);
%>
 

Controlling Show Layers using Check Boxes

// Include a JSP file that contains Objects for subcomponents.
// The names of the CCG-Objects are CCG1, CCG2, CCG3 and CCG4.
<%@ include file="subcomponents.jsp" %>
<%
PrintWriter Out = new PrintWriter(out, true);

String RB_list[] = { CCG1, CCG2, CCG3, CCG4};
AC_Info aci = new AC_Info(request, application);

    ShowLayer SL = new ShowLayer(aci, RB_list, 4);
    SL.CGM(Out); // Include the code Block
%>

// A Communication function for the components SL & CB
function
switch_the_state(grp, state, num) {
   var stt = 'hidden';  // If Check-box is set to OFF
      if (state == 1)  stt = 'visible'; // If Check-box is set to ON
      <%Out.print(SL.getShowLayerName());%>(num, stt)
}
</script>

<!-- Display Check Boxes and control the Layers using the buttons -->
<g transform='translate(300 30)'>
<%
String CB_list[] = { "ORCL", "MSFT", "INTC", "SUNW" };
int def_states[] = { 1,0,0,0 };
   CheckBoxes CB = new CheckBoxes(aci, CB_list, 4);
   CB.setCB_AddMethod("
switch_the_state");
   CB.setDefaultStates(def_states);
   CB.CGM(Out);
// Include the code Block
%>
</g>
 

Controlling Rotate Banners using Radio Buttons

Subcomponents may be created Dynamically Or Use Static Code-Blocks

ComponentFactory CCG1 = new SMS_StockQuote(“ORCL”);
ComponentFactory CCG2 = new SMS_StockQuote(“MSFT”);

String    CCG1 = "//***** BEGIN Of Subcomponent code ******* \n"
     + "<rect style='fill:white;stroke:black; fill-opacity:0' x='0' y='0' width='205' height='130'/> \n"
     + "<text style='fill:red;font-size:16pt' x='10' y='30'>ORCL</text> \n"
     + "<text style='fill:black;font-size:14pt' x='120' y='30'>70.5</text> \n"
     + "<polygon style='fill:green;stroke:black;' points='20,50 35,70 5,70 20,50'/> \n"
     + "<text style='fill:blue;font-size:10pt' x='40' y='70'>2.75</text> \n"
     + "<rect style='fill:yellow;stroke:black;' x='110' y='45' width='80' height='30'/>\n"
     + "<rect style='fill:maroon;stroke:black;' x='110' y='45' width='60' height='15'/>\n"
     + "<rect style='fill:red;stroke:black;' x='110' y='60' width='70' height='15'/> \n"
     + "<text style='fill:red;font-size:16pt' x='10' y='115'>300#</text> \n"
     + "<text style='fill:darkgreen;font-size:16pt' x='90' y='115'> \n"
     + "  <tspan style='fill:blue;font-size:16pt'>$ </tspan>21150</text> \n"
     + "//********** END Of Suncomponent code ************** ";

String    CCG2 = "//****** BEGIN Of Subcomponent code ******** \n"
     + "<rect style='fill:white;stroke:black; fill-opacity:0' x='0' y='0' width='205' height='130'/> \n"
     + "<text style='fill:red;font-size:16pt' x='10' y='30'>MSFT</text> \n"
     + "<text style='fill:black;font-size:14pt' x='120' y='30'>103.937</text> \n"
     + "<polygon style='fill:red;stroke:black;' points='20,70 35,50 5,50 20,70'/> \n"
     + "<text style='fill:blue;font-size:10pt' x='40' y='70'>1.06</text> \n"
     + "<rect style='fill:yellow;stroke:black;' x='110' y='45' width='80' height='30'/>\n"
     + "<rect style='fill:maroon;stroke:black;' x='110' y='45' width='60' height='15'/>\n"
     + "<rect style='fill:red;stroke:black;' x='110' y='60' width='55' height='15'/> \n"
     + "<text style='fill:red;font-size:16pt' x='10' y='115'>200#</text> \n"
     + "<text style='fill:darkgreen;font-size:16pt' x='90' y='115'> \n"
     + "  <tspan style='fill:blue;font-size:16pt'>$ </tspan>20787</text> \n"
     + "//*********** END Of Suncomponent code *************** ";

String AC_list[] = { CCG1, CCG2, CCG3, CCG4};
   RotateBanner RB = new RotateBanner(ACi, AC_list, 4);

An Example for Loosely Coupled
Easily Replaceable Components