Differences

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

Link to this comparison view

controllers:compositecontroller [2015/10/05 17:52]
controllers:compositecontroller [2020/04/16 10:56] (current)
Line 1: Line 1:
 +==== Controller for Composite ====
 +
 +The **CompositeController** is build around a <wrap adicode>​Composite</​wrap>​.
 +It extends a <wrap adicode>​org.adichatz.engine.controller.AEntityManagerController</​wrap>​ that means:
 +  * It is a **collection controller** wich can contain other controllers (field controllers,​ collection controllers...).
 +  * It can receive and manage its own entity.
 +\\
 +
 +==== Control ====
 +The control [[http://​help.eclipse.org/​mars/​index.jsp?​topic=/​org.eclipse.platform.doc.isv/​reference/​api/​org/​eclipse/​swt/​widgets/​Composite.html|org.eclipse.swt.widgets.Composite]] is a SWT controls container which owns its own layout.
 +\\
 +
 +==== Usage: ​ ====
 +== Code ==
 +<sxh xml; highlight: [4,​7,​11,​12];​ Composite controllers usage.>
 +<​formPage formText="#​MSG(adichatzStudio,​ scenario.rcp.formText,​ #​PARAM(pluginName))"​ title="#​MSG(adichatzStudio,​ scenario.rcp.page)"​ id="​rcpPage">​
 +    <layout columnConstraints="​[grow,​fill]"​ layoutConstraints="​wrap"/>​
 +    <include adiResourceURI="​adi://​editor/​ScenarioTBM"​ id="​rcpTBM"/>​
 + <​composite id="​parentRcpComposite"​ entity="#​ENTITY(#​BEAN().getGenerationScenario())"​ entityURI="​adi://​org.adichatz.studio/​model/​GenerationScenarioMM">​
 +        <layout columnConstraints="​[grow,​fill]"​ layoutConstraints="​wrap,​ ins 0"/>​
 +   ​  ​   <​checkBox id="​rcpPart"​ text="#​MSG(adichatzStudio,​ scenario.has.rcp.part)"​ controllerClassName="​org.adichatz.studio.xjc.controller.RcpCheckBoxController"/>​
 +   ​  ​   <​composite id="​rcpComposite"​ entityURI="​adi://​org.adichatz.studio/​model/​RcpPartMM"​ entity="#​ENTITY(#​BEAN().getRcpPart())"​ valid="​false"​ layoutData="​gap left 20"> ​
 +       ​ <​layout columnConstraints="​[grow,​fill]"​ layoutConstraints="​wrap 1"/>​
 +   ​  ​   <​checkBox id="​application"​ property="​application"​ text="#​MSG(adichatzStudio,​ scenario.is.application)"​ noLabel="​true"/>​
 +   ​  ​   <​checkBox id="​navigator"​ property="​navigator"​ text="#​MSG(adichatzStudio,​ scenario.has.navigator)"​ noLabel="​true"/>​
 + </​composite>​
 + </​composite>​
 +</​formPage>​
 +</​sxh>​
 +
 +== Overview ==
 +<columns 100% l 350px middle>
 +{{:​controllers:​composite.png |Composite}}
 +</​columns>​
 +\\
 +== Explanations ==
 +|**<wrap adicode><​nowiki>​entityURI="​adi://​org.adichatz.studio/​model/​RcpPartMM"</​nowiki></​wrap>​**| Gives the type of the entity (EntityMetaModel).|
 +|**<wrap adicode>​entity="​entity="#​ENTITY(#​BEAN().getRcpPart())"</​wrap>​**| Injects and entity in the composite: bean of the new entity is the property rcpPart of the entity injected in the parent controller.|
 +|**<wrap adicode> valid="​false"</​wrap>​**| The controller is not build, the life of cycle ignores the controller and its children. The controller **<wrap adicode>​org.adichatz.studio.xjc.controller.RcpCheckBoxController</​wrap>​** manages the validity of the composite.|
 +|**<wrap adicode>​layoutData="​gap left 20"</​wrap>​**| Add a margin of 20 pixels.|
 +|**<wrap adicode><​layout columnConstraints="​[grow,​fill]"​ .../></​wrap>​**|Composite layout has one column and components in the composite take all place and grow with composite.|
 +