/** * Constructs a new {@link SplitPaneDividerPositionListener}. * @param subject the {@link SplitPane} subject to monitor. * @param callBack the {@link DividerPositionsChangedCallBack} to trigger. */ public SplitPaneDividerPositionListener( SplitPane subject, DividerPositionsChangedCallBack callBack ) { this.subject = subject; this.positionDividers = new HashSet<>(); this.commonListener = ( source, old, updated ) -> callBack.dividerPositionsChanged(); this.subject.getDividers().addListener( ( Change< ? extends Divider > change ) -> updateDividerRegistrations() ); updateDividerRegistrations(); }
@Test public void shouldNotCallBackWhenRemovedDividerPositionIsChanged() { Divider divider = subject.getDividers().get( 0 ); subject.getItems().clear(); divider.setPosition( 0.1 ); verify( callBack, never() ).dividerPositionsChanged(); }
void addColumn(final int position) { SplitPane firstRow = splitPaneRows.get(0); double lastDividerPosition = position == 0 ? 0 : firstRow.getDividers().get(position-1).getPosition(); double nextDividerPosition = position >= firstRow.getItems().size()-1 ? 1 : firstRow.getDividers().get(position).getPosition(); firstRow.getItems().add(position+1, createViewer().getView()); Divider firstDivider = firstRow.getDividers().get(position); firstDivider.setPosition((lastDividerPosition + nextDividerPosition)/2); for (int i = 1; i < splitPaneRows.size(); i++) { SplitPane splitRow = splitPaneRows.get(i); splitRow.getItems().add(position+1, createViewer().getView()); } refreshDividerBindings(); }
private void hideProcsPane(){ Divider div = splitPane.getDividers().get(0); entopDivPosition = div.getPosition(); div.setPosition(0d); splitPane.getItems().remove(0); }
private void showProcsPane(){ splitPane.getItems().add(0, entopPane); Divider div = splitPane.getDividers().get(0); div.setPosition(entopDivPosition); }