mirror of
https://github.com/abap2UI5/abap2UI5.git
synced 2025-04-29 23:06:30 +08:00
parent
c7b0228b64
commit
827d0522bb
|
@ -15,7 +15,8 @@ public section.
|
|||
class-methods FACTORY_POPUP
|
||||
importing
|
||||
!T_NS type Z2UI5_IF_CLIENT=>TY_T_NAME_VALUE optional
|
||||
!CLIENT type ref to Z2UI5_IF_CLIENT
|
||||
!CLIENT type ref to Z2UI5_IF_CLIENT optional
|
||||
PREFERRED PARAMETER client
|
||||
returning
|
||||
value(RESULT) type ref to Z2UI5_CL_XML_VIEW .
|
||||
methods CONSTRUCTOR .
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
|
||||
<asx:values>
|
||||
<DEVC>
|
||||
<CTEXT>abap2UI5 - more functions & popups (ui)</CTEXT>
|
||||
<CTEXT>abap2UI5 - more features (ui)</CTEXT>
|
||||
</DEVC>
|
||||
</asx:values>
|
||||
</asx:abap>
|
||||
|
|
|
@ -4,11 +4,103 @@ CLASS z2ui5_cl_ui_pop_to_confirm DEFINITION
|
|||
CREATE PUBLIC .
|
||||
|
||||
PUBLIC SECTION.
|
||||
|
||||
INTERFACES z2ui5_if_app.
|
||||
|
||||
CLASS-METHODS factory
|
||||
IMPORTING
|
||||
i_question_text TYPE string
|
||||
i_title TYPE string DEFAULT `Title`
|
||||
i_icon TYPE string DEFAULT 'sap-icon://question-mark'
|
||||
i_button_text_confirm TYPE string DEFAULT `OK`
|
||||
i_button_text_cancel TYPE string DEFAULT `Cancel`
|
||||
RETURNING
|
||||
VALUE(r_result) TYPE REF TO z2ui5_cl_ui_pop_to_confirm.
|
||||
|
||||
METHODS check_result
|
||||
RETURNING
|
||||
VALUE(result) TYPE abap_bool.
|
||||
|
||||
PROTECTED SECTION.
|
||||
DATA client TYPE REF TO z2ui5_if_client.
|
||||
|
||||
DATA title TYPE string.
|
||||
DATA icon TYPE string.
|
||||
DATA question_text TYPE string.
|
||||
DATA button_text_confirm TYPE string.
|
||||
DATA button_text_cancel TYPE string.
|
||||
DATA check_initialized TYPE abap_bool.
|
||||
DATA check_result_confirmed TYPE abap_bool.
|
||||
METHODS view_display.
|
||||
PRIVATE SECTION.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
||||
CLASS Z2UI5_CL_UI_POP_TO_CONFIRM IMPLEMENTATION.
|
||||
|
||||
|
||||
METHOD check_result.
|
||||
|
||||
result = check_result_confirmed.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD factory.
|
||||
|
||||
r_result = new #( ).
|
||||
r_result->title = i_title.
|
||||
r_result->icon = i_icon.
|
||||
r_result->question_text = i_question_text.
|
||||
r_result->button_text_confirm = i_button_text_confirm.
|
||||
r_result->button_text_cancel = i_button_text_cancel.
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD view_display.
|
||||
|
||||
DATA(popup) = z2ui5_cl_xml_view=>factory_popup( )->dialog(
|
||||
title = title
|
||||
icon = icon
|
||||
)->content(
|
||||
)->vbox( 'sapUiMediumMargin'
|
||||
)->text( question_text
|
||||
)->get_parent( )->get_parent(
|
||||
)->footer( )->overflow_toolbar(
|
||||
)->toolbar_spacer(
|
||||
)->button(
|
||||
text = button_text_cancel
|
||||
press = client->_event( 'BUTTON_CANCEL' )
|
||||
)->button(
|
||||
text = button_text_confirm
|
||||
press = client->_event( 'BUTTON_CONFIRM' )
|
||||
type = 'Emphasized' ).
|
||||
|
||||
client->popup_display( popup->stringify( ) ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
|
||||
METHOD z2ui5_if_app~main.
|
||||
|
||||
me->client = client.
|
||||
|
||||
IF check_initialized = abap_false.
|
||||
check_initialized = abap_true.
|
||||
view_display( ).
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
CASE client->get( )-event.
|
||||
WHEN `BUTTON_CONFIRM`.
|
||||
check_result_confirmed = abap_true.
|
||||
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
|
||||
WHEN `BUTTON_CANCEL`.
|
||||
check_result_confirmed = abap_false.
|
||||
client->nav_app_leave( client->get_app( client->get( )-s_draft-id_prev_app_stack ) ).
|
||||
ENDCASE.
|
||||
|
||||
ENDMETHOD.
|
||||
ENDCLASS.
|
||||
|
|
Loading…
Reference in New Issue
Block a user