List of usage examples for javafx.scene.layout HBox getChildren
@Override
public ObservableList<Node> getChildren()
From source file:de.bayern.gdi.gui.Controller.java
/** * Validates all items in processing chain container. *//*from w w w.j ava 2 s . c om*/ private void validateChainContainerItems() { boolean allValid = true; for (Node o : chainContainer.getChildren()) { if (o instanceof VBox) { VBox v = (VBox) o; HBox hbox = (HBox) v.getChildren().get(0); Node cBox = hbox.getChildren().get(0); if (cBox instanceof ComboBox && !validateChainContainer((ComboBox) cBox)) { allValid = false; } } } //If all chain items were ready, set status to ready if (allValid) { setStatusTextUI(I18n.format(STATUS_READY)); } }
From source file:de.bayern.gdi.gui.Controller.java
/** * Resets all marks at the processing chain container, items are kept. *//* w w w.j a va2 s.c o m*/ private void resetProcessingChainContainer() { for (Node o : chainContainer.getChildren()) { if (o instanceof VBox) { VBox v = (VBox) o; HBox hbox = (HBox) v.getChildren().get(0); Node cBox = hbox.getChildren().get(0); if (cBox instanceof ComboBox) { cBox.setStyle(FX_BORDER_COLOR_NULL); ComboBox box = (ComboBox) cBox; ObservableList<ProcessingStepConfiguration> confs = (ObservableList<ProcessingStepConfiguration>) box .getItems(); for (ProcessingStepConfiguration cfgI : confs) { cfgI.setCompatible(true); confs.set(confs.indexOf(cfgI), cfgI); } } } } }
From source file:de.bayern.gdi.gui.Controller.java
private void loadWfsSimple() { ObservableList<Node> children = simpleWFSContainer.getChildren(); Map<String, String> parameters = downloadConfig.getParams(); for (Node node : children) { if (node instanceof HBox) { HBox hb = (HBox) node; Node n1 = hb.getChildren().get(0); Node n2 = hb.getChildren().get(1); if (n1 instanceof Label && n2 instanceof TextField) { Label paramLabel = (Label) n1; TextField paramBox = (TextField) n2; String targetValue = parameters.get(paramLabel.getText()); if (targetValue != null) { paramBox.setText(targetValue); }// ww w . j av a2s. c om } if (n2 instanceof ComboBox) { ComboBox<OutputFormatModel> cb = (ComboBox<OutputFormatModel>) n2; cb.setCellFactory(new Callback<ListView<OutputFormatModel>, ListCell<OutputFormatModel>>() { @Override public ListCell<OutputFormatModel> call(ListView<OutputFormatModel> list) { return new CellTypes.StringCell(); } }); cb.setOnAction(event -> { if (cb.getValue().isAvailable()) { cb.setStyle(FX_BORDER_COLOR_NULL); } else { cb.setStyle(FX_BORDER_COLOR_RED); } }); boolean formatAvailable = false; for (OutputFormatModel i : cb.getItems()) { if (i.getItem().equals(downloadConfig.getOutputFormat())) { cb.getSelectionModel().select(i); formatAvailable = true; } } if (!formatAvailable) { String format = downloadConfig.getOutputFormat(); OutputFormatModel m = new OutputFormatModel(); m.setItem(format); m.setAvailable(false); cb.getItems().add(m); cb.getSelectionModel().select(m); } if (cb.getValue().isAvailable()) { cb.setStyle(FX_BORDER_COLOR_NULL); } else { cb.setStyle(FX_BORDER_COLOR_RED); } } } } }
From source file:ui.main.MainViewController.java
private synchronized void paintSentFile(Chat chat, String path, String time) { //this method paints the recieved picture message Task<HBox> recievedMessages = new Task<HBox>() { @Override// ww w .j a v a 2 s . com protected HBox call() throws Exception { Thread.sleep(100); VBox vbox = new VBox(); //to add text ImageView imageRec = new ImageView(myAvatar.getImage()); //image imageRec.setFitHeight(60); imageRec.setFitWidth(50); Label timeL = new Label(time); timeL.setDisable(true); timeL.setFont(new Font("Arial", 10)); Label chatterName = new Label(name.getText()); chatterName.setDisable(true); Hyperlink link = new Hyperlink("File Sent: " + path); link.addEventHandler(MouseEvent.MOUSE_CLICKED, new EventHandler<javafx.scene.input.MouseEvent>() { @Override public void handle(javafx.scene.input.MouseEvent event) { try { if (event.getButton() == MouseButton.PRIMARY) { Runtime.getRuntime().exec("explorer.exe /select," + path); } } catch (IOException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } }); vbox.getChildren().addAll(chatterName, link, timeL); vbox.setAlignment(Pos.CENTER_LEFT); HBox hbox = new HBox(); hbox.setAlignment(Pos.CENTER_RIGHT); //bbl.setBubbleSpec(BubbleSpec.FACE_LEFT_CENTER); hbox.getChildren().addAll(vbox, imageRec); return hbox; } }; recievedMessages.setOnSucceeded(event -> { chatList.getChildren().add(recievedMessages.getValue()); }); if (chat.getParticipant().contains(currentChat.getParticipant())) { Thread t = new Thread(recievedMessages); t.start(); try { t.join(); } catch (InterruptedException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:de.bayern.gdi.gui.Controller.java
private boolean validateInput() { final StringBuilder failed = new StringBuilder(); Consumer<String> fail = s -> { if (failed.length() != 0) { failed.append(", "); }/*from w w w. j a va 2s . c o m*/ failed.append(s); }; for (DataBean.Attribute attr : this.dataBean.getAttributes()) { if (!attr.getType().isEmpty() && !Validator.isValid(attr.getType(), attr.getValue())) { fail.accept(attr.getName()); } } if (downloadConfig != null) { if (serviceTypeChooser.isVisible() && serviceTypeChooser.getValue() instanceof MiscItemModel) { fail.accept(I18n.format("gui.dataset")); } if (atomContainer.isVisible() && atomVariationChooser.getValue() instanceof MiscItemModel) { fail.accept(I18n.format("gui.variants")); } if (referenceSystemChooser.isVisible() && !referenceSystemChooser.getValue().isAvailable()) { fail.accept(I18n.format("gui.reference-system")); } if (basicWFSContainer.isVisible() && dataFormatChooser.isVisible() && !dataFormatChooser.getValue().isAvailable()) { fail.accept(I18n.format("gui.data-format")); } if (simpleWFSContainer.isVisible()) { ObservableList<Node> children = simpleWFSContainer.getChildren(); for (Node node : children) { if (node instanceof HBox) { HBox hb = (HBox) node; Node n2 = hb.getChildren().get(1); if (n2 instanceof ComboBox) { ComboBox<OutputFormatModel> cb = (ComboBox<OutputFormatModel>) n2; if (!cb.getValue().isAvailable()) { fail.accept(I18n.format("gui.data-format")); break; } } } } } } if (failed.length() == 0) { return true; } setStatusTextUI(I18n.format("status.validation-fail", failed.toString())); return false; }
From source file:ui.main.MainViewController.java
private synchronized void paintSentPhoto(Chat chat, File file, String time) { //this method paints the recieved picture message Task<HBox> recievedMessages = new Task<HBox>() { @Override//w w w .j av a 2 s . c o m protected HBox call() throws Exception { // Thread.sleep(100); VBox vbox = new VBox(); //to add text ImageView imageRec = new ImageView(myAvatar.getImage()); //image imageRec.setFitHeight(60); imageRec.setFitWidth(50); Label chatterName = new Label(name.getText()); chatterName.setDisable(true); Label timeL = new Label(time); timeL.setDisable(true); timeL.setFont(new Font("Arial", 10)); try { Image recievedImage = SwingFXUtils.toFXImage(ImageIO.read(file), null); ImageView receivedImageView = new ImageView(recievedImage); receivedImageView.setFitHeight(300); receivedImageView.setFitWidth(300); receivedImageView.setPreserveRatio(true); receivedImageView.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { if (event.getButton() == MouseButton.PRIMARY) { Desktop dt = Desktop.getDesktop(); try { dt.open(file); } catch (IOException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } } }); receivedImageView.setOnMouseEntered(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { chatList.getScene().setCursor(Cursor.HAND); } }); receivedImageView.setOnMouseExited(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { chatList.getScene().setCursor(Cursor.DEFAULT); } }); vbox.getChildren().addAll(chatterName, receivedImageView, timeL); } catch (IOException e) { e.printStackTrace(); } vbox.setAlignment(Pos.CENTER_LEFT); HBox hbox = new HBox(); hbox.setAlignment(Pos.CENTER_RIGHT); //bbl.setBubbleSpec(BubbleSpec.FACE_LEFT_CENTER); hbox.getChildren().addAll(vbox, imageRec); return hbox; } }; recievedMessages.setOnSucceeded(event -> { chatList.getChildren().add(recievedMessages.getValue()); }); if (chat.getParticipant().contains(currentChat.getParticipant())) { Thread t = new Thread(recievedMessages); t.start(); try { t.join(); } catch (InterruptedException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:de.bayern.gdi.gui.Controller.java
private void extractStoredQuery() { ItemModel data = this.dataBean.getDatatype(); if (data instanceof StoredQueryModel) { this.dataBean.setAttributes(new ArrayList<DataBean.Attribute>()); ObservableList<Node> children = this.simpleWFSContainer.getChildren(); for (Node n : children) { if (n.getClass() == HBox.class) { HBox hbox = (HBox) n; ObservableList<Node> hboxChildren = hbox.getChildren(); String value = ""; String name = ""; String type = ""; Label l1 = null;//from www .jav a2 s . co m Label l2 = null; TextField tf = null; ComboBox cb = null; for (Node hn : hboxChildren) { if (hn.getClass() == ComboBox.class) { cb = (ComboBox) hn; } if (hn.getClass() == TextField.class) { tf = (TextField) hn; } if (hn.getClass() == Label.class) { if (l1 == null) { l1 = (Label) hn; } if (l1 != (Label) hn) { l2 = (Label) hn; } } if (tf != null && (l1 != null || l2 != null)) { name = tf.getUserData().toString(); value = tf.getText(); if (l2 != null && l1.getText().equals(name)) { type = l2.getText(); } else { type = l1.getText(); } } if (cb != null && (l1 != null || l2 != null) && cb.getId().equals(UIFactory.getDataFormatID())) { name = OUTPUTFORMAT; if (cb.getSelectionModel() != null && cb.getSelectionModel().getSelectedItem() != null) { value = cb.getSelectionModel().getSelectedItem().toString(); type = ""; } else { Platform.runLater(() -> setStatusTextUI(I18n.getMsg(GUI_FORMAT_NOT_SELECTED))); } } if (!name.isEmpty() && !value.isEmpty()) { this.dataBean.addAttribute(name, value, type); } } } } } }
From source file:ui.main.MainViewController.java
private synchronized void paintSendMessage(String msg, String time) { Task<HBox> recievedMessages = new Task<HBox>() { @Override/*from w ww.j a va 2 s. co m*/ protected HBox call() throws Exception { VBox vbox = new VBox(); //to add text ImageView imageRec = new ImageView(myAvatar.getImage()); imageRec.setFitHeight(60); imageRec.setFitWidth(50); Label myName = new Label(name.getText()); myName.setDisable(true); Label timeL = new Label(time); timeL.setDisable(true); timeL.setFont(new Font("Arial", 10)); BubbledLabel bbl = new BubbledLabel(); bbl.setText(msg); bbl.setBackground(new Background(new BackgroundFill(Color.LIGHTBLUE, null, null))); HBox hbox = new HBox(); hbox.setAlignment(Pos.TOP_RIGHT); bbl.setBubbleSpec(BubbleSpec.FACE_RIGHT_CENTER); vbox.getChildren().addAll(myName, bbl, timeL); hbox.getChildren().addAll(vbox, imageRec); return hbox; } }; recievedMessages.setOnSucceeded(event -> { chatList.getChildren().add(recievedMessages.getValue()); }); Thread t = new Thread(recievedMessages); t.setDaemon(true); t.start(); try { t.join(); } catch (InterruptedException ex) { Logger.getLogger(MainViewController.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:dpfmanager.shell.interfaces.gui.component.report.ReportsView.java
public void addFormatIcons() { colFormats.setCellFactory(//from ww w . j ava 2 s .com new Callback<TableColumn<ReportRow, ObservableMap<String, String>>, TableCell<ReportRow, ObservableMap<String, String>>>() { @Override public TableCell<ReportRow, ObservableMap<String, String>> call( TableColumn<ReportRow, ObservableMap<String, String>> param) { TableCell<ReportRow, ObservableMap<String, String>> cell = new TableCell<ReportRow, ObservableMap<String, String>>() { @Override public void updateItem(ObservableMap<String, String> item, boolean empty) { super.updateItem(item, empty); if (!empty && item != null) { HBox box = new HBox(); box.setSpacing(3); box.setAlignment(Pos.CENTER_LEFT); for (String i : item.keySet()) { ImageView icon = new ImageView(); icon.setId("but" + i); icon.setFitHeight(20); icon.setFitWidth(20); icon.setImage(new Image("images/formats/" + i + ".png")); icon.setCursor(Cursor.HAND); String type = i; String path = item.get(i); icon.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { ArrayMessage am = new ArrayMessage(); am.add(GuiConfig.PERSPECTIVE_SHOW, new UiMessage()); am.add(GuiConfig.PERSPECTIVE_SHOW + "." + GuiConfig.COMPONENT_SHOW, new ShowMessage(type, path)); getContext().send(GuiConfig.PERSPECTIVE_SHOW, am); } }); ContextMenu contextMenu = new ContextMenu(); javafx.scene.control.MenuItem download = new javafx.scene.control.MenuItem( "Download report"); contextMenu.getItems().add(download); icon.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() { public void handle(ContextMenuEvent e) { contextMenu.show(icon, e.getScreenX(), e.getScreenY()); } }); box.getChildren().add(icon); } setGraphic(box); } else { setGraphic(null); } } }; return cell; } }); }
From source file:editeurpanovisu.EquiCubeDialogController.java
/** * * @param strTypeTransf//from w ww. j a v a 2 s .c o m * @throws Exception Exceptions */ public void afficheFenetre(String strTypeTransf) throws Exception { lvListeFichier.getItems().clear(); stTransformations = new Stage(StageStyle.UTILITY); apTransformations = new AnchorPane(); stTransformations.initModality(Modality.APPLICATION_MODAL); stTransformations.setResizable(true); apTransformations.setStyle("-fx-background-color : #ff0000;"); VBox vbFenetre = new VBox(); HBox hbChoix = new HBox(); Pane paneChoixFichier = new Pane(); btnAjouteFichiers = new Button("Ajouter des Fichiers"); paneChoixTypeFichier = new Pane(); Label lblType = new Label("Type des Fichiers de sortie"); rbJpeg = new RadioButton("JPEG (.jpg)"); rbBmp = new RadioButton("BMP (.bmp)"); rbTiff = new RadioButton("TIFF (.tif)"); cbSharpen = new CheckBox("Masque de nettet"); cbSharpen.setSelected(EditeurPanovisu.isbNetteteTransf()); slSharpen = new Slider(0, 2, EditeurPanovisu.getNiveauNetteteTransf()); lblSharpen = new Label(); double lbl = (Math.round(EditeurPanovisu.getNiveauNetteteTransf() * 20.d) / 20.d); lblSharpen.setText(lbl + ""); slSharpen.setDisable(!EditeurPanovisu.isbNetteteTransf()); lblSharpen.setDisable(!EditeurPanovisu.isbNetteteTransf()); Pane paneboutons = new Pane(); btnAnnuler = new Button("Fermer la fentre"); btnValider = new Button("Lancer le traitement"); strTypeTransformation = strTypeTransf; Image imgTransf; if (strTypeTransf.equals(EquiCubeDialogController.EQUI2CUBE)) { stTransformations.setTitle("Transformation d'quirectangulaire en faces de cube"); imgTransf = new Image( "file:" + EditeurPanovisu.getStrRepertAppli() + File.separator + "images/equi2cube.png"); } else { stTransformations.setTitle("Transformation de faces de cube en quirectangulaire"); imgTransf = new Image( "file:" + EditeurPanovisu.getStrRepertAppli() + File.separator + "images/cube2equi.png"); } ImageView ivTypeTransfert = new ImageView(imgTransf); ivTypeTransfert.setLayoutX(35); ivTypeTransfert.setLayoutY(280); paneChoixTypeFichier.getChildren().add(ivTypeTransfert); apTransformations.setPrefHeight(EditeurPanovisu.getHauteurE2C()); apTransformations.setPrefWidth(EditeurPanovisu.getLargeurE2C()); paneChoixFichier.setPrefHeight(350); paneChoixFichier.setPrefWidth(410); paneChoixFichier.setStyle("-fx-background-color: #d0d0d0; -fx-border-color: #bbb;"); paneChoixTypeFichier.setPrefHeight(350); paneChoixTypeFichier.setPrefWidth(180); paneChoixTypeFichier.setStyle("-fx-background-color: #d0d0d0; -fx-border-color: #bbb;"); hbChoix.getChildren().addAll(paneChoixFichier, paneChoixTypeFichier); vbFenetre.setPrefHeight(400); vbFenetre.setPrefWidth(600); apTransformations.getChildren().add(vbFenetre); hbChoix.setPrefHeight(350); hbChoix.setPrefWidth(600); hbChoix.setStyle("-fx-background-color: #d0d0d0;"); paneboutons.setPrefHeight(50); paneboutons.setPrefWidth(600); paneboutons.setStyle("-fx-background-color: #d0d0d0;"); vbFenetre.setStyle("-fx-background-color: #d0d0d0;"); btnAnnuler.setLayoutX(296); btnAnnuler.setLayoutY(10); btnValider.setLayoutX(433); btnValider.setLayoutY(10); lvListeFichier.setPrefHeight(290); lvListeFichier.setPrefWidth(380); lvListeFichier.setEditable(true); lvListeFichier.setLayoutX(14); lvListeFichier.setLayoutY(14); btnAjouteFichiers.setLayoutX(259); btnAjouteFichiers.setLayoutY(319); paneChoixFichier.getChildren().addAll(lvListeFichier, btnAjouteFichiers); if (strTypeTransf.equals(EquiCubeDialogController.EQUI2CUBE)) { lblDragDropE2C = new Label(rbLocalisation.getString("transformation.dragDropE2C")); } else { lblDragDropE2C = new Label(rbLocalisation.getString("transformation.dragDropC2E")); } lblDragDropE2C.setMinHeight(lvListeFichier.getPrefHeight()); lblDragDropE2C.setMaxHeight(lvListeFichier.getPrefHeight()); lblDragDropE2C.setMinWidth(lvListeFichier.getPrefWidth()); lblDragDropE2C.setMaxWidth(lvListeFichier.getPrefWidth()); lblDragDropE2C.setLayoutX(14); lblDragDropE2C.setLayoutY(14); lblDragDropE2C.setAlignment(Pos.CENTER); lblDragDropE2C.setTextFill(Color.web("#c9c7c7")); lblDragDropE2C.setTextAlignment(TextAlignment.CENTER); lblDragDropE2C.setWrapText(true); lblDragDropE2C.setStyle("-fx-font-size : 24px"); lblDragDropE2C.setStyle("-fx-background-color : rgba(128,128,128,0.1)"); paneChoixFichier.getChildren().add(lblDragDropE2C); lblType.setLayoutX(14); lblType.setLayoutY(14); rbBmp.setLayoutX(43); rbBmp.setLayoutY(43); rbBmp.setUserData("bmp"); if (EditeurPanovisu.getStrTypeFichierTransf().equals("bmp")) { rbBmp.setSelected(true); } rbBmp.setToggleGroup(tgTypeFichier); rbJpeg.setLayoutX(43); rbJpeg.setLayoutY(71); rbJpeg.setUserData("jpg"); if (EditeurPanovisu.getStrTypeFichierTransf().equals("jpg")) { rbJpeg.setSelected(true); } rbJpeg.setToggleGroup(tgTypeFichier); if (EditeurPanovisu.getStrTypeFichierTransf().equals("tif")) { rbTiff.setSelected(true); } rbTiff.setLayoutX(43); rbTiff.setLayoutY(99); rbTiff.setToggleGroup(tgTypeFichier); rbTiff.setUserData("tif"); tgTypeFichier.selectedToggleProperty().addListener((ov, old_toggle, new_toggle) -> { EditeurPanovisu.setStrTypeFichierTransf(tgTypeFichier.getSelectedToggle().getUserData().toString()); }); cbSharpen.setLayoutX(43); cbSharpen.setLayoutY(127); cbSharpen.selectedProperty().addListener((ov, old_val, new_val) -> { slSharpen.setDisable(!new_val); lblSharpen.setDisable(!new_val); EditeurPanovisu.setbNetteteTransf(new_val); }); slSharpen.setShowTickMarks(true); slSharpen.setShowTickLabels(true); slSharpen.setMajorTickUnit(0.5f); slSharpen.setMinorTickCount(4); slSharpen.setBlockIncrement(0.05f); slSharpen.setSnapToTicks(true); slSharpen.setLayoutX(23); slSharpen.setLayoutY(157); slSharpen.setTooltip(new Tooltip("Choisissez le niveau d'accentuation de l'image")); slSharpen.valueProperty().addListener((observableValue, oldValue, newValue) -> { if (newValue == null) { lblSharpen.setText(""); return; } DecimalFormat dfArrondi = new DecimalFormat(); dfArrondi.setMaximumFractionDigits(2); //arrondi 2 chiffres apres la virgules dfArrondi.setMinimumFractionDigits(2); dfArrondi.setDecimalSeparatorAlwaysShown(true); lblSharpen.setText(dfArrondi.format(Math.round(newValue.floatValue() * 20.f) / 20.f) + ""); EditeurPanovisu.setNiveauNetteteTransf(newValue.doubleValue()); }); slSharpen.setPrefWidth(120); lblSharpen.setLayoutX(150); lblSharpen.setLayoutY(150); lblSharpen.setMinWidth(30); lblSharpen.setMaxWidth(30); lblSharpen.setTextAlignment(TextAlignment.RIGHT); paneChoixTypeFichier.getChildren().addAll(lblType, rbBmp, rbJpeg, rbTiff, cbSharpen, slSharpen, lblSharpen); pbBarreImage.setLayoutX(40); pbBarreImage.setLayoutY(190); pbBarreImage.setStyle("-fx-accent : #0000bb"); pbBarreImage.setVisible(false); paneChoixTypeFichier.getChildren().add(pbBarreImage); pbBarreAvancement = new ProgressBar(); pbBarreAvancement.setLayoutX(40); pbBarreAvancement.setLayoutY(220); pbBarreImage.setStyle("-fx-accent : #00bb00"); paneChoixTypeFichier.getChildren().add(pbBarreAvancement); pbBarreAvancement.setVisible(false); paneboutons.getChildren().addAll(btnAnnuler, btnValider); vbFenetre.getChildren().addAll(hbChoix, paneboutons); Scene scnTransformations = new Scene(apTransformations); stTransformations.setScene(scnTransformations); stTransformations.show(); btnAnnuler.setOnAction((e) -> { annulerE2C(); }); btnValider.setOnAction((e) -> { if (!bTraitementEffectue) { validerE2C(); } }); btnAjouteFichiers.setOnAction((e) -> { lblTermine.setText(""); fileLstFichier = choixFichiers(); if (fileLstFichier != null) { if (bTraitementEffectue) { lvListeFichier.getItems().clear(); bTraitementEffectue = false; } for (File fileLstFichier1 : fileLstFichier) { String strNomFich = fileLstFichier1.getAbsolutePath(); lvListeFichier.getItems().add(strNomFich); } } }); lvListeFichier.setCellFactory(new Callback<ListView<String>, ListCell<String>>() { @Override public ListCell<String> call(ListView<String> list) { return new ListeTransformationCouleur(); } }); apTransformations.setOnDragOver((event) -> { Dragboard dbFichiersTransformation = event.getDragboard(); if (dbFichiersTransformation.hasFiles()) { event.acceptTransferModes(TransferMode.ANY); } else { event.consume(); } }); stTransformations.widthProperty().addListener((arg0, arg1, arg2) -> { EditeurPanovisu.setLargeurE2C(stTransformations.getWidth()); apTransformations.setPrefWidth(stTransformations.getWidth()); vbFenetre.setPrefWidth(stTransformations.getWidth()); btnAnnuler.setLayoutX(stTransformations.getWidth() - 314); btnValider.setLayoutX(stTransformations.getWidth() - 157); paneChoixFichier.setPrefWidth(stTransformations.getWidth() - 200); lvListeFichier.setPrefWidth(stTransformations.getWidth() - 240); lblDragDropE2C.setMinWidth(lvListeFichier.getPrefWidth()); lblDragDropE2C.setMaxWidth(lvListeFichier.getPrefWidth()); btnAjouteFichiers.setLayoutX(stTransformations.getWidth() - 341); }); stTransformations.heightProperty().addListener((arg0, arg1, arg2) -> { EditeurPanovisu.setHauteurE2C(stTransformations.getHeight()); apTransformations.setPrefHeight(stTransformations.getHeight()); vbFenetre.setPrefHeight(stTransformations.getHeight()); paneChoixFichier.setPrefHeight(stTransformations.getHeight() - 80); hbChoix.setPrefHeight(stTransformations.getHeight() - 80); lvListeFichier.setPrefHeight(stTransformations.getHeight() - 140); lblDragDropE2C.setMinHeight(lvListeFichier.getPrefHeight()); lblDragDropE2C.setMaxHeight(lvListeFichier.getPrefHeight()); btnAjouteFichiers.setLayoutY(stTransformations.getHeight() - 121); }); stTransformations.setWidth(EditeurPanovisu.getLargeurE2C()); stTransformations.setHeight(EditeurPanovisu.getHauteurE2C()); apTransformations.setOnDragDropped((event) -> { Dragboard dbFichiersTransformation = event.getDragboard(); boolean bSucces = false; File[] fileLstFich; fileLstFich = null; if (dbFichiersTransformation.hasFiles()) { lblTermine.setText(""); bSucces = true; String[] stringFichiersPath = new String[200]; int i = 0; for (File file1 : dbFichiersTransformation.getFiles()) { stringFichiersPath[i] = file1.getAbsolutePath(); i++; } int iNb = i; i = 0; boolean bAttention = false; File[] fileLstFich1 = new File[stringFichiersPath.length]; for (int j = 0; j < iNb; j++) { String strNomfich = stringFichiersPath[j]; File fileTransf = new File(strNomfich); String strExtension = strNomfich.substring(strNomfich.lastIndexOf(".") + 1, strNomfich.length()) .toLowerCase(); if (strExtension.equals("bmp") || strExtension.equals("jpg") || strExtension.equals("tif")) { if (i == 0) { strRepertFichier = fileTransf.getParent(); } Image img = null; if (strExtension != "tif") { img = new Image("file:" + fileTransf.getAbsolutePath()); } else { try { img = ReadWriteImage.readTiff(strNomfich); } catch (ImageReadException ex) { Logger.getLogger(EquiCubeDialogController.class.getName()).log(Level.SEVERE, null, ex); } catch (IOException ex) { Logger.getLogger(EquiCubeDialogController.class.getName()).log(Level.SEVERE, null, ex); } } if (strTypeTransformation.equals(EquiCubeDialogController.EQUI2CUBE)) { if (img.getWidth() == 2 * img.getHeight()) { fileLstFich1[i] = fileTransf; i++; } else { bAttention = true; } } else { if (img.getWidth() == img.getHeight()) { String strNom = fileTransf.getAbsolutePath().substring(0, fileTransf.getAbsolutePath().length() - 6); boolean bTrouve = false; for (int ik = 0; ik < i; ik++) { String strNom1 = fileLstFich1[ik].getAbsolutePath().substring(0, fileTransf.getAbsolutePath().length() - 6); if (strNom.equals(strNom1)) { bTrouve = true; } } if (!bTrouve) { fileLstFich1[i] = fileTransf; i++; } } else { bAttention = true; } } } } if (bAttention) { Alert alert = new Alert(AlertType.ERROR); alert.setTitle(rbLocalisation.getString("transformation.traiteImages")); alert.setHeaderText(null); alert.setContentText(rbLocalisation.getString("transformation.traiteImagesType")); alert.showAndWait(); } fileLstFichier = new File[i]; System.arraycopy(fileLstFich1, 0, fileLstFichier, 0, i); } if (fileLstFichier != null) { if (bTraitementEffectue) { lvListeFichier.getItems().clear(); bTraitementEffectue = false; } for (File lstFichier1 : fileLstFichier) { String nomFich = lstFichier1.getAbsolutePath(); lvListeFichier.getItems().add(nomFich); } } lblDragDropE2C.setVisible(false); event.setDropCompleted(bSucces); event.consume(); }); }