Samples / Controls / sap.ui.codeeditor
Code Editor
Display or edit source code with syntax highlighting for various source types.
- Class
z2ui5_cl_smpc_app_114- Repository
- abap2UI5/samples-controls
- Ports
sap.ui.codeeditor.sample.CodeEditor- UI5 libraries
- sap.ui.codeeditor, sap.ui.core
- Lowest UI5 release
- 1.71
- In the browser
- Runs in the playground
- Controls it builds
- sap.ui.codeeditor.CodeEditor, sap.ui.core.mvc.View
The class
" @keywords codeeditor code editor sap.ui.codeeditor ace
" @summary Display or edit source code with syntax highlighting for various source types.
" @origin sap.ui.codeeditor.sample.CodeEditor - https://sdk.openui5.org/entity/sap.ui.codeeditor.CodeEditor/sample/sap.ui.codeeditor.sample.CodeEditor (status: reviewed - read against the original, not run)
CLASS z2ui5_cl_smpc_app_114 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_114 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_navigated( ).
view_display( ).
ENDIF.
ENDMETHOD.
METHOD view_display.
DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).
" the JSON value carries literal braces, which the XMLView parser would read
" as a binding - the original escapes them in its own view.xml (value='\{...').
" The escape has to SURVIVE into the serialized attribute, so the braces come
" from `backtick` literals (verbatim) while the body uses |…| templates for
" the real newlines: inside a template \{ would collapse to a bare brace
view->ele( n = `View` ns = `mvc`
)->a( n = `xmlns` v = `sap.ui.codeeditor`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `height` v = `100%`
)->tag( `CodeEditor`
)->a( n = `type` v = `json`
)->a( n = `value` v = `\{` &&
|\n\t\t"Chinese" : "你好世界",| &&
|\n\t\t"Dutch" : "Hallo wereld",| &&
|\n\t\t"English" : "Hello world",| &&
|\n\t\t"French" : "Bonjour monde",| &&
|\n\t\t"German" : "Hallo Welt",| &&
|\n\t\t"Greek" : "γειά σου κόσμος",| &&
|\n\t\t"Italian" : "Ciao mondo",| &&
|\n\t\t"Japanese" : "こんにちは世界",| &&
|\n\t\t"Korean" : "여보세요 세계",| &&
|\n\t\t"Portuguese" : "Olá mundo",| &&
|\n\t\t"Russian" : "Здравствуй мир",| &&
|\n\t\t"Spanish" : "Hola mundo"| &&
|\n\t| && `\}`
)->a( n = `height` v = `300px` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
ENDCLASS.