-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
Oke,
As Senthi said, I moved also on to the Validator
in stead of constraint
.
Pitty that I have to implement a validator in each VM where the customcomponent is used.
Greetz chill.
2 | No.2 Revision |
Oke,
As Senthi said, Oke found it.
The custom component is now like this :
<hbox align="center" id="${arg.id}">
<textbox cols="9" ctrlKeys="^l" id="personId"
readonly="${arg.readonly}" tooltiptext=">Ctrl + L< will open search dialog ">
<custom-attributes validation="${arg.constraint}" />
</textbox>
<separator width="5px" />
<textbox readonly="true" cols="30" id="name" tabindex="-1"/>
<image src="/img/detail.png" id="detail" />
</hbox>
In the controller (extends HtmlMacroComponent implements IdSpace
) :
private boolean checkConstraint = true;
private String constraint;
@Override
public void afterCompose() {
super.afterCompose();
Selectors.wireComponents(this, this, false);
Selectors.wireEventListeners(this, this);
constraint = (String) personId.getAttribute("validation");
String s = null;
personId.setConstraint(s);
}
public PersonProxy getValue() {
if (checkConstraint) {
personId.setConstraint(constraint);
try {
personId.getValue(); // needed to throw the error message.
} finally {
String s = null;
personId.setConstraint(s); // ambigious situation String-Constraint when entering null directly.
}
}
return this.person;
}
When the ctrl+ctrl is pressed, I moved also on set the checkConstraint
to the Validator
in stead of constraint
.
Pitty that false
, and set back true
when I have to implement a validator in each VM where the customcomponent is used.close the modal popup.
Greetz chill.
3 | No.3 Revision |
Oke found it.
The custom component is now like this :
<hbox align="center" id="${arg.id}">
<textbox cols="9" ctrlKeys="^l" id="personId"
readonly="${arg.readonly}" tooltiptext=">Ctrl + L< will open search dialog ">
<custom-attributes validation="${arg.constraint}" />
</textbox>
<separator width="5px" />
<textbox readonly="true" cols="30" id="name" tabindex="-1"/>
<image src="/img/detail.png" id="detail" />
</hbox>
In the controller (extends HtmlMacroComponent implements IdSpace
) :
private boolean checkConstraint = true;
private String constraint;
@Override
public void afterCompose() {
super.afterCompose();
Selectors.wireComponents(this, this, false);
Selectors.wireEventListeners(this, this);
// some extra code
constraint = (String) personId.getAttribute("validation");
String s = null;
personId.setConstraint(s);
}
public PersonProxy getValue() {
if (checkConstraint) {
personId.setConstraint(constraint);
try {
personId.getValue(); // needed to throw the error message.
} finally {
String s = null;
personId.setConstraint(s); // ambigious situation String-Constraint when entering null directly.
}
}
return this.person;
}
When the ctrl+ctrl is pressed, I set the checkConstraint
to false
, and set back true
when I close the modal popup.
Greetz chill.