diff --git a/src/z2ui5_cl_demo_app_000.clas.abap b/src/z2ui5_cl_demo_app_000.clas.abap index 13dd5cd8..5c3ccbfc 100644 --- a/src/z2ui5_cl_demo_app_000.clas.abap +++ b/src/z2ui5_cl_demo_app_000.clas.abap @@ -252,6 +252,14 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). + + panel->generic_tile( + header = 'Session Stickyness' + press = client->_event( 'z2ui5_cl_demo_app_137' ) + mode = 'LineMode' + class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' + ). + panel = page->panel( expandable = abap_false expanded = abap_true @@ -383,12 +391,12 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. ). - panel->generic_tile( - header = 'Camera & Picture' - press = client->_event( 'z2ui5_cl_demo_app_137' ) - mode = 'LineMode' - class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' - ). +* panel->generic_tile( +* header = 'Camera & Picture' +* press = client->_event( 'z2ui5_cl_demo_app_137' ) +* mode = 'LineMode' +* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' +* ). page = page2->panel( expandable = abap_true @@ -991,8 +999,6 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. mode = 'LineMode' class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'). - - panel = page->panel( expandable = abap_false expanded = abap_true @@ -1112,13 +1118,13 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). - panel->generic_tile( - header = 'Popover' - subheader = 'Call from Nested Views & Popup' - press = client->_event( 'z2ui5_cl_demo_app_147' ) - mode = 'LineMode' - class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' - ). +* panel->generic_tile( +* header = 'Popover' +* subheader = 'Call from Nested Views & Popup' +* press = client->_event( 'z2ui5_cl_demo_app_147' ) +* mode = 'LineMode' +* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' +* ). panel = page->panel( @@ -1127,18 +1133,6 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. headertext = `Built-in Popups` ). -* page = page2->panel( -* expandable = abap_true -* expanded = client->_bind_edit( ms_check_expanded-built_in ) -* headertext = `Built-in Popups` -* ). - -* panel = page->panel( -* expandable = abap_false -* expanded = abap_true -* headertext = `Popups` -* ). - panel->generic_tile( header = 'Popup to Inform' press = client->_event( 'Z2UI5_CL_DEMO_APP_151' ) @@ -1226,14 +1220,6 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). -* panel->generic_tile( -* header = 'Popup Display Layout' -* subheader = '' -* press = client->_event( 'z2ui5_cl_demo_app_200' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). - panel->generic_tile( header = 'Popup Display Download' subheader = '' @@ -1242,13 +1228,6 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). - panel->generic_tile( - header = 'Popup Display JSON Export' - subheader = '' - press = client->_event( 'z2ui5_cl_demo_app_169' ) - mode = 'LineMode' - class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' - ). panel->generic_tile( header = 'Popup Display HTML' @@ -1258,29 +1237,6 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). -* panel = page->panel( -* expandable = abap_false -* expanded = abap_true -* headertext = `Popups (ABAP for Cloud WIP)` -* ). - -* panel->generic_tile( -* header = 'Popup with F4 Help' -* subheader = '(ABAP for Cloud WIP)' -* press = client->_event( 'z2ui5_cl_demo_app_204' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). - -* panel->generic_tile( -* header = 'Popup to Select Transport Requests' -* subheader = '(ABAP for Cloud WIP)' -* press = client->_event( 'z2ui5_cl_pop_transport' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). - - page = page2->panel( expandable = abap_true expanded = client->_bind_edit( ms_check_expanded-features ) @@ -1696,108 +1652,6 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' ). -* page = page2->panel( -* expandable = abap_true -* expanded = client->_bind_edit( ms_check_expanded-custom_controls ) -* headertext = `Features` -* ). -* -* -* - - - -* panel = page->panel( -* expandable = abap_false -* expanded = abap_true -* headertext = `Custom Controls` -* ). -* - - -* panel->generic_tile( -* header = 'Spreadsheet Control' -* subheader = 'Export Table as XLSX' -* press = client->_event( 'Z2UI5_CL_DEMO_APP_077' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). -* -* panel->generic_tile( -* header = 'Font Awesome Icons' -* press = client->_event( 'z2ui5_cl_demo_app_118' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). -* -* panel->generic_tile( -* header = 'Generate Barcodes' -* subheader = 'bwip-js' -* press = client->_event( 'z2ui5_cl_demo_app_102' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). -* -* panel->generic_tile( -* header = 'Tours & Contextual Help' -* subheader = 'driver.js' -* press = client->_event( 'z2ui5_cl_demo_app_119' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). -* -* panel->generic_tile( -* header = 'Image Mapster' -* press = client->_event( 'Z2UI5_CL_DEMO_APP_142' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). -* -* panel->generic_tile( -* header = 'Animate CSS' -* press = client->_event( 'Z2UI5_CL_DEMO_APP_146' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). -* -* panel->generic_tile( -* header = 'Chart.JS' -* press = client->_event( 'Z2UI5_CL_DEMO_APP_148' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). - - -* panel = page->panel( -* expandable = abap_false -* expanded = abap_true -* headertext = `Launchpad Integration` -* ). -* -* panel->generic_tile( -* header = 'Launchpad I' -* subheader = `Read Startup Parameters` -* press = client->_event( 'z2ui5_cl_demo_app_187' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). -* -* panel->generic_tile( -* header = 'Launchpad II' -* subheader = `Set Title` -* press = client->_event( 'z2ui5_cl_demo_app_188' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). -* -* panel->generic_tile( -* header = 'Launchpad III' -* subheader = `Cross App Navigation` -* press = client->_event( 'z2ui5_cl_demo_app_127' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). - page = page2->panel( expandable = abap_true expanded = client->_bind_edit( ms_check_expanded-extensions ) @@ -1810,14 +1664,6 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION. headertext = `General` ). -* panel->generic_tile( -* header = 'Create Views' -* subheader = 'Compare the three ways normal, generic & xml' -* press = client->_event( 'Z2UI5_CL_DEMO_APP_023' ) -* mode = 'LineMode' -* class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom' -* ). - panel->generic_tile( header = 'Import View' diff --git a/src/z2ui5_cl_demo_app_137.clas.abap b/src/z2ui5_cl_demo_app_137.clas.abap new file mode 100644 index 00000000..6bb2564b --- /dev/null +++ b/src/z2ui5_cl_demo_app_137.clas.abap @@ -0,0 +1,97 @@ +CLASS z2ui5_cl_demo_app_137 DEFINITION + PUBLIC + CREATE PUBLIC. + + PUBLIC SECTION. + INTERFACES z2ui5_if_app. + DATA instance_counter TYPE i READ-ONLY. + DATA check_initialized TYPE abap_bool READ-ONLY. + DATA session_is_stateful TYPE abap_bool READ-ONLY. + DATA session_text TYPE string READ-ONLY. + + PROTECTED SECTION. + PRIVATE SECTION. + + METHODS initialize_view + IMPORTING + client TYPE REF TO z2ui5_if_client. + + METHODS on_event + IMPORTING + client TYPE REF TO z2ui5_if_client. + + METHODS set_session_stateful + IMPORTING + client TYPE REF TO z2ui5_if_client + stateful TYPE abap_bool. + +ENDCLASS. + +CLASS z2ui5_cl_demo_app_137 IMPLEMENTATION. + + METHOD z2ui5_if_app~main. + IF check_initialized = abap_false. + check_initialized = abap_true. + initialize_view( client ). + ENDIF. + + on_event( client ). + ENDMETHOD. + + METHOD initialize_view. + set_session_stateful( client = client stateful = abap_true ). + + DATA(view) = z2ui5_cl_xml_view=>factory( ). + + DATA(page) = view->shell( )->page( + title = `abap2UI5 - Sample: Sticky Session` + navbuttonpress = client->_event( 'BACK' ) + shownavbutton = xsdbool( client->get( )-s_draft-id_prev_app_stack IS NOT INITIAL ) ). + + DATA(vbox) = page->vbox( ). + vbox->info_label( text = client->_bind( session_text ) ). + + DATA(hbox) = vbox->hbox( alignitems = 'Center' ). + hbox->label( text = 'press button to increment counter in backend session' class = 'sapUiTinyMarginEnd' ). + hbox->button( + text = client->_bind( instance_counter ) + press = client->_event( 'INCREMENT' ) + type = 'Emphasized' ). + + hbox = vbox->hbox( ). + hbox->button( + text = 'End session' + press = client->_event( 'END_SESSION' ) ). + + hbox->button( + text = 'Start session again' + press = client->_event( 'START_SESSION' ) ). + + client->view_display( view->stringify( ) ). + ENDMETHOD. + + METHOD on_event. + CASE client->get( )-event. + WHEN 'BACK'. + client->nav_app_leave( ). + WHEN 'INCREMENT'. + instance_counter = lcl_static_container=>increment( ). + client->view_model_update( ). + WHEN 'END_SESSION'. + set_session_stateful( client = client stateful = abap_false ). + WHEN 'START_SESSION'. + set_session_stateful( client = client stateful = abap_true ). + ENDCASE. + ENDMETHOD. + + METHOD set_session_stateful. + client->set_session_stateful( stateful ). + session_is_stateful = stateful. + IF stateful = abap_true. + session_text = 'Session ON (stateful)'. + ELSE. + session_text = 'Session OFF (stateless)'. + ENDIF. + client->view_model_update( ). + ENDMETHOD. +ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_137.clas.locals_imp.abap b/src/z2ui5_cl_demo_app_137.clas.locals_imp.abap new file mode 100644 index 00000000..ba8345e0 --- /dev/null +++ b/src/z2ui5_cl_demo_app_137.clas.locals_imp.abap @@ -0,0 +1,16 @@ +CLASS lcl_static_container DEFINITION CREATE PRIVATE FINAL. + PUBLIC SECTION. + CLASS-DATA counter TYPE i READ-ONLY. + CLASS-METHODS increment + RETURNING + VALUE(result) TYPE i. + PROTECTED SECTION. + PRIVATE SECTION. +ENDCLASS. + +CLASS lcl_static_container IMPLEMENTATION. + METHOD increment. + counter = counter + 1. + result = counter. + ENDMETHOD. +ENDCLASS. diff --git a/src/z2ui5_cl_demo_app_137.clas.xml b/src/z2ui5_cl_demo_app_137.clas.xml new file mode 100644 index 00000000..71c78bf8 --- /dev/null +++ b/src/z2ui5_cl_demo_app_137.clas.xml @@ -0,0 +1,16 @@ + + + + + + Z2UI5_CL_DEMO_APP_137 + E + stateful session + 1 + X + X + X + + + + diff --git a/src/z2ui5_cl_demo_app_162.clas.abap b/src/z2ui5_cl_demo_app_162.clas.abap index 24f22d99..ef91f9fd 100644 --- a/src/z2ui5_cl_demo_app_162.clas.abap +++ b/src/z2ui5_cl_demo_app_162.clas.abap @@ -29,7 +29,6 @@ CLASS z2ui5_cl_demo_app_162 DEFINITION PUBLIC. ENDCLASS. - CLASS z2ui5_cl_demo_app_162 IMPLEMENTATION.