@Override public void clearSearch() { searchInput.setValue(""); }
@Override public String getConfirmedName() { return confirmedName.getValue(); }
@Override public void focus() { name.focus(); } }
@Override public void clearAllSelectFilter() { selectInputs.values().forEach(values -> { values.forEach(i -> { if (i.getChecked()) { i.setChecked(false); } }); }); }
@Override public void addParameterNameChangeHandler(final ParameterizedCommand<String> command) { name.addEventListener(BrowserEvents.BLUR, (e) -> command.execute(name.getValue()), false); }
final Label labelElement = (Label) getDocument().createElement("label"); final Input input = (Input) getDocument().createElement("input"); input.setType("checkbox"); input.setValue(entry.getKey()); input.setAttribute("data-label", entry.getValue()); input.addEventListener("change", e -> { final List<String> values = new ArrayList<>(); final List<String> labels = new ArrayList<>(); selectInputs.get(label).stream().filter(i -> i.getChecked()).forEach(i -> { values.add(i.getValue()); labels.add(i.getAttribute("data-label")); });
final Consumer<ActiveFilterItem<T>> callback) { customizeCallback.accept(input); input.setAttribute("placeholder", placeholder); input.setAttribute("data-filter", label); addCSSClass(input, "hidden"); input.setOnkeypress((KeyboardEvent e) -> { if ((e == null || e.getKeyCode() == KeyCodes.KEY_ENTER) && input.getValue().isEmpty() == false) { addActiveFilter(label, input.getValue(), null, valueMapper.apply(input.getValue()), callback); input.setValue("");
@Override public void checkSelectFilter(final String label, final String value) { selectInputs.computeIfPresent(label, (key, values) -> { values.forEach(i -> { if (i.getValue().equals(value) && i.getChecked() == false) { i.setChecked(true); } }); return values; }); }
@Override public void show() { nameInput.setValue(""); nameErrorLabel.setTextContent(""); formDiv.setClassName("form-group"); fluidOption.setSelected(true); pageOption.setSelected(false); nameLabel.setTextContent(i18n.newPerspectivePopUpViewName()); nameHelp.setTitle(i18n.newPerspectivePopUpViewNameHelp()); styleLabel.setTextContent(i18n.newPerspectivePopUpViewStyle()); styleHelp.setTitle(i18n.newPerspectivePopUpViewStyleHelp()); okButton.setTextContent(i18n.newPerspectivePopUpViewOk()); cancelButton.setTextContent(i18n.newPerspectivePopUpViewCancel()); fluidOption.setTextContent(i18n.newPerspectivePopUpViewFluid()); pageOption.setTextContent(i18n.newPerspectivePopUpViewPage()); modal.setTitle(i18n.newPerspectivePopUpViewTitle()); modal.show(); nameInput.focus(); }
private boolean validateForm() { clearErrorMessages(); final boolean newCommentEmpty = isNullOrEmpty(newCommentTextArea.getValue()); if (newCommentEmpty) { newCommentTextArea.focus(); newCommentTextAreaHelp.setTextContent(translationService.format(CASE_COMMENT_CANT_BE_EMPTY)); newCommentTextAreaGroup.setValidationState(ValidationState.ERROR); return false; } return true; }
@Override public void setSearchHint(String text) { searchInput.setAttribute("placeholder", text); }
private int constraintValue() { if (isConstraintValueTypeLiteral.getChecked()) { return BaseSingleFieldConstraint.TYPE_LITERAL; } else if (isConstraintValueTypeRetValue.getChecked()) { return BaseSingleFieldConstraint.TYPE_RET_VALUE; } else if (isConstraintValueTypePredicate.getChecked()) { return BaseSingleFieldConstraint.TYPE_PREDICATE; } return BaseSingleFieldConstraint.TYPE_UNDEFINED; } }
@Override public void selectConstraintValue(final int constraintValue) { isConstraintValueTypeLiteral.setChecked(false); isConstraintValueTypeRetValue.setChecked(false); isConstraintValueTypePredicate.setChecked(false); switch (constraintValue) { case BaseSingleFieldConstraint.TYPE_LITERAL: isConstraintValueTypeLiteral.setChecked(true); break; case BaseSingleFieldConstraint.TYPE_RET_VALUE: isConstraintValueTypeRetValue.setChecked(true); break; case BaseSingleFieldConstraint.TYPE_PREDICATE: isConstraintValueTypePredicate.setChecked(true); break; } }
@Override public void addNumericFilter(final String label, final String placeholder, final Consumer<ActiveFilterItem<Integer>> callback) { createFilterOption(label); createNumberInput(label, placeholder, refineSelect.getOptions().getLength() > 1, input -> { input.setType("number"); input.setAttribute("min", "0"); }, v -> Integer.valueOf(v), callback); }
@Test public void testCheckSelectFilter(){ final Input input1 = mock(Input.class); when(input1.getChecked()).thenReturn(true); when(input1.getValue()).thenReturn("1"); final Input input2 = mock(Input.class); when(input2.getChecked()).thenReturn(false); when(input2.getValue()).thenReturn("2"); view.getSelectInputs().put("label1", Arrays.asList( input1, input2 )); view.checkSelectFilter("label1", "1"); view.checkSelectFilter("label1", "2"); verify(input1, never()).setChecked(true); verify(input2).setChecked(true); } }
@Override public void show() { nameInput.setValue(""); nameErrorLabel.setTextContent(""); formDiv.setClassName("form-group"); fluidOption.setSelected(true); pageOption.setSelected(false); nameLabel.setTextContent(i18n.newPerspectivePopUpViewName()); nameHelp.setTitle(i18n.newPerspectivePopUpViewNameHelp()); styleLabel.setTextContent(i18n.newPerspectivePopUpViewStyle()); styleHelp.setTitle(i18n.newPerspectivePopUpViewStyleHelp()); okButton.setTextContent(i18n.newPerspectivePopUpViewOk()); cancelButton.setTextContent(i18n.newPerspectivePopUpViewCancel()); fluidOption.setTextContent(i18n.newPerspectivePopUpViewFluid()); pageOption.setTextContent(i18n.newPerspectivePopUpViewPage()); modal.setTitle(i18n.newPerspectivePopUpViewTitle()); modal.show(); nameInput.focus(); }
private boolean validateForm() { clearErrorMessages(); final boolean newCommentEmpty = isNullOrEmpty(newCommentTextArea.getValue()); if (newCommentEmpty) { newCommentTextArea.focus(); newCommentTextAreaHelp.setTextContent(translationService.format(CASE_COMMENT_CANT_BE_EMPTY)); newCommentTextAreaGroup.setValidationState(ValidationState.ERROR); return false; } return true; }
@Override public void clearSelectFilter(final String label) { selectInputs.computeIfPresent(label, (key, values) -> { values.forEach(i -> { if (i.getChecked()) { i.setChecked(false); } }); return values; }); }
@Override public void setSearchHint(String text) { searchInput.setAttribute("placeholder", text); }