PL-6306 Add cuba-id for settings button of Filter

This commit is contained in:
Nikita Petunin 2016-03-23 13:33:11 +04:00
parent eec15de195
commit 0c4cbb1f6a
4 changed files with 22 additions and 0 deletions

View File

@ -158,4 +158,7 @@ public class DesktopFilterHelper implements FilterHelper {
@Override
public void setLookupFieldPageLength(LookupField lookupField, int pageLength) {
}
@Override
public void setDebugId(com.haulmont.cuba.gui.components.Component component, String id) {}
}

View File

@ -258,9 +258,11 @@ public class FilterDelegateImpl implements FilterDelegate {
controlsLayout = componentsFactory.createComponent(HBoxLayout.class);
controlsLayout.setSpacing(true);
controlsLayout.setWidth("100%");
filterHelper.setDebugId(controlsLayout, "filterControlsLayout");
filtersPopupBox = componentsFactory.createComponent(HBoxLayout.class);
filtersPopupBox.setStyleName("filter-search-button-layout");
filterHelper.setDebugId(filtersPopupBox, "filterPopupBox");
searchBtn = componentsFactory.createComponent(Button.class);
filtersPopupBox.add(searchBtn);
@ -273,14 +275,17 @@ public class FilterDelegateImpl implements FilterDelegate {
apply(false);
}
});
filterHelper.setDebugId(searchBtn, "filterSearchBtn");
filtersPopupButton = componentsFactory.createComponent(PopupButton.class);
filterHelper.setDebugId(filtersPopupButton, "filterPopupButton");
filtersPopupBox.add(filtersPopupButton);
filtersLookup = componentsFactory.createComponent(LookupField.class);
filtersLookup.setWidth(theme.get("cuba.gui.filter.select.width"));
filtersLookup.addValueChangeListener(new FiltersLookupChangeListener());
filterHelper.setLookupNullSelectionAllowed(filtersLookup, false);
filterHelper.setDebugId(filtersLookup, "filterLookup");
addConditionBtn = componentsFactory.createComponent(LinkButton.class);
addConditionBtn.setAlignment(Component.Alignment.MIDDLE_LEFT);
@ -291,24 +296,29 @@ public class FilterDelegateImpl implements FilterDelegate {
addConditionHelper.addCondition(conditions);
}
});
filterHelper.setDebugId(addConditionBtn, "filterAddConditionBtn");
controlsLayoutGap = componentsFactory.createComponent(Label.class);
filterHelper.setDebugId(controlsLayoutGap, "filterControlsLayoutGap");
controlsLayout.add(controlsLayoutGap);
controlsLayout.expand(controlsLayoutGap);
settingsBtn = componentsFactory.createComponent(PopupButton.class);
settingsBtn.setIcon("icons/gear.png");
filterHelper.setDebugId(settingsBtn, "filterSettingsBtn");
createFilterActions();
createMaxResultsLayout();
createFtsSwitch();
ftsSwitch.setAlignment(Component.Alignment.MIDDLE_RIGHT);
filterHelper.setDebugId(ftsSwitch, "filterFtsSwitch");
String layoutDescription = clientConfig.getGenericFilterControlsLayout();
ControlsLayoutBuilder controlsLayoutBuilder = createControlsLayoutBuilder(layoutDescription);
controlsLayoutBuilder.build();
maxResultsLayout.setVisible(isMaxResultsLayoutVisible());
filterHelper.setDebugId(maxResultsLayout, "filterMaxResultsLayout");
}
protected void createControlsLayoutForFts() {

View File

@ -93,4 +93,6 @@ public interface FilterHelper {
void addShortcutListener(TextField textField, ShortcutListener listener);
void setLookupFieldPageLength(LookupField lookupField, int pageLength);
void setDebugId(Component component, String id);
}

View File

@ -326,4 +326,11 @@ public class WebFilterHelper implements FilterHelper {
ComboBox vComboBox = (ComboBox) WebComponentsHelper.unwrap(lookupField);
vComboBox.setPageLength(pageLength);
}
@Override
public void setDebugId(com.haulmont.cuba.gui.components.Component component, String id) {
if (component != null && AppUI.getCurrent().isTestMode()) {
WebComponentsHelper.unwrap(component).setCubaId(id);
}
}
}