List of usage examples for com.vaadin.server ErrorMessage ErrorMessage
ErrorMessage
From source file:edu.kit.dama.ui.admin.administration.user.UserDataAdministrationTab.java
License:Apache License
private Button getFilterButton() { if (filterButton == null) { String id = "filterButton"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); filterButton = new Button("Filter"); filterButton.setId(DEBUG_ID_PREFIX + id); filterButton.setWidth("100%"); filterButton.setSizeFull();//w ww . ja va 2 s .c o m filterButton.setClickShortcut(ShortcutAction.KeyCode.ENTER, new int[] {}); filterButton.addClickListener((Button.ClickEvent event) -> { String filterExpression = (String) getFilterSearchField().getValue(); // Check if searchField is empty if (filterExpression == null || filterExpression.isEmpty()) { getFilterSearchField().setComponentError(new ErrorMessage() { @Override public ErrorMessage.ErrorLevel getErrorLevel() { return ErrorMessage.ErrorLevel.ERROR; } @Override public String getFormattedHtmlMessage() { return "Filter expression must not be empty."; } }); return; } else { getFilterSearchField().setComponentError(null); } // Filter selected column UserDataFilter.SearchSpace searchSpace = (UserDataFilter.SearchSpace) getFilterOptions().getValue(); getUserDataTablePanel().addTableFilter(filterExpression, (String) getFilterColumnBox().getValue(), searchSpace); getRemoveAllFiltersButton().setEnabled(true); closeFilterWindow(); }); } return filterButton; }
From source file:edu.kit.dama.ui.admin.administration.usergroup.UserGroupAdministrationTab.java
License:Apache License
private Button getFilterButton() { if (filterButton == null) { String id = "filterButton"; LOGGER.debug("Building " + DEBUG_ID_PREFIX + id + " ..."); filterButton = new Button("Filter"); filterButton.setId(DEBUG_ID_PREFIX + id); filterButton.setWidth("100%"); filterButton.setSizeFull();// w ww. j a va 2s . c o m filterButton.setClickShortcut(ShortcutAction.KeyCode.ENTER, new int[] {}); filterButton.addClickListener((Button.ClickEvent event) -> { String filterExpression = (String) getFilterSearchField().getValue(); // Check if searchField is empty if (filterExpression == null || filterExpression.isEmpty()) { getFilterSearchField().setComponentError(new ErrorMessage() { @Override public ErrorMessage.ErrorLevel getErrorLevel() { return ErrorMessage.ErrorLevel.ERROR; } @Override public String getFormattedHtmlMessage() { return "Filter expression must not be empty."; } }); return; } else { getFilterSearchField().setComponentError(null); } // Filter selected column getColumnBox().getValue(); UserGroupFilter.SearchSpace searchSpace = (UserGroupFilter.SearchSpace) getFilterOptions() .getValue(); getUserGroupTablePanel().addTableFilter(filterExpression, (String) getColumnBox().getValue(), searchSpace); getRemoveAllFiltersButton().setEnabled(true); closeFilterWindow(); }); } return filterButton; }
From source file:probe.com.view.core.DoubleTextField.java
@Override public void valueChange(Property.ValueChangeEvent event) { this.setComponentError(null); if (this.getValue() == null || this.getValue().trim().equalsIgnoreCase("")) { value = 0;//from w w w .j av a 2 s . c om return; } try { value = Double.valueOf(this.getValue()); valid = true; } catch (NumberFormatException exp) { valid = false; this.setComponentError(new ErrorMessage() { @Override public ErrorMessage.ErrorLevel getErrorLevel() { return ErrorLevel.ERROR; } @Override public String getFormattedHtmlMessage() { return "Only Double Value Allowed"; } }); } }
From source file:probe.com.view.unused.DoubleBetweenValuesFilter.java
@Override public void buttonClick(Button.ClickEvent event) { filterConfirmLabel.setVisible(false); control.removeFilter(filterBtn.getCaption()); if (minValueField.getDoubleValue() <= 0 && maxValueField.getDoubleValue() <= 0) { //do nothing...remove the filter return;/*from www.j ava2 s . c om*/ } if (maxValueField.isValid() && minValueField.isValid()) { if (minValueField.getDoubleValue() > maxValueField.getDoubleValue()) { okBtn.setComponentError(new ErrorMessage() { @Override public ErrorMessage.ErrorLevel getErrorLevel() { return ErrorMessage.ErrorLevel.ERROR; } @Override public String getFormattedHtmlMessage() { return "Min Value > Max Value"; } }); } else { okBtn.setComponentError(null); filterBtn.setValue( "Between " + minValueField.getDoubleValue() + " AND " + maxValueField.getDoubleValue()); control.addFilter(filterBtn); filterConfirmLabel.setVisible(true); } // minValueField.setComponentError(null); // maxValueField.setComponentError(null); } }