public ComboBoxBaseBinder(ComboBoxBase view) { super(view); changeListener = new ChangeListener<Object>() { @Override public synchronized void changed(ObservableValue<?> observable, Object oldValue, Object newValue) { doOnchange(oldValue, newValue); } }; view.valueProperty().addListener(changeListener); }
@Test public void testGetComboBoxBaseAdjuster() { Adjuster adjuster = Adjuster.getAdjuster(ComboBoxBase.class); assertThat(adjuster, is(instanceOf(ControlAdjuster.class))); assertThat(adjuster.getNodeClass(), is(sameInstance(Control.class))); }
public ComboBoxBinder(ComboBoxBase view) { super(view); }
/** * Gathers all focusable {@link Node}s from the given {@link Parent} and all * its children. * * @param pParent the {@link Parent} at which to start. * @param pIndexedOnly {@code true} only {@link Node}s which do have a tab * index set will be returned. {@code false} will return all * focusable {@link Node}s. * @return all focusable {@link Node}s. */ public static List<Node> gatherFocusableNodes(Parent pParent, boolean pIndexedOnly) { if (pParent instanceof FXDesktopPane) { FXInternalWindow activeWindow = ((FXDesktopPane)pParent).getActiveWindow(); if (activeWindow != null) { return gatherFocusableNodes(activeWindow, pIndexedOnly); } } List<Node> nodes = pParent.getChildrenUnmodifiable(); if (nodes.isEmpty()) { return Collections.emptyList(); } if (isReverseOrderNeeded(pParent)) { nodes = new ArrayList<>(nodes); Collections.reverse(nodes); } List<Node> focusableNodes = new ArrayList<>(); for (Node node : nodes) { if (isTraversable(node)) { if (node instanceof ComboBoxBase) { // The ComboBoxBase does contain a text field (and some other stuff) // which we might accidentally include in our list. if (isFocusable(node) && (!pIndexedOnly || getTabIndex(node) != null)) { focusableNodes.add(node); } } else if (node instanceof TabPane) { // We need to check for a TabPane because Nodes on a tab that // is not the selected one can not be distinguished from others. TabPane tabPane = (TabPane)node; focusableNodes.add(tabPane); Tab selectedTab = tabPane.getSelectionModel().getSelectedItem(); if (selectedTab != null && selectedTab.getContent() != null) { focusableNodes.addAll(gatherFocusableNodes((Parent)selectedTab.getContent(), pIndexedOnly)); } } else { List<Node> newFocusableNodes = gatherFocusableNodes((Parent)node, pIndexedOnly); focusableNodes.addAll(newFocusableNodes); if (newFocusableNodes.isEmpty() && isFocusable(node) && (!pIndexedOnly || getTabIndex(node) != null)) { focusableNodes.add(node); } } } } return focusableNodes; }
public <T> void waitForValue(ComboBoxBase<T> comboBoxBase) { GuiTest.waitUntil(comboBoxBase, c -> c.getValue() != null); }