CLASS zcl_abapgit_html_toolbar DEFINITION PUBLIC CREATE PUBLIC . PUBLIC SECTION. METHODS constructor IMPORTING !iv_id TYPE string OPTIONAL . METHODS add IMPORTING !iv_txt TYPE string !io_sub TYPE REF TO zcl_abapgit_html_toolbar OPTIONAL !iv_typ TYPE c DEFAULT zif_abapgit_html=>c_action_type-sapevent !iv_act TYPE string OPTIONAL !iv_ico TYPE string OPTIONAL !iv_cur TYPE abap_bool OPTIONAL !iv_opt TYPE c OPTIONAL !iv_chk TYPE abap_bool DEFAULT abap_undefined !iv_aux TYPE string OPTIONAL !iv_id TYPE string OPTIONAL !iv_title TYPE string OPTIONAL RETURNING VALUE(ro_self) TYPE REF TO zcl_abapgit_html_toolbar . METHODS count RETURNING VALUE(rv_count) TYPE i . METHODS render IMPORTING !iv_right TYPE abap_bool OPTIONAL !iv_sort TYPE abap_bool OPTIONAL RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . METHODS render_as_droplist IMPORTING !iv_label TYPE string !iv_right TYPE abap_bool OPTIONAL !iv_sort TYPE abap_bool OPTIONAL !iv_corner TYPE abap_bool OPTIONAL !iv_action TYPE string OPTIONAL RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . PROTECTED SECTION. PRIVATE SECTION. TYPES: BEGIN OF ty_item, txt TYPE string, act TYPE string, ico TYPE string, sub TYPE REF TO zcl_abapgit_html_toolbar, opt TYPE c LENGTH 1, typ TYPE c LENGTH 1, cur TYPE abap_bool, chk TYPE abap_bool, aux TYPE string, id TYPE string, title TYPE string, END OF ty_item . TYPES: ty_items TYPE STANDARD TABLE OF ty_item . DATA mt_items TYPE ty_items . DATA mv_id TYPE string . METHODS render_items IMPORTING !iv_sort TYPE abap_bool OPTIONAL RETURNING VALUE(ri_html) TYPE REF TO zif_abapgit_html . ENDCLASS. CLASS ZCL_ABAPGIT_HTML_TOOLBAR IMPLEMENTATION. METHOD add. DATA ls_item TYPE ty_item. ASSERT iv_typ = zif_abapgit_html=>c_action_type-separator " sep doesn't have action OR iv_typ = zif_abapgit_html=>c_action_type-onclick " click may have no action (assigned in JS) OR iv_typ = zif_abapgit_html=>c_action_type-dummy " dummy may have no action OR iv_act IS INITIAL AND io_sub IS NOT INITIAL OR iv_act IS NOT INITIAL AND io_sub IS INITIAL. " Only one supplied ASSERT NOT ( iv_chk <> abap_undefined AND io_sub IS NOT INITIAL ). ls_item-txt = iv_txt. ls_item-act = iv_act. ls_item-ico = iv_ico. ls_item-sub = io_sub. ls_item-opt = iv_opt. ls_item-typ = iv_typ. ls_item-cur = iv_cur. ls_item-chk = iv_chk. ls_item-aux = iv_aux. ls_item-id = iv_id. ls_item-title = iv_title. APPEND ls_item TO mt_items. ro_self = me. ENDMETHOD. METHOD constructor. mv_id = iv_id. ENDMETHOD. METHOD count. rv_count = lines( mt_items ). ENDMETHOD. METHOD render. DATA: lv_class TYPE string. CREATE OBJECT ri_html TYPE zcl_abapgit_html. lv_class = 'nav-container'. IF iv_right = abap_true. lv_class = lv_class && ' float-right'. ENDIF. ri_html->add( |