public RowRenderer getConnectorPropertriesRenderer() {
return new RowRenderer() {
@Override
public void render(Row row, Object data) {
ConnectorProperty property = (ConnectorProperty) data;
row.setValue(property);
Util.appendLabel(row, _(property.getKey()));
appendValueTextbox(row, property);
}
private void appendValueTextbox(Row row,
final ConnectorProperty property) {
final Textbox textbox = new Textbox();
textbox.setWidth("400px");
textbox.setConstraint(checkPropertyValue(property));
Util.bind(textbox, new Util.Getter<String>() {
@Override
public String get() {
return property.getValue();
}
}, new Util.Setter<String>() {
@Override
public void set(String value) {
property.setValue(value);
}
});
if (property.getKey().equals(
PredefinedConnectorProperties.PASSWORD)) {
textbox.setType("password");
}
row.appendChild(textbox);
}
public Constraint checkPropertyValue(
final ConnectorProperty property) {
final String key = property.getKey();
return new Constraint() {
@Override
public void validate(Component comp, Object value) {
if (key.equals(PredefinedConnectorProperties.ACTIVATED)) {
if (!((String) value).equalsIgnoreCase("Y")