diff --git a/CLAUDE.md b/CLAUDE.md index 6a3e4b0c..61bad4f7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -345,6 +345,8 @@ Write everything directly in `main` — no method encapsulation needed. Count on When the logic no longer fits inside `main`, always extract exactly `on_init` and `on_event` as the first step — never use other method names for this purpose. `main` then becomes a pure dispatcher that calls these two methods. Only add further methods (`view_display`, `data_read`, etc.) when they are actually needed. +**Never create a pass-through method with only one statement.** If an extracted method (e.g. `on_init`) would contain only a single call, replace the method call in the dispatcher with that single call directly — and omit the pass-through method entirely. For example, if `on_init` would only call `view_display( )`, write `view_display( )` directly in the `IF client->check_on_init( ).` branch instead. + The following is the **maximum structure**. Only add methods that are actually needed. ### Event handler sub-methods diff --git a/src/z2ui5_cl_demo_app_002.clas.abap b/src/z2ui5_cl_demo_app_002.clas.abap index 81fbf586..ba2b8fca 100644 --- a/src/z2ui5_cl_demo_app_002.clas.abap +++ b/src/z2ui5_cl_demo_app_002.clas.abap @@ -4,15 +4,15 @@ CLASS z2ui5_cl_demo_app_002 DEFINITION PUBLIC. INTERFACES z2ui5_if_app. TYPES: - BEGIN OF suggestion_item, + BEGIN OF ty_s_suggestion_item, value TYPE string, descr TYPE string, - END OF suggestion_item. + END OF ty_s_suggestion_item. TYPES: - BEGIN OF combobox_item, + BEGIN OF ty_s_combobox_item, key TYPE string, text TYPE string, - END OF combobox_item. + END OF ty_s_combobox_item. DATA: BEGIN OF s_screen, @@ -29,8 +29,8 @@ CLASS z2ui5_cl_demo_app_002 DEFINITION PUBLIC. check_switch_02 TYPE abap_bool VALUE abap_false, END OF s_screen. - DATA t_suggestions TYPE STANDARD TABLE OF suggestion_item WITH EMPTY KEY. - DATA t_combo TYPE STANDARD TABLE OF combobox_item WITH EMPTY KEY. + DATA t_suggestions TYPE STANDARD TABLE OF ty_s_suggestion_item WITH EMPTY KEY. + DATA t_combo TYPE STANDARD TABLE OF ty_s_combobox_item WITH EMPTY KEY. PROTECTED SECTION. DATA client TYPE REF TO z2ui5_if_client. diff --git a/src/z2ui5_cl_demo_app_004.clas.abap b/src/z2ui5_cl_demo_app_004.clas.abap index b742a96a..36425fca 100644 --- a/src/z2ui5_cl_demo_app_004.clas.abap +++ b/src/z2ui5_cl_demo_app_004.clas.abap @@ -3,10 +3,9 @@ CLASS z2ui5_cl_demo_app_004 DEFINITION PUBLIC. PUBLIC SECTION. INTERFACES z2ui5_if_app. - DATA view_main TYPE string. - PROTECTED SECTION. - DATA client TYPE REF TO z2ui5_if_client. + DATA client TYPE REF TO z2ui5_if_client. + DATA view_main TYPE string. METHODS on_init. METHODS on_event. diff --git a/src/z2ui5_cl_demo_app_006.clas.abap b/src/z2ui5_cl_demo_app_006.clas.abap index 7e401469..07067432 100644 --- a/src/z2ui5_cl_demo_app_006.clas.abap +++ b/src/z2ui5_cl_demo_app_006.clas.abap @@ -16,12 +16,11 @@ CLASS z2ui5_cl_demo_app_006 DEFINITION PUBLIC. END OF ty_s_row. DATA t_tab TYPE STANDARD TABLE OF ty_s_row WITH EMPTY KEY. + PROTECTED SECTION. + DATA client TYPE REF TO z2ui5_if_client. DATA check_ui5 TYPE abap_bool. DATA key TYPE string. - PROTECTED SECTION. - DATA client TYPE REF TO z2ui5_if_client. - METHODS on_init. METHODS on_event. METHODS view_display. diff --git a/src/z2ui5_cl_demo_app_008.clas.abap b/src/z2ui5_cl_demo_app_008.clas.abap index 118a0f70..80e636b9 100644 --- a/src/z2ui5_cl_demo_app_008.clas.abap +++ b/src/z2ui5_cl_demo_app_008.clas.abap @@ -1,133 +1,152 @@ CLASS z2ui5_cl_demo_app_008 DEFINITION PUBLIC. PUBLIC SECTION. - INTERFACES z2ui5_if_app. + PROTECTED SECTION. + DATA client TYPE REF TO z2ui5_if_client. DATA check_strip_active TYPE abap_bool. - DATA strip_type TYPE string. + DATA strip_type TYPE string. + + METHODS on_event. + METHODS view_display. - PROTECTED SECTION. PRIVATE SECTION. ENDCLASS. - CLASS z2ui5_cl_demo_app_008 IMPLEMENTATION. - METHOD z2ui5_if_app~main. - CASE client->get( )-event. - - WHEN 'BUTTON_MESSAGE_BOX_CONFIRM'. - client->message_box_display( text = 'Approve purchase order 12345?' - type = 'confirm' ). - - WHEN 'BUTTON_MESSAGE_BOX_ALERT'. - client->message_box_display( text = 'The quantity you have reported exceeds the quantity planned.' - type = 'alert' ). - - WHEN 'BUTTON_MESSAGE_BOX_ERROR'. - client->message_box_display( text = 'Select a team in the "Development" area.' && cl_abap_char_utilities=>cr_lf && - '"Marketing" isn’t assigned to this area.' type = 'error' ). - - WHEN 'BUTTON_MESSAGE_BOX_INFO'. - client->message_box_display( 'Your booking will be reserved for 24 hours.' ). - - WHEN 'BUTTON_MESSAGE_BOX_WARNING'. - client->message_box_display( text = 'The project schedule was last updated over a year ago.' - type = 'warning' ). + me->client = client. + IF client->check_on_init( ). + view_display( ). + ELSEIF client->check_on_event( ). + on_event( ). + ENDIF. - WHEN 'BUTTON_MESSAGE_BOX_SUCCESS'. - client->message_box_display( text = 'Project 1234567 was created and assigned to team "ABC".' - type = 'success' ). + ENDMETHOD. - WHEN 'BUTTON_MESSAGE_TOAST'. - client->message_toast_display( 'this is a message toast' ). - WHEN 'BUTTON_MESSAGE_TOAST2'. - client->message_toast_display( text = 'this is a message toast' - at = 'left bottom' - offset = '0 -15' - animationtimingfunction = `ease-in` - class = 'my-style' ). + METHOD on_event. - WHEN 'BUTTON_MESSAGE_STRIP_INFO'. + CASE client->get( )-event. + WHEN `BUTTON_MESSAGE_BOX_CONFIRM`. + client->message_box_display( + text = `Approve purchase order 12345?` + type = `confirm` ). + WHEN `BUTTON_MESSAGE_BOX_ALERT`. + client->message_box_display( + text = `The quantity you have reported exceeds the quantity planned.` + type = `alert` ). + WHEN `BUTTON_MESSAGE_BOX_ERROR`. + client->message_box_display( + text = |Select a team in the "Development" area.{ cl_abap_char_utilities=>newline }"Marketing" isn't assigned to this area.| + type = `error` ). + WHEN `BUTTON_MESSAGE_BOX_INFO`. + client->message_box_display( `Your booking will be reserved for 24 hours.` ). + WHEN `BUTTON_MESSAGE_BOX_WARNING`. + client->message_box_display( + text = `The project schedule was last updated over a year ago.` + type = `warning` ). + WHEN `BUTTON_MESSAGE_BOX_SUCCESS`. + client->message_box_display( + text = `Project 1234567 was created and assigned to team "ABC".` + type = `success` ). + WHEN `BUTTON_MESSAGE_TOAST`. + client->message_toast_display( `this is a message toast` ). + WHEN `BUTTON_MESSAGE_TOAST2`. + client->message_toast_display( + text = `this is a message toast` + at = `left bottom` + offset = `0 -15` + animationtimingfunction = `ease-in` + class = `my-style` ). + WHEN `BUTTON_MESSAGE_STRIP_INFO`. check_strip_active = abap_true. - strip_type = 'Information'. - - WHEN 'BUTTON_MESSAGE_STRIP_ERROR'. + strip_type = `Information`. + WHEN `BUTTON_MESSAGE_STRIP_ERROR`. check_strip_active = abap_true. - strip_type = 'Error'. - - WHEN 'BUTTON_MESSAGE_STRIP_SUCCESS'. + strip_type = `Error`. + WHEN `BUTTON_MESSAGE_STRIP_SUCCESS`. check_strip_active = abap_true. - strip_type = 'Success'. + strip_type = `Success`. ENDCASE. - DATA(view) = z2ui5_cl_xml_view=>factory( ). + view_display( ). + + ENDMETHOD. + + METHOD view_display. + + DATA(view) = z2ui5_cl_xml_view=>factory( ). DATA(page) = view->shell( )->page( - title = 'abap2UI5 - Messages' - navbuttonpress = client->_event_nav_app_leave( ) - shownavbutton = abap_true + title = `abap2UI5 - Messages` + navbuttonpress = client->_event_nav_app_leave( ) + shownavbutton = client->check_app_prev_stack( ) )->header_content( )->link( )->get_parent( ). IF check_strip_active = abap_true. - page->message_strip( text = 'This is a Message Strip' - type = strip_type ). + page->message_strip( + text = `This is a Message Strip` + type = strip_type ). ENDIF. - page->grid( 'L6 M12 S12' - )->content( 'layout' - )->simple_form( 'Message Box' )->content( 'form' + page->grid( `L6 M12 S12` + )->content( `layout` + )->simple_form( `Message Box` + )->content( `form` )->button( - text = 'Confirm' - press = client->_event( 'BUTTON_MESSAGE_BOX_CONFIRM' ) + text = `Confirm` + press = client->_event( `BUTTON_MESSAGE_BOX_CONFIRM` ) )->button( - text = 'Alert' - press = client->_event( 'BUTTON_MESSAGE_BOX_ALERT' ) + text = `Alert` + press = client->_event( `BUTTON_MESSAGE_BOX_ALERT` ) )->button( - text = 'Error' - press = client->_event( 'BUTTON_MESSAGE_BOX_ERROR' ) + text = `Error` + press = client->_event( `BUTTON_MESSAGE_BOX_ERROR` ) )->button( - text = 'Info' - press = client->_event( 'BUTTON_MESSAGE_BOX_INFO' ) + text = `Info` + press = client->_event( `BUTTON_MESSAGE_BOX_INFO` ) )->button( - text = 'Warning' - press = client->_event( 'BUTTON_MESSAGE_BOX_WARNING' ) + text = `Warning` + press = client->_event( `BUTTON_MESSAGE_BOX_WARNING` ) )->button( - text = 'Success' - press = client->_event( 'BUTTON_MESSAGE_BOX_SUCCESS' ) ). + text = `Success` + press = client->_event( `BUTTON_MESSAGE_BOX_SUCCESS` ) ). - page->grid( 'L6 M12 S12' - )->content( 'layout' - )->simple_form( 'Message Strip' )->content( 'form' + page->grid( `L6 M12 S12` + )->content( `layout` + )->simple_form( `Message Strip` + )->content( `form` )->button( - text = 'success' - press = client->_event( 'BUTTON_MESSAGE_STRIP_SUCCESS' ) + text = `success` + press = client->_event( `BUTTON_MESSAGE_STRIP_SUCCESS` ) )->button( - text = 'error' - press = client->_event( 'BUTTON_MESSAGE_STRIP_ERROR' ) + text = `error` + press = client->_event( `BUTTON_MESSAGE_STRIP_ERROR` ) )->button( - text = 'information' - press = client->_event( 'BUTTON_MESSAGE_STRIP_INFO' ) ). + text = `information` + press = client->_event( `BUTTON_MESSAGE_STRIP_INFO` ) ). - page->grid( 'L6 M12 S12' - )->content( 'layout' - )->simple_form( 'Display' )->content( 'form' + page->grid( `L6 M12 S12` + )->content( `layout` + )->simple_form( `Display` + )->content( `form` )->button( - text = 'Message Toast' - press = client->_event( 'BUTTON_MESSAGE_TOAST' ) - )->button( - text = 'Message Toast Customized' - press = client->_event( 'BUTTON_MESSAGE_TOAST2' ) ). - + text = `Message Toast` + press = client->_event( `BUTTON_MESSAGE_TOAST` ) + )->button( + text = `Message Toast Customized` + press = client->_event( `BUTTON_MESSAGE_TOAST2` ) ). client->view_display( view->stringify( ) ). + ENDMETHOD. + ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_009.clas.abap b/src/z2ui5_cl_demo_app_009.clas.abap index 675e8932..e97f6a2f 100644 --- a/src/z2ui5_cl_demo_app_009.clas.abap +++ b/src/z2ui5_cl_demo_app_009.clas.abap @@ -1,375 +1,309 @@ CLASS z2ui5_cl_demo_app_009 DEFINITION PUBLIC. PUBLIC SECTION. - INTERFACES z2ui5_if_app. - DATA: - BEGIN OF screen, - color_01 TYPE string, - color_02 TYPE string, - color_03 TYPE string, - city TYPE string, - name TYPE string, - lastname TYPE string, - quantity TYPE string, - unit TYPE string, - END OF screen. - TYPES: - BEGIN OF s_suggestion_items, + BEGIN OF ty_s_suggestion, selkz TYPE abap_bool, value TYPE string, descr TYPE string, - END OF s_suggestion_items. - DATA mt_suggestion TYPE STANDARD TABLE OF s_suggestion_items WITH EMPTY KEY. - DATA mt_suggestion_sel TYPE STANDARD TABLE OF s_suggestion_items WITH EMPTY KEY. + END OF ty_s_suggestion. + TYPES ty_t_suggestion TYPE STANDARD TABLE OF ty_s_suggestion WITH EMPTY KEY. TYPES: - BEGIN OF s_suggestion_items_city, + BEGIN OF ty_s_city, value TYPE string, descr TYPE string, - END OF s_suggestion_items_city. - DATA mt_suggestion_city TYPE STANDARD TABLE OF s_suggestion_items_city WITH EMPTY KEY. + END OF ty_s_city. TYPES: - BEGIN OF s_employee, + BEGIN OF ty_s_employee, selkz TYPE abap_bool, city TYPE string, nr TYPE string, name TYPE string, lastname TYPE string, - END OF s_employee. - DATA mt_employees_sel TYPE STANDARD TABLE OF s_employee WITH EMPTY KEY. - DATA mt_employees TYPE STANDARD TABLE OF s_employee WITH EMPTY KEY. + END OF ty_s_employee. + TYPES ty_t_employee TYPE STANDARD TABLE OF ty_s_employee WITH EMPTY KEY. + DATA: + BEGIN OF s_screen, + color_01 TYPE string, + color_02 TYPE string, + color_03 TYPE string, + city TYPE string, + name TYPE string, + lastname TYPE string, + quantity TYPE string, + unit TYPE string, + END OF s_screen. + DATA t_suggestion TYPE ty_t_suggestion. + DATA t_suggestion_sel TYPE ty_t_suggestion. + DATA t_cities TYPE STANDARD TABLE OF ty_s_city WITH EMPTY KEY. + DATA t_employees_sel TYPE ty_t_employee. - DATA mv_view_popup TYPE string. - METHODS popup_f4_table - IMPORTING - client TYPE REF TO z2ui5_if_client. - METHODS popup_f4_table_custom - IMPORTING - client TYPE REF TO z2ui5_if_client. PROTECTED SECTION. + DATA client TYPE REF TO z2ui5_if_client. + DATA t_employees TYPE ty_t_employee. - METHODS z2ui5_on_rendering - IMPORTING - client TYPE REF TO z2ui5_if_client. - - METHODS z2ui5_on_event - IMPORTING - client TYPE REF TO z2ui5_if_client. - METHODS z2ui5_on_init. - + METHODS on_init. + METHODS on_event. + METHODS view_display. + METHODS popup_value_suggestion. + METHODS popup_value_employee. PRIVATE SECTION. ENDCLASS. - -CLASS Z2UI5_CL_DEMO_APP_009 IMPLEMENTATION. - - - METHOD popup_f4_table. - - DATA(popup) = z2ui5_cl_xml_view=>factory_popup( ). - - popup->dialog( 'abap2UI5 - F4 Value Help' - )->table( - mode = 'SingleSelectLeft' - items = client->_bind_edit( mt_suggestion_sel ) - )->columns( - )->column( '20rem' - )->text( 'Color' )->get_parent( - )->column( - )->text( 'Description' - )->get_parent( )->get_parent( - )->items( - )->column_list_item( selected = '{SELKZ}' - )->cells( - )->text( '{VALUE}' - )->text( '{DESCR}' - )->get_parent( )->get_parent( )->get_parent( )->get_parent( - )->buttons( - )->button( - text = 'continue' - press = client->_event( 'POPUP_TABLE_F4_CONTINUE' ) - type = 'Emphasized' ). - client->popup_display( popup->stringify( ) ). - - ENDMETHOD. - - - METHOD popup_f4_table_custom. - - DATA(popup2) = z2ui5_cl_xml_view=>factory_popup( ). - - popup2 = popup2->dialog( 'abap2UI5 - F4 Value Help' ). - - popup2->simple_form( - )->label( 'Location' - )->input( - value = client->_bind_edit( screen-city ) - suggestionitems = client->_bind( mt_suggestion_city ) - showsuggestion = abap_true )->get( - )->suggestion_items( )->get( - )->list_item( - text = '{VALUE}' - additionaltext = '{DESCR}' - )->get_parent( )->get_parent( - )->button( - text = 'search...' - press = client->_event( 'SEARCH' ) ). - - DATA(tab) = popup2->table( - headertext = 'Employees' - mode = 'SingleSelectLeft' - items = client->_bind_edit( mt_employees_sel ) ). - - tab->columns( - )->column( '10rem' - )->text( 'City' )->get_parent( - )->column( '10rem' - )->text( 'Nr' )->get_parent( - )->column( '15rem' - )->text( 'Name' )->get_parent( - )->column( '30rem' - )->text( 'Lastname' )->get_parent( ). - - tab->items( )->column_list_item( selected = '{SELKZ}' - )->cells( - )->text( '{CITY}' - )->text( '{NR}' - )->text( '{NAME}' - )->text( '{LASTNAME}' ). - - popup2->buttons( - )->button( - text = 'continue' - press = client->_event( 'POPUP_TABLE_F4_CUSTOM_CONTINUE' ) - type = 'Emphasized' ). - client->popup_display( popup2->stringify( ) ). - - ENDMETHOD. - +CLASS z2ui5_cl_demo_app_009 IMPLEMENTATION. METHOD z2ui5_if_app~main. - CLEAR mv_view_popup. - + me->client = client. IF client->check_on_init( ). - z2ui5_on_init( ). + on_init( ). + ELSEIF client->check_on_event( ). + on_event( ). ENDIF. - z2ui5_on_event( client ). - - z2ui5_on_rendering( client ). ENDMETHOD. - METHOD z2ui5_on_event. + METHOD on_init. + + t_suggestion = VALUE #( + ( descr = `this is the color Green` value = `GREEN` ) + ( descr = `this is the color Blue` value = `BLUE` ) + ( descr = `this is the color Black` value = `BLACK` ) + ( descr = `this is the color Grey` value = `GREY` ) + ( descr = `this is the color Blue2` value = `BLUE2` ) + ( descr = `this is the color Blue3` value = `BLUE3` ) ). + + t_cities = VALUE #( + ( value = `London` descr = `London` ) + ( value = `Paris` descr = `Paris` ) + ( value = `Rome` descr = `Rome` ) ). + + t_employees = VALUE #( + ( city = `London` name = `Tom` lastname = `lastname1` nr = `00001` ) + ( city = `London` name = `Tom2` lastname = `lastname2` nr = `00002` ) + ( city = `London` name = `Tom3` lastname = `lastname3` nr = `00003` ) + ( city = `London` name = `Tom4` lastname = `lastname4` nr = `00004` ) + ( city = `Rome` name = `Michaela1` lastname = `lastname5` nr = `00005` ) + ( city = `Rome` name = `Michaela2` lastname = `lastname6` nr = `00006` ) + ( city = `Rome` name = `Michaela3` lastname = `lastname7` nr = `00007` ) + ( city = `Rome` name = `Michaela4` lastname = `lastname8` nr = `00008` ) + ( city = `Paris` name = `Hermine1` lastname = `lastname9` nr = `00009` ) + ( city = `Paris` name = `Hermine2` lastname = `lastname10` nr = `00010` ) + ( city = `Paris` name = `Hermine3` lastname = `lastname11` nr = `00011` ) ). + + view_display( ). - CASE client->get( )-event. + ENDMETHOD. - WHEN 'POPUP_TABLE_F4'. - mt_suggestion_sel = mt_suggestion. - popup_f4_table( client ). - WHEN 'POPUP_TABLE_F4_CUSTOM'. - mt_employees_sel = VALUE #( ). - mt_employees_sel = VALUE #( ). - popup_f4_table_custom( client ). + METHOD on_event. - WHEN 'SEARCH'. - mt_employees_sel = mt_employees. - IF screen-city IS NOT INITIAL. - DELETE mt_employees_sel WHERE city <> screen-city. - ENDIF. - popup_f4_table_custom( client ). - - WHEN 'POPUP_TABLE_F4_CUSTOM_CONTINUE'. - DELETE mt_employees_sel WHERE selkz = abap_false. - IF lines( mt_employees_sel ) = 1. - screen-name = mt_employees_sel[ 1 ]-name. - screen-lastname = mt_employees_sel[ 1 ]-lastname. - client->message_toast_display( 'f4 value selected' ). - client->popup_destroy( ). + CASE client->get( )-event. + WHEN `POPUP_TABLE_value`. + t_suggestion_sel = t_suggestion. + popup_value_suggestion( ). + WHEN `POPUP_TABLE_value_CUSTOM`. + t_employees_sel = VALUE #( ). + popup_value_employee( ). + WHEN `SEARCH`. + t_employees_sel = t_employees. + + IF s_screen-city IS NOT INITIAL. + DELETE t_employees_sel WHERE city <> s_screen-city. ENDIF. + popup_value_employee( ). + WHEN `POPUP_TABLE_value_CUSTOM_CONTINUE`. + DELETE t_employees_sel WHERE selkz = abap_false. - WHEN 'POPUP_TABLE_F4_CONTINUE'. - DELETE mt_suggestion_sel WHERE selkz = abap_false. - IF lines( mt_suggestion_sel ) = 1. - screen-color_02 = mt_suggestion_sel[ 1 ]-value. - client->message_toast_display( 'f4 value selected' ). + IF lines( t_employees_sel ) = 1. + + s_screen-name = t_employees_sel[ 1 ]-name. + s_screen-lastname = t_employees_sel[ 1 ]-lastname. + client->message_toast_display( `value value selected` ). client->popup_destroy( ). + ENDIF. + WHEN `POPUP_TABLE_value_CONTINUE`. + DELETE t_suggestion_sel WHERE selkz = abap_false. - WHEN 'BUTTON_SEND'. - client->message_box_display( 'success - values send to the server' ). - WHEN 'BUTTON_CLEAR'. - CLEAR screen. - client->message_box_display( 'View initialized' ). - ENDCASE. + IF lines( t_suggestion_sel ) = 1. - ENDMETHOD. + s_screen-color_02 = t_suggestion_sel[ 1 ]-value. + client->message_toast_display( `value value selected` ). + client->popup_destroy( ). + ENDIF. + WHEN `BUTTON_SEND`. + client->message_box_display( `success - values send to the server` ). + WHEN `BUTTON_CLEAR`. + s_screen = VALUE #( ). + client->message_box_display( `View initialized` ). + ENDCASE. - METHOD z2ui5_on_init. - - mt_suggestion = VALUE #( - ( descr = 'this is the color Green' value = 'GREEN' ) - ( descr = 'this is the color Blue' value = 'BLUE' ) - ( descr = 'this is the color Black' value = 'BLACK' ) - ( descr = 'this is the color Grey' value = 'GREY' ) - ( descr = 'this is the color Blue2' value = 'BLUE2' ) - ( descr = 'this is the color Blue3' value = 'BLUE3' ) ). - - mt_suggestion_city = VALUE #( - ( value = 'London' descr = 'London' ) - ( value = 'Paris' descr = 'Paris' ) - ( value = 'Rome' descr = 'Rome' ) ). - - mt_employees = VALUE #( - ( city = 'London' name = 'Tom' lastname = 'lastname1' nr = '00001' ) - ( city = 'London' name = 'Tom2' lastname = 'lastname2' nr = '00002' ) - ( city = 'London' name = 'Tom3' lastname = 'lastname3' nr = '00003' ) - ( city = 'London' name = 'Tom4' lastname = 'lastname4' nr = '00004' ) - ( city = 'Rome' name = 'Michaela1' lastname = 'lastname5' nr = '00005' ) - ( city = 'Rome' name = 'Michaela2' lastname = 'lastname6' nr = '00006' ) - ( city = 'Rome' name = 'Michaela3' lastname = 'lastname7' nr = '00007' ) - ( city = 'Rome' name = 'Michaela4' lastname = 'lastname8' nr = '00008' ) - ( city = 'Paris' name = 'Hermine1' lastname = 'lastname9' nr = '00009' ) - ( city = 'Paris' name = 'Hermine2' lastname = 'lastname10' nr = '00010' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) - ( city = 'Paris' name = 'Hermine3' lastname = 'lastname11' nr = '00011' ) ). + view_display( ). ENDMETHOD. - METHOD z2ui5_on_rendering. + METHOD view_display. DATA(view) = z2ui5_cl_xml_view=>factory( ). DATA(page) = view->shell( )->page( - title = 'abap2UI5 - Value Help Examples' + title = `abap2UI5 - Value Help Examples` navbuttonpress = client->_event_nav_app_leave( ) shownavbutton = client->check_app_prev_stack( ) ). - DATA(form) = page->grid( 'L7 M7 S7' - )->content( 'layout' - )->simple_form( 'Input with Value Help' - )->content( 'form' ). + DATA(form) = page->grid( `L7 M7 S7` + )->content( `layout` + )->simple_form( `Input with Value Help` + )->content( `form` ). - form->label( 'Input with sugestion items' + form->label( `Input with suggestion items` )->input( - value = client->_bind_edit( screen-color_01 ) - placeholder = 'fill in your favorite colour' - suggestionitems = client->_bind( mt_suggestion ) + value = client->_bind_edit( s_screen-color_01 ) + placeholder = `fill in your favorite colour` + suggestionitems = client->_bind( t_suggestion ) showsuggestion = abap_true )->get( - )->suggestion_items( )->get( - )->list_item( - text = '{VALUE}' - additionaltext = '{DESCR}' ). + )->suggestion_items( )->get( + )->list_item( + text = `{VALUE}` + additionaltext = `{DESCR}` ). - form->label( 'Input only numbers allowed' + form->label( `Input only numbers allowed` )->input( - value = client->_bind_edit( screen-quantity ) - type = 'Number' - placeholder = 'quantity' ). + value = client->_bind_edit( s_screen-quantity ) + type = `Number` + placeholder = `quantity` ). - form->label( 'Input with F4' + form->label( `Input with value` )->input( - value = client->_bind_edit( screen-color_02 ) - placeholder = 'fill in your favorite colour' + value = client->_bind_edit( s_screen-color_02 ) + placeholder = `fill in your favorite colour` showvaluehelp = abap_true - valuehelprequest = client->_event( 'POPUP_TABLE_F4' ) ). + valuehelprequest = client->_event( `POPUP_TABLE_value` ) ). - form->label( 'Custom F4 Popup' + form->label( `Custom value Popup` )->input( - value = client->_bind_edit( screen-name ) - placeholder = 'name' + value = client->_bind_edit( s_screen-name ) + placeholder = `name` showvaluehelp = abap_true - valuehelprequest = client->_event( 'POPUP_TABLE_F4_CUSTOM' ) + valuehelprequest = client->_event( `POPUP_TABLE_value_CUSTOM` ) )->input( - value = client->_bind_edit( screen-lastname ) - placeholder = 'lastname' + value = client->_bind_edit( s_screen-lastname ) + placeholder = `lastname` showvaluehelp = abap_true - valuehelprequest = client->_event( 'POPUP_TABLE_F4_CUSTOM' ) ). + valuehelprequest = client->_event( `POPUP_TABLE_value_CUSTOM` ) ). page->footer( )->overflow_toolbar( )->toolbar_spacer( )->button( - text = 'Clear' - press = client->_event( 'BUTTON_CLEAR' ) - type = 'Reject' + text = `Clear` + press = client->_event( `BUTTON_CLEAR` ) + type = `Reject` enabled = abap_false - icon = 'sap-icon://delete' + icon = `sap-icon://delete` )->button( - text = 'Send to Server' - press = client->_event( 'BUTTON_SEND' ) + text = `Send to Server` + press = client->_event( `BUTTON_SEND` ) enabled = abap_false - type = 'Success' ). + type = `Success` ). + + client->view_display( view->stringify( ) ). + + ENDMETHOD. + + METHOD popup_value_suggestion. + DATA(popup) = z2ui5_cl_xml_view=>factory_popup( ). + DATA(dialog) = popup->dialog( `abap2UI5 - value Value Help` ). + DATA(tab) = dialog->table( + mode = `SingleSelectLeft` + items = client->_bind_edit( t_suggestion_sel ) ). - CASE mv_view_popup. + tab->columns( + )->column( `20rem` + )->text( `Color` )->get_parent( + )->column( + )->text( `Description` )->get_parent( ). - WHEN 'POPUP_TABLE_F4'. + tab->items( )->column_list_item( selected = `{SELKZ}` + )->cells( + )->text( `{VALUE}` + )->text( `{DESCR}` ). - popup_f4_table( client ). + dialog->buttons( + )->button( + text = `continue` + press = client->_event( `POPUP_TABLE_value_CONTINUE` ) + type = `Emphasized` ). - WHEN 'POPUP_TABLE_F4_CUSTOM'. + client->popup_display( popup->stringify( ) ). - popup_f4_table_custom( client ). + ENDMETHOD. - ENDCASE. - client->view_display( page->stringify( ) ). + METHOD popup_value_employee. + + DATA(popup) = z2ui5_cl_xml_view=>factory_popup( ). + DATA(dialog) = popup->dialog( `abap2UI5 - value Value Help` ). + + dialog->simple_form( + )->label( `Location` + )->input( + value = client->_bind_edit( s_screen-city ) + suggestionitems = client->_bind( t_cities ) + showsuggestion = abap_true )->get( + )->suggestion_items( )->get( + )->list_item( + text = `{VALUE}` + additionaltext = `{DESCR}` + )->get_parent( )->get_parent( + )->button( + text = `search...` + press = client->_event( `SEARCH` ) ). + + DATA(tab) = dialog->table( + headertext = `Employees` + mode = `SingleSelectLeft` + items = client->_bind_edit( t_employees_sel ) ). + tab->columns( + )->column( `10rem` + )->text( `City` )->get_parent( + )->column( `10rem` + )->text( `Nr` )->get_parent( + )->column( `15rem` + )->text( `Name` )->get_parent( + )->column( `30rem` + )->text( `Lastname` )->get_parent( ). + + tab->items( )->column_list_item( selected = `{SELKZ}` + )->cells( + )->text( `{CITY}` + )->text( `{NR}` + )->text( `{NAME}` + )->text( `{LASTNAME}` ). + + dialog->buttons( + )->button( + text = `continue` + press = client->_event( `POPUP_TABLE_value_CUSTOM_CONTINUE` ) + type = `Emphasized` ). + + client->popup_display( popup->stringify( ) ). ENDMETHOD. + ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_010.clas.abap b/src/z2ui5_cl_demo_app_010.clas.abap index cd5e1aed..2d50712d 100644 --- a/src/z2ui5_cl_demo_app_010.clas.abap +++ b/src/z2ui5_cl_demo_app_010.clas.abap @@ -4,76 +4,93 @@ CLASS z2ui5_cl_demo_app_010 DEFINITION PUBLIC. INTERFACES z2ui5_if_app. PROTECTED SECTION. + DATA client TYPE REF TO z2ui5_if_client. + + METHODS view_display. + PRIVATE SECTION. ENDCLASS. +CLASS z2ui5_cl_demo_app_010 IMPLEMENTATION. -CLASS Z2UI5_CL_DEMO_APP_010 IMPLEMENTATION. + METHOD z2ui5_if_app~main. + me->client = client. + IF client->check_on_init( ). + view_display( ). + ENDIF. - METHOD z2ui5_if_app~main. - DATA(page) = z2ui5_cl_xml_view=>factory( )->shell( + ENDMETHOD. + + + METHOD view_display. + + DATA(view) = z2ui5_cl_xml_view=>factory( ). + DATA(page) = view->shell( )->page( - title = 'abap2UI5 - Demo Layout' + title = `abap2UI5 - Demo Layout` navbuttonpress = client->_event_nav_app_leave( ) shownavbutton = client->check_app_prev_stack( ) ). page->header_content( - )->button( text = 'button' ). + )->button( text = `button` ). page->sub_header( )->overflow_toolbar( - )->button( text = 'button' - )->text( 'text' - )->link( text = 'link' + )->button( text = `button` + )->text( `text` + )->link( text = `link` )->toolbar_spacer( - )->text( 'subheader' + )->text( `subheader` )->toolbar_spacer( - )->button( text = 'button' - )->text( 'text' - )->link( text = 'link' ). + )->button( text = `button` + )->text( `text` + )->link( text = `link` ). - DATA(grid) = page->grid( 'L4 M4 S4' )->content( 'layout' ). + DATA(grid) = page->grid( `L4 M4 S4` )->content( `layout` ). - grid->simple_form( 'Grid width 33%' )->content( 'form' - )->button( text = 'button' - )->text( 'text' - )->link( text = 'link' ). + grid->simple_form( `Grid width 33%` )->content( `form` + )->button( text = `button` + )->text( `text` + )->link( text = `link` ). - grid->simple_form( 'Grid width 33%' )->content( 'form' - )->button( text = 'button' - )->text( 'text' - )->link( text = 'link' ). + grid->simple_form( `Grid width 33%` )->content( `form` + )->button( text = `button` + )->text( `text` + )->link( text = `link` ). - grid->simple_form( 'Grid width 33%' )->content( 'form' - )->button( text = 'button' - )->text( 'text' - )->link( text = 'link' ). + grid->simple_form( `Grid width 33%` )->content( `form` + )->button( text = `button` + )->text( `text` + )->link( text = `link` ). - grid = page->grid( 'L12 M12 S12' )->content( 'layout' ). + grid = page->grid( `L12 M12 S12` )->content( `layout` ). - grid->simple_form( 'grid width 100%' )->content( 'form' - )->button( text = 'button' - )->text( 'text' - )->link( text = 'link' ). + grid->simple_form( `grid width 100%` )->content( `form` + )->button( text = `button` + )->text( `text` + )->link( text = `link` ). page->footer( )->overflow_toolbar( - )->button( text = 'button' - )->text( 'text' - )->link( text = 'link' + )->button( text = `button` + )->text( `text` + )->link( text = `link` )->toolbar_spacer( - )->text( 'footer' + )->text( `footer` )->toolbar_spacer( - )->text( 'text' - )->link( text = 'link' - )->button( text = 'reject' - type = 'Reject' - )->button( text = 'accept' - type = 'Success' ). + )->text( `text` + )->link( text = `link` + )->button( + text = `reject` + type = `Reject` + )->button( + text = `accept` + type = `Success` ). - client->view_display( page->stringify( ) ). + client->view_display( view->stringify( ) ). ENDMETHOD. + ENDCLASS.