mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-30 04:56:21 +08:00
![]() * Added Component and Session Stateful (#1433) - Added Component support (TODO refactoring sap.z2ui5 and view handling -> instead of .placeAt use mainView of component manifest) - Added Session Stateful support *add the following lines to your REST handler in order to support stateful session handling* '''abap if attributes-stateful-switched = abap_true. server->set_session_stateful( stateful = attributes-stateful-active ). endif. ''' And here is an ABAP example class for testing session handling '''abap "! <p class="shorttext synchronized" lang="en">Session Demo</p> class z2ui5_cl_demo_app_session 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_session 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. ''' * Update z2ui5_cl_core_http_get.clas.abap (#1434) updated to reflect latest changes (sorry some local changes were los) * lint fix * lint fix * xml fix --------- Co-authored-by: Michael Zinnöcker <29286643+mzinnoecker@users.noreply.github.com> |
||
---|---|---|
.. | ||
abap_cloud_check.jsonc | ||
abap_standard_check.jsonc | ||
abaplint.jsonc |