Example usage for java.text DecimalFormatSymbols DecimalFormatSymbols

List of usage examples for java.text DecimalFormatSymbols DecimalFormatSymbols

Introduction

In this page you can find the example usage for java.text DecimalFormatSymbols DecimalFormatSymbols.

Prototype

public DecimalFormatSymbols() 

Source Link

Document

Create a DecimalFormatSymbols object for the default java.util.Locale.Category#FORMAT FORMAT locale.

Usage

From source file:org.n52.v3d.terrainserver.povraywts.WebTerrainServlet.java

private void addHints(BufferedImage pImage, VgElevationGrid pTerrain, double pDistance, double pYaw,
        double pExaggeration) {
    DecimalFormatSymbols dfs = new DecimalFormatSymbols();
    dfs.setDecimalSeparator('.');
    DecimalFormat df = new DecimalFormat("0.0", dfs);

    String deltaX = df.format(pTerrain.getGeometry().envelope().getExtentX() / 1000.);
    String deltaY = df.format(pTerrain.getGeometry().envelope().getExtentY() / 1000.);

    String hint = "DIST: " + df.format(pDistance) + ", EXAGG: " + pExaggeration + ", YAW: " + pYaw + ", BBOX: "
            + deltaX + " x " + deltaY + ", DZ: " + df.format(pTerrain.elevationDifference());

    Graphics2D g = pImage.createGraphics();
    g.drawImage(pImage, 0, 0, null);//from  w  ww.  java2s.c o  m
    g.setColor(new java.awt.Color(mCopyrightTextColor.getRed(), mCopyrightTextColor.getGreen(),
            mCopyrightTextColor.getBlue()));
    Font font = new Font(mCopyrightTextFont, Font.BOLD /* Style als int, siehe ggf. API-Dok.*/,
            mCopyrightTextSize);
    g.setFont(font);
    g.drawString(hint, 5, mCopyrightTextSize + 5);
    g.dispose();
}

From source file:LPGoogleFunctions.LPGoogleFunctions.java

public DecimalFormat coordinateDecimalFormat() {
    DecimalFormatSymbols separator = new DecimalFormatSymbols();
    separator.setDecimalSeparator('.');
    DecimalFormat coordinateDecimalFormat = new DecimalFormat("##.######");
    coordinateDecimalFormat.setDecimalFormatSymbols(separator);

    return coordinateDecimalFormat;
}

From source file:fmiquerytest.Coordinates.java

public static void main(String[] args) {
    df_short.setTimeZone(tz);
    df_iso.setTimeZone(tz);//from www .  j  a v a  2s.  c om
    df_daycode.setTimeZone(tz);
    DecimalFormatSymbols otherSymbols = new DecimalFormatSymbols();
    otherSymbols.setDecimalSeparator('.');
    df_fiveDecimal.setDecimalFormatSymbols(otherSymbols);
    String startTime = df_short.format(new Date(startTimeMillis));
    System.out.println("startTime: " + startTime);

    //Clean up old weather data 
    //**********************************************************************
    FileSystemTools.cleanupOldWeatherData(daysToStoreWeatherData);

    //Google query
    //**********************************************************************
    if (gShare.equals("")) {
        Scanner input = new Scanner(System.in);
        System.out.println("Paste Google Directions Share:");
        gShare = input.nextLine();
    }
    String gQuery = Parser.getQueryFromShare(gShare);
    System.out.println("Google query URL: " + gQuery);

    //Check if we already have this route
    //Valid only if the route option is 0 (default)
    //Because otherwise we cannot be sure we already have the optional route
    List<routeStep> gSteps = new ArrayList<>();
    if (FileSystemTools.isSavedRoute(gQuery) && gRouteOption == 0) {
        System.out.println("Route found from saved list. Loading.");
        gSteps = FileSystemTools.loadSavedRoute(gQuery);
    } else {
        gSteps = Parser.getSteps(gQuery);
        if (gRouteOption == 0) {
            System.out.println("Saving new route to list.");
            FileSystemTools.saveRoute(gQuery, gSteps);
        }
    }

    //Compile route table with current settings
    //**********************************************************************
    List<routeStep> routeData = RouteTools.compileRoute(gSteps, refreshInterval);
    String endTime = df_short.format(new Date(startTimeMillis + routeDur * 1000));
    System.out.println("endTime: " + endTime);
    //Forecast from FMI is only for 48h - warning if we are going over
    //Or is it 54h? http://ilmatieteenlaitos.fi/avoin-data-saaennustedata-hirlam
    if (((startTimeMillis + routeDur * 1000) - System.currentTimeMillis()) / (1000 * 60 * 60) > 48) {
        System.out.println("**************************************************" + newLine + "WARNING:" + newLine
                + "Weather forecast available only for 48 hours" + newLine
                + "**************************************************");
    }

    //Prepare time and file variables
    //**********************************************************************
    String nowAsISO = df_iso.format(new Date());
    System.out.println("Start ISO time: " + nowAsISO);
    double timeMarginal = routeDur * 1.2 + 3600;
    String endTimeForFmi = df_iso.format(new Date(startTimeMillis + (intValue(timeMarginal)) * 1000));
    String endTimeForFile = df_iso.format(new Date(startTimeMillis + (intValue(routeDur + 3600)) * 1000));
    System.out.println("End ISO time:   " + endTimeForFmi);
    String fmiParam = new StringBuilder("&starttime=").append(nowAsISO).append("&endtime=")
            .append(endTimeForFmi).toString();
    File weatherDataFileNameFirst = new File("weather" + nowAsISO.replaceAll("[^A-Za-z0-9 ]", "") + ".txt");
    File weatherDataFileNameLast = new File("weather" + endTimeForFmi.replaceAll("[^A-Za-z0-9 ]", "") + ".txt");
    File weatherDataFileNameStart = new File(
            "weather" + (df_iso.format(new Date(startTimeMillis))).replaceAll("[^A-Za-z0-9 ]", "") + ".txt");
    File weatherDataFileNameEnd = new File("weather" + endTimeForFile.replaceAll("[^A-Za-z0-9 ]", "") + ".txt");
    List<stationData> allStations = new ArrayList<>();
    List<stationData> fmiData = new ArrayList<>();
    List<String> savedFileTimes = new ArrayList<>();

    //**********************************************************************
    //Check if we already have the weather data
    //**********************************************************************
    if (!weatherDataFileNameStart.exists() || !weatherDataFileNameEnd.exists()) {
        //FMI query
        //**********************************************************************
        String fmiCities = new StringBuilder(fmiBase).append(fmiKey).append(fmiMiddle).append(fmiQueryCities)
                .append(fmiParam).toString();
        String fmiObsStations = new StringBuilder(fmiBase).append(fmiKey).append(fmiMiddle)
                .append(fmiQueryObsStations).append(fmiParam).toString();
        //System.out.println("FMI cities URL: "+fmiCities);
        //System.out.println("FMI obsstations URL: "+fmiObsStations);

        //Collect weather data from FMI
        //**********************************************************************
        System.out.print("FMI data:" + newLine + fmiCities + newLine + "Loading and processing...");
        fmiData.addAll(Parser.getStations(fmiCities));
        System.out.println("SUCCESS.");
        System.out.print("FMI data:" + newLine + fmiObsStations + newLine + "Loading and processing...");
        fmiData.addAll(Parser.getStations(fmiObsStations));
        System.out.println("SUCCESS.");

        //Get unique stations
        //**********************************************************************
        List<stationData> uniqueStations = ToolBox.getUniqueStations(fmiData);
        System.out.println("Parsed stations count: " + uniqueStations.size());

        //Save or load stations
        //**********************************************************************
        List<stationData> savedStations = new ArrayList<>();
        if (!stationFileName.exists()) {
            //Save current parsed stations to file
            FileSystemTools.saveObjectToFile(uniqueStations, stationFileName);
        } else {
            //Or if the stations were already saved, load them
            System.out.println("Station information file found: " + stationFileName);
            System.out.print("Loading...");
            savedStations = FileSystemTools.loadStationsFromFile(stationFileName);
            System.out.println("DONE.");
            System.out.println("Loaded stations count: " + savedStations.size());
        }

        //Merge station information
        //**********************************************************************
        System.out.println("Merging station information.");
        savedStations.addAll(uniqueStations);
        allStations = ToolBox.getUniqueStations(savedStations);
        System.out.println("Merged stations count: " + allStations.size());

        //Find names for stations
        //**********************************************************************
        String gMapsGeoCode = "https://maps.googleapis.com/maps/api/geocode/xml?latlng=";
        //for (stationData station : allStations){
        for (int i = 0; i < allStations.size(); i++) {
            if (allStations.get(i).stationName.equals("")) {
                gQuery = new StringBuilder(gMapsGeoCode).append(allStations.get(i).stationLocation.Lat)
                        .append(",").append(allStations.get(i).stationLocation.Lon).append("&key=").append(gKey)
                        .toString();
                System.out.println("Google query URL: " + gQuery);

                allStations.get(i).stationName = Parser.getStationName(gQuery);
            }
        }
        //System.out.println("Station names parsed.");
        Collections.sort(allStations);

        //Print stations and separate them for saving
        //**********************************************************************
        List<stationData> onlyStations = new ArrayList<>();
        //int indeksi = 0;
        List<weatherData> weatherPoint = new ArrayList<>();
        weatherPoint.add(0, new weatherData("", "", ""));
        for (stationData station : allStations) {
            //System.out.format("%-4s%-30s%-10s%-10s%n",
            //                    indeksi,station.stationName,station.stationLocation.Lat,station.stationLocation.Lon);
            //++indeksi;
            onlyStations.add(new stationData(station.stationLocation, station.stationName, weatherPoint));
        }

        //Save station names
        //**********************************************************************
        System.out.println("Saving station names.");
        FileSystemTools.saveObjectToFile(onlyStations, stationFileName);

        //Save weather dataset
        //**********************************************************************
        //Compute file names between start and end
        System.out.println("Saving weather data...");
        long currentTimeAsDouble = System.currentTimeMillis();
        int hoursPassed = intValue(Math.floor(currentTimeAsDouble - startTimeMillis) / 1000 / 60 / 60);
        File weatherDataFileNameTemp = weatherDataFileNameFirst;
        while (!weatherDataFileNameTemp.equals(weatherDataFileNameLast)) {
            String savedFileTime = df_iso.format(new Date(startTimeMillis + ((hoursPassed * 3600) * 1000)));
            savedFileTimes.add(savedFileTime);
            weatherDataFileNameTemp = new File(
                    "weather" + savedFileTime.replaceAll("[^A-Za-z0-9 ]", "") + ".txt");
            //System.out.println("Weather data file: "+weatherDataFileNameTemp);
            //This if we don't actually maybe want
            //if (!weatherDataFileNameTemp.exists()){
            List<stationData> thisHourWeather = FileSystemTools.extractHourOfWeatherData(savedFileTime,
                    fmiData);
            //System.out.println("Saving: "+weatherDataFileNameTemp);
            FileSystemTools.saveObjectToFile(thisHourWeather, weatherDataFileNameTemp);
            //}
            ++hoursPassed;
        }
    }
    //If we have weather data saved, definitely we have the stations also
    //**********************************************************************
    else {
        System.out.println("Loading weather data...");
        File weatherDataFileNameTemp = weatherDataFileNameStart;
        int hoursPassed = 0;
        while (!weatherDataFileNameTemp.equals(weatherDataFileNameEnd)) {
            String savedFileTime = df_iso.format(new Date(startTimeMillis + ((hoursPassed * 3600) * 1000)));
            savedFileTimes.add(savedFileTime);
            weatherDataFileNameTemp = new File(
                    "weather" + savedFileTime.replaceAll("[^A-Za-z0-9 ]", "") + ".txt");
            System.out.println("Weather data file: " + weatherDataFileNameTemp);
            if (weatherDataFileNameTemp.exists()) {
                fmiData.addAll(FileSystemTools.loadStationsFromFile(weatherDataFileNameTemp));
            }
            ++hoursPassed;
        }
        allStations = FileSystemTools.loadStationsFromFile(stationFileName);
        System.out.println("DONE.");
    }

    //Find closest weather stations in route points and extract their data
    //**********************************************************************
    System.out.println("Calculating nearest stations in route points:");
    List<Integer> neededStations = new ArrayList<>();
    for (routeStep step : routeData) {
        distance[] stationDistances = RouteTools.calculateStationDistances(step.StartLocation, allStations);
        System.out.format("%-6s%.5f, %.5f  ", "Step: ", step.StartLocation.Lat, step.StartLocation.Lon);
        for (int i = 0; i < 1; i++) {
            System.out.format("%-9s%-5s%-20s%.5f%n", "Station: ", stationDistances[i].stationNum,
                    allStations.get(stationDistances[i].stationNum).stationName,
                    stationDistances[i].stationDistance);
        }
        neededStations.add(stationDistances[0].stationNum);
    }
    System.out.println("Needed stations: " + neededStations.toString().trim());
    //Remove duplicates from needed stations list
    Set<Integer> uniqueEntries = new HashSet<Integer>(neededStations);
    //Extract weather data from needed stations
    Map routeWeather = Collections.synchronizedMap(new HashMap());
    routeWeather = WeatherTools.extractNeededStations(uniqueEntries, fmiData, allStations);

    //Find what fields we have
    List<String> allParameters = new ArrayList<>();
    for (int i = 0; i < fmiData.size(); ++i) {
        allParameters.add(fmiData.get(i).weatherData.get(0).parameterName);
    }
    Set<String> uniqueParameters = new HashSet<String>(allParameters);
    for (String par : uniqueParameters) {
        for (Integer num : uniqueEntries) {
            for (String time : savedFileTimes) {
                //System.out.format("%-5s%-25s%-35s%s%n",num,time,par,routeWeather.get(num+"-"+time+"-"+par));
            }
        }
    }

    // Build the final data table
    //**********************************************************************
    List<stepWeather> stepDataBase = new ArrayList<>();
    stepDataBase = RouteTools.combineRouteDatabase(routeData, neededStations, allStations);

    //Find sunrise and sunset times during the route
    //**********************************************************************
    List<String> sunEvents = DayLightTime.calculateSunEvents(stepDataBase);
    for (String s : sunEvents) {
        System.out.println(s.replaceAll(",", "."));
    }

    //Make a webpage to show the weather data
    //**********************************************************************
    WeatherTools.makeResultHtml(stepDataBase, allStations, routeWeather, sunEvents);
}

From source file:edu.usf.cutr.opentripplanner.android.fragments.MainFragment.java

/**
 * Writes coordinates of latlng to the selected text box.
 *
 * @param latlng    object containing the coordinates to set
 * @param isStartTb when true start text box is set otherwise end text box
 *///from  w  w  w .j  a  va2 s.c  om
private void setLocationTb(LatLng latlng, boolean isStartTb) {
    DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols();
    decimalFormatSymbols.setDecimalSeparator('.');
    DecimalFormat decimalFormat = new DecimalFormat(OTPApp.FORMAT_COORDINATES, decimalFormatSymbols);
    if (isStartTb) {
        setTextBoxLocation(
                decimalFormat.format(latlng.latitude) + ", " + decimalFormat.format(latlng.longitude), true);
    } else {
        setTextBoxLocation(
                decimalFormat.format(latlng.latitude) + ", " + decimalFormat.format(latlng.longitude), false);
    }
}

From source file:org.openbravo.erpCommon.utility.Utility.java

/**
 * Returns a DecimalFormat for the given formatting type contained in the Format.xml file
 */// w w  w. j ava 2 s.c o m
public static DecimalFormat getFormat(VariablesSecureApp vars, String typeName) {
    String format = vars.getSessionValue("#FormatOutput|" + typeName);
    String decimal = vars.getSessionValue("#DecimalSeparator|" + typeName);
    String group = vars.getSessionValue("#GroupSeparator|" + typeName);
    DecimalFormat numberFormatDecimal = null;
    if (format != null && !format.equals("") && decimal != null && !decimal.equals("") && group != null
            && !group.equals("")) {
        DecimalFormatSymbols dfs = new DecimalFormatSymbols();
        dfs.setDecimalSeparator(decimal.charAt(0));
        dfs.setGroupingSeparator(group.charAt(0));
        numberFormatDecimal = new DecimalFormat(format, dfs);
    }
    return numberFormatDecimal;
}

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

/**
 * Initializes the controller class./*from   w  ww .j  a  v a 2  s  . c o m*/
 */
@Override
public void initialize(URL url, ResourceBundle rb) {

    this.resourceBundle = rb;

    viewer3DPanelController.setResourceBundle(rb);

    initStrings(rb);

    colorPickerSeries.valueProperty().addListener(new ChangeListener<javafx.scene.paint.Color>() {
        @Override
        public void changed(ObservableValue<? extends javafx.scene.paint.Color> observable,
                javafx.scene.paint.Color oldValue, javafx.scene.paint.Color newValue) {
            if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() == 1) {
                listViewVoxelsFilesChart.getSelectionModel().getSelectedItem().getSeriesParameters()
                        .setColor(new Color((float) newValue.getRed(), (float) newValue.getGreen(),
                                (float) newValue.getBlue(), 1.0f));
            }
        }
    });

    comboboxScript.getItems().setAll("Daniel script");

    vboxWeighting.disableProperty().bind(checkboxEnableWeighting.selectedProperty().not());

    checkboxEnableWeighting.selectedProperty().addListener(new ChangeListener<Boolean>() {
        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue && textAreaWeighting.getText().isEmpty()) {

                int selectedVoxTab = tabPaneVoxelisation.getSelectionModel().getSelectedIndex();

                if (selectedVoxTab == 0) { //ALS
                    fillWeightingData(EchoesWeightParams.DEFAULT_ALS_WEIGHTING);
                } else if (selectedVoxTab == 1) { //TLS
                    fillWeightingData(EchoesWeightParams.DEFAULT_TLS_WEIGHTING);
                }
            }
        }
    });

    /*comboboxTransMode.getItems().setAll(1, 2, 3);
    comboboxTransMode.getSelectionModel().selectFirst();
            
    comboboxPathLengthMode.getItems().setAll("A", "B");
    comboboxPathLengthMode.getSelectionModel().selectFirst();*/

    helpButtonNaNsCorrection.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            helpButtonNaNsCorrectionController.showHelpDialog(resourceBundle.getString("help_NaNs_correction"));
        }
    });

    helpButtonAutoBBox.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            helpButtonAutoBBoxController.showHelpDialog(resourceBundle.getString("help_bbox"));
        }
    });

    helpButtonHemiPhoto.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            helpButtonHemiPhotoController.showHelpDialog(resourceBundle.getString("help_hemiphoto"));
        }
    });

    buttonHelpEmptyShotsFilter.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            buttonHelpEmptyShotsFilterController
                    .showHelpDialog(resourceBundle.getString("help_empty_shots_filter"));
        }
    });

    /*work around, the divider positions values are defined in the fxml,
    but when the window is initialized the values are lost*/
    Platform.runLater(new Runnable() {
        @Override
        public void run() {
            splitPaneMain.setDividerPositions(0.75f);
            splitPaneVoxelization.setDividerPositions(0.45f);
        }
    });

    initValidationSupport();
    initPostProcessTab();

    listViewTransmittanceMapSensorPositions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    listViewTaskList.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    MenuItem menuItemPadValue1m = new MenuItem("1m voxel size");
    addMenuItemPadValue(menuItemPadValue1m, 3.536958f);

    MenuItem menuItemPadValue2m = new MenuItem("2m voxel size");
    addMenuItemPadValue(menuItemPadValue2m, 2.262798f);

    MenuItem menuItemPadValue3m = new MenuItem("3m voxel size");
    addMenuItemPadValue(menuItemPadValue3m, 1.749859f);

    MenuItem menuItemPadValue4m = new MenuItem("4m voxel size");
    addMenuItemPadValue(menuItemPadValue4m, 1.3882959f);

    MenuItem menuItemPadValue5m = new MenuItem("5m voxel size");
    addMenuItemPadValue(menuItemPadValue5m, 1.0848f);

    menuButtonAdvisablePADMaxValues.getItems().addAll(menuItemPadValue1m, menuItemPadValue2m,
            menuItemPadValue3m, menuItemPadValue4m, menuItemPadValue5m);

    fileChooserSaveCanopyAnalyserOutputFile = new FileChooserContext();
    fileChooserSaveCanopyAnalyserCfgFile = new FileChooserContext();
    fileChooserSaveTransmittanceSimCfgFile = new FileChooserContext();
    fileChooserOpenCanopyAnalyserInputFile = new FileChooserContext();
    listViewCanopyAnalyzerSensorPositions.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    ContextMenu contextMenuProductsList = new ContextMenu();
    MenuItem openImageItem = new MenuItem(RS_STR_OPEN_IMAGE);
    openImageItem.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            File selectedFile = listViewProductsFiles.getSelectionModel().getSelectedItem();

            showImage(selectedFile);
        }
    });

    Menu menuEdit = new Menu(RS_STR_EDIT);

    MenuItem menuItemEditVoxels = new MenuItem("Remove voxels (delete key)");
    MenuItem menuItemFitToContent = new MenuItem("Fit to content");
    MenuItem menuItemCrop = new MenuItem("Crop");

    menuEdit.getItems().setAll(menuItemEditVoxels, menuItemFitToContent, menuItemCrop);

    menuItemFitToContent.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {
            File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem();

            if (selectedItem != null) {
                fitVoxelSpaceToContent(selectedItem);
            }
        }
    });

    menuItemEditVoxels.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {

            File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem();

            if (selectedItem != null) {
                editVoxelSpace(selectedItem);
            }
        }
    });

    menuItemCrop.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {

            File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem();

            if (selectedItem != null) {
                try {
                    voxelSpaceCroppingFrameController.setVoxelFile(selectedItem);
                    voxelSpaceCroppingFrame.show();
                } catch (Exception ex) {
                    showErrorDialog(ex);
                }
            }
        }
    });

    Menu menuExport = new Menu(RS_STR_EXPORT);
    MenuItem menuItemExportDartMaket = new MenuItem("Dart (maket.txt)");
    MenuItem menuItemExportDartPlots = new MenuItem("Dart (plots.xml)");
    MenuItem menuItemExportMeshObj = new MenuItem("Mesh (*.obj)");

    menuItemExportDartMaket.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {

            File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem();

            if (selectedItem != null) {
                exportDartMaket(selectedItem);
            }
        }
    });

    menuItemExportDartPlots.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {

            File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem();

            if (selectedItem != null) {
                exportDartPlots(selectedItem);
            }
        }
    });

    menuItemExportMeshObj.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {

            File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem();

            if (selectedItem != null) {
                exportMeshObj(selectedItem);
            }
        }
    });

    menuExport.getItems().setAll(menuItemExportDartMaket, menuItemExportDartPlots, menuItemExportMeshObj);

    MenuItem menuItemInfo = new MenuItem(RS_STR_INFO);

    menuItemInfo.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {

            Alert alert = new Alert(AlertType.INFORMATION);

            File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem();

            if (selectedItem != null) {
                VoxelFileReader reader;
                try {
                    reader = new VoxelFileReader(selectedItem);
                    VoxelSpaceInfos voxelSpaceInfos = reader.getVoxelSpaceInfos();
                    alert.setTitle("Information");
                    alert.setHeaderText("Voxel space informations");
                    alert.setContentText(voxelSpaceInfos.toString());
                    alert.show();
                } catch (Exception ex) {
                    showErrorDialog(ex);
                }

            }
        }
    });

    final MenuItem menuItemOpenContainingFolder = new MenuItem(RS_STR_OPEN_CONTAINING_FOLDER);

    menuItemOpenContainingFolder.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent event) {

            final File selectedItem = listViewProductsFiles.getSelectionModel().getSelectedItem();

            if (selectedItem != null) {
                if (Desktop.isDesktopSupported()) {
                    new Thread(() -> {
                        try {
                            Desktop.getDesktop().open(selectedItem.getParentFile());
                        } catch (IOException ex) {
                            logger.error("Cannot open directory " + selectedItem);
                        }
                    }).start();
                }

            }

        }
    });

    listViewProductsFiles.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {
        @Override
        public void handle(ContextMenuEvent event) {

            if (listViewProductsFiles.getSelectionModel().getSelectedIndices().size() == 1) {

                File selectedFile = listViewProductsFiles.getSelectionModel().getSelectedItem();
                String extension = FileManager.getExtension(selectedFile);

                switch (extension) {
                case ".png":
                case ".bmp":
                case ".jpg":
                    contextMenuProductsList.getItems().setAll(openImageItem, menuItemOpenContainingFolder);
                    contextMenuProductsList.show(listViewProductsFiles, event.getScreenX(), event.getScreenY());
                    break;
                case ".vox":

                default:
                    if (VoxelFileReader.isFileAVoxelFile(selectedFile)) {
                        contextMenuProductsList.getItems().setAll(menuItemInfo, menuItemOpenContainingFolder,
                                menuEdit, menuExport);
                        contextMenuProductsList.show(listViewProductsFiles, event.getScreenX(),
                                event.getScreenY());
                    }
                }

            }

        }
    });

    ContextMenu contextMenuLidarScanEdit = new ContextMenu();
    MenuItem editItem = new MenuItem("Edit");

    editItem.setOnAction(new EventHandler<ActionEvent>() {

        @Override
        public void handle(ActionEvent event) {

            filterFrameController.setFilters("Reflectance", "Deviation", "Amplitude");
            filterFrame.show();

            filterFrame.setOnHidden(new EventHandler<WindowEvent>() {

                @Override
                public void handle(WindowEvent event) {

                    if (filterFrameController.getFilter() != null) {
                        ObservableList<LidarScan> items = listViewHemiPhotoScans.getSelectionModel()
                                .getSelectedItems();
                        for (LidarScan scan : items) {
                            scan.filters.add(filterFrameController.getFilter());
                        }
                    }
                }
            });
        }
    });

    contextMenuLidarScanEdit.getItems().add(editItem);

    listViewHemiPhotoScans.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
    listViewHemiPhotoScans.setOnContextMenuRequested(new EventHandler<ContextMenuEvent>() {

        @Override
        public void handle(ContextMenuEvent event) {
            contextMenuLidarScanEdit.show(listViewHemiPhotoScans, event.getScreenX(), event.getScreenY());
        }
    });

    /**LAD tab initialization**/
    comboboxLADChoice.getItems().addAll(LeafAngleDistribution.Type.UNIFORM, LeafAngleDistribution.Type.SPHERIC,
            LeafAngleDistribution.Type.ERECTOPHILE, LeafAngleDistribution.Type.PLANOPHILE,
            LeafAngleDistribution.Type.EXTREMOPHILE, LeafAngleDistribution.Type.PLAGIOPHILE,
            LeafAngleDistribution.Type.HORIZONTAL, LeafAngleDistribution.Type.VERTICAL,
            LeafAngleDistribution.Type.ELLIPSOIDAL, LeafAngleDistribution.Type.ELLIPTICAL,
            LeafAngleDistribution.Type.TWO_PARAMETER_BETA);

    comboboxLADChoice.getSelectionModel().select(LeafAngleDistribution.Type.SPHERIC);
    comboboxLADChoice.getSelectionModel().selectedItemProperty()
            .addListener(new ChangeListener<LeafAngleDistribution.Type>() {

                @Override
                public void changed(ObservableValue<? extends LeafAngleDistribution.Type> observable,
                        LeafAngleDistribution.Type oldValue, LeafAngleDistribution.Type newValue) {

                    if (newValue == LeafAngleDistribution.Type.TWO_PARAMETER_BETA
                            || newValue == LeafAngleDistribution.Type.ELLIPSOIDAL) {

                        hboxTwoBetaParameters.setVisible(true);

                        if (newValue == LeafAngleDistribution.Type.ELLIPSOIDAL) {
                            labelLADBeta.setVisible(false);
                        } else {
                            labelLADBeta.setVisible(true);
                        }
                    } else {
                        hboxTwoBetaParameters.setVisible(false);
                    }
                }
            });

    ToggleGroup ladTypeGroup = new ToggleGroup();
    radiobuttonLADHomogeneous.setToggleGroup(ladTypeGroup);
    radiobuttonLADLocalEstimation.setToggleGroup(ladTypeGroup);

    /**CHART panel initialization**/

    ToggleGroup profileChartType = new ToggleGroup();
    radiobuttonPreDefinedProfile.setToggleGroup(profileChartType);
    radiobuttonFromVariableProfile.setToggleGroup(profileChartType);

    ToggleGroup profileChartRelativeHeightType = new ToggleGroup();
    radiobuttonHeightFromAboveGround.setToggleGroup(profileChartRelativeHeightType);
    radiobuttonHeightFromBelowCanopy.setToggleGroup(profileChartRelativeHeightType);

    comboboxFromVariableProfile.disableProperty().bind(radiobuttonPreDefinedProfile.selectedProperty());
    comboboxPreDefinedProfile.disableProperty().bind(radiobuttonFromVariableProfile.selectedProperty());

    hboxMaxPADVegetationProfile.visibleProperty().bind(radiobuttonPreDefinedProfile.selectedProperty());

    listViewVoxelsFilesChart.getSelectionModel().selectedIndexProperty()
            .addListener(new ChangeListener<Number>() {

                @Override
                public void changed(ObservableValue<? extends Number> observable, Number oldValue,
                        Number newValue) {

                    if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() > 1) {
                        colorPickerSeries.setDisable(true);
                    } else if (listViewVoxelsFilesChart.getSelectionModel().getSelectedItems().size() == 1) {

                        VoxelFileChart selectedItem = listViewVoxelsFilesChart.getSelectionModel()
                                .getSelectedItem();
                        Color selectedItemColor = selectedItem.getSeriesParameters().getColor();

                        colorPickerSeries.setDisable(false);
                        colorPickerSeries.setValue(new javafx.scene.paint.Color(
                                selectedItemColor.getRed() / 255.0, selectedItemColor.getGreen() / 255.0,
                                selectedItemColor.getBlue() / 255.0, 1.0));

                        if (newValue.intValue() >= 0) {
                            textfieldLabelVoxelFileChart.setText(
                                    listViewVoxelsFilesChart.getItems().get(newValue.intValue()).label);
                        }
                    }
                }
            });

    textfieldLabelVoxelFileChart.textProperty().addListener(new ChangeListener<String>() {

        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {

            if (listViewVoxelsFilesChart.getSelectionModel().getSelectedIndex() >= 0) {
                listViewVoxelsFilesChart.getSelectionModel().getSelectedItem().label = newValue;
            }
        }
    });

    listViewVoxelsFilesChart.getItems().addListener(new ListChangeListener<VoxelFileChart>() {

        @Override
        public void onChanged(ListChangeListener.Change<? extends VoxelFileChart> c) {

            while (c.next()) {
            }

            if (c.wasAdded() && c.getAddedSize() == c.getList().size()) {

                try {
                    VoxelFileReader reader = new VoxelFileReader(c.getList().get(0).file);
                    String[] columnNames = reader.getVoxelSpaceInfos().getColumnNames();
                    comboboxFromVariableProfile.getItems().clear();
                    comboboxFromVariableProfile.getItems().addAll(columnNames);
                    comboboxFromVariableProfile.getSelectionModel().selectFirst();
                } catch (Exception ex) {
                    logger.error("Cannot read voxel file", ex);
                }
            }

        }
    });

    anchorpaneQuadrats.disableProperty().bind(checkboxMakeQuadrats.selectedProperty().not());

    comboboxSelectAxisForQuadrats.getItems().addAll("X", "Y", "Z");
    comboboxSelectAxisForQuadrats.getSelectionModel().select(1);

    comboboxPreDefinedProfile.getItems().addAll("Vegetation (PAD)");
    comboboxPreDefinedProfile.getSelectionModel().selectFirst();

    radiobuttonSplitCountForQuadrats.selectedProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            textFieldSplitCountForQuadrats.setDisable(!newValue);
            textFieldLengthForQuadrats.setDisable(newValue);
        }
    });

    ToggleGroup chartMakeQuadratsSplitType = new ToggleGroup();
    radiobuttonLengthForQuadrats.setToggleGroup(chartMakeQuadratsSplitType);
    radiobuttonSplitCountForQuadrats.setToggleGroup(chartMakeQuadratsSplitType);

    /**Virtual measures panel initialization**/

    comboboxHemiPhotoBitmapOutputMode.getItems().addAll("Pixel", "Color");
    comboboxHemiPhotoBitmapOutputMode.getSelectionModel().selectFirst();

    ToggleGroup virtualMeasuresChoiceGroup = new ToggleGroup();

    toggleButtonLAI2000Choice.setToggleGroup(virtualMeasuresChoiceGroup);
    toggleButtonLAI2200Choice.setToggleGroup(virtualMeasuresChoiceGroup);

    comboboxChooseCanopyAnalyzerSampling.getItems().setAll(500, 4000, 10000);
    comboboxChooseCanopyAnalyzerSampling.getSelectionModel().selectFirst();

    initEchoFiltering();

    data = FXCollections.observableArrayList();

    tableViewSimulationPeriods.setItems(data);
    tableViewSimulationPeriods.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    comboboxChooseDirectionsNumber.getItems().addAll(1, 6, 16, 46, 136, 406);
    comboboxChooseDirectionsNumber.getSelectionModel().select(4);

    ToggleGroup scannerPositionsMode = new ToggleGroup();

    /*radiobuttonScannerPosSquaredArea.setToggleGroup(scannerPositionsMode);
    radiobuttonScannerPosFile.setToggleGroup(scannerPositionsMode);*/

    tableColumnPeriod.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<SimulationPeriod, String>, ObservableValue<String>>() {

                @Override
                public ObservableValue<String> call(
                        TableColumn.CellDataFeatures<SimulationPeriod, String> param) {
                    return new SimpleStringProperty(param.getValue().getPeriod().toString());
                }
            });

    tableColumnClearness.setCellValueFactory(
            new Callback<TableColumn.CellDataFeatures<SimulationPeriod, String>, ObservableValue<String>>() {

                @Override
                public ObservableValue<String> call(
                        TableColumn.CellDataFeatures<SimulationPeriod, String> param) {
                    return new SimpleStringProperty(String.valueOf(param.getValue().getClearnessCoefficient()));
                }
            });

    checkboxMultiFiles.selectedProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            anchorpaneBoundingBoxParameters.setDisable(newValue);
        }
    });

    hboxGenerateBitmapFiles.disableProperty().bind(checkboxGenerateBitmapFile.selectedProperty().not());
    hboxGenerateTextFile.disableProperty().bind(checkboxGenerateTextFile.selectedProperty().not());

    fileChooserOpenConfiguration = new FileChooser();
    fileChooserOpenConfiguration.setTitle("Choose configuration file");

    fileChooserSaveConfiguration = new FileChooserContext("cfg.xml");
    fileChooserSaveConfiguration.fc.setTitle("Choose output file");

    fileChooserOpenInputFileALS = new FileChooser();
    fileChooserOpenInputFileALS.setTitle("Open input file");
    fileChooserOpenInputFileALS.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Shot files", "*.sht"), new ExtensionFilter("Text Files", "*.txt"),
            new ExtensionFilter("Las Files", "*.las", "*.laz"));

    fileChooserOpenTrajectoryFileALS = new FileChooser();
    fileChooserOpenTrajectoryFileALS.setTitle("Open trajectory file");
    fileChooserOpenTrajectoryFileALS.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Text Files", "*.txt"));

    fileChooserOpenOutputFileALS = new FileChooser();
    fileChooserOpenOutputFileALS.setTitle("Choose output file");

    fileChooserOpenInputFileTLS = new FileChooserContext();
    fileChooserOpenInputFileTLS.fc.setTitle("Open input file");
    fileChooserOpenInputFileTLS.fc.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Text Files", "*.txt"), new ExtensionFilter("Rxp Files", "*.rxp"),
            new ExtensionFilter("Project Rsp Files", "*.rsp"));

    directoryChooserOpenOutputPathTLS = new DirectoryChooser();
    directoryChooserOpenOutputPathTLS.setTitle("Choose output path");

    directoryChooserOpenOutputPathALS = new DirectoryChooser();
    directoryChooserOpenOutputPathALS.setTitle("Choose output path");

    fileChooserSaveOutputFileTLS = new FileChooser();
    fileChooserSaveOutputFileTLS.setTitle("Save voxel file");

    fileChooserSaveTransmittanceTextFile = new FileChooser();
    fileChooserSaveTransmittanceTextFile.setTitle("Save text file");

    directoryChooserSaveTransmittanceBitmapFile = new DirectoryChooser();
    directoryChooserSaveTransmittanceBitmapFile.setTitle("Choose output directory");

    fileChooserSaveHemiPhotoOutputBitmapFile = new FileChooserContext("*.png");
    fileChooserSaveHemiPhotoOutputBitmapFile.fc.setTitle("Save bitmap file");

    directoryChooserSaveHemiPhotoOutputBitmapFile = new DirectoryChooser();
    directoryChooserSaveHemiPhotoOutputBitmapFile.setTitle("Choose bitmap files output directory");

    directoryChooserSaveHemiPhotoOutputTextFile = new DirectoryChooser();
    directoryChooserSaveHemiPhotoOutputTextFile.setTitle("Choose text files output directory");

    fileChooserSaveHemiPhotoOutputTextFile = new FileChooser();
    fileChooserSaveHemiPhotoOutputTextFile.setTitle("Save text file");

    fileChooserOpenVoxelFile = new FileChooser();
    fileChooserOpenVoxelFile.setTitle("Open voxel file");
    fileChooserOpenVoxelFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Voxel Files", "*.vox"));

    fileChooserOpenPopMatrixFile = new FileChooser();
    fileChooserOpenPopMatrixFile.setTitle("Choose matrix file");
    fileChooserOpenPopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Text Files", "*.txt"));

    fileChooserOpenSopMatrixFile = new FileChooser();
    fileChooserOpenSopMatrixFile.setTitle("Choose matrix file");
    fileChooserOpenSopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Text Files", "*.txt"));

    fileChooserOpenVopMatrixFile = new FileChooser();
    fileChooserOpenVopMatrixFile.setTitle("Choose matrix file");
    fileChooserOpenVopMatrixFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Text Files", "*.txt"));

    fileChooserOpenPonderationFile = new FileChooser();
    fileChooserOpenPonderationFile.setTitle("Choose ponderation file");
    fileChooserOpenPonderationFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Text Files", "*.txt"));

    fileChooserOpenDTMFile = new FileChooser();
    fileChooserOpenDTMFile.setTitle("Choose DTM file");
    fileChooserOpenDTMFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("DTM Files", "*.asc"));

    fileChooserOpenPointCloudFile = new FileChooser();
    fileChooserOpenPointCloudFile.setTitle("Choose point cloud file");
    fileChooserOpenPointCloudFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("TXT Files", "*.txt"));

    fileChooserOpenMultiResVoxelFile = new FileChooser();
    fileChooserOpenMultiResVoxelFile.setTitle("Choose voxel file");
    fileChooserOpenMultiResVoxelFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Voxel Files", "*.vox"));

    fileChooserOpenOutputFileMultiRes = new FileChooser();
    fileChooserOpenOutputFileMultiRes.setTitle("Save voxel file");

    fileChooserAddTask = new FileChooser();
    fileChooserAddTask.setTitle("Choose parameter file");
    fileChooserAddTask.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("XML Files", "*.xml"));

    fileChooserSaveDartFile = new FileChooser();
    fileChooserSaveDartFile.setTitle("Save dart file (.maket)");
    fileChooserSaveDartFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Maket File", "*.maket"));

    fileChooserOpenOutputFileMerging = new FileChooser();
    fileChooserOpenOutputFileMerging.setTitle("Choose voxel file");
    fileChooserOpenOutputFileMerging.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("Voxel Files", "*.vox"));

    fileChooserOpenScriptFile = new FileChooser();
    fileChooserOpenScriptFile.setTitle("Choose script file");

    fileChooserSaveGroundEnergyOutputFile = new FileChooser();
    fileChooserSaveGroundEnergyOutputFile.setTitle("Save ground energy file");

    fileChooserOpenPointsPositionFile = new FileChooser();
    fileChooserOpenPointsPositionFile.setTitle("Choose points file");
    fileChooserOpenPointsPositionFile.getExtensionFilters().addAll(new ExtensionFilter("All Files", "*"),
            new ExtensionFilter("TXT Files", "*.txt"));

    try {
        viewCapsSetupFrame = new Stage();
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/ViewCapsSetupFrame.fxml"));
        Parent root = loader.load();
        viewCapsSetupFrameController = loader.getController();
        viewCapsSetupFrame.setScene(new Scene(root));
    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/FilteringPaneComponent.fxml"));
        anchorPaneEchoFilteringRxp = loader.load();
        filteringPaneController = loader.getController();
        filteringPaneController.setFiltersNames("Reflectance", "Amplitude", "Deviation");
    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    try {
        positionImporterFrame = new Stage();
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/PositionImporterFrame.fxml"));
        Parent root = loader.load();
        positionImporterFrameController = loader.getController();
        positionImporterFrame.setScene(new Scene(root));
        positionImporterFrameController.setStage(positionImporterFrame);
    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    try {
        voxelSpaceCroppingFrame = new Stage();
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/VoxelSpaceCroppingFrame.fxml"));
        Parent root = loader.load();
        voxelSpaceCroppingFrameController = loader.getController();
        voxelSpaceCroppingFrame.setScene(new Scene(root));
    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    try {
        attributsImporterFrame = new Stage();
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/AttributsImporterFrame.fxml"));
        Parent root = loader.load();
        attributsImporterFrameController = loader.getController();
        attributsImporterFrame.setScene(new Scene(root));
        attributsImporterFrameController.setStage(attributsImporterFrame);
    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    try {
        textFileParserFrameController = TextFileParserFrameController.getInstance();
    } catch (Exception ex) {
        logger.error("Cannot load fxml file", ex);
    }

    try {
        transformationFrameController = TransformationFrameController.getInstance();
        transformationFrame = transformationFrameController.getStage();
    } catch (Exception ex) {
        logger.error("Cannot load fxml file", ex);
    }

    updaterFrame = new Stage();

    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/update/UpdaterFrame.fxml"));
        Parent root = loader.load();
        updaterFrameController = loader.getController();
        updaterFrame.setScene(new Scene(root));

    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    riscanProjectExtractor = new RiscanProjectExtractor();
    ptxProjectExtractor = new PTXProjectExtractor();
    ptgProjectExtractor = new PTGProjectExtractor();

    dateChooserFrame = new Stage();

    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/DateChooserFrame.fxml"));
        Parent root = loader.load();
        dateChooserFrameController = loader.getController();
        dateChooserFrame.setScene(new Scene(root));
        dateChooserFrameController.setStage(dateChooserFrame);
    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    comboboxModeALS.getItems().addAll(RS_STR_INPUT_TYPE_LAS, RS_STR_INPUT_TYPE_LAZ,
            /*RS_STR_INPUT_TYPE_XYZ, */RS_STR_INPUT_TYPE_SHOTS);

    comboboxModeALS.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {

            if (newValue.equals(RS_STR_INPUT_TYPE_SHOTS)) {
                alsVoxValidationSupport.registerValidator(textFieldTrajectoryFileALS, false,
                        Validators.unregisterValidator);
            } else {
                alsVoxValidationSupport.registerValidator(textFieldTrajectoryFileALS, false,
                        Validators.fileExistValidator);
            }
        }
    });

    comboboxModeTLS.getItems().setAll("Rxp scan", "Rsp project", "PTX",
            "PTG"/*, RS_STR_INPUT_TYPE_XYZ, RS_STR_INPUT_TYPE_SHOTS*/);
    comboboxGroundEnergyOutputFormat.getItems().setAll("txt", "png");

    comboboxLaserSpecification.getItems().addAll(LaserSpecification.getPresets());

    comboboxLaserSpecification.getSelectionModel().selectedItemProperty()
            .addListener(new ChangeListener<LaserSpecification>() {
                @Override
                public void changed(ObservableValue<? extends LaserSpecification> observable,
                        LaserSpecification oldValue, LaserSpecification newValue) {
                    DecimalFormatSymbols symb = new DecimalFormatSymbols();
                    symb.setDecimalSeparator('.');
                    DecimalFormat formatter = new DecimalFormat("#####.######", symb);

                    textFieldBeamDiameterAtExit.setText(formatter.format(newValue.getBeamDiameterAtExit()));
                    textFieldBeamDivergence.setText(formatter.format(newValue.getBeamDivergence()));
                }
            });

    comboboxLaserSpecification.getSelectionModel().select(LaserSpecification.LMS_Q560);

    comboboxLaserSpecification.disableProperty().bind(checkboxCustomLaserSpecification.selectedProperty());
    textFieldBeamDiameterAtExit.disableProperty()
            .bind(checkboxCustomLaserSpecification.selectedProperty().not());
    textFieldBeamDivergence.disableProperty().bind(checkboxCustomLaserSpecification.selectedProperty().not());

    listViewProductsFiles.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);

    listViewProductsFiles.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            int size = listViewProductsFiles.getSelectionModel().getSelectedIndices().size();

            if (size == 1) {
                viewer3DPanelController
                        .updateCurrentVoxelFile(listViewProductsFiles.getSelectionModel().getSelectedItem());
            }
        }
    });

    listViewTaskList.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
            int size = listViewTaskList.getSelectionModel().getSelectedIndices().size();

            if (size == 1) {
                buttonLoadSelectedTask.setDisable(false);
            } else {
                buttonLoadSelectedTask.setDisable(true);
            }

            buttonExecute.setDisable(size == 0);
        }
    });

    resetMatrices();

    calculateMatrixFrame = new Stage();

    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/CalculateMatrixFrame.fxml"));
        Parent root = loader.load();
        calculateMatrixFrameController = loader.getController();
        calculateMatrixFrameController.setStage(calculateMatrixFrame);
        Scene scene = new Scene(root);
        calculateMatrixFrame.setScene(scene);
    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    filterFrame = new Stage();

    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/FilterFrame.fxml"));
        Parent root = loader.load();
        filterFrameController = loader.getController();
        filterFrameController.setStage(filterFrame);
        filterFrameController.setFilters("Angle");
        filterFrame.setScene(new Scene(root));
    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    try {
        FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/export/ObjExporterDialog.fxml"));
        Parent root = loader.load();
        objExporterController = loader.getController();
        Stage s = new Stage();
        objExporterController.setStage(s);
        s.setScene(new Scene(root));
    } catch (IOException ex) {
        logger.error("Cannot load fxml file", ex);
    }

    textFieldResolution.textProperty().addListener(new ChangeListener<String>() {
        @Override
        public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
            voxelSpacePanelVoxelizationController.setResolution(Float.valueOf(newValue));
        }
    });

    textFieldResolution.textProperty().addListener(voxelSpacePanelVoxelizationController.getChangeListener());

    checkboxUseDTMFilter.selectedProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {

            if (checkboxUseDTMFilter.isSelected()) {
                buttonOpenDTMFile.setDisable(false);
                textfieldDTMPath.setDisable(false);
                textfieldDTMValue.setDisable(false);
                checkboxApplyVOPMatrix.setDisable(false);
                labelDTMValue.setDisable(false);
                labelDTMPath.setDisable(false);
            } else {
                buttonOpenDTMFile.setDisable(true);
                textfieldDTMPath.setDisable(true);
                textfieldDTMValue.setDisable(true);
                checkboxApplyVOPMatrix.setDisable(true);
                labelDTMValue.setDisable(true);
                labelDTMPath.setDisable(true);
            }
        }
    });

    checkboxUseVopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            buttonSetVOPMatrix.setDisable(!newValue);
        }
    });

    checkboxUsePopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue) {
                checkBoxUseDefaultPopMatrix.setDisable(false);
                buttonOpenPopMatrixFile.setDisable(false);
            } else {
                checkBoxUseDefaultPopMatrix.setDisable(true);
                buttonOpenPopMatrixFile.setDisable(true);
            }
        }
    });

    checkboxUseSopMatrix.selectedProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue) {
                checkBoxUseDefaultSopMatrix.setDisable(false);
                buttonOpenSopMatrixFile.setDisable(false);
            } else {
                checkBoxUseDefaultSopMatrix.setDisable(true);
                buttonOpenSopMatrixFile.setDisable(true);
            }
        }
    });

    checkboxCalculateGroundEnergy.selectedProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {
            if (newValue) {
                anchorPaneGroundEnergyParameters.setDisable(false);
            } else {
                anchorPaneGroundEnergyParameters.setDisable(true);
            }
        }
    });

    listviewRxpScans.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<LidarScan>() {

        @Override
        public void changed(ObservableValue<? extends LidarScan> observable, LidarScan oldValue,
                LidarScan newValue) {
            if (newValue != null) {
                sopMatrix = newValue.matrix;
                updateResultMatrix();
            }
        }
    });

    comboboxModeTLS.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {

            switch (newValue.intValue()) {

            case 1:
            case 2:
            case 3:
                listviewRxpScans.setDisable(false);
                checkboxMergeAfter.setDisable(false);
                textFieldMergedFileName.setDisable(false);
                disableSopMatrixChoice(false);
                labelTLSOutputPath.setText("Output path");
                break;

            default:
                listviewRxpScans.setDisable(true);
                checkboxMergeAfter.setDisable(true);
                textFieldMergedFileName.setDisable(true);
                //disableSopMatrixChoice(true);
                labelTLSOutputPath.setText("Output file");
            }

            if (newValue.intValue() == 0 || newValue.intValue() == 1) {
                checkboxEmptyShotsFilter.setDisable(false);
            } else {
                checkboxEmptyShotsFilter.setDisable(true);
            }
        }
    });

    tabPaneVoxelisation.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {

        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {

            switch (newValue.intValue()) {

            case 1:
                disableSopMatrixChoice(false);
                disablePopMatrixChoice(false);
                checkboxEmptyShotsFilter.setDisable(false);
                break;

            default:
                disableSopMatrixChoice(true);
                disablePopMatrixChoice(true);
                checkboxEmptyShotsFilter.setDisable(true);
            }

            switch (newValue.intValue()) {
            case 0:
                checkboxCalculateGroundEnergy.setDisable(false);

                if (checkboxCalculateGroundEnergy.isSelected()) {
                    anchorPaneGroundEnergyParameters.setDisable(true);
                    checkboxCalculateGroundEnergy.setDisable(false);

                }

                anchorPaneEchoFiltering.getChildren().set(0, anchorPaneEchoFilteringClassifications);

                //anchorPaneEchoFilteringClassifications.setVisible(true);
                anchorpaneBoundingBoxParameters.setDisable(checkboxMultiFiles.isSelected());
                hboxAutomaticBBox.setDisable(false);
                break;
            default:
                anchorPaneGroundEnergyParameters.setDisable(true);
                checkboxCalculateGroundEnergy.setDisable(true);
                anchorPaneEchoFiltering.getChildren().set(0, anchorPaneEchoFilteringRxp);
                //anchorPaneEchoFilteringClassifications.setVisible(false);
                anchorpaneBoundingBoxParameters.setDisable(false);
                hboxAutomaticBBox.setDisable(true);
            }
        }
    });

    int availableCores = Runtime.getRuntime().availableProcessors();

    sliderRSPCoresToUse.setMin(1);
    sliderRSPCoresToUse.setMax(availableCores);
    sliderRSPCoresToUse.setValue(availableCores);

    textFieldInputFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent);
    textFieldTrajectoryFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent);
    textFieldOutputFileALS.setOnDragOver(DragAndDropHelper.dragOverEvent);
    textFieldInputFileTLS.setOnDragOver(DragAndDropHelper.dragOverEvent);
    textFieldOutputFileMerging.setOnDragOver(DragAndDropHelper.dragOverEvent);
    textfieldDTMPath.setOnDragOver(DragAndDropHelper.dragOverEvent);
    textFieldOutputFileGroundEnergy.setOnDragOver(DragAndDropHelper.dragOverEvent);
    listViewTaskList.setOnDragOver(DragAndDropHelper.dragOverEvent);
    listViewProductsFiles.setOnDragOver(DragAndDropHelper.dragOverEvent);
    textfieldVoxelFilePathTransmittance.setOnDragOver(DragAndDropHelper.dragOverEvent);
    textfieldOutputTextFilePath.setOnDragOver(DragAndDropHelper.dragOverEvent);
    textfieldOutputBitmapFilePath.setOnDragOver(DragAndDropHelper.dragOverEvent);

    textFieldInputFileALS.setOnDragDropped(new EventHandler<DragEvent>() {
        @Override
        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) {
                        textFieldInputFileALS.setText(file.getAbsolutePath());
                        selectALSInputMode(file);
                    }
                }
            }
            event.setDropCompleted(success);
            event.consume();
        }
    });
    textFieldTrajectoryFileALS.setOnDragDropped(new EventHandler<DragEvent>() {
        @Override
        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) {
                        onTrajectoryFileChoosed(file);
                    }
                }
            }
            event.setDropCompleted(success);
            event.consume();
        }
    });

    textFieldInputFileTLS.setOnDragDropped(new EventHandler<DragEvent>() {
        @Override
        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) {
                        onInputFileTLSChoosed(file);
                    }
                }
            }
            event.setDropCompleted(success);
            event.consume();
        }
    });

    setDragDroppedSingleFileEvent(textFieldOutputFileALS);
    setDragDroppedSingleFileEvent(textFieldOutputFileMerging);
    setDragDroppedSingleFileEvent(textfieldDTMPath);
    setDragDroppedSingleFileEvent(textFieldOutputFileGroundEnergy);
    setDragDroppedSingleFileEvent(textfieldVoxelFilePathTransmittance);
    setDragDroppedSingleFileEvent(textfieldOutputTextFilePath);
    setDragDroppedSingleFileEvent(textfieldOutputBitmapFilePath);

    listViewTaskList.setOnDragDropped(new EventHandler<DragEvent>() {
        @Override
        public void handle(DragEvent event) {
            Dragboard db = event.getDragboard();
            boolean success = false;
            if (db.hasFiles()) {
                success = true;
                for (File file : db.getFiles()) {
                    addFileToTaskList(file);
                }
            }
            event.setDropCompleted(success);
            event.consume();
        }
    });

    listViewProductsFiles.setOnDragDropped(new EventHandler<DragEvent>() {
        @Override
        public void handle(DragEvent event) {
            Dragboard db = event.getDragboard();
            boolean success = false;
            if (db.hasFiles()) {
                success = true;
                for (File file : db.getFiles()) {
                    addFileToProductsList(file);
                }
            }
            event.setDropCompleted(success);
            event.consume();
        }
    });

    listViewProductsFiles.setOnDragDetected(new EventHandler<MouseEvent>() {

        @Override
        public void handle(MouseEvent event) {

            Dragboard db = listViewProductsFiles.startDragAndDrop(TransferMode.COPY);

            ClipboardContent content = new ClipboardContent();
            content.putFiles(listViewProductsFiles.getSelectionModel().getSelectedItems());
            db.setContent(content);

            event.consume();
        }
    });

    addPointcloudFilterComponent();

    checkboxUsePointcloudFilter.selectedProperty().addListener(new ChangeListener<Boolean>() {

        @Override
        public void changed(ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) {

            hBoxPointCloudFiltering.setDisable(!newValue);

            ObservableList<Node> list = vBoxPointCloudFiltering.getChildren();
            for (Node n : list) {
                if (n instanceof PointCloudFilterPaneComponent) {

                    PointCloudFilterPaneComponent panel = (PointCloudFilterPaneComponent) n;
                    panel.disableContent(!newValue);
                }
            }

            buttonAddPointcloudFilter.setDisable(!newValue);

        }
    });

    //displayGThetaAllDistributions();
}

From source file:org.openbravo.erpCommon.utility.Utility.java

/**
 * Gets the number format for the organization country.
 * // w  w w .  ja  v  a  2  s . c  o  m
 * @param orgid
 *          ID of the organization.
 * @param defaultDecimalFormat
 *          Default decimal format.
 * 
 * @return DecimalFormat for the number representation defined for the country.
 */
public static DecimalFormat getCountryNumberFormat(String orgid, DecimalFormat defaultDecimalFormat) {
    try {
        OBContext.setAdminMode(true);
        Country country = getCountryFromOrgId(orgid);
        DecimalFormatSymbols symbols = new DecimalFormatSymbols();
        if (country.getDecimalseparator() != null)
            symbols.setDecimalSeparator(country.getDecimalseparator().equals("C") ? ',' : '.');
        if (country.getGroupingseparator() != null)
            symbols.setGroupingSeparator(country.getGroupingseparator().equals("C") ? ',' : '.');
        if (country.getNumericmask() != null) {
            DecimalFormat numberFormat = new DecimalFormat(country.getNumericmask());
            numberFormat.setDecimalFormatSymbols(symbols);
            return numberFormat;
        } else {
            if (country.getDecimalseparator() != null || country.getNumericmask() != null) {
                defaultDecimalFormat.setDecimalFormatSymbols(symbols);
            }
            return defaultDecimalFormat;
        }
    } finally {
        OBContext.restorePreviousMode();
    }
}

From source file:org.sakaiproject.tool.assessment.facade.AssessmentGradingFacadeQueries.java

/***
 * /*from  w w w  . java  2  s  .co m*/
 *@author Mustansar Mehmood
 */
public Double getAverageSubmittedAssessmentGrading(final Long publishedAssessmentId, final String agentId) {
    Double averageScore = new Double(0.0);
    AssessmentGradingData ag = null;
    final String query = "from AssessmentGradingData a "
            + " where a.publishedAssessmentId=? and a.agentId=? and "
            + " a.forGrade=?  order by  a.submittedDate desc";

    final HibernateCallback hcb = new HibernateCallback() {
        public Object doInHibernate(Session session) throws HibernateException, SQLException {
            Query q = session.createQuery(query);
            q.setLong(0, publishedAssessmentId.longValue());
            q.setString(1, agentId);
            q.setBoolean(2, true);
            return q.list();
        };
    };
    List assessmentGradings = getHibernateTemplate().executeFind(hcb);

    if (assessmentGradings.size() != 0) {
        AssessmentGradingData agd = null;
        Double cumulativeScore = new Double(0);
        Iterator i = assessmentGradings.iterator();

        while (i.hasNext()) {
            agd = (AssessmentGradingData) i.next();
            cumulativeScore += agd.getFinalScore();
        }
        averageScore = cumulativeScore / assessmentGradings.size();

        DecimalFormat df = new DecimalFormat("0.##");
        DecimalFormatSymbols dfs = new DecimalFormatSymbols();
        dfs.setDecimalSeparator('.');
        df.setDecimalFormatSymbols(dfs);

        averageScore = new Double(df.format((double) averageScore));
    }
    return averageScore;
}

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

@FXML
private void onActionButtonLoadSelectedTask(ActionEvent event) {

    File selectedFile = listViewTaskList.getSelectionModel().getSelectedItem().getLinkedFile();

    if (selectedFile != null) {

        try {/* w  ww  .j av  a 2  s.c o m*/

            String type = Configuration.readType(selectedFile);

            MultiResCfg cfg1;

            if (type.equals("multi-resolutions")) {

                showErrorDialog(new Exception("This mode is not supported anymore"));

            } else if (type.equals("Hemi-Photo")) {

                tabPaneMain.getSelectionModel().select(1);
                tabPaneVirtualMeasures.getSelectionModel().select(2);

                HemiPhotoCfg cfg = HemiPhotoCfg.readCfg(selectedFile);
                HemiParameters hemiParameters = cfg.getParameters();

                switch (hemiParameters.getMode()) {
                case ECHOS:
                    listViewHemiPhotoScans.getItems().setAll(hemiParameters.getRxpScansList());
                    break;
                case PAD:
                    textfieldVoxelFilePathHemiPhoto.setText(hemiParameters.getVoxelFile().getAbsolutePath());
                    listViewHemiPhotoSensorPositions.getItems().setAll(hemiParameters.getSensorPositions());
                    break;
                }

                textfieldPixelNumber.setText(String.valueOf(hemiParameters.getPixelNumber()));
                textfieldAzimutsNumber.setText(String.valueOf(hemiParameters.getAzimutsNumber()));
                textfieldZenithsNumber.setText(String.valueOf(hemiParameters.getZenithsNumber()));

                checkboxGenerateSectorsTextFileHemiPhoto.setSelected(hemiParameters.isGenerateTextFile());

                if (hemiParameters.isGenerateTextFile()) {
                    textfieldHemiPhotoOutputTextFile
                            .setText(hemiParameters.getOutputTextFile().getAbsolutePath());
                }

                checkboxHemiPhotoGenerateBitmapFile.setSelected(hemiParameters.isGenerateBitmapFile());

                if (hemiParameters.isGenerateBitmapFile()) {
                    comboboxHemiPhotoBitmapOutputMode.getSelectionModel()
                            .select(hemiParameters.getBitmapMode().getMode());
                    textfieldHemiPhotoOutputBitmapFile
                            .setText(hemiParameters.getOutputBitmapFile().getAbsolutePath());

                }

            } else if (type.equals("transmittance") || type.equals("LAI2000") || type.equals("LAI2200")) {

                tabPaneMain.getSelectionModel().select(1);

                TransmittanceCfg cfg = TransmittanceCfg.readCfg(selectedFile);

                //cfg.readConfiguration(selectedFile);
                TransmittanceParameters params = cfg.getParameters();

                if (type.equals("transmittance")) {

                    textfieldVoxelFilePathTransmittance.setText(params.getInputFile().getAbsolutePath());

                    tabPaneVirtualMeasures.getSelectionModel().select(0);
                    comboboxChooseDirectionsNumber.getSelectionModel()
                            .select(new Integer(params.getDirectionsNumber()));
                    textfieldDirectionRotationTransmittanceMap
                            .setText(String.valueOf(params.getDirectionsRotation()));
                    checkboxTransmittanceMapToricity.setSelected(params.isToricity());

                    checkboxGenerateBitmapFile.setSelected(params.isGenerateBitmapFile());

                    if (params.isGenerateBitmapFile() && params.getBitmapFile() != null) {
                        textfieldOutputBitmapFilePath.setText(params.getBitmapFile().getAbsolutePath());
                    }

                    checkboxGenerateTextFile.setSelected(params.isGenerateTextFile());

                    if (params.isGenerateTextFile() && params.getTextFile() != null) {
                        textfieldOutputTextFilePath.setText(params.getTextFile().getAbsolutePath());
                    }

                    if (params.getPositions() != null) {
                        listViewTransmittanceMapSensorPositions.getItems().setAll(params.getPositions());
                    }

                    textfieldLatitudeRadians.setText(String.valueOf(params.getLatitudeInDegrees()));

                    data.clear();

                    List<SimulationPeriod> simulationPeriods = params.getSimulationPeriods();

                    if (simulationPeriods != null) {
                        data.addAll(simulationPeriods);
                    }

                } else {

                    textfieldVoxelFilePathCanopyAnalyzer.setText(params.getInputFile().getAbsolutePath());

                    if (type.equals("LAI2000")) {
                        toggleButtonLAI2000Choice.setSelected(true);
                    } else if (type.equals("LAI2200")) {
                        toggleButtonLAI2200Choice.setSelected(true);
                    }

                    tabPaneVirtualMeasures.getSelectionModel().select(1);

                    comboboxChooseCanopyAnalyzerSampling.getSelectionModel()
                            .select(Integer.valueOf(params.getDirectionsNumber()));

                    boolean[] masks = params.getMasks();
                    if (masks != null && masks.length == 5) {
                        toggleButtonCanopyAnalyzerRingMask1.setSelected(masks[0]);
                        toggleButtonCanopyAnalyzerRingMask2.setSelected(masks[1]);
                        toggleButtonCanopyAnalyzerRingMask3.setSelected(masks[2]);
                        toggleButtonCanopyAnalyzerRingMask4.setSelected(masks[3]);
                        toggleButtonCanopyAnalyzerRingMask5.setSelected(masks[4]);
                    }

                    checkboxGenerateLAI2xxxFormat.setSelected(params.isGenerateLAI2xxxTypeFormat());

                    List<Point3d> positions = params.getPositions();
                    if (positions != null) {
                        listViewCanopyAnalyzerSensorPositions.getItems().setAll(positions);
                    }

                    checkboxGenerateCanopyAnalyzerTextFile.setSelected(params.isGenerateTextFile());
                    if (params.isGenerateTextFile() && params.getTextFile() != null) {
                        textfieldOutputCanopyAnalyzerTextFile.setText(params.getTextFile().getAbsolutePath());
                    }

                }

            } else if (type.equals("merging")) {

                VoxMergingCfg cfg = new VoxMergingCfg();
                cfg.readConfiguration(selectedFile);

                tabPaneVoxelisation.getSelectionModel().select(2);

                List<File> files = cfg.getFiles();

                if (files != null) {
                    listViewProductsFiles.getItems().addAll(files);
                }
                textFieldOutputFileMerging.setText(cfg.getOutputFile().getAbsolutePath());
                textFieldPADMax.setText(String.valueOf(cfg.getVoxelParameters().infos.getMaxPAD()));

            } else if (type.equals("voxelisation-ALS") || type.equals("voxelisation-TLS")
                    || type.equals("multi-voxelisation")) {

                Configuration cfg;

                if (type.equals("voxelisation-ALS")) {
                    cfg = new ALSVoxCfg();
                } else if (type.equals("voxelisation-TLS")) {
                    cfg = new TLSVoxCfg();
                } else {
                    cfg = new MultiVoxCfg();
                }

                cfg.readConfiguration(selectedFile);

                //VoxelisationConfiguration cfg = new VoxelisationConfiguration();

                VoxelParameters voxelParameters = ((VoxelAnalysisCfg) cfg).getVoxelParameters();
                checkboxWriteShotSegment.setSelected(((VoxelAnalysisCfg) cfg).isExportShotSegment());

                LaserSpecification laserSpecification = voxelParameters.getLaserSpecification();
                if (laserSpecification != null) {
                    if (laserSpecification.getName().equals("custom")) {
                        checkboxCustomLaserSpecification.setSelected(true);
                        DecimalFormatSymbols symb = new DecimalFormatSymbols();
                        symb.setDecimalSeparator('.');
                        DecimalFormat formatter = new DecimalFormat("#####.######", symb);

                        textFieldBeamDiameterAtExit
                                .setText(formatter.format(laserSpecification.getBeamDiameterAtExit()));
                        textFieldBeamDivergence
                                .setText(formatter.format(laserSpecification.getBeamDivergence()));
                    } else {
                        checkboxCustomLaserSpecification.setSelected(false);
                        comboboxLaserSpecification.getSelectionModel().select(laserSpecification);
                    }
                }

                textFieldResolution.setText(String.valueOf(voxelParameters.infos.getResolution()));

                DTMFilteringParams dtmFilteringParams = voxelParameters.getDtmFilteringParams();
                if (dtmFilteringParams == null) {
                    dtmFilteringParams = new DTMFilteringParams();
                }

                checkboxUseDTMFilter.setSelected(dtmFilteringParams.useDTMCorrection());
                File tmpFile = dtmFilteringParams.getDtmFile();
                if (tmpFile != null) {
                    textfieldDTMPath.setText(tmpFile.getAbsolutePath());
                    textfieldDTMValue.setText(String.valueOf(dtmFilteringParams.getMinDTMDistance()));
                    checkboxApplyVOPMatrix.setSelected(dtmFilteringParams.isUseVOPMatrix());
                }

                checkboxUsePointcloudFilter.setSelected(voxelParameters.isUsePointCloudFilter());
                List<PointcloudFilter> pointcloudFilters = voxelParameters.getPointcloudFilters();
                if (pointcloudFilters != null) {

                    clearPointcloudFiltersPane();

                    for (PointcloudFilter filter : pointcloudFilters) {
                        PointCloudFilterPaneComponent pane = addPointcloudFilterComponent();
                        pane.setCSVFile(filter.getPointcloudFile());
                        pane.getTextfieldPointCloudErrorMargin()
                                .setText(String.valueOf(filter.getPointcloudErrorMargin()));

                        int index;
                        if (filter.isKeep()) {
                            index = 0;
                        } else {
                            index = 1;
                        }
                        pane.getComboboxPointCloudFilteringType().getSelectionModel().select(index);
                    }
                }

                checkboxUsePopMatrix.setSelected(((VoxelAnalysisCfg) cfg).isUsePopMatrix());
                checkboxUseSopMatrix.setSelected(((VoxelAnalysisCfg) cfg).isUseSopMatrix());
                checkboxUseVopMatrix.setSelected(((VoxelAnalysisCfg) cfg).isUseVopMatrix());

                if (type.equals("voxelisation-ALS") || type.equals("multi-voxelisation")) {

                    List<Integer> classifiedPointsToDiscard = ((ALSVoxCfg) cfg).getClassifiedPointsToDiscard();

                    for (Integer i : classifiedPointsToDiscard) {
                        listviewClassifications.getItems().get(i).setSelected(false);
                    }
                } else if (type.equals("voxelisation-TLS")) {

                    filteringPaneController.setFilters(((TLSVoxCfg) cfg).getEchoFilters());
                    checkboxEmptyShotsFilter.setSelected(((TLSVoxCfg) cfg).isEnableEmptyShotsFiltering());
                }

                textFieldPADMax.setText(
                        String.valueOf(((VoxelAnalysisCfg) cfg).getVoxelParameters().infos.getMaxPAD()));

                popMatrix = ((VoxelAnalysisCfg) cfg).getPopMatrix();
                sopMatrix = ((VoxelAnalysisCfg) cfg).getSopMatrix();
                vopMatrix = ((VoxelAnalysisCfg) cfg).getVopMatrix();

                if (popMatrix == null) {
                    popMatrix = new Matrix4d();
                    popMatrix.setIdentity();
                }

                if (sopMatrix == null) {
                    sopMatrix = new Matrix4d();
                    sopMatrix.setIdentity();
                }

                if (vopMatrix == null) {
                    vopMatrix = new Matrix4d();
                    vopMatrix.setIdentity();
                }

                updateResultMatrix();

                List<Filter> filters = ((VoxelAnalysisCfg) cfg).getShotFilters();
                if (filters != null) {
                    listviewFilters.getItems().clear();
                    listviewFilters.getItems().addAll(filters);
                }

                if (((VoxelAnalysisCfg) cfg).getVoxelParameters().getEchoesWeightParams()
                        .getWeightingMode() == EchoesWeightParams.WEIGHTING_NONE) {
                    checkboxEnableWeighting.setSelected(false);
                } else {
                    checkboxEnableWeighting.setSelected(true);
                    fillWeightingData(((VoxelAnalysisCfg) cfg).getVoxelParameters().getEchoesWeightParams()
                            .getWeightingData());
                }

                LADParams ladParameters = voxelParameters.getLadParams();
                if (ladParameters == null) {
                    ladParameters = new LADParams();
                }

                comboboxLADChoice.getSelectionModel().select(ladParameters.getLadType());
                radiobuttonLADHomogeneous.setSelected(ladParameters.getLadEstimationMode() == 0);
                textFieldTwoBetaAlphaParameter
                        .setText(String.valueOf(ladParameters.getLadBetaFunctionAlphaParameter()));
                textFieldTwoBetaBetaParameter
                        .setText(String.valueOf(ladParameters.getLadBetaFunctionBetaParameter()));

                /*comboboxTransMode.getSelectionModel().select(new Integer(voxelParameters.getTransmittanceMode()));
                comboboxPathLengthMode.getSelectionModel().select(voxelParameters.getPathLengthMode());*/

                if (type.equals("voxelisation-ALS") || type.equals("multi-voxelisation")) {

                    tabPaneVoxelisation.getSelectionModel().select(0);

                    if (((ALSVoxCfg) cfg).getInputType() != SHOTS_FILE) {
                        textFieldTrajectoryFileALS
                                .setText(((ALSVoxCfg) cfg).getTrajectoryFile().getAbsolutePath());
                        trajectoryFile = ((ALSVoxCfg) cfg).getTrajectoryFile();
                    }

                    GroundEnergyParams groundEnergyParameters = ((ALSVoxCfg) cfg).getVoxelParameters()
                            .getGroundEnergyParams();
                    if (groundEnergyParameters == null) {
                        groundEnergyParameters = new GroundEnergyParams();
                    }

                    checkboxCalculateGroundEnergy.setSelected(groundEnergyParameters.isCalculateGroundEnergy());
                    if (groundEnergyParameters.getGroundEnergyFile() != null) {
                        comboboxGroundEnergyOutputFormat.getSelectionModel()
                                .select(groundEnergyParameters.getGroundEnergyFileFormat());
                        textFieldOutputFileGroundEnergy
                                .setText(groundEnergyParameters.getGroundEnergyFile().getAbsolutePath());
                    }

                    if (type.equals("voxelisation-ALS")) {

                        textFieldInputFileALS.setText(((ALSVoxCfg) cfg).getInputFile().getAbsolutePath());
                        selectALSInputMode(((ALSVoxCfg) cfg).getInputFile());

                        textFieldOutputFileALS.setText(((ALSVoxCfg) cfg).getOutputFile().getAbsolutePath());
                        checkboxMultiResAfterMode2.setSelected(
                                ((ALSVoxCfg) cfg).getVoxelParameters().getNaNsCorrectionParams().isActivate());
                        textfieldNbSamplingThresholdMultires.setText(String.valueOf(((ALSVoxCfg) cfg)
                                .getVoxelParameters().getNaNsCorrectionParams().getNbSamplingThreshold()));
                        checkboxMultiFiles.setSelected(false);

                    } else if (type.equals("multi-voxelisation")) {

                        List<Input> inputs = ((MultiVoxCfg) cfg).getMultiProcessInputs();
                        StringBuilder inputFiles = new StringBuilder();

                        for (Input input : inputs) {
                            inputFiles.append(input.inputFile.getAbsolutePath()).append(";");
                        }

                        textFieldInputFileALS.setText(inputFiles.toString());

                        if (inputs.size() > 0) {
                            textFieldOutputFileALS
                                    .setText(inputs.get(0).outputFile.getParentFile().getAbsolutePath());
                            textFieldResolution.setText(
                                    String.valueOf(inputs.get(0).voxelParameters.infos.getResolution()));
                        }

                        checkboxMultiFiles.setSelected(true);
                    }
                } else {

                    tabPaneVoxelisation.getSelectionModel().select(1);

                    textFieldInputFileTLS.setText(((TLSVoxCfg) cfg).getInputFile().getAbsolutePath());
                    textFieldOutputPathTLS.setText(((TLSVoxCfg) cfg).getOutputFile().getAbsolutePath());

                    switch (((TLSVoxCfg) cfg).getInputType()) {
                    case RSP_PROJECT:
                        comboboxModeTLS.getSelectionModel().select(1);
                        break;
                    case RXP_SCAN:
                        comboboxModeTLS.getSelectionModel().select(0);
                        break;
                    case POINTS_FILE:
                        comboboxModeTLS.getSelectionModel().select(2);
                        break;
                    case SHOTS_FILE:
                        comboboxModeTLS.getSelectionModel().select(5);
                        break;
                    case PTG_PROJECT:
                        comboboxModeTLS.getSelectionModel().select(3);
                        break;
                    case PTX_PROJECT:
                        comboboxModeTLS.getSelectionModel().select(2);
                        break;
                    }

                    checkboxMergeAfter.setSelected(((TLSVoxCfg) cfg).getVoxelParameters().isMergingAfter());

                    if (((TLSVoxCfg) cfg).getVoxelParameters().getMergedFile() != null) {
                        textFieldMergedFileName
                                .setText(((TLSVoxCfg) cfg).getVoxelParameters().getMergedFile().getName());
                    }

                    List<LidarScan> matricesAndFiles = ((TLSVoxCfg) cfg).getLidarScans();
                    if (matricesAndFiles != null) {
                        items = matricesAndFiles;
                        listviewRxpScans.getItems().setAll(items);
                    }
                }

                if (type.equals("voxelisation-ALS") || type.equals("voxelisation-TLS")) {

                    voxelSpacePanelVoxelizationController.getTextFieldEnterXMin()
                            .setText(String.valueOf(voxelParameters.infos.getMinCorner().x));
                    voxelSpacePanelVoxelizationController.getTextFieldEnterYMin()
                            .setText(String.valueOf(voxelParameters.infos.getMinCorner().y));
                    voxelSpacePanelVoxelizationController.getTextFieldEnterZMin()
                            .setText(String.valueOf(voxelParameters.infos.getMinCorner().z));

                    voxelSpacePanelVoxelizationController.getTextFieldEnterXMax()
                            .setText(String.valueOf(voxelParameters.infos.getMaxCorner().x));
                    voxelSpacePanelVoxelizationController.getTextFieldEnterYMax()
                            .setText(String.valueOf(voxelParameters.infos.getMaxCorner().y));
                    voxelSpacePanelVoxelizationController.getTextFieldEnterZMax()
                            .setText(String.valueOf(voxelParameters.infos.getMaxCorner().z));

                    voxelSpacePanelVoxelizationController.getTextFieldXNumber()
                            .setText(String.valueOf(voxelParameters.infos.getSplit().x));
                    voxelSpacePanelVoxelizationController.getTextFieldYNumber()
                            .setText(String.valueOf(voxelParameters.infos.getSplit().y));
                    voxelSpacePanelVoxelizationController.getTextFieldZNumber()
                            .setText(String.valueOf(voxelParameters.infos.getSplit().z));

                }
            }

        } catch (Exception e) {

            logger.error("Configuration file cannot be load", e);
            Alert alert = new Alert(AlertType.CONFIRMATION);
            alert.setHeaderText("Incorrect file");
            alert.setContentText("File is corrupted or cannot be read!\n" + "Do you want to keep it?");
            Optional<ButtonType> result = alert.showAndWait();
            if (result.get() == ButtonType.CANCEL) {
                listViewTaskList.getItems().remove(selectedFile);
            }
        }
    }

}