Example usage for javafx.concurrent Task Task

List of usage examples for javafx.concurrent Task Task

Introduction

In this page you can find the example usage for javafx.concurrent Task Task.

Prototype

public Task() 

Source Link

Document

Creates a new Task.

Usage

From source file:com.bekwam.resignator.ResignatorAppMainViewController.java

@FXML
public void changePassword() {

    Task<Void> task = new Task<Void>() {

        @Override//from   w w  w  . ja v  a 2s .  c  o  m
        protected Void call() throws Exception {

            NewPasswordController npc = newPasswordControllerProvider.get();

            Platform.runLater(() -> {
                try {
                    npc.showAndWait();
                } catch (Exception exc) {
                    logger.error("error showing change password form", exc);
                }
            });

            synchronized (npc) {
                try {
                    npc.wait(MAX_WAIT_TIME); // 10 minutes to enter the password
                } catch (InterruptedException exc) {
                    logger.error("change password operation interrupted", exc);
                }
            }

            if (logger.isDebugEnabled()) {
                logger.debug("[CHANGE PASSWORD] npc={}", npc.getHashedPassword());
            }

            if (StringUtils.isNotEmpty(npc.getHashedPassword())) {

                activeConfiguration.setHashedPassword(npc.getHashedPassword());
                activeConfiguration.setUnhashedPassword(npc.getUnhashedPassword());
                activeConfiguration.setLastUpdatedDateTime(LocalDateTime.now());

                configurationDS.saveConfiguration();

                configurationDS.loadConfiguration();

            } else {

                Platform.runLater(() -> {
                    Alert noPassword = new Alert(Alert.AlertType.INFORMATION, "Password change cancelled.");
                    noPassword.showAndWait();
                });

            }

            return null;
        }
    };
    new Thread(task).start();
}

From source file:ui.main.MainViewController.java

private void addRosterListener() {
    //when roster changes occur, the changes are tracked in here
    contactsManager.getRoster().addRosterListener(new RosterListener() {
        @Override//from w ww . ja  v a 2s  .com
        public void entriesAdded(Collection<String> clctn) {
            java.util.Iterator<String> i = clctn.iterator();

            Task t = new Task() {
                @Override
                protected Object call() throws Exception {
                    return new Object();
                }
            };

            t.setOnSucceeded(value -> {
                showContacts();
                while (i.hasNext()) {
                    String user = i.next();
                    if (contactsManager.getUserType(user).equals(ItemType.from)) {
                        Alert alert = new Alert(Alert.AlertType.INFORMATION);
                        alert.setTitle("Attention!");
                        alert.setHeaderText("Friend Request!");
                        alert.setContentText(
                                "You have a new friend Request from " + user + ". Please check Contacts.");
                        alert.showAndWait();
                    }
                }
            });
            Thread thread1 = new Thread(t);
            thread1.start();
        }

        @Override
        public void entriesUpdated(Collection<String> clctn) {
            Task t = new Task() {
                @Override
                protected Object call() throws Exception {
                    return new Object();
                }
            };

            t.setOnSucceeded(value -> showContacts());
            Thread thread1 = new Thread(t);
            thread1.start();
        }

        @Override
        public void entriesDeleted(Collection<String> clctn) {
            Task t = new Task() {
                @Override
                protected Object call() throws Exception {
                    return new Object();
                }
            };

            t.setOnSucceeded(value -> showContacts());
            Thread thread1 = new Thread(t);
            thread1.start();
        }

        @Override
        public void presenceChanged(Presence prsnc) {
            if (currentChat != null) {
                if (prsnc.getFrom().contains(currentChat.getParticipant())) {
                    Task<String> t = new Task<String>() {
                        @Override
                        protected String call() throws Exception {
                            return prsnc.toString();
                        }
                    };
                    t.setOnSucceeded(value -> chatterPresence.setText(t.getValue()));

                    Thread thread = new Thread(t);
                    thread.start();
                }

            }
            Task t = new Task() {
                @Override
                protected Object call() throws Exception {
                    return new Object();
                }
            };

            t.setOnSucceeded(value -> showContacts());
            Thread thread1 = new Thread(t);
            thread1.start();
        }
    });
}

From source file:ui.main.MainViewController.java

private void paintConversationMessage(Message msg) {
    //this method draws the recievied text message
    Task<HBox> recievedMessages = new Task<HBox>() {
        @Override/*w w  w.ja v a 2s . c  o m*/
        protected HBox call() throws Exception {

            VBox vbox = new VBox(); //to add text
            String user = msg.getFrom();
            user = user.substring(user.indexOf("/") + 1, user.length());
            ImageView imageView = new ImageView(); //image
            imageView.setFitHeight(60);
            imageView.setFitWidth(50);
            VCard vcard = new VCard();
            try {
                vcard.load(ConnectionManager.getConnectionManager().getXMPPConnection(),
                        user.concat(AppData.serviceNameAt));
                if (vcard.getAvatar() != null) {
                    BufferedImage img = ImageIO.read(new ByteArrayInputStream(vcard.getAvatar()));
                    Image image = SwingFXUtils.toFXImage(img, null);
                    imageView.setImage(image);
                } else {
                    Image defaultAvatar = new Image("resources/defaultAvatar.png", 50, 60, true, true);
                    imageView.setImage(defaultAvatar);
                }
            } catch (XMPPException e) {
                Image defaultAvatar = new Image("resources/defaultAvatar.png", 50, 60, true, true);
                imageView.setImage(defaultAvatar);
                System.out.println(e);
            }

            Label chatterName = new Label(user);
            chatterName.setDisable(true);

            //chat message
            BubbledLabel bbl = new BubbledLabel();
            bbl.setText(msg.getBody());
            bbl.setBackground(new Background(new BackgroundFill(Color.GAINSBORO, null, null)));

            vbox.getChildren().addAll(chatterName, bbl);
            vbox.setAlignment(Pos.CENTER_RIGHT);
            HBox hbox = new HBox();
            bbl.setBubbleSpec(BubbleSpec.FACE_LEFT_CENTER);
            hbox.getChildren().addAll(imageView, vbox);
            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);
    }
    Task t1 = new Task() {
        @Override
        protected Object call() throws Exception {
            Thread.sleep(500);
            return new Object();
        }
    };

    t1.setOnSucceeded(value -> scrollPane.setVvalue(scrollPane.getHmax()));

    Thread thread1 = new Thread(t1);
    thread1.start();
}

From source file:ui.main.MainViewController.java

private void addCallListener() {
    //system notifies the incomming calls
    List<JingleMediaManager> mediaManagers1 = new ArrayList<JingleMediaManager>();
    mediaManagers1.add(new JmfMediaManager(new BasicTransportManager()));
    final JingleManager jm1 = new JingleManager(connectionManager.getXMPPConnection(), mediaManagers1);

    jm1.addJingleSessionRequestListener(new JingleSessionRequestListener() {
        @Override//from   w w w.  ja va  2 s  . c  om
        public void sessionRequested(JingleSessionRequest jsr) {
            try {

                System.out.println("Got one");
                JingleSession session = jsr.accept();
                session.startIncoming();

                Task t = new Task() {
                    @Override
                    protected Object call() throws Exception {
                        return new Object();
                    }
                };

                t.setOnSucceeded(value -> {
                    Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
                    alert.setTitle("Incoming Call");
                    alert.setHeaderText("You have an incomming call from " + session.getInitiator());

                    ButtonType buttonTpeYes = new ButtonType("Answer");
                    ButtonType buttonTypeNo = new ButtonType("Reject");
                    ButtonType buttonTypeCancel = new ButtonType("Cancel", ButtonBar.ButtonData.CANCEL_CLOSE);

                    alert.getButtonTypes().setAll(buttonTpeYes, buttonTypeNo, buttonTypeCancel);

                    Optional<ButtonType> result = alert.showAndWait();
                    if (result.get() == buttonTpeYes) {
                        session.startIncoming(); //accept the call and answer the call

                    } else if (result.get() == buttonTypeNo) {
                        try {
                            session.terminate();
                        } catch (XMPPException ex) {
                            Alert alertError = new Alert(Alert.AlertType.ERROR);
                            alertError.setTitle("Error Occured");
                            alertError.setHeaderText("Call failure occured with " + ex.getMessage());
                        }
                    } else {
                        return;
                    }
                });

                Thread thread = new Thread(t);
                thread.start();

                Task t1 = new Task() {
                    @Override
                    protected Object call() throws Exception {
                        return new Object();
                    }
                };

                t1.setOnSucceeded(value -> {
                    Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
                    alert.setTitle("Incoming Call");
                    alert.setHeaderText("Your Call  " + session.getInitiator());

                    ButtonType buttonTypeDisconnect = new ButtonType("Disconnect");

                    alert.getButtonTypes().setAll(buttonTypeDisconnect);

                    Optional<ButtonType> result = alert.showAndWait();
                    try {
                        session.terminate();
                    } catch (XMPPException ex) {
                    }
                });

                if (session.isFullyEstablished()) {
                    Thread thread1 = new Thread(t1);
                    thread.start();
                }
            } catch (XMPPException ex) {
                Logger.getLogger(CallViewController.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    });
}

From source file:snpviewer.SnpViewer.java

public void saveRegion(final String chromosome, final double startCoordinate, final double endCoordinate) {
    final Task<RegionSummary> saveSelectionTask = new Task<RegionSummary>() {
        @Override//  w  ww.  jav a 2  s. c  o m
        protected RegionSummary call() throws Exception {
            try {
                updateProgress(-1, -1);
                updateTitle("Finding flanking SNPs");
                updateMessage("Searching for nearest SNP in all files...");

                /* read SnpFiles to find closest SNPs - use binary search
                 * to find nearby SNP and refine to closest
                 */
                List<SnpFile.SnpLine> startAndEndSnps = searchCoordinate(chromosome, (int) startCoordinate,
                        (int) endCoordinate);
                if (startAndEndSnps == null) {
                    System.out.println("Start and End SNPS ARE NULL!");
                    //DISPLAY ERROR HERE?
                    return null;
                }
                RegionSummary region = new RegionSummary(chromosome, startAndEndSnps.get(0).getPosition(),
                        startAndEndSnps.get(1).getPosition(), 0, 0, startAndEndSnps.get(0).getId(),
                        startAndEndSnps.get(1).getId());
                return region;

            } catch (NumberFormatException ex) {
                Dialogs.showErrorDialog(null,
                        "Can't display flanking SNP IDs"
                                + " - missing required componant!\n\nPlease report this error.",
                        "Error!", "SNP Viewer", ex);
            }
            return null;
        }
    };
    setProgressMode(true);
    progressBar.progressProperty().bind(saveSelectionTask.progressProperty());
    progressMessage.textProperty().unbind();
    progressMessage.textProperty().bind(saveSelectionTask.messageProperty());
    progressTitle.textProperty().unbind();
    progressTitle.textProperty().bind(saveSelectionTask.titleProperty());
    saveSelectionTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            setProgressMode(false);
            RegionSummary result = (RegionSummary) e.getSource().getValue();
            savedRegions.add(result);
            RegionSummary sorter = new RegionSummary();
            sorter.mergeRegionsByPosition(savedRegions);
            saveProject();
            clearDragSelectRectangle();
            savedRegionsDisplay.clear();
            savedRegionsReference.clear();
            drawSavedRegions(
                    (String) chromosomeBoxList[chromosomeSelector.getSelectionModel().getSelectedIndex()]);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressTitle.textProperty().unbind();
            progressMessage.textProperty().unbind();
            progressTitle.setText("");
            progressMessage.setText("");
        }

    });
    saveSelectionTask.setOnFailed(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressTitle.textProperty().unbind();
            progressMessage.textProperty().unbind();
            progressTitle.setText("");
            progressMessage.setText("");
            Dialogs.showErrorDialog(null, "Error finding flanking SNPs\n", "Save Region error", "SNP Viewer",
                    saveSelectionTask.getException());

        }

    });
    saveSelectionTask.setOnCancelled(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            progressMessage.setText("Region write cancelled");
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressTitle.textProperty().unbind();
            progressMessage.textProperty().unbind();
            progressTitle.setText("");
            progressMessage.setText("");
            Dialogs.showErrorDialog(null, "User cancelled region save.", "Save Region", "SNP Viewer",
                    saveSelectionTask.getException());
        }

    });
    cancelButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            saveSelectionTask.cancel();

        }
    });
    new Thread(saveSelectionTask).start();
}

From source file:snpviewer.SnpViewer.java

public void displayFlankingSnpIDs(final String chrom, final double start, final double end) {
    final Task<List<String>> displayTask = new Task<List<String>>() {
        @Override/* w  ww.  j  av a2 s.  c om*/
        protected List<String> call() {
            updateProgress(-1, -1);
            updateTitle("Finding flanking SNPs");
            updateMessage("Searching for nearest SNP in all files...");
            //work out coordinates based on chromosome and pane sizes
            /* read SnpFiles to find closest SNPs - use binary search
            * to find nearby SNP and refine to closest
            */
            List<SnpFile.SnpLine> startAndEndSnps = searchCoordinate(chrom, (int) start, (int) end);
            if (startAndEndSnps == null) {
                //DISPLAY ERROR HERE?
                return null;
            }
            String coordResult = "chr" + chrom + ":" + nf.format(startAndEndSnps.get(0).getPosition()) + "-"
                    + nf.format(startAndEndSnps.get(1).getPosition());
            String idResult = startAndEndSnps.get(0).getId() + ";" + startAndEndSnps.get(1).getId();
            List<String> result = new ArrayList();
            result.add(coordResult);
            result.add(idResult);
            return result;
        }
    };

    setProgressMode(true);
    progressBar.progressProperty().bind(displayTask.progressProperty());
    progressMessage.textProperty().unbind();
    progressMessage.textProperty().bind(displayTask.messageProperty());
    progressTitle.textProperty().unbind();
    progressTitle.textProperty().bind(displayTask.titleProperty());
    displayTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressTitle.textProperty().unbind();
            progressMessage.textProperty().unbind();
            progressTitle.setText("");
            progressMessage.setText("");
        }

    });
    displayTask.setOnFailed(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressTitle.textProperty().unbind();
            progressMessage.textProperty().unbind();
            progressTitle.setText("");
            progressMessage.setText("");
            Dialogs.showErrorDialog(null, "Error displaying flanking SNPs\n", "Display error", "SNP Viewer",
                    displayTask.getException());

        }

    });
    displayTask.setOnCancelled(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            progressMessage.setText("Display flanking SNPs cancelled");
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressTitle.textProperty().unbind();
            progressMessage.textProperty().unbind();
            progressTitle.setText("");
            progressMessage.setText("");
            Dialogs.showErrorDialog(null, "User cancelled display.", "Display error", "SNP Viewer",
                    displayTask.getException());
        }

    });
    cancelButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            displayTask.cancel();

        }
    });
    new Thread(displayTask).start();
    try {
        List<String> result = displayTask.get();
        FXMLLoader loader = new FXMLLoader(getClass().getResource("RegionReporter.fxml"));
        Stage stage = new Stage();
        Pane page = (Pane) loader.load();
        Scene scene = new Scene(page);
        stage.setScene(scene);
        stage.setTitle("SNP Viewer Region Summary");
        stage.getIcons().add(new Image(this.getClass().getResourceAsStream("icon.png")));
        RegionReporterController regionReporter = loader.<RegionReporterController>getController();
        if (result == null) {
            regionReporter.setCoordinates("Error!");
            regionReporter.setIds("Error!");
        } else {
            regionReporter.setCoordinates(result.get(0));
            regionReporter.setIds(result.get(1));
        }
        scene.getStylesheets().add(SnpViewer.class.getResource("SnpViewerStyleSheet.css").toExternalForm());
        stage.setResizable(false);
        stage.initModality(Modality.NONE);

        stage.show();
    } catch (InterruptedException | ExecutionException | IOException ex) {
        Dialogs.showErrorDialog(null,
                "Can't display flanking SNP IDs" + " - exception caught!\n\nPlease report this error.",
                "Error!", "SNP Viewer", ex);
    }

}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param listFichiers liste des fichiers  charger
 * @param iNb nombre de fichiers  charger
 * @return Task/*from   ww w.  j av  a 2s.co m*/
 */
public static Task tskChargeListeFichiers(final File[] listFichiers, int iNb) {
    return new Task() {
        @Override
        protected Object call() throws Exception {
            int i = 0;
            File[] fileLstFich1 = new File[listFichiers.length];
            String[] strTypeFich1 = new String[listFichiers.length];
            for (int jj = 0; jj < iNb; jj++) {
                File fileFichier = listFichiers[jj];
                String strNomfich = fileFichier.getAbsolutePath();
                String strExtension = strNomfich.substring(strNomfich.lastIndexOf(".") + 1, strNomfich.length())
                        .toLowerCase();
                if (strExtension.equals("jpg") || strExtension.equals("bmp") || strExtension.equals("tif")) {
                    Image imgPano = null;
                    if (strExtension.equals("tif")) {
                        try {
                            imgPano = ReadWriteImage.readTiff(fileFichier.getAbsolutePath());

                        } catch (ImageReadException | IOException ex) {
                            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
                        }
                    } else {
                        imgPano = new Image("file:" + fileFichier.getAbsolutePath());
                    }
                    strTypeFich1[i] = "";
                    if (imgPano != null) {
                        if (imgPano.getWidth() == 2 * imgPano.getHeight()) {
                            fileLstFich1[i] = fileFichier;
                            strTypeFich1[i] = Panoramique.SPHERE;
                            i++;
                        }
                        if (imgPano.getWidth() == imgPano.getHeight()) {
                            String strNom = fileFichier.getAbsolutePath().substring(0,
                                    fileFichier.getAbsolutePath().length() - 6);
                            boolean bTrouveFichier = false;
                            for (int j = 0; j < i; j++) {
                                String strNom1 = "";
                                if (fileLstFich1[j].getAbsolutePath().length() == fileFichier.getAbsolutePath()
                                        .length()) {
                                    strNom1 = fileLstFich1[j].getAbsolutePath().substring(0,
                                            fileFichier.getAbsolutePath().length() - 6);
                                }
                                if (strNom.equals(strNom1)) {
                                    bTrouveFichier = true;
                                }
                            }
                            if (!bTrouveFichier) {
                                fileLstFich1[i] = fileFichier;
                                strTypeFich1[i] = Panoramique.CUBE;
                                i++;
                            }
                        }
                    }

                }
            }
            File[] fileLstFich = new File[i];
            System.arraycopy(fileLstFich1, 0, fileLstFich, 0, i);

            for (int ii = 0; ii < fileLstFich.length; ii++) {
                File fileFichier1 = fileLstFich[ii];
                int iNumP = ii + 1;
                Platform.runLater(() -> {
                    lblCharge.setText(
                            "pano " + iNumP + "/" + fileLstFich.length + " : " + fileFichier1.getPath());
                    lblNiveaux.setText("");
                    pbarAvanceChargement.setProgress((double) (iNumP - 1) / (double) fileLstFich.length);
                });

                setbDejaSauve(false);
                mniSauveProjet.setDisable(false);
                setStrCurrentDir(fileFichier1.getParent());
                File fileImageRepert = new File(getStrRepertTemp() + File.separator + "panos");

                if (!fileImageRepert.exists()) {

                    fileImageRepert.mkdirs();
                }
                setStrRepertPanos(fileImageRepert.getAbsolutePath());
                ajoutePanoramiqueProjet(fileFichier1.getPath(), strTypeFich1[ii], iNumP, fileLstFich.length);
            }
            return true;
        }

        @Override
        protected void succeeded() {
            getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
            super.succeeded();
            cbListeChoixPanoramique.getItems().clear();
            apVignettesPano.getChildren().clear();
            for (int i = 0; i < getiNombrePanoramiques(); i++) {
                String strFichierPano = getPanoramiquesProjet()[i].getStrNomFichier();
                String strNomPano = strFichierPano.substring(strFichierPano.lastIndexOf(File.separator) + 1,
                        strFichierPano.length());
                cbListeChoixPanoramique.getItems().add(strNomPano);
                String strExtension = getPanoramiquesProjet()[i].getStrNomFichier().substring(
                        getPanoramiquesProjet()[i].getStrNomFichier().length() - 3,
                        getPanoramiquesProjet()[i].getStrNomFichier().length());
                ImageView ivVignettePano = new ImageView(
                        getPanoramiquesProjet()[i].getImgVignettePanoramique());
                ivVignettePano.setPreserveRatio(true);
                ivVignettePano.setFitWidth(iLargeurVignettes);
                ivVignettePano.setLayoutX(5);
                ivVignettePano.setLayoutY((iLargeurVignettes / 2 + 10) * i + 10);
                ivVignettePano.setCursor(Cursor.HAND);
                int iNumero = i;
                ivVignettePano.setOnMouseClicked((e) -> {
                    affichePanoChoisit(iNumero);
                });
                ivVignettePano.setOnMouseDragEntered((e) -> {
                    ivVignettePano.setLayoutX(3);
                    ivVignettePano.setStyle("-fx-border-color : #fff;" + "-fx-border-width : 2px;"
                            + "-fx-border-style :solid;");
                });
                ivVignettePano.setOnMouseDragExited((e) -> {
                    ivVignettePano.setLayoutX(5);
                    ivVignettePano.setStyle("-fx-border-color : rgba(0,0,0,0);" + "-fx-border-width : 0px;"
                            + "-fx-border-style :none;");
                });

                apVignettesPano.getChildren().add(ivVignettePano);

            }
            apVignettesPano.getChildren().add(rectVignettePano);
            getVbChoixPanoramique().setVisible(true);
            ivImagePanoramique.setImage(getPanoramiquesProjet()[getiPanoActuel()].getImgPanoramique());
            ivImagePanoramique.setSmooth(true);
            retireAffichageLigne();
            dejaCharge = false;
            retireAffichageHotSpots();
            retireAffichagePointsHotSpots();
            setiNumPoints(0);
            ajouteAffichageLignes();
            cbListeChoixPanoramique.setValue(cbListeChoixPanoramique.getItems().get(getiPanoActuel()));
            affichePoV(getPanoramiquesProjet()[getiPanoActuel()].getRegardX(),
                    getPanoramiquesProjet()[getiPanoActuel()].getRegardY(),
                    getPanoramiquesProjet()[getiPanoActuel()].getChampVisuel());
            afficheNord(getPanoramiquesProjet()[getiPanoActuel()].getZeroNord());
            installeEvenements();
            ivVisiteGenere.setOpacity(1.0);
            ivVisiteGenere.setDisable(false);
            getGestionnaireInterface().rafraichit();
            affichePanoChoisit(getiPanoActuel());
            bPanoCharge = true;
            cbListeChoixPanoramique.setValue(cbListeChoixPanoramique.getItems().get(getiPanoActuel()));
            getApAttends().setVisible(false);
            mbarPrincipal.setDisable(false);
            bbarPrincipal.setDisable(false);
            hbBarreBouton.setDisable(false);
            tpEnvironnement.setDisable(false);

            ordPano.ajouteNouveauxPanos();
            apListePanoTriable = ordPano.getApListePanoramiques();
            apListePanoTriable.setMaxHeight(apListePanoTriable.getPrefHeight());
            apListePanoTriable.setMinHeight(apListePanoTriable.getPrefHeight());
            apListePanoTriable.setVisible(true);
            apParametresVisite.getChildren().remove(apListePanoTriable);
            apParametresVisite.getChildren().add(apListePanoTriable);
            apListePanoTriable.setLayoutX(40);
            apListePanoTriable.setLayoutY(130);
            apParametresVisite.setPrefHeight(120 + apListePanoTriable.getPrefHeight() + 20);
            if (apParametresVisite.isVisible()) {
                apParametresVisite.setMinHeight(120 + apListePanoTriable.getPrefHeight() + 20);
                apParametresVisite.setMaxHeight(120 + apListePanoTriable.getPrefHeight() + 20);
            }
            rafraichitListePano();

        }

    };
}

From source file:snpviewer.SnpViewer.java

public void writeSavedRegionsToFile() {
    if (savedRegions.size() < 1) {
        Dialogs.showErrorDialog(null, "No Saved Regions exist to write!", "No Saved Regions", "SnpViewer");
        return;//from www  . j  a  va2s.  co m
    }
    final int flanks = 10;
    FileChooser fileChooser = new FileChooser();
    FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("Excel (*.xlsx)", "*.xlsx");
    fileChooser.getExtensionFilters().add(extFilter);
    fileChooser.setTitle("Write regions to Excel file (.xlsx)...");
    File rFile = fileChooser.showSaveDialog(mainWindow);
    if (rFile == null) {
        return;
    } else if (!rFile.getName().endsWith(".xlsx")) {
        rFile = new File(rFile.getAbsolutePath() + ".xlsx");
    }
    final File regionFile = rFile;
    final Task<Boolean> writeTask = new Task() {
        @Override
        protected Boolean call() throws Exception {
            try {
                updateProgress(-1, -1);
                BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(regionFile));
                Workbook wb = new XSSFWorkbook();
                //first create a summary sheet of all regions
                Sheet sheet = wb.createSheet();
                Row row = null;
                int rowNo = 0;
                int sheetNo = 0;
                wb.setSheetName(sheetNo++, "Summary");
                row = sheet.createRow(rowNo++);
                String header[] = { "Coordinates", "rsIDs", "Size (Mb)" };
                for (int col = 0; col < header.length; col++) {
                    Cell cell = row.createCell(col);
                    cell.setCellValue(header[col]);
                }
                for (int i = 0; i < savedRegions.size(); i++) {
                    row = sheet.createRow(rowNo++);
                    int col = 0;
                    Cell cell = row.createCell(col++);
                    cell.setCellValue("chr" + savedRegions.get(i).getCoordinateString());
                    cell = row.createCell(col++);
                    cell.setCellValue(savedRegions.get(i).getIdLine());
                    cell = row.createCell(col++);
                    double mB = (double) savedRegions.get(i).getLength() / 1000000;
                    cell.setCellValue(mB);
                }

                ArrayList<SnpFile> bothFiles = new ArrayList<>();
                bothFiles.addAll(affFiles);
                bothFiles.addAll(unFiles);
                String prevChrom = new String();
                double prog = 0;
                double total = savedRegions.size() * bothFiles.size() * 2;
                updateProgress(prog, total);
                int regCounter = 0;
                for (RegionSummary reg : savedRegions) {
                    updateMessage("Writing region " + ++regCounter + " of " + savedRegions.size());
                    //create a sheet for each chromosome
                    if (!reg.getChromosome().equalsIgnoreCase(prevChrom)) {
                        if (!prevChrom.isEmpty()) {

                            CellRangeAddress[] regions = {
                                    new CellRangeAddress(0, rowNo, 2, 2 + bothFiles.size()) };
                            SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();

                            ConditionalFormattingRule rule1 = sheetCF
                                    .createConditionalFormattingRule(ComparisonOperator.EQUAL, "\"AA\"");
                            PatternFormatting fill1 = rule1.createPatternFormatting();
                            fill1.setFillBackgroundColor(IndexedColors.LIGHT_GREEN.index);
                            fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
                            ConditionalFormattingRule rule2 = sheetCF
                                    .createConditionalFormattingRule(ComparisonOperator.EQUAL, "\"BB\"");
                            PatternFormatting fill2 = rule2.createPatternFormatting();
                            fill2.setFillBackgroundColor(IndexedColors.PALE_BLUE.index);
                            fill2.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
                            ConditionalFormattingRule rule3 = sheetCF
                                    .createConditionalFormattingRule(ComparisonOperator.EQUAL, "\"AB\"");
                            PatternFormatting fill3 = rule3.createPatternFormatting();
                            fill3.setFillBackgroundColor(IndexedColors.ROSE.index);
                            fill3.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
                            sheetCF.addConditionalFormatting(regions, rule3, rule2);
                            sheetCF.addConditionalFormatting(regions, rule1);
                        }
                        rowNo = 0;
                        sheet = wb.createSheet();
                        wb.setSheetName(sheetNo++, reg.getChromosome());
                        prevChrom = reg.getChromosome();

                    } else {//pad regions with an empty line
                        rowNo++;
                    }
                    TreeMap<Integer, HashMap<String, String>> coordMap = new TreeMap();
                    /*coordmap - key is position, key of hashmap 
                     * is input filename and value call
                     */
                    HashMap<Integer, String> coordToId = new HashMap<>();
                    //coordinate to rs ID

                    try {
                        for (SnpFile f : bothFiles) {
                            updateProgress(prog++, total);
                            if (isCancelled()) {
                                return false;
                            }
                            List<SnpFile.SnpLine> lines = f.getSnpsInRegion(reg.getChromosome(),
                                    reg.getStartPos(), reg.getEndPos(), flanks);
                            for (SnpFile.SnpLine snpLine : lines) {
                                if (isCancelled()) {
                                    return false;
                                }
                                Integer coord = snpLine.getPosition();
                                if (!coordMap.containsKey(coord)) {
                                    coordMap.put(coord, new HashMap<String, String>());
                                }
                                String filename = f.inputFile.getName();
                                String rsId = snpLine.getId();
                                String call = snpLine.getCall();
                                coordMap.get(coord).put(filename, call);
                                coordToId.put(coord, rsId);
                            }
                        }
                        row = sheet.createRow(rowNo++);
                        Cell cell = row.createCell(0);
                        cell.setCellValue(reg.getCoordinateString());
                        row = sheet.createRow(rowNo++);
                        cell = row.createCell(0);
                        cell.setCellValue(reg.getIdLine());

                        int col = 0;
                        row = sheet.createRow(rowNo++);
                        cell = row.createCell(col++);
                        cell.setCellValue("Position");
                        cell = row.createCell(col++);
                        cell.setCellValue("rsID");
                        for (SnpFile f : bothFiles) {
                            updateProgress(prog++, total);
                            cell = row.createCell(col++);
                            if (f.getSampleName() != null && !f.getSampleName().isEmpty()) {
                                cell.setCellValue(f.getSampleName());
                            } else {
                                cell.setCellValue(f.inputFile.getName());
                            }
                        }
                        for (Entry current : coordMap.entrySet()) {
                            if (isCancelled()) {
                                return false;
                            }
                            col = 0;
                            Integer coord = (Integer) current.getKey();
                            row = sheet.createRow(rowNo++);
                            cell = row.createCell(col++);
                            cell.setCellValue(coord);
                            cell = row.createCell(col++);
                            cell.setCellValue(coordToId.get(coord));
                            HashMap<String, String> fileToCall = (HashMap<String, String>) current.getValue();
                            for (SnpFile f : bothFiles) {
                                cell = row.createCell(col++);
                                if (fileToCall.containsKey(f.inputFile.getName())) {
                                    cell.setCellValue(fileToCall.get(f.inputFile.getName()));
                                } else {
                                    cell.setCellValue("-");
                                }
                            }
                        }
                    } catch (Exception ex) {
                        return false;
                    }

                }
                CellRangeAddress[] regions = { new CellRangeAddress(0, rowNo, 2, 2 + bothFiles.size()) };
                SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();

                ConditionalFormattingRule rule1 = sheetCF
                        .createConditionalFormattingRule(ComparisonOperator.EQUAL, "\"AA\"");
                PatternFormatting fill1 = rule1.createPatternFormatting();
                fill1.setFillBackgroundColor(IndexedColors.LIGHT_GREEN.index);
                fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
                ConditionalFormattingRule rule2 = sheetCF
                        .createConditionalFormattingRule(ComparisonOperator.EQUAL, "\"BB\"");
                PatternFormatting fill2 = rule2.createPatternFormatting();
                fill2.setFillBackgroundColor(IndexedColors.PALE_BLUE.index);
                fill2.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
                ConditionalFormattingRule rule3 = sheetCF
                        .createConditionalFormattingRule(ComparisonOperator.EQUAL, "\"AB\"");
                PatternFormatting fill3 = rule3.createPatternFormatting();
                fill3.setFillBackgroundColor(IndexedColors.ROSE.index);
                fill3.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
                sheetCF.addConditionalFormatting(regions, rule3, rule2);
                sheetCF.addConditionalFormatting(regions, rule1);
                wb.write(out);
                updateProgress(total, total);
                out.close();
            } catch (IOException | NumberFormatException ex) {
                ex.printStackTrace();
                return false;
            }
            return true;
        }
    };//end of task

    setProgressMode(true);
    progressBar.progressProperty().bind(writeTask.progressProperty());
    progressMessage.textProperty().bind(writeTask.messageProperty());
    writeTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            if (e.getSource().getValue() == true) {
                Dialogs.showInformationDialog(null,
                        "Saved regions written " + "to file " + "(" + regionFile.getName() + ")successfully",
                        "Regions Written", "SNP Viewer");
            } else {
                Dialogs.showErrorDialog(null, "Region write failed.", "Write Failed", "SNP Viewer");
            }
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressMessage.textProperty().unbind();
            progressMessage.setText("");
            progressTitle.setText("");

        }

    });
    writeTask.setOnFailed(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressMessage.textProperty().unbind();
            progressMessage.setText("");
            progressTitle.setText("Region write failed!");
            Dialogs.showErrorDialog(null, "Error writing region to file\n", "Region write error", "SNP Viewer",
                    e.getSource().getException());

        }

    });
    writeTask.setOnCancelled(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            progressMessage.setText("Region write cancelled");
            progressTitle.setText("Cancelled");
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            Dialogs.showErrorDialog(null, "Error writing region to file\n", "Region write error", "SNP Viewer");
        }

    });
    cancelButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            writeTask.cancel();

        }
    });
    progressTitle.setText("Writing regions to .xlsx file");
    new Thread(writeTask).start();
}

From source file:snpviewer.SnpViewer.java

public void writeRegionToFile(final String chromosome, final double start, final double end) {
    /* get coordinates of selection and report back
     * write SNPs in region to file/*from w  ww .jav a2s  .c  o m*/
     */
    FileChooser fileChooser = new FileChooser();
    FileChooser.ExtensionFilter extFilter = new FileChooser.ExtensionFilter("Excel  (*.xlsx)", "*.xlsx");
    fileChooser.getExtensionFilters().add(extFilter);
    fileChooser.setTitle("Write region to Excel file (.xlsx)...");
    File rFile = fileChooser.showSaveDialog(mainWindow);
    if (rFile == null) {
        return;
    } else if (!rFile.getName().endsWith(".xlsx")) {
        rFile = new File(rFile.getAbsolutePath() + ".xlsx");
    }
    final File regionFile = rFile;
    final Task<Boolean> writeTask = new Task() {
        @Override
        protected Boolean call() throws Exception {
            try {

                updateProgress(-1, -1);
                ArrayList<SnpFile> bothFiles = new ArrayList<>();
                bothFiles.addAll(affFiles);
                bothFiles.addAll(unFiles);
                TreeMap<Integer, HashMap<String, String>> coordMap = new TreeMap();
                /*coordmap - key is position, key of hashmap 
                 * is input filename and value call
                 */
                HashMap<Integer, String> coordToId = new HashMap<>();
                double progress = 0;
                double total = bothFiles.size() * 5;
                try {
                    BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(regionFile));
                    Workbook wb = new XSSFWorkbook();
                    Sheet sheet = wb.createSheet();
                    int rowNo = 0;
                    Row row = sheet.createRow(rowNo++);
                    for (SnpFile f : bothFiles) {
                        if (isCancelled()) {
                            return false;
                        }
                        updateProgress(++progress, total);
                        updateMessage("Reading region in " + f.inputFile.getName());
                        List<SnpFile.SnpLine> lines = f.getSnpsInRegion(chromosome, (int) start, (int) end);
                        for (SnpFile.SnpLine snpLine : lines) {
                            if (isCancelled()) {
                                return false;
                            }
                            Integer coord = snpLine.getPosition();
                            if (!coordMap.containsKey(coord)) {
                                coordMap.put(coord, new HashMap<String, String>());
                            }
                            String filename = f.inputFile.getName();
                            String rsId = snpLine.getId();
                            String call = snpLine.getCall();
                            coordMap.get(coord).put(filename, call);
                            coordToId.put(coord, rsId);
                        }
                    }
                    Cell cell = row.createCell(0);
                    cell.setCellValue(
                            "chr" + chromosome + ":" + coordMap.firstKey() + "-" + coordMap.lastKey());
                    row = sheet.createRow(rowNo++);
                    cell = row.createCell(0);
                    cell.setCellValue(
                            coordToId.get(coordMap.firstKey()) + ";" + coordToId.get(coordMap.lastKey()));
                    row = sheet.createRow(rowNo++);
                    int colNo = 0;
                    cell = row.createCell(colNo++);
                    cell.setCellValue("Position");
                    cell = row.createCell(colNo++);
                    cell.setCellValue("rsID");
                    for (SnpFile f : bothFiles) {
                        cell = row.createCell(colNo++);
                        if (f.getSampleName() != null && f.getSampleName().length() > 0) {
                            cell.setCellValue(f.getSampleName());
                        } else {
                            cell.setCellValue(f.getInputFileName());
                        }
                    }
                    progress = coordMap.size();
                    total = 5 * coordMap.size();
                    updateMessage("Writing region to file...");
                    for (Entry current : coordMap.entrySet()) {
                        if (isCancelled()) {
                            return false;
                        }
                        progress += 4;
                        updateProgress(progress, total);
                        row = sheet.createRow(rowNo++);
                        colNo = 0;
                        Integer coord = (Integer) current.getKey();
                        cell = row.createCell(colNo++);
                        cell.setCellValue(coord);
                        String rsId = coordToId.get(coord);
                        cell = row.createCell(colNo++);
                        cell.setCellValue(rsId);
                        HashMap<String, String> fileToCall = (HashMap<String, String>) current.getValue();
                        for (SnpFile f : bothFiles) {
                            cell = row.createCell(colNo++);
                            if (fileToCall.containsKey(f.inputFile.getName())) {
                                cell.setCellValue(fileToCall.get(f.inputFile.getName()));
                            } else {
                                cell.setCellValue("-");
                            }
                        }
                    }
                    CellRangeAddress[] regions = { new CellRangeAddress(0, rowNo, 2, 2 + bothFiles.size()) };
                    SheetConditionalFormatting sheetCF = sheet.getSheetConditionalFormatting();

                    ConditionalFormattingRule rule1 = sheetCF
                            .createConditionalFormattingRule(ComparisonOperator.EQUAL, "\"AA\"");
                    PatternFormatting fill1 = rule1.createPatternFormatting();
                    fill1.setFillBackgroundColor(IndexedColors.LIGHT_GREEN.index);
                    fill1.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
                    ConditionalFormattingRule rule2 = sheetCF
                            .createConditionalFormattingRule(ComparisonOperator.EQUAL, "\"BB\"");
                    PatternFormatting fill2 = rule2.createPatternFormatting();
                    fill2.setFillBackgroundColor(IndexedColors.PALE_BLUE.index);
                    fill2.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
                    ConditionalFormattingRule rule3 = sheetCF
                            .createConditionalFormattingRule(ComparisonOperator.EQUAL, "\"AB\"");
                    PatternFormatting fill3 = rule3.createPatternFormatting();
                    fill3.setFillBackgroundColor(IndexedColors.ROSE.index);
                    fill3.setFillPattern(PatternFormatting.SOLID_FOREGROUND);
                    sheetCF.addConditionalFormatting(regions, rule3, rule2);
                    sheetCF.addConditionalFormatting(regions, rule1);
                    wb.write(out);
                    out.close();
                    return true;
                } catch (IOException ex) {
                    return false;
                }
            } catch (Exception ex) {
                return false;
            }
        }
    };//end of task

    setProgressMode(true);
    progressBar.progressProperty().bind(writeTask.progressProperty());
    progressMessage.textProperty().bind(writeTask.messageProperty());
    writeTask.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            if (e.getSource().getValue() == true) {
                Dialogs.showInformationDialog(null,
                        "Region written to file " + "(" + regionFile.getName() + ") successfully",
                        "Region Written", "SNP Viewer");
            } else {
                Dialogs.showErrorDialog(null, "Region write failed.", "Write Failed", "SNP Viewer");
            }
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressMessage.textProperty().unbind();
            progressMessage.setText("");
            progressTitle.setText("");

        }

    });
    writeTask.setOnFailed(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            progressMessage.textProperty().unbind();
            progressMessage.setText("");
            progressTitle.setText("Region write failed!");
            Dialogs.showErrorDialog(null, "Error writing region to file\n", "Region write error", "SNP Viewer",
                    e.getSource().getException());

        }

    });
    writeTask.setOnCancelled(new EventHandler<WorkerStateEvent>() {
        @Override
        public void handle(WorkerStateEvent e) {
            progressMessage.setText("Region write cancelled");
            progressTitle.setText("Cancelled");
            setProgressMode(false);
            progressBar.progressProperty().unbind();
            progressBar.progressProperty().set(0);
            Dialogs.showErrorDialog(null, "Error writing region to file\n", "Region write error", "SNP Viewer");
        }

    });
    cancelButton.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent actionEvent) {
            writeTask.cancel();

        }
    });
    progressTitle.setText("Writing region to .xlsx file");
    new Thread(writeTask).start();
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param strLigComplete/*from   ww  w.  j  a v  a  2s  .co m*/
 * @return
 */
public static Task tskAnalyseFichierPVU(final String strLigComplete) {
    return new Task() {
        @Override
        protected Object call() throws Exception {

            strPanoEntree = "";
            strOrdrePanos = "";
            setiNombrePanoramiques(0);
            String strLigneComplete = strLigComplete.replace("[", "|");
            String strLignes[] = strLigneComplete.split("\\|", 500);
            String strLigne;
            String[] strElementsLigne;
            String[] strTypeElement;
            int iNbHS = 0;
            int iNbImg = 0;
            int iNbHTML = 0;
            int iNbHSDiapo = 0;
            int iNbHsplan = 0;
            int iNbImages = 0;
            setiNombrePlans(-1);
            for (int ikk = 1; ikk < strLignes.length; ikk++) {
                strLigne = strLignes[ikk];
                strElementsLigne = strLigne.split(";", 25);
                strTypeElement = strElementsLigne[0].split(">", 2);
                strTypeElement[0] = strTypeElement[0].replace(" ", "").replace("=", "").replace("[", "");
                strElementsLigne[0] = strTypeElement[1];
                if ("Panoramique".equals(strTypeElement[0])) {
                    for (int i = 0; i < strElementsLigne.length; i++) {
                        strElementsLigne[i] = strElementsLigne[i].replace("]", "").replace("\n", "");
                        String[] strValeur = strElementsLigne[i].split(":", 2);
                        if (strValeur.length == 1) {
                            strValeur[1] = "";
                        }
                        switch (strValeur[0]) {
                        case "fichier":
                            String nmFich = strDecodeFichier(strValeur[1]);
                            File fileImgPano = new File(nmFich);
                            if (!fileImgPano.exists()) {
                                fileImgPano = new File(getStrRepertAppli() + File.separator + "images"
                                        + File.separator + "pasImage.jpg");
                            }
                            int iNumPano = getiNombrePanoramiques() + 1;
                            Platform.runLater(() -> {
                                lblCharge.setText("pano " + iNumPano + "/" + getiNombrePanoramiquesFichier()
                                        + " : " + nmFich);
                                lblNiveaux.setText("");
                                pbarAvanceChargement.setProgress(
                                        (double) (iNumPano - 1) / (double) getiNombrePanoramiquesFichier());
                            });
                            File fileImageRepert = new File(getStrRepertTemp() + File.separator + "panos");

                            if (!fileImageRepert.exists()) {
                                fileImageRepert.mkdirs();
                            }
                            setStrRepertPanos(fileImageRepert.getAbsolutePath());
                            String strFichierPano = fileImgPano.getPath();
                            String strExtension = strFichierPano.substring(strFichierPano.length() - 3,
                                    strFichierPano.length());
                            Image imgPano = null;
                            if ("tif".equals(strExtension)) {
                                try {
                                    imgPano = ReadWriteImage.readTiff(strFichierPano);

                                } catch (IOException ex) {
                                    Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null,
                                            ex);
                                }
                            } else {
                                imgPano = new Image("file:" + strFichierPano);
                            }
                            if (imgPano != null) {
                                if (imgPano.getWidth() == imgPano.getHeight()) {
                                    ajoutePanoramiqueProjet(nmFich, Panoramique.CUBE, iNumPano,
                                            getiNombrePanoramiquesFichier());

                                } else {
                                    ajoutePanoramiqueProjet(nmFich, Panoramique.SPHERE, iNumPano,
                                            getiNombrePanoramiquesFichier());
                                }
                            }
                            break;

                        case "titre":
                            if (!strValeur[1].equals("null")) {
                                getPanoramiquesProjet()[getiPanoActuel()].setStrTitrePanoramique(strValeur[1]);
                            } else {
                                getPanoramiquesProjet()[getiPanoActuel()].setStrTitrePanoramique("");
                            }
                            break;
                        case "type":
                            getPanoramiquesProjet()[getiPanoActuel()].setStrTypePanoramique(strValeur[1]);
                            break;
                        case "afficheInfo":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setAfficheInfo(strValeur[1].equals("true"));
                            break;
                        case "afficheTitre":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setAfficheTitre(strValeur[1].equals("true"));
                            break;
                        case "nb":
                            iNbHS = Integer.parseInt(strValeur[1]);
                            break;
                        case "nbImg":
                            iNbImg = Integer.parseInt(strValeur[1]);
                            break;
                        case "nbHTML":
                            iNbHTML = Integer.parseInt(strValeur[1]);
                            break;
                        case "nbDiapo":
                            iNbHSDiapo = Integer.parseInt(strValeur[1]);
                            break;
                        case "regardX":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setRegardX(Double.parseDouble(strValeur[1]));
                            break;
                        case "regardY":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setRegardY(Double.parseDouble(strValeur[1]));
                            break;
                        case "minLat":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setMinLat(Double.parseDouble(strValeur[1]));
                            break;
                        case "maxLat":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setMaxLat(Double.parseDouble(strValeur[1]));
                            break;
                        case "bMinLat":
                            getPanoramiquesProjet()[getiPanoActuel()].setbMinLat(strValeur[1].equals("true"));
                            break;
                        case "bMaxLat":
                            getPanoramiquesProjet()[getiPanoActuel()].setbMaxLat(strValeur[1].equals("true"));
                            break;
                        case "fov":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setChampVisuel(Double.parseDouble(strValeur[1]) / 2.0);
                            break;
                        case "minfov":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setFovMin(Double.parseDouble(strValeur[1]));
                            break;
                        case "maxfov":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setFovMax(Double.parseDouble(strValeur[1]));
                            break;
                        case "zeroNord":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setZeroNord(Double.parseDouble(strValeur[1]));
                            break;
                        case "numeroPlan":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setNumeroPlan(Integer.parseInt(strValeur[1].replace(" ", "")));
                            break;
                        case "longitudeGeo":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setMarqueurGeolocatisation(new CoordonneesGeographiques());
                            getPanoramiquesProjet()[getiPanoActuel()].getMarqueurGeolocatisation()
                                    .setLongitude(Double.parseDouble(strValeur[1]));
                            break;
                        case "latitudeGeo":
                            getPanoramiquesProjet()[getiPanoActuel()].getMarqueurGeolocatisation()
                                    .setLatitude(Double.parseDouble(strValeur[1]));
                            break;

                        case "affichePlan":
                            getPanoramiquesProjet()[getiPanoActuel()]
                                    .setAffichePlan(strValeur[1].equals("true"));
                            break;
                        default:
                            break;
                        }
                    }
                    for (int jj = 0; jj < iNbHS; jj++) {
                        ikk++;
                        strLigne = strLignes[ikk];
                        strElementsLigne = strLigne.split(";", 10);
                        strTypeElement = strElementsLigne[0].split(">", 2);
                        strTypeElement[0] = strTypeElement[0].replace(" ", "").replace("=", "").replace("[",
                                "");
                        strElementsLigne[0] = strTypeElement[1];
                        HotSpot HS = new HotSpot();
                        for (int i = 0; i < strElementsLigne.length; i++) {
                            strElementsLigne[i] = strElementsLigne[i].replace("]", "");
                            String[] strValeur = strElementsLigne[i].split(":", 2);

                            switch (strValeur[0]) {
                            case "longitude":
                                HS.setLongitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "latitude":
                                HS.setLatitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "regardX":
                                HS.setRegardX(Double.parseDouble(strValeur[1]));
                                break;
                            case "regardY":
                                HS.setRegardY(Double.parseDouble(strValeur[1]));
                                break;
                            case "champVisuel":
                                HS.setChampVisuel(Double.parseDouble(strValeur[1]) / 2.0);
                                break;
                            case "image":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrFichierImage(null);
                                } else {
                                    HS.setStrFichierImage(strValeur[1]);
                                }
                                break;
                            case "info":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrInfo(null);
                                } else {
                                    HS.setStrInfo(strValeur[1].replace("&pv", ";").replace("&dp", ":")
                                            .replace("&ds", "#"));
                                }
                                break;
                            case "xml":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrFichierXML(null);
                                } else {
                                    HS.setStrFichierXML(strValeur[1]);
                                }
                                break;
                            case "numXML":
                                HS.setNumeroPano(Integer.parseInt(strValeur[1]));
                                break;
                            case "anime":
                                HS.setAnime(strValeur[1].equals("true"));
                                break;
                            }
                        }
                        getPanoramiquesProjet()[getiPanoActuel()].addHotspot(HS);
                    }

                    for (int jj = 0; jj < iNbImg; jj++) {
                        ikk++;
                        strLigne = strLignes[ikk];
                        strElementsLigne = strLigne.split(";", 10);
                        strTypeElement = strElementsLigne[0].split(">", 2);
                        strTypeElement[0] = strTypeElement[0].replace(" ", "").replace("=", "").replace("[",
                                "");
                        strElementsLigne[0] = strTypeElement[1];
                        HotspotImage HS = new HotspotImage();
                        for (int i = 0; i < strElementsLigne.length; i++) {
                            strElementsLigne[i] = strElementsLigne[i].replace("]", "");
                            String[] strValeur = strElementsLigne[i].split(":", 2);
                            switch (strValeur[0]) {
                            case "longitude":
                                HS.setLongitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "latitude":
                                HS.setLatitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "image":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrFichierImage(null);
                                } else {
                                    HS.setStrFichierImage(strValeur[1]);
                                }
                                break;
                            case "couleur":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrCouleurFond("");
                                } else {
                                    HS.setStrCouleurFond(strValeur[1]);
                                }
                                break;
                            case "opacite":
                                if ("null".equals(strValeur[1])) {
                                    HS.setOpacite(-1);
                                } else {
                                    HS.setOpacite(Double.parseDouble(strValeur[1]));
                                }
                                break;
                            case "info":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrInfo(null);
                                } else {
                                    HS.setStrInfo(strValeur[1].replace("&pv", ";").replace("&dp", ":")
                                            .replace("&ds", "#"));
                                }
                                break;
                            case "img":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrLienImg(null);
                                } else {
                                    HS.setStrLienImg(strValeur[1]);
                                }
                                break;
                            case "urlImg":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrUrlImage(null);
                                } else {
                                    HS.setStrUrlImage(strValeur[1]);
                                }
                                String nmFich = strValeur[1];
                                File imgPano = new File(nmFich);
                                File imageRepert = new File(getStrRepertTemp() + File.separator + "images");
                                if (!imageRepert.exists()) {
                                    imageRepert.mkdirs();
                                }
                                setStrRepertPanos(imageRepert.getAbsolutePath());
                                try {
                                    if (imgPano.exists()) {
                                        copieFichierRepertoire(imgPano.getPath(), getStrRepertPanos());
                                    } else {
                                        String strExtension = imgPano.getPath()
                                                .substring(imgPano.getPath().lastIndexOf(".") + 1);
                                        String nomFichier = getStrRepertAppli() + File.separator + "images"
                                                + File.separator + "imagePasTrouvee." + strExtension;
                                        copieFichierRepertoire(nomFichier, getStrRepertPanos());
                                        String strFich = imgPano.getPath()
                                                .substring(imgPano.getPath().lastIndexOf(File.separator));
                                        File fFichier = new File(getStrRepertTemp() + File.separator + "images"
                                                + File.separator + "imagePasTrouvee." + strExtension);
                                        File fNouvFichier = new File(getStrRepertTemp() + File.separator
                                                + "images" + File.separator + strFich);
                                        fFichier.renameTo(fNouvFichier);
                                    }
                                } catch (IOException ex) {
                                    Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null,
                                            ex);
                                }

                                break;
                            case "anime":
                                HS.setAnime(strValeur[1].equals("true"));
                                break;
                            }
                        }
                        getPanoramiquesProjet()[getiPanoActuel()].addHotspotImage(HS);
                    }
                    for (int jj = 0; jj < iNbHSDiapo; jj++) {
                        ikk++;
                        strLigne = strLignes[ikk];
                        strElementsLigne = strLigne.split(";", 10);
                        strTypeElement = strElementsLigne[0].split(">", 2);
                        strTypeElement[0] = strTypeElement[0].replace(" ", "").replace("=", "").replace("[",
                                "");
                        strElementsLigne[0] = strTypeElement[1];
                        HotspotDiaporama HS = new HotspotDiaporama();
                        for (int i = 0; i < strElementsLigne.length; i++) {
                            strElementsLigne[i] = strElementsLigne[i].replace("]", "");
                            String[] strValeur = strElementsLigne[i].split(":", 2);
                            switch (strValeur[0]) {
                            case "longitude":
                                HS.setLongitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "latitude":
                                HS.setLatitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "info":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrInfo(null);
                                } else {
                                    HS.setStrInfo(strValeur[1].replace("&pv", ";").replace("&dp", ":")
                                            .replace("&ds", "#"));
                                }
                                break;
                            case "numDiapo":
                                HS.setiNumDiapo(Integer.parseInt(strValeur[1]));
                                break;
                            case "anime":
                                HS.setbAnime(strValeur[1].equals("true"));
                                break;
                            }
                        }
                        getPanoramiquesProjet()[getiPanoActuel()].addHotspotDiapo(HS);
                    }

                    for (int jj = 0; jj < iNbHTML; jj++) {
                        ikk++;
                        strLigne = strLignes[ikk];
                        strElementsLigne = strLigne.split(";", 10);
                        strTypeElement = strElementsLigne[0].split(">", 2);
                        strTypeElement[0] = strTypeElement[0].replace(" ", "").replace("=", "").replace("[",
                                "");
                        strElementsLigne[0] = strTypeElement[1];
                        HotspotHTML HS = new HotspotHTML();
                        for (int i = 0; i < strElementsLigne.length; i++) {
                            strElementsLigne[i] = strElementsLigne[i].replace("]", "");
                            String[] strValeur = strElementsLigne[i].split(":", 2);
                            switch (strValeur[0]) {
                            case "longitude":
                                HS.setLongitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "latitude":
                                HS.setLatitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "lienExterieur":
                                HS.setbLienExterieur(strValeur[1].equals("true"));
                                break;
                            case "url":
                                HS.setStrURLExterieure(strValeur[1]);
                                break;

                            case "info":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrInfo(null);
                                } else {
                                    HS.setStrInfo(strValeur[1].replace("&pv", ";").replace("&dp", ":")
                                            .replace("&ds", "#"));
                                }
                                break;
                            case "anime":
                                HS.setAnime(strValeur[1].equals("true"));
                                break;
                            case "position":
                                HS.setStrPositionHTML(strValeur[1]);
                                break;
                            case "couleur":
                                HS.setStrCouleurHTML(strValeur[1]);
                                break;
                            case "opacite":
                                HS.setOpaciteHTML(Double.parseDouble(strValeur[1]));
                                break;
                            case "largeur":
                                HS.setLargeurHTML(Double.parseDouble(strValeur[1]));
                                break;

                            }
                        }
                        getPanoramiquesProjet()[getiPanoActuel()].addHotspotHTML(HS);
                    }

                }
                if ("Diaporama".equals(strTypeElement[0])) {
                    diaporamas[getiNombreDiapo()] = new Diaporama();
                    for (int i = 0; i < strElementsLigne.length; i++) {
                        strElementsLigne[i] = strElementsLigne[i].replace("]", "").replace("\n", "");
                        String[] strValeur = strElementsLigne[i].split(":", 2);
                        if (strValeur.length == 1) {
                            strValeur[1] = "";
                        }
                        switch (strValeur[0]) {
                        case "nom":
                            diaporamas[getiNombreDiapo()].setStrNomDiaporama(strValeur[1]);
                            break;
                        case "fichier":
                            if (!strValeur[1].equals("null")) {
                                diaporamas[getiNombreDiapo()].setStrFichierDiaporama(strValeur[1]);
                            } else {
                                diaporamas[getiNombreDiapo()].setStrFichierDiaporama("");
                            }
                            break;
                        case "nbImages":
                            iNbImages = Integer.parseInt(strValeur[1]);
                            break;
                        case "opacite":
                            diaporamas[getiNombreDiapo()].setOpaciteDiaporama(Double.parseDouble(strValeur[1]));
                            break;
                        case "delai":
                            diaporamas[getiNombreDiapo()].setDelaiDiaporama(Double.parseDouble(strValeur[1]));
                            break;
                        case "coul":
                            diaporamas[getiNombreDiapo()].setStrCouleurFondDiaporama(
                                    suprimeEspaceFin(strValeur[1].replace("\n", "")));
                            break;
                        default:
                            break;
                        }
                    }
                    for (int jj = 0; jj < iNbImages; jj++) {
                        ikk++;
                        strLigne = strLignes[ikk];
                        strElementsLigne = strLigne.split(";", 10);
                        strTypeElement = strElementsLigne[0].split(">", 2);
                        strTypeElement[0] = strTypeElement[0].replace(" ", "").replace("=", "").replace("[",
                                "");
                        strElementsLigne[0] = strTypeElement[1];
                        for (int i = 0; i < strElementsLigne.length; i++) {
                            strElementsLigne[i] = strElementsLigne[i].replace("]", "");
                            String[] strValeur = strElementsLigne[i].split(":", 2);
                            if (strValeur.length == 1) {
                                strValeur[1] = "";
                            }
                            switch (strValeur[0]) {
                            case "fichierImage":
                                diaporamas[getiNombreDiapo()].setStrFichiersImage(strValeur[1], jj);
                                break;
                            case "fichiers":
                                diaporamas[getiNombreDiapo()].setStrFichiers(strValeur[1], jj);
                                break;
                            case "libelles":
                                diaporamas[getiNombreDiapo()].setStrLibellesImages(
                                        suprimeEspaceFin(strValeur[1].replace("\n", "")).replace("\n", ""), jj);
                                break;
                            }
                        }
                        diaporamas[getiNombreDiapo()].setiNombreImages(jj + 1);
                    }
                    setiNombreDiapo(getiNombreDiapo() + 1);
                }

                if ("Plan".equals(strTypeElement[0])) {
                    for (int i = 0; i < strElementsLigne.length; i++) {
                        strElementsLigne[i] = strElementsLigne[i].replace("]", "");
                        String[] strValeur = strElementsLigne[i].split(":", 2);
                        switch (strValeur[0]) {
                        case "lienImage":
                            setiNombrePlans(getiNombrePlans() + 1);
                            getPlans()[getiNombrePlans()] = new Plan();
                            getPlans()[getiNombrePlans()].setStrLienPlan(strValeur[1]);
                            File fileRepertoirePlan = new File(getStrRepertTemp() + File.separator + "images");
                            if (!fileRepertoirePlan.exists()) {
                                fileRepertoirePlan.mkdirs();
                            }
                            try {
                                copieFichierRepertoire(getPlans()[getiNombrePlans()].getStrLienPlan(),
                                        fileRepertoirePlan.getAbsolutePath());

                            } catch (IOException ex) {
                                Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
                            }

                            break;
                        case "image":
                            getPlans()[getiNombrePlans()].setStrImagePlan(strValeur[1]);
                            break;
                        case "titre":
                            if (!strValeur[1].equals("'null'")) {
                                getPlans()[getiNombrePlans()].setTitrePlan(strValeur[1]);
                            } else {
                                getPlans()[getiNombrePlans()].setTitrePlan("");
                            }
                            break;
                        case "nb":
                            iNbHsplan = Integer.parseInt(strValeur[1]);
                            break;
                        case "position":
                            getPlans()[getiNombrePlans()].setStrPosition(strValeur[1]);
                            break;
                        case "positionX":
                            getPlans()[getiNombrePlans()].setPositionX(Double.parseDouble(strValeur[1]));
                            break;
                        case "positionY":
                            getPlans()[getiNombrePlans()].setPositionY(Double.parseDouble(strValeur[1]));
                            break;
                        case "directionNord":
                            getPlans()[getiNombrePlans()].setDirectionNord(Double.parseDouble(strValeur[1]));
                            break;
                        default:
                            break;
                        }
                    }
                    for (int jj = 0; jj < iNbHsplan; jj++) {
                        ikk++;
                        strLigne = strLignes[ikk];
                        strElementsLigne = strLigne.split(";", 15);
                        strTypeElement = strElementsLigne[0].split(">", 2);
                        strTypeElement[0] = strTypeElement[0].replace(" ", "").replace("=", "").replace("[",
                                "");
                        strElementsLigne[0] = strTypeElement[1];
                        HotSpot HS = new HotSpot();
                        for (int i = 0; i < strElementsLigne.length; i++) {
                            strElementsLigne[i] = strElementsLigne[i].replace("]", "");
                            String[] strValeur = strElementsLigne[i].split(":", 2);
                            switch (strValeur[0]) {
                            case "longitude":
                                HS.setLongitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "latitude":
                                HS.setLatitude(Double.parseDouble(strValeur[1]));
                                break;
                            case "image":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrFichierImage(null);
                                } else {
                                    HS.setStrFichierImage(strValeur[1]);
                                }
                                break;
                            case "info":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrInfo(null);
                                } else {
                                    HS.setStrInfo(strValeur[1]);
                                }
                                break;
                            case "xml":
                                if ("null".equals(strValeur[1])) {
                                    HS.setStrFichierXML(null);
                                } else {
                                    HS.setStrFichierXML(strValeur[1]);
                                }
                                break;
                            case "numeroPano":
                                HS.setNumeroPano(
                                        Integer.parseInt(strValeur[1].replace("\n", "").replace(" ", "")));
                                break;
                            case "anime":
                                HS.setAnime(strValeur[1].equals("true"));
                                break;
                            }
                        }
                        getPlans()[getiNombrePlans()].addHotspot(HS);
                    }
                }
                if ("Interface".equals(strTypeElement[0])) {
                    String[] strElts = strElementsLigne[0].replace("]", "").split("\n");
                    List<String> strListTemplate = new ArrayList<>();
                    for (String strTexte : strElts) {
                        if (!strTexte.equals("")) {
                            strListTemplate.add(strTexte);
                        }
                    }
                    getGestionnaireInterface().setTemplate(strListTemplate);
                }
                if ("PanoEntree".equals(strTypeElement[0])) {
                    strPanoEntree = strElementsLigne[0].split("]")[0];
                }
                if ("introLP".equals(strTypeElement[0])) {
                    setbIntroPetitePlanete(strElementsLigne[0].split("]")[0].equals("true"));
                }
                if ("arDemarre".equals(strTypeElement[0])) {
                    setbAutoRotationDemarre(strElementsLigne[0].split("]")[0].equals("true"));
                }
                if ("arVitesse".equals(strTypeElement[0])) {
                    setiAutoRotationVitesse(Integer.parseInt(strElementsLigne[0].split("]")[0]));
                }
                if ("atDemarre".equals(strTypeElement[0])) {
                    setbAutoTourDemarre(strElementsLigne[0].split("]")[0].equals("true"));
                }
                if ("atVitesse".equals(strTypeElement[0])) {
                    setiAutoTourLimite(Integer.parseInt(strElementsLigne[0].split("]")[0]));
                }
                if ("atDemarrage".equals(strTypeElement[0])) {
                    setiAutoTourDemarrage(Integer.parseInt(strElementsLigne[0].split("]")[0]));
                }
                if ("atType".equals(strTypeElement[0])) {
                    setStrAutoTourType(strElementsLigne[0].split("]")[0]);
                }
                if ("OrdrePanos".equals(strTypeElement[0])) {
                    strOrdrePanos = strElementsLigne[0].split("]")[0];
                }
                if ("titreVisite".equals(strTypeElement[0])) {
                    strTitreVisite = strElementsLigne[0].split("]")[0];
                }
                if ("pageHTML".equals(strTypeElement[0])) {
                    String[] strLignesCommande = strElementsLigne[0].split("]")[0].split("\n");
                    int inPano = 0;
                    int inHSHTML = 0;
                    int inImage = 0;
                    for (String strLigneCommande : strLignesCommande) {
                        String strCommande = strLigneCommande.split(":", 2)[0];
                        String strVal = strLigneCommande.split(":", 2)[1].replace("&nl", "\n")
                                .replace("&pv", ";").replace("&dp", ":");
                        switch (strCommande) {
                        case "numPano":
                            inPano = Integer.parseInt(strVal);
                            break;
                        case "numHSHTML":
                            inHSHTML = Integer.parseInt(strVal);
                            break;
                        case "texteHTML":
                            getPanoramiquesProjet()[inPano].getHotspotHTML(inHSHTML).setStrTexteHTML(strVal);
                            break;
                        case "imagePath":
                            ImageEditeurHTML imageEdit = new ImageEditeurHTML();
                            imageEdit.setStrImagePath(strVal);
                            panoramiquesProjet[inPano].getHotspotHTML(inHSHTML)
                                    .getImagesEditeur()[inImage] = imageEdit;
                            inImage++;
                            getPanoramiquesProjet()[inPano].getHotspotHTML(inHSHTML).setiNombreImages(inImage);
                            break;

                        }
                    }
                }

            }
            for (int i = 0; i < getiNombreDiapo(); i++) {
            }
            return true;
        }

        @Override

        protected void succeeded() {
            super.succeeded();

            getVbChoixPanoramique().setVisible(true);
            setiNombrePlans(getiNombrePlans() + 1);
            if (getiNombrePlans() != 0) {
                int iNbPlans1 = getiNombrePlans();
                for (int i = 0; i < iNbPlans1; i++) {
                    setiNombrePlans(i);
                    getGestionnairePlan().ajouterPlan();
                }
                setiNombrePlans(getiNombrePlans() + 1);
            }
            for (int i = 0; i < getiNombrePanoramiques(); i++) {
                for (int j = 0; j < getPanoramiquesProjet()[i].getNombreHotspots(); j++) {
                    if (getPanoramiquesProjet()[i].getHotspot(j).getNumeroPano() != -1) {
                        String strFichPano = getPanoramiquesProjet()[getPanoramiquesProjet()[i].getHotspot(j)
                                .getNumeroPano()].getStrNomFichier();
                        strFichPano = strFichPano
                                .substring(strFichPano.lastIndexOf(File.separator) + 1, strFichPano.length())
                                .split("\\.")[0] + ".xml";
                        getPanoramiquesProjet()[i].getHotspot(j).setStrFichierXML(strFichPano);
                    } else {
                        String strNomFichier = getPanoramiquesProjet()[i].getHotspot(j).getStrFichierXML()
                                .split("\\.")[0];
                        for (int k = 0; k < getiNombrePanoramiques(); k++) {
                            String strFichPano = getPanoramiquesProjet()[k].getStrNomFichier();
                            strFichPano = strFichPano.substring(strFichPano.lastIndexOf(File.separator) + 1,
                                    strFichPano.length()).split("\\.")[0];
                            if (strFichPano.equals(strNomFichier)) {
                                getPanoramiquesProjet()[i].getHotspot(j).setNumeroPano(k);
                            }
                        }
                    }
                }
            }
            for (int i = 0; i < getiNombreDiapo(); i++) {
                try {
                    creeDiaporamaHTML(diaporamas[i], i);
                } catch (IOException ex) {
                    Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
                }

            }
            try {
                getGestionnaireInterface().afficheTemplate();
                setbDejaSauve(true);

            } catch (IOException ex) {
                Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
            }
            if (apListePanoTriable != null) {
                apParametresVisite.getChildren().remove(apListePanoTriable);
            }
            if (strOrdrePanos.equals((""))) {
                ordPano.creeListe();
            } else {
                ordPano.creeListe(strOrdrePanos);
            }
            apListePanoTriable = ordPano.getApListePanoramiques();
            apListePanoTriable.setLayoutX(40);
            apListePanoTriable.setLayoutY(130);
            apListePanoTriable.setVisible(true);
            apParametresVisite.setPrefHeight(120 + apListePanoTriable.getPrefHeight() + 20);
            apParametresVisite.getChildren().add(apListePanoTriable);
            if (apParametresVisite.isVisible()) {
                apParametresVisite.setMinHeight(120 + apListePanoTriable.getPrefHeight() + 20);
                apParametresVisite.setMaxHeight(120 + apListePanoTriable.getPrefHeight() + 20);
            }
            getGestionnaireInterface().rafraichit();
            setiPanoActuel(Integer.parseInt(ordPano.getStrPanos().get(0)));
            rafraichitListePano();
            affichePanoChoisit(getiPanoActuel());
            bPanoCharge = true;
            getVbChoixPanoramique().setVisible(true);
            cbListeChoixPanoramique.setValue(cbListeChoixPanoramique.getItems().get(0));
            TextField tfVisite = (TextField) getVbChoixPanoramique().lookup("#titreVisite");
            tfVisite.setText(strTitreVisite);
            getApAttends().setVisible(false);
            mbarPrincipal.setDisable(false);
            bbarPrincipal.setDisable(false);
            hbBarreBouton.setDisable(false);
            tpEnvironnement.setDisable(false);
            cbIntroPetitePlanete.setSelected(isbIntroPetitePlanete());
            cbAutoRotationDemarrage.setSelected(isbAutoRotationDemarre());
            bdfAutoRotationVitesse.setNumber(new BigDecimal(getiAutoRotationVitesse()));
            switch (getiAutoRotationVitesse()) {
            case 10:
                cbAutoRotationVitesse.getSelectionModel().select(0);
                break;
            case 20:
                cbAutoRotationVitesse.getSelectionModel().select(1);
                break;
            case 30:
                cbAutoRotationVitesse.getSelectionModel().select(2);
                break;
            default:
                cbAutoRotationVitesse.getSelectionModel().select(3);
                break;
            }
            cbAutoTourDemarrage.setSelected(isbAutoTourDemarre());
            bdfAutoTourLimite.setNumber(new BigDecimal(getiAutoTourLimite()));
            bdfAutoTourDemarrage.setNumber(new BigDecimal(getiAutoTourDemarrage()));
            switch (getStrAutoTourType()) {
            case "tours":
                cbAutoTourType.getSelectionModel().select(0);
                break;
            case "secondes":
                cbAutoTourType.getSelectionModel().select(1);
                break;
            }
            rafraichitListePano();
            creeVignettesHS();
        }

    };
}