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.Label;
|
||||||
import com.vaadin.ui.Link;
|
import com.vaadin.ui.Link;
|
||||||
import com.vaadin.ui.TextField;
|
import com.vaadin.ui.TextField;
|
||||||
|
import com.vaadin.ui.UI;
|
||||||
import com.vaadin.ui.VerticalLayout;
|
import com.vaadin.ui.VerticalLayout;
|
||||||
import com.vaadin.ui.themes.ValoTheme;
|
import com.vaadin.ui.themes.ValoTheme;
|
||||||
|
|
||||||
@@ -111,6 +112,8 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
|
|
||||||
private Link helpLink;
|
private Link helpLink;
|
||||||
|
|
||||||
|
private Button searchIcon;
|
||||||
|
|
||||||
private String oldFilterName;
|
private String oldFilterName;
|
||||||
|
|
||||||
private String oldFilterQuery;
|
private String oldFilterQuery;
|
||||||
@@ -195,6 +198,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
nameTextField.setWidth(380, Unit.PIXELS);
|
nameTextField.setWidth(380, Unit.PIXELS);
|
||||||
|
|
||||||
saveButton = createSaveButton();
|
saveButton = createSaveButton();
|
||||||
|
searchIcon = createSearchIcon();
|
||||||
|
|
||||||
helpLink = SPUIComponentProvider.getHelpLink(uiProperties.getLinks().getDocumentation().getTargetfilterView());
|
helpLink = SPUIComponentProvider.getHelpLink(uiProperties.getLinks().getDocumentation().getTargetfilterView());
|
||||||
|
|
||||||
@@ -292,7 +296,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
final HorizontalLayout iconLayout = new HorizontalLayout();
|
final HorizontalLayout iconLayout = new HorizontalLayout();
|
||||||
iconLayout.setSizeUndefined();
|
iconLayout.setSizeUndefined();
|
||||||
iconLayout.setSpacing(false);
|
iconLayout.setSpacing(false);
|
||||||
iconLayout.addComponents(helpLink, saveButton);
|
iconLayout.addComponents(helpLink, searchIcon, saveButton);
|
||||||
|
|
||||||
final HorizontalLayout queryLayout = new HorizontalLayout();
|
final HorizontalLayout queryLayout = new HorizontalLayout();
|
||||||
queryLayout.setSizeUndefined();
|
queryLayout.setSizeUndefined();
|
||||||
@@ -324,10 +328,12 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
if (validationFailed || (isNameAndQueryEmpty(nameTextField.getValue(), query)
|
if (validationFailed || (isNameAndQueryEmpty(nameTextField.getValue(), query)
|
||||||
|| (query.equals(oldFilterQuery) && nameTextField.getValue().equals(oldFilterName)))) {
|
|| (query.equals(oldFilterQuery) && nameTextField.getValue().equals(oldFilterName)))) {
|
||||||
saveButton.setEnabled(false);
|
saveButton.setEnabled(false);
|
||||||
|
searchIcon.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
if (hasSavePermission()) {
|
if (hasSavePermission()) {
|
||||||
saveButton.setEnabled(true);
|
saveButton.setEnabled(true);
|
||||||
}
|
}
|
||||||
|
searchIcon.setEnabled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,6 +369,22 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
|
|||||||
return saveButton;
|
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
|
@Override
|
||||||
public void buttonClick(final ClickEvent event) {
|
public void buttonClick(final ClickEvent event) {
|
||||||
if (UIComponentIdProvider.CUSTOM_FILTER_SAVE_ICON.equals(event.getComponent().getId())
|
if (UIComponentIdProvider.CUSTOM_FILTER_SAVE_ICON.equals(event.getComponent().getId())
|
||||||
|
|||||||
@@ -876,6 +876,10 @@ public final class UIComponentIdProvider {
|
|||||||
* ID for download anonymous checkbox
|
* ID for download anonymous checkbox
|
||||||
*/
|
*/
|
||||||
public static final String DOWNLOAD_ANONYMOUS_CHECKBOX = "downloadanonymouscheckbox";
|
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.
|
* /* Private Constructor.
|
||||||
|
|||||||
Reference in New Issue
Block a user