public EditableRequiredDropDownCellPanel(final String id, final PropertyColumn<T, S> column, @SuppressWarnings("rawtypes") final List choices) { super(id); @SuppressWarnings("unchecked") DropDownChoice<T> field = new DropDownChoice<T>("dropdown", choices); field.setLabel(column.getDisplayModel()); add(field); }
/** * Instantiates a new {@link LabeledEnumDropDownPanel}. * * @param id * the id * @param model * the model * @param labelModel * the label model * @param choices * the choices */ @SuppressWarnings({ "unchecked", "rawtypes" }) public LabeledEnumDropDownPanel(final String id, final IModel<?> model, final IModel<String> labelModel, final IModel<?> choices) { super(id, model); setOutputMarkupId(true); add(new DropDownChoice("edit", model, choices).setLabel(labelModel)); }
/** * Instantiates a new {@link LabeledEnumDropDownPanel}. * * @param id * the id * @param model * the model * @param labelModel * the label model * @param choices * the choices */ @SuppressWarnings({ "unchecked", "rawtypes" }) public LabeledEnumDropDownPanel(final String id, final IModel<?> model, final IModel<String> labelModel, final IModel<?> choices) { super(id, model); setOutputMarkupId(true); add(new DropDownChoice("edit", model, choices).setLabel(labelModel)); }
public CharsetPanel(final String id, final IModel charsetModel, final IModel paramLabelModel, final boolean required) { // make the value of the combo field the model of this panel, for easy // value retriaval super(id, charsetModel); // the label String requiredMark = required ? " *" : ""; Label label = new Label("paramName", paramLabelModel.getObject() + requiredMark); add(label); // the drop down field, with a decorator for validations final ArrayList charsets = new ArrayList(Charset.availableCharsets().keySet()); choice = new DropDownChoice("paramValue", charsetModel, charsets); choice.setRequired(required); // set the label to be the paramLabelModel otherwise a validation error would look like // "Parameter 'paramValue' is required" choice.setLabel(paramLabelModel); FormComponentFeedbackBorder feedback = new FormComponentFeedbackBorder("border"); feedback.add(choice); add(feedback); }
public CharsetPanel( final String id, final IModel<String> charsetModel, final IModel<String> paramLabelModel, final boolean required) { // make the value of the combo field the model of this panel, for easy // value retriaval super(id, charsetModel); // the label String requiredMark = required ? " *" : ""; Label label = new Label("paramName", paramLabelModel.getObject() + requiredMark); add(label); // the drop down field, with a decorator for validations final ArrayList<String> charsets = new ArrayList<String>(Charset.availableCharsets().keySet()); choice = new DropDownChoice<String>("paramValue", charsetModel, charsets); choice.setRequired(required); // set the label to be the paramLabelModel otherwise a validation error would look like // "Parameter 'paramValue' is required" choice.setLabel(paramLabelModel); FormComponentFeedbackBorder feedback = new FormComponentFeedbackBorder("border"); feedback.add(choice); add(feedback); }
public WorkspacePanel(final String id, final IModel workspaceModel, final IModel paramLabelModel, final boolean required) { // make the value of the combo field the model of this panel, for easy // value retriaval super(id, workspaceModel); // the label String requiredMark = required ? " *" : ""; Label label = new Label("paramName", paramLabelModel.getObject() + requiredMark); add(label); // the drop down field, with a decorator for validations choice = new DropDownChoice("paramValue", workspaceModel, new WorkspacesModel(), new WorkspaceChoiceRenderer()); choice.setRequired(required); // set the label to be the paramLabelModel otherwise a validation error would look like // "Parameter 'paramValue' is required" choice.setLabel(paramLabelModel); FormComponentFeedbackBorder feedback = new FormComponentFeedbackBorder("border"); feedback.add(choice); add(feedback); }
public WorkspacePanel( final String id, final IModel workspaceModel, final IModel paramLabelModel, final boolean required) { // make the value of the combo field the model of this panel, for easy // value retriaval super(id, workspaceModel); // the label String requiredMark = required ? " *" : ""; Label label = new Label("paramName", paramLabelModel.getObject() + requiredMark); add(label); // the drop down field, with a decorator for validations choice = new DropDownChoice( "paramValue", workspaceModel, new WorkspacesModel(), new WorkspaceChoiceRenderer()); choice.setRequired(required); // set the label to be the paramLabelModel otherwise a validation error would look like // "Parameter 'paramValue' is required" choice.setLabel(paramLabelModel); FormComponentFeedbackBorder feedback = new FormComponentFeedbackBorder("border"); feedback.add(choice); add(feedback); }
@Override protected void onInitialize() { super.onInitialize(); String stringValue; if (getModelObject() != null) { if (getModelObject()) stringValue = "yes"; else stringValue = "no"; } else { stringValue = null; } input = new DropDownChoice<String>("input", Model.of(stringValue), Lists.newArrayList("yes", "no")); input.setLabel(Model.of(getDescriptor().getDisplayName(this))); input.setNullValid(true); add(input); input.add(new AjaxFormComponentUpdatingBehavior("change"){ @Override protected void onUpdate(AjaxRequestTarget target) { onPropertyUpdating(target); } }); }
private DropDownChoice<String> createRepositoryPanel() { IModel<List<String>> choices = new RepositoryListDettachableModel(); RepoInfoChoiceRenderer choiceRenderer = new RepoInfoChoiceRenderer(); DropDownChoice<String> choice = new DropDownChoice<>( "geogig_repository", repositoryUriModel, choices, choiceRenderer); choice.setLabel(new ResourceModel("repository")); choice.setNullValid(true); choice.setRequired(true); choice.setOutputMarkupId(true); choice.add( new AjaxFormComponentUpdatingBehavior("change") { private static final long serialVersionUID = 6182000388125500580L; @Override protected void onUpdate(AjaxRequestTarget target) { String branchName = null; // do not lose the original branch if the user is moving around the repo // choices if (Objects.equal(originalRepo, repositoryUriModel.getObject())) { branchName = originalBranch; } branchNameModel.setObject(branchName); branch.updateChoices(true, GeoGigDataStoreEditPanel.this.storeEditForm); target.add(branch); } }); return choice; }
typeSelector.setLabel(Model.of(getDescriptor().getDisplayName(this)));
DropDownChoice<Object> listField = new DropDownChoice<>("list", propModel, categories, choiceRenderer); listField.setRequired(true); listField.setLabel(new StringResourceModel(DIALOG_LIST_LABEL, this, null)); add(listField);