Added the search icon for executing the filter query.
Signed-off-by: Gaurav <gaurav.sahay@in.bosch.com>
This commit is contained in:
@@ -52,6 +52,7 @@ import com.vaadin.ui.HorizontalLayout;
|
||||
import com.vaadin.ui.Label;
|
||||
import com.vaadin.ui.Link;
|
||||
import com.vaadin.ui.TextField;
|
||||
import com.vaadin.ui.UI;
|
||||
import com.vaadin.ui.VerticalLayout;
|
||||
import com.vaadin.ui.themes.ValoTheme;
|
||||
|
||||
@@ -111,6 +112,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
|
||||
private Link helpLink;
|
||||
|
||||
private Button searchIcon;
|
||||
|
||||
private String oldFilterName;
|
||||
|
||||
private String oldFilterQuery;
|
||||
@@ -195,6 +198,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
nameTextField.setWidth(380, Unit.PIXELS);
|
||||
|
||||
saveButton = createSaveButton();
|
||||
searchIcon = createSearchIcon();
|
||||
|
||||
helpLink = SPUIComponentProvider.getHelpLink(uiProperties.getLinks().getDocumentation().getTargetfilterView());
|
||||
|
||||
@@ -292,7 +296,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
final HorizontalLayout iconLayout = new HorizontalLayout();
|
||||
iconLayout.setSizeUndefined();
|
||||
iconLayout.setSpacing(false);
|
||||
iconLayout.addComponents(helpLink, saveButton);
|
||||
iconLayout.addComponents(helpLink, searchIcon, saveButton);
|
||||
|
||||
final HorizontalLayout queryLayout = new HorizontalLayout();
|
||||
queryLayout.setSizeUndefined();
|
||||
@@ -324,10 +328,12 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
if (validationFailed || (isNameAndQueryEmpty(nameTextField.getValue(), query)
|
||||
|| (query.equals(oldFilterQuery) && nameTextField.getValue().equals(oldFilterName)))) {
|
||||
saveButton.setEnabled(false);
|
||||
searchIcon.setEnabled(false);
|
||||
} else {
|
||||
if (hasSavePermission()) {
|
||||
saveButton.setEnabled(true);
|
||||
}
|
||||
searchIcon.setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,6 +369,22 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
||||
return saveButton;
|
||||
}
|
||||
|
||||
private Button createSearchIcon() {
|
||||
searchIcon = SPUIComponentProvider.getButton(UIComponentIdProvider.FILTER_SEARCH_ICON_ID, "", "", null, false,
|
||||
FontAwesome.SEARCH, SPUIButtonStyleSmallNoBorder.class);
|
||||
searchIcon.addClickListener(event -> onSearchIconClick());
|
||||
searchIcon.setEnabled(false);
|
||||
searchIcon.setData(false);
|
||||
return searchIcon;
|
||||
}
|
||||
|
||||
private void onSearchIconClick() {
|
||||
if (!queryTextField.isValidationError()) {
|
||||
queryTextField.showValidationInProgress();
|
||||
queryTextField.getExecutor().execute(queryTextField.new StatusCircledAsync(UI.getCurrent()));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buttonClick(final ClickEvent event) {
|
||||
if (UIComponentIdProvider.CUSTOM_FILTER_SAVE_ICON.equals(event.getComponent().getId())
|
||||
|
||||
@@ -876,6 +876,10 @@ public final class UIComponentIdProvider {
|
||||
* ID for download anonymous checkbox
|
||||
*/
|
||||
public static final String DOWNLOAD_ANONYMOUS_CHECKBOX = "downloadanonymouscheckbox";
|
||||
/**
|
||||
* Id of custom filter query search Icon.
|
||||
*/
|
||||
public static final String FILTER_SEARCH_ICON_ID = "filter.search.icon";
|
||||
|
||||
/**
|
||||
* /* Private Constructor.
|
||||
|
||||
Reference in New Issue
Block a user