No Margin if I use TableView Iterator

I am using a htmlb:TableView with Iterator.
I noticed that the cell-margin disappears if I a htmlb:textView in the iterator.
For example, if I have two columns, and in only the second column I show a textview as a replacement bee, the second column will have no cell-margin while the first one has.
METHOD if_htmlb_tableview_iterator~render_cell_start .
  DATA lr_text  TYPE REF TO cl_htmlb_textview.
  FIELD-SYMBOLS <fs_row>  LIKE LINE OF ##mytable##.
    CASE p_column_key.
      WHEN 'MYCOLUMN2'.
        CREATE OBJECT lr_text.
        lr_text->id       = p_cell_id.
        lr_text->wrapping = cl_bdv_co=>c_true.
        lr_text->text     = <fs_row>-mycolumn2.
        p_replacement_bee = lr_text.
    ENDCASE.
ENDMETHOD.
Is there anything I can do about it?

p_class is depreciated as on design 2003. check this thread for more on this.
Note 816352: Rendering Differences between DESIGN 2002 and 2003.
instead what you an do is place a raw html table with cellpadding and one cell containing your text into this cell.
DATA: rad_gp TYPE REF TO cl_bsp_bee_table.
      CREATE OBJECT rad_gp.
      rad_gp->add_html( html = '<table cellpadding="2" ...' ).
      p_replacement_bee = rad_gp.
Regards
Raja

Similar Messages

  • Error when updating back to ODS using tableview iterator.

    I get this error when I try to execute my bsp page. The page collects a cell value that was edited on the previous page and updates it to the ods.
    The error is "Function not possible in a captured session"
    The termination type was: TH_RES_FREE
    When I debug, every thing looks fine. ITab3 returns values it's supposed to. So I am not sure what's causing it to fail. Any ideas? Thanks.
    Here is my code:
    CLASS cl_htmlb_manager DEFINITION LOAD.
    DATA: event TYPE REF TO cl_htmlb_event.
    event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
    if event->id = 'Update' and event->event_type = 'click'.
      DATA: tv TYPE REF TO cl_htmlb_tableview.
    FIELD-SYMBOLS <i> LIKE LINE OF selectedrowindextable.
    tv ?= cl_htmlb_manager=>get_data( request = runtime->server->request
                                     name = 'tableView'
                                     id = 'tv1' ).
    IF tv IS NOT INITIAL.
    DATA: tv_data TYPE REF TO cl_htmlb_event_tableview.
      tv_data = tv->data.
      refresh itab2.
      refresh itab3.
      call method tv_data->GET_ROWS_SELECTED
      receiving selected_rows = itab2.
      endif.
      data : ind type SELECTEDROW,
              row_s type row.
      if itab2 is not initial.
        data: rw LIKE LINE OF itab.
        loop at itab2 into ind.
        READ TABLE itab INDEX ind-index into
        rw.
        if rw is not initial.
        row_s = rw.
        append row_s to itab3.
        clear row_s.
        endif.
        endloop.
            MODIFY /bic/aNCN_O01300 FROM table itab3.
          ENDIF.
          endif.

    hi Uday,
    This is simple....
    Use the function module
    <b>1) For adding leading zero's or spaces...!</b>
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
      EXPORTING
        INPUT   = lw_variable
    IMPORTING
       OUTPUT   = lw_variable.
    <b>2) and for removing leading zero's or spaces.....</b>
    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
      EXPORTING
        INPUT   = lw_variable
    IMPORTING
       OUTPUT   = lw_variable.
    Hope this helps.
    <b><i>Do reward each useful answer..!</i></b>
    Thanks,
    Tatvagna.

  • Checkbox  in a table loop - without using Tableview or Iterator.

    My client doesnt want to use tableview or iterator. We are using basic html to create the page. I know I can accomplish much easily using tableviews...but I am not allowed to use it.
    My requirement is simple. In my layout I loop at my internal table and display the contents. The last field is displayed as a checkbox.
    Ex:
    Name  status flag
    Tom  10         [ ]
    Ted    20        [X]
    Rob    10       [X]
    My loop in the Layout is as below:
    <%
      loop at t_rqdt into l_rqdt.
      if l_rqdt-flag = 'X'.
         l_chk = 'checked'.
      endif.
    %>
    <tr bgcolor="#EFEFEF">
    <td></td>
    <td <%= l_rqdt-name %> </td>
    <td <%= l_rqdt-status %></td>
    <td class=tdstatus width=40% >
    <input type=checkbox name="flag" value="flag" <%= l_chk %> > </td>
      </tr>
    <%
      endloop.
    %>
    When I select couple of rows and mark the flag field checkbox, and SUBMIT at the end, and when I see my internal table t_rqdt field r_rqdt-flag.. I dont see them having value X for the rows I marked the check boxes.
    Can anyone please help me how can I trap the checkboxes marked inside a table loop in my on input processing?
    Thanks
    PK

    Much Thanks Raja! It worked!!
    I declared as below for the form fields and was able to get values.
        DATA:  t_form_fields TYPE tihttpnvp.
        DATA:  l_form_fields TYPE LINE OF tihttpnvp.
        CALL METHOD request->get_form_fields
          CHANGING
            fields = t_form_fields.
    One more before my client asks me to do..
    if I place a button CheckALL and Uncheck All on the layout, how can we check/uncheck all the checkboxes on the client side. Any simple Javascript method available? I know I can pass the itab to on input processing and get the flags set, but if it can be achieved on the client side using a script that would help.
    Please let me know.
    Thanks.

  • Problem with tableview iterator

    Dear friends.
    I try to adopt tableview iterator in my customer's BSP pages. So, I programmed test page.
    METHOD if_htmlb_tableview_iterator~render_row_start .
      m_row_ref ?= p_row_data_ref.
    ENDMETHOD.
    M_ROW_REF is "Static Attribute" and "Public" and "Type Ref To Z3TYDISP"
    z3tydisp has structure as below
    REQNO          NUMC     12
    VGUBUN          CHAR     1
    DSCOFVGUBUN     STRING     0
    REQDT          DATS     8
    RNAME          CHAR     10
    VCOMP          CHAR     30
    VNAME          CHAR     10
    VPLACE          CHAR     5
    VPLACEDSC     CHAR     20
    APPROVAL     CHAR     1
    DSCOFAPPROVAL     STRING     0
    AND... p_row_data_ref has structure below
    REQNO     N     12
    VGUBUN     C     1
    DSCOFVGUBUN     g     0
    REQDT     D     8
    RNAME     C     10
    VCOMP     C     30
    VNAME     C     10
    VPLACE     C     5
    VPLACEDSC     C     20
    APPROVAL     C     1
    DSCOFAPPROVAL     g     0
    In my option, p_row_data_ref has same structure compared with z3tydisp. But there is "CX_SY_MOVE_CAST_ERROR". How I have to define "z3tydisp"????

    >><b>M_ROW_REF is "Static Attribute" and "Public" and "Type Ref To Z3TYDISP"</b>
    instead of this make your M_ROW_REF a instantaneous attribute. since static attribute are intantiated only once when object created and are shared by all other intances. m_row_ref contains data about the table you are going to render using tableview. so it should be public, so that get different data for different iterator objects.
    your p_row_data_ref must be of type ref to data which is superior class of data types.
    and if you have defined iterator "IF_HTMLB_TABLEVIEW_ITERATOR" in your interfaces. then you need not to define structure for p_row_data_ref, its already there in interface.
    hope this will solve your problem,
    regards,
    hemendra

  • Nested image Tag in tableview iterator

    In the past I use the tableview tag "tableViewColumn". In this tag a nested image tag inside a link tag was used.
    Now I use the tableview iterator. But I can only define one p_replacement_bee in the RENDER_CELL_START method.
    Does anyone knows a solution for my problem?
    Example:
    <htmlb:tableViewColumn columnName = "transport"
    tooltipColumnKey = "transport_tooltip"
    type = "user"
    title = "<%= otr(zinternet/tracking) %>"
    horizontalAlignment = "center" >
    <htmlb:link id = "$TVCID$"
    reference = "$TRANSPORT_LINK$"
    target = "_blank" >
    <htmlb:image src="$TVCVALUE$" />
    </htmlb:link>
    </htmlb:tableViewColumn>

    Just off hand I see one problem.  In your reference you have 'www.sap.com'.  This link wouldn't work (and might be causing your problem, because without the http:// on the front it would assume that was a relative path.
    Other than that I don't see a problem off hand.  I normally don't render my elements to BEEs and then add the BEEs to the BEE Tree. I prefer to render to elements and then use the ADD method instead of the ADD_BEE method:
            data: tag_gl       type ref to cl_htmlb_gridlayout,
                  tag_glc_if1  type ref to cl_htmlb_gridlayoutcell,
                  tag_glc_if2  type ref to cl_htmlb_gridlayoutcell,
                  tag_glc_if3  type ref to cl_htmlb_gridlayoutcell.
            tag_gl       = cl_htmlb_gridlayout=>factory(
                        columnsize  = '3' rowsize  = '1' ).
            tag_glc_if1 = cl_htmlb_gridlayoutcell=>factory(
                        columnindex = '1' rowindex = '1' ).
            tag_glc_if2  = cl_htmlb_gridlayoutcell=>factory(
                        columnindex = '2' rowindex = '1' ).
            tag_glc_if3  = cl_htmlb_gridlayoutcell=>factory(
                        columnindex = '3' rowindex = '1' ).
            data: seats_bee type ref to cl_bsp_bee_table.
            create object seats_bee.
            seats_bee->add( level = 1 element = tag_gl ).
            seats_bee->add( level = 2 element = tag_glc_if1 ).
            seats_bee->add( level = 3 element = if_first ).
            seats_bee->add( level = 2 element = tag_glc_if2 ).
            seats_bee->add( level = 3 element = if_bus ).
            seats_bee->add( level = 2 element = tag_glc_if3 ).
            seats_bee->add( level = 3 element = if_econ ).
            p_replacement_bee = seats_bee.

  • Matrix in tableView iterator

    Hi,
    I have created a composite BSP element that outputs a matrix with two cells, the first containing an icon, the second with a description.  This works fine when placed in a BSP page.
    When, however, I try to use the element in a tableView iterator, it blanks the whole table.  Do I need to do something special to get the element working inside a tableView?
    My element code is posted here:
    METHOD if_bsp_element~do_at_beginning.
    * use matrix to control alignment
    * <phtmlb:matrix width = "100%" >
      DATA: phtmlb_matrix TYPE REF TO cl_phtmlb_matrix.
      phtmlb_matrix = cl_phtmlb_matrix=>factory( width = '100%' ).
    * create matrix and set alignment
      WHILE m_page_context->element_process( element = phtmlb_matrix ) = co_element_continue.
        CLEAR:  phtmlb_matrix->mc_backgrounddesign,
                phtmlb_matrix->mc_col,
                phtmlb_matrix->mc_design,
                phtmlb_matrix->mc_row,
                phtmlb_matrix->mc_halign,
                phtmlb_matrix->mc_separation.
        phtmlb_matrix->mc_valign = 'MIDDLE'.
        phtmlb_matrix->mc_halign = 'LEFT'.
        phtmlb_matrix->do_set_data( element_name = 'matrixCell' ).
    *   get status info
        data: ls_status type /baasow/status.
        clear: ls_status.
        select single * from /baasow/status
          into ls_status where status = status.
        DATA: html TYPE string.
    *   no status found
        if sy-subrc ne 0.
          html = status.
          me->print_string( html ).
          exit.
        endif.
    *   status icon
        DATA: lr_icon TYPE REF TO cl_htmlb_image.
        lr_icon = cl_htmlb_image=>factory(
                src = ls_status-icon ).
        WHILE m_page_context->element_process( element = lr_icon )
          = co_element_continue.
        ENDWHILE.
        CLEAR:  phtmlb_matrix->mc_backgrounddesign,
                phtmlb_matrix->mc_col,
                phtmlb_matrix->mc_design,
                phtmlb_matrix->mc_row,
                phtmlb_matrix->mc_halign,
                phtmlb_matrix->mc_separation.
        phtmlb_matrix->mc_valign = 'MIDDLE'.
        phtmlb_matrix->mc_halign = 'LEFT'.
        phtmlb_matrix->do_set_data( element_name = 'matrixCell' ).
    *   status text
        html = ls_status-TEXTSH.
        me->print_string( html ).
      ENDWHILE.
      rc = co_element_done.
    ENDMETHOD.

    Hi,
    I have created a composite BSP element that outputs a matrix with two cells, the first containing an icon, the second with a description.  This works fine when placed in a BSP page.
    When, however, I try to use the element in a tableView iterator, it blanks the whole table.  Do I need to do something special to get the element working inside a tableView?
    My element code is posted here:
    METHOD if_bsp_element~do_at_beginning.
    * use matrix to control alignment
    * <phtmlb:matrix width = "100%" >
      DATA: phtmlb_matrix TYPE REF TO cl_phtmlb_matrix.
      phtmlb_matrix = cl_phtmlb_matrix=>factory( width = '100%' ).
    * create matrix and set alignment
      WHILE m_page_context->element_process( element = phtmlb_matrix ) = co_element_continue.
        CLEAR:  phtmlb_matrix->mc_backgrounddesign,
                phtmlb_matrix->mc_col,
                phtmlb_matrix->mc_design,
                phtmlb_matrix->mc_row,
                phtmlb_matrix->mc_halign,
                phtmlb_matrix->mc_separation.
        phtmlb_matrix->mc_valign = 'MIDDLE'.
        phtmlb_matrix->mc_halign = 'LEFT'.
        phtmlb_matrix->do_set_data( element_name = 'matrixCell' ).
    *   get status info
        data: ls_status type /baasow/status.
        clear: ls_status.
        select single * from /baasow/status
          into ls_status where status = status.
        DATA: html TYPE string.
    *   no status found
        if sy-subrc ne 0.
          html = status.
          me->print_string( html ).
          exit.
        endif.
    *   status icon
        DATA: lr_icon TYPE REF TO cl_htmlb_image.
        lr_icon = cl_htmlb_image=>factory(
                src = ls_status-icon ).
        WHILE m_page_context->element_process( element = lr_icon )
          = co_element_continue.
        ENDWHILE.
        CLEAR:  phtmlb_matrix->mc_backgrounddesign,
                phtmlb_matrix->mc_col,
                phtmlb_matrix->mc_design,
                phtmlb_matrix->mc_row,
                phtmlb_matrix->mc_halign,
                phtmlb_matrix->mc_separation.
        phtmlb_matrix->mc_valign = 'MIDDLE'.
        phtmlb_matrix->mc_halign = 'LEFT'.
        phtmlb_matrix->do_set_data( element_name = 'matrixCell' ).
    *   status text
        html = ls_status-TEXTSH.
        me->print_string( html ).
      ENDWHILE.
      rc = co_element_done.
    ENDMETHOD.

  • Composite Element in Tableview Iterator

    I want to use a <phtmlb:matrix> element in a tableview iterator to arrange the content of a cell.
    I tried to follow Brians Weblog on composite elements.
    In my test example, I just want to combine two fields of t000 into one cell. Of course I know, that concatenation would be more easy here, but that would not answer my questions.
    Thought it could look like this:
    METHOD render_cell_start.
      DATA:
        l_o_matrix             TYPE REF TO cl_phtmlb_matrix,
        l_o_bsp_element        TYPE REF TO cl_bsp_element,
        l_string               TYPE STRING.
      CASE p_tableview_id.
        WHEN 'TABLE_T000'.
        l_o_matrix = cl_phtmlb_matrix=>factory( ).
        WHILE o_page_context->element_process( element = l_o_matrix )
          = cl_bsp_element=>co_element_continue.
    Cell 1
          CLEAR: l_o_matrix->mc_backgrounddesign,
                 l_o_matrix->mc_design,
                 l_o_matrix->mc_separation.
          l_o_matrix->do_set_data( element_name = 'matrixCell' ).
          l_string = me->t000-mandt.
          l_o_bsp_element = cl_htmlb_textview=>factory( text = l_string ).
          WHILE o_page_context->element_process( element = l_o_bsp_element )
           = cl_bsp_element=>co_element_continue.
          ENDWHILE.
    Cell 2
          CLEAR: l_o_matrix->mc_backgrounddesign,
                 l_o_matrix->mc_design,
                 l_o_matrix->mc_separation.
          l_o_matrix->mc_halign = 'LEFT'.
          l_o_matrix->mc_valign = 'TOP'.
          l_o_matrix->do_set_data( element_name = 'matrixCell' ).
          l_string = me->t000-mtext.
          l_o_bsp_element = cl_htmlb_textview=>factory( text = l_string ).
          WHILE o_page_context->element_process( element = l_o_bsp_element )
           = cl_bsp_element=>co_element_continue.
          ENDWHILE.
        ENDWHILE.
        p_replacement_bee = l_o_matrix.
      ENDCASE.
    ENDMETHOD.
    However, that does not work.
    First, the list of T000-MANDT fields is rendered twice:
    into the tableview and into a list before the tableview.
    Second:  T000-MTEXT does not show up at all.
    What do I do wrong?
    I feel that I do not completely understand how the rendering is processed.
    Thanks for our help.
    Juergen

    The following is the example from Brian's weblog, updated for design2003.  It doesn't use the Matrix however.  Perhaps it will help.
    It still doesn't render quite like it did under design2002.  I'm not sure if there is a good way to combine multiple input fields into one cell any longer.  I know others have had a problem with this as well.  I will have to look closer at your matrix attempt.
    when 'SEATS'.
          if p_edit_mode is initial.
            data: max type string, occ type string,
                  value type string.
            max = m_row_ref->seatsmax + m_row_ref->seatsmax_b
                + m_row_ref->seatsmax_f.
            occ = m_row_ref->seatsocc + m_row_ref->seatsocc_b
                + m_row_ref->seatsocc_f.
            condense: max, occ.
            concatenate occ ` / ` max into value.
            p_replacement_bee = cl_htmlb_textview=>factory(
                text = value ).
          else.
            data: icon_plane2 type string.
            icon_plane2 = cl_bsp_mimes=>sap_icon(
                 id = 'ICON_WS_PLANE' ).
            data: image type ref to cl_htmlb_image.
            image = cl_htmlb_image=>factory(
                 id = p_cell_id
                 src = icon_plane2 ).
            data: if_first type ref to cl_htmlb_inputfield.
            if_first = cl_htmlb_inputfield=>factory( id = p_cell_id
                id_postfix = '_first'
                type = 'INTEGER' size = '4' ).
            if_first->value = m_row_ref->seatsocc_f.
            data: if_bus   type ref to cl_htmlb_inputfield.
            if_bus   = cl_htmlb_inputfield=>factory( id = p_cell_id
                id_postfix = '_bus'
                type = 'INTEGER' size = '4' ).
            if_bus->value = m_row_ref->seatsocc_b.
            data: if_econ  type ref to cl_htmlb_inputfield.
            if_econ = cl_htmlb_inputfield=>factory( id = p_cell_id
                id_postfix = '_econ'
                type = 'INTEGER' size = '4'  ).
            if_econ->value = m_row_ref->seatsocc.
            data: tag_gl       type ref to cl_htmlb_gridlayout,
                  tag_glc_if1  type ref to cl_htmlb_gridlayoutcell,
                  tag_glc_if2  type ref to cl_htmlb_gridlayoutcell,
                  tag_glc_if3  type ref to cl_htmlb_gridlayoutcell.
            tag_gl       = cl_htmlb_gridlayout=>factory(
                        columnsize  = '3' rowsize  = '1' ).
            tag_glc_if1 = cl_htmlb_gridlayoutcell=>factory(
                        columnindex = '1' rowindex = '1' ).
            tag_glc_if2  = cl_htmlb_gridlayoutcell=>factory(
                        columnindex = '2' rowindex = '1' ).
            tag_glc_if3  = cl_htmlb_gridlayoutcell=>factory(
                        columnindex = '3' rowindex = '1' ).
            data: seats_bee type ref to cl_bsp_bee_table.
            create object seats_bee.
            seats_bee->add( level = 1 element = tag_gl ).
            seats_bee->add( level = 2 element = tag_glc_if1 ).
            seats_bee->add( level = 3 element = if_first ).
            seats_bee->add( level = 2 element = tag_glc_if2 ).
            seats_bee->add( level = 3 element = if_bus ).
            seats_bee->add( level = 2 element = tag_glc_if3 ).
            seats_bee->add( level = 3 element = if_econ ).
            p_replacement_bee = seats_bee.
          endif.
    Message was edited by: Thomas Jung

  • Passing Parameters to tableview iterator class

    Hi all,
    I have a tableview with 2 fields say A and B.
    When i click any of the field(row) i want to open a new page with the parameters A and B.
    I have used iterator and able to get the value for either  field-A or field-B..How to get both field values in
    IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START
    This my code,
    *Oncreate*
    create object tv_iterator type ycl_salary_review.
    method if_htmlb_tableview_iterator~render_cell_start .
        data: wf_text type string,
            wf_url type string,
            test type char1.
      data: htmlstring type string ,
      rono type string .
      field-symbols: <fs> type any ,
                       <l_a> type any,
                     <l_b> type any.
      assign p_row_data_ref->* to <fs>.
      case p_column_key.
        when 'A'.
          assign component p_column_key of structure <fs> to <l_a>.
          wf_text = <l_a> .
        concatenate 'page2.htm?field_a=' wf_text into
          wf_url.
          call method cl_htmlb_link=>factory
            exporting
              id        = p_cell_id
              reference = wf_url
              target    = '_self'
              text      = wf_text
            receiving
              element   = p_replacement_bee.
      endcase.
    Rgds,
    Venkonk

    Hi Ven,
    pls Go thro this step-by-step creation of Tableview with iterator...
    /people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator
    Look at the Standard BSP Application BSP_MODEL --> Page Name:- table.htm
    *pls assign points,if link is useful*
    Regards
    CSM reddy

  • BSP tableview Iterator

    Dear Experts,
    I am currently working with BSP tableview iterator.
    I have use many internal tables and the data are store in my class.
    My question is how can i use certain data which already store in my class and display them in my tableview with iterator.
    I use another internal table in my tableview, but when i try to refer my other data which already stored in my class, the internal table is empty.
    Please guide and advise.
    Thanks and regards,
    Simon Kiew

    Hi Bin,
    You can use HTMLB Link in your RENDER_CELL_START method.
    WHEN 'LINK'.
    p_replacement_bee = cl_htmlb_link=>factory(  id    = p_cell_id
    reference= 'http://www.yahoo.com/'
    text      = 'YAHOO'
    target = '_new' ).
    Hope this helps,
    Regards,
    Ravikiran.

  • How can I use a iteration control to compare with array?

    Dear All
    I have done a program and I need to test me program...but I seem to have to problem...I don't know how to use a iteration ( a for loop ) to test my program...
    My test code is written like this...
    public class ClockWatchDemo
    public static void main(String[]args)
    TimePiece[] tpList = new TimePiece[3];
    tpList[0] = new Watch(200, "Vintage", "Men");
    tpList[1] = new Clock(400, "Classic", 70);
    tpList[2] = new Clock(300, "Futuristic", 45);
    for(int i=0; i<3; i++)
    if( i == tpList[0] ) // how can I do to compare my temp integer with the array number?
    System.out.println(tpList[0].toString() + "\n");
    else
    return "";
    Please advise

    Thank you for your help but how can i compare my temp int i to the tpList array?
    I wanted to do something like this
    if( i == tpList)
    System.out.println(tpList[i].toString() + "\n");
    but I will get prompt to inform me that
    if( i == tpList[i])
    incomparable types : int and TimePiece
    Please advise.
    Thank you

  • Dynamic rows in TableView Iterator

    Hello All,
    I am developing an application in which there would be a TableView with last column as a button. OnClick event on the button should add the row below the current row (the facility should be like an Excel spreadsheet where we can insert the rows below). Can it be acheived by re-populating the internal table which his attached with TableView Control.
    Is it Ok to use TableView in such a condition or we have to go with pure HTML tables or some kind of ActiveX controls?
    Thanks in advance.
    Thanks And Regards
    Rajeev Patkie

    Hallo Rajeev,
    > Is it Ok to use TableView in such a condition...
    It is OK to use the tableView as long as it works for you! Once we run into problems, then of course one has to see if the functionality is "working as designed" and whether it was designed to handle your specific request.
    However, what you want to achieve sounds relatively harmless. Just use onclick on the button to trigger a server round trip. (Nice idea: write the row index directly into the onclick string!). Then add a new empty row into your at the correct index (see ABAP documentation), and just render table new.
    All of this should be relatively easy. Why don't you try, and let us see what you achieve.

  • Parent Child Synchronization using a Iterator Component

    Hi All,
    I am working on ADF 11.1.1.5.0. I have the following business requirement :
    I have DepartmentVO and EmployeeVO with a view link defined on DepartmentId attribute.
    Use Case : I need to display all departments with their respective childs with a specific UI design i.e. i need to show all the Departments as Panel boxes and their respective children inside the panel box.
    So for that i have used the Iterator component which will dynamically create Panel boxes based on the rowcount of DepartmentVO .(if there are 5 records in dept table then 5 panel boxes will be formed).
    Similarly for child i have used another Iterator component(inside parent Iterator) which will display its respective children.
    jspx code is as follows :
    <af:panelGroupLayout id="pgl1" layout="scroll">
    <af:iterator id="i2" value="#{bindings.DepartmentsView1.collectionModel}"
    var="row">
    <af:panelBox text="#{row.DepartmentId} -- #{row.DepartmentName}" id="pb1" styleClass="AFStretchWidth">
    <af:panelGroupLayout id="pgl3">
    <af:iterator id="i1" value="#{bindings.EmployeesView3.collectionModel}"
    var="attr">
    <af:outputText value="#{attr.DepartmentId}" id="ot1"/>
    <af:outputText value="#{attr.FirstName}" id="outputText1"/>
    <af:outputText value="#{attr.LastName}" id="outputText2"/>
    </af:iterator>
    </af:panelGroupLayout>
    </af:panelBox>
    </af:iterator>
    </af:panelGroupLayout>
    When i run the page i see all the parent records as panel boxes but child records are not properly synchronized. The children of first parent is getting repeated inside all parents.This probably is the first parent is set as current row for which its children get repeated in all other parents.
    If i run the same through AppModule it runs perfectly as in appmodule run we hv a NEXT button to iterate the Parent VO.
    Thnks
    -Sanjeeb

    HI ,
    Instead of what you have tried, you can try this. EmployeesView here should be present as a child accessor in DepartmentsView.
    <af:iterator id="i2"
    value="#{bindings.DepartmentsView1.collectionModel}"
    var="row">
    <af:panelBox text="#{row.DepartmentId} --#{row.DepartmentName}"
    id="pb1" styleClass="AFStretchWidth">
    <af:panelGroupLayout id="pgl3" layout="vertical">
    <af:iterator id="i1" value="#{row.EmployeesView}" var="attr">
    <af:panelGroupLayout id="pgl0" layout="horizontal">
    <af:outputText value="#{attr.FirstName}" id="outputText1"/>
    <af:outputText value="#{attr.EmployeeId}" id="outputText2"/>
    <af:outputText value="#{attr.LastName}" id="outputText3"/>
    </af:panelGroupLayout>
    </af:iterator>
    </af:panelGroupLayout>
    </af:panelBox>
    </af:iterator>
    Hope this anwsers your question.
    Thanks,
    TJ

  • Using TableView in DefaultStyledDocument

    I have added tables to a DefaultStyledDocument using TableView, TableRow and ParagraphView for cells. I add text to the document using insertText(position, string, style) and tables using insert(position, elementSpec[]). The element spec array for a table might be:
    tableStart
      rowStart
        cellStart
          content
        cellEnd
      rowEnd
    tableEndThis all works OK but in my tests, the table won't resize along the Y axis when it is not the first thing in the document. If it is the first (or only) thing everything is fine. The cells contain text and strangely, this wraps as expected as the window is shrunk but intercepting setSize at the table, row and cell levels shows that the Y axis never grows as the lines in the cells are broken. I'm drawing a border so, of course, the text appears 'outside' and if scrolling is required then anything below the preceived table size cannot be brought into view.
    Using Java 1.4.1 on WinNT - Ideas welcome.

    The key to using TableView is to realise that it does the row/column span stuff but doesn't enforce the type of children you might want to put in it. It is declared abstract so you must extend it to use it, and if you want to use the TableRow inner class you must create the rows in the context of a TableView instance. That said, here is my code again. I explain the important points below:
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.geom.Rectangle2D;
    import java.awt.Shape;
    import java.awt.BasicStroke;
    import javax.swing.SizeRequirements;
    import javax.swing.event.DocumentEvent;
    import javax.swing.text.View;
    import javax.swing.text.BoxView;
    import javax.swing.text.Document;
    import javax.swing.text.ViewFactory;
    import javax.swing.text.Element;
    import javax.swing.text.AttributeSet;
    import javax.swing.text.ParagraphView;
    import java.util.HashSet;
    * @author $Author: Sanderst $
    * @version $Revision: 1 $
    public class StyledEditorKit extends javax.swing.text.StyledEditorKit
      private static HashSet elementTypes__;
      public static String TABLE = "table";
      public static String ROW   = "row";
      public static String CELL  = "cell";
      private ViewFactory viewFactory_ = new ExtendedViewFactory();
      private ViewFactory origVf_;
      static
        elementTypes__ = new HashSet();
        elementTypes__.add(TABLE);
        elementTypes__.add(ROW);
        elementTypes__.add(CELL);
      public StyledEditorKit(ViewFactory vf)
        origVf_ = vf;
      public Document createDefaultDocument()
        return new StyledDocument();
      public ViewFactory getViewFactory()
        return viewFactory_;
      private class ExtendedViewFactory implements ViewFactory
        public View create(Element elem)
             String kind = elem.getName();
          System.out.println("ExtendedViewFactory.create " + kind);
             if (elementTypes__.contains(kind))
            if (kind.equals(TABLE))
              //System.out.println("ExtendedViewFactory.create TABLE!");
              return new TableView(elem);
            else if (kind.equals(ROW))
              // If this gets called its a problem because TableRow is a
              // member-inner class of TableView and we don't have the
              // TableView to create it with.  loadChildren is called instead
              //System.out.println("ExtendedViewFactory.create ROW!");
              return null;
            else if (kind.equals(CELL))
              //System.out.println("ExtendedViewFactory.create CELL!");
              //return new ParagraphView(elem);
              TableCell tc = new TableCell(elem);
              tc.setBorderWidth((short)1);
              tc.setCellPadding((short)3);
              return tc;
            else
              return origVf_.create(elem); // Defer to swing's ViewFactory
             else
            // Defer to swing's ViewFactory
            return origVf_.create(elem);
      static private class TableView extends javax.swing.text.TableView
        private View parent_;
        final static private BasicStroke stroke_ = new BasicStroke(1.0f);
        TableView (Element elem)
          super(elem);
          //System.out.println("TableView()");
        // Override to protect our children from having their
        // parent view set to null as well.  See View.setParent()
        public void setParent(View parent)
          if (parent != null)
            super.setParent(parent);
          parent_ = parent;
        public View getParent()
          return parent_;
        public void paint(Graphics g,
                          Shape    allocation)
          //layoutChanged(View.Y_AXIS);
          super.paint(g, allocation);
          //System.out.println("TableView.paint");
        public void setSize(float width, float height)
          super.setSize(width, height);
          //System.out.println("TableView.setSize          " + hashCode() + " " + width + " " + height);
        public float getPreferredSpan(int axis)
          float f = super.getPreferredSpan(axis);
          //if (axis == View.Y_AXIS)
            //System.out.println("TableView.getPreferredSpan " + hashCode() + " " + axis + " " + f);
          return f;
        public float getMinimumSpan(int axis)
          float f = super.getMinimumSpan(axis);
          //if (axis == View.Y_AXIS)
            //System.out.println("TableView.getMinimumSpan   " + hashCode() + " " + axis + " " + f);
          return f;
        public float getMaximumSpan(int axis)
          //float f = super.getMaximumSpan(axis);
          float f ;
          if (axis == View.X_AXIS)
            f = super.getPreferredSpan(axis);  // No stretch.  Could make configurable...
          else
            f = super.getMaximumSpan(axis);
          //if (axis == View.Y_AXIS)
            //System.out.println("TableView.getMaximumSpan   " + hashCode() + " " + axis + " " + f);
          return f;
        protected void loadChildren(ViewFactory f)
          if (f == null)
            // No factory. This most likely indicates the parent view
            // has changed out from under us, bail!
            System.out.println("No factory!!");
            return;
          //System.out.println("TableView.loadChildren()");
          Element e = getElement();
          int n = e.getElementCount();
          if (n > 0)
            View[] added = new View[n];
            for (int i = 0; i < n; i++)
              added[i] = new TableRow(e.getElement(i));
            replace(0, getViewCount(), added);
        public class TableRow extends javax.swing.text.TableView.TableRow
          TableRow(Element elem)
            super(elem);
          public void paint(Graphics g,
                            Shape    allocation)
            super.paint(g, allocation);
            drawCellBorder(g, allocation);
            //System.out.println("TableRow.paint");
          public void setSize(float width, float height)
            super.setSize(width, height);
            //System.out.println("TableRow.setSize           " + hashCode() + " " + width + " " + height);
          public float getPreferredSpan(int axis)
            float f = super.getPreferredSpan(axis);
            //if (axis == View.Y_AXIS)
              //System.out.println("TableRow.getPreferredSpan  " + hashCode() + " " + axis + " " + f);
            return f;
          public float getMinimumSpan(int axis)
            float f = super.getMinimumSpan(axis);
            //if (axis == View.Y_AXIS)
              //System.out.println("TableRow.getMinimumSpan    " + hashCode() + " " + axis + " " + f);
            return f;
          public float getMaximumSpan(int axis)
            float f = super.getMaximumSpan(axis);
            //if (axis == View.Y_AXIS)
              //System.out.println("TableRow.getMaximumSpan    " + hashCode() + " " + axis + " " + f);
            return f;
          protected SizeRequirements calculateMinorAxisRequirements(int axis, SizeRequirements r)
            int min   = 0;
            long pref = 0;
            int max   = 0; //Integer.MAX_VALUE;
            int n = getViewCount();
            for (int i = 0; i < n; i++)
              View v = getView(i);
              min = Math.max((int) v.getMinimumSpan(axis), min);
              pref = Math.max((int) v.getPreferredSpan(axis), pref);
              max = Math.max((int) v.getMaximumSpan(axis), max);
            if (r == null)
              r = new SizeRequirements();
              r.alignment = 0.5f;
            r.preferred = (int) pref;
            r.minimum = min;
            r.maximum = max;
            return r;
          protected void drawCellBorder(Graphics g,
                                        Shape    allocation)
            // Get the overall bounding rectangle of the row
            Rectangle2D r = allocation.getBounds2D();
            // Set up the drawing
            Graphics2D g2 = (Graphics2D)g;
            g2.setStroke(stroke_);
            g2.setColor(Color.BLACK);
            int children = getViewCount();
            // draw each cell border
            for (int i = 0; i < children; i++)
              int width = getSpan(View.X_AXIS, i);
              r.setRect(r.getX(), r.getY(), width, r.getHeight());
              //System.out.println("draw " + r);
              g2.draw(r);
              // Move the rectangle origin on to the next cell starting point
              r.setRect(r.getX() + width, r.getY(), width, r.getHeight());
      static private class TableCell extends ParagraphView
        private short borderWidth_  = 0;
        private short cellPadding_  = 0;
        public TableCell(Element elem)
          super(elem);
        public void setBorderWidth(short width)
          if (width < 0)
            return;
          short oldBw  = borderWidth_;
          borderWidth_ = width;
          setInsets((short)(getTopInset()    - oldBw - cellPadding_),
                    (short)(getLeftInset()   - oldBw - cellPadding_),
                    (short)(getBottomInset() - oldBw - cellPadding_),
                    (short)(getRightInset()  - oldBw - cellPadding_));
        public void setCellPadding(short padding)
          if (padding < 0)
            return;
          short oldCp  = cellPadding_;
          cellPadding_ = padding;
          setInsets((short)(getTopInset()    - oldCp - borderWidth_),
                    (short)(getLeftInset()   - oldCp - borderWidth_),
                    (short)(getBottomInset() - oldCp - borderWidth_),
                    (short)(getRightInset()  - oldCp - borderWidth_));
        public void paint(Graphics g,
                          Shape    allocation)
          super.paint(g, allocation);
          //System.out.println("TableCell.paint @" + Integer.toHexString(hashCode()) + " parent: " + getParent());
        public void setSize(float width, float height)
          super.setSize(width, height);
          //System.out.println("TableCell.setSize          " + hashCode() + " " + width + " " + height);
        public float getPreferredSpan(int axis)
          float f = super.getPreferredSpan(axis) + 2 * borderWidth_ + 2 * cellPadding_;
          //if (axis == View.Y_AXIS)
            //System.out.println("TableCell.getPreferredSpan " + hashCode() + " " + axis + " " + f);
            //if (height_ != f)
             // height_ = f;
              //getParent().preferenceChanged(this, false, true);
          return f;
        public float getMinimumSpan(int axis)
          float f = super.getMinimumSpan(axis) + 2 * borderWidth_ + 2 * cellPadding_;
          //if (axis == View.Y_AXIS)
            //System.out.println("TableCell.getMinimumSpan   " + hashCode() + " " + axis + " " + f);
          return f;
        public float getMaximumSpan(int axis)
          //float f = getPreferredSpan(axis);
          float f = super.getMaximumSpan(axis) + 2 * borderWidth_ + 2 * cellPadding_;
          //if (axis == View.Y_AXIS)
            //System.out.println("TableCell.getMaximumSpan   " + hashCode() + " " + axis + " " + f);
          return f;
        protected SizeRequirements calculateMajorAxisRequirements(int axis, SizeRequirements r)
          SizeRequirements s = super.calculateMajorAxisRequirements(axis, r);
          //System.out.println("TableCell.calculateMajorAxisRequirements   " + hashCode() + axis + " " + " " + s);
          return s;
        protected void setInsets(short top,
                                 short left,
                                 short bottom,
                                 short right)
          short ntop    = (short)(top    + borderWidth_ + cellPadding_);
          short nleft   = (short)(left   + borderWidth_ + cellPadding_);
          short nbottom = (short)(bottom + borderWidth_ + cellPadding_);
          short nright  = (short)(right  + borderWidth_ + cellPadding_);
          super.setInsets(ntop,
                          nleft,
                          nbottom,
                          nright);
        protected void setParagraphInsets(AttributeSet attr)
          super.setParagraphInsets(attr);
          setInsets(getTopInset(),
                    getLeftInset(),
                    getBottomInset(),
                    getRightInset());
    }From the top:
    1)
    To make swing understand the new element types for creating tables you need your own EditorKit and ViewFactory. I personally like to delegate to, rather than extend the default ViewFactory so I check if the element type (that is the attribute name) is one that my ViewFactory implementation understands and if not fall back to the Swing one.
    2)
    My TableView extension only tweaks the geometry methods so that the table doesn't stretch to the full width of the space available. This is hard-coded but, like other things, will be set from the element's attributes when I use it in anger. It does its own parent handling - see above. Apart from that all methods are just intercepts to aid my debugging (I mean understanding) of javax.swing.text :-)
    TableView.loadChildren creates the rows, thus satisfying the inner class nature of TableView.TableRow.
    3)
    TableRow just tweaks the geometry to stop rows growing to the full height of the available space, and I added border drawing (see below)
    4) TableCell is an extension of ParagraphView. Again, borders and padding should be read from attributes, tbd.
    Now you need to install the editor kit in any text pane you create - here's my extension of JTextPane to do that:
    public class JTextPane extends javax.swing.JTextPane
      public JTextPane()
      protected EditorKit createDefaultEditorKit()
        EditorKit ek = super.createDefaultEditorKit();
        ViewFactory vf = ek.getViewFactory();
        return new StyledEditorKit(vf);
    }Finally I extended DefaultStyledDocument but only to expose some useful protected methods:
    public class StyledDocument extends DefaultStyledDocument
       * Expose protected method.
      public void create(DefaultStyledDocument.ElementSpec[] data)
        super.create(data);
      public void insert(int offset,
                            DefaultStyledDocument.ElementSpec[] data) throws BadLocationException
        super.insert(offset, data);
    }Then to add tables you can use these methods like:
          SimpleAttributeSet section = new SimpleAttributeSet();
          section.addAttribute(AbstractDocument.ElementNameAttribute, "section");
          SimpleAttributeSet table = new SimpleAttributeSet();
          table.addAttribute(AbstractDocument.ElementNameAttribute, "table");
          SimpleAttributeSet row = new SimpleAttributeSet();
          row.addAttribute(AbstractDocument.ElementNameAttribute, "row");
          SimpleAttributeSet cell = new SimpleAttributeSet();
          cell.addAttribute(AbstractDocument.ElementNameAttribute, "cell");
          SimpleAttributeSet redStyle = new SimpleAttributeSet();
          redStyle.addAttribute(StyleConstants.Foreground, Color.RED);
          SimpleAttributeSet greenStyle = new SimpleAttributeSet();
          greenStyle.addAttribute(StyleConstants.Foreground, Color.GREEN);
          DefaultStyledDocument.ElementSpec esSectionStart = new DefaultStyledDocument.ElementSpec(section, DefaultStyledDocument.ElementSpec.StartTagType);
          DefaultStyledDocument.ElementSpec esSectionEnd   = new DefaultStyledDocument.ElementSpec(section, DefaultStyledDocument.ElementSpec.EndTagType);
          DefaultStyledDocument.ElementSpec esTableStart = new DefaultStyledDocument.ElementSpec(table, DefaultStyledDocument.ElementSpec.StartTagType);
          DefaultStyledDocument.ElementSpec esRowStart   = new DefaultStyledDocument.ElementSpec(row,   DefaultStyledDocument.ElementSpec.StartTagType);
          DefaultStyledDocument.ElementSpec esCellStart  = new DefaultStyledDocument.ElementSpec(cell,  DefaultStyledDocument.ElementSpec.StartTagType);
          DefaultStyledDocument.ElementSpec esTableEnd   = new DefaultStyledDocument.ElementSpec(table, DefaultStyledDocument.ElementSpec.EndTagType);
          DefaultStyledDocument.ElementSpec esRowEnd     = new DefaultStyledDocument.ElementSpec(row,   DefaultStyledDocument.ElementSpec.EndTagType);
          DefaultStyledDocument.ElementSpec esCellEnd    = new DefaultStyledDocument.ElementSpec(cell,  DefaultStyledDocument.ElementSpec.EndTagType);
          DefaultStyledDocument.ElementSpec esCell1 = new DefaultStyledDocument.ElementSpec(redStyle,   DefaultStyledDocument.ElementSpec.ContentType, "AFAIK".toCharArray(), 0, 5);
          DefaultStyledDocument.ElementSpec esCell2 = new DefaultStyledDocument.ElementSpec(greenStyle, DefaultStyledDocument.ElementSpec.ContentType, "As far as I know".toCharArray(), 0, 16);
          DefaultStyledDocument.ElementSpec esCell3 = new DefaultStyledDocument.ElementSpec(redStyle,   DefaultStyledDocument.ElementSpec.ContentType, "Not to put too fine a point on it".toCharArray(), 0, 33);
          DefaultStyledDocument.ElementSpec esCell4 = new DefaultStyledDocument.ElementSpec(greenStyle, DefaultStyledDocument.ElementSpec.ContentType, "NTPTFPOI".toCharArray(), 0, 8);
          DefaultStyledDocument.ElementSpec ico = new DefaultStyledDocument.ElementSpec(icon, DefaultStyledDocument.ElementSpec.ContentType, " ".toCharArray(), 0, 1);
          DefaultStyledDocument.ElementSpec[] esArray = {
          esSectionStart,
            esTableStart,
              esRowStart,
                esCellStart,
                  esCell1,
                esCellEnd,
                esCellStart,
                  esCell2,
                esCellEnd,
              esRowEnd,
              esRowStart,
                esCellStart,
                  esCell3,
                esCellEnd,
                esCellStart,
                  esCell4,
                esCellEnd,
              esRowEnd,
            esTableEnd,
          esSectionEnd };
          com.inqwell.any.client.swing.StyledDocument doc = (com.inqwell.any.client.swing.StyledDocument)textPane.getDocument();
          try
            doc.insert(0, esArray);
          catch(Exception e) {e.printStackTrace();}Hope that helps!

  • TableView Iterator in WebDynpro as in BSP

    Hi all,
    i'm planning to move from BSP to WebDynpro ABAP and have a question:
    Does WD ABAP provide the same kind of <htmlb:tableView> as BSP? Especially, does it support the concept of an tableview iterator?
    Thx & Regards,
    Daniel

    Yes you'll find everything.
    You'll find also the ALV extension of a table.
    I was familiar with iterator and I like it so much; in WDA you can reach the same result but in a different way.
    Basically you have to prepare, in advance, all the data in the table rows and then in the table configuration you'll describe the rules for each column (even with variants per row).
    You have to study the Table UI object with table cell variant and then ALV features.
    Sergio

  • Attributes in tableview iterator

    how to retrive my inputField value in tableview iterator ?
    I have a page with inputField : eno
                    & tableview (and onclicking the cellvalue in the column it goes to other page)
    <i>
    <b> here i want to get the value of my inpufield </b>
    concatenate 'preview.htm?ref_no=' wf_text into wf_url.
          call method cl_htmlb_link=>factory
            exporting
              id        = p_cell_id
              reference = wf_url
              target    = '_self'
              text      = wf_text
            receiving
              element   = p_replacement_bee.
    </i>
    Pts Assured.
    Thanks,
    JBP.
    I have added the field also in the row iterator and now able to get its value.
    Message was edited by: P24101990

    Hi Mark,
    Thanks for your reply. I tried that in DO_INIT and in DO_REQUEST as well. I started of this application well with the values selecting from Dropdown and then rendering the table columns. But now I have commented everything and just trying to render one column of the table....
    I have one concern.
    I have declared like this
    tv_iterator type ref to ZITERATOR.
    and in DO_INIT I have instantiated. Create Object tv_iterator.
    If you have any suggestions please let me know....
    Thanks

Maybe you are looking for

  • When i try to log on to the internet I get a message "we noticed you may have signed in or signed out in another window, click ok to reload your page

    When I log on the internet my home page is frontier.my.yahoo.com/?bc1 The screen dims and I get the message We noticed you may have signed in or signed out in another window, click ok to reload your page How can I get rid of this message?

  • Apple Store hours away

    so Apple Care and Genius Bar are not really practical care policies for my new iMac 17. CompUSA is available. I talked to them and then w "permission" cuz I got an Ed Discount I purchased from Apple. Anyone had experience w them and their care policy

  • GrantPermission nameError

    Hi all, The following wlst command to add a system policy for CSF access is failing with a nameError. Am I missing a patch or something? Any help will be very much appreciated. [~]$ java -classpath /scratch/soa/Oracle/Middleware/wlserver_10.3/server/

  • Transactional Session JMS Adapter

    Hi, i'm using a JMS sender and receiver adapter. Everything works but i can't understand if it'could be better to use a Transactional Session in Jms setting. I've found a lot of documentation about jms adapter configuration, but not so much informati

  • Iphone 3g with Exchange Activesync lackluster battery life

    Hey fellow IPhone people! I just bought my first Iphone and just returned my first Blackberry Storm in favor of the IPhone's superior UI. I use Exchange Activesync to synchronize my company email/contacts/calendar with my IPhone. It seems to work wel