@Override public void setFieldLabel(IModel<String> fieldLabel) { super.setFieldLabel(fieldLabel); field.setLabel(fieldLabel); }
/** * The value will be made available to the validator property by means of ${label}. It does not * have any specific meaning to FormComponent itself. * * @param labelModel * @return this for chaining */ public final AjaxEditableLabel<T> setLabel(final IModel<String> labelModel) { getEditor().setLabel(labelModel); return this; }
/** * The value will be made available to the validator property by means of ${label}. It does not * have any specific meaning to FormComponent itself. * * @param labelModel * @return this for chaining */ public final AjaxEditableLabel<T> setLabel(final IModel<String> labelModel) { getEditor().setLabel(labelModel); return this; }
public Object component(Component component) { FormComponent formComponent = (FormComponent)component; formComponent.setLabel( new Model(propertyMeta.getLabel()) ); formComponent.add( new ErrorHighlightingBehavior() ); return IVisitor.CONTINUE_TRAVERSAL; } });
@SuppressWarnings("unchecked") public static void setLabel(final FormComponent<?> component, final Label label) { final IModel<String> labelModel = (IModel<String>) label.getDefaultModel(); if (component instanceof DatePanel) { ((DatePanel) component).getDateField().setLabel(labelModel); } else { component.setLabel(labelModel); } }
@Override public void onComponentTagBody(final MarkupStream markupStream, final ComponentTag openTag) { // try and find some form of label content... IModel<String> labelModel = findLabelContent(markupStream, openTag); // print the label text replaceComponentTagBody(markupStream, openTag, labelModel != null ? labelModel.getObject() : ""); // store the label text in FormComponent's label model so its available to errors if (labelModel != null) { if (labeled instanceof FormComponent) { FormComponent<?> fc = (FormComponent<?>)labeled; fc.setLabel(labelModel); } else { // if we can't hand off the labelmodel to a component, we have to detach it labelModel.detach(); } } }
private FormComponent<Short> createPositionColumn(final PaymentScheduleDO payment) { final List<Short> availablePositionNumbers = payment.getAuftrag().getPositionenExcludingDeleted().stream() .map(AuftragsPositionDO::getNumber) .collect(Collectors.toList()); return new DropDownChoice<>("positionNumber", new PropertyModel<>(payment, "positionNumber"), availablePositionNumbers) .setNullValid(true) .setRequired(true) .setLabel(new ResourceModel("fibu.auftrag.position")); } }
public AjaxDateFieldPanel(final String id, final String name, final IModel<Date> model, final String datePattern) { super(id, name, model, datePattern); field = new AjaxDatePicker("field", model, SyncopeConsoleSession.get().getLocale(), datePattern); add(field.setLabel(new Model<>(name)).setOutputMarkupId(true)); }
public AjaxDateTimeFieldPanel( final String id, final String name, final IModel<Date> model, final String dateTimePattern) { super(id, name, model, dateTimePattern); // dateTimePattern should be spit into separate date and time pattern strings in order to be passed to the // AjaxDateTimePicker constructor, but there is no safe way to do that - ignoring field = new AjaxDateTimePicker("field", model, SyncopeConsoleSession.get().getLocale()); add(field.setLabel(new Model<>(name)).setOutputMarkupId(true)); }
public AjaxCheckBoxPanel( final String id, final String name, final IModel<Boolean> model, final boolean enableOnChange) { super(id, name, model); field = new CheckBox("checkboxField", model); add(field.setLabel(new Model<>(name)).setOutputMarkupId(true)); if (enableOnChange && !isReadOnly()) { field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget target) { // nothing to do } }); } }
@Override public Component appendInput(WicketBuildContext ctx, BSControls formGroup, IModel<String> labelModel) { final IModel<? extends SInstance> model = ctx.getModel(); final FormComponent<?> field = new TextField<>(model.getObject().getName(), new Model<String>() { @Override public String getObject() { return getReadOnlyFormattedText(ctx, model); } @Override public void setObject(String object) {} }); field.setEnabled(false); field.setLabel(labelModel); formGroup.appendInputText(field); return field; }
@Override public Component appendInput(WicketBuildContext ctx, BSControls formGroup, IModel<String> labelModel) { final IModel<? extends SInstance> model = ctx.getModel(); final FormComponent<?> field = new TextField<>(model.getObject().getName(), new Model<String>() { @Override public String getObject() { return getReadOnlyFormattedText(ctx, model); } @Override public void setObject(String object) {} }); field.setEnabled(false); field.setLabel(labelModel); formGroup.appendInputText(field); return field; }
@Override protected void onInitialize() { super.onInitialize(); add($b.classAppender("control-label")); add(newBSGridColBehavior()); add($b.attr("for", $m.get(() -> findTargetFormComponent().map(it -> it.getMarkupId()).orElse("")))); // altera propriedade label dos componentes se com o valor desta // label, se a primeira for null IModel<String> labelModel = $m.get(() -> getDefaultModelObjectAsString()); add($b.onConfigure(c -> findTargetFormComponent() .filter(it -> it.getLabel() == null) .ifPresent(it -> it.setLabel(labelModel)) )); }
@Override public Component appendInput(WicketBuildContext ctx, BSControls formGroup, IModel<String> labelModel) { final IModel<? extends SInstance> model = ctx.getModel(); final SView view = ctx.getView(); if (view instanceof SViewTextArea) { SViewTextArea mTextAreaView = (SViewTextArea) view; final SInstance mi = model.getObject(); FormComponent<?> textArea = new TextArea<>(mi.getName(), new SInstanceValueModel<>(model)); textArea.setLabel(labelModel); formGroup.appendTextarea(textArea, mTextAreaView.getLines()); Optional<Integer> maxSize = Optional.ofNullable(mi.getAttributeValue(SPackageBasic.ATR_MAX_LENGTH)); if (maxSize.isPresent()) { textArea.add(StringValidator.maximumLength(maxSize.get())); textArea.add(new CountDownBehaviour()); } return textArea; } throw new WicketRuntimeException("TextAreaMapper deve ser utilizado com MTextAreaView"); } }
@Override protected void onInitialize() { super.onInitialize(); add($b.classAppender("control-label")); add(newBSGridColBehavior()); add($b.attr("for", $m.get(() -> findTargetFormComponent().map(it -> it.getMarkupId()).orElse("")))); // altera propriedade label dos componentes se com o valor desta // label, se a primeira for null IModel<String> labelModel = $m.get(() -> getDefaultModelObjectAsString()); add($b.onConfigure(c -> findTargetFormComponent() .filter(it -> it.getLabel() == null) .ifPresent(it -> it.setLabel(labelModel)) )); }
public AjaxPasswordFieldPanel( final String id, final String name, final IModel<String> model, final boolean enableOnChange) { super(id, name, model); field = new PasswordTextField("passwordField", model); add(field.setLabel(new ResourceModel(name, name)).setRequired(false).setOutputMarkupId(true)); if (enableOnChange && !isReadOnly()) { field.add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) { private static final long serialVersionUID = -1107858522700306810L; @Override protected void onUpdate(final AjaxRequestTarget art) { // nothing to do } }); } }
@Override protected void onInitialize() { super.onInitialize(); add(input = new MarkdownEditor("input", Model.of(getModelObject()), false, null)); input.setLabel(Model.of(getDescriptor().getDisplayName(this))); input.add(new OnTypingDoneBehavior() { @Override protected void onTypingDone(AjaxRequestTarget target) { onPropertyUpdating(target); } }); }
@SuppressWarnings("unchecked") @Override public Component appendInput(WicketBuildContext ctx, BSControls formGroup, IModel<String> labelModel) { final IModel<? extends SInstance> model = ctx.getModel(); BSDatepickerInputGroup datepicker = formGroup .newComponent(id -> new BSDatepickerInputGroup(id) .setConverter(new ConverterImpl()) .setTextFieldConfigurer((IConsumer<FormComponent<?>>) c -> c .setLabel(labelModel) .setDefaultModel(new SInstanceValueModel<>(model)) .setOutputMarkupId(true) .add(new InputMaskBehavior(Masks.FULL_DATE)))); configureMaxDate(datepicker, model.getObject().getAttributeValue(ATR_MAX_DATE)); return datepicker.getTextField(); }
public TextResourceEditor(String id, ModelBuffer model) { super(id); // protocol field List<Protocol> protocols = Arrays.asList(Protocol.values()); IChoiceRenderer<Protocol> renderer = new ProtocolRenderer(); IModel<Protocol> protocolModel = model.forProperty("requiredProtocol"); requiredProtocol = new DropDownChoice<Protocol>("requiredProtocol", protocolModel, protocols, renderer); add(requiredProtocol.setNullValid(false)); // mimetype field IModel<String> mimeTypeModel = model.forProperty("mimeType"); add(new TextField<String>("mimeType", mimeTypeModel).add(new TextMimeTypeValidator()).setLabel(new ResourceModel("mimeType"))); // content field IModel<String> contentModel = model.forProperty("dataAsString"); add(new TextArea<String>("content", contentModel)); }
@Override protected void onInitialize() { super.onInitialize(); DateTextFieldConfig config = new DateTextFieldConfig(); config.autoClose(true); config.clearButton(true); config.withFormat(DateEditSupport.DATE_INPUT_FORMAT); input = new DateTextField("input", Model.of(getModelObject()), config); input.setType(getDescriptor().getPropertyClass()); Method propertyGetter = getDescriptor().getPropertyGetter(); if (propertyGetter.getAnnotation(OmitName.class) != null) input.add(AttributeModifier.replace("placeholder", EditableUtils.getDisplayName(propertyGetter))); input.setLabel(Model.of(getDescriptor().getDisplayName(this))); add(input); input.add(new OnTypingDoneBehavior() { @Override protected void onTypingDone(AjaxRequestTarget target) { onPropertyUpdating(target); } }); }