riena emf dynamic views

Example – redView UI Templates

to make the development process of UI easier, the redView Designer Editor can use templates.

There’s an Example project available:


What are redView Templates

Redview templates allow you to save parts of a view as a reusable template. This template can be saved and used later again. So the development of uis can be optimized.

You do not have to model ui components like an address composite again and again. Design it once, save as a template and reuse in the designer editor whenever you like.

Where can you store redView templates

Redview offers an extension point org.redview.core.uitemplates.service.templateProvider.exsd which allows you to store your template everywhere you want.

But offcourse, redview also provides default features to provide your templates.

Default template storage

– uitTemplateStore

The extension point org.redview.core.uitemplates.provider.manager.uitemplateStore.exsd allows you to specify a folder inside your plugin, where you can put your templates.

All files contained their have to be valid ui templates and the extension of the file name must be called uitemplate. How to create your own template see below.

If you have specified this extension, all the uiTemplates inside of this folder are shown as actions in the designer editors popup menu.

– Workspace or file system

Additionally you can save your templates in the workspace or somewhere at the file system. RedViews designer editor allows you to load these templates by a dialog.

– Do it your way

If you want to use your own way to load templates, you can use org.redview.core.uitemplates.service.templateProvider.exsd to write your own provider.

Therefore see following implemenations:

  • org.redview.examples.templates.coded.ExampleTemplatesProvider
  • org.redview.core.uitemplates.provider.manager.ManagerTemplatesProvider

How to create templates

By the redView’s designer

It is really easy to create your own templates.

To do so, select an ui component inside the designer editor, open the popup menu and select “save as template”. This action will open an dialog which allows you to save your templates.

This dialog is divided into 3 parts:

Location part

The location part lets you specify a location to save the file. One template file can contain MANY templates.

Contents part on the right side

The contents part shows you already contained templates in this file. If you select an template in the list, you can replace it by the current template.

Definition part at the buttom of the dialog

The definition part allows you to specify the name and description of the template to save.

Coded templates

Of course, you can create templates by code and provide them. See org.redview.examples.templates.coded.ExampleTemplatesProvider.

%d bloggers like this: