diff --git a/src/00/06/z2ui5_cl_demo_app_085.clas.abap b/src/00/06/z2ui5_cl_demo_app_085.clas.abap
index da41b223..6b42accf 100644
--- a/src/00/06/z2ui5_cl_demo_app_085.clas.abap
+++ b/src/00/06/z2ui5_cl_demo_app_085.clas.abap
@@ -104,9 +104,8 @@ CLASS z2ui5_cl_demo_app_085 IMPLEMENTATION.
header_title->snapped_heading(
)->flex_box( alignitems = `Center`
- )->image( src = c_pic_url && ls_detail-pic
- width = `2rem`
- class = `sapUiTinyMarginEnd`
+ )->avatar( src = c_pic_url && ls_detail-pic
+ class = `sapUiTinyMarginEnd`
)->info_label( text = |Product Id | && client->_bind( ls_detail-productid )
colorscheme = `9`
width = `200px`
@@ -154,9 +153,9 @@ CLASS z2ui5_cl_demo_app_085 IMPLEMENTATION.
DATA(header_content) = page->header_content( `uxap` ).
header_content->flex_box( wrap = `Wrap`
- )->image( src = c_pic_url && ls_detail-pic
- width = `5rem`
- class = `sapUiSmallMarginEnd`
+ )->avatar( src = c_pic_url && ls_detail-pic
+ class = `sapUiSmallMarginEnd`
+ displaysize = `layout`
)->vertical_layout( class = `sapUiSmallMarginBeginEnd`
)->label( `Dimension`
)->label( `Weight`
diff --git a/src/00/06/z2ui5_cl_demo_app_086.clas.abap b/src/00/06/z2ui5_cl_demo_app_086.clas.abap
new file mode 100644
index 00000000..75ac2fc9
--- /dev/null
+++ b/src/00/06/z2ui5_cl_demo_app_086.clas.abap
@@ -0,0 +1,44 @@
+CLASS z2ui5_cl_demo_app_086 DEFINITION PUBLIC.
+
+ PUBLIC SECTION.
+ INTERFACES z2ui5_if_app.
+
+ TYPES:
+ BEGIN OF ty_s_tab_supplier,
+ suppliername TYPE string,
+ email TYPE string,
+ phone TYPE string,
+ zipcode TYPE string,
+ city TYPE string,
+ street TYPE string,
+ country TYPE string,
+ END OF ty_s_tab_supplier.
+ DATA ls_detail_supplier TYPE ty_s_tab_supplier.
+
+ PROTECTED SECTION.
+ PRIVATE SECTION.
+ENDCLASS.
+
+
+CLASS z2ui5_cl_demo_app_086 IMPLEMENTATION.
+
+ METHOD z2ui5_if_app~main.
+
+ DATA(view) = z2ui5_cl_xml_view=>factory( ).
+ DATA(page) = view->shell(
+ )->page(
+ title = `abap2UI5 - Flow Logic - APP 85`
+ navbuttonpress = client->_event_nav_app_leave( )
+ shownavbutton = client->check_app_prev_stack( ) ).
+
+ page->grid( `L6 M12 S12` )->content( `layout`
+ )->simple_form( `Supplier` )->content( `form`
+ )->label( `Value set by previous app`
+ )->input( value = ls_detail_supplier-suppliername
+ editable = `false` ).
+
+ client->view_display( view->stringify( ) ).
+
+ ENDMETHOD.
+
+ENDCLASS.
diff --git a/src/00/06/z2ui5_cl_demo_app_086.clas.xml b/src/00/06/z2ui5_cl_demo_app_086.clas.xml
new file mode 100644
index 00000000..38575192
--- /dev/null
+++ b/src/00/06/z2ui5_cl_demo_app_086.clas.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Z2UI5_CL_DEMO_APP_086
+ E
+ ZZZ - called by 085
+ 1
+ X
+ X
+ X
+
+
+
+
diff --git a/src/01/01/z2ui5_cl_demo_app_009.clas.abap b/src/01/01/z2ui5_cl_demo_app_009.clas.abap
index 3cf7c5c2..e3ce4f87 100644
--- a/src/01/01/z2ui5_cl_demo_app_009.clas.abap
+++ b/src/01/01/z2ui5_cl_demo_app_009.clas.abap
@@ -132,6 +132,8 @@ CLASS z2ui5_cl_demo_app_009 IMPLEMENTATION.
client->message_toast_display( `value selected` ).
client->popup_destroy( ).
+ ELSE.
+ client->message_toast_display( `please select exactly one employee` ).
ENDIF.
WHEN `POPUP_TABLE_VALUE_CONTINUE`.
DELETE t_suggestion_sel WHERE selkz = abap_false.
@@ -142,6 +144,8 @@ CLASS z2ui5_cl_demo_app_009 IMPLEMENTATION.
client->message_toast_display( `value selected` ).
client->popup_destroy( ).
+ ELSE.
+ client->message_toast_display( `please select exactly one color` ).
ENDIF.
WHEN `BUTTON_SEND`.
client->message_box_display( `success - values sent to the server` ).
@@ -164,6 +168,13 @@ CLASS z2ui5_cl_demo_app_009 IMPLEMENTATION.
navbuttonpress = client->_event_nav_app_leave( )
shownavbutton = client->check_app_prev_stack( ) ).
+ page->message_strip(
+ text = `Four value-help patterns: inline suggestions, numeric-only input, a value-help popup with a selectable table, ` &&
+ `and a custom popup with a city search. Fill the fields, then Clear resets the view and Send simulates a submit.`
+ type = `Information`
+ showicon = abap_true
+ class = `sapUiSmallMargin` ).
+
DATA(form) = page->grid( `L7 M7 S7`
)->content( `layout`
)->simple_form( `Input with Value Help`
@@ -210,16 +221,15 @@ CLASS z2ui5_cl_demo_app_009 IMPLEMENTATION.
)->overflow_toolbar(
)->toolbar_spacer(
)->button(
- text = `Clear`
- press = client->_event( `BUTTON_CLEAR` )
- type = `Reject`
- enabled = abap_false
- icon = `sap-icon://delete`
+ text = `Clear`
+ press = client->_event( `BUTTON_CLEAR` )
+ type = `Reject`
+ icon = `sap-icon://delete`
)->button(
- text = `Send to Server`
- press = client->_event( `BUTTON_SEND` )
- enabled = abap_false
- type = `Success` ).
+ text = `Send to Server`
+ press = client->_event( `BUTTON_SEND` )
+ type = `Success`
+ icon = `sap-icon://paper-plane` ).
client->view_display( view->stringify( ) ).
diff --git a/src/01/01/z2ui5_cl_demo_app_052.clas.abap b/src/01/01/z2ui5_cl_demo_app_052.clas.abap
index eaaa5359..e55e4907 100644
--- a/src/01/01/z2ui5_cl_demo_app_052.clas.abap
+++ b/src/01/01/z2ui5_cl_demo_app_052.clas.abap
@@ -38,8 +38,9 @@ CLASS z2ui5_cl_demo_app_052 IMPLEMENTATION.
lo_popover->popover( placement = `Right`
title = |abap2UI5 - Popover - { mv_product }|
- contentwidth = `50%`
- )->simple_form( editable = abap_true
+ contentwidth = `20rem`
+ )->simple_form( editable = abap_false
+ layout = `ColumnLayout`
)->content( `form`
)->label( `Product`
)->text( mv_product
diff --git a/src/01/01/z2ui5_cl_demo_app_065.clas.abap b/src/01/01/z2ui5_cl_demo_app_065.clas.abap
index ffaeb740..2fd41ced 100644
--- a/src/01/01/z2ui5_cl_demo_app_065.clas.abap
+++ b/src/01/01/z2ui5_cl_demo_app_065.clas.abap
@@ -5,6 +5,7 @@ CLASS z2ui5_cl_demo_app_065 DEFINITION PUBLIC.
DATA mv_input_main TYPE string.
DATA mv_input_nest TYPE string.
+ DATA mv_count TYPE i.
PROTECTED SECTION.
PRIVATE SECTION.
@@ -34,14 +35,14 @@ CLASS z2ui5_cl_demo_app_065 IMPLEMENTATION.
press = client->_event( `MAIN` )
)->button( text = `Rerender only nested view`
press = client->_event( `NEST` )
+ )->button( text = `Update only nested MODEL (nest_view_model_update)`
+ press = client->_event( `NEST_MODEL` )
)->input( client->_bind_edit( mv_input_main ) ).
DATA(lo_view_nested) = z2ui5_cl_xml_view=>factory(
)->page( `Nested View`
)->button( text = `event`
press = client->_event( `TEST` )
- )->button( text = `frontend event`
- press = client->_event_client( val = client->cs_event-open_new_tab t_arg = VALUE #( ( `https://github.com/abap2UI5/abap2UI5/` ) ) )
)->input( client->_bind_edit( mv_input_nest ) ).
IF client->check_on_init( ).
@@ -67,6 +68,15 @@ CLASS z2ui5_cl_demo_app_065 IMPLEMENTATION.
client->nest_view_display( val = lo_view_nested->stringify( )
id = `test`
method_insert = `addContent` ).
+
+ WHEN `NEST_MODEL`.
+ " change only a nest-bound field and refresh the nested view's model
+ " copy (no re-render of the nested XML) - this isolates the effect of
+ " nest_view_model_update. Press "Rerender only nested view" first so
+ " the nested view exists.
+ mv_count = mv_count + 1.
+ mv_input_nest = |nest model updated #{ mv_count }|.
+ client->nest_view_model_update( ).
ENDCASE.
ENDMETHOD.
diff --git a/src/01/01/z2ui5_cl_demo_app_097.clas.abap b/src/01/01/z2ui5_cl_demo_app_097.clas.abap
index e840dcf5..ec078e7d 100644
--- a/src/01/01/z2ui5_cl_demo_app_097.clas.abap
+++ b/src/01/01/z2ui5_cl_demo_app_097.clas.abap
@@ -5,6 +5,7 @@ CLASS z2ui5_cl_demo_app_097 DEFINITION PUBLIC.
TYPES:
BEGIN OF ty_s_row,
+ uuid TYPE string,
title TYPE string,
value TYPE string,
descr TYPE string,
@@ -57,7 +58,7 @@ CLASS z2ui5_cl_demo_app_097 IMPLEMENTATION.
filterproperty = `INFO` )->text( `INFO` )->ui_template( )->text( `{INFO}` ).
lo_columns->get_parent( )->ui_row_action_template( )->ui_row_action(
)->ui_row_action_item( icon = `sap-icon://delete`
- press = client->_event( val = `ROW_DELETE` t_arg = VALUE #( ( `${TITLE}` ) ) ) ).
+ press = client->_event( val = `ROW_DELETE` t_arg = VALUE #( ( `${UUID}` ) ) ) ).
client->nest_view_display(
val = lo_view_nested->stringify( )
@@ -123,11 +124,8 @@ CLASS z2ui5_cl_demo_app_097 IMPLEMENTATION.
CASE client->get( )-event.
WHEN `ROW_DELETE`.
- DATA(ls_arg) = client->get_event_arg( ).
- IF ls_arg IS NOT INITIAL.
- DELETE t_tab2 WHERE title = ls_arg.
- ENDIF.
+ DELETE t_tab2 WHERE uuid = client->get_event_arg( ).
client->nest_view_model_update( ).
WHEN `SELCHANGE`.
@@ -135,7 +133,8 @@ CLASS z2ui5_cl_demo_app_097 IMPLEMENTATION.
DELETE lt_sel WHERE selected = abap_false.
READ TABLE lt_sel INTO DATA(ls_sel) INDEX 1.
- APPEND ls_sel TO t_tab2.
+ ls_sel-uuid = z2ui5_cl_sample_context=>uuid_get_c32( ).
+ INSERT ls_sel INTO TABLE t_tab2.
mv_layout = `TwoColumnsMidExpanded`.
diff --git a/src/01/01/z2ui5_cl_demo_app_098.clas.abap b/src/01/01/z2ui5_cl_demo_app_098.clas.abap
index 84f7fe9e..bd2c8df1 100644
--- a/src/01/01/z2ui5_cl_demo_app_098.clas.abap
+++ b/src/01/01/z2ui5_cl_demo_app_098.clas.abap
@@ -83,7 +83,7 @@ CLASS z2ui5_cl_demo_app_098 IMPLEMENTATION.
page = page->text( client->_bind( mv_title )
)->button(
text = `frontend event`
- press = client->_event_client( val = client->cs_event-open_new_tab t_arg = VALUE #( ( `https://github.com/abap2UI5/abap2UI5/` ) ) ) ).
+ press = client->_event( `NN_VIEW` ) ).
client->nest2_view_display(
val = lo_view_nested->stringify( )
@@ -149,6 +149,9 @@ CLASS z2ui5_cl_demo_app_098 IMPLEMENTATION.
CASE client->get( )-event.
+ WHEN 'NN_VIEW'.
+ client->message_box_display( `Event in nested nested view raised` ).
+
WHEN `ROW_NAVIGATE`.
IF client->get_event_arg( ) IS NOT INITIAL.
@@ -165,7 +168,9 @@ CLASS z2ui5_cl_demo_app_098 IMPLEMENTATION.
DELETE lt_sel WHERE selected = abap_false.
READ TABLE lt_sel INTO DATA(ls_sel) INDEX 1.
- APPEND ls_sel TO t_tab2.
+ IF NOT line_exists( t_tab2[ title = ls_sel-title ] ).
+ INSERT ls_sel INTO TABLE t_tab2.
+ ENDIF.
mv_layout = `TwoColumnsMidExpanded`.
diff --git a/src/01/01/z2ui5_cl_demo_app_163.clas.xml b/src/01/01/z2ui5_cl_demo_app_163.clas.xml
index 5839289f..d3a194fc 100644
--- a/src/01/01/z2ui5_cl_demo_app_163.clas.xml
+++ b/src/01/01/z2ui5_cl_demo_app_163.clas.xml
@@ -5,7 +5,7 @@
Z2UI5_CL_DEMO_APP_163
E
- More - require sap.m.MessageToast in XML View
+ More - Require Object in XML View
1
X
X
diff --git a/src/01/01/z2ui5_cl_demo_app_173.clas.abap b/src/01/01/z2ui5_cl_demo_app_173.clas.abap
index 1280af22..91f4a0d1 100644
--- a/src/01/01/z2ui5_cl_demo_app_173.clas.abap
+++ b/src/01/01/z2ui5_cl_demo_app_173.clas.abap
@@ -44,9 +44,9 @@ CLASS z2ui5_cl_demo_app_173 IMPLEMENTATION.
navbuttonpress = client->_event_nav_app_leave( )
shownavbutton = client->check_app_prev_stack( ) ).
- view->table( client->_bind( mt_data )
+ view->table( client->_bind_edit( mt_data )
)->columns(
- )->template_repeat( list = `{template>/MT_LAYOUT}`
+ )->template_repeat( list = `{template>/XX/MT_LAYOUT}`
var = `L0`
)->column( mergeduplicates = `{L0>MERGE}`
visible = `{L0>VISIBLE}` )->text( `{L0>FNAME}` )->get_parent(
@@ -54,7 +54,7 @@ CLASS z2ui5_cl_demo_app_173 IMPLEMENTATION.
)->items(
)->column_list_item(
)->cells(
- )->template_repeat( list = `{template>/MT_LAYOUT}`
+ )->template_repeat( list = `{template>/XX/MT_LAYOUT}`
var = `L1`
)->object_identifier( text = `{= '{' + ${L1>FNAME} + '}' }` ).
diff --git a/src/01/01/z2ui5_cl_demo_app_176.clas.abap b/src/01/01/z2ui5_cl_demo_app_176.clas.abap
index ee52b87e..b74b7f43 100644
--- a/src/01/01/z2ui5_cl_demo_app_176.clas.abap
+++ b/src/01/01/z2ui5_cl_demo_app_176.clas.abap
@@ -67,9 +67,9 @@ CLASS z2ui5_cl_demo_app_176 IMPLEMENTATION.
DATA(lo_view_nested) = z2ui5_cl_xml_view=>factory( ).
lo_view_nested->shell( )->page( `Nested View`
- )->table( i_client->_bind( mt_data )
+ )->table( i_client->_bind_edit( mt_data )
)->columns(
- )->template_repeat( list = `{template>/MT_LAYOUT}`
+ )->template_repeat( list = `{template>/XX/MT_LAYOUT}`
var = `LO`
)->column( mergeduplicates = `{LO>MERGE}`
visible = `{LO>VISIBLE}` )->get_parent(
@@ -77,7 +77,7 @@ CLASS z2ui5_cl_demo_app_176 IMPLEMENTATION.
)->items(
)->column_list_item(
)->cells(
- )->template_repeat( list = `{template>/MT_LAYOUT}`
+ )->template_repeat( list = `{template>/XX/MT_LAYOUT}`
var = `LO2`
)->object_identifier( text = `{= '{' + ${LO2>FNAME} + '}' }` ).
diff --git a/src/01/02/z2ui5_cl_demo_app_073.clas.abap b/src/01/02/z2ui5_cl_demo_app_073.clas.abap
index 98bcea36..7549fe84 100644
--- a/src/01/02/z2ui5_cl_demo_app_073.clas.abap
+++ b/src/01/02/z2ui5_cl_demo_app_073.clas.abap
@@ -45,9 +45,19 @@ CLASS z2ui5_cl_demo_app_073 IMPLEMENTATION.
CASE client->get( )-event.
WHEN `BUTTON_OPEN_NEW_TAB`.
+
+ DATA(ls_config) = client->get( )-s_config.
+ DATA(result) = z2ui5_cl_a2ui5_context=>app_get_url( classname = `z2ui5_cl_demo_app_073`
+ origin = ls_config-origin
+ pathname = ls_config-pathname
+ search = ls_config-search
+ hash = ls_config-hash ).
+
client->follow_up_action(
val = z2ui5_if_client=>cs_event-open_new_tab
- t_arg = VALUE #( ( `https://www.google.com/search?q=abap2ui5&oq=abap2ui5,123` ) ) ).
+ t_arg = VALUE #(
+ ( result )
+ ) ).
ENDCASE.
ENDMETHOD.
diff --git a/src/01/02/z2ui5_cl_demo_app_125.clas.xml b/src/01/02/z2ui5_cl_demo_app_125.clas.xml
index b64f5816..9e8e5c5f 100644
--- a/src/01/02/z2ui5_cl_demo_app_125.clas.xml
+++ b/src/01/02/z2ui5_cl_demo_app_125.clas.xml
@@ -5,7 +5,7 @@
Z2UI5_CL_DEMO_APP_125
E
- Browsre - Title
+ Browser - Title
1
X
X
diff --git a/src/01/02/z2ui5_cl_demo_app_316.clas.abap b/src/01/02/z2ui5_cl_demo_app_316.clas.abap
index 5b12e8a8..ba67875c 100644
--- a/src/01/02/z2ui5_cl_demo_app_316.clas.abap
+++ b/src/01/02/z2ui5_cl_demo_app_316.clas.abap
@@ -44,7 +44,8 @@ CLASS z2ui5_cl_demo_app_316 IMPLEMENTATION.
)->shell(
)->page( title = `abap2UI5 - Sample: URL Helper`
navbuttonpress = client->_event_nav_app_leave( )
- shownavbutton = client->check_app_prev_stack( ) ).
+ shownavbutton = client->check_app_prev_stack( )
+ ).
DATA(layout) = page->vertical_layout( class = `sapUiContentPadding`
width = `100%` ).
@@ -116,8 +117,7 @@ CLASS z2ui5_cl_demo_app_316 IMPLEMENTATION.
class = `sapUiSmallMarginBottom` ).
mobile_form->button( text = `Trigger SMS`
press = client->_event_client( val = client->cs_event-urlhelper
- t_arg = VALUE #( ( `TRIGGER_SMS` )
- ( |${ client->_bind_edit( mobile ) }| ) ) ) ).
+ t_arg = VALUE #( ( `TRIGGER_SMS` ) ( |${ client->_bind_edit( mobile ) }| ) ) ) ).
DATA(url_form) = layout->simple_form( `Redirect` ).
url_form->label( text = `URL`
@@ -129,8 +129,7 @@ CLASS z2ui5_cl_demo_app_316 IMPLEMENTATION.
class = `sapUiSmallMarginBottom` ).
url_form->button( text = `Redirect`
press = client->_event_client( val = client->cs_event-urlhelper
- t_arg = VALUE #( ( `REDIRECT` )
- ( |${ client->_bind_edit( url ) }| ) ) ) ).
+ t_arg = VALUE #( ( `REDIRECT` ) ( |${ client->_bind_edit( url ) }| ) ) ) ).
client->view_display( page->stringify( ) ).
diff --git a/src/01/02/z2ui5_cl_demo_app_446.clas.abap b/src/01/02/z2ui5_cl_demo_app_446.clas.abap
new file mode 100644
index 00000000..202f8ab7
--- /dev/null
+++ b/src/01/02/z2ui5_cl_demo_app_446.clas.abap
@@ -0,0 +1,100 @@
+CLASS z2ui5_cl_demo_app_446 DEFINITION PUBLIC.
+
+ PUBLIC SECTION.
+ INTERFACES z2ui5_if_app.
+
+ PROTECTED SECTION.
+ DATA client TYPE REF TO z2ui5_if_client.
+
+ METHODS view_display.
+ METHODS on_event.
+
+ PRIVATE SECTION.
+ENDCLASS.
+
+
+CLASS z2ui5_cl_demo_app_446 IMPLEMENTATION.
+
+ METHOD z2ui5_if_app~main.
+
+ me->client = client.
+ IF client->check_on_init( ).
+ view_display( ).
+ ELSE.
+ on_event( ).
+ ENDIF.
+
+ ENDMETHOD.
+
+
+ METHOD on_event.
+
+ CASE client->get( )-event.
+
+ WHEN `TOAST`.
+ client->control_call( object = `MESSAGE_TOAST`
+ method = `show`
+ params = VALUE #( ( `Hello from control_call!` ) ) ).
+
+ WHEN `MSGBOX`.
+ client->control_call( object = `MESSAGE_BOX`
+ method = `show`
+ params = VALUE #( ( `A message box, opened via control_call.` ) ) ).
+
+ WHEN `THEME_DARK`.
+ client->control_call( object = `THEMING`
+ method = `setTheme`
+ params = VALUE #( ( `sap_horizon_dark` ) ) ).
+
+ WHEN `THEME_LIGHT`.
+ client->control_call( object = `THEMING`
+ method = `setTheme`
+ params = VALUE #( ( `sap_horizon` ) ) ).
+
+ ENDCASE.
+
+ view_display( ).
+
+ ENDMETHOD.
+
+
+ METHOD view_display.
+
+ DATA(view) = z2ui5_cl_xml_view=>factory( ).
+
+ DATA(page) = view->shell(
+ )->page(
+ title = `abap2UI5 - Action - control_call`
+ navbuttonpress = client->_event_nav_app_leave( )
+ shownavbutton = client->check_app_prev_stack( ) ).
+
+ page->message_strip(
+ text = `Each button lets the backend call a method on a global frontend object ` &&
+ `(MessageToast, MessageBox, Theming) - client-side, after the response renders, ` &&
+ `without wiring a control event.`
+ type = `Information`
+ showicon = abap_true
+ class = `sapUiSmallMargin` ).
+
+ page->vbox( `sapUiSmallMargin`
+ )->button( text = `MessageToast.show`
+ icon = `sap-icon://information`
+ press = client->_event( `TOAST` )
+ )->button( text = `MessageBox.show`
+ icon = `sap-icon://message-popup`
+ press = client->_event( `MSGBOX` )
+ class = `sapUiTinyMarginTop`
+ )->button( text = `Theming.setTheme( dark )`
+ icon = `sap-icon://palette`
+ press = client->_event( `THEME_DARK` )
+ class = `sapUiTinyMarginTop`
+ )->button( text = `Theming.setTheme( light )`
+ icon = `sap-icon://palette`
+ press = client->_event( `THEME_LIGHT` )
+ class = `sapUiTinyMarginTop` ).
+
+ client->view_display( view->stringify( ) ).
+
+ ENDMETHOD.
+
+ENDCLASS.
diff --git a/src/01/02/z2ui5_cl_demo_app_446.clas.xml b/src/01/02/z2ui5_cl_demo_app_446.clas.xml
new file mode 100644
index 00000000..63cbc260
--- /dev/null
+++ b/src/01/02/z2ui5_cl_demo_app_446.clas.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Z2UI5_CL_DEMO_APP_446
+ E
+ Action - control_call
+ 1
+ X
+ X
+ X
+
+
+
+
diff --git a/src/01/02/z2ui5_cl_demo_app_447.clas.abap b/src/01/02/z2ui5_cl_demo_app_447.clas.abap
new file mode 100644
index 00000000..343098ec
--- /dev/null
+++ b/src/01/02/z2ui5_cl_demo_app_447.clas.abap
@@ -0,0 +1,111 @@
+CLASS z2ui5_cl_demo_app_447 DEFINITION PUBLIC.
+
+ PUBLIC SECTION.
+ INTERFACES z2ui5_if_app.
+
+ TYPES:
+ BEGIN OF ty_s_row,
+ index TYPE i,
+ text TYPE string,
+ END OF ty_s_row.
+ DATA mt_row TYPE STANDARD TABLE OF ty_s_row WITH EMPTY KEY.
+
+ PROTECTED SECTION.
+ DATA client TYPE REF TO z2ui5_if_client.
+
+ METHODS view_display.
+ METHODS on_event.
+
+ PRIVATE SECTION.
+ENDCLASS.
+
+
+CLASS z2ui5_cl_demo_app_447 IMPLEMENTATION.
+
+ METHOD z2ui5_if_app~main.
+
+ me->client = client.
+
+ IF client->check_on_init( ).
+
+ DO 30 TIMES.
+ INSERT VALUE #( index = sy-index
+ text = |Row number { sy-index }| ) INTO TABLE mt_row.
+ ENDDO.
+
+ view_display( ).
+
+ ELSE.
+ on_event( ).
+ ENDIF.
+
+ ENDMETHOD.
+
+
+ METHOD on_event.
+
+ CASE client->get( )-event.
+
+ WHEN `FOCUS`.
+ client->control_call_by_id( id = `nameInput`
+ method = `focus` ).
+
+ WHEN `SCROLL`.
+ client->control_call_by_id( id = `bigTable`
+ method = `scrollToIndex`
+ params = VALUE #( ( `25` ) ) ).
+
+ ENDCASE.
+
+ view_display( ).
+
+ ENDMETHOD.
+
+
+ METHOD view_display.
+
+ DATA(view) = z2ui5_cl_xml_view=>factory( ).
+
+ DATA(page) = view->shell(
+ )->page(
+ title = `abap2UI5 - Action - control_call_by_id`
+ navbuttonpress = client->_event_nav_app_leave( )
+ shownavbutton = client->check_app_prev_stack( ) ).
+
+ page->message_strip(
+ text = `The backend calls a whitelisted method on a control resolved by id, after the ` &&
+ `response renders: focus() on the input, scrollToIndex() on the table.`
+ type = `Information`
+ showicon = abap_true
+ class = `sapUiSmallMargin` ).
+
+ page->vbox( `sapUiSmallMargin`
+ )->input( id = `nameInput`
+ placeholder = `this input can be focused from the backend`
+ )->button( text = `focus( ) the input`
+ icon = `sap-icon://edit`
+ press = client->_event( `FOCUS` )
+ class = `sapUiTinyMarginTop`
+ )->button( text = `scrollToIndex( 25 ) on the table`
+ icon = `sap-icon://down`
+ press = client->_event( `SCROLL` )
+ class = `sapUiTinyMarginTop` ).
+
+ DATA(tab) = page->table( id = `bigTable`
+ items = client->_bind( mt_row ) ).
+
+ tab->columns(
+ )->column( )->text( `Index` )->get_parent(
+ )->column( )->text( `Text` )->get_parent( ).
+
+ tab->items(
+ )->column_list_item(
+ )->cells(
+ )->text( `{INDEX}`
+ )->text( `{TEXT}` ).
+
+ client->view_display( view->stringify( ) ).
+
+ ENDMETHOD.
+
+ENDCLASS.
diff --git a/src/01/02/z2ui5_cl_demo_app_447.clas.xml b/src/01/02/z2ui5_cl_demo_app_447.clas.xml
new file mode 100644
index 00000000..7da6001a
--- /dev/null
+++ b/src/01/02/z2ui5_cl_demo_app_447.clas.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Z2UI5_CL_DEMO_APP_447
+ E
+ Action - control_call_by_id
+ 1
+ X
+ X
+ X
+
+
+
+
diff --git a/src/01/05/z2ui5_cl_demo_app_074.clas.abap b/src/01/05/z2ui5_cl_demo_app_074.clas.abap
index 99f834f5..6eefe942 100644
--- a/src/01/05/z2ui5_cl_demo_app_074.clas.abap
+++ b/src/01/05/z2ui5_cl_demo_app_074.clas.abap
@@ -3,17 +3,14 @@ CLASS z2ui5_cl_demo_app_074 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
- DATA mv_path TYPE string.
- DATA mv_value TYPE string.
- DATA mr_table TYPE REF TO data.
- DATA mv_check_edit TYPE abap_bool.
- DATA mv_check_download TYPE abap_bool.
+ DATA filepath TYPE string.
+ DATA file TYPE string.
+ DATA table TYPE REF TO data.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS on_event.
-
METHODS view_display.
PRIVATE SECTION.
@@ -24,6 +21,18 @@ ENDCLASS.
CLASS z2ui5_cl_demo_app_074 IMPLEMENTATION.
+ METHOD z2ui5_if_app~main.
+
+ me->client = client.
+ IF client->check_on_init( ) OR client->check_on_navigated( ).
+ view_display( ).
+ ELSE.
+ on_event( ).
+ ENDIF.
+
+ ENDMETHOD.
+
+
METHOD on_event.
TRY.
@@ -35,23 +44,25 @@ CLASS z2ui5_cl_demo_app_074 IMPLEMENTATION.
WHEN `UPLOAD`.
- SPLIT mv_value AT `;` INTO DATA(lv_dummy) DATA(lv_data).
- SPLIT lv_data AT `,` INTO lv_dummy lv_data.
+ " the uploader delivers a data URL (data:;base64,);
+ " drop the prefix, then base64-decode the payload into a string
+ SPLIT file AT `;` INTO DATA(header) DATA(base64).
+ SPLIT base64 AT `,` INTO header base64.
- DATA(lv_data2) = z2ui5_cl_sample_context=>conv_decode_x_base64( lv_data ).
- DATA(lv_ready) = z2ui5_cl_sample_context=>conv_get_string_by_xstring( lv_data2 ).
+ DATA(raw) = z2ui5_cl_sample_context=>conv_decode_x_base64( base64 ).
+ DATA(content) = z2ui5_cl_sample_context=>conv_get_string_by_xstring( raw ).
- mr_table = z2ui5_cl_sample_context=>itab_get_itab_by_csv( lv_ready ).
- client->message_box_display( `CSV loaded to table` ).
+ client->message_box_display( content ).
+
+ file = VALUE #( ).
+ filepath = VALUE #( ).
view_display( ).
- mv_value = VALUE #( ).
- mv_path = VALUE #( ).
ENDCASE.
- CATCH cx_root INTO DATA(x).
- client->message_box_display( text = x->get_text( )
+ CATCH cx_root INTO DATA(error).
+ client->message_box_display( text = error->get_text( )
type = `error` ).
ENDTRY.
@@ -61,58 +72,45 @@ CLASS z2ui5_cl_demo_app_074 IMPLEMENTATION.
METHOD view_display.
DATA(view) = z2ui5_cl_xml_view=>factory( ).
+
DATA(page) = view->shell( )->page(
- title = `abap2UI5 - CSV to ABAP internal Table`
- navbuttonpress = client->_event_nav_app_leave( )
- shownavbutton = client->check_app_prev_stack( ) ).
- FIELD-SYMBOLS TYPE table.
+ title = `abap2UI5 - Upload a File`
+ navbuttonpress = client->_event_nav_app_leave( )
+ shownavbutton = client->check_app_prev_stack( ) ).
- IF mr_table IS NOT INITIAL.
+ IF table IS NOT INITIAL.
- ASSIGN mr_table->* TO .
+ FIELD-SYMBOLS TYPE table.
+ ASSIGN table->* TO .
- DATA(tab) = page->table(
- COND #( WHEN mv_check_edit = abap_true THEN client->_bind_edit( ) ELSE client->_bind_edit( ) )
+ DATA(tab) = page->table( client->_bind_edit( )
)->header_toolbar(
)->overflow_toolbar(
)->title( `CSV Content`
)->toolbar_spacer(
)->get_parent( )->get_parent( ).
- DATA(lr_fields) = z2ui5_cl_sample_context=>rtti_get_t_attri_by_any( ).
- DATA(lo_cols) = tab->columns( ).
- LOOP AT lr_fields REFERENCE INTO DATA(lr_col).
- lo_cols->column( )->text( lr_col->name ).
- ENDLOOP.
- DATA(lo_cells) = tab->items( )->column_list_item( )->cells( ).
- LOOP AT lr_fields REFERENCE INTO lr_col.
- lo_cells->text( |\{{ lr_col->name }\}| ).
+ DATA(fields) = z2ui5_cl_sample_context=>rtti_get_t_attri_by_any( ).
+ DATA(columns) = tab->columns( ).
+ DATA(cells) = tab->items( )->column_list_item( )->cells( ).
+
+ LOOP AT fields REFERENCE INTO DATA(field).
+ columns->column( )->text( field->name ).
+ cells->text( |\{{ field->name }\}| ).
ENDLOOP.
- ENDIF.
- DATA(footer) = page->footer( )->overflow_toolbar( ).
+ ENDIF.
- footer->_z2ui5( )->file_uploader(
- value = client->_bind_edit( mv_value )
- path = client->_bind_edit( mv_path )
- placeholder = `filepath here...`
- upload = client->_event( `UPLOAD` ) ).
+ page->footer(
+ )->overflow_toolbar(
+ )->_z2ui5( )->file_uploader(
+ value = client->_bind_edit( file )
+ path = client->_bind_edit( filepath )
+ placeholder = `filepath here...`
+ upload = client->_event( `UPLOAD` ) ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
-
- METHOD z2ui5_if_app~main.
-
- me->client = client.
- IF client->check_on_init( ).
- view_display( ).
- ELSEIF client->check_on_navigated( ).
- view_display( ).
- ELSE.
- on_event( ).
- ENDIF.
-
- ENDMETHOD.
ENDCLASS.
diff --git a/src/01/05/z2ui5_cl_demo_app_120.clas.abap b/src/01/05/z2ui5_cl_demo_app_120.clas.abap
index 6704cb98..d426cf0e 100644
--- a/src/01/05/z2ui5_cl_demo_app_120.clas.abap
+++ b/src/01/05/z2ui5_cl_demo_app_120.clas.abap
@@ -24,6 +24,10 @@ CLASS z2ui5_cl_demo_app_120 DEFINITION PUBLIC.
DATA mt_spot TYPE TABLE OF ty_s_spot.
PROTECTED SECTION.
+ DATA client TYPE REF TO z2ui5_if_client.
+
+ METHODS view_display.
+
PRIVATE SECTION.
ENDCLASS.
@@ -32,90 +36,67 @@ CLASS z2ui5_cl_demo_app_120 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
- IF client->check_on_init( ).
-
- DATA(view) = z2ui5_cl_xml_view=>factory( ).
- client->view_display( view->shell(
- )->page(
- title = `abap2UI5 - Device Capabilities`
- navbuttonpress = client->_event_nav_app_leave( )
- shownavbutton = client->check_app_prev_stack( )
- )->_z2ui5( )->geolocation(
- finished = client->_event( `GEOLOCATION_LOADED` )
- longitude = client->_bind_edit( longitude )
- latitude = client->_bind_edit( latitude )
- altitude = client->_bind_edit( altitude )
- altitudeaccuracy = client->_bind_edit( altitudeaccuracy )
- accuracy = client->_bind_edit( accuracy )
- speed = client->_bind_edit( speed )
- )->simple_form( title = `Geolocation`
- editable = abap_true
- )->content( `form`
- )->label( `Longitude`
- )->input( client->_bind_edit( longitude )
- )->label( `Latitude`
- )->input( client->_bind_edit( latitude )
- )->label( `Altitude`
- )->input( client->_bind_edit( altitude )
- )->label( `Accuracy`
- )->input( client->_bind_edit( accuracy )
- )->label( `AltitudeAccuracy`
- )->input( client->_bind_edit( altitudeaccuracy )
- )->label( `Speed`
- )->input( client->_bind_edit( speed )
- )->label( `MapContainer`
- )->button( text = `Display`
- press = client->_event( `MAP_CONTAINER_DISPLAY` )
- )->stringify( ) ).
+ me->client = client.
+ IF client->check_on_init( ).
+ view_display( ).
RETURN.
ENDIF.
CASE client->get( )-event.
- WHEN `MAP_CONTAINER_DISPLAY`.
-
- IF longitude IS NOT INITIAL.
- mt_spot = VALUE #( ( pos = longitude && `;` && latitude && `;0` type = `Default` contentoffset = `0;-6` scale = `1;1;1` key = `Your Position` tooltip = `Your Position` ) ).
- ENDIF.
-
- view = z2ui5_cl_xml_view=>factory( ).
- client->view_display( view->shell(
- )->page(
- title = `abap2UI5 - Device Capabilities`
- navbuttonpress = client->_event_nav_app_leave( )
- shownavbutton = client->check_app_prev_stack( )
- )->_z2ui5( )->geolocation(
- finished = client->_event( )
- longitude = client->_bind_edit( longitude )
- latitude = client->_bind_edit( latitude )
- altitude = client->_bind_edit( altitude )
- altitudeaccuracy = client->_bind_edit( altitudeaccuracy )
- accuracy = client->_bind_edit( accuracy )
- speed = client->_bind_edit( speed )
- )->simple_form( title = `Geolocation`
- editable = abap_true
- )->content( `form`
- )->label( `Longitude`
- )->input( client->_bind_edit( longitude )
- )->label( `Latitude`
- )->input( client->_bind_edit( latitude )
- )->label( `Altitude`
- )->input( client->_bind_edit( altitude )
- )->label( `Accuracy`
- )->input( client->_bind_edit( accuracy )
- )->label( `AltitudeAccuracy`
- )->input( client->_bind_edit( altitudeaccuracy )
- )->label( `Speed`
- )->input( client->_bind_edit( speed )
- )->label( `MapContainer`
- )->button( text = `Display`
- press = client->_event( `MAP_CONTAINER_DISPLAY` )
- )->get_parent( )->get_parent(
- )->stringify( ) ).
+ WHEN `GEOLOCATION_ERROR`.
+
+ " the Geolocation control fires `error` when the position cannot be
+ " read; the code (1 = permission denied, 2 = position unavailable,
+ " 3 = timeout) and message are passed as event arguments.
+ client->message_box_display(
+ text = |Location unavailable ({ client->get_event_arg( 1 ) }): { client->get_event_arg( 2 ) }|
+ type = `error` ).
ENDCASE.
ENDMETHOD.
+
+ METHOD view_display.
+
+ DATA(view) = z2ui5_cl_xml_view=>factory( ).
+
+ view->shell(
+ )->page(
+ title = `abap2UI5 - Device Capabilities`
+ navbuttonpress = client->_event_nav_app_leave( )
+ shownavbutton = client->check_app_prev_stack( )
+ )->_z2ui5( )->geolocation(
+ finished = client->_event( `GEOLOCATION_LOADED` )
+ error = client->_event( val = `GEOLOCATION_ERROR`
+ t_arg = VALUE #( ( `${$parameters>/code}` )
+ ( `${$parameters>/message}` ) ) )
+ longitude = client->_bind_edit( longitude )
+ latitude = client->_bind_edit( latitude )
+ altitude = client->_bind_edit( altitude )
+ altitudeaccuracy = client->_bind_edit( altitudeaccuracy )
+ accuracy = client->_bind_edit( accuracy )
+ speed = client->_bind_edit( speed )
+ )->simple_form( title = `Geolocation`
+ editable = abap_false
+ )->content( `form`
+ )->label( `Longitude`
+ )->input( value = client->_bind_edit( longitude ) editable = abap_false
+ )->label( `Latitude`
+ )->input( value = client->_bind_edit( latitude ) editable = abap_false
+ )->label( `Altitude`
+ )->input( value = client->_bind_edit( altitude ) editable = abap_false
+ )->label( `Accuracy`
+ )->input( value = client->_bind_edit( accuracy ) editable = abap_false
+ )->label( `AltitudeAccuracy`
+ )->input( value = client->_bind_edit( altitudeaccuracy ) editable = abap_false
+ )->label( `Speed`
+ )->input( value = client->_bind_edit( speed ) editable = abap_false ).
+
+ client->view_display( view->stringify( ) ).
+
+ ENDMETHOD.
+
ENDCLASS.
diff --git a/src/01/06/z2ui5_cl_demo_app_160.clas.abap b/src/01/06/z2ui5_cl_demo_app_160.clas.abap
index b59365ed..c8bf5181 100644
--- a/src/01/06/z2ui5_cl_demo_app_160.clas.abap
+++ b/src/01/06/z2ui5_cl_demo_app_160.clas.abap
@@ -39,32 +39,43 @@ CLASS z2ui5_cl_demo_app_160 DEFINITION PUBLIC.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
- METHODS load_output_table.
+ METHODS model_init.
METHODS on_event.
- METHODS render_main_screen.
+ METHODS view_display.
PRIVATE SECTION.
ENDCLASS.
-CLASS Z2UI5_CL_DEMO_APP_160 IMPLEMENTATION.
+CLASS z2ui5_cl_demo_app_160 IMPLEMENTATION.
+ METHOD z2ui5_if_app~main.
+
+ me->client = client.
+ IF client->check_on_init( ).
+ model_init( ).
+ view_display( ).
+ ELSE.
+ on_event( ).
+ ENDIF.
- METHOD load_output_table.
+ ENDMETHOD.
+
+ METHOD model_init.
- DATA ls_output TYPE ty_s_output.
mt_output = VALUE #( ).
DO 10 TIMES.
- ls_output-index = sy-index.
- ls_output-set_sk = `Test`.
- ls_output-matnr = `1234567`.
- ls_output-description = `Test`.
- ls_output-pl_01 = 0.
- ls_output-pl_02 = 0.
- APPEND ls_output TO mt_output.
+ INSERT VALUE #(
+ index = sy-index
+ set_sk = `Test`
+ matnr = `1234567`
+ description = `Test`
+ pl_01 = 0
+ pl_02 = 0
+ ) INTO TABLE mt_output.
ENDDO.
@@ -73,27 +84,21 @@ CLASS Z2UI5_CL_DEMO_APP_160 IMPLEMENTATION.
METHOD on_event.
- DATA lt_event_arguments TYPE string_table.
-
IF client->check_on_event( `PL_TOTAL_CHANGE` ).
-
- lt_event_arguments = client->get( )-t_event_arg.
- DATA(lv_id_event) = lt_event_arguments[ 1 ].
-
- DATA(lv_tab_index) = lt_event_arguments[ 2 ].
- DATA(ls_row_submit) = mt_output[ lv_tab_index ].
-
- DATA(lv_id_parent) = lt_event_arguments[ 3 ].
-
- client->message_box_display( lv_tab_index && lv_id_event && lv_id_parent ).
+ client->message_box_display(
+ `Id of Input via source object: ` && client->get_event_arg( ) && z2ui5_cl_sample_context=>cv_char_util_newline &&
+ `Id of Input via event.oSource.sId: ` && client->get_event_arg( 2 ) && z2ui5_cl_sample_context=>cv_char_util_newline &&
+ `Value of same row, index: ` && client->get_event_arg( 3 ) && z2ui5_cl_sample_context=>cv_char_util_newline &&
+ `Id of parent (row) via event.oSource.oParent.sId: ` && client->get_event_arg( 4 ) && z2ui5_cl_sample_context=>cv_char_util_newline &&
+ `Attribute of parameters.value: ` && client->get_event_arg( 5 )
+ ).
ENDIF.
- client->view_model_update( ).
ENDMETHOD.
- METHOD render_main_screen.
+ METHOD view_display.
DATA(view) = z2ui5_cl_xml_view=>factory( ).
@@ -106,13 +111,15 @@ CLASS Z2UI5_CL_DEMO_APP_160 IMPLEMENTATION.
)->link(
)->get_parent( ).
- DATA(table) = page->flex_box( height = `85vh` )->ui_table( alternaterowcolors = `true`
- selectionmode = `None`
- visiblerowcountmode = `Auto`
- fixedrowcount = `1`
- rows = client->_bind_edit( val = mt_output
-* compress_mode = z2ui5_if_client=>cs_compress_mode-none
- ) ).
+ page->text( `Make an input and press ENTER` ).
+
+ DATA(table) = page->flex_box( height = `85vh`
+ )->ui_table( alternaterowcolors = `true`
+ selectionmode = `None`
+ visiblerowcountmode = `Auto`
+ fixedrowcount = `1`
+ rows = client->_bind_edit( mt_output )
+ ).
DATA(columns) = table->ui_columns( ).
@@ -122,127 +129,24 @@ CLASS Z2UI5_CL_DEMO_APP_160 IMPLEMENTATION.
columns->ui_column( width = `5rem`
sortproperty = `MATNR`
filterproperty = `MATNR` )->text( `Column 2` )->ui_template( )->text( `{MATNR}` ).
- columns->ui_column( width = `20rem`
- sortproperty = `DESCRIPTION`
- filterproperty = `DESCRIPTION` )->text( `Column 3` )->ui_template( )->text( `{DESCRIPTION}` ).
- columns->ui_column( width = `5rem`
- sortproperty = `IS_TOTAL`
- filterproperty = `IS_TOTAL` )->text( `Column 4` )->ui_template( )->text( `{IS_TOTAL}` ).
-
columns->ui_column( width = `5rem`
sortproperty = `PL_TOTAL`
filterproperty = `PL_TOTAL` )->text( `Column 5` )->ui_template( )->input(
value = `{PL_TOTAL}`
submit = client->_event( val = `PL_TOTAL_CHANGE` t_arg = VALUE #(
( `${$source>/id}` )
+ ( `$event.oSource.sId` )
( `${INDEX}` )
-* ( `$source.oParent.sId` )
( `$event.oSource.oParent.sId` )
- ) ) editable = abap_true
- type = `Number` ).
+ ( `${$parameters>/value}` )
+ ) ) editable = abap_true type = `Number` ).
columns->ui_column( width = `4rem`
sortproperty = `per_cent_total`
- filterproperty = `per_cent_total` )->text( `Column 6` )->ui_template( )->text( `{per_cent_total} %` ).
-
- columns->ui_column( width = `5rem`
- sortproperty = `IS_01_PREV`
- filterproperty = `IS_01_PREV` )->text( `Column 7` )->ui_template( )->text( `{IS_01_PREV}` ).
- columns->ui_column( width = `5rem`
- sortproperty = `PL_01`
- filterproperty = `PL_01` )->text( `Column 8` )->ui_template( )->input( value = `{PL_01}`
- editable = abap_true
- type = `Number` ).
- columns->ui_column( width = `4rem`
- sortproperty = `per_cent_01`
- filterproperty = `per_cent_01` )->text( `Column 9` )->ui_template( )->text( `{per_cent_01} %` ).
-
- columns->ui_column( width = `5rem`
- sortproperty = `IS_02_PREV`
- filterproperty = `IS_02_PREV` )->text( `Column 10` )->ui_template( )->text( `{IS_02_PREV}` ).
- columns->ui_column( width = `5rem`
- sortproperty = `PL_02`
- filterproperty = `PL_02` )->text( `Column 11` )->ui_template( )->input( value = `{PL_02}`
- editable = abap_true
- type = `Number` ).
- columns->ui_column( width = `4rem`
- sortproperty = `per_cent_02`
- filterproperty = `per_cent_02` )->text( `Column 12` )->ui_template( )->text( `{per_cent_02} %` ).
-
- columns->ui_column( width = `5rem`
- sortproperty = `IS_03_PREV`
- filterproperty = `IS_03_PREV` )->text( `Column 13` )->ui_template( )->text( `{IS_03_PREV}` ).
- columns->ui_column( width = `5rem`
- sortproperty = `PL_03`
- filterproperty = `PL_03` )->text( `Column 14` )->ui_template( )->input( value = `{PL_03}`
- editable = abap_true
- type = `Number` ).
- columns->ui_column( width = `4rem`
- sortproperty = `per_cent_03`
- filterproperty = `per_cent_03` )->text( `Column 15` )->ui_template( )->text( `{per_cent_03} %` ).
-
- columns->ui_column( width = `5rem`
- sortproperty = `IS_Q01_PREV`
- filterproperty = `IS_Q01_PREV` )->text( `Column 16` )->ui_template( )->text( `{IS_Q01_PREV}` ).
- columns->ui_column( width = `5rem`
- sortproperty = `PL_Q01`
- filterproperty = `PL_Q01` )->text( `Column 17` )->ui_template( )->text( `{PL_Q01}` ). "Not editable, because it is planned at detail level
- columns->ui_column( width = `4rem`
- sortproperty = `per_cent_q01`
- filterproperty = `per_cent_q01` )->text( `Column 18` )->ui_template( )->text( `{per_cent_q01} %` ).
-
- columns->ui_column( width = `5rem`
- sortproperty = `IS_Q02_PREV`
- filterproperty = `IS_Q02_PREV` )->text( `Column 19` )->ui_template( )->text( `{IS_Q02_PREV}` ).
- columns->ui_column( width = `5rem`
- sortproperty = `PL_Q02`
- filterproperty = `PL_Q02` )->text( `Column 20` )->ui_template( )->input( value = `{PL_Q02}`
- editable = abap_true
- type = `Number` ).
- columns->ui_column( width = `4rem`
- sortproperty = `per_cent_q02`
- filterproperty = `per_cent_q02` )->text( `Column 21` )->ui_template( )->text( `{per_cent_q02} %` ).
-
- columns->ui_column( width = `5rem`
- sortproperty = `IS_Q03_PREV`
- filterproperty = `IS_Q03_PREV` )->text( `Column 22` )->ui_template( )->text( `{IS_Q03_PREV}` ).
- columns->ui_column( width = `5rem`
- sortproperty = `PL_Q03`
- filterproperty = `PL_Q03` )->text( `Column 23` )->ui_template( )->input( value = `{PL_Q03}`
- editable = abap_true
- type = `Number` ).
- columns->ui_column( width = `4rem`
- sortproperty = `per_cent_q03`
- filterproperty = `per_cent_q03` )->text( `Column 24` )->ui_template( )->text( `{per_cent_q03} %` ).
-
- columns->ui_column( width = `5rem`
- sortproperty = `IS_Q04_PREV`
- filterproperty = `IS_Q04_PREV` )->text( `Column 25` )->ui_template( )->text( `{IS_Q04_PREV}` ).
- columns->ui_column( width = `5rem`
- sortproperty = `PL_Q04`
- filterproperty = `PL_Q04` )->text( `Column 26` )->ui_template( )->input( value = `{PL_Q04}`
- editable = abap_true
- type = `Number` ).
- columns->ui_column( width = `4rem`
- sortproperty = `per_cent_q04`
- filterproperty = `per_cent_q04` )->text( `Column 27` )->ui_template( )->text( `{per_cent_q04} %` ).
+ filterproperty = `per_cent_total` )->text( `Column 6` )->ui_template( )->text( `{PL_TOTAL} %` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
-
- METHOD z2ui5_if_app~main.
-
- me->client = client.
- IF client->check_on_init( ).
-
- load_output_table( ).
- render_main_screen( ).
-
- ELSE.
- on_event( ).
- ENDIF.
-
- ENDMETHOD.
ENDCLASS.
diff --git a/src/01/06/z2ui5_cl_demo_app_445.clas.abap b/src/01/06/z2ui5_cl_demo_app_445.clas.abap
new file mode 100644
index 00000000..dbcb0868
--- /dev/null
+++ b/src/01/06/z2ui5_cl_demo_app_445.clas.abap
@@ -0,0 +1,165 @@
+CLASS z2ui5_cl_demo_app_445 DEFINITION PUBLIC.
+
+ PUBLIC SECTION.
+ INTERFACES z2ui5_if_app.
+
+ PROTECTED SECTION.
+ DATA client TYPE REF TO z2ui5_if_client.
+
+ METHODS view_display.
+ METHODS on_event.
+ METHODS popup_display.
+
+ "! Build the label/value rows that show the live device state. The
+ "! `device>` model is a OneWay JSONModel over sap.ui.Device, so the
+ "! bindings below update on their own when the window is resized or the
+ "! device is rotated - no backend round-trip is involved.
+ METHODS device_form
+ IMPORTING
+ parent TYPE REF TO z2ui5_cl_xml_view
+ RETURNING
+ VALUE(result) TYPE REF TO z2ui5_cl_xml_view.
+
+ PRIVATE SECTION.
+ENDCLASS.
+
+
+
+CLASS z2ui5_cl_demo_app_445 IMPLEMENTATION.
+
+ METHOD z2ui5_if_app~main.
+
+ me->client = client.
+ IF client->check_on_init( ).
+ view_display( ).
+ ELSE.
+ on_event( ).
+ ENDIF.
+
+ ENDMETHOD.
+
+
+ METHOD on_event.
+
+ IF client->check_on_event( `OPEN_POPUP` ).
+ popup_display( ).
+ ENDIF.
+
+ ENDMETHOD.
+
+
+ METHOD device_form.
+
+ DATA(form) = parent->simple_form( editable = abap_false
+ layout = `ResponsiveGridLayout` ).
+
+ " a readable label per system type instead of the raw booleans
+ form->label( `System type`
+ )->object_status(
+ text = `{= ${device>/system/phone} ? 'Phone' : (${device>/system/tablet} ? 'Tablet' : (${device>/system/desktop} ? 'Desktop' : 'Other')) }`
+ state = `Information` ).
+
+ form->label( `Orientation`
+ )->object_status(
+ text = `{= ${device>/orientation/landscape} ? 'Landscape' : 'Portrait' }` ).
+
+ " resize/width and resize/height are updated live by UI5
+ form->label( `Window size`
+ )->object_status(
+ text = `{device>/resize/width} x {device>/resize/height} px` ).
+
+ form->label( `Touch support`
+ )->object_status(
+ text = `{= ${device>/support/touch} ? 'Yes' : 'No' }`
+ state = `{= ${device>/support/touch} ? 'Success' : 'None' }` ).
+
+ form->label( `Browser`
+ )->text( `{device>/browser/name} {device>/browser/version}` ).
+
+ form->label( `Operating system`
+ )->text( `{device>/os/name} {device>/os/version}` ).
+
+ result = form.
+
+ ENDMETHOD.
+
+
+ METHOD view_display.
+
+ DATA(view) = z2ui5_cl_xml_view=>factory( ).
+
+ DATA(page) = view->shell(
+ )->page(
+ title = `abap2UI5 - Device Model`
+ navbuttonpress = client->_event_nav_app_leave( )
+ shownavbutton = client->check_app_prev_stack( ) ).
+
+ page->message_strip(
+ text = `The 'device>' model is a one-way JSONModel over sap.ui.Device. ` &&
+ `Resize the window or rotate your device and the values update live - ` &&
+ `no backend round-trip. It is available in this view and in the dialog below.`
+ type = `Information`
+ showicon = abap_true
+ class = `sapUiSmallMargin` ).
+
+ " 1) the raw device state, bound field by field
+ device_form( page->panel( headertext = `Live device properties`
+ class = `sapUiSmallMargin` ) ).
+
+ " 2) an expression binding that reacts to the device type
+ page->message_strip(
+ text = `{= ${device>/system/phone} ? 'Compact layout - you are on a phone.' : 'Full layout - tablet or desktop.' }`
+ type = `{= ${device>/system/phone} ? 'Warning' : 'Success' }`
+ showicon = abap_true
+ class = `sapUiSmallMargin` ).
+
+ " 3) a control whose content collapses on a phone: expanded = !phone
+ DATA(tabs) = page->panel( headertext = `Responsive IconTabBar (expanded only when it is not a phone)`
+ class = `sapUiSmallMargin`
+ )->icon_tab_bar(
+ expanded = `{= !${device>/system/phone} }`
+ class = `sapUiResponsiveContentPadding`
+ )->items( ).
+
+ tabs->icon_tab_filter( text = `Sales` key = `sales` icon = `sap-icon://money-bills`
+ )->text( `On a phone the tab content is collapsed to save space; on tablet/desktop it stays expanded.` ).
+
+ tabs->icon_tab_filter( text = `Stock` key = `stock` icon = `sap-icon://product`
+ )->text( `Everything here is driven purely by the device> model - no event handler.` ).
+
+ " 4) the same device state, but inside a popup (device> now reaches popups too)
+ page->button(
+ text = `Open dialog (device model inside a popup)`
+ icon = `sap-icon://sys-monitor`
+ press = client->_event( `OPEN_POPUP` )
+ class = `sapUiSmallMargin` ).
+
+ client->view_display( view->stringify( ) ).
+
+ ENDMETHOD.
+
+
+ METHOD popup_display.
+
+ DATA(popup) = z2ui5_cl_xml_view=>factory_popup( ).
+
+ " the dialog width itself is driven by the device model
+ DATA(dialog) = popup->dialog(
+ title = `Device model inside a popup`
+ contentwidth = `{= ${device>/system/phone} ? '95%' : '420px' }` ).
+
+ device_form( dialog->content( ) ).
+
+ dialog->footer(
+ )->overflow_toolbar(
+ )->toolbar_spacer(
+ )->button(
+ text = `Close`
+ type = `Emphasized`
+ press = client->_event_client( client->cs_event-popup_close ) ).
+
+ client->popup_display( popup->stringify( ) ).
+
+ ENDMETHOD.
+
+ENDCLASS.
diff --git a/src/01/06/z2ui5_cl_demo_app_445.clas.xml b/src/01/06/z2ui5_cl_demo_app_445.clas.xml
new file mode 100644
index 00000000..0a1649cc
--- /dev/null
+++ b/src/01/06/z2ui5_cl_demo_app_445.clas.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+ Z2UI5_CL_DEMO_APP_445
+ E
+ sap.ui.Device - Device Model in views and popups
+ 1
+ X
+ X
+ X
+
+
+
+
diff --git a/src/01/z2ui5_cl_sample_app_001.clas.abap b/src/01/z2ui5_cl_sample_app_001.clas.abap
index 3aca772d..4b01f4eb 100644
--- a/src/01/z2ui5_cl_sample_app_001.clas.abap
+++ b/src/01/z2ui5_cl_sample_app_001.clas.abap
@@ -225,7 +225,7 @@ CLASS z2ui5_cl_sample_app_001 IMPLEMENTATION.
( group = `framework - basics` header = `More` sub = `Generic Data Reference` app = `z2ui5_cl_demo_app_061` )
( group = `framework - basics` header = `More` sub = `Model Size Limit` app = `z2ui5_cl_demo_app_071` )
( group = `framework - basics` header = `More` sub = `Read Frontend Infos` app = `z2ui5_cl_demo_app_122` )
- ( group = `framework - basics` header = `More` sub = `require sap.m.MessageToast in XML View` app = `z2ui5_cl_demo_app_163` )
+ ( group = `framework - basics` header = `More` sub = `Require Object in XML View` app = `z2ui5_cl_demo_app_163` )
( group = `framework - basics` header = `Nested Views I` sub = `Basic Example` app = `z2ui5_cl_demo_app_065` )
( group = `framework - basics` header = `Nested Views II` sub = `Head & Item Table` app = `z2ui5_cl_demo_app_097` )
( group = `framework - basics` header = `Nested Views III` sub = `Head & Item Table & Detail` app = `z2ui5_cl_demo_app_098` )
@@ -239,8 +239,10 @@ CLASS z2ui5_cl_sample_app_001 IMPLEMENTATION.
( group = `framework - basics` header = `Popup III` sub = `Popup in Popup - Backend Stack Handling` app = `z2ui5_cl_demo_app_161` )
( group = `framework - basics` header = `Templating I` sub = `Basic Example` app = `z2ui5_cl_demo_app_173` )
( group = `framework - basics` header = `Templating II` sub = `Nested Views` app = `z2ui5_cl_demo_app_176` )
+ ( group = `framework - action` header = `Action` sub = `control_call` app = `z2ui5_cl_demo_app_446` )
+ ( group = `framework - action` header = `Action` sub = `control_call_by_id` app = `z2ui5_cl_demo_app_447` )
( group = `framework - action` header = `Browser` sub = `Logout` app = `z2ui5_cl_demo_app_361` )
- ( group = `framework - action` header = `Browsre` sub = `Title` app = `z2ui5_cl_demo_app_125` )
+ ( group = `framework - action` header = `Browser` sub = `Title` app = `z2ui5_cl_demo_app_125` )
( group = `framework - action` header = `Focus I` sub = `Set Focus in Textfield` app = `z2ui5_cl_demo_app_133` )
( group = `framework - action` header = `Focus II` sub = `Jump with the focus` app = `z2ui5_cl_demo_app_189` )
( group = `framework - action` header = `Input` sub = `Clipboard` app = `z2ui5_cl_demo_app_325` )
@@ -266,6 +268,7 @@ CLASS z2ui5_cl_sample_app_001 IMPLEMENTATION.
( group = `framework - use cases` header = `sap.m.Table` sub = `Editable` app = `z2ui5_cl_demo_app_011` )
( group = `framework - use cases` header = `sap.m.Table` sub = `Selection Modes: Single Select & Multi Select` app = `z2ui5_cl_demo_app_019` )
( group = `framework - use cases` header = `sap.m.Table` sub = `Table with sap.m.ScrollContainer` app = `z2ui5_cl_demo_app_006` )
+ ( group = `framework - use cases` header = `sap.ui.Device` sub = `Device Model in views and popups` app = `z2ui5_cl_demo_app_445` )
( group = `framework - use cases` header = `sap.ui.Table` sub = `Events on Cell Level` app = `z2ui5_cl_demo_app_160` )
( group = `framework - use cases` header = `sap.ui.Table` sub = `Filtering` app = `z2ui5_cl_demo_app_143` )
( group = `framework - use cases` header = `sap.ui.Table` sub = `Full Example` app = `z2ui5_cl_demo_app_070` )
diff --git a/src/01/z2ui5_cl_sample_context.clas.abap b/src/01/z2ui5_cl_sample_context.clas.abap
index 09a28ff2..4b8fa2ef 100644
--- a/src/01/z2ui5_cl_sample_context.clas.abap
+++ b/src/01/z2ui5_cl_sample_context.clas.abap
@@ -792,6 +792,12 @@ CLASS z2ui5_cl_sample_context IMPLEMENTATION.
FIELD-SYMBOLS TYPE any.
FIELD-SYMBOLS TYPE any.
+ " an empty search matches everything (and find( sub = `` ) would dump
+ " with CX_SY_STRG_PAR_VAL), so leave the table untouched
+ IF val IS INITIAL.
+ RETURN.
+ ENDIF.
+
DATA(lv_search) = COND string( WHEN ignore_case = abap_true
THEN to_upper( val )
ELSE val ).