private void addStaticContent() { createLegend(); final Text inputText = new Text("Input"); inputText.setX( getAnimationPaneWidth() / 2 - getAnimationPaneWidth() / 4 - inputText.getBoundsInLocal().getWidth() / 2); inputText.setY(20); inputText.setFont( Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize())); inputText.setFontSmoothingType(FontSmoothingType.LCD); animationPane.getChildren().add(inputText); final Text outputText = new Text("Output"); outputText.setX( getAnimationPaneWidth() / 2 + getAnimationPaneWidth() / 4 - outputText.getBoundsInLocal().getWidth() / 2); outputText.setY(20); outputText.setFont( Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize())); outputText.setFontSmoothingType(FontSmoothingType.LCD); animationPane.getChildren().add(outputText); final Text adapterText = new Text("Adapter"); adapterText.setX(getAnimationPaneWidth() / 2 - adapterText.getBoundsInLocal().getWidth() / 2); adapterText.setTranslateY(20); adapterText.setFont( Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize())); adapterText.setFontSmoothingType(FontSmoothingType.LCD); animationPane.getChildren().add(adapterText); Line lineInput = new Line(); lineInput.getStrokeDashArray().addAll(5d); lineInput.setCache(true); lineInput.startXProperty().set(getAnimationPaneWidth() / 2 - getAnimationPaneWidth() / 8); lineInput.endXProperty().set(lineInput.startXProperty().get()); lineInput.startYProperty().set(0); lineInput.endYProperty().bind(animationPane.heightProperty()); animationPane.getChildren().add(lineInput); Line lineOutput = new Line(); lineOutput.getStrokeDashArray().addAll(5d); lineOutput.setCache(true); lineOutput.startXProperty().set(getAnimationPaneWidth() / 2 + getAnimationPaneWidth() / 8); lineOutput.endXProperty().set(lineOutput.startXProperty().get()); lineOutput.startYProperty().set(0); lineOutput.endYProperty().bind(animationPane.heightProperty()); animationPane.getChildren().add(lineOutput); }
public Grid(final int rowNo, final int columnNo, final Pane container) { super(); this.container = container; this.columnNumber = columnNo; this.rowNumber = rowNo; container .widthProperty() .addListener( new ChangeListener<Number>() { public void changed( ObservableValue<? extends Number> observableValue, Number number, Number widthNo) { recalculateMinoSize(); } }); container .heightProperty() .addListener( new ChangeListener<Number>() { public void changed( ObservableValue<? extends Number> observableValue, Number number, Number heightNo) { recalculateMinoSize(); } }); recalculateMinoSize(); }
public static void startValueSetAnimation(final Pane parent) { final javafx.scene.shape.Rectangle rectangle = new javafx.scene.shape.Rectangle(); Insets margin = BorderPane.getMargin(parent); if (margin == null) { margin = new Insets(0); } rectangle .widthProperty() .bind(parent.widthProperty().subtract(margin.getLeft() + margin.getRight())); rectangle .heightProperty() .bind(parent.heightProperty().subtract(margin.getTop() + margin.getBottom())); rectangle.setFill(Color.rgb(0, 150, 201)); parent.getChildren().add(rectangle); BoxBlur bb = new BoxBlur(); bb.setWidth(5); bb.setHeight(5); bb.setIterations(3); rectangle.setEffect(bb); FadeTransition ft = new FadeTransition(Duration.millis(250), rectangle); ft.setFromValue(0.2); ft.setToValue(0.8); ft.setCycleCount(2); ft.setAutoReverse(true); ft.play(); ft.setOnFinished( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { parent.getChildren().remove(rectangle); } }); }
private Pane buildUpperArea() { Pane up = new Pane(); up.prefHeightProperty().bind(this.heightProperty()); up.prefWidthProperty().bind(this.widthProperty()); TableView<DebateDetails> table = new TableView<DebateDetails>(); table.prefHeightProperty().bind(up.heightProperty()); table.prefWidthProperty().bind(up.widthProperty()); final Label label = new Label("Debate Tournament"); label.setFont(new Font("Arial", 20)); table.setEditable(false); table.getChildrenUnmodifiable().clear(); table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY); TableColumn<DebateDetails, String> divCol = new TableColumn<DebateDetails, String>("Division"); divCol.setCellValueFactory(new PropertyValueFactory<>("division")); TableColumn<DebateDetails, String> teamCountCol = new TableColumn<DebateDetails, String>("Team Count"); teamCountCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("teamCount"))); TableColumn<DebateDetails, String> debCountCol = new TableColumn<DebateDetails, String>("Debate Count"); debCountCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("totalMatch"))); TableColumn<DebateDetails, String> debCompCol = new TableColumn<DebateDetails, String>("Debates Completed "); debCompCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("matchCompleted"))); TableColumn<DebateDetails, String> debRemCol = new TableColumn<DebateDetails, String>("Upcoming Debates"); debRemCol.setCellValueFactory(new PropertyValueFactory<>(String.valueOf("matchRemaining"))); final ObservableList<DebateDetails> data = FXCollections.observableArrayList(TeamManager.getDebateDetails()); table.setItems(data); table.getColumns().add(divCol); table.getColumns().add(teamCountCol); table.getColumns().add(debCountCol); table.getColumns().add(debCompCol); table.getColumns().add(debRemCol); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(label, table); up.getChildren().add(vbox); return up; }
public void setMode(Mode mode) { if (mode != this.mode) { Mode previousMode = this.mode; this.mode = mode; log.info(String.format("Dock mode is now %s", mode)); switch (mode) { case LAUNCHERS: rebuildIcons(); setAvailable(); flinger.recentre(); break; case UPDATE: try { // Starting an update, so hide the all other windows hideIfShowing(signInPopup); hideIfShowing(optionsPopup); hideIfShowing(resourceGroupPopup); setAvailable(); updateScene = (Update) context.openScene( Update.class, Configuration.getDefault().isVertical() ? "Vertical" : null); Scene scn = updateScene.getScene(); scn.setFill(new Color(0, 0, 0, 0)); /* * The update popup will get future update events, but it * needs this one to initialize */ updateScene.initUpdate(appsToUpdate, previousMode); Parent sceneRoot = scn.rootProperty().get(); scn.setRoot(new Group()); if (cfg.isVertical()) ((VBox) sceneRoot).minWidthProperty().bind(shortcuts.heightProperty()); else ((HBox) sceneRoot).minHeightProperty().bind(shortcuts.widthProperty()); flinger.getContent().getChildren().clear(); flinger.getContent().getChildren().add(sceneRoot); } catch (IOException ioe) { log.error("Failed to load update scene.", ioe); } break; case IDLE: flinger.getContent().getChildren().clear(); setAvailable(); break; default: throw new UnsupportedOperationException(); } } }
/** initialize secondary structure view items */ private void initSecondaryView() { // clear the secondary structure pane on initialization pane2D.getChildren().clear(); if (view2DController.getGraph2d() != null) { pane2D.widthProperty().removeListener(view2DController.getWidthChangeListener()); pane2D.heightProperty().removeListener(view2DController.getHeightChangeListener()); } view2DController.initGraph2d( rnaSequence3D.extractString(), rnaSequence3D.getNucleotides().size(), rnaSequence3D.computeWCBonds(), (int) pane2D.getWidth(), (int) pane2D.getHeight()); listenOnPane2dResize(); view2DController.setScaleBinding(pane2D.widthProperty(), pane2D.heightProperty()); view2DController.getGraph2d().setSelectionModel(selectionModel); pane2D.getChildren().add(view2DController.getGraph2d()); }
private void listenOnPane2dResize() { view2DController.initProperties(); pane2D.widthProperty().addListener(view2DController.getWidthChangeListener()); pane2D.heightProperty().addListener(view2DController.getHeightChangeListener()); }