public DropDownChoicePanel<T> setRequired(final boolean required) { dropDownChoice.setRequired(required); return this; }
private void updateCost2ChoiceValidation() { final boolean cost2Visible = CollectionUtils.isNotEmpty(cost2List); // cost2ChoiceFieldset.setVisible(cost2Visible); cost2Choice.setRequired(cost2Visible); }
/** * {@inheritDoc} */ @Override protected void onBeforeRender() { dropdownChoice.setRequired(isRequired()); super.onBeforeRender(); }
/** * {@inheritDoc} */ @Override protected void onBeforeRender() { dropdownChoice.setRequired(isRequired()); super.onBeforeRender(); }
public DropDownChoiceWrapperPanel( String id, IModel<T> model, List<? extends T> list, ChoiceRenderer<T> renderer) { super(id, model); add(new DropDownChoice<T>("innerComponent", model, list, renderer).setRequired(true)); } }
private DropDownChoice<Reification> selectReificationStrategy(String id, String property) { final List<Reification> reificationList = Arrays.asList(Reification.values()); DropDownChoice<Reification> reificationDropDownChoice = new BootstrapSelect<>(id, kbModel.bind(property), reificationList); reificationDropDownChoice.setRequired(true); return reificationDropDownChoice; } }
private DropDownChoice<Reification> selectReificationStrategy(String id, String property) { final List<Reification> reificationList = Arrays.asList(Reification.values()); DropDownChoice<Reification> reificationDropDownChoice = new BootstrapSelect<>(id, kbModel.bind(property), reificationList); reificationDropDownChoice.setRequired(true); return reificationDropDownChoice; } }
public TypePanel(String id, AbstractColumn column, IModel rowModel, IModel itemModel) { super(id, column, rowModel); List<Type> types = Arrays.asList(Type.values()); DropDownChoice<Type> choice; add(choice = new DropDownChoice<Type>("dropDown", itemModel, types, typeRenderer)); choice.setNullValid(false); choice.setRequired(true); }
private DropDownChoice criarDropDown(IModel<List<Actor>> actorsModel, Model<Actor> model) { DropDownChoice<Actor> dropDownChoice = new DropDownChoice<>("selecao", model, actorsModel, new ChoiceRenderer<>("nome", "codUsuario")); dropDownChoice.setRequired(true); return dropDownChoice; }
private DropDownChoice<RepositoryType> createTypeSelection(String id, String property) { DropDownChoice<RepositoryType> typeChoice = new BootstrapSelect<>(id, kbModel.bind(property), asList(RepositoryType.values()), new EnumChoiceRenderer<>(this)); typeChoice.setRequired(true); return typeChoice; }
private DropDownChoice<String> makeProjectTypeChoice() { List<String> types = projectService.listProjectTypes().stream().map(t -> t.id()) .collect(Collectors.toList()); DropDownChoice<String> projTypes = new BootstrapSelect<>("mode", types); projTypes.setRequired(true); projTypes.add(LambdaBehavior.onConfigure(_this -> { // If there is only a single project type and the project mode has not been set yet, // then we can simply select that and do not need to show the choice at all. Project project = projectModel.getObject(); if (projectTypes.getChoices().size() == 1 && project.getMode() == null) { project.setMode(projectTypes.getChoices().get(0)); } _this.setEnabled( nonNull(projectModel.getObject()) && isNull(projectModel.getObject().getId())); // If there is only a single project type, then we can simply select that and do not // need to show the choice at all. _this.setVisible(projTypes.getChoices().size() > 1); })); return projTypes; }
private DropDownChoice<RepositoryType> createTypeSelection(String id, String property) { DropDownChoice<RepositoryType> typeChoice = new BootstrapSelect<>(id, kbModel.bind(property), asList(RepositoryType.values()), new EnumChoiceRenderer<>(this)); typeChoice.setRequired(true); return typeChoice; }
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); }
private DropDownChoice<StoredQuery> storedQueriesDropDown() { final DropDownChoice<StoredQuery> dropdown = new DropDownChoice<>( "storedQueriesDropDown", new Model<>(), new StoredQueryListModel(), new StoredQueryListRenderer()); dropdown.setRequired(true); dropdown.add( new AjaxFormComponentUpdatingBehavior("change") { /** serialVersionUID */ private static final long serialVersionUID = -7195159596309736905L; @Override protected void onUpdate(AjaxRequestTarget target) { StoredQuery selection = (StoredQuery) dropdown.getDefaultModelObject(); parameterProvider.refreshItems(selection.storedQueryId); target.add(parameters); } }); return dropdown; }
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); }
private DropDownChoice<AddressType> newModbusAddressTypeDropdown( final ModbusConfigurationEntry configEntry) { final DropDownChoice<AddressType> dropDown = new DropDownChoice<AddressType>( "type", new PropertyModel<AddressType>(configEntry, "modbusRange.modbusAddressType"), modbusTypes, new ModbusAddressTypeChoiceRenderer()); dropDown.setRequired(true); dropDown.add(new OnChangeAjaxBehavior() { @Override protected void onUpdate(AjaxRequestTarget target) { configEntry.getModbusRange().setModbusAddressType(dropDown.getModelObject()); } }); return dropDown; }
public NewStatementGroupFragment(String aId) { super(aId, "newStatementGroup", StatementGroupPanel.this, groupModel); IModel<KBHandle> property = Model.of(); Form<KBHandle> form = new Form<>("form", property); DropDownChoice<KBHandle> type = new BootstrapSelect<>("property"); type.setModel(property); type.setChoiceRenderer(new ChoiceRenderer<>("uiLabel")); type.setChoices(getUnusedProperties()); type.setRequired(true); type.setOutputMarkupId(true); form.add(type); focusComponent = type; form.add(new LambdaAjaxButton<>("create", this::actionNewProperty)); form.add(new LambdaAjaxLink("cancel", this::actionCancelNewProperty)); add(form); }
public NewStatementGroupFragment(String aId) { super(aId, "newStatementGroup", StatementGroupPanel.this, groupModel); IModel<KBHandle> property = Model.of(); Form<KBHandle> form = new Form<>("form", property); DropDownChoice<KBHandle> type = new BootstrapSelect<>("property"); type.setModel(property); type.setChoiceRenderer(new ChoiceRenderer<>("uiLabel")); type.setChoices(getUnusedProperties()); type.setRequired(true); type.setOutputMarkupId(true); form.add(type); focusComponent = type; form.add(new LambdaAjaxButton<>("create", this::actionNewProperty)); form.add(new LambdaAjaxLink("cancel", this::actionCancelNewProperty)); add(form); }
private void addParameterSettings(final int idx) { final FieldsetPanel fs = gridBuilder.newFieldset(getString("scripting.script.parameterName") + " " + idx); final String parameterType = "parameter" + idx + "Type"; final String parameterName = "parameter" + idx + "Name"; final MaxLengthTextField name = new MaxLengthTextField(fs.getTextFieldId(), new PropertyModel<String>(data, parameterName)); WicketUtils.setSize(name, 20); fs.add(name); // DropDownChoice type final LabelValueChoiceRenderer<ScriptParameterType> typeChoiceRenderer = new LabelValueChoiceRenderer<ScriptParameterType>(this, ScriptParameterType.values()); final DropDownChoice<ScriptParameterType> typeChoice = new DropDownChoice<ScriptParameterType>(fs.getDropDownChoiceId(), new PropertyModel<ScriptParameterType>(data, parameterType), typeChoiceRenderer.getValues(), typeChoiceRenderer); typeChoice.setNullValid(true); typeChoice.setRequired(false); fs.add(typeChoice); }
private Form<Void> createSessionControlForm() { Form<Void> form = new Form<>(CID_SESSION_CONTROL_FORM); DropDownChoice<AnnotationLayer> layersDropdown = new BootstrapSelect<>(CID_SELECT_LAYER); layersDropdown.setModel(alStateModel.bind("layer")); layersDropdown.setChoices(LoadableDetachableModel.of(this::listLayersWithRecommenders)); layersDropdown.setChoiceRenderer(new LambdaChoiceRenderer<>(AnnotationLayer::getUiName)); layersDropdown.add(LambdaBehavior.onConfigure(it -> it.setEnabled(!alStateModel .getObject().isSessionActive()))); layersDropdown.setOutputMarkupId(true); layersDropdown.setRequired(true); form.add(layersDropdown); form.add(new LambdaAjaxSubmitLink(CID_START_SESSION_BUTTON, this::actionStartSession) .add(visibleWhen(() -> !alStateModel.getObject().isSessionActive()))); form.add(new LambdaAjaxLink(CID_STOP_SESSION_BUTTON, this::actionStopSession) .add(visibleWhen(() -> alStateModel.getObject().isSessionActive()))); form.add(visibleWhen(() -> alStateModel.getObject().isDoExistRecommenders())); return form; }