Example usage for javafx.scene.control TextField setText

List of usage examples for javafx.scene.control TextField setText

Introduction

In this page you can find the example usage for javafx.scene.control TextField setText.

Prototype

public final void setText(String value) 

Source Link

Usage

From source file:com.chart.SwingChart.java

/**
 * Series edition// www.  j a  v a2s  .c o m
 * @param series Series to edit
 */
void editSeries(final Series series) {
    String[] style = series.getStyle().split(";");
    String strColor = "black";
    final TextField editWidth = new TextField();

    String tempS = "null";
    for (String e : style) {
        if (e.contains("color: ")) {
            strColor = e.replace("color: ", "");
        } else if (e.contains("width: ")) {
            editWidth.setText(e.replace("width: ", ""));
        } else if (e.contains("shape: ")) {
            tempS = e.replace("shape: ", "");
        }
    }
    final String symbol = tempS;

    final List<SeriesShape> symbolList = new ArrayList<>();
    final ObservableList<SeriesShape> symbolListModel;
    final ListView<SeriesShape> comboSymbol = new ListView();
    symbolList.add(new SeriesShape("null", javafx.scene.paint.Color.web(strColor)));
    symbolList.add(new SeriesShape("rectangle", javafx.scene.paint.Color.web(strColor)));
    symbolList.add(new SeriesShape("circle", javafx.scene.paint.Color.web(strColor)));
    symbolList.add(new SeriesShape("triangle", javafx.scene.paint.Color.web(strColor)));
    symbolList.add(new SeriesShape("crux", javafx.scene.paint.Color.web(strColor)));
    symbolList.add(new SeriesShape("diamond", javafx.scene.paint.Color.web(strColor)));
    symbolList.add(new SeriesShape("empty rectangle", javafx.scene.paint.Color.web(strColor)));
    symbolList.add(new SeriesShape("empty circle", javafx.scene.paint.Color.web(strColor)));
    symbolList.add(new SeriesShape("empty triangle", javafx.scene.paint.Color.web(strColor)));
    symbolList.add(new SeriesShape("empty diamond", javafx.scene.paint.Color.web(strColor)));

    symbolListModel = FXCollections.observableList(symbolList);
    comboSymbol.setItems(symbolListModel);
    comboSymbol.setCellFactory(new Callback<ListView<SeriesShape>, ListCell<SeriesShape>>() {
        @Override
        public ListCell<SeriesShape> call(ListView<SeriesShape> p) {
            ListCell<SeriesShape> cell = new ListCell<SeriesShape>() {
                @Override
                protected void updateItem(SeriesShape t, boolean bln) {
                    super.updateItem(t, bln);
                    if (t != null) {
                        setText("");
                        setGraphic(t.getShapeGraphic());
                    }
                }
            };

            return cell;
        }
    });
    for (SeriesShape smb : symbolListModel) {
        if (smb.getName().equals(symbol)) {
            comboSymbol.getSelectionModel().select(smb);
        }
    }

    final ColorPicker colorPicker = new ColorPicker(javafx.scene.paint.Color.web(strColor));

    colorPicker.setOnAction((ActionEvent t) -> {
        String sc = colorPicker.getValue().toString();
        symbolListModel.clear();
        symbolListModel.add(new SeriesShape("null", javafx.scene.paint.Color.web(sc)));
        symbolListModel.add(new SeriesShape("rectangle", javafx.scene.paint.Color.web(sc)));
        symbolListModel.add(new SeriesShape("circle", javafx.scene.paint.Color.web(sc)));
        symbolListModel.add(new SeriesShape("triangle", javafx.scene.paint.Color.web(sc)));
        symbolListModel.add(new SeriesShape("crux", javafx.scene.paint.Color.web(sc)));
        symbolListModel.add(new SeriesShape("diamond", javafx.scene.paint.Color.web(sc)));
        symbolListModel.add(new SeriesShape("empty rectangle", javafx.scene.paint.Color.web(sc)));
        symbolListModel.add(new SeriesShape("empty circle", javafx.scene.paint.Color.web(sc)));
        symbolListModel.add(new SeriesShape("empty triangle", javafx.scene.paint.Color.web(sc)));
        symbolListModel.add(new SeriesShape("empty diamond", javafx.scene.paint.Color.web(sc)));

        comboSymbol.setItems(symbolListModel);
        for (SeriesShape smb : symbolListModel) {
            if (smb.getName().equals(symbol)) {
                comboSymbol.getSelectionModel().select(smb);
            }
        }
    });

    GridPane grid = new GridPane();

    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(0, 10, 0, 10));

    grid.add(new Label("Series"), 0, 0);
    grid.add(new Label(series.getKey().toString()), 1, 0);
    grid.add(new Label("Color"), 0, 1);
    grid.add(colorPicker, 1, 1);
    grid.add(new Label("Width"), 0, 2);
    grid.add(editWidth, 1, 2);
    grid.add(new Label("Shape"), 0, 3);
    grid.add(comboSymbol, 1, 3);

    new PseudoModalDialog(skeleton, grid, true) {
        @Override
        public boolean validation() {
            String strColor = colorPicker.getValue().toString();
            String strWidth = editWidth.getText();
            double dWidth = Double.valueOf(strWidth);
            String strSimbolo = "null";
            SeriesShape simb = new SeriesShape(comboSymbol.getSelectionModel().getSelectedItem().toString(),
                    javafx.scene.paint.Color.web(strColor));

            XYItemRenderer renderer = (XYItemRenderer) plot.getRenderer(series.getAxisIndex());

            renderer.setSeriesPaint(series.getSeriesIndex(), scene2awtColor(colorPicker.getValue()));

            try {
                if (Double.valueOf(strWidth) > 0) {
                    ((XYLineAndShapeRenderer) renderer).setSeriesLinesVisible(series.getSeriesIndex(), true);
                    renderer.setSeriesStroke(series.getSeriesIndex(),
                            new BasicStroke(Integer.valueOf(strWidth)));
                } else {
                    ((XYLineAndShapeRenderer) renderer).setSeriesLinesVisible(series.getSeriesIndex(), false);
                }
            } catch (NumberFormatException ex) {

            }

            if (simb.getName().contains("null")) {
                ((XYLineAndShapeRenderer) renderer).setSeriesShapesVisible(series.getSeriesIndex(), false);
                renderer.setSeriesShape(series.getSeriesIndex(), null);
            } else {
                ((XYLineAndShapeRenderer) renderer).setSeriesShapesVisible(series.getSeriesIndex(), true);
                renderer.setSeriesShape(series.getSeriesIndex(), simb.getShapeAWT());
                if (simb.getName().contains("empty")) {
                    ((XYLineAndShapeRenderer) renderer).setSeriesShapesFilled(series.getSeriesIndex(), false);
                } else {
                    ((XYLineAndShapeRenderer) renderer).setSeriesShapesFilled(series.getSeriesIndex(), true);
                }

            }

            series.setStyle(
                    "color: " + strColor + ";width: " + editWidth.getText() + ";shape: " + strSimbolo + ";");

            for (Node le : legendFrame.getChildren()) {
                if (le instanceof LegendAxis) {
                    for (Node nn : ((LegendAxis) le).getChildren()) {
                        if (nn instanceof Label) {
                            if (((Label) nn).getText().equals(series.getKey().toString())) {
                                ((Label) nn).setGraphic(simb.getShapeGraphic());
                            }
                        }
                    }
                }
            }
            return true;
        }
    }.show();

}

From source file:com.chart.SwingChart.java

/**
 * Set lower and upper limits for an ordinate
 * @param axis Axis to configure/*from   w  ww. java  2  s  . com*/
 */
void setOrdinateRange(final NumberAxis axis) {
    axis.setAutoRange(false);
    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(0, 10, 0, 10));
    final TextField tfMax;
    final TextField tfMin;
    final TextField tfTick;
    final TextField tfFuente;
    grid.add(new Label("Axis"), 0, 0);
    grid.add(new Label(axis.getLabel()), 1, 0);
    grid.add(new Label("Lower"), 0, 1);
    grid.add(tfMin = new TextField(), 1, 1);
    grid.add(new Label("Upper"), 0, 2);
    grid.add(tfMax = new TextField(), 1, 2);
    grid.add(new Label("Space"), 0, 3);
    grid.add(tfTick = new TextField(), 1, 3);

    tfMin.setText(String.valueOf(axis.getLowerBound()));
    tfMax.setText(String.valueOf(axis.getUpperBound()));
    tfTick.setText(String.valueOf(axis.getTickUnit().getSize()));

    new PseudoModalDialog(skeleton, grid, true) {
        @Override
        public boolean validation() {
            axis.setLowerBound(Double.valueOf(tfMin.getText()));
            axis.setUpperBound(Double.valueOf(tfMax.getText()));
            axis.setTickUnit(new NumberTickUnit(Double.valueOf(tfTick.getText())));
            return true;
        }
    }.show();

}

From source file:com.chart.SwingChart.java

/**
 * Background edition/* w  w w .j  a  v  a2 s. c  om*/
 */
final public void backgroundEdition() {
    final ColorPicker colorPickerChartBackground = new ColorPicker(
            javafx.scene.paint.Color.web(strChartBackgroundColor));
    colorPickerChartBackground.setMaxWidth(Double.MAX_VALUE);
    final ColorPicker colorPickerGridline = new ColorPicker(javafx.scene.paint.Color.web(strGridlineColor));
    colorPickerGridline.setMaxWidth(Double.MAX_VALUE);
    final ColorPicker colorPickerBackground = new ColorPicker(javafx.scene.paint.Color.web(strBackgroundColor));
    colorPickerBackground.setMaxWidth(Double.MAX_VALUE);
    final ColorPicker colorPickerTick = new ColorPicker(javafx.scene.paint.Color.web(strTickColor));
    colorPickerTick.setMaxWidth(Double.MAX_VALUE);
    final TextField tfFontSize = new TextField();
    tfFontSize.setMaxWidth(Double.MAX_VALUE);

    GridPane grid = new GridPane();
    grid.setHgap(10);
    grid.setVgap(10);
    grid.setPadding(new Insets(0, 10, 0, 10));

    grid.add(new Label("Background color"), 0, 0);
    grid.add(colorPickerChartBackground, 1, 0);
    grid.add(new Label("Gridline color"), 0, 1);
    grid.add(colorPickerGridline, 1, 1);
    grid.add(new Label("Frame color"), 0, 2);
    grid.add(colorPickerBackground, 1, 2);
    grid.add(new Label("Tick color"), 0, 3);
    grid.add(colorPickerTick, 1, 3);
    grid.add(new Label("Font size"), 0, 4);
    grid.add(tfFontSize, 1, 4);
    tfFontSize.setText(String.valueOf(fontSize));

    new PseudoModalDialog(skeleton, grid, true) {

        @Override
        public boolean validation() {
            fontSize = Float.valueOf(tfFontSize.getText().replace(",", "."));
            strBackgroundColor = colorPickerBackground.getValue().toString().replace("0x", "#");
            for (Node le : legendFrame.getChildren()) {
                if (le instanceof LegendAxis) {
                    le.setStyle("-fx-background-color:" + strBackgroundColor);
                    ((LegendAxis) le).selected = false;
                }
            }
            chart.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));
            chartPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4),
                    BorderFactory.createLineBorder(
                            scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)))));
            chartPanel.setBackground(scene2awtColor(javafx.scene.paint.Color.web(strBackgroundColor)));

            legendFrame.setStyle("marco: " + colorPickerBackground.getValue().toString().replace("0x", "#")
                    + ";-fx-background-color: marco;");

            strChartBackgroundColor = colorPickerChartBackground.getValue().toString().replace("0x", "#");
            plot.setBackgroundPaint(scene2awtColor(javafx.scene.paint.Color.web(strChartBackgroundColor)));

            for (Node le : legendFrame.getChildren()) {
                if (le instanceof LegendAxis) {
                    le.setStyle("-fx-background-color:" + strBackgroundColor);
                    ((LegendAxis) le).selected = false;
                    for (Node nn : ((LegendAxis) le).getChildren()) {
                        if (nn instanceof Label) {
                            ((Label) nn).setStyle("fondo: "
                                    + colorPickerChartBackground.getValue().toString().replace("0x", "#")
                                    + ";-fx-background-color: fondo;-fx-text-fill: ladder(fondo, white 49%, black 50%);-fx-padding:5px;-fx-background-radius: 5;-fx-font-size: "
                                    + String.valueOf(fontSize) + "px");
                        }
                    }
                }
            }

            strGridlineColor = colorPickerGridline.getValue().toString().replace("0x", "#");
            plot.setDomainGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));
            plot.setRangeGridlinePaint(scene2awtColor(javafx.scene.paint.Color.web(strGridlineColor)));

            strTickColor = colorPickerTick.getValue().toString().replace("0x", "#");
            abcissaAxis.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
            abcissaAxis.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
            abcissaAxis.setLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize));
            abcissaAxis.setTickLabelFont(abcissaAxis.getLabelFont().deriveFont(fontSize));

            for (NumberAxis ejeOrdenada : AxesList) {
                ejeOrdenada.setLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
                ejeOrdenada.setTickLabelPaint(scene2awtColor(javafx.scene.paint.Color.web(strTickColor)));
                ejeOrdenada.setLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize));
                ejeOrdenada.setTickLabelFont(ejeOrdenada.getLabelFont().deriveFont(fontSize));
            }
            return true;
        }
    }.show();

}

From source file:de.bayern.gdi.gui.Controller.java

private void loadWfsSimple() {
    ObservableList<Node> children = simpleWFSContainer.getChildren();
    Map<String, String> parameters = downloadConfig.getParams();
    for (Node node : children) {
        if (node instanceof HBox) {
            HBox hb = (HBox) node;//from  ww  w.ja  va  2  s  . co m
            Node n1 = hb.getChildren().get(0);
            Node n2 = hb.getChildren().get(1);
            if (n1 instanceof Label && n2 instanceof TextField) {
                Label paramLabel = (Label) n1;
                TextField paramBox = (TextField) n2;
                String targetValue = parameters.get(paramLabel.getText());
                if (targetValue != null) {
                    paramBox.setText(targetValue);
                }
            }
            if (n2 instanceof ComboBox) {
                ComboBox<OutputFormatModel> cb = (ComboBox<OutputFormatModel>) n2;
                cb.setCellFactory(new Callback<ListView<OutputFormatModel>, ListCell<OutputFormatModel>>() {
                    @Override
                    public ListCell<OutputFormatModel> call(ListView<OutputFormatModel> list) {
                        return new CellTypes.StringCell();
                    }
                });
                cb.setOnAction(event -> {
                    if (cb.getValue().isAvailable()) {
                        cb.setStyle(FX_BORDER_COLOR_NULL);
                    } else {
                        cb.setStyle(FX_BORDER_COLOR_RED);
                    }
                });
                boolean formatAvailable = false;
                for (OutputFormatModel i : cb.getItems()) {
                    if (i.getItem().equals(downloadConfig.getOutputFormat())) {
                        cb.getSelectionModel().select(i);
                        formatAvailable = true;
                    }
                }
                if (!formatAvailable) {
                    String format = downloadConfig.getOutputFormat();
                    OutputFormatModel m = new OutputFormatModel();
                    m.setItem(format);
                    m.setAvailable(false);
                    cb.getItems().add(m);
                    cb.getSelectionModel().select(m);
                }
                if (cb.getValue().isAvailable()) {
                    cb.setStyle(FX_BORDER_COLOR_NULL);
                } else {
                    cb.setStyle(FX_BORDER_COLOR_RED);
                }
            }
        }
    }
}

From source file:snpviewer.SnpViewer.java

public void refreshView(String chrom, boolean forceRedraw) {
    //if forceRedraw is false look for existing png files for each snpFile
    if (chrom == null) {
        /*if null is passed then select/reselect chromosome from 
         * chromosomeSelector, return and let chromosomeSelector's 
         * listener refire this method//ww w .ja  va 2  s . com
         */
        if (chromosomeSelector.getSelectionModel().isEmpty()) {
            chromosomeSelector.getSelectionModel().selectFirst();
        } else {
            int sel = chromosomeSelector.getSelectionModel().getSelectedIndex();
            chromosomeSelector.getSelectionModel().clearSelection();
            chromosomeSelector.getSelectionModel().select(sel);
        }
        return;
    }
    int totalFiles = affFiles.size() + unFiles.size();
    if (totalFiles < 1) {
        return;
    }
    ArrayList<Pane> panesToAdd = new ArrayList<>();
    ArrayList<ScrollPane> labelsToAdd = new ArrayList<>();
    clearSplitPanes();

    setProgressMode(true);
    nextChromMenu.setDisable(false);
    nextChromMenu.setDisable(false);
    for (final SnpFile f : affFiles) {
        Pane sPane = new Pane();
        sPane.setMinHeight(chromSplitPane.getHeight() / totalFiles);
        sPane.setMinWidth(chromSplitPane.getWidth());
        sPane.setVisible(true);
        panesToAdd.add(sPane);
        ScrollPane labelPane = new ScrollPane();
        Label fileLabel = new Label(f.inputFile.getName() + "\n(Affected)");
        fileLabel.setTextFill(Color.WHITE);
        labelPane.setMinHeight(labelSplitPane.getHeight() / totalFiles);
        labelPane.setPrefWidth(labelSplitPane.getWidth());
        labelPane.minHeightProperty().bind(labelSplitPane.heightProperty().divide(totalFiles));
        VBox vbox = new VBox();
        vbox.setSpacing(10);
        vbox.getChildren().add(fileLabel);
        final TextField textField = new TextField();
        textField.setStyle("-fx-text-fill: white; -fx-background-color: "
                + "rgba(90%,90%,90%,0.3); -fx-border-color:white");
        textField.setPromptText("Sample Name");
        if (f.getSampleName() != null) {
            textField.setText(f.getSampleName());
        }
        textField.setFocusTraversable(true);
        textField.setOnKeyPressed(new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent ke) {
                if (ke.getCode().equals(KeyCode.ENTER)) {
                    if (!textField.getText().isEmpty()) {
                        String name = textField.getText().trim();
                        if (name.length() > 0) {
                            f.setSampleName(name);
                        }
                        textField.getParent().requestFocus();
                        saveProject();
                    }
                }
            }
        });
        textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
            @Override
            public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue,
                    Boolean newValue) {
                if (!textField.isFocused()) {
                    if (!textField.getText().isEmpty()) {
                        String name = textField.getText().trim();
                        if (name.length() > 0) {
                            f.setSampleName(name);
                        }
                        saveProject();
                    }
                }
            }
        });
        vbox.getChildren().add(textField);
        Label noCalls = new Label();
        if (f.getPercentNoCall() != null) {
            noCalls.setText("No Calls: " + DecimalFormat.getInstance().format(f.getPercentNoCall()) + " %");
        } else {
            noCalls.setText("No Calls: none");
        }
        Label meanQual = new Label();
        if (f.getMeanQuality() != null) {
            meanQual.setText("Av. Call Conf: "
                    + DecimalFormat.getInstance().format(100 - (f.getMeanQuality() * 100)) + " %");
        } else {
            meanQual.setText("No Call Confidence Data");
        }
        vbox.getChildren().add(noCalls);
        vbox.getChildren().add(meanQual);
        labelPane.setContent(vbox);
        //            labelPane.getChildren().add(fileLabel);
        //            labelPane.getChildren().add(new TextField());
        labelsToAdd.add(labelPane);
    }
    for (final SnpFile f : unFiles) {
        Pane sPane = new Pane();
        sPane.setMinHeight(chromSplitPane.getHeight() / totalFiles);
        sPane.setMinWidth(chromSplitPane.getWidth());
        sPane.setVisible(true);
        panesToAdd.add(sPane);
        ScrollPane labelPane = new ScrollPane();
        Label fileLabel = new Label(f.inputFile.getName() + "\n(Unaffected)");
        fileLabel.setStyle("-fx-text-fill: black");
        labelPane.setMinHeight(labelSplitPane.getHeight() / totalFiles);
        labelPane.setPrefWidth(labelSplitPane.getWidth());
        labelPane.minHeightProperty().bind(labelSplitPane.heightProperty().divide(totalFiles));
        VBox vbox = new VBox();
        vbox.setSpacing(10);
        vbox.getChildren().add(fileLabel);
        final TextField textField = new TextField();
        textField.setStyle("-fx-text-fill: black; " + "-fx-background-color: rgba(90%,90%,90%,0.3);"
                + " -fx-border-color:white");
        textField.setPromptText("Sample Name");
        if (f.getSampleName() != null) {
            textField.setText(f.getSampleName());
        }
        textField.setFocusTraversable(true);
        textField.setOnKeyPressed(new EventHandler<KeyEvent>() {
            @Override
            public void handle(KeyEvent ke) {
                if (ke.getCode().equals(KeyCode.ENTER)) {
                    if (!textField.getText().isEmpty()) {
                        f.setSampleName(textField.getText());
                        textField.getParent().requestFocus();
                        saveProject();
                    }
                }
            }
        });
        textField.focusedProperty().addListener(new ChangeListener<Boolean>() {
            @Override
            public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue,
                    Boolean newValue) {
                if (!textField.isFocused()) {
                    if (!textField.getText().isEmpty()) {
                        f.setSampleName(textField.getText());
                        saveProject();
                    }
                }
            }
        });
        vbox.getChildren().add(textField);
        Label noCalls = new Label();
        if (f.getPercentNoCall() != null) {
            noCalls.setText("No Calls: " + DecimalFormat.getInstance().format(f.getPercentNoCall()) + " %");
        } else {
            noCalls.setText("No Calls: none");
        }
        Label meanQual = new Label();
        if (f.getMeanQuality() != null) {
            meanQual.setText("Av. Call Conf: "
                    + DecimalFormat.getInstance().format(100 - (f.getMeanQuality() * 100)) + " %");
        } else {
            meanQual.setText("No Call Confidence Data");
        }
        vbox.getChildren().add(noCalls);
        vbox.getChildren().add(meanQual);
        labelPane.setContent(vbox);
        //            labelPane.getChildren().add(fileLabel);
        labelsToAdd.add(labelPane);
    }
    if (panesToAdd.size() > 0) {
        chromSplitPane.getItems().addAll(panesToAdd);
        labelSplitPane.getItems().addAll(labelsToAdd);

        ArrayList<SnpFile> bothFiles = new ArrayList<>(affFiles);
        bothFiles.addAll(unFiles);
        final Iterator<SnpFile> fileIter = bothFiles.iterator();
        final Iterator<Pane> paneIter = panesToAdd.iterator();
        SnpFile firstFileToProcess = fileIter.next();
        Pane firstPaneToProcess = paneIter.next();
        String pngPath = null;
        if (qualityFilter != null) {
            Integer percent = new Integer(100 - (int) (qualityFilter * 100));
            pngPath = percent.toString();
        }
        drawWithIterator(firstFileToProcess, firstPaneToProcess, pngPath, fileIter, paneIter, 1, totalFiles,
                chrom, forceRedraw, chromSplitPane);
    } else {
        setProgressMode(false);
    }
}

From source file:fr.amap.lidar.amapvox.gui.MainFrameController.java

private void setDragDroppedSingleFileEvent(final TextField textField) {

    textField.setOnDragDropped(new EventHandler<DragEvent>() {
        @Override/*from w  w w  .  j  av a 2  s. c  o  m*/
        public void handle(DragEvent event) {
            Dragboard db = event.getDragboard();
            boolean success = false;
            if (db.hasFiles() && db.getFiles().size() == 1) {
                success = true;
                for (File file : db.getFiles()) {
                    if (file != null) {
                        textField.setText(file.getAbsolutePath());
                    }
                }
            }
            event.setDropCompleted(success);
            event.consume();
        }
    });
}

From source file:tachyon.view.ProjectProperties.java

public ProjectProperties(JavaProject project, Window w) {
    this.project = project;
    stage = new Stage();
    stage.initOwner(w);/*  w  w w  . j a  v a2  s.co  m*/
    stage.initModality(Modality.APPLICATION_MODAL);
    stage.setWidth(600);
    stage.setTitle("Project Properties - " + project.getProjectName());
    stage.getIcons().add(tachyon.Tachyon.icon);
    stage.setResizable(false);
    HBox mai, libs, one, two, thr, fou;
    ListView<String> compileList, runtimeList;
    Button compileAdd, compileRemove, preview, selectIm, runtimeAdd, runtimeRemove;
    TextField iconField;
    stage.setScene(new Scene(new VBox(5, pane = new TabPane(
            new Tab("Library Settings",
                    box1 = new VBox(15,
                            libs = new HBox(10, new Label("External Libraries"), libsView = new ListView<>(),
                                    new VBox(5, addJar = new Button("Add Jar"),
                                            removeJar = new Button("Remove Jar"))))),
            new Tab("Program Settings",
                    new ScrollPane(box2 = new VBox(15, one = new HBox(10, new Label("Main-Class"),
                            mainClass = new TextField(project.getMainClassName()),
                            select = new Button("Select")),
                            two = new HBox(10, new Label("Compile-Time Arguments"),
                                    compileList = new ListView<>(),
                                    new VBox(5, compileAdd = new Button("Add Argument"),
                                            compileRemove = new Button("Remove Argument")))))),
            new Tab("Deployment Settings",
                    box3 = new VBox(15, thr = new HBox(10, new Label("Icon File"),
                            iconField = new TextField(project.getFileIconPath()),
                            preview = new Button("Preview Image"), selectIm = new Button("Select Icon")),
                            fou = new HBox(10, new Label("Runtime Arguments"), runtimeList = new ListView<>(),
                                    new VBox(5, runtimeAdd = new Button("Add Argument"),
                                            runtimeRemove = new Button("Remove Argument")))))),
            new VBox(15, mai = new HBox(10, cancel = new Button("Cancel"), confirm = new Button("Confirm"))))));
    if (applyCss.get()) {
        stage.getScene().getStylesheets().add(css);
    }
    for (Tab b : pane.getTabs()) {
        b.setClosable(false);
    }
    mainClass.setPromptText("Main-Class");
    box1.setPadding(new Insets(5, 10, 5, 10));
    mai.setAlignment(Pos.CENTER_RIGHT);
    mai.setPadding(box1.getPadding());
    libs.setAlignment(Pos.CENTER);
    one.setAlignment(Pos.CENTER);
    two.setAlignment(Pos.CENTER);
    thr.setAlignment(Pos.CENTER);
    fou.setAlignment(Pos.CENTER);
    box1.setAlignment(Pos.CENTER);
    box2.setPadding(box1.getPadding());
    box2.setAlignment(Pos.CENTER);
    box3.setPadding(box1.getPadding());
    box3.setAlignment(Pos.CENTER);
    mainClass.setEditable(false);
    mainClass.setPrefWidth(200);
    for (JavaLibrary lib : project.getAllLibs()) {
        libsView.getItems().add(lib.getBinaryAbsolutePath());
    }
    for (String sa : project.getCompileTimeArguments().keySet()) {
        compileList.getItems().add(sa + ":" + project.getCompileTimeArguments().get(sa));
    }
    for (String sa : project.getRuntimeArguments()) {
        runtimeList.getItems().add(sa);
    }
    compileAdd.setOnAction((e) -> {
        Dialog<Pair<String, String>> dialog = new Dialog<>();
        dialog.setTitle("Compiler Argument");
        dialog.initOwner(stage);
        dialog.setHeaderText("Entry the argument");

        ButtonType loginButtonType = new ButtonType("Done", ButtonData.OK_DONE);
        dialog.getDialogPane().getButtonTypes().addAll(loginButtonType, ButtonType.CANCEL);

        GridPane grid = new GridPane();
        grid.setHgap(10);
        grid.setVgap(10);
        grid.setPadding(new Insets(20, 150, 10, 10));

        TextField username = new TextField();
        username.setPromptText("Key");
        TextField password = new TextField();
        password.setPromptText("Value");

        grid.add(new Label("Key:"), 0, 0);
        grid.add(username, 1, 0);
        grid.add(new Label("Value:"), 0, 1);
        grid.add(password, 1, 1);

        Node loginButton = dialog.getDialogPane().lookupButton(loginButtonType);
        loginButton.setDisable(true);

        username.textProperty().addListener((observable, oldValue, newValue) -> {
            loginButton.setDisable(newValue.trim().isEmpty());
        });

        dialog.getDialogPane().setContent(grid);

        Platform.runLater(() -> username.requestFocus());

        dialog.setResultConverter(dialogButton -> {
            if (dialogButton == loginButtonType) {
                return new Pair<>(username.getText(), password.getText());
            }
            return null;
        });

        Optional<Pair<String, String>> result = dialog.showAndWait();
        if (result.isPresent()) {
            compileList.getItems().add(result.get().getKey() + ":" + result.get().getValue());
        }
    });
    compileRemove.setOnAction((e) -> {
        if (compileList.getSelectionModel().getSelectedItem() != null) {
            compileList.getItems().remove(compileList.getSelectionModel().getSelectedItem());
        }
    });
    runtimeAdd.setOnAction((e) -> {
        TextInputDialog dia = new TextInputDialog();
        dia.setTitle("Add Runtime Argument");
        dia.setHeaderText("Enter an argument");
        dia.initOwner(stage);
        Optional<String> res = dia.showAndWait();
        if (res.isPresent()) {
            runtimeList.getItems().add(res.get());
        }
    });
    runtimeRemove.setOnAction((e) -> {
        if (runtimeList.getSelectionModel().getSelectedItem() != null) {
            runtimeList.getItems().remove(runtimeList.getSelectionModel().getSelectedItem());
        }
    });
    preview.setOnAction((e) -> {
        if (!iconField.getText().isEmpty()) {
            if (iconField.getText().endsWith(".ico")) {
                List<BufferedImage> read = new ArrayList<>();
                try {
                    read.addAll(ICODecoder.read(new File(iconField.getText())));
                } catch (IOException ex) {
                }
                if (read.size() >= 1) {
                    Image im = SwingFXUtils.toFXImage(read.get(0), null);
                    Stage st = new Stage();
                    st.initOwner(stage);
                    st.initModality(Modality.APPLICATION_MODAL);
                    st.setTitle("Icon Preview");
                    st.getIcons().add(Tachyon.icon);
                    st.setScene(new Scene(new BorderPane(new ImageView(im))));
                    if (applyCss.get()) {
                        st.getScene().getStylesheets().add(css);
                    }
                    st.showAndWait();
                }
            } else if (iconField.getText().endsWith(".icns")) {
                try {
                    BufferedImage ima = Imaging.getBufferedImage(new File(iconField.getText()));
                    if (ima != null) {
                        Image im = SwingFXUtils.toFXImage(ima, null);
                        Stage st = new Stage();
                        st.initOwner(stage);
                        st.initModality(Modality.APPLICATION_MODAL);
                        st.setTitle("Icon Preview");
                        st.getIcons().add(Tachyon.icon);
                        st.setScene(new Scene(new BorderPane(new ImageView(im))));
                        if (applyCss.get()) {
                            st.getScene().getStylesheets().add(css);
                        }
                        st.showAndWait();
                    }
                } catch (ImageReadException | IOException ex) {
                }
            } else {
                Image im = new Image(new File(iconField.getText()).toURI().toString());
                Stage st = new Stage();
                st.initOwner(stage);
                st.initModality(Modality.APPLICATION_MODAL);
                st.setTitle("Icon Preview");
                st.getIcons().add(Tachyon.icon);
                st.setScene(new Scene(new BorderPane(new ImageView(im))));
                if (applyCss.get()) {
                    st.getScene().getStylesheets().add(css);
                }
                st.showAndWait();
            }
        }
    });
    selectIm.setOnAction((e) -> {
        FileChooser fc = new FileChooser();
        fc.setTitle("Icon File");
        String OS = System.getProperty("os.name").toLowerCase();
        fc.getExtensionFilters().add(new ExtensionFilter("Icon File",
                OS.contains("win") ? getWindowsImageExtensions() : getMacImageExtensions()));
        fc.setSelectedExtensionFilter(fc.getExtensionFilters().get(0));
        File lf = fc.showOpenDialog(stage);
        if (lf != null) {
            iconField.setText(lf.getAbsolutePath());
        }
    });

    addJar.setOnAction((e) -> {
        FileChooser f = new FileChooser();
        f.setTitle("External Libraries");
        f.setSelectedExtensionFilter(new ExtensionFilter("Jar Files", "*.jar"));
        List<File> showOpenMultipleDialog = f.showOpenMultipleDialog(stage);
        if (showOpenMultipleDialog != null) {
            for (File fi : showOpenMultipleDialog) {
                if (!libsView.getItems().contains(fi.getAbsolutePath())) {
                    libsView.getItems().add(fi.getAbsolutePath());
                }
            }
        }
    });

    removeJar.setOnAction((e) -> {
        String selected = libsView.getSelectionModel().getSelectedItem();
        if (selected != null) {
            libsView.getItems().remove(selected);
        }
    });

    select.setOnAction((e) -> {
        List<String> all = getAll();
        ChoiceDialog<String> di = new ChoiceDialog<>(project.getMainClassName(), all);
        di.setTitle("Select Main Class");
        di.initOwner(stage);
        di.setHeaderText("Select A Main Class");
        Optional<String> show = di.showAndWait();
        if (show.isPresent()) {
            mainClass.setText(show.get());
        }
    });
    cancel.setOnAction((e) -> {
        stage.close();
    });
    confirm.setOnAction((e) -> {
        project.setMainClassName(mainClass.getText());
        project.setFileIconPath(iconField.getText());
        project.setRuntimeArguments(runtimeList.getItems());
        HashMap<String, String> al = new HashMap<>();
        for (String s : compileList.getItems()) {
            String[] spl = s.split(":");
            al.put(spl[0], spl[1]);
        }
        project.setCompileTimeArguments(al);
        project.setAllLibs(libsView.getItems());
        stage.close();
    });
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 *//*from w ww.j a v a  2  s . c  o  m*/
private static void afficheInfoPano() {
    TextField tfTitrePano = (TextField) getScnPrincipale().lookup("#txttitrepano");
    if (getPanoramiquesProjet()[getiPanoActuel()].getStrTitrePanoramique() != null) {
        tfTitrePano.setText(getPanoramiquesProjet()[getiPanoActuel()].getStrTitrePanoramique());
    } else {
        tfTitrePano.setText("");
    }
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param iNumHS//  w  w w. j  ava2 s  .c  om
 * @return
 */
private static AnchorPane apAfficherListePanosVignettes(int iNumHS) {
    NavigateurPanoramique navigateurPano2;
    AnchorPane apVisuPanoHS;
    iNumeroPanoChoisitHS = -1;
    if (!getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).getStrFichierXML().equals("")) {
        for (int ii1 = 0; ii1 < getiNombrePanoramiques(); ii1++) {
            String strFichPano = getPanoramiquesProjet()[ii1].getStrNomFichier();
            String strNomXMLFile = strFichPano
                    .substring(strFichPano.lastIndexOf(File.separator) + 1, strFichPano.length())
                    .split("\\.")[0] + ".xml";
            if (strNomXMLFile
                    .equals(getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).getStrFichierXML())) {
                iNumeroPanoChoisitHS = ii1;
                strNomPanoChoisitHS = getPanoramiquesProjet()[ii1].getStrNomFichier();
            }
        }
        navigateurPano2 = new NavigateurPanoramique(
                getPanoramiquesProjet()[iNumeroPanoChoisitHS].getImgVisuPanoramique(), 0, 0, 400, 200, true);
        if (getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).getRegardX() != -1000) {
            navigateurPano2.setChoixLongitude(
                    getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).getRegardX());
        } else {
            navigateurPano2.setChoixLongitude(0);
        }
        navigateurPano2.setLongitude(navigateurPano2.getChoixLongitude());
        if (getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).getRegardY() != -1000) {
            navigateurPano2.setChoixLatitude(
                    getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).getRegardY());
        } else {
            navigateurPano2.setChoixLatitude(0);
        }
        navigateurPano2.setLatitude(navigateurPano2.getChoixLatitude());
        if (getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).getChampVisuel() != 0) {
            navigateurPano2
                    .setChoixFov(getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).getChampVisuel());
        } else {
            navigateurPano2.setChoixFov(50);
        }
        navigateurPano2.setFov(navigateurPano2.getChoixFov());
        apVisuPanoHS = navigateurPano2.affichePano();
        apVisuPanoHS.setDisable(false);

    } else {
        navigateurPano2 = new NavigateurPanoramique(
                getPanoramiquesProjet()[getiPanoActuel()].getImgVisuPanoramique(), 0, 0, 400, 200, true);
        apVisuPanoHS = navigateurPano2.affichePano();
        apVisuPanoHS.setDisable(true);
    }
    AnchorPane aplistePano = new AnchorPane();
    aplistePano.setOpacity(1);
    Pane paneFond = new Pane();
    paneFond.setOnMouseClicked((mouseEvent) -> {
        mouseEvent.consume();
    });
    paneFond.setStyle("-fx-background-color : #bbb;");
    paneFond.setPrefWidth(540);
    paneFond.setPrefHeight(((getiNombrePanoramiques() - 2) / 4 + 1) * 65 + 10 + 320);
    paneFond.setMinWidth(540);
    paneFond.setMinHeight(70);
    aplistePano.getChildren().add(paneFond);
    aplistePano.setStyle("-fx-backgroung-color : #bbb;");
    int ij = 0;
    ImageView[] ivPano;
    ivPano = new ImageView[getiNombrePanoramiques()];
    double xPos;
    double yPos;
    int iRow = 0;
    Button btnValide = new Button("Ok");
    btnValide.setPrefWidth(80);
    btnValide.setLayoutX(paneFond.getPrefWidth() - 100);
    btnValide.setLayoutY(paneFond.getPrefHeight() - 30);
    paneFond.getChildren().add(btnValide);
    btnValide.setOnMouseClicked((mouseEvent) -> {
        if (iNumeroPanoChoisitHS != -1) {
            panePanoramique.setCursor(Cursor.CROSSHAIR);
            panePanoramique.setOnMouseClicked((me1) -> {
                gereSourisPanoramique(me1);
            });
            setStrPanoListeVignette(strNomPanoChoisitHS);
            if (getPanoramiquesProjet()[iNumeroPanoChoisitHS].getStrTitrePanoramique() != null) {
                String strTexteHS = getPanoramiquesProjet()[iNumeroPanoChoisitHS].getStrTitrePanoramique();
                TextField tfTxtHS = (TextField) vbOutils.lookup("#txtHS" + iNumHS);
                tfTxtHS.setText(strTexteHS);
            }
            double latitude = Math.round(navigateurPano2.getChoixLatitude() * 10) / 10.d;
            double longitude = Math.round(navigateurPano2.getChoixLongitude() * 10) / 10.d - 180;
            double fov = Math.round(navigateurPano2.getChoixFov() * 10) / 10.d;
            longitude = longitude % 360;
            longitude = longitude < 0 ? longitude + 360 : longitude;
            longitude = longitude > 180 ? longitude - 360 : longitude;
            getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).setNumeroPano(iNumeroPanoChoisitHS);
            getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).setRegardX(longitude - 180);
            getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).setRegardY(latitude);
            getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS).setChampVisuel(fov);
            getPanoramiquesProjet()[getiPanoActuel()].getHotspot(iNumHS)
                    .setImgVueHs(navigateurPano2.getImgVignetteHS());
            ComboBox cbPanos = (ComboBox) vbOutils.lookup("#cbpano" + iNumHS);
            cbPanos.getSelectionModel().select(iNumeroPanoChoisitHS);
            aplistePano.setVisible(false);
        }
        mouseEvent.consume();

    });
    for (int i = 0; i < getiNombrePanoramiques(); i++) {
        int iNumeroPano1 = i;
        String strNomPano = getPanoramiquesProjet()[i].getStrNomFichier();
        ivPano[ij] = new ImageView(getPanoramiquesProjet()[i].getImgVignettePanoramique());
        ivPano[ij].setFitWidth(120);
        ivPano[ij].setFitHeight(60);
        ivPano[ij].setSmooth(true);
        int iCol = ij % 4;
        iRow = ij / 4;
        xPos = iCol * 130 + 25;
        yPos = iRow * 65 + 15;
        ivPano[ij].setLayoutX(xPos);
        ivPano[ij].setLayoutY(yPos);
        ivPano[ij].setCursor(Cursor.HAND);
        ivPano[ij].setStyle("-fx-background-color : #ccc;");
        Tooltip tltpPano = new Tooltip(
                strNomPano.substring(strNomPano.lastIndexOf(File.separator) + 1, strNomPano.lastIndexOf(".")));
        tltpPano.setStyle(getStrTooltipStyle());
        Tooltip.install(ivPano[ij], tltpPano);
        ivPano[ij].setOnMouseClicked((mouseEvent) -> {
            iNumeroPanoChoisitHS = iNumeroPano1;
            strNomPanoChoisitHS = getPanoramiquesProjet()[iNumeroPanoChoisitHS].getStrNomFichier();
            navigateurPano2.setImagePanoramique(
                    getPanoramiquesProjet()[iNumeroPanoChoisitHS].getStrNomFichier(),
                    getPanoramiquesProjet()[iNumeroPanoChoisitHS].getImgVisuPanoramique());
            navigateurPano2.setLongitude(getPanoramiquesProjet()[iNumeroPanoChoisitHS].getRegardX() - 180);
            navigateurPano2.setLatitude(getPanoramiquesProjet()[iNumeroPanoChoisitHS].getRegardY());
            navigateurPano2.setFov(getPanoramiquesProjet()[iNumeroPanoChoisitHS].getChampVisuel());
            navigateurPano2.affiche();
            apVisuPanoHS.setDisable(false);
        });
        aplistePano.getChildren().add(ivPano[ij]);
        ij++;

    }
    int iTaille = (iRow + 1) * 65 + 5;
    apVisuPanoHS.setLayoutY(iTaille + 10);
    iTaille += 320;
    apVisuPanoHS.setLayoutX((540 - apVisuPanoHS.getPrefWidth()) / 2.d);
    aplistePano.setPrefWidth(540);
    aplistePano.setPrefHeight(iTaille);
    aplistePano.setMinWidth(540);
    aplistePano.setMinHeight(iTaille);
    aplistePano.getChildren().add(apVisuPanoHS);
    ImageView ivClose = new ImageView(
            new Image("file:" + getStrRepertAppli() + File.separator + "images/ferme.png", 20, 20, true, true));
    ivClose.setLayoutX(2);
    ivClose.setLayoutY(5);
    ivClose.setCursor(Cursor.HAND);
    aplistePano.getChildren().add(ivClose);
    ivClose.setOnMouseClicked((mouseEvent) -> {
        panePanoramique.setCursor(Cursor.CROSSHAIR);
        panePanoramique.setOnMouseClicked((mouseEvent1) -> {
            gereSourisPanoramique(mouseEvent1);
        });

        setStrPanoListeVignette("");
        aplistePano.setVisible(false);
        mouseEvent.consume();
    });
    return aplistePano;
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param strLstPano//from   w  w w .  ja v  a2s .c  o m
 * @param iNumPano
 * @return
 */
public static Pane paneAffichageHS(String strLstPano, int iNumPano) {

    Pane paneHotSpots = new Pane();
    paneHotSpots.setTranslateY(10);
    paneHotSpots.setTranslateX(10);
    VBox vbHotspots = new VBox(5);
    paneHotSpots.getChildren().add(vbHotspots);
    Label lblPoint;
    int io;
    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspots(); io++) {
        Label lblSep = new Label(" ");
        Label lblSep1 = new Label(" ");
        VBox vbPanneauHS = new VBox();
        double deplacement = 0;
        vbPanneauHS.setLayoutX(deplacement);
        Pane paneHsPanoramique = new Pane(vbPanneauHS);
        paneHsPanoramique.setPrefHeight(300);
        paneHsPanoramique.setMinHeight(300);
        paneHsPanoramique.setMaxHeight(300);

        int iNum1 = io;
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1);
            if (c1 != null) {
                if (c1.getFill() == Color.RED) {
                    c1.setFill(Color.YELLOW);
                    c1.setStroke(Color.RED);
                } else {
                    c1.setFill(Color.RED);
                    c1.setStroke(Color.YELLOW);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsPanoramique.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsPanoramique.setOnMouseExited((e) -> {
            timBouge.pause();
            Circle c1 = (Circle) panePanoramique.lookup("#point" + iNum1);
            if (c1 != null) {
                c1.setFill(Color.YELLOW);
                c1.setStroke(Color.RED);
            }
        });
        paneHsPanoramique
                .setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsPanoramique.setId("HS" + io);
        lblPoint = new Label("Point #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.setTranslateX(-deplacement);
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHotspots = new Separator(Orientation.HORIZONTAL);
        sepHotspots.setTranslateX(-deplacement);
        sepHotspots.setPrefWidth(321);
        sepHotspots.setTranslateX(2);
        paneHsPanoramique.setPrefWidth(325);
        vbPanneauHS.getChildren().addAll(lblPoint, sepHotspots);
        if (strLstPano != null) {

            Label lblLien = new Label(rbLocalisation.getString("main.panoramiqueDestination"));
            lblLien.setTranslateX(10);
            ComboBox cbDestPano = new ComboBox();
            String[] strListe = strLstPano.split(";");
            cbDestPano.getItems().addAll(Arrays.asList(strListe));
            int iNum11 = getPanoramiquesProjet()[iNumPano].getHotspot(io).getNumeroPano();
            cbDestPano.setTranslateX(10);
            cbDestPano.setId("cbpano" + io);
            cbDestPano.getSelectionModel().select(iNum11);
            cbDestPano.getSelectionModel().selectedIndexProperty().addListener((ov, t, t1) -> {
                valideHS();
                if (dejaCharge) {
                    dejaCharge = false;
                    retireAffichageHotSpots();
                    Pane affHS1 = paneAffichageHS(strListePano(), iNumPano);
                    affHS1.setId("labels");
                    vbVisuHotspots.getChildren().add(affHS1);
                }
            });
            if (iNum11 != -1) {
                int iNumPan = iNum11;
                ImageView ivAfficheVignettePano = new ImageView(
                        getPanoramiquesProjet()[iNum11].getImgPanoRect());
                ivAfficheVignettePano.setPreserveRatio(true);
                ivAfficheVignettePano.setFitWidth(300);
                ivAfficheVignettePano.setLayoutY(10);
                ivAfficheVignettePano.setCursor(Cursor.HAND);
                ivAfficheVignettePano.setOnMouseClicked((e) -> {
                    affichePanoChoisit(iNumPan);
                });
                AnchorPane apVisuVignettePano = new AnchorPane(ivAfficheVignettePano);
                apVisuVignettePano.setPrefHeight(170);
                apVisuVignettePano.setTranslateX(10);
                vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, apVisuVignettePano, lblSep);
            } else {
                vbPanneauHS.getChildren().addAll(lblLien, cbDestPano, lblSep);
            }

        }
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);
        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspot(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtHS" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1);
        vbHotspots.getChildren().addAll(paneHsPanoramique, lblSep);
    }
    int iNbHS = io;
    int iTaillePane = io * 325;
    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotImage(); io++) {
        Label lblSep = new Label(" ");
        Label lblSep1 = new Label(" ");
        VBox vbPanneauHsImage = new VBox();
        Pane paneHsImage = new Pane(vbPanneauHsImage);
        int iNum = io;
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum);
            if (c1 != null) {
                if (c1.getFill() == Color.BLUE) {
                    c1.setFill(Color.YELLOW);
                    c1.setStroke(Color.BLUE);
                } else {
                    c1.setFill(Color.BLUE);
                    c1.setStroke(Color.YELLOW);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsImage.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsImage.setOnMouseExited((e) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#img" + iNum);
            if (c1 != null) {

                c1.setFill(Color.BLUE);
                c1.setStroke(Color.YELLOW);
            }
            timBouge.pause();
        });
        paneHsImage.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsImage.setId("HSImg" + io);
        lblPoint = new Label("Image #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHS = new Separator(Orientation.HORIZONTAL);
        sepHS.setPrefWidth(321);
        sepHS.setTranslateX(2);

        paneHsImage.setPrefWidth(325);
        vbPanneauHsImage.getChildren().addAll(lblPoint, sepHS);
        Label lblLien = new Label(rbLocalisation.getString("main.imageChoisie"));
        lblLien.setTranslateX(10);

        String strF1XML = getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrLienImg();
        Image imgChoisie = new Image(
                "file:" + getStrRepertTemp() + File.separator + "images" + File.separator + strF1XML);
        ImageView ivChoisie = new ImageView(imgChoisie);
        ivChoisie.setTranslateX(100);
        ivChoisie.setFitWidth(100);
        ivChoisie.setFitHeight(imgChoisie.getHeight() / imgChoisie.getWidth() * 100);

        vbPanneauHsImage.getChildren().addAll(lblLien, ivChoisie, lblSep);
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);

        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtHSImage" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHsImage.getChildren().addAll(lblTexteHS, tfTexteHS, lblSep1);
        Label lblCoulFond = new Label(rbLocalisation.getString("diapo.couleurFond"));
        lblCoulFond.setTranslateX(10);
        Label lblOpacite = new Label(rbLocalisation.getString("diapo.opacite"));
        lblOpacite.setTranslateX(10);
        if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond().equals("")) {
            getPanoramiquesProjet()[iNumPano].getHotspotImage(io).setStrCouleurFond(
                    "#" + getGestionnaireInterface().getCouleurFondTheme().toString().substring(2, 8));
        }
        ColorPicker cpCouleurFond = new ColorPicker(
                Color.valueOf(getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getStrCouleurFond()));
        if (getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite() == -1) {
            getPanoramiquesProjet()[iNumPano].getHotspotImage(io)
                    .setOpacite(getGestionnaireInterface().getOpaciteTheme());
        }
        cpCouleurFond.setTranslateX(100);
        int i = io;
        cpCouleurFond.valueProperty().addListener((ov, av, nv) -> {
            if (getiNombrePanoramiques() != 0) {
                setbDejaSauve(false);
                getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
            }
            getPanoramiquesProjet()[iNumPano].getHotspotImage(i)
                    .setStrCouleurFond("#" + cpCouleurFond.getValue().toString().substring(2, 8));
        });
        Slider slOpacite = new Slider(0, 1, getPanoramiquesProjet()[iNumPano].getHotspotImage(io).getOpacite());
        slOpacite.valueProperty().addListener((ov, av, nv) -> {
            if (getiNombrePanoramiques() != 0) {
                setbDejaSauve(false);
                getStPrincipal().setTitle(getStPrincipal().getTitle().replace(" *", "") + " *");
            }
            getPanoramiquesProjet()[iNumPano].getHotspotImage(i).setOpacite(slOpacite.getValue());
        });
        slOpacite.setTranslateX(100);
        slOpacite.setPrefWidth(130);
        slOpacite.setMinWidth(130);
        slOpacite.setMaxWidth(130);
        vbPanneauHsImage.getChildren().addAll(lblCoulFond, cpCouleurFond, lblOpacite, slOpacite);

        vbHotspots.getChildren().addAll(paneHsImage, lblSep);
        iTaillePane += 225 + ivChoisie.getFitHeight();
        paneHsImage.setPrefHeight(200 + ivChoisie.getFitHeight());
        paneHsImage.setMinHeight(200 + ivChoisie.getFitHeight());
        paneHsImage.setMaxHeight(200 + ivChoisie.getFitHeight());
    }

    iNbHS += io;

    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getNombreHotspotHTML(); io++) {
        Label lblSep = new Label(" ");
        int iNum = io;
        VBox vbPanneauHS = new VBox();
        Pane paneHsHtml = new Pane(vbPanneauHS);
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum);
            if (c1 != null) {

                if (c1.getFill() == Color.DARKGREEN) {
                    c1.setFill(Color.YELLOWGREEN);
                    c1.setStroke(Color.DARKGREEN);
                } else {
                    c1.setFill(Color.DARKGREEN);
                    c1.setStroke(Color.YELLOWGREEN);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsHtml.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsHtml.setOnMouseExited((e) -> {
            timBouge.pause();
            Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum);
            if (c1 != null) {
                c1.setFill(Color.DARKGREEN);
                c1.setStroke(Color.YELLOWGREEN);
            }
        });
        paneHsHtml.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsHtml.setId("HSHTML" + io);
        lblPoint = new Label("Hotspot HTML #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHS = new Separator(Orientation.HORIZONTAL);
        sepHS.setPrefWidth(321);
        sepHS.setTranslateX(2);
        paneHsHtml.setPrefWidth(325);
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);
        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotHTML(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtHSHTML" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS);
        Button btnEditeHSHTML = new Button(rbLocalisation.getString("main.editeHTML"));
        btnEditeHSHTML.setPrefWidth(80);
        btnEditeHSHTML.setTranslateX(paneHsHtml.getPrefWidth() - btnEditeHSHTML.getPrefWidth() - 10);
        vbPanneauHS.getChildren().addAll(btnEditeHSHTML);
        btnEditeHSHTML.setOnAction((e) -> {
            EditeurHTML editHTML = new EditeurHTML();
            HotspotHTML HS = getPanoramiquesProjet()[iNumPano].getHotspotHTML(iNum);
            editHTML.setHsHTML(HS);
            Rectangle2D tailleEcran = Screen.getPrimary().getBounds();
            int iHauteur = (int) tailleEcran.getHeight() - 100;
            int iLargeur = (int) tailleEcran.getWidth() - 100;
            editHTML.affiche(iLargeur, iHauteur);
            editHTML.addPropertyChangeListener("bValide", (ev) -> {
                if (ev.getNewValue().toString().equals("true")) {
                    getPanoramiquesProjet()[iNumPano].setHotspotHTML(editHTML.getHsHTML(), iNum);
                    dejaCharge = false;
                    retireAffichageHotSpots();
                    Pane affHS1 = paneAffichageHS(strListePano(), iNumPano);
                    affHS1.setId("labels");
                    vbVisuHotspots.getChildren().add(affHS1);
                }
            });

        });

        vbHotspots.getChildren().addAll(paneHsHtml, lblSep);
        paneHsHtml.setPrefHeight(120);
        paneHsHtml.setMinHeight(120);
        paneHsHtml.setMaxHeight(120);
        iTaillePane += 145;
    }
    iNbHS += io;
    for (io = 0; io < getPanoramiquesProjet()[iNumPano].getiNombreHotspotDiapo(); io++) {
        Label lblSep = new Label(" ");
        int iNum = io;
        VBox vbPanneauHS = new VBox();
        Pane paneHsDiapo = new Pane(vbPanneauHS);
        Timeline timBouge = new Timeline(new KeyFrame(Duration.millis(500), (ActionEvent event) -> {
            Circle c1 = (Circle) panePanoramique.lookup("#dia" + iNum);
            if (c1 != null) {

                if (c1.getFill() == Color.TURQUOISE) {
                    c1.setFill(Color.ORANGE);
                    c1.setStroke(Color.TURQUOISE);
                } else {
                    c1.setFill(Color.TURQUOISE);
                    c1.setStroke(Color.ORANGE);
                }
            }
        }));
        timBouge.setCycleCount(Timeline.INDEFINITE);
        timBouge.pause();
        paneHsDiapo.setOnMouseEntered((e) -> {
            timBouge.play();
        });
        paneHsDiapo.setOnMouseExited((e) -> {
            timBouge.pause();
            Circle c1 = (Circle) panePanoramique.lookup("#html" + iNum);
            if (c1 != null) {
                c1.setFill(Color.TURQUOISE);
                c1.setStroke(Color.ORANGE);
            }
        });
        paneHsDiapo.setStyle("-fx-border-color : #777777;-fx-border-width : 1px;-fx-border-radius : 3px;");
        paneHsDiapo.setId("DIAPO" + io);
        lblPoint = new Label("Hotspot Diaporama #" + (io + 1));
        lblPoint.setPadding(new Insets(5, 10, 5, 5));
        lblPoint.getStyleClass().add("titreOutil");
        Separator sepHS = new Separator(Orientation.HORIZONTAL);
        sepHS.setPrefWidth(321);
        sepHS.setTranslateX(2);
        paneHsDiapo.setPrefWidth(325);
        Label lblTexteHS = new Label(rbLocalisation.getString("main.texteHotspot"));
        lblTexteHS.setTranslateX(10);
        TextField tfTexteHS = new TextField();
        if (getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo() != null) {
            tfTexteHS.setText(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getStrInfo());
        }
        tfTexteHS.textProperty().addListener((final ObservableValue<? extends String> observable,
                final String oldValue, final String newValue) -> {
            valideHS();
        });

        tfTexteHS.setId("txtDIA" + io);
        tfTexteHS.setPrefSize(200, 25);
        tfTexteHS.setMaxSize(200, 20);
        tfTexteHS.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(lblPoint, sepHS, lblTexteHS, tfTexteHS);
        ComboBox cbListeDiapo = new ComboBox();
        for (int i = 0; i < getiNombreDiapo(); i++) {
            cbListeDiapo.getItems().add(diaporamas[i].getStrNomDiaporama());
        }
        cbListeDiapo.getSelectionModel()
                .select(getPanoramiquesProjet()[iNumPano].getHotspotDiapo(io).getiNumDiapo());
        int iii = io;
        cbListeDiapo.getSelectionModel().selectedIndexProperty().addListener((ov, av, nv) -> {
            getPanoramiquesProjet()[iNumPano].getHotspotDiapo(iii).setiNumDiapo((int) nv);
        });
        cbListeDiapo.setTranslateX(60);
        vbPanneauHS.getChildren().addAll(cbListeDiapo);
        //Ajouter Liste Diaporamas
        vbHotspots.getChildren().addAll(paneHsDiapo, lblSep);
        paneHsDiapo.setPrefHeight(120);
        paneHsDiapo.setMinHeight(120);
        paneHsDiapo.setMaxHeight(120);
        iTaillePane += 145;
    }
    valideHS();
    iNbHS += io;
    dejaCharge = true;
    paneHotSpots.setPrefHeight(iTaillePane);
    paneHotSpots.setMinHeight(iTaillePane);
    paneHotSpots.setMaxHeight(iTaillePane);
    paneHotSpots.setId("labels");
    apVisuHS.setPrefHeight(paneHotSpots.getPrefHeight());
    apVisuHS.setMinHeight(paneHotSpots.getPrefHeight());
    apVisuHS.setMaxHeight(paneHotSpots.getPrefHeight());
    vbVisuHotspots.setPrefHeight(paneHotSpots.getPrefHeight());
    vbVisuHotspots.setMinHeight(paneHotSpots.getPrefHeight());
    vbVisuHotspots.setMaxHeight(paneHotSpots.getPrefHeight());

    return paneHotSpots;
}