List of usage examples for javafx.beans.binding Bindings size
public static <K, V> IntegerBinding size(final ObservableMap<K, V> op)
From source file:mesclasses.view.RapportEleveController.java
/** * Initializes the controller class./*ww w .ja v a2s . co m*/ */ @Override public void initialize(URL url, ResourceBundle rb) { name = "Rapport Classe Ctrl"; super.initialize(url, rb); trimestreIndex = new SimpleIntegerProperty(); selectedTrimestre = new SimpleStringProperty(); selectedFileType = new SimpleStringProperty(); selectBulletin(); selectedFileType.addListener((observable, oldValue, newValue) -> { refreshGrid(); }); trimestreLabel.textProperty().bind(selectedTrimestre); previousBtn.disableProperty() .bind(Bindings.or(Bindings.size(trimestres).lessThan(2), trimestreIndex.isEqualTo(0))); Btns.makeLeft(previousBtn); nextBtn.disableProperty().bind(Bindings.or(Bindings.size(trimestres).lessThan(2), trimestreIndex.isEqualTo(trimestres.size() - 1))); Btns.makeRight(nextBtn); bulletinBtn.prefWidthProperty().bind(bulletinPane.widthProperty()); vieScolaireBtn.prefWidthProperty().bind(vieScolairePane.widthProperty()); orientationBtn.prefWidthProperty().bind(orientationPane.widthProperty()); }
From source file:dpfmanager.shell.interfaces.gui.component.report.ReportsView.java
private void addHeaders() { TableColumn colDate = new TableColumn(bundle.getString("colDate")); setMinMaxWidth(colDate, 75);/* w w w. ja v a 2 s . co m*/ colDate.setCellValueFactory(new PropertyValueFactory<ReportRow, String>("date")); TableColumn colTime = new TableColumn(bundle.getString("colTime")); setMinMaxWidth(colTime, 75); colTime.setCellValueFactory(new PropertyValueFactory<ReportRow, String>("time")); TableColumn colN = new TableColumn(bundle.getString("colN")); setMinMaxWidth(colN, 70); colN.setCellValueFactory(new PropertyValueFactory<ReportRow, String>("nfiles")); TableColumn colFile = new TableColumn(bundle.getString("colFile")); setMinMaxWidth(colFile, 160); colFile.setCellValueFactory(new PropertyValueFactory<ReportRow, String>("input")); TableColumn colErrors = new TableColumn(bundle.getString("colErrors")); setMinMaxWidth(colErrors, 65); colErrors.setCellValueFactory(new PropertyValueFactory<ReportRow, String>("errors")); TableColumn colWarnings = new TableColumn(bundle.getString("colWarnings")); setMinMaxWidth(colWarnings, 85); colWarnings.setCellValueFactory(new PropertyValueFactory<ReportRow, String>("warnings")); TableColumn colPassed = new TableColumn(bundle.getString("colPassed")); setMinMaxWidth(colPassed, 65); colPassed.setCellValueFactory(new PropertyValueFactory<ReportRow, String>("passed")); colScore = new TableColumn(bundle.getString("colScore")); setMinMaxWidth(colScore, 75); colScore.setCellValueFactory(new PropertyValueFactory<ReportRow, String>("score")); colFormats = new TableColumn(bundle.getString("colFormats")); setMinMaxWidth(colFormats, 120); colFormats .setCellValueFactory(new PropertyValueFactory<ReportRow, ObservableMap<String, String>>("formats")); colDelete = new TableColumn(bundle.getString("colDelete")); setMinMaxWidth(colDelete, 30); colDelete.setVisible(true); colDelete.setCellValueFactory(new PropertyValueFactory<>("delete")); tabReports.skinProperty().addListener((obs, oldSkin, newSkin) -> { TableHeaderRow header = (TableHeaderRow) tabReports.lookup("TableHeaderRow"); header.reorderingProperty().addListener((o, oldVal, newVal) -> header.setReordering(false)); }); tabReports.setPrefWidth(840.0); tabReports.setFixedCellSize(28.0); tabReports.getColumns().addAll(colDate, colTime, colN, colFile, colErrors, colWarnings, colPassed, colScore, colFormats, colDelete); tabReports.setCursor(Cursor.DEFAULT); tabReports.setEditable(false); tabReports.setMaxHeight(470.0); // Change column colors changeColumnTextColor(colDate, Color.LIGHTGRAY); changeColumnTextColor(colTime, Color.LIGHTGRAY); changeColumnTextColor(colFile, Color.LIGHTGRAY); changeColumnTextColor(colN, Color.CYAN); changeColumnTextColor(colErrors, Color.RED); changeColumnTextColor(colWarnings, Color.ORANGE); changeColumnTextColor(colPassed, Color.GREENYELLOW); changeColumnTextColor(colScore, Color.LIGHTGRAY); // Columns factories Bindings.size(tabReports.getItems()).addListener(new ChangeListener<Number>() { @Override public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) { resizeTable(); } }); addChartScore(); addFormatIcons(); addDeleteIcon(); }
From source file:org.mskcc.shenkers.view.IntervalViewNGTest.java
@Test public void testGenericStackedIntervalView() throws InterruptedException { List<Pair<Integer, Integer>> intervals = Arrays.asList(new Pair(0, 1), new Pair(1, 2), new Pair(2, 3), new Pair(3, 4), new Pair(4, 5), new Pair(5, 6)); List<Pane> nodes = intervals.stream().map(i -> new RectangleIntervalNode()).collect(Collectors.toList()); GenericStackedIntervalView p = new GenericStackedIntervalView(0, 6); p.setData(intervals, nodes);/*ww w . j a va 2 s . c om*/ ScrollPane sp = new ScrollPane(p); ScrollBar sb = new ScrollBar(); sb.maxProperty().bind(sp.vmaxProperty()); sb.minProperty().bind(sp.vminProperty()); sb.visibleAmountProperty().bind(sp.heightProperty().divide(p.prefHeightProperty())); sb.setOrientation(Orientation.VERTICAL); sp.vvalueProperty().bindBidirectional(sb.valueProperty()); HiddenSidesPane hsp = new HiddenSidesPane(); hsp.setContent(sp); hsp.setRight(sb); sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); p.setOrientation(Orientation.VERTICAL); p.prefTileHeightProperty().bind(new SimpleDoubleProperty(40)); // p.minHeightProperty().bind(new SimpleDoubleProperty(20).multiply(Bindings.size(p.getChildren()))); p.prefTileWidthProperty().bind(sp.widthProperty()); p.prefHeightProperty() .bind(new SimpleDoubleProperty(50).multiply(Bindings.size(p.getChildren())).subtract(10)); p.prefWidthProperty().bind(sp.widthProperty()); sp.setPadding(Insets.EMPTY); p.setVgap(10); CountDownLatch l = new CountDownLatch(1); Platform.runLater(() -> { Stage stage = new Stage(); stage.setOnHidden(e -> { l.countDown(); }); Scene scene = new Scene(hsp, 300, 300, Color.GRAY); stage.setTitle("GenericStackedPaneTest"); stage.setScene(scene); stage.show(); }); l.await(); }
From source file:org.mskcc.shenkers.view.IntervalViewNGTest.java
public void testStackedIntervalView() throws InterruptedException { StackedIntervalView p = new StackedIntervalView(0, 6); p.setData(Arrays.asList(new Pair(0, 1), new Pair(1, 2), new Pair(2, 3), new Pair(3, 4), new Pair(4, 5), new Pair(5, 6) //, {8, 10}, {1, 2}, {3, 7}, // {9, 10}, {1, 2}, {3, 5}, {6, 7}, {8, 10}, {2, 5}, {8, 10} ));//from ww w.j a v a2 s . c o m ScrollPane sp = new ScrollPane(p); ScrollBar sb = new ScrollBar(); sb.maxProperty().bind(sp.vmaxProperty()); sb.minProperty().bind(sp.vminProperty()); sb.visibleAmountProperty().bind(sp.heightProperty().divide(p.prefHeightProperty())); sb.setOrientation(Orientation.VERTICAL); sp.vvalueProperty().bindBidirectional(sb.valueProperty()); HiddenSidesPane hsp = new HiddenSidesPane(); hsp.setContent(sp); hsp.setRight(sb); sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); p.setOrientation(Orientation.VERTICAL); p.prefTileHeightProperty().bind(new SimpleDoubleProperty(40)); // p.minHeightProperty().bind(new SimpleDoubleProperty(20).multiply(Bindings.size(p.getChildren()))); p.prefTileWidthProperty().bind(sp.widthProperty()); p.prefHeightProperty() .bind(new SimpleDoubleProperty(50).multiply(Bindings.size(p.getChildren())).subtract(10)); p.prefWidthProperty().bind(sp.widthProperty()); sp.setPadding(Insets.EMPTY); p.setVgap(10); CountDownLatch l = new CountDownLatch(1); Platform.runLater(() -> { Stage stage = new Stage(); stage.setOnHidden(e -> { l.countDown(); }); Scene scene = new Scene(hsp, 300, 300, Color.GRAY); stage.setTitle("StackedPaneTest"); stage.setScene(scene); stage.show(); }); l.await(); }
From source file:org.mskcc.shenkers.view.IntervalViewNGTest.java
public void testStackIntervalView() throws InterruptedException { System.out.println("testStackIntervalView"); int[][] d = new int[][] { { 2, 6 }, { 7, 10 }, { 1, 3 }, { 4, 6 }, { 8, 10 }, { 1, 2 }, { 3, 7 }, { 9, 10 }, { 1, 2 }, { 3, 5 }, { 6, 7 }, { 8, 10 }, { 2, 5 }, { 8, 10 } }; List<int[]> asList = Arrays.asList(d); Collections.sort(asList, new Comparator<int[]>() { @Override/*from ww w . j ava 2 s .c o m*/ public int compare(int[] o1, int[] o2) { return o1[0] - o2[0]; } }); List<TreeRangeSet<Integer>> rows = new ArrayList<>(); rows.add(TreeRangeSet.create()); for (int[] r : d) { Range<Integer> R = Range.closed(r[0], r[1]); int i = 0; added: { while (i < rows.size()) { TreeRangeSet<Integer> set = rows.get(i); RangeSet<Integer> intersection = set.subRangeSet(Range.closed(r[0] - 1, r[1] + 1)); if (intersection.isEmpty()) { set.add(R); break added; } i++; } // Stri i = ; TreeRangeSet<Integer> row = TreeRangeSet.create(); row.add(R); rows.add(row); } } TilePane p = new TilePane(); p.setSnapToPixel(false); for (int i = 0; i < rows.size(); i++) { p.getChildren().add(get(rows.get(i), 0, 11)); System.out.println(rows.get(i).toString()); StringBuilder sb = new StringBuilder(11); sb.append(StringUtils.repeat(".", 11)); for (int j = 0; j < 11; j++) { if (rows.get(i).contains(j)) { sb.setCharAt(j, 'X'); } } System.out.println(sb.toString()); } // p.prefWidth(100); // p.prefHeight(100); ScrollPane sp = new ScrollPane(p); ScrollBar sb = new ScrollBar(); sb.maxProperty().bind(sp.vmaxProperty()); sb.minProperty().bind(sp.vminProperty()); sb.visibleAmountProperty().bind(sp.heightProperty().divide(p.prefHeightProperty())); sb.setOrientation(Orientation.VERTICAL); sp.vvalueProperty().bindBidirectional(sb.valueProperty()); HiddenSidesPane hsp = new HiddenSidesPane(); hsp.setContent(sp); hsp.setRight(sb); sp.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); sp.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); p.setOrientation(Orientation.VERTICAL); p.prefTileHeightProperty().bind(new SimpleDoubleProperty(40)); // p.minHeightProperty().bind(new SimpleDoubleProperty(20).multiply(Bindings.size(p.getChildren()))); p.prefTileWidthProperty().bind(sp.widthProperty()); p.prefHeightProperty() .bind(new SimpleDoubleProperty(50).multiply(Bindings.size(p.getChildren())).subtract(10)); p.prefWidthProperty().bind(sp.widthProperty()); sp.setPadding(Insets.EMPTY); p.setVgap(10); CountDownLatch l = new CountDownLatch(1); Platform.runLater(() -> { Stage stage = new Stage(); stage.setOnHidden(e -> { l.countDown(); }); Scene scene = new Scene(hsp, 300, 300, Color.GRAY); stage.setTitle("JavaFX Scene Graph Demo"); stage.setScene(scene); stage.show(); }); l.await(); }