Programmatically Adding Components

I need write code where a person orders a product X. Now, they can order as many X as they want and then ship them to different addresses. So for instance, I want an X for myself, my mother, and my aunt Susie.
I enter that I want 3 X. I can do all of this in JSF. The problem comes when entering all the addresses. I would like to dynamically create text boxes and labels on the fly so that the page would look like this:
John Doe [TextBox id="one"]
123 Main Street
Somewhere, ST 12345
Jane Doe [TextBox id="two"]
456 W. 1st Stret
Anyother, PL 03943
Susie Doe [TextBox id="three"]
222 2nd Street
Thrid, PL 09341
The TextBoxes would be where the user would enter how many of the item they want to go to each address. However, I cannot find a way to programatically add the TextBoxes to the page and since there are an unknown number of addresses, I don't know what else to do.
I have seen this post:
http://forum.java.sun.com/thread.jspa?forumID=427&threadID=503456
And I tried that code and it didn't help. I am not sure if the GroupRenderer is not rendering the child components or what.
Can anyone help?

Why don't you use h:datatable?
It needs no dynamic creating components.

Similar Messages

  • Programmatically adding UIComponents

    I've had no problem using the JWSDP 1.3 + 1.0 RI to create JSF applications using JSP tags, but I can't get any UIComponents that I add directly using the JSF API to render. I've tried adding components to the existing JSF ViewRoot both directly in a JSP page, as well as via an ActionListener. Both attempts failed.
    Has anyone been able to manipulate the JSF Tree via the API?
    Here is a simple example of what I'm trying to achieve: (The page renders with the components that were added via JSP tags, but not the UICommand component)
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <body bgcolor="white">
    <f:view>
    <h:form id="login_form">
    <TABLE BORDER="0">
    <TR>
    <TD>
    Username:
    </TD>
    <TD>
    <h:inputText value="#{LoginBean.username}"/>
    </TD>
    <TR>
    <TD>
    Password:
    </TD>
    <TD>
    <h:inputText value="#{LoginBean.password}"/>
    </TD>
    <TR>
    <TD COLSPAN="2">
    <%
    FacesContext fc = FacesContext.getCurrentInstance();
    UICommand loginButton = new javax.faces.component.UICommand();
    loginButton.setValue("Login");
    loginButton.setRendered(true);
    fc.getViewRoot().findComponent("login_form").getChildren().add(label);
    %>
    </TD>
    </TR>
    </TABLE>
    </h:form>
    </f:view>
    Any help is appreciated. Thanks!

    Another approach is to place a panelGroup in the page to serve as the parent of the added components. The GroupRenderer has rendersChildren()==true, so this component allows the components to be added. Here is a JSP that does it:
    <html>
    <head>
    <title>Programmatic Component Addition</title>
    <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
    <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
    </head>
    <body>
    <h1>Programmatic Component Addition</h1>
    <f:view>
    <h:form id="form">
    <h:commandButton value="submit" id="button"
    actionListener="#{test3.addComponentToTree}"/>
    <h:panelGroup id="addHere" />
    </h:form>
    </f:view>
    <hr>
    </body>
    </html>
    The addComponentToTreeMethod is like this:
    public void addComponentToTree(ActionEvent action) {
         HtmlOutputText output = new HtmlOutputText();
         output.setValue("<p>==new output==</p>");
         output.setEscape(false);
         UIComponent group = FacesContext.getCurrentInstance().getViewRoot().findComponent("form" + NamingContainer.SEPARATOR_CHAR + "addHere");
         group.getChildren().add(output);
         com.sun.faces.util.DebugUtil.printTree(FacesContext.getCurrentInstance().getViewRoot(),
                             System.out);
    note the handy dandy undocumented class: com.sun.faces.util.DebugUtil. This is in the RI and prints out the tree.
    Ed

  • Programmatically adding chart to a report throws exception

    programmatically adding chart to a report throws exception "chart condition fields are not valid".
    Configuration:
    I am using CR4E to create web application, I've added RAS jars (rasapp.jar, rascore.jar, reporttemplate.jar, serialization.jar) to this web application. For designing reports i am using Crystal Reports 2008.
    Code:
    <%
    // Get the previously opened report from the session.
    ReportClientDocument reportClientDocument =
         (ReportClientDocument)session.getAttribute("ReportClientDocument");
    System.out.println(reportClientDocument.getReportDocument().getName());
    // Try to get the report's DataDefinition object.
    IDataDefinition dataDefinition;
    try
         dataDefinition = reportClientDocument.getDataDefController().getDataDefinition();
    // If the DataDefinition object can not be retrieved, redirect the user to an error page.
    catch (Exception e)
         System.out.println("With error1");
        return;
    // Create a new ChartDefinition object and set its type to ChartType.group.
    ChartDefinition chartDefinition = new ChartDefinition();
    chartDefinition.setChartType(ChartType.group);
    Get the conditional field of the report's first group. Set this conditional
    field for the ChartDefinition object using the setConditonalFields method. Notice
    that the conditional field is first placed in a Fields collection because the
    setConditionalFields method takes a Fields object as an argument.
    Fields conditionFields = new Fields();
    if (!dataDefinition.getGroups().isEmpty())
         IField field = dataDefinition.getGroups().getGroup(0).getConditionField();
         System.out.println("Condition field name ->" + field.getLongName(Locale.ENGLISH));
         conditionFields.addElement(field);
    chartDefinition.setConditionFields(conditionFields);
    //Get the summary field name from the form on the previous page.
    String summaryFieldName = URLDecoder.decode(request.getParameter("summaryField"));
    System.out.println("Summary field name ->" + summaryFieldName);
    Loop through all of the report's summary fields until the one matching the name
    above is found. Set this summary field for the ChartDefinition object using the
    setDataFields method. Notice that the summary field is first placed in a Fields
    collection because the setDataFields method takes a Fields object as an argument.
    Fields dataFields = new Fields();
    for (int i = 0; i < dataDefinition.getSummaryFields().size(); i++)
        IField summaryField = dataDefinition.getSummaryFields().getField(i);
         if (summaryField.getLongName(Locale.ENGLISH).equals(summaryFieldName))
              System.out.println("Adding data field ->" + summaryFieldName);
              dataFields.addElement(summaryField);
    chartDefinition.setDataFields(dataFields);
    Create a new ChartObject to represent the chart that will be added.  Set the
    ChartDefinition property of the ChartObject using the ChartDefinition object created
    above.
    ChartObject chartObject = new ChartObject();
    chartObject.setChartDefinition(chartDefinition);
    Get the chart type, chart placement, and chart title strings from the form on the
    previous page. If no chart title was chosen, create a generic title.
    String chartTypeString = request.getParameter("type");
    String chartPlacementString = request.getParameter("placement");
    String chartTitle = request.getParameter("title");
    System.out.println("chartTypeString ->"+ chartTypeString + "<-chartPlacementString->" + chartPlacementString + "<-chartTitle->"+chartTitle);
    if (chartTitle.equals(""))
         chartTitle = "untitled";
    Create a ChartStyleType object and a AreaSectionKind object based on the
    the chartTypeString and chartPlacementString retrieved above. In this example
    possible chart types are bar chart and pie chart. Possible chart placements
    are header and footer.
    ChartStyleType chartStyleType = ChartStyleType.from_string(chartTypeString);
    AreaSectionKind chartPlacement = AreaSectionKind.from_string(chartPlacementString);
    // Set the chart type, chart placement, and chart title for the chart.
    chartObject.getChartStyle().setType(chartStyleType);
    chartObject.setChartReportArea(chartPlacement);
    chartObject.getChartStyle().getTextOptions().setTitle(chartTitle);
    // Set the width, height, and top for the chart.
    chartObject.setHeight(5000);
    chartObject.setWidth(5000);
    chartObject.setTop(1000);
    Get a ReportDefController object that can be used to modify the report's definition.
    ReportDefController reportDefController;
    try
         reportDefController = reportClientDocument.getReportDefController();
    catch (Exception e)
         System.out.println("With Error2");
         return;
    *Create a Section object that represents the section that will hold the chart.
    If the chart placement was set header, get the header section, otherwise, if the
    chart placement was set to footer, get the footer section.
    Section chartSection = null;
    if (chartPlacement.equals(AreaSectionKind.reportHeader))
         IArea reportHeaderArea =
              reportDefController.getReportDefinition().getReportHeaderArea();
         chartSection = (Section)reportHeaderArea.getSections().getSection(0);
    else if (chartPlacement.equals(AreaSectionKind.reportFooter))
         IArea reportFooterArea =
              reportDefController.getReportDefinition().getReportFooterArea();
         chartSection = (Section)reportFooterArea.getSections().getSection(0);
    Add the chart to the section using the ReportDefController object.
    reportDefController.getReportObjectController().add(chartObject, chartSection, 1);
    // Save the changes and close the report.
    reportClientDocument.save();
    reportClientDocument.close();
    session.removeAttribute("ReportClientDocument");
    %>     
    Trace:
    com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException: The chart condition fields are not valid.---- Error code:-2147213287 Error code name:invalidChartObject
         at com.crystaldecisions.sdk.occa.report.lib.ReportDefControllerException.throwReportDefControllerException(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.a(Unknown Source)
         at com.crystaldecisions.sdk.occa.report.application.ReportObjectController.add(Unknown Source)
         at org.apache.jsp.AddChart_jsp._jspService(AddChart_jsp.java:230)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:162)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:283)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
         at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:585)
         at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:244)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
         at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:276)
         at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:218)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
         at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:56)
         at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:189)
         at java.security.AccessController.doPrivileged(Native Method)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:185)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
         at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
         at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
         at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
         at org.apache.catalina.authenticator.SingleSignOn.invoke(SingleSignOn.java:393)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
         at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
         at java.lang.Thread.run(Thread.java:595)

    Please try this code snippet
    var cs:ColumnSeries = new ColumnSeries();
    cs.dataProvider = dp;
    cs.displayName = "Series 2";
    cs.yField = "values";
    chart.series.push(cs);
    OR
    var temp:Array = [];
    var cs:ColumnSeries = new ColumnSeries();
    cs.dataProvider = dp;
    cs.displayName = "Series 2";
    cs.yField = "values";
    temp = chart.series;
    temp.add(cs);
    chart.series = temp;

  • Programmatically refresh components inside a specific row of an af:table

    How to programmatically refresh components inside a specific row of an af:table without refreshing the whole table ?_
    I have an af:table displaying a read-only view object. There is an edit button inside the table calling an af:popup, where the user can update some informations and click a submit button to validate his changes.
    The action property of this button is a method in a backing been where
    -     1 : A stored procedure is called to update several tables (related to my read-only VO).
    -     2 : The VO is re-queried (VO. refreshQueryKeepingCurrentRow() )
    -     3 : The whole table is refreshed (AdfFacesContext.getCurrentInstance().addPartialTarget(myTable) )
    Is it possible to programmatically refresh some components of the current row of the table without refreshing the whole table (point 3)?
    I’ve tried to play with the “partialTrigger” property of af:outputText (table:column:outputText), without success.
    Thanks
    Nicolas

    "+do you happen to want to refresh following an action on the row? Like a link/button click?+" : NO
    There is a table on my page. The user select a row and click on an edit button. This edit button call a popup where the user can modify some information (not directly on the viewObject. All fields in the popup are dummy fields bind to attributes in my backing bean) and then he click on a submit button.
    The submit button action execute a method "submitInformation" in a backing been.
    public String submitInformation(){
            Map<String, Object> params = new HashMap<String, Object>();
            params.put("pManNo", xManNo.getValue()); //xManNo is an attribute of the backing bean
            params.put("pDate", xPeriod.getValue()); //xPeriod is an attribute of the backing bean
            // Execute Operation
            OperationBinding oper = ADFUtils.findOperation("serviceSubmitInfo");
            oper.getParamsMap().putAll(params);
            String results = (String)oper.execute();
            // Close Popup & Refresh Row if OK
            if(!StringUtils.isStringEmpty(results) && results.equals("TRUE")){
                 closePopup("pt1:popAbs");
                 refreshMyCol();
    }The serviceSubmitInfo method is defined in my serviceImpl
        public String serviceSubmitInfo (String pManNo, String pPeriod, ......){
             String results =
                callStoredFunction("? :=myDatabaseFunction(?, ?, ?, ?)",
                                   new Object[] { pManNo, pPeriod, ...... });
              // Commit
              getDBTransaction().commit();
              // Refresh VO (re-query & set currentRow)
              getMyVO().refreshQueryKeepingCurrentRow();         
              return results; // TRUE if ok
        }I want the " refreshMyCol()" method to refresh only the current row and not the whole table...
    Regards
    Nicolas

  • Can't import datePicker/dateDisplayer components into "Added Components"

    I downloaded the source code and the components lib and follow exactly the steps that mentioned in the documentation but i'm still not able to import the datePicker components lib,and when i click import componets the JSC prompt for the runtime jar file,and i dunno where to get that jar file.
    anyone please explain what i need to do???????

    Hi,
    I could add the datepicker complib. Here is what i did
    -- Go to palette -> standard
    --right  below added components ,choose import  component library
    --Select the complib file,click OK
    -- you can see Date Picker and Date displayer are added
    Hope this helps
    MJ

  • Programmatically Added Web Part Issues - Powershell

    Hello!
    I have been doing quite a bit of research on this for the last few days but so far to no avail. What I am trying to do is use a powershell script to create a Content Editor Web Part on a basic sharepoint site created using the Team Site template. 
    The issue I'm running into is when I use the script I have to add a new web part to the "wpz" zone. The webpart gets created properly and exists in the webparts collection however it does not show up on the page. I can bind to the webpart through
    powershell and can see that the visible property is set to true while the hidden property is false. The webpart is not closed it simply doesn't show up. 
    When I add the webpart to another zone it shows up properly however as soon as you edit the page the webpart disappears. However this only happens while the page is in edit mode. As soon as you save the page the programmatically added webpart immediately
    shows back up in the zone it's supposed to be in. 
    I was wondering if anyone else had ever experienced this specific issue and if there is anything I can do to fix it.
    The environment is a development box running Microsoft Server 2012 and is hosting Sharepoint 2013. 
    Thanks!

    Hello Patrick,
    Thanks for your response. The script I am using is in the following code block:
    $SiteUrl = "http://maddevsp01.btdev.net/my/personal/14736"
    $WebUrl = "http://maddevsp01.btdev.net/my/personal/14736"
    function main() {
    [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint")
    $OpenWeb = Get-SPWeb $WebUrl
    $OpenSite = Get-SPSite $SiteUrl
    $file = $OpenWeb.GetFile("$WebURL/SitePages/Home.aspx")
    $WebPartManager = $file.GetLimitedWebPartManager([System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
    Add-ContentEditorWebPart "$WebURL" "$WebURL/SitePages/Home.aspx" "wpz" 12 "Test" "Test webpart"
    $OpenWeb.Dispose()
    function Add-ContentEditorWebPart($SiteURL, $pageUrl, $webpartzone, $index, $title, $content)
    $site = new-object Microsoft.SharePoint.SPSite($SiteURL)
    $web=$site.OpenWeb()
    $webpartmanager = $web.GetLimitedWebPartManager($pageUrl, [System.Web.UI.WebControls.WebParts.PersonalizationScope]::Shared)
    $webpart = new-object Microsoft.SharePoint.WebPartPages.ContentEditorWebPart
    $webpart.ChromeType = [System.Web.UI.WebControls.WebParts.PartChromeType]::Default;
    $webpart.Title = $title
    $docXml = New-Object System.Xml.XmlDocument
    $contentXml = $docXml.CreateElement("Content");
    $contentXml.set_InnerText($content);
    $docXml.AppendChild($contentXml);
    $webpart.Content = $contentXml;
    $webpartmanager.AddWebPart($webpart, $webpartzone, $index);
    $web.Close()
    $site.Close()
    function Get-SPSite([string]$url) {
    New-Object Microsoft.SharePoint.SPSite($url)
    function Get-SPWeb([string]$url) {
    $SPSite = Get-SPSite $url
    return $SPSite.OpenWeb()
    $SPSite.Dispose()
    main
    I was investigating further after posting yesterday and used powershell to bind to a webpart created by the script and a webpart I created using the sharepoint interface. Then I exported all the properties and their values to two different text files and
    used winmerge to compare the differences to see if there was a setting I was missing in the script or something akin to that. However when I did the comparison the only differences between the two were the following values: Title, Description, PartOrder, ID,
    StorageKey, EffectiveTitle, DisplayTitle, ZoneIndex, ClientID, and UniqueID. All of which you would expect to be different. All other settings are exactly the same on both webparts.
    I am at a complete loss as to what this issue might be.
    Kindest Regards,
    -Zach

  • Programmatically adding objects/components

    Hi guys,
    I'm just new to Java and the Java Studio Creator.
    Anyway, I would just like to ask how you can programmatically add objects or components after each event, let's ay after every press of a button, another text field, output text, image or whatever component, is added on the page.
    I'm trying to do an application wherein the user can enter number of rows they want to show in a table (grid panel) which has by default, 5 columns with one image inside every column. If the user enters 2, the table should now have 2 rows that are identical.
    Hope you can help me with this problem guys. Thanks in advance!

    Anyway, I would just like to ask how you can
    programmatically add objects or components after each
    event, let's ay after every press of a button,
    another text field, output text, image or whatever
    component, is added on the page.The components of a page are organized into a tree structure with parent-child relationships. Therefore, all you need to do is acquire a reference to the component you want to be the parent, create a new instance of the child, and add the new child to the parent component's list of children.
    In a page bean, it looks something like this. Assume you want to add a new Output Text component inside the form component named "form1". Because Creator binds all of the components to properties in the page bean, finding this component is easy -- there is an instance variable with the same name that contains a reference to this component. So, you would do something like this:
    UIComponent parent = form1; // Get reference to parent
    HtmlOutputText newOne = new HtmlOutputText();
    newOne.setValue("This is the text value");
    // set other properties as needed
    parent.getChildren().add(newOne);The value returned by getChildren() is a standard java.util.List, so you can insert children anywhere in the list, remove them, reorganize them, or whatever is needed.
    Craig McClanahan

  • Adding Components And There Value Bindings  Programmatically

    Dear Friends ,
    In One of assignment I have requirement of creating JSF Components
    and There Value Bindings Programmatically
    on valuechange event of a SelectOneListBox I need to create some componenet and add them to a panelGrid...up to this it's okay I have already achieved this goal but my next big challenge is creating value bindings programmatically for those components...
    suppose I have created a textbox component in which user has to insert some text and that text I want to store in a database ..
    how to do that...?

    tht's simplest way ..I know but suppose
    my code is like this....
    public void buildComponenets(int selectedId) {
    ArrayList arrList = new ArrayList();
    arrList = objABC.GetDocumentParameter(selectedId);
    Iterator iterate = arrList.iterator();
    HtmlInputText htmlText;
    HtmlSelectBooleanCheckbox htmlSelect;
    HtmlOutputLabel htmlLabel;
    HtmlMessage htmlMess;
    int i = 1;
    ABC objABC= new ABC();
    while(iterate.hasNext())
    objABC = (ABC)iterate.next();
    String compType = objABC.getControlName();
    if(compType.equals("TextBox"))
    htmlText = new HtmlInputText();
    htmlLabel=new HtmlOutputLabel();
    htmlMess = new HtmlMessage();
    htmlLabel.setValue(objABC.getLabelName());
    htmlLabel.setId("lble"+i);
    htmlText.setId("txt"+i);
    htmlText.setImmediate(true);
    htmlMess.setId("message"+i);
    htmlMess.setFor("txt"+i);
    htmlText.setRequired(objABC.isValidationRequired());
    if(cotrolsPan.getChildren().contains(htmlText))
    cotrolsPan.getChildren().remove(htmlText);
    cotrolsPan.getChildren().add(htmlLabel);
    cotrolsPan.getChildren().add(htmlText);
    cotrolsPan.getChildren().add(htmlMess);
    if(compType.equals("CheckBox"))
    htmlSelect = new HtmlSelectBooleanCheckbox();
    htmlLabel=new HtmlOutputLabel();
    htmlMess = new HtmlMessage();
    htmlLabel.setValue(objABC.getLabelName());
    htmlLabel.setId("lble"+i);
    htmlLabel.setValue(objABC.getLabelName());
    htmlLabel.setId("lble"+i);
    htmlSelect.setId("check"+i);
    htmlSelect.setImmediate(true);
    htmlMess.setId("message"+i);
    htmlMess.setFor("check"+i);
    htmlSelect.setRequired(objABC.isValidationRequired());
    if(cotrolsPan.getChildren().contains(htmlSelect))
    cotrolsPan.getChildren().remove(htmlSelect);
    cotrolsPan.getChildren().add(htmlLabel);
    cotrolsPan.getChildren().add(htmlSelect);
    cotrolsPan.getChildren().add(htmlMess);
    i++;
    now How to create value bindings for these components

  • Programmatically adding declarative components (ADF 11g 11.1.1.5.0)

    Hi All,
    We have a number of declarative components that we are utilizing within our ADF implementation, I am trying to create one of those components in a similar fashion to how I create a Rich Input Text (for example)
    RichInputText text = new RichInputText();
    panelForm.getChildren().add(text);
    This doesn't seem to work if I replace the "RichInputText" with "MyDecComp" class, where the declarative component doesn't render. Is there any way to achieve the same outcome with the declarative component as the normal JSF / ADF component.
    Looking forward to your reply.
    Regards,
    Younis
    Edited by: Younis on 7/10/2011 09:01

    Are you talking about custom components?
    This will help you:
    Documentation
    http://download.oracle.com/docs/cd/E14571_01/web.1111/b31973/ad_custom.htmA Sample
    http://andrejusb.blogspot.com/2009/10/custom-declarative-components-in-adf.html- Prasad

  • IDOC for Creation of Production order and also adding components

    Hi ,
    I have a requirement like I get the data from a 3rd party system and using that i have to create production orders and also should be able to add more materials in COMPONENTS part of that Production order. I was looking for a BAPI which can handle this process.
    And also can any one help me by letting me know is there any Message type available for handling this process of Production order creation and Adding extyra components to it.
    I have a  message type LOIPRO (for Production Order) and associated function modle CLOI_MASTERIDOC_CREATE_LOIPRO for creation of master IDoc, but not sure can i handle the Components part in this.
    Please do send replies ASAP, its very urgent.
    Or else atleast suggest me the other ways of doing this .
    Also send me any BDC program if anyone has already developed for this.
    Thanks
    Kumar
    Edited by: Phani Kumar Peddagopu on Mar 19, 2008 6:56 PM

    Resolved .

  • Adding Components to a JPanel not working correctly

    I'm trying to build a JFrame that contains a parent JPanel that will hold a JPanel used to display a message view, a vertical strut and a JPanel that holds VCR-like buttons to cycle through the messages.
    My parent JPanel uses a BorderLayout and the Border is a TitledBorder which tells which product you are viewing (i.e., Message 1 of 5). I build the message JPanel, vertical strut and button JPanel and add them all in order to the parent JPanel which then gets added to the rootContentPane of the JFrame. All that appears is the parent JPanel's TitledBorder, the strut and the button JPanel. Using JSwat, I've been able to determine that the message JPanel has 0 for both its height and width after adding the message components to the JPanel.
    I create the message JPanel with a BorderLayout and an OvalBorder as copied from Manning Press's Swing book (which works fine in other JFrames that I have built), then add other components as necessary to the individual messages (mostly items around the edges with a central display for the actual message). What I can't figure out is why the height and width of the message JPanel isn't growing as I add components.
    I had previously used the same code to display a single message (minus the parent JPanel, strut and button JPanel) where I added the border panels (northPanel, eastPanel, southPanel and westPanel) created in createMsgPanel() directly to the contentPane and it worked perfectly, so I know that the code that adds the message works fine. Then, the requirements changed (go figure) and I had to display multiple messages from the same screen.
    Here's what I've got:
    public class Layout
                 extends JFrame
                 implements ActionListener
       private MissionData missionData;
       private JPanel messagePanel = null;
       private int index = 0;
       private int numMsgs = 0;
       private JPanel mainPanel = null;
       private JPanel buttonPanel = null;
       private TitledBorder titledBorder = null;
       Layout ()
       public Layout (MissionData msn)
          super ();
          missionData = msn;
          setSize (640, 640);
          setIconImage (new ImageIcon ("Icon.jpg").getImage());
          setTitle (((Message) (missionData.messages.elementAt(0))).name);
          numMsgs = missionData.messages.size();
          titledBorder = new TitledBorder (
                            new LineBorder (Color.BLACK),
                            "Message " + String.valueOf (index + 1) +
                            " of " + String.valueOf (numMsgs),
                            TitledBorder.LEFT,
                            TitledBorder.TOP);
          mainPanel = new JPanel ();
          mainPanel.setLayout (new BorderLayout());
          mainPanel.setBorder (new CompoundBorder (titledBorder,
                                                   new EmptyBorder (
                                                      new Insets (3, 3, 3, 3))));
          messagePanel = new JPanel();
          messagePanel.setLayout (new BorderLayout ());
          messagePanel.setBorder (new CompoundBorder (
                                     new EmptyBorder (50, 50, 50, 50),
                                     new OvalBorder (20, 20, Color.white)));
          messagePanel.setBackground (Color.black);
          createButtonPanel ();
          createMsgPanel ((Message) missionData.messages.elementAt (0));
          mainPanel.add (messagePanel);
          mainPanel.add (Box.createVerticalStrut (20));
          mainPanel.add (buttonPanel);
          Container mainContentPane = getContentPane();
          mainContentPane.add (mainPanel);
       private void createMsgPanel (Message msg)
          MessageType msgType = null;
          if (msg.getFunctionalAreaDesignator(0) == Message.GENERAL_INFO)
             if (msg.getMessageNumber(0) == 1)
                msgType = FREE_TEXT;
          else if (msg.getFunctionalAreaDesignator(0) == Message.SUPPORT)
             if (msg.getMessageNumber(0) == 33)
                msgType = CAS;
             else if (msg.getMessageNumber(0) == 34)
                msgType = OSR;
          // Setup NORTH Panel of Display
          JPanel northPanel = new JPanel (new GridLayout (2, 6));
          northPanel.setBackground (Color.black);
          northPanel.add (new JTIMLabel ("", false));
          northPanel.add (new JTIMLabel ("<html>RECV</html>", false));
          if (msgType == CAS)
             northPanel.add (new JTIMLabel ("<html>PCLR</html>", false));
             northPanel.add (new JTIMLabel ("<html>MSN</html>", false));
             northPanel.add (new JTIMLabel ("<html>SAVE</html>", false));
          else if (msgType == OSR)
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("", false));
          else if (msgType == FREE_TEXT)
             northPanel.add (new JTIMLabel ("<html>ERASE</html>", false));
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("<html>BRDCST</html>", false));
          northPanel.add (new JTIMLabel ("<html>SEND</html>", false));
          northPanel.add (new JTIMLabel ("", false));
          northPanel.add (new JTIMLabel ("", false));
          if (msgType == CAS)
             northPanel.add (new JTIMLabel ("<html>CAS</html>", false));
          else if (msgType == OSR)
             northPanel.add (new JTIMLabel ("<html>OSR</html>", false));
          else if (msgType == FREE_TEXT)
             northPanel.add (new JTIMLabel ("<html>FTXT</html>", false));
          if (msgType == FREE_TEXT)
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("", false));
          else
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("<html>CAS</html>", false));
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("", false));
             northPanel.add (new JTIMLabel ("", false));
          messagePanel.add (northPanel, BorderLayout.NORTH);
          // Setup EAST Box of Display
          Box eastBox = new Box (BoxLayout.Y_AXIS);
          if (msgType == CAS)
             eastBox.add (Box.createGlue());
             eastBox.add (new JTIMLabel ("<html>F<br>T<br>X<br>T</html>", false));
             eastBox.add (Box.createGlue());
             eastBox.add (new JTIMLabel ("<html>O<br>S<br>R</html>", false));
             eastBox.add (Box.createGlue());
             eastBox.add (new JTIMLabel ("<html>D<br>P<br>I<br>P</html>", false));
             eastBox.add (Box.createGlue());
          else if (msgType == FREE_TEXT)
             eastBox.add (Box.createGlue());
             eastBox.add (new JTIMLabel ("", false));
             eastBox.add (Box.createGlue());
             eastBox.add (new JTIMLabel ("", false));
             eastBox.add (Box.createGlue());
             eastBox.add (new JTIMLabel ("", false));
             eastBox.add (Box.createGlue());
             eastBox.add (new JTIMLabel ("", false));
             eastBox.add (Box.createGlue());
          eastBox.add (new JTIMLabel ("<html>W<br>L<br>C<br>O</html>", false));
          eastBox.add (Box.createGlue());
          eastBox.add (new JTIMLabel ("<html>C<br>N<br>T<br>C<br>O</html>",
                                        false));
          eastBox.add (Box.createGlue());
          messagePanel.add (eastBox, BorderLayout.EAST);
          // Setup SOUTH Panel of Display
          JPanel southPanel = new JPanel (new GridLayout (2, 5));
          southPanel.setBackground (Color.black);
          southPanel.add (new JTIMLabel ("", false));
          southPanel.add (new JTIMLabel ("", false));
          southPanel.add (new JTIMLabel ("", false));
          southPanel.add (new JTIMLabel ("", false));
          southPanel.add (new JTIMLabel ("<html>ON</html>", false));
          southPanel.add (new JTIMLabel ("", false));
          southPanel.add (new JTIMLabel ("", false));
          southPanel.add (new JTIMLabel ("", false));
          if (msgType == CAS)
             southPanel.add (new JTIMLabel ("<html>USE</html>", false));
             southPanel.add (new JTIMLabel ("<html>RCALL</html>", false));
          else if ((msgType == OSR) || (msgType == FREE_TEXT))
             southPanel.add (new JTIMLabel ("", false));
             southPanel.add (new JTIMLabel ("", false));
          southPanel.add (new JTIMLabel ("<html>MENU</html>", false));
          southPanel.add (new JTIMLabel ("<html>VMF</html>", false));
          if (msgType == CAS)
             southPanel.add (new JTIMLabel ("<html>NETS</html>", false));
          else if ((msgType == OSR) || (msgType == FREE_TEXT))
             southPanel.add (new JTIMLabel ("<html>CAS</html>", false));
          southPanel.add (new JTIMLabel ("", false));
          messagePanel.add (southPanel, BorderLayout.SOUTH);
          // Setup WEST Box of Display
          JTIMLabel incrLabel = null;
          JTIMLabel decrLabel = null;
          Box westBox = new Box (BoxLayout.Y_AXIS);
          if (msgType == FREE_TEXT)
             westBox.add (Box.createGlue());
             westBox.add (new JTIMLabel ("", false));
             westBox.add (Box.createGlue());
             westBox.add (new JTIMLabel ("", false));
             westBox.add (Box.createGlue());
             westBox.add (new JTIMLabel ("", false));
             westBox.add (Box.createGlue());
             westBox.add (new JTIMLabel ("<html>N<br>E<br>X<br>T</html>", false));
             westBox.add (Box.createGlue());
             westBox.add (new JTIMLabel ("<html>P<br>R<br>E<br>V</html>", false));
          else
             westBox.add (Box.createGlue());
             westBox.add (new JTIMLabel ("<html>U<br>F<br>C</html>", false));
             westBox.add (Box.createGlue());
             if (msgType == CAS)
                westBox.add (new JTIMLabel ("<html>/\\</html>", false));
                westBox.add (Box.createGlue());
                westBox.add (new JTIMLabel ("<html>\\/</html>", false));
                westBox.add (Box.createGlue());
                incrLabel = new JTIMLabel ("<html>I<br>N<br>C<br>R</html>", false);
                westBox.add (incrLabel);
                westBox.add (Box.createGlue());
                decrLabel = new JTIMLabel ("<html>D<br>E<br>C<br>R</html>", false);
                westBox.add (decrLabel);
                westBox.add (Box.createGlue());
          messagePanel.add (westBox, BorderLayout.WEST);
          // Create CENTER Box to display message bodies
          GriddedPanel centerBox = new GriddedPanel ();
          centerBox.setBackground (Color.black);
          messagePanel.add (centerBox, BorderLayout.CENTER);
          if (msgType == CAS)
             new CASDisplay (msg, centerBox, incrLabel, decrLabel);
          else if (msgType == OSR)
             new OSRDisplay (msg, centerBox);
          else if (msgType == FREE_TEXT)
             new FreeTextDisplay (msg, centerBox);
       private void createButtonPanel ()
          // build the button panel
          buttonPanel = new JPanel ();
          buttonPanel.setLayout (new BoxLayout (buttonPanel, BoxLayout.X_AXIS));
          buttonPanel.setBorder (new LineBorder (Color.BLACK));
          // Create and add the buttons
          buttonPanel.add (createButton ("FIRST_BUTTON"));
          buttonPanel.add (createButton ("PREV_BUTTON"));
          buttonPanel.add (createButton ("NEXT_BUTTON"));
          buttonPanel.add (createButton ("LAST_BUTTON"));
       private JButton createButton (String buttonName)
          JButton button = new JButton ();
          button.addActionListener (this);
          button.setActionCommand (buttonName);
          Image image = null;
          String tooltip = "Press to go to the ";
          if (buttonName.equals ("FIRST_BUTTON"))
             image = new ImageIcon ("firstArrowIcon.gif").getImage();
             tooltip += "First";
          else if (buttonName.equals ("PREV_BUTTON"))
             image = new ImageIcon ("previousArrowIcon.gif").getImage();
             tooltip += "Previous";
          else if (buttonName.equals ("NEXT_BUTTON"))
             image = new ImageIcon ("nextArrowIcon.gif").getImage();
             tooltip += "Next";
          else if (buttonName.equals ("LAST_BUTTON"))
             image = new ImageIcon ("lastArrowIcon.gif").getImage();
             tooltip += "Last";
          tooltip += " message in the lst";
          button.setToolTipText (tooltip);
          button.setIcon (new ImageIcon (image.getScaledInstance (36, 36, Image.SCALE_FAST)));
          return button;
       public void actionPerformed (ActionEvent e)
          if (e.getActionCommand ().equals ("FIRST_BUTTON"))
             index = 0;
          else if (e.getActionCommand ().equals ("PREV_BUTTON"))
             if (index > 0)
                index--;
          else if (e.getActionCommand ().equals ("NEXT_BUTTON"))
             if (index < numMsgs - 1)
                index++;
          else if (e.getActionCommand ().equals ("LAST_BUTTON"))
             index = numMsgs - 1;
          titledBorder.setTitle ("Message " + String.valueOf (index + 1) +
                                 " of " + String.valueOf (numMsgs));
          createMsgPanel ((Message) missionData.messages.elementAt (index));
       private static class MessageType
                            extends EnumeratedType
                            implements Serializable
          final static long serialVersionUID = 1;
          protected MessageType (int value, String desc)
             super (value, desc);
       private static MessageType FREE_TEXT =
          new MessageType (0, "Free Text");
       private static MessageType CAS =
          new MessageType (1, "Call Accounting System");
       private static MessageType OSR =
          new MessageType (2, "Occupational Survey Report");
    }

    That's all well and good, but I've had more times that not where
    people want the entire program, not bits and pieces.Then you missed the whole point of that link.
    We don't want to see bits and pieces of code. We want to see an executable program, but we want an executable program the demonstrates the incorrect behaviour without all the unnecessary code. 90% of the code you posted was not related to your problem. That is we what you do to some basic debugging and remove the parts of code that are not related to the problem so we can concentrate on the code that is related to the problem.

  • Sales order cancelled and new sales order with added components

    Hi all,
    There is a MTO scenario.Lets say a product X was to be made .Now when the production was complete,the sales order got cancelled and a new sales order was generated for same product with 2 new components to be added,lets say A and B.
    So now i have to use the finished good x and new components A and B for the new sales order.How will the costing of new product be done and how do i maintain the BOM?

    Dear,
    You have to create the new material code for your new product as it is having two new components. For that new product say Y you need to add the X, A and B.
    As you have already manufactured the X so system will not create any procurement proposal for it and you can consume the X while manufacturing the Y and it cost also get capture to the Y. This is standard Practice.
    Hope clear to you.
    Regards,
    R.Brahmankar

  • Programmatically adding a Word Document or PDF to a crystal report

    I am using Crystal XI for windows.  I have a VB.Net windows application that I am trying to insert a Word Document and/or PDF into.  I want to programmatically be able to add any file(s) to a crystal report.  Is there any sample code or guidance that can show me how to programmically add a file to a report?
    In the user interface, the user can click on unlimited number of PDFs, Word Documents... to insert into a Crystal Report.  Is this possible?   If so, please show steps and some sample code how to do this.
    Kind Regards,
    Jeff

    In this example, the ReportAppFactory gets initialized with the instance from the session object... If I am doing this in windows (not a web application), how would this change it if this is a windows application with no session object?
    I am connecting against an  ADO.Net (XML) file on the same computer - no connection information required... I just want to open the report file, SetDataSource to a dataset ...then do the other stuff in the example.  I think after I get past connecting to the data and opening the report, the rest of working with sections and adding ole objects I can get from the examples.  All of the sample code that I found are web based and don't show how to connect if you are windows based - not over a web page.
    I am not using a CMS or anything web / network based... I just want to connect to a local XML file that was generated from Visual Studio .Net 2005.   The example below is one of the Crystal Samples... they are all web based samples.  ...I am looking for a windows based sample to see how to connect and open a report file.
    Example:
            If Not (Session("boEnterpriseSession") Is Nothing) Then
                boEnterpriseSession = CType(Session("boEnterpriseSession"), CrystalDecisions.Enterprise.EnterpriseSession)
            Else
                'Log on to the Enterprise CMS
                boSessionMgr = New CrystalDecisions.Enterprise.SessionMgr
                boEnterpriseSession = boSessionMgr.Logon(Request.QueryString.Item("username"), Request.QueryString.Item("password"), Request.QueryString.Item("cms"), Request.QueryString.Item("authtype"))
                Session.Add("boEnterpriseSession", boEnterpriseSession)
            End If
            'get report object from session or create a new report object
            If Not (Session("boReportClientDocument") Is Nothing) Then
                boReportClientDocument = CType(Session("boReportClientDocument"), CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocument)
            Else
                boEnterpriseService = boEnterpriseSession.GetService("", "InfoStore")
                boInfoStore = New CrystalDecisions.Enterprise.InfoStore(boEnterpriseService)
                boReportName = "SimpleRCAPIReport.rpt"
                'Retrieve the report object from the InfoStore, only need the SI_ID for RAS
                boQuery = "Select SI_ID From CI_INFOOBJECTS Where SI_NAME = '" + boReportName + _
                 "' AND SI_Instance=0"
                boInfoObjects = boInfoStore.Query(boQuery)
                boInfoObject = boInfoObjects(1)
                boEnterpriseService = Nothing
                'Retrieve the RASReportFactory
                boEnterpriseService = boEnterpriseSession.GetService("RASReportFactory")
                boReportAppFactory = CType(boEnterpriseService.Interface, CrystalDecisions.ReportAppServer.ClientDoc.ReportAppFactory)
                'Open the report from Enterprise
                boReportClientDocument = boReportAppFactory.OpenDocument(boInfoObject.ID, 0)
                'First determine where to add - in this case the details Area
                boArea = boReportClientDocument.ReportDefController.ReportDefinition.DetailArea
                'Create the new section object
                boSection = New CrystalDecisions.ReportAppServer.ReportDefModel.Section
                'Set the properties for the section
                boSection.Kind = CrystalDecisions.ReportAppServer.ReportDefModel.CrAreaSectionKindEnum.crAreaSectionKindDetail
                boSection.Name = "Detail2"
                boSection.Height = 1000
                boSection.Width = 11520
                'Now add the section
                boReportClientDocument.ReportDefController.ReportSectionController.Add(boSection, boArea, -1)
                'Add the reportClientDocument to session
                Session.Add("boReportClientDocument", boReportClientDocument)
            End If
    Thanks,
    Jeff
    Edited by: Jeff Dressing on Aug 20, 2008 10:48 AM

  • AdvancedDataGrid problem with programmatically adding a column

    Hi everybody,
    I have a Problem with adding columns programmatically to a AdvancedDataGrid. The code:
    var cols:Array = thisDataGrid.columns;
    cols.push(dgc);
    thisDataGrid.columns = cols;
    does create a column, adds it to the cols array, bot the last code line has no effect. The cols wont be found in the thisDataGrid.columns property...
    What could be the problem? I'm working with a test license, and on the advanceddatagrid the watermark shows up. Could this be a problem?
    Thanks for help!
    Markus

    As the columns property of an adg is bindable, you could try to bind it to an array and afterwards, add columns to that array:
    AS:
    [Bindable]
    private var adgCols:Array = new Array();
    private function addCol():void
                    var myCol:AdvancedDataGridColumn = new AdvancedDataGridColumn();
                    myCol.headerText = "test";
                    myCol.dataField = "v1";
                    adgCols.push(myCol);
    MXML:
    <mx:AdvancedDataGrid id="adg" designViewDataType="flat" columns="{adgCols}"/>
    This helps?
    Dany

  • Panel adding Components

    Hi all,
    I have a problem here with Java swing. I tried to create a JPanel and add all the components in to it like Label, JRadioButton,JCheckBox, etc., and finally adding them in to a container which gets the content pane and display it. The problem here is the panel is adding the Label properly but not the other JComponents. I have tested it by adding some more JComponents and non-JComponents and those with nonJs are added properly and displays only those components.
    Model Code:
    Container cp = getContentPane();
    cp.setLayout(new FlowLayout());
    JPanel secPanel = new JPanel();
    secPanel.setLayout(new BoxLayout(secPanel,BoxLayout.Y_AXIS));
    Label lbl = new Label("Heading");
    secPanel.add(lbl);
    secPanel.add(new JCheckBox("Choice 1");
    secPanel.add(new JRadioButton("choice 2");
    cp.add(secPanel);Further, I have also tested by creating a new JApplet and same as above, I did the panel and added JComponents in to that and it seems to work fine there.
    Completely, bizarre for me!!!
    Can anybody shed their views you have here?
    Thanks,
    Shivaram.

    Sure. I now removed all the nonJComponents and pasted down the code
    import java.awt.*;
    import java.applet.*;
    import java.awt.event.*;
    import java.util.*;
    import javax.swing.*;
    public class TestSwingCheck02 extends JApplet implements ItemListener{
        String order;
        int numSections=0;
        String[] alpha = { "A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V",
                "W","X","Y","Z"};
                int score = 0; //default value
                int ansSetID = 0;
                boolean validParams = true;
                Vector panelVector;
                Vector choiceVector;
                Vector labelVector;
                Vector boxGroupVector;
                Vector correctAnswers;
                Vector sectionScores;
                Vector ansSets;
                String itemSelected=""; //for debugging
                String errorMessage="";
                boolean shuffle;
                Container mainPanel;
                /** Initialization method that will be called after the applet is loaded
                 *  into the browser.
                public void init() {
                    try {
                        javax.swing.SwingUtilities.invokeAndWait(new Runnable() {
                            public void run() {
                                createGUI();
                    } catch (Exception e) {
                        System.err.println("createGUI didn't successfully complete");
                private void createGUI() {
                    // TODO start asynchronous download of heavy resources
                    panelVector = new Vector();
                    choiceVector = new Vector();
                    labelVector = new Vector();
                    boxGroupVector = new Vector();
                    correctAnswers = new Vector();
                    sectionScores = new Vector();
                    shuffle = false;
                    mainPanel = getContentPane();
                    order = this.getParameter("order_type");
                    numSections = Integer.parseInt(this.getParameter("num_sections"));
                    if(order.equalsIgnoreCase("C")){
                        mainPanel.setLayout(new FlowLayout());
                    }else if(order.equalsIgnoreCase("R")){
                        mainPanel.setLayout(new FlowLayout());
                    }else{
                        errorMessage = "Order type '"+order+"' is not recognised. Please specify either 'R' for rowwise layout or 'C' for columnwise layout.";
                    if(!(order.equalsIgnoreCase("C") || order.equalsIgnoreCase("R"))){
                        validParams = false;
                        score = -99;
                    if(validParams){
                        for(int i=0; i<numSections; i++){
                            Box secPanel = new Box(BoxLayout.Y_AXIS);
                            String sectionPart = "sec"+alpha;
    String heading = this.getParameter(sectionPart+"_head");
    String secType = this.getParameter(sectionPart+"_type");
    int totalChoices = Integer.parseInt(this.getParameter(sectionPart+"_choicenum"));
    String choiceList = this.getParameter(sectionPart+"_choices");
    String correctAns = this.getParameter(sectionPart+"_correct");
    String sShuffle = this.getParameter(sectionPart+"_shuffle");
    String secScore = this.getParameter(sectionPart+"_score");
    ansSets = new Vector();
    boolean hasMultipleAnswers = false;
    if(ansSets.size()==0){
    if(this.getParameter("answer_set") != null){
    ansSets.add(this.getParameter("answer_set"));
    }else if(this.getParameter("answer_set1") != null){
    for(int q=1;q<=100;q++){
    if(this.getParameter("answer_set"+q) != null){
    ansSets.add(this.getParameter("answer_set"+q));
    }else{
    break;
    if(sShuffle != null){
    shuffle = Boolean.parseBoolean(sShuffle);
    if(correctAns != null){
    correctAnswers.add(correctAns);
    sectionScores.add(secScore);
    String[] choices = null;
    if(choiceList != null){
    if(!choiceList.equals("")){
    choices = this.splitChoiceList(choiceList);
    if(choices.length != totalChoices){
    errorMessage = "Choicenum value doesnot match with the total number of choices in "+sectionPart;
    if(order.equalsIgnoreCase("C")){
    }else if(order.equalsIgnoreCase("R")){
    if(secType.equalsIgnoreCase("chk")){
    hasMultipleAnswers = true;
    }else if(secType.equalsIgnoreCase("rdo")){
    Font fnt = new Font("Monospaced",Font.BOLD,14);
    JLabel lbl = new JLabel(heading);
    lbl.setFont(fnt);
    labelVector.add(lbl);
    secPanel.add((JLabel)labelVector.get(i));
    secPanel.add(new JLabel("Check label"));
    secPanel.add(new JRadioButton("Check1"));
    Vector tempChoice = new Vector();
    for(int j=0; j<choices.length; j++){
    if(hasMultipleAnswers) {
    tempChoice.add(new JCheckBox(choices[j]));
    }else{
    tempChoice.add(new JRadioButton(choices[j]));
    secPanel.add(new JRadioButton("Check2"));
    if(shuffle){
    Vector afterShuffle = this.shuffleChoices(tempChoice);
    for(int j=0; j<afterShuffle.size(); j++){
    if(hasMultipleAnswers){
    JCheckBox chkBox = (JCheckBox)afterShuffle.get(j);
    chkBox.setVisible(true);
    chkBox.setEnabled(true);
    chkBox.addItemListener(this);
    secPanel.add(chkBox);
    }else{
    JRadioButton rdoBtn = (JRadioButton)afterShuffle.get(j);
    rdoBtn.setVisible(true);
    rdoBtn.setEnabled(true);
    rdoBtn.addItemListener(this);
    secPanel.add(rdoBtn);
    choiceVector.add(tempChoice);
    }else{
    for(int j=0; j<tempChoice.size();j++){
    if(hasMultipleAnswers){
    JCheckBox chkBox = (JCheckBox)tempChoice.get(j);
    chkBox.setVisible(true);
    chkBox.setEnabled(true);
    chkBox.addItemListener(this);
    secPanel.add(chkBox);
    }else{
    JRadioButton rdoBtn = (JRadioButton)tempChoice.get(j);
    rdoBtn.setVisible(true);
    rdoBtn.setEnabled(true);
    rdoBtn.addItemListener(this);
    secPanel.add(rdoBtn);
    choiceVector.add(tempChoice);
    //secPanel.setVisible(true);
    secPanel.setBackground(Color.YELLOW);
    mainPanel.add(secPanel, BorderLayout.NORTH);
    mainPanel.setVisible(true);
    public void itemStateChanged(ItemEvent ie){
    public void paint(Graphics g){
    Thanks,
    Shivaram.

Maybe you are looking for

  • Turnaround/Shutdown Process implementation using PS/PM modules

    We are a larger Size Fertilizer Industry, currently in the process of SAP Implementation. We carry out Annual Turnarounds each year for annual maintenance / overhauling of our equipment / machines. The total numbers of maintenance jobs are around 150

  • My phone will not update to 3.1 says server time out or network settings

    Can anyone tell me what I need to do to be able to update to 3.1. I have done it several times as I am supposed to, but it keeps telling me there is an error or timeout that I need to check my network settings or try again later. I have tried it on s

  • Converting Datetime in String in map

    Hello all, I am reciving a message from a system A, in which I am receiving field DOB as datetime and I am sending same message to system B , problem is that system B not able to handle DOB at there end as datetime - I have checked at BizTalk side th

  • IDS 4230 - End of Software Support = No Signature Update?

    I have one question regarding to Product Bulletin, No. 1772 - "End-of-Sale Announcement for Cisco Intrusion Detection System 4230 Platform" According to the bulletin, the date of End of software support is July 31, 2005. Does it mean the signate upda

  • How do I get out of full screen mode?

    How do I get out of full-screen mode? This happened after installing Lion.