Differences

This shows you the differences between two versions of the page.

Link to this comparison view

controllers:richtextcontroller [2015/10/05 17:52]
controllers:richtextcontroller [2020/04/16 10:56] (current)
Line 1: Line 1:
 +==== Controller for RichText ====
 +
 +The RichTextController is build around the [[https://​www.eclipse.org/​nebula/​widgets/​richtext/​richtext.php|Nebula RichText project]] which contains 2 controls:
 +  * RichTextViewer for rendering HTML formatted text.
 +  * RichTextEditor for editing HTML formatted text.
 +
 +This is  a FieldController that means that it can be linked to the databinding service. ​
 +
 +<WRAP indic>
 +Currently, the **Nebula RichText project** is a recent project and does not seem completely finalized. For example, we do not know haw to correctly manage scrolling operation in
 + <​wrap adicode>​RichTextViewer</​wrap>​ control.
 +</​WRAP>​
 +
 +==== Control ====
 +<columns 100% l>
 +{{:​controllers:​rich_text_viewer.png?​350 |RichTextViewer control}}
 +<​newcolumn left>
 +<wrap adicode>​RichTextController</​wrap>​ is a controller build around a <wrap adicode>​RichTextViewer</​wrap>​ control.\\
 +  * It proposes a button to <​html><​img src="/​dokuwiki/​lib/​exe/​fetch.php?​media=controllers:​expand_icon.png"​ style="​vertical-align:​ bottom;"​ alt=""/></​html>​ expand or <​html><​img src="/​dokuwiki/​lib/​exe/​fetch.php?​media=controllers:​editor_icon.png"​ style="​vertical-align:​ bottom;"​ alt=""/></​html>​ edit the field by opening a window containing a <wrap adicode>​RichTextEditor</​wrap>​ control.
 +  * When all of the text could not be displayed, an Image Label <​html><​img src="/​dokuwiki/​lib/​exe/​fetch.php?​media=controllers:​incomplete_icon.png"​ style="​vertical-align:​ bottom;"​ alt=""/></​html>​ is displayed:  ​
 +</​columns>​
 +\\
 +<columns 100% l>
 +{{:​controllers:​rich_text_editor.png?​450 |RichTextEditor control}}
 +<​newcolumn left>
 +When clicking on  <​html><​img src="/​dokuwiki/​lib/​exe/​fetch.php?​media=controllers:​editor_icon.png"​ style="​vertical-align:​ bottom;"​ alt=""/></​html>​ Edit button in the <wrap adicode>​RichTextController</​wrap>, ​
 +a new window is opened around a <wrap adicode>​RichTextEditor</​wrap>​ control which offer a way to edit text.   
 +</​columns>​
 +\\
 +==== Usage: ​ ====
 +
 +== Code ==
 +<sxh xml; highlight: [18]; title: Store description field as String.>
 +<?xml version="​1.0"​ encoding="​UTF-8"​ standalone="​yes"?>​
 +<​includeTree xmlns:​xsi="​http://​www.w3.org/​2001/​XMLSchema-instance"​ XMLSchema-instance"​ coreClassName="​org.adichatz.engine.core.ASectionCore"​ entityURI="​adi:/​entityURI="​adi://​myproject/​model.filmText/​FilmTextMM"​ generationType="​DETAIL"​ xsi:​noNamespaceSchemaLocation="​http://​www.adichatz.org/​xsd/​v0.8.4/​generator/​includeTree.xsd">​
 +    <section text="#​MSG(filmText,​ detailContainerText)"​ style="​Section.TWISTIE | Section.TITLE_BAR | Section.EXPANDED"​ id="​detailContainer">​
 +        <​listeners>​
 +            <​listener id="​filmIELsnr"​ listenerTypes="​INJECT_ENTITY">​
 +                <​code>​getComposite().setEnabled(null != getEntity());</​code>​
 +            </​listener>​
 +            <​listener id="​filmAELCLsnr"​ listenerTypes="​AFTER_END_LIFE_CYCLE">​
 +                <​code>​getComposite().setEnabled(null != getEntity());​
 +getControl().setData(&​quot;​ONE_TO_ONE&​quot;,​ #​ENTITY_MM(adi://​myproject/​model.film/​FilmMM).getLazyFieldMap().get(&​quot;​filmText&​quot;​));</​code>​
 +            </​listener>​
 +        </​listeners>​
 +        <layout layoutConstraints="​wrap 4" columnConstraints="​[fill,​ align right]10[fill,​grow]25[align right]10[fill,​grow]"/>​
 + <​formattedText editPattern="######"​ format="​Short"​ property="​filmId"​ enabled="​false"​ id="​filmId"/>​
 + <​dateText property="​lastUpdate"​ style="​SWT.BORDER | SWT.TIME"​ enabled="​false"​ id="​lastUpdate"/>​
 + <​composite layoutData="​newline,​ grow, push, span 4" id="​bottomComposite">​
 + <​layout layoutConstraints="​ins 0, wrap 2" columnConstraints="​[fill,​grow]15[fill,​grow]"​ rowConstraints="​[grow,​fill,​ al top]"/>​
 + <​richText noLabel="​true"​ layoutData="​sg bottom"​ property="​description"​ id="​description"/>​
 + <​imageViewer noLabel="​true"​ layoutData="​sg bottom"​ toolBarStyle="​AdiSWT.DELETE_BUTTON | AdiSWT.EXPANDABLE | AdiSWT.EDITABLE"​ fitCanvas="​true"​ imageType="​Data"​ property="​image"​ id="​image"/>​
 + </​composite>​
 +    </​section>​
 +</​includeTree>​
 +</​sxh>​
 +
 +== Overview ==
 +{{:​controllers:​filmtext_detail.png |RichText - Store description field as String}}
 +\\
 +== Explanations ==
 +^  **  layoutData="<​wrap adicode>​sg bottom</​wrap>"​**:​|<​wrap adicode>​description</​wrap>​ richtext control and <wrap adicode>​image</​wrap>​ imageViewer control have same size.|
 +^  **  noLabel**:​|No label are affected to control <wrap adicode>​description</​wrap>​. By default, when a field control is linked to a model field (here <wrap adicode>​property="​description"</​wrap>​),​ a label control is automatically created.|
 +