Skip to content

Refactor demo apps: improve naming, add new examples, fix bugs - #680

Merged
oblomov-dev merged 16 commits into
standardfrom
claude/abap2ui5-message-box-pr-fwrrj3
Jul 17, 2026
Merged

Refactor demo apps: improve naming, add new examples, fix bugs#680
oblomov-dev merged 16 commits into
standardfrom
claude/abap2ui5-message-box-pr-fwrrj3

Conversation

@oblomov-dev

Copy link
Copy Markdown
Member

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

  • z2ui5_cl_demo_app_160: Renamed methods for clarity (load_output_tablemodel_init, render_main_screenview_display), simplified event handling, and improved data initialization using INSERT VALUE instead of local variable assignment
  • z2ui5_cl_demo_app_120: Extracted view logic into separate view_display() method, improved geolocation error handling with proper event argument access
  • z2ui5_cl_demo_app_074: Renamed data members for clarity (mv_pathfilepath, mv_valuefile, mr_tabletable), improved CSV upload handling with better variable naming, added proper z2ui5_if_app~main implementation
  • z2ui5_cl_demo_app_065: Added mv_count data member and new NEST_MODEL event for nested view model updates
  • z2ui5_cl_demo_app_009: Added validation messages when no selection or multiple selections occur in popup dialogs, added informational message strip to main view
  • z2ui5_cl_demo_app_085: Replaced image control with avatar control in header
  • z2ui5_cl_demo_app_097: Added uuid field to row structure
  • z2ui5_cl_demo_app_098: Changed frontend event from direct tab opening to backend event NN_VIEW
  • z2ui5_cl_demo_app_073: Added URL helper logic for opening new tabs via backend
  • z2ui5_cl_demo_app_316: Minor formatting improvements

New Demo Apps

  • z2ui5_cl_demo_app_445: Demonstrates sap.ui.Device model usage in views and popups with responsive layouts and live device property binding
  • z2ui5_cl_demo_app_446: Showcases control_call action for calling global frontend objects (MessageToast, MessageBox, Theming) without control event wiring
  • z2ui5_cl_demo_app_447: Demonstrates control_call_by_id action for calling whitelisted methods on controls resolved by ID (focus, scrollToIndex)
  • z2ui5_cl_demo_app_086: Simple flow logic demo app called by app 085, displays supplier details

Bug Fixes & Improvements

  • Fixed class name casing in z2ui5_cl_demo_app_160 (CLASS Z2UI5_CL_DEMO_APP_160 → CLASS z2ui5_cl_demo_app_160)
  • Improved event argument handling in z2ui5_cl_demo_app_160 using client->get_event_arg() with proper indices
  • Fixed typo in z2ui5_cl_demo_app_125 description ("Browsre" → "Browser")
  • Updated z2ui5_cl_demo_app_163 description for clarity
  • Added null-check guard in z2ui5_cl_sample_context for empty search strings
  • Improved code formatting and consistency across multiple files

Implementation Details

  • All refactored apps now follow consistent pattern: z2ui5_if_app~main delegates to view_display() on init and on_event() otherwise
  • New device model demo showcases OneWay JSONModel binding with no backend round-trips
  • Control call demos illustrate both global object calls and control-specific method invocation
  • Improved variable naming throughout for better code readability

https://claude.ai/code/session_01YAnf42GPU5rnh9A7pRpYQe

claude and others added 16 commits July 17, 2026 10:27
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
@oblomov-dev
oblomov-dev merged commit ec1efe0 into standard Jul 17, 2026
1 of 5 checks passed
@oblomov-dev
oblomov-dev deleted the claude/abap2ui5-message-box-pr-fwrrj3 branch July 17, 2026 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants