Revision history [back]

click to hide/show revision 1
initial version

answered 2014-06-16 07:51:19 +0800

chillworld gravatar image chillworld flag of Belgium

https://github.com/chillw...

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.

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="&gt;Ctrl + L&lt; 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.

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="&gt;Ctrl + L&lt; 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.

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More