0 Replies Latest reply on Sep 18, 2008 4:02 PM by Stephen Chambers

    Positioning dynamically created element within custom compon

    Stephen Chambers Newbie

      I have a custom component like below where I am creating several div's and then an HtmlCalender component. How do I make sure it is in a certain position within the html I am creating?

       @Override
       public void encodeBegin( FacesContext context ) throws IOException {
       FacesContext currentInstance = FacesContext.getCurrentInstance();
       Application app = FacesContext.getCurrentInstance().getApplication();
      
       ResponseWriter writer = context.getResponseWriter();
       writer.startElement( "div", this );
       writer.writeAttribute( "width", new Integer(140), "width" );
       writer.writeAttribute("id", getClientId(currentInstance), "id");
       writer.startElement( "div", this );
       writer.write( "Start" );
       writer.endElement( "div" );
      
       writer.startElement( "div", this );
       writer.write( "Start Date" );
       writer.startElement( "br",this );
       writer.endElement( "br" );
       HtmlCalendar calendar = (HtmlCalendar) app.createComponent( HtmlCalendar.COMPONENT_TYPE );
       calendar.setPopup( true );
       calendar.setShowApplyButton( true );
       getChildren().add( calendar );
       writer.endElement( "div" );
      
       writer.startElement( "div", this );
       writer.write( "Start After" );
       writer.startElement( "br",this );
       writer.endElement( "br" );
       writer.startElement( "input", this );
       writer.writeAttribute("name", "startAfter", "name");
       writer.writeAttribute("type", "text", "type");
       writer.writeAttribute("class", "table_text", "class");
       writer.endElement( "input" );
       writer.endElement( "div" );
      
       writer.startElement( "div", this );
       writer.write( "Don't Start After" );
       writer.startElement( "br",this );
       writer.endElement( "br" );
       writer.startElement( "input", this );
       writer.writeAttribute("name", "dontStartAfter", "name");
       writer.writeAttribute("type", "text", "type");
       writer.writeAttribute("class", "table_text", "class");
       writer.endElement( "input" );
       writer.endElement( "div" );
      
       writer.startElement( "div", this );
       writer.startElement( "font", this );
       writer.writeAttribute("color", "#FF0000", "color");
       writer.write( "* All times are local store time" );
       writer.endElement( "font" );
       writer.endElement( "div" );
       writer.endElement( "div" );
      
       writer.flush();
       }


      I would like it to show up right where I have the code right now. (Obviously it won't work this way) Is there anyway I can get it to be a certain position within the various html tags? Right now it is showing up last.

      Steve