Skip to content

Commit bc01c27

Browse files
authored
Merge pull request #68 from abap2UI5/claude/split-event-page-sections-9drDr
Reorganize documentation structure for events and controller
2 parents 5ba0a1b + 91f153e commit bc01c27

13 files changed

Lines changed: 275 additions & 180 deletions

File tree

docs/.vitepress/config.mjs

Lines changed: 40 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ export default defineConfig({
6060
text: "Guide",
6161
items: [
6262
{ text: "Introduction", link: "/get_started/about" },
63-
{ text: "Cookbook", link: "/development/general" },
63+
{ text: "Cookbook", link: "/development/controller/life_cycle" },
6464
{ text: "Configuration", link: "/configuration/setup" },
6565
{ text: "Advanced Topic", link: "/advanced/downporting" },
6666
{ text: "Technical Insight", link: "/technical/concept" },
@@ -114,10 +114,20 @@ export default defineConfig({
114114
},
115115
{
116116
text: "Cookbook",
117-
link: "/development/general",
117+
link: "/development/controller/life_cycle",
118118
collapsed: true,
119119
items: [
120-
{ text: "Controller", link: "/development/general" },
120+
{
121+
text: "Controller",
122+
link: "/development/controller/life_cycle",
123+
collapsed: true,
124+
items: [
125+
{ text: "Life Cycle", link: "/development/controller/life_cycle" },
126+
{ text: "Init", link: "/development/controller/init" },
127+
{ text: "Event", link: "/development/controller/event" },
128+
{ text: "Navigated", link: "/development/controller/navigated" },
129+
],
130+
},
121131
{
122132
text: "View",
123133
collapsed: true,
@@ -137,12 +147,22 @@ export default defineConfig({
137147
{ text: "OData", link: "/development/model/odata" },
138148
],
139149
},
140-
{ text: "Event", link: "/development/events" },
150+
{
151+
text: "Event",
152+
link: "/development/events/backend",
153+
collapsed: true,
154+
items: [
155+
{ text: "Backend", link: "/development/events/backend" },
156+
{ text: "Frontend", link: "/development/events/frontend" },
157+
{ text: "Follow-up", link: "/development/events/follow_up" },
158+
],
159+
},
141160
{
142161
text: "Navigation",
143-
link: "/development/navigation/navigation",
162+
link: "/development/navigation/inner_cross_app",
144163
collapsed: true,
145164
items: [
165+
{ text: "Inner, Cross App", link: "/development/navigation/inner_cross_app" },
146166
{ text: "App State", link: "/development/navigation/app_state" },
147167
{
148168
text: "Share, Bookmark",
@@ -158,10 +178,9 @@ export default defineConfig({
158178
{ text: "Message", link: "/development/messages/messages" },
159179
{ text: "Error", link: "/development/messages/errors" },
160180
{ text: "Logging", link: "/development/messages/logging" },
161-
{ text: "CL_DEMO_OUTPUT", link: "/development/specific/demo_output" },
181+
{ text: "Translation, i18n", link: "/development/translation" },
162182
],
163183
},
164-
{ text: "Translation, i18n", link: "/development/translation" },
165184
{
166185
text: "Popup, Popover",
167186
link: "/development/popups/popup",
@@ -213,6 +232,13 @@ export default defineConfig({
213232
{ text: "Lock", link: "/development/specific/locks" },
214233
{ text: "Statefulness", link: "/development/specific/statefulness" },
215234
{ text: "Logout", link: "/configuration/logout" },
235+
{
236+
text: "More",
237+
collapsed: true,
238+
items: [
239+
{ text: "Demo Output", link: "/development/specific/demo_output" },
240+
],
241+
},
216242
],
217243
},
218244
],
@@ -228,7 +254,7 @@ export default defineConfig({
228254
{ text: "Authorization", link: "/configuration/authorization" },
229255
{ text: "Performance", link: "/configuration/performance" },
230256
{ text: "UI5 Version", link: "/configuration/ui5_versions" },
231-
{ text: "Productive Usage", link: "/configuration/productive_usage" },
257+
{ text: "Production Use", link: "/configuration/productive_usage" },
232258
{ text: "Debugging", link: "/configuration/troubleshooting" },
233259
{ text: "Fiori Launchpad", link: "/configuration/launchpad" },
234260
{
@@ -239,7 +265,7 @@ export default defineConfig({
239265
text: "S/4 Public Cloud",
240266
link: "/configuration/s4_public_cloud",
241267
},
242-
{ text: "BTP ABAP Env", link: "/configuration/btp_abap_env" },
268+
{ text: "BTP ABAP Environment", link: "/configuration/btp_abap_env" },
243269
{ text: "Build Work Zone", link: "/configuration/btp" },
244270
{ text: "Mobile Start", link: "/configuration/mobile_start" },
245271
],
@@ -253,8 +279,8 @@ export default defineConfig({
253279
items: [
254280
{ text: "Downporting", link: "/advanced/downporting" },
255281
{ text: "Renaming", link: "/advanced/renaming" },
256-
{ text: "Builder", link: "/advanced/builds" },
257-
{ text: "Local", link: "/advanced/local" },
282+
{ text: "Build Process", link: "/advanced/builds" },
283+
{ text: "Local Setup", link: "/advanced/local" },
258284
{ text: "RFC Connector", link: "/advanced/rfc" },
259285
{ text: "HTTP Connector", link: "/advanced/http" },
260286
{ text: "Fiori Elements Integration", link: "/advanced/fiori" },
@@ -267,7 +293,7 @@ export default defineConfig({
267293
text: "User Exit",
268294
link: "/advanced/extensibility/user_exits",
269295
},
270-
{ text: "Custom JS", link: "/advanced/extensibility/custom_js" },
296+
{ text: "Custom JavaScript", link: "/advanced/extensibility/custom_js" },
271297
{ text: "Frontend", link: "/advanced/extensibility/frontend" },
272298
{
273299
text: "Custom Control",
@@ -300,14 +326,15 @@ export default defineConfig({
300326
{
301327
text: "Technology",
302328
link: "/technical/technology/overview",
329+
collapsed: true,
303330
items: [
304331
{ text: "RAP", link: "/technical/technology/rap" },
305332
{ text: "UI5 Freestyle", link: "/technical/technology/ui5" },
306333
],
307334
},
308335
{
309336
text: "Tool",
310-
collapsed: false,
337+
collapsed: true,
311338
items: [
312339
{ text: "abapGit", link: "/technical/tools/abapgit" },
313340
{ text: "ajson", link: "/technical/tools/ajson" },

docs/configuration/launchpad.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ Use these parameters for target mapping in your Launchpad configuration:
1616
- ID: `z2ui5`
1717
- Parameter: `app_start / Z2UI5_CL_MY_APP`
1818

19+
### Cross App Navigation
20+
We recommend backend communication only for view changes or popup calls. With a Launchpad, consider navigating via the Launchpad to use browser navigation and history:
21+
```abap
22+
client->_event_client(
23+
val = client->cs_event-cross_app_nav_to_ext
24+
t_arg = VALUE #( (
25+
`{ semanticObject: "Z2UI5_CL_LP_SAMPLE_04", action: "display" }`
26+
) ) ).
27+
```
28+
1929
### Troubleshooting
2030
Sometimes installation via abapGit causes cache-related issues. Here's how to clear them:
2131

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
outline: [2, 4]
3+
---
4+
# Controller
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
outline: [2, 4]
3+
---
4+
# Event
5+
6+
`client->check_on_event` returns `abap_true` when the request was triggered by a user event. Read the event name with `client->get( )-event` and dispatch to the matching handler.
7+
8+
```abap
9+
METHOD z2ui5_if_app~main.
10+
11+
me->client = client.
12+
CASE abap_true.
13+
WHEN client->check_on_event( ).
14+
on_event( ).
15+
ENDCASE.
16+
17+
ENDMETHOD.
18+
19+
METHOD on_event.
20+
21+
DATA(lt_arg) = client->get_event_arg( ).
22+
23+
CASE client->get( )-event.
24+
WHEN `BUTTON_POST`.
25+
client->message_toast_display( |{ mv_value } - send to the server| ).
26+
ENDCASE.
27+
28+
ENDMETHOD.
29+
```
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
outline: [2, 4]
3+
---
4+
# Init
5+
6+
`client->check_on_init` returns `abap_true` on the first request. Use this branch to initialize app data and render the initial view.
7+
8+
```abap
9+
METHOD z2ui5_if_app~main.
10+
11+
me->client = client.
12+
CASE abap_true.
13+
WHEN client->check_on_init( ).
14+
on_init( ).
15+
display_view( ).
16+
ENDCASE.
17+
18+
ENDMETHOD.
19+
20+
METHOD on_init.
21+
22+
mv_value = `value`.
23+
24+
ENDMETHOD.
25+
26+
METHOD display_view.
27+
28+
DATA(view) = z2ui5_cl_xml_view=>factory( ).
29+
view->shell( )->page(
30+
)->simple_form( title = `Form Title` editable = abap_true
31+
)->content( `form`
32+
)->title( `Input`
33+
)->label( `value`
34+
)->input( client->_bind_edit( mv_value )
35+
)->button(
36+
text = `post`
37+
press = client->_event( `BUTTON_POST` ) ).
38+
client->view_display( view->stringify( ) ).
39+
40+
ENDMETHOD.
41+
```
Lines changed: 3 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
outline: [2, 4]
33
---
4-
# Controller
4+
# Life Cycle
55

66
abap2UI5 gives you great flexibility in how you structure apps. Most sample apps follow the pattern below. Use it as a starting point, and tweak it or build a wrapper around abap2UI5 for more specific behavior.
77

8-
The idea: every request enters the `main` method, and you use `CASE` to dispatch between initialization, navigation returns, and user events.
8+
The idea: every request enters the `main` method, and you use `CASE` to dispatch between initialization, navigation returns, and user events. The recommended pattern uses `CASE abap_true` together with `client->check_on_init`, `client->check_on_event`, and `client->check_on_navigated` to dispatch to the matching handler method.
99

1010
```abap
1111
CLASS z2ui5_cl_demo_app_001 DEFINITION PUBLIC.
@@ -45,45 +45,7 @@ CLASS z2ui5_cl_demo_app_001 IMPLEMENTATION.
4545
4646
ENDMETHOD.
4747
48-
METHOD on_init.
49-
50-
mv_value = `value`.
51-
52-
ENDMETHOD.
53-
54-
METHOD display_view.
55-
56-
DATA(view) = z2ui5_cl_xml_view=>factory( ).
57-
view->shell( )->page(
58-
)->simple_form( title = `Form Title` editable = abap_true
59-
)->content( `form`
60-
)->title( `Input`
61-
)->label( `value`
62-
)->input( client->_bind_edit( mv_value )
63-
)->button(
64-
text = `post`
65-
press = client->_event( `BUTTON_POST` ) ).
66-
client->view_display( view->stringify( ) ).
67-
68-
ENDMETHOD.
69-
70-
METHOD on_event.
71-
72-
DATA(lt_arg) = client->get_event_arg( ).
73-
74-
CASE client->get( )-event.
75-
WHEN `BUTTON_POST`.
76-
client->message_toast_display( |{ mv_value } - send to the server| ).
77-
ENDCASE.
78-
79-
ENDMETHOD.
80-
81-
METHOD on_navigated.
82-
83-
DATA(lo_app_prev) = client->get_app_prev( ).
84-
85-
ENDMETHOD.
86-
8748
ENDCLASS.
8849
```
50+
8951
See the dedicated sections of this development guide for full details on views, events, data binding, and navigation.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
outline: [2, 4]
3+
---
4+
# Navigated
5+
6+
`client->check_on_navigated` returns `abap_true` when the user returns from another app. Use `client->get_app_prev` to access the previous app instance and read any data it returns.
7+
8+
```abap
9+
METHOD z2ui5_if_app~main.
10+
11+
me->client = client.
12+
CASE abap_true.
13+
WHEN client->check_on_navigated( ).
14+
on_navigated( ).
15+
ENDCASE.
16+
17+
ENDMETHOD.
18+
19+
METHOD on_navigated.
20+
21+
DATA(lo_app_prev) = client->get_app_prev( ).
22+
23+
ENDMETHOD.
24+
```

0 commit comments

Comments
 (0)