Wiki Markup |
{scrollbar} |
Excerpt |
|
Avoiding repetition when using component parameters by adding autoconnect=true |
Default Parameter
Wiki Markup |
{float:right|background=""
{contentbylabel:title=Related Articles|showLabels=false|showSpace=false|space=@self|labels=parameters}
{float} |
...
Let's say you have created a component, RichTextEditor
, which operates like a normal TextArea component, but provides a _javascript_ rich text editor. You might start with something like:
Code Block |
JAVA
|
|
public class RichTextEditor implements Field
{
@Property
@Parameter(required=true)
private String value;
. . . // Lots more code not shown here
}
|
However, the weakness here is when you make use of the component. You template may look like:
Code Block |
|
<t:label for=""
<br/>
<t:richtexteditor t:id="profile" value="profile"/>
|
...
This repetition can be avoided by adding the autoconnect attribute to the @Parameter annotation:
Code Block |
|
@Property
@Parameter(required=true, autoconnect=true)
private String value;
|
...