Differences

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

Link to this comparison view

controllers:extratextcontroller [2015/10/05 17:52]
controllers:extratextcontroller [2020/04/16 10:56] (current)
Line 1: Line 1:
 +==== Controller for ExtraText ====
 +
 +The ExtraController is build around a specific control created for Adichatz.
 +This is  a FieldController that means that it can be linked to the databinding service.
 +
 +==== Control ====
 +<columns 100% l>
 +The control <wrap adicode>​org.adichatz.engine.widgets.extratext.ExtraText</​wrap>​ was developped by Adichatz based on [[http://​www.javacodegeeks.com/​2012/​07/​richtext-editor-component-for-swt-based.html|Alonso Dominguez'​s work]].\\
 +A ExtraText widget is a small editor widget managing bold, underline, hyperlink around a [[http://​www.eclipse.org/​articles/​StyledText%201/​article1.html|StyledText]] widget.
 +  * Add Bold, Italic, underline, strikethrough feature to character.
 +  * Cut, Copy, Paste.
 +  * Add Hyperlink (browser or mail access).
 +  * Buttons can be added after ExtraText is instantiated.
 +  * Creation of a ExtraText controller composition of the ExtraText widget.
 +<​newcolumn left>
 +{{:​controllers:​extratext-hyperlink.jpg?​350 |ExtraText control}}
 +</​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"​ entityURI="​adi://​myproject/​model.filmText/​FilmTextMM"​ XMLSchema-instance"​ coreClassName="​org.adichatz.engine.core.ASectionCore"​ entityURI="​adi:/​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]"/>​
 + <​extraText addRefreshItem="​true"​ 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:​extratext.png |ExtraText - Store description field as String}}
 +\\
 +== Explanations ==
 +^  **  addRefreshItem="​true"​**:​|Add a refresh button to retrieve previous value when changes had occured.|
 +^  **  layoutData="<​wrap adicode>​sg bottom</​wrap>"​**:​|<​wrap adicode>​description</​wrap>​ ExtraText 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.|
 +