@Test public void getText() { List<String> text = new ArrayList<>(); Platform.runLater(() -> { tabPane.marathon_select("Tab 2"); text.add(tabPane.getAttribute("text")); }); new Wait("Waiting for the tab selection.") { @Override public boolean until() { return text.size() > 0; } }; AssertJUnit.assertEquals("Tab 2", text.get(0)); }
@Override public boolean marathon_select(String tab) { Matcher matcher = CLOSE_PATTERN.matcher(tab); boolean isCloseTab = matcher.matches(); tab = isCloseTab ? matcher.group(1) : tab; TabPane tp = (TabPane) node; ObservableList<Tab> tabs = tp.getTabs(); for (int index = 0; index < tabs.size(); index++) { String current = getTextForTab(tp, tabs.get(index)); if (tab.equals(current)) { if (isCloseTab) { closeTab(tabs.get(index)); return true; } tp.getSelectionModel().select(index); return true; } } return false; }
JavaFXTabPaneElement extends JavaFXElement { @Override public boolean marathon_select(String tab) { Matcher matcher = CLOSE_PATTERN.matcher(tab); boolean isCloseTab = matcher.matches(); tab = isCloseTab ? matcher.group(1) : tab; TabPane tp = (TabPane) node; ObservableList<Tab> tabs = tp.getTabs(); for (int index = 0; index < tabs.size(); index++) { String current = getTextForTab(tp, tabs.get(index)); if (tab.equals(current)) { if (isCloseTab) { closeTab(tabs.get(index)); return true; } tp.getSelectionModel().select(index); return true; } } return false; } }
JavaFXTabPaneElement extends JavaFXElement { @Override public boolean marathon_select(String tab) { Matcher matcher = CLOSE_PATTERN.matcher(tab); boolean isCloseTab = matcher.matches(); tab = isCloseTab ? matcher.group(1) : tab; TabPane tp = (TabPane) node; ObservableList<Tab> tabs = tp.getTabs(); for (int index = 0; index < tabs.size(); index++) { String current = getTextForTab(tp, tabs.get(index)); if (tab.equals(current)) { if (isCloseTab) { closeTab(tabs.get(index)); return true; } tp.getSelectionModel().select(index); return true; } } return false; } JavaFXTabPaneElement(Node component, IJavaFXAgent driver, JFXWindow window); }
JavaFXTabPaneElement extends JavaFXElement { @Override public boolean marathon_select(String tab) { Matcher matcher = CLOSE_PATTERN.matcher(tab); boolean isCloseTab = matcher.matches(); tab = isCloseTab ? matcher.group(1) : tab; TabPane tp = (TabPane) node; ObservableList<Tab> tabs = tp.getTabs(); for (int index = 0; index < tabs.size(); index++) { String current = getTextForTab(tp, tabs.get(index)); if (tab.equals(current)) { if (isCloseTab) { closeTab(tabs.get(index)); return true; } tp.getSelectionModel().select(index); return true; } } return false; } JavaFXTabPaneElement(Node component, IJavaFXAgent driver, JFXWindow window); @Override List<IJavaFXElement> getByPseudoElement(String selector, Object[] params); @Override boolean marathon_select(String tab); @Override String _getText(); String getContent(); }
JavaFXTabPaneElement extends JavaFXElement { @Override public boolean marathon_select(String tab) { Matcher matcher = CLOSE_PATTERN.matcher(tab); boolean isCloseTab = matcher.matches(); tab = isCloseTab ? matcher.group(1) : tab; TabPane tp = (TabPane) node; ObservableList<Tab> tabs = tp.getTabs(); for (int index = 0; index < tabs.size(); index++) { String current = getTextForTab(tp, tabs.get(index)); if (tab.equals(current)) { if (isCloseTab) { closeTab(tabs.get(index)); return true; } tp.getSelectionModel().select(index); return true; } } return false; } JavaFXTabPaneElement(Node component, IJavaFXAgent driver, JFXWindow window); @Override List<IJavaFXElement> getByPseudoElement(String selector, Object[] params); @Override boolean marathon_select(String tab); @Override String _getText(); String getContent(); static final Logger LOGGER; }