Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Collapse grid buttons as space is available #1597

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 7 additions & 25 deletions src/org/labkey/test/components/ui/grids/TabbedGridPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

import static org.labkey.test.WebDriverWrapper.WAIT_FOR_JAVASCRIPT;
Expand Down Expand Up @@ -115,39 +114,22 @@ protected ElementCache newElementCache()
return new ElementCache();
}

public Optional<MultiMenu> optionalMoreMenu()
{
return elementCache().gridMoreMenu();
}

public MultiMenu clickAssayMenu()
{
MultiMenu menu;
if (optionalMoreMenu().isPresent())
{
menu = optionalMoreMenu().get();
optionalMoreMenu().get().openMenuTo("Import Assay Data");
}
else
menu = elementCache().gridAssayMenu;
if (elementCache().gridAssayMenuFinder.findOptional().isPresent())
return elementCache().gridAssayMenu;

MultiMenu menu = elementCache().gridMoreMenu;
menu.openMenuTo("Import Assay Data");
return menu;
}
public void clickAssay(String assayName)
{
MultiMenu menu = clickAssayMenu();
menu.clickSubMenu(getWrapper().defaultWaitForPage, assayName);
}

protected class ElementCache extends Component<?>.ElementCache
{
MultiMenu.MultiMenuFinder gridMoreMenuFinder = new MultiMenu.MultiMenuFinder(getDriver()).withText("More");
Optional<MultiMenu> gridMoreMenu()
{
return gridMoreMenuFinder.findOptional(this);
}
MultiMenu gridMoreMenu = new MultiMenu.MultiMenuFinder(getDriver()).withText("More").findWhenNeeded();

MultiMenu gridAssayMenu = new MultiMenu.MultiMenuFinder(getDriver()).withText("Assay").findWhenNeeded(this);
MultiMenu.MultiMenuFinder gridAssayMenuFinder = new MultiMenu.MultiMenuFinder(getDriver()).withText("Assay");
MultiMenu gridAssayMenu = gridAssayMenuFinder.findWhenNeeded(this);

final WebElement body = Locator.tagWithClass("div", "tabbed-grid-panel__body")
.findWhenNeeded(this).withTimeout(WAIT_FOR_JAVASCRIPT);
Expand Down