List of usage examples for javafx.scene.control ScrollPane setHbarPolicy
public final void setHbarPolicy(ScrollBarPolicy value)
From source file:fruitproject.FruitProject.java
public void second(final String pfname) { final Stage st = new Stage(); Scene scene = null;/* w w w.ja v a 2 s .co m*/ final GridPane grid = new GridPane(); grid.setAlignment(Pos.CENTER); grid.setHgap(10); grid.setVgap(10); grid.setPadding(new Insets(25, 25, 25, 25)); TableView tv = new TableView(); final TableColumn<Map, String> firstDataColumn = new TableColumn<>("Name"); final TableColumn<Map, String> secondDataColumn = new TableColumn<>("Amount"); final TableColumn<Map, String> thirdDataColumn = new TableColumn<>("Remove"); firstDataColumn.setMinWidth(130); secondDataColumn.setMinWidth(130); thirdDataColumn.setMinWidth(130); if (!pfname.equals("")) { firstDataColumn.setCellValueFactory(new MapValueFactory(Column1MapKey)); secondDataColumn.setCellValueFactory(new MapValueFactory(Column2MapKey)); thirdDataColumn.setCellValueFactory(new MapValueFactory(Column3MapKey)); rows = 0; tv = new TableView<>(generateDataInMap(pfname, addPairs)); } tv.getColumns().setAll(firstDataColumn, secondDataColumn, thirdDataColumn); // secondDataColumn.setCellFactory(TextFieldTableCell.forTableColumn()); ScrollPane sp = new ScrollPane(); sp.setMinWidth(400); sp.setHbarPolicy(ScrollBarPolicy.NEVER); sp.setContent(tv); grid.add(sp, 0, 3); final ComboBox comboBox = new ComboBox(); HBox hb1 = new HBox(); comboBox.setValue("FILE"); comboBox.getItems().addAll("Save this file", "Load a new file"); Button btnOk = new Button(); btnOk.setText("OK"); hb1.getChildren().addAll(comboBox, btnOk); hb1.setSpacing(10); grid.add(hb1, 0, 1); Label label1 = new Label("Title:"); final TextField tfFilename = new TextField(); tfFilename.setText(getTitle(pfname)); HBox hb = new HBox(); hb.getChildren().addAll(label1, tfFilename); hb.setSpacing(10); grid.add(hb, 0, 2); final Stage ps = new Stage(); final TableView tv1 = tv; btnOk.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { //System.out.println("Hello World!"); if (comboBox.getValue().equals("Load a new file")) { first(ps); st.close(); } else { PrintWriter pw = null; try { pw = new PrintWriter("abc.json"); BufferedWriter bw = new BufferedWriter(new FileWriter(pfname, false)); bw.write("{title:\"" + tfFilename.getText() + "\""); bw.write(",fruits:["); for (int i = 0; i < rows; i++) { bw.write("{name:\"" + String.valueOf(firstDataColumn.getCellData(i)) + "\",amount:" + String.valueOf(secondDataColumn.getCellData(i)) + "}"); if (i != rows - 1) bw.write(","); } bw.write("]}"); bw.close(); } catch (Exception e) { System.out.println(e.toString()); } } } }); Button btn = new Button(); btn.setText("New Fruit"); grid.add(btn, 1, 2); // TableView tv=new TableView(); // TableColumn Col1 = new TableColumn("Name"); // TableColumn Col2 = new TableColumn("Amount"); // TableColumn Col3 = new TableColumn("Remove"); // tv.getColumns().addAll(Col1, Col2, Col3); //sp.setFitToWidth(true); Image img = new Image("file:music.jpg"); ImageView iv2 = new ImageView(); iv2.setImage(img); iv2.setFitWidth(200); iv2.setPreserveRatio(true); iv2.setSmooth(true); iv2.setCache(true); grid.add(iv2, 1, 3); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { //System.out.println("Hello World!"); System.out.println(comboBox.valueProperty()); st.close(); third(pfname); } }); scene = new Scene(grid, 700, 450); st.setScene(scene); st.show(); }
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);/* w ww . j a v 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("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 ww .ja v a 2 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 w w w . jav a 2 s. com 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:qupath.lib.gui.tma.TMASummaryViewer.java
private Pane createSidePane() { BorderPane pane = new BorderPane(); TabPane tabPane = new TabPane(); kmDisplay = new KaplanMeierDisplay(null, null, null, null); BorderPane paneKaplanMeier = new BorderPane(); paneKaplanMeier.setCenter(kmDisplay.getView()); paneKaplanMeier.setPadding(new Insets(10, 10, 10, 10)); // comboMainMeasurement.prefWidthProperty().bind(paneKaplanMeier.widthProperty()); comboMainMeasurement.setMaxWidth(Double.MAX_VALUE); comboMainMeasurement.setTooltip(new Tooltip("Measurement thresholded to create survival curves etc.")); GridPane kmTop = new GridPane(); kmTop.add(new Label("Score"), 0, 0); kmTop.add(comboMainMeasurement, 1, 0); kmTop.add(new Label("Survival type"), 0, 1); kmTop.add(comboSurvival, 1, 1);//from w ww. j a v a 2s. c o m comboSurvival.setTooltip(new Tooltip("Specify overall or recurrence-free survival (if applicable)")); comboSurvival.setMaxWidth(Double.MAX_VALUE); GridPane.setHgrow(comboMainMeasurement, Priority.ALWAYS); GridPane.setHgrow(comboSurvival, Priority.ALWAYS); kmTop.setHgap(5); paneKaplanMeier.setTop(kmTop); // kmDisplay.setOrientation(Orientation.VERTICAL); histogramDisplay = new HistogramDisplay(model, false); comboMainMeasurement.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> { histogramDisplay.refreshCombo(); histogramDisplay.showHistogram(n); updateSurvivalCurves(); }); comboMeasurementMethod.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> { histogramDisplay.refreshHistogram(); scatterPane.updateChart(); updateSurvivalCurves(); }); comboSurvival.getSelectionModel().selectedItemProperty().addListener((v, o, n) -> { updateSurvivalCurves(); }); // Create a Tab for showing images BorderPane paneImages = new BorderPane(); CheckBox cbShowOverlay = new CheckBox("Show overlay"); imageAvailability.addListener((c, v, n) -> { if (n == ImageAvailability.OVERLAY_ONLY) cbShowOverlay.setSelected(true); else if (n == ImageAvailability.IMAGE_ONLY) cbShowOverlay.setSelected(false); cbShowOverlay.setDisable(n != ImageAvailability.BOTH); }); ListView<TMAEntry> listImages = new ListView<>(); listImages.setCellFactory(v -> new ImageListCell(cbShowOverlay.selectedProperty(), imageCache)); listImages.widthProperty().addListener((v, o, n) -> listImages.refresh()); listImages.setStyle("-fx-control-inner-background-alt: -fx-control-inner-background ;"); table.getSelectionModel().getSelectedItems().addListener((Change<? extends TreeItem<TMAEntry>> e) -> { List<TMAEntry> entries = new ArrayList<>(); for (TreeItem<TMAEntry> item : e.getList()) { if (item.getChildren().isEmpty()) { if (item.getValue().hasImage() || item.getValue().hasOverlay()) entries.add(item.getValue()); } else { for (TreeItem<TMAEntry> item2 : item.getChildren()) { if (item2.getValue().hasImage() || item2.getValue().hasOverlay()) entries.add(item2.getValue()); } } listImages.getItems().setAll(entries); } }); cbShowOverlay.setAlignment(Pos.CENTER); cbShowOverlay.setMaxWidth(Double.MAX_VALUE); cbShowOverlay.setPadding(new Insets(5, 5, 5, 5)); cbShowOverlay.selectedProperty().addListener((v, o, n) -> listImages.refresh()); paneImages.setCenter(listImages); paneImages.setTop(cbShowOverlay); // Determine visibility based upon whether there are any images to show // Tab tabImages = new Tab("Images", paneImages); ScrollPane scrollPane = new ScrollPane(paneKaplanMeier); scrollPane.setFitToWidth(true); scrollPane.setFitToHeight(true); scrollPane.setVbarPolicy(ScrollBarPolicy.AS_NEEDED); scrollPane.setHbarPolicy(ScrollBarPolicy.AS_NEEDED); Tab tabSurvival = new Tab("Survival", scrollPane); tabPane.getTabs().addAll(new Tab("Table", getCustomizeTablePane()), // tabImages, new Tab("Histogram", histogramDisplay.getPane()), new Tab("Scatterplot", scatterPane.getPane()), tabSurvival); tabPane.setTabClosingPolicy(TabClosingPolicy.UNAVAILABLE); // if (imageAvailability.get() != ImageAvailability.NONE) // tabPane.getTabs().add(1, tabImages); // // imageAvailability.addListener((c, v, n) -> { // if (n == ImageAvailability.NONE) // tabPane.getTabs().remove(tabImages); // else if (!tabPane.getTabs().contains(tabImages)) // tabPane.getTabs().add(1, tabImages); // }); // tabSurvival.visibleProperty().bind( // Bindings.createBooleanBinding(() -> !survivalColumns.isEmpty(), survivalColumns) // ); pane.setCenter(tabPane); pane.setMinWidth(350); return pane; }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param primaryStage/*from w ww.j a v a 2s . c om*/ * @param racine * @param taille * @throws Exception */ private void creeMenu(VBox racine, int taille) throws Exception { //Pane myPane = (Pane) FXMLLoader.load(getClass().getResource("menuPrincipal.fxml")); VBox myPane = new VBox(); myPane.setPrefHeight(80); myPane.setPrefWidth(3000); MenuBar menuPrincipal = new MenuBar(); menuPrincipal.setMinHeight(25); menuPrincipal.setPrefHeight(29); menuPrincipal.setPrefWidth(3000); /* Menu projets */ Menu menuProjet = new Menu(rb.getString("projets")); menuPrincipal.getMenus().add(menuProjet); nouveauProjet = new MenuItem(rb.getString("nouveauProjet")); nouveauProjet.setAccelerator(KeyCombination.keyCombination("Ctrl+N")); menuProjet.getItems().add(nouveauProjet); chargeProjet = new MenuItem(rb.getString("ouvrirProjet")); chargeProjet.setAccelerator(KeyCombination.keyCombination("Ctrl+O")); menuProjet.getItems().add(chargeProjet); sauveProjet = new MenuItem(rb.getString("sauverProjet")); sauveProjet.setDisable(true); sauveProjet.setAccelerator(KeyCombination.keyCombination("Ctrl+S")); menuProjet.getItems().add(sauveProjet); sauveSousProjet = new MenuItem(rb.getString("sauverProjetSous")); sauveSousProjet.setDisable(true); sauveSousProjet.setAccelerator(KeyCombination.keyCombination("Shift+Ctrl+S")); menuProjet.getItems().add(sauveSousProjet); derniersProjets = new Menu(rb.getString("derniersProjets")); // derniersProjets.setDisable(true); menuProjet.getItems().add(derniersProjets); fichHistoFichiers = new File(repertConfig.getAbsolutePath() + File.separator + "derniersprojets.cfg"); nombreHistoFichiers = 0; if (fichHistoFichiers.exists()) { FileReader fr; fr = new FileReader(fichHistoFichiers); try (BufferedReader br = new BufferedReader(fr)) { while ((texteHisto = br.readLine()) != null) { MenuItem menuDerniersFichiers = new MenuItem(texteHisto); derniersProjets.getItems().add(menuDerniersFichiers); histoFichiers[nombreHistoFichiers] = texteHisto; nombreHistoFichiers++; menuDerniersFichiers.setOnAction((ActionEvent e) -> { MenuItem mnu = (MenuItem) e.getSource(); try { try { projetChargeNom(mnu.getText()); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); } } } SeparatorMenuItem sep1 = new SeparatorMenuItem(); menuProjet.getItems().add(sep1); fermerProjet = new MenuItem(rb.getString("quitterApplication")); fermerProjet.setAccelerator(KeyCombination.keyCombination("Ctrl+Q")); menuProjet.getItems().add(fermerProjet); /* Menu affichage */ Menu menuAffichage = new Menu(rb.getString("affichage")); menuPrincipal.getMenus().add(menuAffichage); affichageVisite = new MenuItem(rb.getString("main.creationVisite")); affichageVisite.setAccelerator(KeyCombination.keyCombination("Ctrl+1")); menuAffichage.getItems().add(affichageVisite); affichageInterface = new MenuItem(rb.getString("main.creationInterface")); affichageInterface.setAccelerator(KeyCombination.keyCombination("Ctrl+2")); menuAffichage.getItems().add(affichageInterface); affichagePlan = new MenuItem(rb.getString("main.tabPlan")); affichagePlan.setAccelerator(KeyCombination.keyCombination("Ctrl+3")); affichagePlan.setDisable(true); menuAffichage.getItems().add(affichagePlan); SeparatorMenuItem sep3 = new SeparatorMenuItem(); menuAffichage.getItems().add(sep3); configTransformation = new MenuItem(rb.getString("affichageConfiguration")); menuAffichage.getItems().add(configTransformation); /* Menu panoramiques */ menuPanoramique = new Menu(rb.getString("panoramiques")); menuPanoramique.setDisable(true); menuPrincipal.getMenus().add(menuPanoramique); ajouterPano = new MenuItem(rb.getString("ajouterPanoramiques")); ajouterPano.setAccelerator(KeyCombination.keyCombination("Ctrl+A")); menuPanoramique.getItems().add(ajouterPano); ajouterPlan = new MenuItem(rb.getString("ajouterPlan")); ajouterPlan.setAccelerator(KeyCombination.keyCombination("Ctrl+P")); menuPanoramique.getItems().add(ajouterPlan); ajouterPlan.setDisable(true); SeparatorMenuItem sep2 = new SeparatorMenuItem(); menuPanoramique.getItems().add(sep2); visiteGenere = new MenuItem(rb.getString("genererVisite")); visiteGenere.setDisable(true); visiteGenere.setAccelerator(KeyCombination.keyCombination("Ctrl+V")); menuPanoramique.getItems().add(visiteGenere); /* Menu Modles */ menuModeles = new Menu(rb.getString("menuModele")); menuPrincipal.getMenus().add(menuModeles); chargerModele = new MenuItem(rb.getString("modeleCharger")); menuModeles.getItems().add(chargerModele); sauverModele = new MenuItem(rb.getString("modeleSauver")); menuModeles.getItems().add(sauverModele); /* Menu transformations */ menuTransformation = new Menu(rb.getString("outils")); menuPrincipal.getMenus().add(menuTransformation); equi2CubeTransformation = new MenuItem(rb.getString("outilsEqui2Cube")); menuTransformation.getItems().add(equi2CubeTransformation); cube2EquiTransformation = new MenuItem(rb.getString("outilsCube2Equi")); menuTransformation.getItems().add(cube2EquiTransformation); /* Menu Aide */ Menu menuAide = new Menu(rb.getString("aide")); menuPrincipal.getMenus().add(menuAide); aide = new MenuItem(rb.getString("aideAide")); aide.setAccelerator(KeyCombination.keyCombination("Ctrl+H")); menuAide.getItems().add(aide); SeparatorMenuItem sep4 = new SeparatorMenuItem(); menuAide.getItems().add(sep4); aPropos = new MenuItem(rb.getString("aideAPropos")); menuAide.getItems().add(aPropos); /* barre de boutons */ HBox barreBouton = new HBox(); barreBouton.getStyleClass().add("menuBarreOutils1"); barreBouton.setPrefHeight(50); barreBouton.setMinHeight(50); barreBouton.setPrefWidth(3000); /* Bouton nouveau Projet */ ScrollPane spBtnNouvprojet = new ScrollPane(); spBtnNouvprojet.getStyleClass().add("menuBarreOutils"); spBtnNouvprojet.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnNouvprojet.setPrefHeight(35); spBtnNouvprojet.setMaxHeight(35); spBtnNouvprojet.setPadding(new Insets(2)); spBtnNouvprojet.setPrefWidth(35); HBox.setMargin(spBtnNouvprojet, new Insets(5, 15, 0, 15)); imgNouveauProjet = new ImageView( new Image("file:" + repertAppli + File.separator + "images/nouveauProjet.png")); spBtnNouvprojet.setContent(imgNouveauProjet); Tooltip t0 = new Tooltip(rb.getString("nouveauProjet")); t0.setStyle(tooltipStyle); spBtnNouvprojet.setTooltip(t0); barreBouton.getChildren().add(spBtnNouvprojet); /* Bouton ouvrir Projet */ ScrollPane spBtnOuvrirProjet = new ScrollPane(); spBtnOuvrirProjet.getStyleClass().add("menuBarreOutils"); spBtnOuvrirProjet.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnOuvrirProjet.setPrefHeight(35); spBtnOuvrirProjet.setMaxHeight(35); spBtnOuvrirProjet.setPadding(new Insets(2)); spBtnOuvrirProjet.setPrefWidth(35); HBox.setMargin(spBtnOuvrirProjet, new Insets(5, 15, 0, 0)); imgChargeProjet = new ImageView( new Image("file:" + repertAppli + File.separator + "images/ouvrirProjet.png")); spBtnOuvrirProjet.setContent(imgChargeProjet); Tooltip t1 = new Tooltip(rb.getString("ouvrirProjet")); t1.setStyle(tooltipStyle); spBtnOuvrirProjet.setTooltip(t1); barreBouton.getChildren().add(spBtnOuvrirProjet); /* Bouton sauve Projet */ ScrollPane spBtnSauveProjet = new ScrollPane(); spBtnSauveProjet.getStyleClass().add("menuBarreOutils"); spBtnSauveProjet.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnSauveProjet.setPrefHeight(35); spBtnSauveProjet.setMaxHeight(35); spBtnSauveProjet.setPadding(new Insets(2)); spBtnSauveProjet.setPrefWidth(35); HBox.setMargin(spBtnSauveProjet, new Insets(5, 15, 0, 0)); imgSauveProjet = new ImageView( new Image("file:" + repertAppli + File.separator + "images/sauveProjet.png")); spBtnSauveProjet.setContent(imgSauveProjet); Tooltip t2 = new Tooltip(rb.getString("sauverProjet")); t2.setStyle(tooltipStyle); spBtnSauveProjet.setTooltip(t2); barreBouton.getChildren().add(spBtnSauveProjet); Separator sepImages = new Separator(Orientation.VERTICAL); sepImages.prefHeight(200); barreBouton.getChildren().add(sepImages); imgSauveProjet.setDisable(true); imgSauveProjet.setOpacity(0.3); /* Bouton Ajoute Panoramique */ ScrollPane spBtnAjoutePano = new ScrollPane(); spBtnAjoutePano.getStyleClass().add("menuBarreOutils"); spBtnAjoutePano.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnAjoutePano.setPrefHeight(35); spBtnAjoutePano.setMaxHeight(35); spBtnAjoutePano.setPadding(new Insets(2)); spBtnAjoutePano.setPrefWidth(35); HBox.setMargin(spBtnAjoutePano, new Insets(5, 15, 0, 15)); imgAjouterPano = new ImageView( new Image("file:" + repertAppli + File.separator + "images/ajoutePanoramique.png")); spBtnAjoutePano.setContent(imgAjouterPano); Tooltip t3 = new Tooltip(rb.getString("ajouterPanoramiques")); t3.setStyle(tooltipStyle); spBtnAjoutePano.setTooltip(t3); barreBouton.getChildren().add(spBtnAjoutePano); imgAjouterPano.setDisable(true); imgAjouterPano.setOpacity(0.3); /* Bouton Ajoute Panoramique */ ScrollPane spBtnAjoutePlan = new ScrollPane(); spBtnAjoutePlan.getStyleClass().add("menuBarreOutils"); spBtnAjoutePlan.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnAjoutePlan.setPrefHeight(35); spBtnAjoutePlan.setMaxHeight(35); spBtnAjoutePlan.setPadding(new Insets(2)); spBtnAjoutePlan.setPrefWidth(35); HBox.setMargin(spBtnAjoutePlan, new Insets(5, 15, 0, 15)); imgAjouterPlan = new ImageView(new Image("file:" + repertAppli + File.separator + "images/ajoutePlan.png")); spBtnAjoutePlan.setContent(imgAjouterPlan); Tooltip t31 = new Tooltip(rb.getString("ajouterPlan")); t31.setStyle(tooltipStyle); spBtnAjoutePlan.setTooltip(t31); barreBouton.getChildren().add(spBtnAjoutePlan); imgAjouterPlan.setDisable(true); imgAjouterPlan.setOpacity(0.3); /* Bouton Gnre */ ScrollPane spBtnGenereVisite = new ScrollPane(); spBtnGenereVisite.getStyleClass().add("menuBarreOutils"); spBtnGenereVisite.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnGenereVisite.setPrefHeight(35); spBtnGenereVisite.setMaxHeight(35); spBtnGenereVisite.setPadding(new Insets(2)); spBtnGenereVisite.setPrefWidth(70); HBox.setMargin(spBtnGenereVisite, new Insets(5, 15, 0, 0)); imgVisiteGenere = new ImageView( new Image("file:" + repertAppli + File.separator + "images/genereVisite.png")); spBtnGenereVisite.setContent(imgVisiteGenere); Tooltip t4 = new Tooltip(rb.getString("genererVisite")); t4.setStyle(tooltipStyle); spBtnGenereVisite.setTooltip(t4); barreBouton.getChildren().add(spBtnGenereVisite); imgVisiteGenere.setDisable(true); imgVisiteGenere.setOpacity(0.3); Separator sepImages1 = new Separator(Orientation.VERTICAL); sepImages1.prefHeight(200); barreBouton.getChildren().add(sepImages1); /* Bouton equi -> faces de Cube */ ScrollPane spBtnEqui2Cube = new ScrollPane(); spBtnEqui2Cube.getStyleClass().add("menuBarreOutils"); spBtnEqui2Cube.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnEqui2Cube.setPrefHeight(35); spBtnEqui2Cube.setMaxHeight(35); spBtnEqui2Cube.setPadding(new Insets(2)); spBtnEqui2Cube.setPrefWidth(109); HBox.setMargin(spBtnEqui2Cube, new Insets(5, 15, 0, 250)); imgEqui2Cube = new ImageView(new Image("file:" + repertAppli + File.separator + "images/equi2cube.png")); spBtnEqui2Cube.setContent(imgEqui2Cube); Tooltip t6 = new Tooltip(rb.getString("outilsEqui2Cube")); t6.setStyle(tooltipStyle); spBtnEqui2Cube.setTooltip(t6); barreBouton.getChildren().add(spBtnEqui2Cube); /* Bouton faces de cube -> equi */ ScrollPane spBtnCube2Equi = new ScrollPane(); spBtnCube2Equi.getStyleClass().add("menuBarreOutils"); spBtnCube2Equi.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnCube2Equi.setPrefHeight(35); spBtnCube2Equi.setMaxHeight(35); spBtnCube2Equi.setPadding(new Insets(2)); spBtnCube2Equi.setPrefWidth(109); HBox.setMargin(spBtnCube2Equi, new Insets(5, 25, 0, 0)); imgCube2Equi = new ImageView(new Image("file:" + repertAppli + File.separator + "images/cube2equi.png")); spBtnCube2Equi.setContent(imgCube2Equi); Tooltip t5 = new Tooltip(rb.getString("outilsCube2Equi")); t5.setStyle(tooltipStyle); spBtnCube2Equi.setTooltip(t5); barreBouton.getChildren().add(spBtnCube2Equi); myPane.getChildren().addAll(menuPrincipal, barreBouton); racine.getChildren().add(myPane); nouveauProjet.setOnAction((ActionEvent e) -> { projetsNouveau(); }); chargeProjet.setOnAction((ActionEvent e) -> { try { try { projetCharge(); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); sauveProjet.setOnAction((ActionEvent e) -> { try { projetSauve(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); sauveSousProjet.setOnAction((ActionEvent e) -> { try { projetSauveSous(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); visiteGenere.setOnAction((ActionEvent e) -> { try { genereVisite(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); fermerProjet.setOnAction((ActionEvent e) -> { try { projetsFermer(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); ajouterPano.setOnAction((ActionEvent e) -> { try { panoramiquesAjouter(); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); ajouterPlan.setOnAction((ActionEvent e) -> { planAjouter(); }); aPropos.setOnAction((ActionEvent e) -> { aideapropos(); }); aide.setOnAction((ActionEvent e) -> { AideDialogController.affiche(); }); chargerModele.setOnAction((ActionEvent e) -> { try { modeleCharger(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); sauverModele.setOnAction((ActionEvent e) -> { try { modeleSauver(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); cube2EquiTransformation.setOnAction((ActionEvent e) -> { transformationCube2Equi(); }); equi2CubeTransformation.setOnAction((ActionEvent e) -> { transformationEqui2Cube(); }); affichageVisite.setOnAction((ActionEvent e) -> { tabPaneEnvironnement.getSelectionModel().select(0); }); affichageInterface.setOnAction((ActionEvent e) -> { tabPaneEnvironnement.getSelectionModel().select(1); }); affichagePlan.setOnAction((ActionEvent e) -> { if (!tabPlan.isDisabled()) { tabPaneEnvironnement.getSelectionModel().select(2); } }); configTransformation.setOnAction((ActionEvent e) -> { try { ConfigDialogController cfg = new ConfigDialogController(); cfg.afficheFenetre(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnNouvprojet.setOnMouseClicked((MouseEvent t) -> { projetsNouveau(); }); spBtnOuvrirProjet.setOnMouseClicked((MouseEvent t) -> { try { try { projetCharge(); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnSauveProjet.setOnMouseClicked((MouseEvent t) -> { try { projetSauve(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnAjoutePano.setOnMouseClicked((MouseEvent t) -> { try { panoramiquesAjouter(); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnAjoutePlan.setOnMouseClicked((MouseEvent t) -> { planAjouter(); }); spBtnGenereVisite.setOnMouseClicked((MouseEvent t) -> { try { genereVisite(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnEqui2Cube.setOnMouseClicked((MouseEvent t) -> { transformationEqui2Cube(); }); spBtnCube2Equi.setOnMouseClicked((MouseEvent t) -> { transformationCube2Equi(); }); }
From source file:editeurpanovisu.EditeurPanovisu.java
private ScrollPane afficheLegende() { double positionX = 0; double positionY = 0; AnchorPane apLegende = new AnchorPane(); ScrollPane spLegende = new ScrollPane(apLegende); spLegende.getStyleClass().add("legendePane"); apLegende.setMinWidth(1000);//from w w w. j a v a 2 s .c om apLegende.setMinHeight(150); apLegende.setPrefWidth(1000); apLegende.setPrefHeight(150); apLegende.setMaxWidth(1000); apLegende.setMaxHeight(150); positionY = (pano.getLayoutY() + pano.getPrefHeight() + 10); Circle point = new Circle(30, 20, 5); point.setFill(Color.YELLOW); point.setStroke(Color.RED); point.setCursor(Cursor.DEFAULT); Circle point2 = new Circle(30, 60, 5); point2.setFill(Color.BLUE); point2.setStroke(Color.YELLOW); point2.setCursor(Cursor.DEFAULT); Circle point3 = new Circle(30, 100, 5); point3.setFill(Color.GREEN); point3.setStroke(Color.YELLOW); point3.setCursor(Cursor.DEFAULT); Polygon polygon = new Polygon(); polygon.getPoints().addAll(new Double[] { 15.0, 2.0, 2.0, 2.0, 2.0, 15.0, -2.0, 15.0, -2.0, 2.0, -15.0, 2.0, -15.0, -2.0, -2.0, -2.0, -2.0, -15.0, 2.0, -15.0, 2.0, -2.0, 15.0, -2.0 }); polygon.setStrokeLineJoin(StrokeLineJoin.MITER); polygon.setFill(Color.BLUEVIOLET); polygon.setStroke(Color.YELLOW); polygon.setId("PoV"); polygon.setLayoutX(500); polygon.setLayoutY(20); Label lblHS = new Label(rb.getString("main.legendeHS")); Label lblHSImage = new Label(rb.getString("main.legendeHSImage")); //Label lblHSHTML = new Label(rb.getString("main.legendeHSHTML")); Label lblPoV = new Label(rb.getString("main.legendePoV")); Label lblNord = new Label(rb.getString("main.legendeNord")); Line ligneNord = new Line(500, 45, 500, 65); ligneNord.setStroke(Color.RED); ligneNord.setStrokeWidth(3); lblHS.setLayoutX(50); lblHS.setLayoutY(10); lblHSImage.setLayoutX(50); lblHSImage.setLayoutY(50); //lblHSHTML.setLayoutX(50); //lblHSHTML.setLayoutY(90); lblPoV.setLayoutX(520); lblPoV.setLayoutY(10); lblNord.setLayoutX(520); lblNord.setLayoutY(50); // apLegende.getChildren().addAll(lblHS, point, lblHSImage, point2, lblHSHTML, point3, lblPoV, polygon, lblNord, ligneNord); apLegende.getChildren().addAll(lblHS, point, lblHSImage, point2, lblPoV, polygon, lblNord, ligneNord); apLegende.setId("legende"); apLegende.setVisible(true); if (largeurMax - 50 < 1004) { spLegende.setPrefWidth(largeurMax - 50); spLegende.setMaxWidth(largeurMax - 50); positionX = 25; } else { spLegende.setPrefWidth(1004); spLegende.setMaxWidth(1004); positionX = (largeurMax - 1004) / 2.d; } spLegende.setLayoutX(positionX); spLegende.setLayoutY(positionY); spLegende.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spLegende.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); return spLegende; }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param vbRacine panel d'installation du menu * @throws Exception Exceptions/* w ww. j a v a 2 s . co m*/ */ private static void creeMenu(VBox vbRacine) throws Exception { VBox vbMonPanneau = new VBox(); vbMonPanneau.setPrefHeight(80); vbMonPanneau.setPrefWidth(3000); mbarPrincipal.setMinHeight(29); mbarPrincipal.setPrefHeight(29); mbarPrincipal.setMaxHeight(29); mbarPrincipal.setPrefWidth(3000); if (isMac()) { mbarPrincipal.setUseSystemMenuBar(true); } /* Menu projets */ Menu mnuProjet = new Menu(rbLocalisation.getString("projets")); mbarPrincipal.getMenus().add(mnuProjet); mniNouveauProjet = new MenuItem(rbLocalisation.getString("nouveauProjet")); mniNouveauProjet.setAccelerator(new KeyCodeCombination(KeyCode.N, KeyCombination.SHORTCUT_DOWN)); mnuProjet.getItems().add(mniNouveauProjet); mniChargeProjet = new MenuItem(rbLocalisation.getString("ouvrirProjet")); mniChargeProjet.setAccelerator(new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN)); mnuProjet.getItems().add(mniChargeProjet); mniSauveProjet = new MenuItem(rbLocalisation.getString("sauverProjet")); mniSauveProjet.setDisable(true); mniSauveProjet.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN)); mnuProjet.getItems().add(mniSauveProjet); mniSauveSousProjet = new MenuItem(rbLocalisation.getString("sauverProjetSous")); mniSauveSousProjet.setDisable(true); mniSauveSousProjet.setAccelerator( new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN, KeyCodeCombination.SHIFT_DOWN)); mnuProjet.getItems().add(mniSauveSousProjet); mnuDerniersProjets = new Menu(rbLocalisation.getString("derniersProjets")); mnuProjet.getItems().add(mnuDerniersProjets); fileHistoFichiers = new File(fileRepertConfig.getAbsolutePath() + File.separator + "derniersprojets.cfg"); nombreHistoFichiers = 0; if (fileHistoFichiers.exists()) { try (BufferedReader brHistoFichiers = new BufferedReader( new InputStreamReader(new FileInputStream(fileHistoFichiers), "UTF-8"))) { while ((strTexteHisto = brHistoFichiers.readLine()) != null) { MenuItem menuDerniersFichiers = new MenuItem(strTexteHisto); mnuDerniersProjets.getItems().add(menuDerniersFichiers); strHistoFichiers[nombreHistoFichiers] = strTexteHisto; nombreHistoFichiers++; menuDerniersFichiers.setOnAction((e) -> { MenuItem mniSousMenu = (MenuItem) e.getSource(); try { try { projetChargeNom(mniSousMenu.getText()); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); } } } SeparatorMenuItem sepMenu1 = new SeparatorMenuItem(); mnuProjet.getItems().add(sepMenu1); mniFermerProjet = new MenuItem(rbLocalisation.getString("quitterApplication")); mniFermerProjet.setAccelerator(new KeyCodeCombination(KeyCode.A, KeyCombination.SHORTCUT_DOWN)); mnuProjet.getItems().add(mniFermerProjet); /* Menu affichage */ Menu mnuAffichage = new Menu(rbLocalisation.getString("affichage")); mbarPrincipal.getMenus().add(mnuAffichage); mniAffichageVisite = new MenuItem(rbLocalisation.getString("main.creationVisite")); mniAffichageVisite.setAccelerator(new KeyCodeCombination(KeyCode.DIGIT1, KeyCombination.SHORTCUT_DOWN)); mnuAffichage.getItems().add(mniAffichageVisite); mniAffichageInterface = new MenuItem(rbLocalisation.getString("main.creationInterface")); mniAffichageInterface.setAccelerator(new KeyCodeCombination(KeyCode.DIGIT2, KeyCombination.SHORTCUT_DOWN)); mnuAffichage.getItems().add(mniAffichageInterface); setMniAffichagePlan(new MenuItem(rbLocalisation.getString("main.tabPlan"))); getMniAffichagePlan().setAccelerator(new KeyCodeCombination(KeyCode.DIGIT3, KeyCombination.SHORTCUT_DOWN)); getMniAffichagePlan().setDisable(true); mnuAffichage.getItems().add(getMniAffichagePlan()); mniOutilsLoupe = new MenuItem(rbLocalisation.getString("main.loupe")); mniOutilsLoupe.setAccelerator(new KeyCodeCombination(KeyCode.L, KeyCombination.SHORTCUT_DOWN)); mnuAffichage.getItems().add(mniOutilsLoupe); SeparatorMenuItem sep3 = new SeparatorMenuItem(); mnuAffichage.getItems().add(sep3); mniConfigTransformation = new MenuItem(rbLocalisation.getString("affichageConfiguration")); mnuAffichage.getItems().add(mniConfigTransformation); /* Menu panoramiques */ mnuPanoramique = new Menu(rbLocalisation.getString("panoramiques")); mnuPanoramique.setDisable(true); mbarPrincipal.getMenus().add(mnuPanoramique); mniAjouterPano = new MenuItem(rbLocalisation.getString("ajouterPanoramiques")); mniAjouterPano.setAccelerator(new KeyCodeCombination(KeyCode.A, KeyCombination.SHORTCUT_DOWN)); mnuPanoramique.getItems().add(mniAjouterPano); setMniAjouterPlan(new MenuItem(rbLocalisation.getString("ajouterPlan"))); getMniAjouterPlan().setAccelerator(new KeyCodeCombination(KeyCode.P, KeyCombination.SHORTCUT_DOWN)); mnuPanoramique.getItems().add(getMniAjouterPlan()); getMniAjouterPlan().setDisable(true); SeparatorMenuItem sep2 = new SeparatorMenuItem(); mnuPanoramique.getItems().add(sep2); mniVisiteGenere = new MenuItem(rbLocalisation.getString("genererVisite")); mniVisiteGenere.setDisable(true); mniVisiteGenere.setAccelerator(new KeyCodeCombination(KeyCode.V, KeyCombination.SHORTCUT_DOWN)); mnuPanoramique.getItems().add(mniVisiteGenere); /* Menu Modles */ mnuModeles = new Menu(rbLocalisation.getString("menuModele")); mbarPrincipal.getMenus().add(mnuModeles); mniChargerModele = new MenuItem(rbLocalisation.getString("modeleCharger")); mnuModeles.getItems().add(mniChargerModele); mniSauverModele = new MenuItem(rbLocalisation.getString("modeleSauver")); mnuModeles.getItems().add(mniSauverModele); /* Menu transformations */ mnuTransformation = new Menu(rbLocalisation.getString("outils")); mbarPrincipal.getMenus().add(mnuTransformation); mniEqui2CubeTransformation = new MenuItem(rbLocalisation.getString("outilsEqui2Cube")); mnuTransformation.getItems().add(mniEqui2CubeTransformation); mniCube2EquiTransformation = new MenuItem(rbLocalisation.getString("outilsCube2Equi")); mnuTransformation.getItems().add(mniCube2EquiTransformation); SeparatorMenuItem sep6 = new SeparatorMenuItem(); mnuTransformation.getItems().add(sep6); mniOutilsBarre = new MenuItem(rbLocalisation.getString("outilsBarre")); mniOutilsBarre.setAccelerator(new KeyCodeCombination(KeyCode.B, KeyCombination.SHORTCUT_DOWN)); mnuTransformation.getItems().add(mniOutilsBarre); mniOutilsDiaporama = new MenuItem(rbLocalisation.getString("outilsDiaporama")); mniOutilsDiaporama.setAccelerator(new KeyCodeCombination(KeyCode.D, KeyCombination.SHORTCUT_DOWN)); mnuTransformation.getItems().add(mniOutilsDiaporama); /* Menu Aide */ Menu mnuAide = new Menu(rbLocalisation.getString("aide")); mbarPrincipal.getMenus().add(mnuAide); mniAide = new MenuItem(rbLocalisation.getString("aideAide")); mniAide.setAccelerator(new KeyCodeCombination(KeyCode.H, KeyCombination.SHORTCUT_DOWN)); mnuAide.getItems().add(mniAide); SeparatorMenuItem sep4 = new SeparatorMenuItem(); mnuAide.getItems().add(sep4); mniAPropos = new MenuItem(rbLocalisation.getString("aideAPropos")); mnuAide.getItems().add(mniAPropos); // // } // /* barre de boutons */ hbBarreBouton = new HBox(); hbBarreBouton.getStyleClass().add("menuBarreOutils1"); hbBarreBouton.setPrefHeight(50); hbBarreBouton.setMinHeight(50); hbBarreBouton.setPrefWidth(3000); /* Bouton nouveau Projet */ ScrollPane spBtnNouvprojet = new ScrollPane(); spBtnNouvprojet.getStyleClass().add("menuBarreOutils"); spBtnNouvprojet.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnNouvprojet.setPrefHeight(35); spBtnNouvprojet.setMaxHeight(35); spBtnNouvprojet.setPadding(new Insets(2)); spBtnNouvprojet.setPrefWidth(35); HBox.setMargin(spBtnNouvprojet, new Insets(5, 15, 0, 15)); ivNouveauProjet = new ImageView( new Image("file:" + getStrRepertAppli() + File.separator + "images/nouveauProjet.png")); spBtnNouvprojet.setContent(ivNouveauProjet); Tooltip tltpNouveauProjet = new Tooltip(rbLocalisation.getString("nouveauProjet")); tltpNouveauProjet.setStyle(getStrTooltipStyle()); spBtnNouvprojet.setTooltip(tltpNouveauProjet); hbBarreBouton.getChildren().add(spBtnNouvprojet); /* Bouton ouvrir Projet */ ScrollPane spBtnOuvrirProjet = new ScrollPane(); spBtnOuvrirProjet.getStyleClass().add("menuBarreOutils"); spBtnOuvrirProjet.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnOuvrirProjet.setPrefHeight(35); spBtnOuvrirProjet.setMaxHeight(35); spBtnOuvrirProjet.setPadding(new Insets(2)); spBtnOuvrirProjet.setPrefWidth(35); HBox.setMargin(spBtnOuvrirProjet, new Insets(5, 15, 0, 0)); ivChargeProjet = new ImageView( new Image("file:" + getStrRepertAppli() + File.separator + "images/ouvrirProjet.png")); spBtnOuvrirProjet.setContent(ivChargeProjet); Tooltip tltpOuvrirProjet = new Tooltip(rbLocalisation.getString("ouvrirProjet")); tltpOuvrirProjet.setStyle(getStrTooltipStyle()); spBtnOuvrirProjet.setTooltip(tltpOuvrirProjet); hbBarreBouton.getChildren().add(spBtnOuvrirProjet); /* Bouton sauve Projet */ ScrollPane spBtnSauveProjet = new ScrollPane(); spBtnSauveProjet.getStyleClass().add("menuBarreOutils"); spBtnSauveProjet.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnSauveProjet.setPrefHeight(35); spBtnSauveProjet.setMaxHeight(35); spBtnSauveProjet.setPadding(new Insets(2)); spBtnSauveProjet.setPrefWidth(35); HBox.setMargin(spBtnSauveProjet, new Insets(5, 15, 0, 0)); ivSauveProjet = new ImageView( new Image("file:" + getStrRepertAppli() + File.separator + "images/sauveProjet.png")); spBtnSauveProjet.setContent(ivSauveProjet); Tooltip tltpSauverProjet = new Tooltip(rbLocalisation.getString("sauverProjet")); tltpSauverProjet.setStyle(getStrTooltipStyle()); spBtnSauveProjet.setTooltip(tltpSauverProjet); hbBarreBouton.getChildren().add(spBtnSauveProjet); Separator sepImages = new Separator(Orientation.VERTICAL); sepImages.prefHeight(200); hbBarreBouton.getChildren().add(sepImages); ivSauveProjet.setDisable(true); ivSauveProjet.setOpacity(0.3); /* Bouton Ajoute Panoramique */ ScrollPane spBtnAjoutePano = new ScrollPane(); spBtnAjoutePano.getStyleClass().add("menuBarreOutils"); spBtnAjoutePano.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnAjoutePano.setPrefHeight(35); spBtnAjoutePano.setMaxHeight(35); spBtnAjoutePano.setPadding(new Insets(2)); spBtnAjoutePano.setPrefWidth(35); HBox.setMargin(spBtnAjoutePano, new Insets(5, 15, 0, 15)); ivAjouterPano = new ImageView( new Image("file:" + getStrRepertAppli() + File.separator + "images/ajoutePanoramique.png")); spBtnAjoutePano.setContent(ivAjouterPano); Tooltip tltpAjouterPano = new Tooltip(rbLocalisation.getString("ajouterPanoramiques")); tltpAjouterPano.setStyle(getStrTooltipStyle()); spBtnAjoutePano.setTooltip(tltpAjouterPano); hbBarreBouton.getChildren().add(spBtnAjoutePano); ivAjouterPano.setDisable(true); ivAjouterPano.setOpacity(0.3); /* Bouton Ajoute Panoramique */ ScrollPane spBtnAjoutePlan = new ScrollPane(); spBtnAjoutePlan.getStyleClass().add("menuBarreOutils"); spBtnAjoutePlan.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnAjoutePlan.setPrefHeight(35); spBtnAjoutePlan.setMaxHeight(35); spBtnAjoutePlan.setPadding(new Insets(2)); spBtnAjoutePlan.setPrefWidth(35); HBox.setMargin(spBtnAjoutePlan, new Insets(5, 15, 0, 15)); setIvAjouterPlan( new ImageView(new Image("file:" + getStrRepertAppli() + File.separator + "images/ajoutePlan.png"))); spBtnAjoutePlan.setContent(getIvAjouterPlan()); Tooltip tltpAjouterPlan = new Tooltip(rbLocalisation.getString("ajouterPlan")); tltpAjouterPlan.setStyle(getStrTooltipStyle()); spBtnAjoutePlan.setTooltip(tltpAjouterPlan); hbBarreBouton.getChildren().add(spBtnAjoutePlan); getIvAjouterPlan().setDisable(true); getIvAjouterPlan().setOpacity(0.3); /* Bouton Gnre */ ScrollPane spBtnGenereVisite = new ScrollPane(); spBtnGenereVisite.getStyleClass().add("menuBarreOutils"); spBtnGenereVisite.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnGenereVisite.setPrefHeight(35); spBtnGenereVisite.setMaxHeight(35); spBtnGenereVisite.setPadding(new Insets(2)); spBtnGenereVisite.setPrefWidth(70); HBox.setMargin(spBtnGenereVisite, new Insets(5, 15, 0, 0)); ivVisiteGenere = new ImageView( new Image("file:" + getStrRepertAppli() + File.separator + "images/genereVisite.png")); spBtnGenereVisite.setContent(ivVisiteGenere); Tooltip tltpGenererVisite = new Tooltip(rbLocalisation.getString("genererVisite")); tltpGenererVisite.setStyle(getStrTooltipStyle()); spBtnGenereVisite.setTooltip(tltpGenererVisite); hbBarreBouton.getChildren().add(spBtnGenereVisite); ivVisiteGenere.setDisable(true); ivVisiteGenere.setOpacity(0.3); Separator sepImages1 = new Separator(Orientation.VERTICAL); sepImages1.prefHeight(200); hbBarreBouton.getChildren().add(sepImages1); /* Bouton equi -> faces de Cube */ ScrollPane spBtnEqui2Cube = new ScrollPane(); spBtnEqui2Cube.getStyleClass().add("menuBarreOutils"); spBtnEqui2Cube.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnEqui2Cube.setPrefHeight(35); spBtnEqui2Cube.setMaxHeight(35); spBtnEqui2Cube.setPadding(new Insets(2)); spBtnEqui2Cube.setPrefWidth(109); HBox.setMargin(spBtnEqui2Cube, new Insets(5, 15, 0, 250)); ivEqui2Cube = new ImageView( new Image("file:" + getStrRepertAppli() + File.separator + "images/equi2cube.png")); spBtnEqui2Cube.setContent(ivEqui2Cube); Tooltip tltpEqui2Cube = new Tooltip(rbLocalisation.getString("outilsEqui2Cube")); tltpEqui2Cube.setStyle(getStrTooltipStyle()); spBtnEqui2Cube.setTooltip(tltpEqui2Cube); hbBarreBouton.getChildren().add(spBtnEqui2Cube); /* Bouton faces de cube -> equi */ ScrollPane spBtnCube2Equi = new ScrollPane(); spBtnCube2Equi.getStyleClass().add("menuBarreOutils"); spBtnCube2Equi.setHbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spBtnCube2Equi.setPrefHeight(35); spBtnCube2Equi.setMaxHeight(35); spBtnCube2Equi.setPadding(new Insets(2)); spBtnCube2Equi.setPrefWidth(109); HBox.setMargin(spBtnCube2Equi, new Insets(5, 25, 0, 0)); ivCube2Equi = new ImageView( new Image("file:" + getStrRepertAppli() + File.separator + "images/cube2equi.png")); spBtnCube2Equi.setContent(ivCube2Equi); Tooltip tltpCube2Equi = new Tooltip(rbLocalisation.getString("outilsCube2Equi")); tltpCube2Equi.setStyle(getStrTooltipStyle()); spBtnCube2Equi.setTooltip(tltpCube2Equi); hbBarreBouton.getChildren().add(spBtnCube2Equi); if (isMac()) { mbarPrincipal.setMaxHeight(0); hbBarreBouton.setTranslateY(-30); } vbMonPanneau.getChildren().addAll(mbarPrincipal, hbBarreBouton); vbRacine.getChildren().add(vbMonPanneau); mniNouveauProjet.setOnAction((e) -> { projetsNouveau(); }); mniChargeProjet.setOnAction((e) -> { try { try { projetCharge(); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); mniSauveProjet.setOnAction((e) -> { try { projetSauve(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); mniSauveSousProjet.setOnAction((e) -> { try { projetSauveSous(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); mniVisiteGenere.setOnAction((e) -> { try { genereVisite(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); mniFermerProjet.setOnAction((e) -> { try { projetsFermer(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); mniAjouterPano.setOnAction((e) -> { try { panoramiquesAjouter(); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); getMniAjouterPlan().setOnAction((e) -> { planAjouter(); }); mniAPropos.setOnAction((e) -> { aideapropos(); }); mniAide.setOnAction((e) -> { AideDialogController.affiche(); }); mniChargerModele.setOnAction((e) -> { try { modeleCharger(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); mniSauverModele.setOnAction((e) -> { try { modeleSauver(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); mniCube2EquiTransformation.setOnAction((e) -> { transformationCube2Equi(); }); mniEqui2CubeTransformation.setOnAction((e) -> { transformationEqui2Cube(); }); mniOutilsBarre.setOnAction((e) -> { creerEditerBarre(""); }); mniOutilsDiaporama.setOnAction((e) -> { creerEditerDiaporama(""); }); mniOutilsLoupe.setOnAction((e) -> { e.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"; } }); mniAffichageVisite.setOnAction((e) -> { tpEnvironnement.getSelectionModel().select(0); }); mniAffichageInterface.setOnAction((e) -> { tpEnvironnement.getSelectionModel().select(1); }); getMniAffichagePlan().setOnAction((e) -> { if (!tabPlan.isDisabled()) { tpEnvironnement.getSelectionModel().select(2); } }); mniConfigTransformation.setOnAction((e) -> { try { ConfigDialogController cfg = new ConfigDialogController(); cfg.afficheFenetre(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnNouvprojet.setOnMouseClicked((t) -> { projetsNouveau(); }); spBtnOuvrirProjet.setOnMouseClicked((t) -> { try { try { projetCharge(); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnSauveProjet.setOnMouseClicked((t) -> { try { projetSauve(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnAjoutePano.setOnMouseClicked((t) -> { try { panoramiquesAjouter(); } catch (InterruptedException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnAjoutePlan.setOnMouseClicked((t) -> { planAjouter(); }); spBtnGenereVisite.setOnMouseClicked((t) -> { try { genereVisite(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); spBtnEqui2Cube.setOnMouseClicked((t) -> { transformationEqui2Cube(); }); spBtnCube2Equi.setOnMouseClicked((t) -> { transformationCube2Equi(); }); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @return/*w w w. ja v a2s . co m*/ */ private static ScrollPane spAfficheLegende() { double positionX; double positionY; AnchorPane apLegende = new AnchorPane(); ScrollPane spLegende = new ScrollPane(apLegende); spLegende.getStyleClass().add("legendePane"); apLegende.setMinWidth(1000); apLegende.setMinHeight(150); apLegende.setPrefWidth(1000); apLegende.setPrefHeight(150); apLegende.setMaxWidth(1000); apLegende.setMaxHeight(150); positionY = (spVuePanoramique.getPrefHeight() - apLegende.getPrefHeight() - 15); Circle circPoint = new Circle(30, 20, 5); circPoint.setFill(Color.YELLOW); circPoint.setStroke(Color.RED); circPoint.setCursor(Cursor.DEFAULT); Circle circPoint2 = new Circle(30, 40, 5); circPoint2.setFill(Color.BLUE); circPoint2.setStroke(Color.YELLOW); circPoint2.setCursor(Cursor.DEFAULT); Circle circPoint3 = new Circle(30, 60, 5); circPoint3.setFill(Color.GREEN); circPoint3.setStroke(Color.YELLOW); circPoint3.setCursor(Cursor.DEFAULT); Polygon polygonCroix = new Polygon(); polygonCroix.getPoints().addAll(new Double[] { 15.0, 2.0, 2.0, 2.0, 2.0, 15.0, -2.0, 15.0, -2.0, 2.0, -15.0, 2.0, -15.0, -2.0, -2.0, -2.0, -2.0, -15.0, 2.0, -15.0, 2.0, -2.0, 15.0, -2.0 }); polygonCroix.setStrokeLineJoin(StrokeLineJoin.MITER); polygonCroix.setFill(Color.BLUEVIOLET); polygonCroix.setStroke(Color.YELLOW); polygonCroix.setId("PoV"); polygonCroix.setLayoutX(500); polygonCroix.setLayoutY(20); Label lblHS = new Label(rbLocalisation.getString("main.legendeHS")); Label lblHSImage = new Label(rbLocalisation.getString("main.legendeHSImage")); Label lblHSHTML = new Label(rbLocalisation.getString("main.legendeHSHTML")); Label lblPoV = new Label(rbLocalisation.getString("main.legendePoV")); Label lblNord = new Label(rbLocalisation.getString("main.legendeNord")); Line lineNord = new Line(500, 45, 500, 65); lineNord.setStroke(Color.RED); lineNord.setStrokeWidth(3); lblHS.setLayoutX(50); lblHS.setLayoutY(15); lblHSImage.setLayoutX(50); lblHSImage.setLayoutY(35); lblHSHTML.setLayoutX(50); lblHSHTML.setLayoutY(55); lblPoV.setLayoutX(520); lblPoV.setLayoutY(15); lblNord.setLayoutX(520); lblNord.setLayoutY(55); apLegende.getChildren().addAll(lblHS, circPoint, lblHSImage, circPoint2, lblHSHTML, circPoint3, lblPoV, polygonCroix, lblNord, lineNord); apLegende.setId("legende"); apLegende.setVisible(true); if (largeurMax - 50 < 1004) { spLegende.setPrefWidth(largeurMax - 50); spLegende.setMaxWidth(largeurMax - 50); positionX = 25; } else { spLegende.setPrefWidth(1004); spLegende.setMaxWidth(1004); positionX = (largeurMax - 1004) / 2.d; } spLegende.setLayoutX(positionX); spLegende.setLayoutY(positionY); spLegende.setVbarPolicy(ScrollPane.ScrollBarPolicy.NEVER); spLegende.setHbarPolicy(ScrollPane.ScrollBarPolicy.AS_NEEDED); return spLegende; }