@Override public void readDesign(Element design, DesignContext designContext) { super.readDesign(design, designContext); Attributes attr = design.attributes(); if (attr.hasKey("maxlength")) { setMaxLength(DesignAttributeHandler.readAttribute("maxlength", attr, Integer.class)); } }
@Override public StringInputBuilder maxLength(int maxLength) { getInstance().setMaxLength(maxLength); return builder(); }
@Override public StringInputBuilder maxLength(int maxLength) { getInstance().setMaxLength(maxLength); return builder(); }
public AbstractField<?> getTextField(MaduraPropertyWrapper property) { AbstractTextField ret = null; if (property.isSecret()) { ret = new PasswordField(); } else { ret = new TextField(); } ret.setMaxLength(property.getMaxLength()); return ret; } public Button getButtonField(String name, MessageSource messageSource) {
textComponent.setMaxLength(maxLengthAllowed);
textComponent.setMaxLength(maxLengthAllowed);
public AbstractField getTextField(MaduraPropertyWrapper property) { AbstractTextField ret = null; if (property.isSecret()) { ret = new PasswordField(); } else { ret = new TextField(); // int maxLength = property.getMaxLength(); // if (maxLength > 100) { // ret = new TextArea(); // } else { // ret = new TextField(); // } } ret.setMaxLength(property.getMaxLength()); return ret; } public Button getButtonField(String name, MessageSource messageSource) {
public AbstractField<?> getTextField(MaduraPropertyWrapper property) { AbstractTextField ret = null; if (property.isSecret()) { ret = new PasswordField(); } else { if ("comment".equals(property.getName())) { TextArea textArea = new TextArea(); textArea.setRows(5); textArea.setWordwrap(true); textArea.setWidth("400px"); ret = textArea; } else { ret = new TextField(); } } ret.setMaxLength(property.getMaxLength()); if (property.getValue() == null) { property.setValue(""); } return ret; } }
@Override public AbstractTextField createFieldComponent() { // Create a TextArea if the rows > 1 AbstractTextField field; if (getDefinition().getRows() > 1) { TextArea textArea = new TextArea(); textArea.setRows(getDefinition().getRows()); field = textArea; } else { field = new TextField(); } if (getDefinition().getMaxLength() != -1) { field.setMaxLength(getDefinition().getMaxLength()); } String placeholder = getDefinition().getPlaceholder(); if (placeholder != null && !isMessageKey(placeholder)) { field.setPlaceholder(placeholder); } return field; } }
private AbstractTextField createInputField(InputWidgetElement iwe) { AbstractTextField field = iwe.getSecret() != null && iwe.getSecret() ? new PasswordField() : new TextField(); if (iwe.getMaxLength() != null) { field.setMaxLength(iwe.getMaxLength()); } if (hasText(iwe.getRegexp()) && hasText(iwe.getRegexp())) { field.addValidator(new RegexpValidator(WidgetDefinitionLoader.replaceXmlEscapeCharacters(iwe.getRegexp()), iwe.getErrorKey() != null ? iwe.getErrorKey() : getMessage("processdata.block.error.regexp").replaceFirst("%s", iwe.getRegexp()))); } if (nvl(iwe.getRequired(), false)) { field.setRequired(true); if (hasText(iwe.getCaption())) { String caption = iwe.getCaption(); if (caption.endsWith(":")) caption = caption.substring(0, caption.length() - 1); field.setRequiredError(getMessage("processdata.block.field-required-error") + " " + caption); } else { field.setRequiredError(getMessage("processdata.block.field-required-error")); } } if (hasText(iwe.getBaseText())) { field.setValue(getMessage(iwe.getBaseText())); } if (hasText(iwe.getPrompt())) { field.setInputPrompt(getMessage(iwe.getPrompt())); } if (iwe.getValue() != null) field.setValue(iwe.getValue()); return field; }