MECS-1454_Search_filter_improvements

Signed-off-by: venu1278 <venugopal.boodidadinne@in.bosch.com>
This commit is contained in:
venu1278
2016-02-04 11:19:45 +05:30
parent ee7603b8c2
commit 84830ba5d2
2 changed files with 21 additions and 21 deletions

View File

@@ -117,8 +117,6 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private LayoutClickListener nameLayoutClickListner; private LayoutClickListener nameLayoutClickListner;
private Label targetFilterStatusLabel;
private String newFilterQuery; private String newFilterQuery;
/** /**
@@ -158,7 +156,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
setUpCaptionLayout(true); setUpCaptionLayout(true);
resetComponents(); resetComponents();
} else if (custFUIEvent == CustomFilterUIEvent.TARGET_FILTER_STATUS_HIDE) { } else if (custFUIEvent == CustomFilterUIEvent.TARGET_FILTER_STATUS_HIDE) {
this.getUI().access(() -> targetFilterStatusLabel.setVisible(false)); this.getUI().access(() -> showValidationSuccesIcon());
} }
} }
@@ -188,8 +186,10 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private Label createStatusIcon() { private Label createStatusIcon() {
final Label statusIcon = new Label(FontAwesome.CHECK_CIRCLE.getHtml(), ContentMode.HTML); final Label statusIcon = new Label(FontAwesome.CHECK_CIRCLE.getHtml(), ContentMode.HTML);
statusIcon.addStyleName(SPUIStyleDefinitions.SUCCESS_ICON); statusIcon.setValue(null);
statusIcon.setSizeUndefined(); statusIcon.addStyleName(SPUIStyleDefinitions.TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE);
statusIcon.setVisible(false);
statusIcon.setImmediate(true);
return statusIcon; return statusIcon;
} }
@@ -203,11 +203,6 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
nameTextField = createNameTextField(); nameTextField = createNameTextField();
nameTextField.setWidth(380, Unit.PIXELS); nameTextField.setWidth(380, Unit.PIXELS);
targetFilterStatusLabel = new Label();
targetFilterStatusLabel.addStyleName(SPUIStyleDefinitions.TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE);
targetFilterStatusLabel.setVisible(false);
targetFilterStatusLabel.setImmediate(true);
queryTextField = createSearchField(); queryTextField = createSearchField();
addSearchLisenter(); addSearchLisenter();
@@ -358,7 +353,7 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
private void processQueryChange() { private void processQueryChange() {
this.getUI().access(() -> { this.getUI().access(() -> {
targetFilterStatusLabel.setVisible(true); validationIcon.setVisible(true);
onQueryChange(newFilterQuery); onQueryChange(newFilterQuery);
}); });
@@ -368,12 +363,11 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
boolean validationFailed = false; boolean validationFailed = false;
if (!Strings.isNullOrEmpty(text)) { if (!Strings.isNullOrEmpty(text)) {
final String input = text.toLowerCase(); final String input = text.toLowerCase();
searchLayout.addComponentAsFirst(targetFilterStatusLabel); searchLayout.addComponentAsFirst(validationIcon);
searchLayout.setComponentAlignment(targetFilterStatusLabel, Alignment.MIDDLE_CENTER); searchLayout.setComponentAlignment(validationIcon, Alignment.MIDDLE_CENTER);
searchLayout.addComponent(validationIcon, 2); showValidationInProgress();
final ValidationResult validationResult = FilterQueryValidation.getExpectedTokens(input); final ValidationResult validationResult = FilterQueryValidation.getExpectedTokens(input);
if (!validationResult.getIsValidationFailed()) { if (!validationResult.getIsValidationFailed()) {
showValidationSuccesIcon();
filterManagementUIState.setFilterQueryValue(input); filterManagementUIState.setFilterQueryValue(input);
filterManagementUIState.setIsFilterByInvalidFilterQuery(Boolean.FALSE); filterManagementUIState.setIsFilterByInvalidFilterQuery(Boolean.FALSE);
} else { } else {
@@ -417,14 +411,22 @@ public class CreateOrUpdateFilterHeader extends VerticalLayout implements Button
} }
private void showValidationSuccesIcon() { private void showValidationSuccesIcon() {
validationIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml()); if (null != filterManagementUIState.getFilterQueryValue()) {
validationIcon.setStyleName(SPUIStyleDefinitions.SUCCESS_ICON); validationIcon.setValue(FontAwesome.CHECK_CIRCLE.getHtml());
validationIcon.setDescription(""); validationIcon.setStyleName(SPUIStyleDefinitions.SUCCESS_ICON);
validationIcon.setDescription("");
}
} }
private void showValidationFailureIcon() { private void showValidationFailureIcon() {
validationIcon.setValue(FontAwesome.TIMES_CIRCLE.getHtml()); validationIcon.setValue(FontAwesome.TIMES_CIRCLE.getHtml());
validationIcon.setStyleName(SPUIStyleDefinitions.ERROR_ICON); validationIcon.setStyleName(SPUIStyleDefinitions.ERROR_ICON);
}
private void showValidationInProgress() {
validationIcon.setValue(null);
validationIcon.setStyleName(SPUIStyleDefinitions.TARGET_FILTER_SEARCH_PROGRESS_INDICATOR_STYLE);
} }
private SPUIButton createSearchResetIcon() { private SPUIButton createSearchResetIcon() {

View File

@@ -63,8 +63,6 @@ public class FilterManagementView extends VerticalLayout implements View {
@Autowired @Autowired
private transient EventBus.SessionEventBus eventBus; private transient EventBus.SessionEventBus eventBus;
private HorizontalLayout messageLabelLayout;
@Override @Override
public void enter(final ViewChangeEvent event) { public void enter(final ViewChangeEvent event) {
setSizeFull(); setSizeFull();
@@ -151,7 +149,7 @@ public class FilterManagementView extends VerticalLayout implements View {
} }
private HorizontalLayout addTargetFilterMessageLabel() { private HorizontalLayout addTargetFilterMessageLabel() {
messageLabelLayout = new HorizontalLayout(); final HorizontalLayout messageLabelLayout = new HorizontalLayout();
messageLabelLayout.addComponent(targetFilterCountMessageLabel); messageLabelLayout.addComponent(targetFilterCountMessageLabel);
messageLabelLayout.addStyleName("footer-layout"); messageLabelLayout.addStyleName("footer-layout");
messageLabelLayout.setWidth("100%"); messageLabelLayout.setWidth("100%");