Skip to content

Commit

Permalink
popover with nested view
Browse files Browse the repository at this point in the history
  • Loading branch information
oblomov-dev committed Mar 14, 2024
1 parent 81518e6 commit 77be2cc
Show file tree
Hide file tree
Showing 3 changed files with 134 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/z2ui5_cl_demo_app_000.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,13 @@ CLASS z2ui5_cl_demo_app_000 IMPLEMENTATION.
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
).

panel->generic_tile(
header = 'Popover on Nested View'
subheader = ''
press = client->_event( 'z2ui5_cl_demo_app_147' )
mode = 'LineMode'
class = 'sapUiTinyMarginEnd sapUiTinyMarginBottom'
).

page = page2->panel(
expandable = abap_true
Expand Down
111 changes: 111 additions & 0 deletions src/z2ui5_cl_demo_app_147.clas.abap
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
CLASS z2ui5_cl_demo_app_147 DEFINITION
PUBLIC
CREATE PUBLIC .

PUBLIC SECTION.

INTERFACES z2ui5_if_app.

DATA mv_input_main TYPE string .
DATA mv_input_nest TYPE string .
DATA check_initialized TYPE abap_bool .
DATA mv_path TYPE string .
DATA mv_value TYPE string .
DATA mv_file TYPE string .

METHODS on_rendering
IMPORTING
!client TYPE REF TO z2ui5_if_client .
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.



CLASS Z2UI5_CL_DEMO_APP_147 IMPLEMENTATION.


METHOD on_rendering.
DATA(lo_view) = z2ui5_cl_xml_view=>factory( ).

DATA(page) = lo_view->shell(
)->page(
title = `Popover on Nested View` id = `test`
navbuttonpress = client->_event( 'BACK' )
shownavbutton = abap_true
)->header_content(
)->link(
text = 'Source_Code' target = '_blank'
)->get_parent(
)->button( id = 'TEST_MAIN' text = 'SHOW POPOVER MAIN' press = client->_event( 'SHOW POPOVER_MAIN' ) ).

DATA(lo_view_nested) = z2ui5_cl_xml_view=>factory(
)->page( title = `Nested View`
)->button( id = 'TEST_NESTED' text = 'SHOW POPOVER NESTED' press = client->_event( 'SHOW POPOVER_NESTED' ) ).

client->view_display( lo_view->stringify( ) ).
client->nest_view_display( val = lo_view_nested->stringify( ) id = `test` method_insert = 'addContent' ).

ENDMETHOD.


METHOD z2ui5_if_app~main.

IF check_initialized = abap_false.
check_initialized = abap_true.
on_rendering( client = client ).
ENDIF.

CASE client->get( )-event.
WHEN 'START'.
on_rendering( client = client ).

WHEN 'SHOW POPOVER_NESTED'.
* ---------- Create View --------------------------------------------------------------------------
DATA(lr_view) = z2ui5_cl_xml_view=>factory_popup( ).

* ---------- Create popover window ----------------------------------------------------------------
DATA(lr_popover) = lr_view->popover( placement = 'Right'
showheader = abap_false
class = `sapUiContentPadding` ).

* ---------- Create vertical box ------------------------------------------------------------------
DATA(lr_vbox) = lr_popover->vbox( ).

* ---------- Set text -----------------------------------------------------------------------------
lr_vbox->text( text = 'Discard all changes?' ).

* ---------- Set button ---------------------------------------------------------------------------
lr_vbox->button( text = 'Discard'
press = client->_event( 'DISCARD' )
width = `16rem` ).

* ---------- Return xml ---------------------------------------------------------------------------
client->popover_display( xml = lr_view->stringify( ) by_id = 'TEST_NESTED' ).

WHEN 'SHOW POPOVER_MAIN'.
* ---------- Create View --------------------------------------------------------------------------
DATA(lr_view_main) = z2ui5_cl_xml_view=>factory_popup( ).

* ---------- Create popover window ----------------------------------------------------------------
DATA(lr_popover_main) = lr_view_main->popover( placement = 'Right' ).

* ---------- Create vertical box ------------------------------------------------------------------
DATA(lr_vbox_main) = lr_popover_main->vbox( ).

* ---------- Set text -----------------------------------------------------------------------------
lr_vbox_main->text( text = 'Discard all changes?' ).

* ---------- Set button ---------------------------------------------------------------------------
lr_vbox_main->button( text = 'Discard' press = client->_event( 'DISCARD' ) ).

* ---------- Return xml ---------------------------------------------------------------------------
client->popover_display( xml = lr_view_main->stringify( ) by_id = 'TEST_MAIN' ).

WHEN 'BACK'.
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).

ENDCASE.

ENDMETHOD.
ENDCLASS.
16 changes: 16 additions & 0 deletions src/z2ui5_cl_demo_app_147.clas.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<abapGit version="v1.0.0" serializer="LCL_OBJECT_CLAS" serializer_version="v1.0.0">
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<VSEOCLASS>
<CLSNAME>Z2UI5_CL_DEMO_APP_147</CLSNAME>
<LANGU>E</LANGU>
<DESCRIPT>animatecss demo</DESCRIPT>
<STATE>1</STATE>
<CLSCCINCL>X</CLSCCINCL>
<FIXPT>X</FIXPT>
<UNICODE>X</UNICODE>
</VSEOCLASS>
</asx:values>
</asx:abap>
</abapGit>

0 comments on commit 77be2cc

Please sign in to comment.