List of usage examples for javafx.geometry Rectangle2D getWidth
public double getWidth()
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param strLstPano//from w ww. j a v a2 s. c om * @param iNumPano * @return */ public static Pane paneAffichageHS(String strLstPano, int iNumPano) { Pane paneHotSpots = new Pane(); paneHotSpots.setTranslateY(10); paneHotSpots.setTranslateX(10); VBox vbHotspots = new VBox(5); paneHotSpots.getChildren().add(vbHotspots); Label lblPoint; int io; for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspots(); io++) { Label lblSep = new Label(" "); Label lblSep1 = new Label(" "); VBox vbPanneauHS = new VBox(); double deplacement = 0; vbPanneauHS.setLayoutX(deplacement); Pane paneHsPanoramique = new Pane(vbPanneauHS); paneHsPanoramique.setPrefHeight(300); paneHsPanoramique.setMinHeight(300); paneHsPanoramique.setMaxHeight(300); int iNum1 = io; Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> { Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1); if (c1 != null) { if (c1.getFill() == Color.RED) { c1.setFill(Color.YELLOW); c1.setStroke(Color.RED); } else { c1.setFill(Color.RED); c1.setStroke(Color.YELLOW); } } })); timBouge.setCycleCount(Timeline.INDEFINITE); timBouge.pause(); paneHsPanoramique.setOnMouseEntered((e) -> { timBouge.play(); }); paneHsPanoramique.setOnMouseExited((e) -> { timBouge.pause(); Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1); if (c1 != null) { c1.setFill(Color.YELLOW); c1.setStroke(Color.RED); } }); paneHsPanoramique .setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;"); paneHsPanoramique.setId("HS" + io); lblPoint = new Label("Point #" + (io + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.setTranslateX(-deplacement); lblPoint.getStyleClass().add("titreOutil"); Separator sepHotspots = new Separator(Orientation.HORIZONTAL); sepHotspots.setTranslateX(-deplacement); sepHotspots.setPrefWidth(321); sepHotspots.setTranslateX(2); paneHsPanoramique.setPrefWidth(325); vbPanneauHS.getChildren().addAll(lblPoint, sepHotspots); if (strLstPano != null) { Label lblLien = new Label(rbLocalisation.getString("main.panoramiqueDestination")); lblLien.setTranslateX(10); ComboBox cbDestPano = new ComboBox(); String[] strListe = strLstPano.split(";"); cbDestPano.getItems().addAll(Arrays.asList(strListe)); int iNum11 = getPanoramiquesProjet()[iNumPano].getHotspot(io).getNumeroPano(); cbDestPano.setTranslateX(10); cbDestPano.setId("cbpano" + io); cbDestPano.getSelectionModel().select(iNum11); cbDestPano.getSelectionModel().selectedIndexProperty().addListener((ov, t, t1) -> { valideHS(); if (dejaCharge) { dejaCharge = false; retireAffichageHotSpots(); Pane affHS1 = paneAffichageHS(strListePano(), iNumPano); affHS1.setId("labels"); vbVisuHotspots.getChildren().add(affHS1); } }); if (iNum11 != -1) { int iNumPan = iNum11; ImageView ivAfficheVignettePano = new ImageView( getPanoramiquesProjet()[iNum11].getImgPanoRect()); ivAfficheVignettePano.setPreserveRatio(true); ivAfficheVignettePano.setFitWidth(300); ivAfficheVignettePano.setLayoutY(10); ivAfficheVignettePano.setCursor(Cursor.HAND); ivAfficheVignettePano.setOnMouseClicked((e) -> { affichePanoChoisit(iNumPan); }); AnchorPane apVisuVignettePano = new AnchorPane(ivAfficheVignettePano); apVisuVignettePano.setPrefHeight(170); apVisuVignettePano.setTranslateX(10); vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, apVisuVignettePano, lblSep); } else { vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, lblSep); } } Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot")); lblTexteHS.setTranslateX(10); TextField tfTexteHS = new TextField(); if (getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo() != null) { tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo()); } tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); tfTexteHS.setId("txtHS" + io); tfTexteHS.setPrefSize(200, 25); tfTexteHS.setMaxSize(200, 20); tfTexteHS.setTranslateX(60); vbPanneauHS.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1); vbHotspots.getChildren().addAll(paneHsPanoramique, lblSep); } int iNbHS = io; int iTaillePane = io * 325; for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotImage(); io++) { Label lblSep = new Label(" "); Label lblSep1 = new Label(" "); VBox vbPanneauHsImage = new VBox(); Pane paneHsImage = new Pane(vbPanneauHsImage); int iNum = io; Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> { Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum); if (c1 != null) { if (c1.getFill() == Color.BLUE) { c1.setFill(Color.YELLOW); c1.setStroke(Color.BLUE); } else { c1.setFill(Color.BLUE); c1.setStroke(Color.YELLOW); } } })); timBouge.setCycleCount(Timeline.INDEFINITE); timBouge.pause(); paneHsImage.setOnMouseEntered((e) -> { timBouge.play(); }); paneHsImage.setOnMouseExited((e) -> { Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum); if (c1 != null) { c1.setFill(Color.BLUE); c1.setStroke(Color.YELLOW); } timBouge.pause(); }); paneHsImage.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;"); paneHsImage.setId("HSImg" + io); lblPoint = new Label("Image #" + (io + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.getStyleClass().add("titreOutil"); Separator sepHS = new Separator(Orientation.HORIZONTAL); sepHS.setPrefWidth(321); sepHS.setTranslateX(2); paneHsImage.setPrefWidth(325); vbPanneauHsImage.getChildren().addAll(lblPoint, sepHS); Label lblLien = new Label(rbLocalisation.getString("main.imageChoisie")); lblLien.setTranslateX(10); String strF1XML = getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrLienImg(); Image imgChoisie = new Image( "file:" + getStrRepertTemp() + File.separator + "images" + File.separator + strF1XML); ImageView ivChoisie = new ImageView(imgChoisie); ivChoisie.setTranslateX(100); ivChoisie.setFitWidth(100); ivChoisie.setFitHeight(imgChoisie.getHeight() / imgChoisie.getWidth() * 100); vbPanneauHsImage.getChildren().addAll(lblLien, ivChoisie, lblSep); Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot")); lblTexteHS.setTranslateX(10); TextField tfTexteHS = new TextField(); if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo() != null) { tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo()); } tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); tfTexteHS.setId("txtHSImage" + io); tfTexteHS.setPrefSize(200, 25); tfTexteHS.setMaxSize(200, 20); tfTexteHS.setTranslateX(60); vbPanneauHsImage.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1); Label lblCoulFond = new Label(rbLocalisation.getString("diapo.couleurFond")); lblCoulFond.setTranslateX(10); Label lblOpacite = new Label(rbLocalisation.getString("diapo.opacite")); lblOpacite.setTranslateX(10); if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond().equals("")) { getPanoramiquesProjet()[iNumPano].getHotspotImage(io).setStrCouleurFond( "#" + getGestionnaireInterface().getCouleurFondTheme().toString().substring(2, 8)); } ColorPicker cpCouleurFond = new ColorPicker( Color.valueOf(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond())); if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite() == -1) { getPanoramiquesProjet()[iNumPano].getHotspotImage(io) .setOpacite(getGestionnaireInterface().getOpaciteTheme()); } cpCouleurFond.setTranslateX(100); int i = io; cpCouleurFond.valueProperty().addListener((ov, av, nv) -> { if (getiNombrePanoramiques() != 0) { setbDejaSauve(false); getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *"); } getPanoramiquesProjet()[iNumPano].getHotspotImage(i) .setStrCouleurFond("#" + cpCouleurFond.getValue().toString().substring(2, 8)); }); Slider slOpacite = new Slider(0, 1, getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite()); slOpacite.valueProperty().addListener((ov, av, nv) -> { if (getiNombrePanoramiques() != 0) { setbDejaSauve(false); getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *"); } getPanoramiquesProjet()[iNumPano].getHotspotImage(i).setOpacite(slOpacite.getValue()); }); slOpacite.setTranslateX(100); slOpacite.setPrefWidth(130); slOpacite.setMinWidth(130); slOpacite.setMaxWidth(130); vbPanneauHsImage.getChildren().addAll(lblCoulFond, cpCouleurFond, lblOpacite, slOpacite); vbHotspots.getChildren().addAll(paneHsImage, lblSep); iTaillePane += 225 + ivChoisie.getFitHeight(); paneHsImage.setPrefHeight(200 + ivChoisie.getFitHeight()); paneHsImage.setMinHeight(200 + ivChoisie.getFitHeight()); paneHsImage.setMaxHeight(200 + ivChoisie.getFitHeight()); } iNbHS += io; for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotHTML(); io++) { Label lblSep = new Label(" "); int iNum = io; VBox vbPanneauHS = new VBox(); Pane paneHsHtml = new Pane(vbPanneauHS); Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> { Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum); if (c1 != null) { if (c1.getFill() == Color.DARKGREEN) { c1.setFill(Color.YELLOWGREEN); c1.setStroke(Color.DARKGREEN); } else { c1.setFill(Color.DARKGREEN); c1.setStroke(Color.YELLOWGREEN); } } })); timBouge.setCycleCount(Timeline.INDEFINITE); timBouge.pause(); paneHsHtml.setOnMouseEntered((e) -> { timBouge.play(); }); paneHsHtml.setOnMouseExited((e) -> { timBouge.pause(); Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum); if (c1 != null) { c1.setFill(Color.DARKGREEN); c1.setStroke(Color.YELLOWGREEN); } }); paneHsHtml.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;"); paneHsHtml.setId("HSHTML" + io); lblPoint = new Label("Hotspot HTML #" + (io + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.getStyleClass().add("titreOutil"); Separator sepHS = new Separator(Orientation.HORIZONTAL); sepHS.setPrefWidth(321); sepHS.setTranslateX(2); paneHsHtml.setPrefWidth(325); Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot")); lblTexteHS.setTranslateX(10); TextField tfTexteHS = new TextField(); if (getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo() != null) { tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo()); } tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); tfTexteHS.setId("txtHSHTML" + io); tfTexteHS.setPrefSize(200, 25); tfTexteHS.setMaxSize(200, 20); tfTexteHS.setTranslateX(60); vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS); Button btnEditeHSHTML = new Button(rbLocalisation.getString("main.editeHTML")); btnEditeHSHTML.setPrefWidth(80); btnEditeHSHTML.setTranslateX(paneHsHtml.getPrefWidth() - btnEditeHSHTML.getPrefWidth() - 10); vbPanneauHS.getChildren().addAll(btnEditeHSHTML); btnEditeHSHTML.setOnAction((e) -> { EditeurHTML editHTML = new EditeurHTML(); HotspotHTML HS = getPanoramiquesProjet()[iNumPano].getHotspotHTML(iNum); editHTML.setHsHTML(HS); Rectangle2D tailleEcran = Screen.getPrimary().getBounds(); int iHauteur = (int) tailleEcran.getHeight() - 100; int iLargeur = (int) tailleEcran.getWidth() - 100; editHTML.affiche(iLargeur, iHauteur); editHTML.addPropertyChangeListener("bValide", (ev) -> { if (ev.getNewValue().toString().equals("true")) { getPanoramiquesProjet()[iNumPano].setHotspotHTML(editHTML.getHsHTML(), iNum); dejaCharge = false; retireAffichageHotSpots(); Pane affHS1 = paneAffichageHS(strListePano(), iNumPano); affHS1.setId("labels"); vbVisuHotspots.getChildren().add(affHS1); } }); }); vbHotspots.getChildren().addAll(paneHsHtml, lblSep); paneHsHtml.setPrefHeight(120); paneHsHtml.setMinHeight(120); paneHsHtml.setMaxHeight(120); iTaillePane += 145; } iNbHS += io; for (io = 0; io < getPanoramiquesProjet()[iNumPano].getiNombreHotspotDiapo(); io++) { Label lblSep = new Label(" "); int iNum = io; VBox vbPanneauHS = new VBox(); Pane paneHsDiapo = new Pane(vbPanneauHS); Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> { Circle c1 = (Circle) panePanoramique.lookup("#dia" + iNum); if (c1 != null) { if (c1.getFill() == Color.TURQUOISE) { c1.setFill(Color.ORANGE); c1.setStroke(Color.TURQUOISE); } else { c1.setFill(Color.TURQUOISE); c1.setStroke(Color.ORANGE); } } })); timBouge.setCycleCount(Timeline.INDEFINITE); timBouge.pause(); paneHsDiapo.setOnMouseEntered((e) -> { timBouge.play(); }); paneHsDiapo.setOnMouseExited((e) -> { timBouge.pause(); Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum); if (c1 != null) { c1.setFill(Color.TURQUOISE); c1.setStroke(Color.ORANGE); } }); paneHsDiapo.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;"); paneHsDiapo.setId("DIAPO" + io); lblPoint = new Label("Hotspot Diaporama #" + (io + 1)); lblPoint.setPadding(new Insets(5, 10, 5, 5)); lblPoint.getStyleClass().add("titreOutil"); Separator sepHS = new Separator(Orientation.HORIZONTAL); sepHS.setPrefWidth(321); sepHS.setTranslateX(2); paneHsDiapo.setPrefWidth(325); Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot")); lblTexteHS.setTranslateX(10); TextField tfTexteHS = new TextField(); if (getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo() != null) { tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo()); } tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable, final String oldValue, final String newValue) -> { valideHS(); }); tfTexteHS.setId("txtDIA" + io); tfTexteHS.setPrefSize(200, 25); tfTexteHS.setMaxSize(200, 20); tfTexteHS.setTranslateX(60); vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS); ComboBox cbListeDiapo = new ComboBox(); for (int i = 0; i < getiNombreDiapo(); i++) { cbListeDiapo.getItems().add(diaporamas[i].getStrNomDiaporama()); } cbListeDiapo.getSelectionModel() .select(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getiNumDiapo()); int iii = io; cbListeDiapo.getSelectionModel().selectedIndexProperty().addListener((ov, av, nv) -> { getPanoramiquesProjet()[iNumPano].getHotspotDiapo(iii).setiNumDiapo((int) nv); }); cbListeDiapo.setTranslateX(60); vbPanneauHS.getChildren().addAll(cbListeDiapo); //Ajouter Liste Diaporamas vbHotspots.getChildren().addAll(paneHsDiapo, lblSep); paneHsDiapo.setPrefHeight(120); paneHsDiapo.setMinHeight(120); paneHsDiapo.setMaxHeight(120); iTaillePane += 145; } valideHS(); iNbHS += io; dejaCharge = true; paneHotSpots.setPrefHeight(iTaillePane); paneHotSpots.setMinHeight(iTaillePane); paneHotSpots.setMaxHeight(iTaillePane); paneHotSpots.setId("labels"); apVisuHS.setPrefHeight(paneHotSpots.getPrefHeight()); apVisuHS.setMinHeight(paneHotSpots.getPrefHeight()); apVisuHS.setMaxHeight(paneHotSpots.getPrefHeight()); vbVisuHotspots.setPrefHeight(paneHotSpots.getPrefHeight()); vbVisuHotspots.setMinHeight(paneHotSpots.getPrefHeight()); vbVisuHotspots.setMaxHeight(paneHotSpots.getPrefHeight()); return paneHotSpots; }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param strNomFichierBarre//w w w .j av a 2 s . com */ public static void creerEditerBarre(String strNomFichierBarre) { apCreationBarre.getChildren().clear(); apCreationBarre.setStyle("-fx-background-color : -fx-base;" + "-fx-border-color: derive(-fx-base,10%);" + "-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.5) , 8, 0.0 , 0 , 8 );" + "-fx-border-width: 1px;"); AnchorPane apOutilsBarre = new AnchorPane(); Button btnAnnulerBarre = new Button(rbLocalisation.getString("main.quitter"), new ImageView(new Image("file:" + getStrRepertAppli() + "/images/annule.png"))); final Button btnSauverBarre = new Button(rbLocalisation.getString("main.sauver"), new ImageView( new Image("file:" + getStrRepertAppli() + "/images/sauveProjet.png", 24, 24, true, true, true))); Rectangle2D tailleEcran = Screen.getPrimary().getBounds(); btnAjouteZone = new Button(rbLocalisation.getString("main.ajouteZone"), new ImageView( new Image("file:" + getStrRepertAppli() + "/images/btn+.png", 24, 24, true, true, true))); apImgBarrePersonnalisee = new AnchorPane(); apImgBarrePersonnalisee.getChildren().clear(); apZoneBarrePersonnalisee = new AnchorPane(); apZoneBarrePersonnalisee.getChildren().clear(); apZoneBarrePersonnalisee.setLayoutX(0); apZoneBarrePersonnalisee.setLayoutY(150); apZoneBarrePersonnalisee.setPrefWidth(300); apZoneBarrePersonnalisee.setPrefHeight(200); int iLargeurEcran = (int) tailleEcran.getWidth(); int iHauteurEcran = (int) tailleEcran.getHeight() - 100; final int iLargeur = 1200; final int iHauteur = 600; mbarPrincipal.setDisable(true); bbarPrincipal.setDisable(true); hbBarreBouton.setDisable(true); tpEnvironnement.setDisable(true); apCreationBarre.setPrefWidth(iLargeur); apCreationBarre.setMinWidth(iLargeur); apCreationBarre.setMaxWidth(iLargeur); apCreationBarre.setPrefHeight(iHauteur); apCreationBarre.setMinHeight(iHauteur); apCreationBarre.setMaxHeight(iHauteur); apCreationBarre.setLayoutX((iLargeurEcran - iLargeur) / 2); apCreationBarre.setLayoutY((iHauteurEcran - iHauteur) / 2); apCreationBarre.setVisible(true); Label lblBarrePersonnalisee = new Label(rbLocalisation.getString("main.creeBarrePersonnalisee")); lblBarrePersonnalisee.setMinWidth(iLargeur - 10); lblBarrePersonnalisee.setAlignment(Pos.CENTER); lblBarrePersonnalisee.setStyle("-fx-background-color : #777;"); lblBarrePersonnalisee.setTextFill(Color.WHITE); lblBarrePersonnalisee.setLayoutX(5); lblBarrePersonnalisee.setLayoutY(10); lblBarrePersonnalisee.setFont(Font.font(14)); apCreationBarre.getChildren().add(lblBarrePersonnalisee); apOutilsBarre.setPrefWidth(300); apOutilsBarre.setMinWidth(300); apOutilsBarre.setMaxWidth(300); apOutilsBarre.setPrefHeight(iHauteur - 50); apOutilsBarre.setMinHeight(iHauteur - 50); apOutilsBarre.setMaxHeight(iHauteur - 50); apOutilsBarre.setLayoutX(iLargeur - 302); apOutilsBarre.setLayoutY(50); apOutilsBarre.setStyle( "-fx-background-color : -fx-background;-fx-border-width : 1px;-fx-border-color : transparent transparent transparent -fx-outer-border;"); btnAnnulerBarre.setPrefWidth(120); btnAnnulerBarre.setLayoutX(30); btnAnnulerBarre.setLayoutY(iHauteur - 90); btnSauverBarre.setPrefWidth(120); btnSauverBarre.setLayoutX(160); btnSauverBarre.setLayoutY(iHauteur - 90); btnSauverBarre.setDisable(true); Label lblChargeImage = new Label(rbLocalisation.getString("main.chargeImage")); lblChargeImage.setLayoutX(20); lblChargeImage.setLayoutY(10); TextField tfChargeImage = new TextField(""); tfChargeImage.setDisable(true); tfChargeImage.setPrefWidth(200); tfChargeImage.setLayoutX(50); tfChargeImage.setLayoutY(40); Button btnChargeImage = new Button("..."); btnChargeImage.setLayoutX(260); btnChargeImage.setLayoutY(40); final CheckBox cbMasqueZones = new CheckBox(rbLocalisation.getString("main.masqueZones")); cbMasqueZones.setDisable(true); cbMasqueZones.setLayoutX(20); cbMasqueZones.setLayoutY(70); btnAjouteZone.setLayoutX(130); btnAjouteZone.setLayoutY(110); btnAjouteZone.setDisable(true); apOutilsBarre.getChildren().addAll(lblChargeImage, tfChargeImage, btnChargeImage, cbMasqueZones, btnAjouteZone, apZoneBarrePersonnalisee, btnAnnulerBarre, btnSauverBarre); apCreationBarre.getChildren().addAll(apImgBarrePersonnalisee, apOutilsBarre); if (!strNomFichierBarre.equals("")) { lblChargeImage.setVisible(false); tfChargeImage.setVisible(false); btnChargeImage.setVisible(false); String strNomFichier = strNomFichierBarre; strNomFichier = strNomFichier.substring(0, strNomFichier.length() - 4); strNomFichierShp = strNomFichier + ".shp"; String strNomFichierPng = strNomFichier + ".png"; File fichPng = new File(strNomFichierPng); if (fichPng.exists()) { try { btnAjouteZone.setDisable(false); imgBarrePersonnalisee = new Image("file:" + fichPng); iNombreZones = getGestionnaireInterface().lisFichierShp(strNomFichierShp, zones); btnSauverBarre.setDisable(false); if (iNombreZones > 0) { cbMasqueZones.setDisable(false); } afficheBarrePersonnalisee(iLargeur, iHauteur, false); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } } btnAnnulerBarre.setOnMouseClicked((t) -> { mbarPrincipal.setDisable(false); bbarPrincipal.setDisable(false); hbBarreBouton.setDisable(false); tpEnvironnement.setDisable(false); apCreationBarre.setVisible(false); }); btnAjouteZone.setOnMouseClicked((t) -> { btnAjouteZone.setDisable(true); ajouterZone(iLargeur, iHauteur, false); }); btnChargeImage.setOnMouseClicked((t) -> { strRepertBarrePersonnalisee = getStrRepertAppli() + "/theme/telecommandes"; File fileRepert; fileRepert = new File(strRepertBarrePersonnalisee); FileChooser fileChooser = new FileChooser(); FileChooser.ExtensionFilter efShpFilter = new FileChooser.ExtensionFilter( "Fichiers barre personnalise (SHP)", "*.shp", "*.png"); fileChooser.setInitialDirectory(fileRepert); fileChooser.getExtensionFilters().addAll(efShpFilter); File fileFichierImage = fileChooser.showOpenDialog(null); if (fileFichierImage != null) { String strNomFichier = fileFichierImage.getAbsolutePath(); strNomFichier = strNomFichier.substring(0, strNomFichier.length() - 4); strNomFichierShp = strNomFichier + ".shp"; String strNomFichierPng = strNomFichier + ".png"; File fileFichierPng = new File(strNomFichierPng); if (fileFichierPng.exists()) { try { btnAjouteZone.setDisable(false); imgBarrePersonnalisee = new Image("file:" + fileFichierPng); iNombreZones = getGestionnaireInterface().lisFichierShp(strNomFichierShp, zones); btnSauverBarre.setDisable(false); if (iNombreZones > 0) { cbMasqueZones.setDisable(false); } afficheBarrePersonnalisee(iLargeur, iHauteur, false); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } } }); btnSauverBarre.setOnMouseClicked((t) -> { try { sauverBarre(strNomFichierShp); getGestionnaireInterface().chargeBarrePersonnalisee(strNomFichierBarre); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } }); cbMasqueZones.selectedProperty() .addListener((ObservableValue<? extends Boolean> ov, Boolean old_val, Boolean new_val) -> { afficheBarrePersonnalisee(iLargeur, iHauteur, new_val); }); }
From source file:editeurpanovisu.EditeurPanovisu.java
/** * * @param stPrimaryStage/*from ww w. j a v a 2 s . co m*/ * @throws Exception Exceptions */ @Override public void start(Stage stPrimaryStage) throws Exception { if (isLinux()) { stPrimaryStage.setFullScreen(true); } File fileRep = new File(""); setbInternet(netIsAvailable()); setStrCurrentDir(fileRep.getAbsolutePath()); setStrRepertAppli(fileRep.getAbsolutePath()); fileRepertConfig = new File(getStrRepertAppli() + File.separator + "configPV"); rbLocalisation = ResourceBundle.getBundle("editeurpanovisu.i18n.PanoVisu", getLocale()); Package pack = Package.getPackage("editeurpanovisu"); strNumVersion = pack.getImplementationVersion() + "-b" + rbLocalisation.getString("build.numero").replace(" ", "").replace("", ""); lisPreferences(); setStPrincipal(stPrimaryStage); stPrimaryStage.setResizable(false); getStPrincipal().setResizable(true); getStPrincipal().setAlwaysOnTop(false); getStPrincipal().setTitle("PanoVisu v" + strNumVersion.split("-")[0]); stPrimaryStage.setMaximized(true); stPrimaryStage.setAlwaysOnTop(false); Rectangle2D tailleEcran = Screen.getPrimary().getBounds(); int iHauteur; if (isMac()) { iHauteur = (int) tailleEcran.getHeight() - 60; } else { iHauteur = (int) tailleEcran.getHeight() - 20; } int iLargeur = (int) tailleEcran.getWidth() - 2; largeurMax = tailleEcran.getWidth() - 450.0d; creeEnvironnement(stPrimaryStage, iLargeur, iHauteur); File fileRepertTempFile = new File(getStrRepertAppli() + File.separator + "temp"); setStrRepertTemp(fileRepertTempFile.getAbsolutePath()); if (!fileRepertTempFile.exists()) { fileRepertTempFile.mkdirs(); } else { deleteDirectory(getStrRepertTemp()); } String strExtTemp = strGenereChaineAleatoire(20); setStrRepertTemp(getStrRepertTemp() + File.separator + "temp" + strExtTemp); fileRepertTempFile = new File(getStrRepertTemp()); fileRepertTempFile.mkdirs(); installeEvenements(); projetsNouveau(); stPrimaryStage.setOnCloseRequest((WindowEvent event) -> { try { sauvePreferences(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } ButtonType reponse = null; ButtonType buttonTypeOui = new ButtonType(rbLocalisation.getString("main.oui")); ButtonType buttonTypeNon = new ButtonType(rbLocalisation.getString("main.non")); ButtonType buttonTypeAnnule = new ButtonType(rbLocalisation.getString("main.annuler")); if (!isbDejaSauve()) { Alert alert = new Alert(AlertType.CONFIRMATION); alert.setTitle(rbLocalisation.getString("main.dialog.quitterApplication")); alert.setHeaderText(null); alert.setContentText(rbLocalisation.getString("main.dialog.chargeProjetMessage")); alert.getButtonTypes().clear(); alert.getButtonTypes().setAll(buttonTypeOui, buttonTypeNon, buttonTypeAnnule); Optional<ButtonType> actReponse = alert.showAndWait(); reponse = actReponse.get(); } if (reponse == buttonTypeOui) { try { projetSauve(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } } if ((reponse == buttonTypeOui) || (reponse == buttonTypeNon) || (reponse == null)) { try { sauveHistoFichiers(); } catch (IOException ex) { Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex); } deleteDirectory(getStrRepertTemp()); File fileTemp = new File(getStrRepertTemp()); fileTemp.delete(); } else { event.consume(); } }); }
From source file:org.eclipse.jubula.rc.javafx.driver.RobotJavaFXImpl.java
/** * Refreshes the complete layout and returns the bounds of the given * Component./*from ww w . j a v a2 s . co m*/ * * @param comp * the Component * @param clickOp * not used * @return Rectangle with the Bounds */ private Rectangle getComponentBounds(final Object comp, ClickOptions clickOp) { ComponentHandler.syncStageResize(); Rectangle bounds = null; if (comp instanceof Stage) { Stage s = (Stage) comp; bounds = new Rectangle(new Point(Rounding.round(s.getX()), Rounding.round(s.getY()))); // This is not multi display compatible Screen screen = Screen.getPrimary(); final Rectangle2D screenBounds = screen.getBounds(); int displayWidth = Rounding.round(screenBounds.getWidth()); int displayHeight = Rounding.round(screenBounds.getHeight()); if (s.isFullScreen()) { bounds.width = Rounding.round(displayWidth); bounds.height = Rounding.round(displayHeight); } else if (s.isMaximized()) { int x = Rounding.round(s.getX()); int y = Rounding.round(s.getY()); // trimming the bounds to the display if necessary bounds.width = Rounding.round(s.getWidth()); bounds.height = Rounding.round(s.getHeight()); if (x < 0 || y < 0) { bounds.x = 0; bounds.y = 0; if (bounds.width > displayWidth) { bounds.width = displayWidth; } if (bounds.height > displayHeight) { bounds.height = displayHeight; } } } else { bounds.width = Rounding.round(s.getWidth()); bounds.height = Rounding.round(s.getHeight()); } } else { final Node node = (Node) comp; if (clickOp.isScrollToVisible()) { ensureComponentVisible(node); } bounds = EventThreadQueuerJavaFXImpl.invokeAndWait("Robot get node bounds", new Callable<Rectangle>() { //$NON-NLS-1$ @Override public Rectangle call() throws Exception { Rectangle bs = new Rectangle(getLocation(node, new Point(0, 0))); Bounds b = node.getBoundsInParent(); bs.width = Rounding.round(b.getWidth()); bs.height = Rounding.round(b.getHeight()); return bs; } }); } return bounds; }
From source file:org.jevis.jeconfig.JEConfig.java
/** * Build an new JEConfig Login and main frame/stage * * @param primaryStage/*from w ww.j a va2s.co m*/ */ //AITBilal - Login private void initGUI(Stage primaryStage) { Scene scene; LoginGlass login = new LoginGlass(primaryStage); AnchorPane jeconfigRoot = new AnchorPane(); AnchorPane.setTopAnchor(jeconfigRoot, 0.0); AnchorPane.setRightAnchor(jeconfigRoot, 0.0); AnchorPane.setLeftAnchor(jeconfigRoot, 0.0); AnchorPane.setBottomAnchor(jeconfigRoot, 0.0); // jeconfigRoot.setStyle("-fx-background-color: white;"); // jeconfigRoot.getChildren().setAll(new Label("sodfhsdhdsofhdshdsfdshfjf")); Screen screen = Screen.getPrimary(); Rectangle2D bounds = screen.getVisualBounds(); // @AITBilal - Main frame elemente wird aufgerufen nachdem man sich eingeloggt hat. login.getLoginStatus().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) { if (newValue) { System.out.println("after request"); _mainDS = login.getDataSource(); ds = _mainDS; Platform.runLater(new Runnable() { @Override public void run() { FadeTransition ft = new FadeTransition(Duration.millis(1500), login); ft.setFromValue(1.0); ft.setToValue(0); ft.setCycleCount(1); ft.play(); } }); JEConfig.PROGRAMM_INFO.setJEVisAPI(ds.getInfo()); JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.commons.application.Info.INFO); JEConfig.PROGRAMM_INFO.addLibrary(org.jevis.application.Info.INFO); preLodedClasses = login.getAllClasses(); preLodedRootObjects = login.getRootObjects(); PluginManager pMan = new PluginManager(ds); //@AITBilal - Toolbar fr save, newB, delete, sep1, form GlobalToolBar toolbar = new GlobalToolBar(pMan); pMan.addPluginsByUserSetting(null); // StackPane root = new StackPane(); // root.setId("mainpane"); BorderPane border = new BorderPane(); VBox vbox = new VBox(); vbox.getChildren().addAll(new TopMenu(), toolbar.ToolBarFactory()); border.setTop(vbox); //@AITBilal - Alle Plugins Inhalt fr JEConfig (Resources... | System | Attribute) border.setCenter(pMan.getView()); Statusbar statusBar = new Statusbar(ds); border.setBottom(statusBar); System.out.println("show welcome"); //Disable GUI is StatusBar note an disconnect border.disableProperty().bind(statusBar.connectedProperty.not()); Platform.runLater(new Runnable() { @Override public void run() { AnchorPane.setTopAnchor(border, 0.0); AnchorPane.setRightAnchor(border, 0.0); AnchorPane.setLeftAnchor(border, 0.0); AnchorPane.setBottomAnchor(border, 0.0); jeconfigRoot.getChildren().setAll(border); // try { // WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://coffee-project.eu/")); // WelcomePage welcome = new WelcomePage(primaryStage, new URI("http://openjevis.org/projects/openjevis/wiki/JEConfig3#JEConfig-Version-3")); // Task<Void> showWelcome = new Task<Void>() { // @Override // protected Void call() throws Exception { try { WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL()); } catch (URISyntaxException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } catch (MalformedURLException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } // return null; // } // }; // new Thread(showWelcome).start(); // WelcomePage welcome = new WelcomePage(primaryStage, _config.getWelcomeURL()); // } catch (URISyntaxException ex) { // Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); // } catch (MalformedURLException ex) { // Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); // } } }); } } }); AnchorPane.setTopAnchor(login, 0.0); AnchorPane.setRightAnchor(login, 0.0); AnchorPane.setLeftAnchor(login, 0.0); AnchorPane.setBottomAnchor(login, 0.0); //@AITBilal - Login Dialog scene = new Scene(jeconfigRoot, bounds.getWidth(), bounds.getHeight()); scene.getStylesheets().add("/styles/Styles.css"); primaryStage.getIcons().add(getImage("1393354629_Config-Tools.png")); primaryStage.setTitle("JEConfig"); primaryStage.setScene(scene); maximize(primaryStage); primaryStage.show(); // Platform.runLater(new Runnable() { // @Override // public void run() { //@AITBilal - Inhalt bzw. die Elemente von LoginDialog jeconfigRoot.getChildren().setAll(login); // } // }); primaryStage.onCloseRequestProperty().addListener(new ChangeListener<EventHandler<WindowEvent>>() { @Override public void changed(ObservableValue<? extends EventHandler<WindowEvent>> ov, EventHandler<WindowEvent> t, EventHandler<WindowEvent> t1) { try { System.out.println("Disconnect"); ds.disconnect(); } catch (JEVisException ex) { Logger.getLogger(JEConfig.class.getName()).log(Level.SEVERE, null, ex); } } }); }
From source file:org.jevis.jeconfig.JEConfig.java
/** * maximized the given stage/*from w w w . ja v a2 s . c o m*/ * * @param primaryStage */ public static void maximize(Stage primaryStage) { Screen screen = Screen.getPrimary(); Rectangle2D bounds = screen.getVisualBounds(); primaryStage.setX(bounds.getMinX()); primaryStage.setY(bounds.getMinY()); primaryStage.setWidth(bounds.getWidth()); primaryStage.setHeight(bounds.getHeight()); }
From source file:qupath.lib.gui.plots.ScatterPlot.java
public void drawPlot(GraphicsContext g, Rectangle2D region, int maxPoints) { g.save();/*from ww w. ja v a 2s. c o m*/ g.beginPath(); g.moveTo(region.getMinX(), region.getMinY()); g.lineTo(region.getMaxX(), region.getMinY()); g.lineTo(region.getMaxX(), region.getMaxY()); g.lineTo(region.getMinX(), region.getMaxY()); g.closePath(); g.clip(); // int pad = 10; double scaleX = region.getWidth() / (maxX - minX); double scaleY = region.getHeight() / (maxY - minY); g.setLineWidth(1.5f); // g.setStroke(javafx.scene.paint.Color.GRAY); // g.strokeRect(region.getX(), region.getY(), region.getWidth(), region.getHeight()); g.translate(region.getMinX(), region.getMinY()); // g2d.drawLine(0, 0, 0, region.height); // g2d.drawLine(0, region.height, region.width, region.height); double increment; if (maxPoints < 0 || x.length <= maxPoints) increment = 1; else increment = (double) x.length / maxPoints; for (double i = 0; i < x.length; i += increment) { int ind = (int) i; double xx = x[ind]; double yy = y[ind]; // // Skip if out of range // if (xx < minX || xx > maxX || yy < minY || yy > maxY) // continue; double xo = (xx - minX) * scaleX - markerSize / 2; double yo = region.getHeight() - (yy - minY) * scaleY - markerSize / 2; Color cDraw = colorDraw == null ? null : colorDraw[ind]; if (fillMarkers) { Color cFill = colorFill[ind] == null ? cDraw : colorFill[ind]; if (cFill != null) { g.setFill(cFill); g.fillOval(xo, yo, markerSize, markerSize); // Don't need to draw if it would be the same color anyway if (cFill == cDraw) continue; } } if (cDraw != null) { g.setStroke(cDraw); g.strokeOval(xo, yo, markerSize, markerSize); } } g.restore(); }
From source file:snpviewer.SnpViewer.java
private void fixStageSize(Stage stage, boolean fix) { /*provides a fix for annoying bug which means that * setResizable(false) causing windows to grow in size in Windows *//*from w ww . j a va 2 s. c om*/ if (fix) { stage.setMaxHeight(stage.getHeight()); stage.setMinHeight(stage.getHeight()); stage.setMaxWidth(stage.getWidth()); stage.setMinWidth(stage.getWidth()); } else { Rectangle2D primaryScreenBounds = Screen.getPrimary().getVisualBounds(); stage.setMaxHeight(primaryScreenBounds.getHeight()); stage.setMinHeight(300); stage.setMaxWidth(primaryScreenBounds.getWidth()); stage.setMinWidth(500); } }