Difference between revisions of "E4/UI/Modeled UI"

From Eclipsepedia

< E4‎ | UI
Jump to: navigation, search
(UI Model)
(Window)
 
(18 intermediate revisions by one user not shown)
Line 61: Line 61:
 
</tr>
 
</tr>
 
<tr>
 
<tr>
 +
<td></td>
 +
<td>y</td>
 +
<td>int</td>
 +
<td>The y position on the screen</td>
 +
</tr>
 +
<tr style='background-color: #DDDDDD'>
 
<td></td>
 
<td></td>
 
<td>width</td>
 
<td>width</td>
Line 66: Line 72:
 
<td>The width of the window</td>
 
<td>The width of the window</td>
 
</tr>
 
</tr>
<tr style='background-color: #DDDDDD'>
+
<tr>
 
<td></td>
 
<td></td>
 
<td>height</td>
 
<td>height</td>
Line 72: Line 78:
 
<td>The height of the window</td>
 
<td>The height of the window</td>
 
</tr>
 
</tr>
<tr>
+
<tr style='background-color: #DDDDDD'>
 
<td></td>
 
<td></td>
 
<td>windows</td>
 
<td>windows</td>
Line 78: Line 84:
 
<td>Child Windows</td>
 
<td>Child Windows</td>
 
</tr>
 
</tr>
<tr style='background-color: #DDDDDD'>
+
<tr>
 
<td></td>
 
<td></td>
 
<td>sharedElements</td>
 
<td>sharedElements</td>
 
<td>List<UIElement></td>
 
<td>List<UIElement></td>
<td></td>
+
<td>Shared Elements are quite an advanced concept coming into Eclipse through perspectives. Normally an UI-Tree is made up of only contaiments but without the idea of links. In an Eclipse Application this is not necessarily this way because e.g. the editor-area with all its editors is shared between different parts of the model (the perspectives), the same holds true for certain parts (e.g. the Package Explorer). The currently supported elements to share are MPart and MPartSashContainer</td>
 
</tr>
 
</tr>
 
<tr style='background-color: #777; color: white; font-weight: bold;'>
 
<tr style='background-color: #777; color: white; font-weight: bold;'>
Line 282: Line 288:
  
 
==== Containers ====
 
==== Containers ====
 +
 +
There are 2 default containers used by e4 applications to build the UI-Tree PartSashContainer und PartStack. The difference between them is that PartSashContainer is designed to show all of its children at once whereas PartStack is showing only one of its children at a time.
  
 
[[Image:e4_model_container.png]]
 
[[Image:e4_model_container.png]]
Line 292: Line 300:
  
 
'''Attributes:'''
 
'''Attributes:'''
 +
<table border='0' cellpadding='5' cellspacing='0'>
 +
<tr>
 +
<th>Class</th>
 +
<th>Attribute</th>
 +
<th>Type</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td>MPartSashContainer</td>
 +
<td></td>
 +
<td></td>
 +
<td></td>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td>MGenericTile</td>
 +
<td></td>
 +
<td></td>
 +
<td></td>
 +
</tr>
 +
<tr>
 +
<td></td>
 +
<td>horizontal</td>
 +
<td>boolean</td>
 +
<td>true if all children are aligned next to each other horizontally</td>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td>MElementContainer</td>
 +
<td></td>
 +
<td></td>
 +
<td></td>
 +
</tr>
 +
<tr>
 +
<td></td>
 +
<td>children</td>
 +
<td>List<MPartSashContainerElement></td>
 +
<td>Child elements layed out in the container depending on the horizontal attribute</td>
 +
</tr>
 +
<tr style='background-color: #DDDDDD'>
 +
<td></td>
 +
<td>selectedElement</td>
 +
<td>MWindowElement</td>
 +
<td>The currently active childcontrol</td>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td>MUIElement</td>
 +
<td></td>
 +
<td></td>
 +
<td></td>
 +
</tr>
 +
<tr style='background-color: #DDDDDD'>
 +
<td></td>
 +
<td>widget</td>
 +
<td>Object</td>
 +
<td>the real UI-Control (e.g. SWT-Widget) rendering the element</td>
 +
</tr>
 +
<tr>
 +
<td></td>
 +
<td>renderer</td>
 +
<td>Object</td>
 +
<td>The renderer resposible to create the UI-Control and sync it with the elements attribute</td>
 +
</tr>
 +
<tr style='background-color: #DDDDDD'>
 +
<td></td>
 +
<td>toBeRendered</td>
 +
<td>boolean</td>
 +
<td></td>
 +
</tr>
 +
<tr>
 +
<td></td>
 +
<td>onTop</td>
 +
<td>boolean</td>
 +
<td></td>
 +
</tr>
 +
<tr style='background-color: #DDDDDD'>
 +
<td></td>
 +
<td>visible</td>
 +
<td>boolean</td>
 +
<td></td>
 +
</tr>
 +
<tr>
 +
<td></td>
 +
<td>parent</td>
 +
<td>MElementContainer<MUIElement></td>
 +
<td>The parent container</td>
 +
</tr>
 +
<tr style='background-color: #DDDDDD'>
 +
<td></td>
 +
<td>containerData</td>
 +
<td>String</td>
 +
<td></td>
 +
</tr>
 +
<tr>
 +
<td></td>
 +
<td>curSharedRef</td>
 +
<td>MPlaceholder</td>
 +
<td></td>
 +
</tr>
 +
<tr style='background-color: #DDDDDD'>
 +
<td></td>
 +
<td>visibleWhen</td>
 +
<td>MExpression</td>
 +
<td></td>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td>MApplicationElement</td>
 +
<td></td>
 +
<td></td>
 +
<td></td>
 +
</tr>
 +
<tr style='background-color: #DDDDDD'>
 +
<td></td>
 +
<td>elementId</td>
 +
<td>String</td>
 +
<td>id to identify the element e.g. when contributing</td>
 +
</tr>
 +
<tr>
 +
<td></td>
 +
<td>tags</td>
 +
<td>List<String></td>
 +
<td>Arbitary strings used to tag elements so that one can query for them</td>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td colspan='4'>MPartSashContainerElement (Marker)</td>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td>MWindowElement (Marker)</td>
 +
<td></td>
 +
<td></td>
 +
<td></td>
 +
</tr>
 +
</table>
  
 
===== PartStack =====
 
===== PartStack =====
Line 312: Line 451:
  
 
'''Attributes:'''
 
'''Attributes:'''
 +
<table border='0' cellpadding='5' cellspacing='0'>
 +
<tr>
 +
<th>Class</th>
 +
<th>Attribute</th>
 +
<th>Type</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td>MPart</td>
 +
<td></td>
 +
<td></td>
 +
<td></td>
 +
</tr>
 +
</table>
  
 
===== InputPart =====
 
===== InputPart =====
Line 320: Line 473:
  
 
'''Attributes:'''
 
'''Attributes:'''
 +
<table border='0' cellpadding='5' cellspacing='0'>
 +
<tr>
 +
<th>Class</th>
 +
<th>Attribute</th>
 +
<th>Type</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td>MInputPart</td>
 +
<td></td>
 +
<td></td>
 +
<td></td>
 +
</tr>
 +
</table>
  
 
==== Other Elements ====
 
==== Other Elements ====
Line 329: Line 496:
  
 
'''Attributes:'''
 
'''Attributes:'''
 +
<table border='0' cellpadding='5' cellspacing='0'>
 +
<tr>
 +
<th>Class</th>
 +
<th>Attribute</th>
 +
<th>Type</th>
 +
<th>Description</th>
 +
</tr>
 +
<tr style='background-color: #777; color: white; font-weight: bold;'>
 +
<td>MTrimBar</td>
 +
<td></td>
 +
<td></td>
 +
<td></td>
 +
</tr>
 +
</table>
 +
 +
=== Menu, Toolbar &amp; Trim UI Domain Objects ===
 +
 +
==== Menu ====
 +
 +
===== Menu =====
 +
===== PopupMenu =====
 +
 +
==== ToolBar ====
  
=== Menu &amp; Toolbar UI Domain Objects ===
+
==== Trim ====
  
 
=== Advanced UI Domain Objects ===
 
=== Advanced UI Domain Objects ===
Line 336: Line 526:
 
=== Descriptors ===
 
=== Descriptors ===
  
== Logical Model ==
+
== Application Logic Layer ==
  
 
=== Command, Handlers &amp; Expressions ===
 
=== Command, Handlers &amp; Expressions ===

Latest revision as of 16:43, 21 June 2010

Contents

[edit] Overview

An e4 application is completely backed up by a domain model often called Workbench or Application Model but in contrast to e.g. the browser DOM which only holds visual elements the e4 application model also holds other informations relevant to an e4 application (e.g. commands, handlers, ...). This makes the e4 application model the center of each e4 application.

From a technical point of view the e4 application model is defined using EMFs Ecore meta model. For an average user the usage of EMF in the background is completely transparent and you don't need to know about EMF to write an develop e4 applications (you won't even notice that you are using EMF because the API presented to you is not holding EMF-Types). For people who'd like to extend the workbench model a certain knowlegde about EMF is certainly needed.

[edit] UI Layer

As outlined before the application model holds the main UI structure of an e4 application. When we talk about the main UI structure this means everything part of the Application Window (Menus, PartStacks, ...) and e.g. Part menus but not the UI shown inside an application Part (e.g. the Tree in the PackageExplorer)

The following screenshot displays the domain model making up the ui on the left and the rendered application Modeled app.jpg

One of the most important things when talking about the application model we need to know that ALL modification made in the model are immediately reflected in the UI. It is in contrast so that you are only programming against the application model and not against its visual representation. This now is indeed similar to how you are implementing Browser-Applications where also modify the DOM and the browser updates the visual representation.


The ui-domain objects are organized in 3 different packages:

  • menu: Holding menu and toolbar domain objects
  • basic: Basic UI domain objects e.g. to create windows, stacks, ...
  • advanced: Advanced UI domain objects e.g. to create perspectives

[edit] Basic UI Domain Objects

These domain objects are needed to write a simple to medium size e4 application providing you with the most common UI concepts like Window, Sash and Stack.

[edit] Windows

There are 2 domain types available to define a window in your application.

E4 model window.jpg

[edit] Window

Represents a standard window used by application who are not in need of advanced stuff.

Inheritance:

E4 model window inheritance.png

Attributes:

Class Feature Type Description
MWindow
mainMenu Menu The main menu shown in the menubar of the Shell
x int The x position on the screen
y int The y position on the screen
width int The width of the window
height int The height of the window
windows List<Window> Child Windows
sharedElements List<UIElement> Shared Elements are quite an advanced concept coming into Eclipse through perspectives. Normally an UI-Tree is made up of only contaiments but without the idea of links. In an Eclipse Application this is not necessarily this way because e.g. the editor-area with all its editors is shared between different parts of the model (the perspectives), the same holds true for certain parts (e.g. the Package Explorer). The currently supported elements to share are MPart and MPartSashContainer
MBindings
bindingContexts List<String> Keybinding contexts active in this window
MContext
context IEclipseContext The IEclipseContext used by the DI-Framework for injection
variables List<String> Variables defined in this context (see IEclipseContext description)
MElementContainer
children List<MWindowElement> Child elements layouted in the windows content pane
selectedElement MWindowElement The currently active childcontrol
MUIElement
widget Object the real UI-Control (e.g. SWT-Widget) rendering the element
renderer Object The renderer resposible to create the UI-Control and sync it with the elements attribute
toBeRendered boolean
onTop boolean
visible boolean
parent MElementContainer<MUIElement> The parent container
containerData String
curSharedRef MPlaceholder
visibleWhen MExpression
MApplicationElement
elementId String id to identify the element e.g. when contributing
tags List<String> Arbitary strings used to tag elements so that one can query for them
MHandlerContainer
handlers List<MHandler> list of handlers
MUILabel
label String The label displayed on the window
iconURI String The icon displayed on the window
tooltip String
[edit] TrimmedWindow

Represents a window with TrimBars e.g. to show a ToolBar at the top, a StatusBar at the bottom and minimized Stacks at the right and left

Inheritance:

E4 model trimmed window inheritance.png

Attributes:

Class Attribute Type Description
MTrimmedWindow
trimBars List<MTrimBar> TrimBars who hold e.g. the ToolBar, Minimized Stacks, ...
MWindow *

[edit] Containers

There are 2 default containers used by e4 applications to build the UI-Tree PartSashContainer und PartStack. The difference between them is that PartSashContainer is designed to show all of its children at once whereas PartStack is showing only one of its children at a time.

E4 model container.png

[edit] PartSashContainer

Inheritance:

E4 model partsash inheritance.png

Attributes:

Class Attribute Type Description
MPartSashContainer
MGenericTile
horizontal boolean true if all children are aligned next to each other horizontally
MElementContainer
children List<MPartSashContainerElement> Child elements layed out in the container depending on the horizontal attribute
selectedElement MWindowElement The currently active childcontrol
MUIElement
widget Object the real UI-Control (e.g. SWT-Widget) rendering the element
renderer Object The renderer resposible to create the UI-Control and sync it with the elements attribute
toBeRendered boolean
onTop boolean
visible boolean
parent MElementContainer<MUIElement> The parent container
containerData String
curSharedRef MPlaceholder
visibleWhen MExpression
MApplicationElement
elementId String id to identify the element e.g. when contributing
tags List<String> Arbitary strings used to tag elements so that one can query for them
MPartSashContainerElement (Marker)
MWindowElement (Marker)
[edit] PartStack

Inheritance:

E4 model partstack inheritance.png

Attributes:

[edit] Parts

E4 model parts.png

[edit] Part

Inheritance:

E4 model part inheritance.png

Attributes:

Class Attribute Type Description
MPart
[edit] InputPart

Inheritance:

E4 model inputpart inheritance.png

Attributes:

Class Attribute Type Description
MInputPart

[edit] Other Elements

[edit] TrimBar

Inheritance:

E4 model trimbar inheritance.png

Attributes:

Class Attribute Type Description
MTrimBar

[edit] Menu, Toolbar & Trim UI Domain Objects

[edit] Menu

[edit] Menu
[edit] PopupMenu

[edit] ToolBar

[edit] Trim

[edit] Advanced UI Domain Objects

[edit] Descriptors

[edit] Application Logic Layer

[edit] Command, Handlers & Expressions

[edit] Contribution, Model Assembling & Addons

[edit] Extending the workbench model