List of usage examples for javafx.geometry Insets EMPTY
Insets EMPTY
To view the source code for javafx.geometry Insets EMPTY.
Click Source Link
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group(), 450, 250); TilePane tile = new TilePane(); tile.setHgap(8);/*ww w . ja v a2 s . c om*/ tile.setPrefColumns(4); for (int i = 0; i < 20; i++) { tile.getChildren().add(new CheckBox("CheckBox")); } HBox hbox = new HBox(10); hbox.setPadding(new Insets(20, 0, 0, 20)); hbox.getChildren().setAll(tile); TilePane.setMargin(hbox, Insets.EMPTY); Group root = (Group) scene.getRoot(); root.getChildren().add(hbox); stage.setScene(scene); stage.show(); }
From source file:de.pixida.logtest.designer.automaton.Graph.java
Graph(final IAutomatonEditor aAutomatonEditor) { Validate.notNull(aAutomatonEditor);/* w ww . j a v a2 s.c om*/ this.automatonEditor = aAutomatonEditor; this.pane.setBackground(new Background(new BackgroundFill(Color.WHITE, CornerRadii.EMPTY, Insets.EMPTY))); final double minSizeX = 800.0; final double minSizeY = 600.0; this.pane.setMinSize(minSizeX, minSizeY); final double paddingRightBottom = 8.0; this.pane.setPadding(new Insets(0.0, paddingRightBottom, paddingRightBottom, 0.0)); this.pane.setOnMouseMoved(event -> this.mouseMovedOnPane(event)); this.pane.setOnMouseClicked(event -> this.mouseClickedOnPane(event)); final MenuItem mi = new MenuItem("Create new state"); mi.setGraphic(Icons.getIconGraphics("pencil_add")); mi.setOnAction(event -> { // The following code does not really belong here as the class is designed only to handle business belongings... it should be // moved somewhere else!? final AutomatonNode newNode = new AutomatonNode(Graph.this); newNode.setPosition(new Point2D(this.lastMousePositionOnPaneX, this.lastMousePositionOnPaneY)); newNode.setName("New state"); Graph.this.addObject(newNode); Graph.this.handleChange(); Graph.this.showConfigFrameOfObject(newNode); }); this.contextMenu.getItems().add(mi); }
From source file:com.ggvaidya.scinames.complexquery.ComplexQueryViewController.java
public void setQueryStatus(String status) { if (status.equals("ok")) { queryStatusTextField.setBackground( new Background(new BackgroundFill(Paint.valueOf("green"), CornerRadii.EMPTY, Insets.EMPTY))); queryStatusTextField.setAlignment(Pos.CENTER); queryStatusTextField.setText("Query executed successfully"); } else {/*from w w w . j a v a2s .c o m*/ queryStatusTextField.setBackground( new Background(new BackgroundFill(Paint.valueOf("red"), CornerRadii.EMPTY, Insets.EMPTY))); queryStatusTextField.setAlignment(Pos.CENTER); queryStatusTextField.setText(status); } }
From source file:net.rptools.tokentool.controller.TokenTool_Controller.java
@FXML void initialize() { // Note: A Pane is added to the compositeTokenPane so the ScrollPane doesn't consume the mouse events assert fileManageOverlaysMenu != null : "fx:id=\"fileManageOverlaysMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileSaveAsMenu != null : "fx:id=\"fileSaveAsMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileExitMenu != null : "fx:id=\"fileExitMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert editCaptureScreenMenu != null : "fx:id=\"editCaptureScreenMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert editCopyImageMenu != null : "fx:id=\"editCopyImageMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert editPasteImageMenu != null : "fx:id=\"editPasteImageMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert helpAboutMenu != null : "fx:id=\"helpAboutMenu\" was not injected: check your FXML file 'TokenTool.fxml'."; assert saveOptionsPane != null : "fx:id=\"saveOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayOptionsPane != null : "fx:id=\"overlayOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert backgroundOptionsPane != null : "fx:id=\"backgroundOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert zoomOptionsPane != null : "fx:id=\"zoomOptionsPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert compositeTokenPane != null : "fx:id=\"compositeTokenPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert tokenPreviewPane != null : "fx:id=\"tokenPreviewPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitScrollPane != null : "fx:id=\"portraitScrollPane\" was not injected: check your FXML file 'TokenTool.fxml'."; assert compositeGroup != null : "fx:id=\"compositeGroup\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayTreeView != null : "fx:id=\"overlayTreeview\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitImageView != null : "fx:id=\"portraitImageView\" was not injected: check your FXML file 'TokenTool.fxml'."; assert maskImageView != null : "fx:id=\"maskImageView\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayImageView != null : "fx:id=\"overlayImageView\" was not injected: check your FXML file 'TokenTool.fxml'."; assert tokenImageView != null : "fx:id=\"tokenImageView\" was not injected: check your FXML file 'TokenTool.fxml'."; assert useFileNumberingCheckbox != null : "fx:id=\"useFileNumberingCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayUseAsBaseCheckbox != null : "fx:id=\"overlayUseAsBaseCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'."; assert clipPortraitCheckbox != null : "fx:id=\"clipPortraitCheckbox\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileNameTextField != null : "fx:id=\"fileNameTextField\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileNameSuffixLabel != null : "fx:id=\"fileNameSuffixLabel\" was not injected: check your FXML file 'TokenTool.fxml'."; assert fileNameSuffixTextField != null : "fx:id=\"fileNameSuffixTextField\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayNameLabel != null : "fx:id=\"overlayNameLabel\" was not injected: check your FXML file 'TokenTool.fxml'."; assert backgroundColorPicker != null : "fx:id=\"backgroundColorPicker\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayAspectToggleButton != null : "fx:id=\"overlayAspectToggleButton\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitTransparencySlider != null : "fx:id=\"portraitTransparencySlider\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitBlurSlider != null : "fx:id=\"portraitBlurSlider\" was not injected: check your FXML file 'TokenTool.fxml'."; assert portraitGlowSlider != null : "fx:id=\"portraitGlowSlider\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayTransparencySlider != null : "fx:id=\"overlayTransparencySlider\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayWidthSpinner != null : "fx:id=\"overlayWidthSpinner\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayHeightSpinner != null : "fx:id=\"overlayHeightSpinner\" was not injected: check your FXML file 'TokenTool.fxml'."; assert overlayTreeProgressBar != null : "fx:id=\"overlayTreeProgressIndicator\" was not injected: check your FXML file 'ManageOverlays.fxml'."; executorService = Executors.newCachedThreadPool(runable -> { loadOverlaysThread = Executors.defaultThreadFactory().newThread(runable); loadOverlaysThread.setDaemon(true); return loadOverlaysThread; });/*from www. j a v a2 s . c om*/ overlayTreeView.setShowRoot(false); overlayTreeView.getSelectionModel().selectedItemProperty().addListener( (observable, oldValue, newValue) -> updateCompositImageView((TreeItem<Path>) newValue)); addPseudoClassToLeafs(overlayTreeView); // Bind color picker to compositeTokenPane background fill backgroundColorPicker.setValue(Color.TRANSPARENT); ObjectProperty<Background> background = compositeTokenPane.backgroundProperty(); background.bind(Bindings.createObjectBinding(() -> { BackgroundFill fill = new BackgroundFill(backgroundColorPicker.getValue(), CornerRadii.EMPTY, Insets.EMPTY); return new Background(fill); }, backgroundColorPicker.valueProperty())); // Bind transparency slider to portraitImageView opacity portraitTransparencySlider.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { portraitImageView.setOpacity(new_val.doubleValue()); updateTokenPreviewImageView(); } }); // // Restrict text field to valid filename characters // Pattern validDoubleText = Pattern.compile("[^a-zA-Z0-9\\\\._ \\\\/`~!@#$%\\\\^&\\\\(\\\\)\\\\-\\\\=\\\\+\\\\[\\\\]\\\\{\\\\}',\\\\\\\\:]"); // Pattern validText = Pattern.compile("[^a-zA-Z0-9 ]"); // TextFormatter<> textFormatter = new TextFormatter<>( // change -> { // String newText = change.getControlNewText(); // if (validText.matcher(newText).matches()) { // return change; // } else // return null; // }); // UnaryOperator<TextFormatter.Change> filter = new UnaryOperator<TextFormatter.Change>() { // @Override // public TextFormatter.Change apply(TextFormatter.Change t) { // String validText = "[^a-zA-Z0-9]"; // // if (t.isReplaced()) // if (t.getText().matches(validText)) // t.setText(t.getControlText().substring(t.getRangeStart(), t.getRangeEnd())); // // if (t.isAdded()) { // if (t.getText().matches(validText)) { // return null; // } // } // // return t; // } // }; UnaryOperator<Change> filter = change -> { String text = change.getText(); if (text.matches(AppConstants.VALID_FILE_NAME_PATTERN)) { return change; } else { change.setText(FileSaveUtil.cleanFileName(text)); ; return change; } // // return null; }; TextFormatter<String> textFormatter = new TextFormatter<>(filter); fileNameTextField.setTextFormatter(textFormatter); // Effects GaussianBlur gaussianBlur = new GaussianBlur(0); Glow glow = new Glow(0); gaussianBlur.setInput(glow); // Bind blur slider to portraitImageView opacity portraitBlurSlider.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { gaussianBlur.setRadius(new_val.doubleValue()); portraitImageView.setEffect(gaussianBlur); updateTokenPreviewImageView(); } }); // Bind glow slider to portraitImageView opacity portraitGlowSlider.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { glow.setLevel(new_val.doubleValue()); portraitImageView.setEffect(gaussianBlur); updateTokenPreviewImageView(); } }); // Bind transparency slider to overlayImageView opacity overlayTransparencySlider.valueProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue<? extends Number> ov, Number old_val, Number new_val) { overlayImageView.setOpacity(new_val.doubleValue()); updateTokenPreviewImageView(); } }); // Bind width/height spinners to overlay width/height overlayWidthSpinner.getValueFactory().valueProperty() .bindBidirectional(overlayHeightSpinner.getValueFactory().valueProperty()); overlayWidthSpinner.valueProperty().addListener( (observable, oldValue, newValue) -> overlayWidthSpinner_onTextChanged(oldValue, newValue)); overlayHeightSpinner.valueProperty().addListener( (observable, oldValue, newValue) -> overlayHeightSpinner_onTextChanged(oldValue, newValue)); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * *///from ww w.j a v a 2 s .c o m private static void installeEvenements() { /** * */ getScnPrincipale().widthProperty().addListener( (ObservableValue<? extends Number> observableValue, Number oldSceneWidth, Number newSceneWidth) -> { if ((double) newSceneWidth < 1280) { } double largeur = (double) newSceneWidth - largeurOutils - 20; apPanovisu.setLayoutX((double) newSceneWidth - largeurOutils); spVuePanoramique.setPrefWidth(largeur); spVuePanoramique.setBackground( new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY))); gestionnaireInterface.getApVis().setPrefWidth((double) newSceneWidth - largeurOutils - 20); if ((double) newSceneWidth - largeurOutils - 20 < gestionnaireInterface.getApVis() .getMaxWidth()) { gestionnaireInterface.getApVis().setMinWidth((double) newSceneWidth - largeurOutils - 20); } if ((double) newSceneWidth - largeurOutils - 20 < gestionnairePlan.getApPlan().getMaxWidth()) { gestionnairePlan.getApPlan().setMinWidth((double) newSceneWidth - largeurOutils - 20); } gestionnairePlan.getApPlan().setPrefWidth((double) newSceneWidth - largeurOutils - 20); }); /** * */ getScnPrincipale().heightProperty().addListener((ObservableValue<? extends Number> observableValue, Number oldSceneHeight, Number newSceneHeight) -> { spVuePanoramique.setPrefHeight((double) newSceneHeight - 130.0d - getiDecalageMac()); spPanneauOutils.setPrefHeight((double) newSceneHeight - 130.0d - getiDecalageMac()); spVuePanoramique .setBackground(new Background(new BackgroundFill(Color.BLUE, CornerRadii.EMPTY, Insets.EMPTY))); if ((double) newSceneHeight - 130.0d - getiDecalageMac() < gestionnaireInterface.getSpOutils() .getMaxHeight()) { gestionnaireInterface.getSpOutils() .setMinHeight((double) newSceneHeight - 130.0d - getiDecalageMac()); } gestionnaireInterface.getSpOutils().setPrefHeight((double) newSceneHeight - 130.0d - getiDecalageMac()); gestionnairePlan.getSpOutils().setPrefHeight((double) newSceneHeight - 130 - getiDecalageMac()); if ((double) newSceneHeight - 130 - getiDecalageMac() < gestionnairePlan.getSpOutils().getMaxHeight()) { gestionnairePlan.getSpOutils().setMinHeight((double) newSceneHeight - 130 - getiDecalageMac()); } }); getScnPrincipale().setOnKeyPressed((clavierEvt) -> { //System.out.println("Code clavier : " + clavierEvt.getCode()); if (clavierEvt.isControlDown()) { if (clavierEvt.getText().toLowerCase().equals("l")) { clavierEvt.consume(); setAfficheLoupe(!isAfficheLoupe()); apLoupe.setVisible(isAfficheLoupe()); Point p = MouseInfo.getPointerInfo().getLocation(); if (p.x < getiTailleLoupe() + 80 && p.y < getiTailleLoupe() + 160) { apLoupe.setLayoutX(ivImagePanoramique.getFitWidth() - getiTailleLoupe() + 5); apLoupe.setLayoutY(35); strPositLoupe = "droite"; } else { apLoupe.setLayoutX(35); apLoupe.setLayoutY(35); strPositLoupe = "gauche"; } } } if (clavierEvt.getText().equals("+")) { setiTailleLoupe(getiTailleLoupe() + 10); creeLoupe(); afficheLoupe(positLoupeX, positLoupeY); } if (clavierEvt.getText().equals("-")) { setiTailleLoupe(getiTailleLoupe() - 10); creeLoupe(); afficheLoupe(positLoupeX, positLoupeY); } }); /** * */ panePanoramique.setOnMouseClicked((mouseEvent) -> { gereSourisPanoramique(mouseEvent); }); /** * */ panePanoramique.setOnMouseMoved((mouseEvent) -> { if (bEstCharge) { double mouseX = mouseEvent.getSceneX() - ivImagePanoramique.getLayoutX(); if (mouseX < 0) { mouseX = 0; } if (mouseX > ivImagePanoramique.getFitWidth()) { mouseX = ivImagePanoramique.getFitWidth(); } double mouseY = mouseEvent.getSceneY() - panePanoramique.getLayoutY() - 130 - getiDecalageMac(); if (mouseY < 0) { mouseY = 0; } if (mouseY > ivImagePanoramique.getFitHeight()) { mouseY = ivImagePanoramique.getFitHeight(); } double longitude, latitude; double largeur = ivImagePanoramique.getFitWidth() * panePanoramique.getScaleX(); longitude = 360.0f * mouseX / largeur - 180; latitude = 90.0d - 2.0f * mouseY / largeur * 180.0f; String strLong = "Long : " + String.format("%.1f", longitude); String strLat = "Lat : " + String.format("%.1f", latitude); lblLong.setText(strLong); lblLat.setText(strLat); afficheLoupe(mouseX, mouseY); } }); cbListeChoixPanoramique.valueProperty().addListener((ov, ancienneValeur, nouvelleValeur) -> { if (nouvelleValeur != null) { if (!(nouvelleValeur.equals(strPanoAffiche))) { valideHS(); strPanoAffiche = nouvelleValeur.toString(); } } }); }
From source file:org.cryptomator.ui.util.PasswordStrengthUtil.java
public Background getBackgroundWithStrengthColor(Number score) { Color c = this.getStrengthColor(score); BackgroundFill fill = new BackgroundFill(c, CornerRadii.EMPTY, Insets.EMPTY); return new Background(fill); }
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);/*from www . j a v a 2 s . com*/ 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} ));// w w w .jav a2 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("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 w w w .ja v a2 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(); }
From source file:org.sleuthkit.autopsy.timeline.ui.detailview.AggregateEventNode.java
public AggregateEventNode(final AggregateEvent event, AggregateEventNode parentEventNode, EventDetailChart chart) {//from w ww .j a v a 2 s. c o m this.event = event; descLOD.set(event.getLOD()); this.parentEventNode = parentEventNode; this.chart = chart; final Region region = new Region(); HBox.setHgrow(region, Priority.ALWAYS); final HBox hBox = new HBox(descrLabel, countLabel, region, minusButton, plusButton); hBox.setPrefWidth(USE_COMPUTED_SIZE); hBox.setMinWidth(USE_PREF_SIZE); hBox.setPadding(new Insets(2, 5, 2, 5)); hBox.setAlignment(Pos.CENTER_LEFT); minusButton.setVisible(false); plusButton.setVisible(false); minusButton.setManaged(false); plusButton.setManaged(false); final BorderPane borderPane = new BorderPane(subNodePane, hBox, null, null, null); BorderPane.setAlignment(subNodePane, Pos.TOP_LEFT); borderPane.setPrefWidth(USE_COMPUTED_SIZE); getChildren().addAll(spanRegion, borderPane); setAlignment(Pos.TOP_LEFT); setMinHeight(24); minWidthProperty().bind(spanRegion.widthProperty()); setPrefHeight(USE_COMPUTED_SIZE); setMaxHeight(USE_PREF_SIZE); //set up subnode pane sizing contraints subNodePane.setPrefHeight(USE_COMPUTED_SIZE); subNodePane.setMinHeight(USE_PREF_SIZE); subNodePane.setMinWidth(USE_PREF_SIZE); subNodePane.setMaxHeight(USE_PREF_SIZE); subNodePane.setMaxWidth(USE_PREF_SIZE); subNodePane.setPickOnBounds(false); //setup description label eventTypeImageView.setImage(event.getType().getFXImage()); descrLabel.setGraphic(eventTypeImageView); descrLabel.setPrefWidth(USE_COMPUTED_SIZE); descrLabel.setTextOverrun(OverrunStyle.CENTER_ELLIPSIS); descrLabel.setMouseTransparent(true); setDescriptionVisibility(chart.getDescrVisibility().get()); //setup backgrounds final Color evtColor = event.getType().getColor(); spanFill = new Background( new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY)); setBackground( new Background(new BackgroundFill(evtColor.deriveColor(0, 1, 1, .1), CORNER_RADII, Insets.EMPTY))); setCursor(Cursor.HAND); spanRegion.setStyle("-fx-border-width:2 0 2 2; -fx-border-radius: 2; -fx-border-color: " + ColorUtilities.getRGBCode(evtColor) + ";"); // NON-NLS spanRegion.setBackground(spanFill); //set up mouse hover effect and tooltip setOnMouseEntered((MouseEvent e) -> { //defer tooltip creation till needed, this had a surprisingly large impact on speed of loading the chart installTooltip(); spanRegion.setEffect(new DropShadow(10, evtColor)); minusButton.setVisible(true); plusButton.setVisible(true); minusButton.setManaged(true); plusButton.setManaged(true); toFront(); }); setOnMouseExited((MouseEvent e) -> { spanRegion.setEffect(null); minusButton.setVisible(false); plusButton.setVisible(false); minusButton.setManaged(false); plusButton.setManaged(false); }); setOnMouseClicked(new EventMouseHandler()); plusButton.disableProperty().bind(descLOD.isEqualTo(DescriptionLOD.FULL)); minusButton.disableProperty().bind(descLOD.isEqualTo(event.getLOD())); plusButton.setOnMouseClicked(e -> { final DescriptionLOD next = descLOD.get().next(); if (next != null) { loadSubClusters(next); descLOD.set(next); } }); minusButton.setOnMouseClicked(e -> { final DescriptionLOD previous = descLOD.get().previous(); if (previous != null) { loadSubClusters(previous); descLOD.set(previous); } }); }