Refactor demo apps: improve naming, add new examples, fix bugs - #680
Merged
Conversation
Rebuild the "Events on Cell Level" sample: a wider ty_s_output row type, a 10-row model, and a sap.ui.Table whose PL_TOTAL Input submits the cell/row identifiers (source id, event.oSource.sId, row index, oParent.sId, parameters.value) to PL_TOTAL_CHANGE, shown via message_box_display. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
New "framework - use cases" sample showing how to apply the device>
model (a one-way JSONModel over sap.ui.Device):
- a panel binding the raw device state field by field (system type,
orientation, live window size, touch, browser, OS)
- an expression binding that switches a MessageStrip by device type
- an IconTabBar collapsed on phones via expanded="{= !${device>/system/phone} }"
- a dialog that binds the same state (and its own width) - proving the
device> model now reaches popups, not just the main view
The device_form( ) helper builds the label/value rows once and is reused
for both the main view and the popup. Overview (sample_app_001)
regenerated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
IconTabBar has no default aggregation, so IconTabFilter children must go into <items>. Add ->items( ) after icon_tab_bar( ), matching app_117; without it UI5 raises "Cannot add direct child without default aggregation defined for control sap.m.IconTabBar". Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
contentWidth="50%" is a percentage, so the popover first renders at the content's natural width, positions, then resolves 50% and repositions - a visible size jump, compounded by SimpleForm's post-render relayout. Use a fixed 20rem so the popover computes its geometry once. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
The popover form only shows text, so render it read-only (editable = abap_false) with ColumnLayout instead of the default ResponsiveGridLayout - ColumnLayout does not re-measure and re-lay-out on render, removing the second reflow that could still nudge the popover. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
- Render the geo fields read-only (editable = abap_false) - they only
display the values the Geolocation control writes.
- Bind the control's new `error` event to a GEOLOCATION_ERROR roundtrip,
passing code + message via ${$parameters>/...}, and show the reason
from the backend with message_box_display.
- Collapse the duplicated init/MAP_CONTAINER_DISPLAY views into one
view_display( ) method.
Note: the geolocation `error` parameter needs the matching abap2UI5
framework change; abaplint flags it until that is deployed to main.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
New "Update only nested MODEL" button changes a nest-bound field (mv_input_nest) and calls nest_view_model_update( ) - refreshing only the nested view's model copy without re-rendering its XML, so the effect of the method is visible on its own. A counter makes the value change on each press. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
- Enable the "Clear" and "Send to Server" buttons - both were enabled=abap_false, so their handlers could never be triggered. - Add an intro MessageStrip explaining the four value-help patterns. - Give "Send" a paper-plane icon to match "Clear". - The two popup "continue" handlers now toast "please select exactly one ..." instead of silently doing nothing when the selection is not a single row. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
The MAP_CONTAINER_DISPLAY handler is gone, so the button only fired an empty roundtrip. Drop the button and its label; the form ends at Speed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
Take the simpler uploader flow (decode the file and show its text in a message box). Cleanups: drop the identical-branch COND (both sides were _bind_edit) and the two unused check flags; remove Hungarian prefixes per the style guide; put main first and merge the init/navigated branches; clear the bound fields before re-rendering; merge the duplicated column / cell loops into one. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
itab_filter_by_val ran find( sub = lv_search ) with an empty search
string, which raises CX_SY_STRG_PAR_VAL ("value '' not permitted for
parameter SUB of FIND") - hit in demo_app_059 when the search field is
cleared to empty. An empty search matches everything, so return early and
leave the table unfiltered.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
Two "framework - action" samples: - 446 "Action - control_call": buttons that let the backend call global frontend objects (MessageToast.show, MessageBox.show, Theming.setTheme). - 447 "Action - control_call_by_id": focus() an input and scrollToIndex() a 30-row table, both by control id. Overview regenerated. Note: both use the new client->control_call / control_call_by_id methods; samples abaplint flags them as "method not found" until the abap2UI5 framework change is deployed to main. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR refactors several demo applications to improve code clarity and maintainability, adds three new demo apps showcasing advanced features, and fixes bugs in existing apps.
Key Changes
Refactored Apps
load_output_table→model_init,render_main_screen→view_display), simplified event handling, and improved data initialization usingINSERT VALUEinstead of local variable assignmentview_display()method, improved geolocation error handling with proper event argument accessmv_path→filepath,mv_value→file,mr_table→table), improved CSV upload handling with better variable naming, added properz2ui5_if_app~mainimplementationmv_countdata member and newNEST_MODELevent for nested view model updatesimagecontrol withavatarcontrol in headeruuidfield to row structureNN_VIEWNew Demo Apps
sap.ui.Devicemodel usage in views and popups with responsive layouts and live device property bindingcontrol_callaction for calling global frontend objects (MessageToast, MessageBox, Theming) without control event wiringcontrol_call_by_idaction for calling whitelisted methods on controls resolved by ID (focus, scrollToIndex)Bug Fixes & Improvements
client->get_event_arg()with proper indicesImplementation Details
z2ui5_if_app~maindelegates toview_display()on init andon_event()otherwisehttps://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe