PDF Viewer - Popup
A PDF viewer opening as a popup dialog.
Z2UI5_CL_SMPC_APP_044
Controls
sap.m
UI5 1.71
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_044- Source file
z2ui5_cl_smpc_app_044.clas.abap↗- Library
- sap.m
- UI5 entity
sap.m.PDFViewer- Demo kit sample
sap.m.sample.PDFViewerPopup- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.71 — the floor abap2UI5 holds its samples to
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: pdfviewer, sap.m, pdf, viewer, opening, popup, dialog., carousel, image
Controls it builds
Read out of the builder chain by the abap2UI5 linter, not from the category this sample is filed under — which is what makes “which samples build one of these” a question the catalogue can answer at all.
Libraries
Run it here
The sample running, in this page — the app on its own, with no editor over it.
Switch to Playground with this code
Nothing is installed and nothing is sent anywhere: the ABAP is compiled to JavaScript in this browser and runs against abap2UI5 itself.
The ABAP
z2ui5_cl_smpc_app_044.clas.abap — 89 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords pdfviewer sap.m pdf viewer opening popup dialog. carousel image
" @summary A PDF viewer opening as a popup dialog.
CLASS z2ui5_cl_smpc_app_044 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
" original: onPress feeds the popup-mode PDFViewer via setSource
DATA pdf_source TYPE string.
PROTECTED SECTION.
" images and PDF files of the original sample sap/m/demokit/sample/PDFViewerPopup
CONSTANTS c_base_url TYPE string VALUE `https://sdk.openui5.org/test-resources/sap/m/demokit/sample/PDFViewerPopup/`.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
METHODS on_event.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_044 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_navigated( ).
view_display( ).
ELSEIF client->check_on_event( ).
on_event( ).
ENDIF.
ENDMETHOD.
METHOD view_display.
DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).
view->ele( n = `View` ns = `mvc`
)->a( n = `xmlns` v = `sap.m`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `height` v = `100%`
" original onInit's controller-created PDFViewer, declared in the view's dependents aggregation instead
)->ele( n = `dependents` ns = `mvc`
)->tag( `PDFViewer`
)->a( n = `id` v = `pdfViewer`
)->a( n = `source` v = client->_bind( pdf_source )
)->a( n = `title` v = `My Custom Title`
)->a( n = `isTrustedSource` v = `true`
)->end(
)->ele( `Carousel`
)->a( n = `class` v = `sapUiContentPadding`
)->a( n = `loop` v = `true`
)->ele( `pages`
)->tag( `Image`
)->a( n = `id` v = `image1`
)->a( n = `src` v = c_base_url && `sample1.jpg`
)->a( n = `alt` v = `Example Picture 1`
)->a( n = `press` v = client->_event( val = `SHOW_PDF` arg = `sample1.pdf` )
)->tag( `Image`
)->a( n = `id` v = `image2`
)->a( n = `src` v = c_base_url && `sample2.jpg`
)->a( n = `alt` v = `Example Picture 2`
)->a( n = `press` v = client->_event( val = `SHOW_PDF` arg = `sample2.pdf` ) ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
METHOD on_event.
IF client->get_event( ) = `SHOW_PDF`.
" original onPress setSource + open(): update the bound source, then the whitelisted open runs after render (t_arg positional: id, method; the view defaults to cs_view-main)
pdf_source = c_base_url && client->get_event_arg( ).
client->follow_up_action( val = z2ui5_if_client=>cs_event-control_by_id
t_arg = VALUE #( ( `pdfViewer` )
( `open` ) ) ).
ENDIF.
ENDMETHOD.
ENDCLASS.
More in sap.m
- Message View connected with Message Model — A sample showing how you can connect the MessageView with MessageManager.
- MultiComboBox - Grouping of items — Items in the MultiComboBox could be grouped by a property
- MultiInput — MultiInput provides functionality to add / remove / enter tokens.
- Object Header — This is a Object Header which displays the basic information about objects similar to the…
- Object Status — The object status is a small building block representing a status with a semantic color.
- Panel - Expand / Collapse — Panels also have the possibility to expand/collapse their content (including the infoTool…
- RangeSlider — With the RangeSlider a user can specify range from a numerical interval.
- Scroll Container — The Scroll Container is a control that can display arbitrary content within a limited scr…
- Segmented Button — The Segmented Button allows the user to pick one out of many options for displaying the c…
- Select — Illustrates the usage of a Select in header, footer and content of a page. Note the diffe…
- StepInput — The StepInput allows the user to change stepwise a value by a predefined step and also to…
- Switch — "Some say it is only a switch, I say it is one of the most stylish controls in the univer…
On this page