add(new Label("reference-edit", stringValue)); } else { TextFieldWidget editor = new TextFieldWidget("reference-edit", valueModel); editor.setSize("40"); add(editor); add(new Label("reference-edit", stringValue)); } else { TextFieldWidget editor = new TextFieldWidget("reference-edit", valueModel); editor.setSize("40"); add(editor);
public PasswordHashEditor(String id, final int passwordLength, JcrPropertyModel propertyModel, IModel<String> valueModel) { super(id); this.passwordLength = passwordLength; setOutputMarkupId(true); // generate link: final PasswordGenerateLink generateLink = new PasswordGenerateLink("password-generate-link", propertyModel, valueModel); add(generateLink); // hash link final PasswordHashLink hashLink = new PasswordHashLink("password-hash-link", propertyModel, valueModel); add(hashLink); // input field passwordField = new TextFieldWidget("password-input", valueModel) { @Override protected void onUpdate(final AjaxRequestTarget target) { // do nothing target.focusComponent(this); target.add(PasswordHashEditor.this); } }; passwordField.setOutputMarkupId(true); passwordField.setSize("60"); add(passwordField); }
public TextFieldWidget(String id, IModel<String> model, IModel<String> labelModel, Duration throttleDelay) { super(id, model, throttleDelay); final TextField<String> textField = new TextField<String>("widget", model) { { setFlag(FLAG_CONVERT_EMPTY_INPUT_STRING_TO_NULL, false); } @Override protected void onComponentTag(final ComponentTag tag) { if (getMaxlength() != null) { tag.put("maxlength", getMaxlength()); } if (getSize() != null) { tag.put("size", getSize()); } super.onComponentTag(tag); } }; addFormField(textField); if (labelModel != null) { textField.setLabel(labelModel); } }
public CopyModelDialog(CompatibilityWorkflowPlugin.WorkflowAction action) { action.super(); WorkflowDescriptorModel workflowModel = (WorkflowDescriptorModel) EditmodelWorkflowPlugin.this.getDefaultModel(); PropertyModel<String> model = new PropertyModel<>(action, "name"); try { model.setObject(name = workflowModel.getNode().getName()); } catch (RepositoryException ex) { log.error(ex.getMessage()); } TextFieldWidget widget = new TextFieldWidget("name", model); ((FormComponent) widget.get("widget")).add(new IValidator() { private static final long serialVersionUID = 1L; public void validate(IValidatable validatable) { try { NamespaceValidator.checkName((String) validatable.getValue()); } catch (Exception e) { validatable.error(new ExceptionError(e)); } } }).setRequired(true); add(widget); setFocus(widget); }
addressTextField.setOutputMarkupId(true); addressTextField.setSize(SIZE); setFocus(addressTextField); add(addressTextField); final TextFieldWidget titleTextField = new TextFieldWidget("title", new StringPropertyModel(model, ExternalXinhaLink.TITLE)); titleTextField.setSize(SIZE); add(titleTextField);
switch (mode) { case EDIT: TextFieldWidget widget = new TextFieldWidget("value", stringModel); if (config.getString("size") != null) { widget.setSize(config.getString("size")); widget.setMaxlength(config.getString("maxlength"));
QuestionPanel(final String id, final IModel<String> question, final IModel<String> answer) { super(id); add(CssClass.append("question-answer")); add(new Label("question", question)); add(new TextFieldWidget("answer", answer)); } }
HstReferenceEditor(String id, JcrPropertyModel propertyModel, IModel<String> valueModel) { super(id); setOutputMarkupId(true); final ReferenceLink referenceLink = new ReferenceLink("reference-link", propertyModel, valueModel); add(referenceLink); // input field final TextFieldWidget editor = new TextFieldWidget("reference-edit", valueModel) { @Override protected void onUpdate(final AjaxRequestTarget target) { referenceLink.load(); target.add(HstReferenceEditor.this); } }; editor.setSize("40"); add(editor); }
@Override public void applyState() { setComplete(nameComponent.getFormComponent().isValid()); } }
@Override protected void populateItem(final Item<String> item) { if (editable) { item.add(new TextFieldWidget("editor", item.getModel())); } else { item.add(new Label("editor", item.getModel())); } item.add(new AjaxLink<Void>("remove") { @Override public void onClick(AjaxRequestTarget target) { cssProvider.remove(item.getIndex()); target.add(FieldPluginEditor.this); } }.setVisible(editable)); } });
ReferenceEditor(String id, JcrPropertyModel propertyModel, final JcrPropertyValueModel<String> valueModel) { super(id, valueModel); setOutputMarkupId(true); final ReferenceLink referenceLink = new ReferenceLink("reference-link", valueModel); add(referenceLink); try { if (propertyModel.getProperty().getDefinition().isProtected()) { add(new Label("reference-edit", valueModel.getObject())); } else { TextFieldWidget editor = new TextFieldWidget("reference-edit", valueModel) { @Override protected void onUpdate(final AjaxRequestTarget target) { referenceLink.load(); target.add(ReferenceEditor.this); } }; editor.setSize("40"); add(editor); } } catch (RepositoryException e) { addOrReplace(new Label("reference-edit", e.getClass().getName())); addOrReplace(new ExceptionLink("reference-link", Model.of(e.getMessage()))); } }
@Override public void applyState() { setComplete(nameComponent.getFormComponent().isValid()); } }
TextFieldWidget nameField = new TextFieldWidget("name", new PropertyModel(this, "name")); nameField.setSize(String.valueOf(name.length() + 5)); add(nameField); } else {
final int index = item.getModelObject().intValue(); try { item.add(new TextFieldWidget("facet", new JcrPropertyValueModel<String>(index, new JcrPropertyModel<String>(node.getProperty("hippo:facets"))))); item.add(new TextFieldWidget("mode", new JcrPropertyValueModel<String>(index, new JcrPropertyModel<String>(node.getProperty("hippo:modes"))))); item.add(new TextFieldWidget("value", new JcrPropertyValueModel<String>(index, new JcrPropertyModel<String>(node.getProperty("hippo:values"))))); AjaxLink<Void> removeButton;
nameField.setSize(String.valueOf(name.length() + 5)); add(nameField); } else {
TypeDetailStep(NewCompoundTypeAction action) { super(new ResourceModel("type-detail-title"), new ResourceModel("compound-type-detail-summary")); final IModel<String> nameLabel = new ResourceModel("name-caption"); nameComponent = new RequiredTextFieldWidget("name", PropertyModel.of(action, "name"), nameLabel); nameComponent.getFormComponent().add(NamespaceValidator.createNameValidator()); add(nameComponent); setFocus(nameComponent.getFormComponent()); }
TextFieldWidget nameField = new TextFieldWidget("name", new PropertyModel<String>(this, "name")); nameField.setSize(String.valueOf(name.length() + 5)); add(nameField);
add(new TextFieldWidget("caption-editor", captionModel)); add(new TextAreaWidget("hint-editor", hintModel)); } else { protected void populateItem(final Item<String> item) { if (editable) { item.add(new TextFieldWidget("editor", item.getModel())); } else { item.add(new Label("editor", item.getModel()));
nameField.setSize(String.valueOf(name.length() + 5)); add(nameField);
TypeDetailStep(NewDocumentTypeAction action, final List<String> candidatesSuperTypes) { super(new ResourceModel("type-detail-title"), new ResourceModel("type-detail-summary")); final DropDownChoice<String> superTypeChoice = new DropDownChoice<>("super-type-list", new PropertyModel<>(action, "superType"), candidatesSuperTypes); add(superTypeChoice); IModel<String> nameLabel = new ResourceModel("name-caption"); nameComponent = new RequiredTextFieldWidget("name", PropertyModel.of(action, "name"), nameLabel); nameComponent.getFormComponent().add(NamespaceValidator.createNameValidator()); add(nameComponent); setFocus(nameComponent.getFormComponent()); }