Example usage for java.lang Package getPackage

List of usage examples for java.lang Package getPackage

Introduction

In this page you can find the example usage for java.lang Package getPackage.

Prototype

@CallerSensitive
@Deprecated(since = "9")
@SuppressWarnings("deprecation")
public static Package getPackage(String name) 

Source Link

Document

Finds a package by name in the caller's class loader and its ancestors.

Usage

From source file:net.sf.jasperreports.engine.export.ooxml.JRPptxExporter.java

/**
 *
 *///from w  w w. j  av a 2s.c  o m
protected void exportReportToStream(OutputStream os) throws JRException, IOException {
    pptxZip = new PptxZip();
    PptxExporterConfiguration configuration = getCurrentConfiguration();

    presentationWriter = pptxZip.getPresentationEntry().getWriter();
    presentationRelsWriter = pptxZip.getRelsEntry().getWriter();

    boolean isEmbedFonts = Boolean.TRUE.equals(configuration.isEmbedFonts());

    FileBufferedWriter fontWriter = new FileBufferedWriter();
    fontHelper = new PptxFontHelper(jasperReportsContext, fontWriter, presentationRelsWriter, pptxZip,
            isEmbedFonts);

    presentationHelper = new PptxPresentationHelper(jasperReportsContext, presentationWriter, fontWriter);
    presentationHelper.exportHeader(isEmbedFonts);

    presentationRelsHelper = new PptxPresentationRelsHelper(jasperReportsContext, presentationRelsWriter);
    presentationRelsHelper.exportHeader();

    ctHelper = new PptxContentTypesHelper(jasperReportsContext, pptxZip.getContentTypesEntry().getWriter());
    ctHelper.exportHeader();

    appHelper = new PropsAppHelper(jasperReportsContext, pptxZip.getAppEntry().getWriter());
    coreHelper = new PropsCoreHelper(jasperReportsContext, pptxZip.getCoreEntry().getWriter());

    appHelper.exportHeader();

    String application = configuration.getMetadataApplication();
    if (application == null) {
        application = "JasperReports Library version "
                + Package.getPackage("net.sf.jasperreports.engine").getImplementationVersion();
    }
    appHelper.exportProperty(PropsAppHelper.PROPERTY_APPLICATION, application);

    coreHelper.exportHeader();

    String title = configuration.getMetadataTitle();
    if (title != null) {
        coreHelper.exportProperty(PropsCoreHelper.PROPERTY_TITLE, title);
    }
    String subject = configuration.getMetadataSubject();
    if (subject != null) {
        coreHelper.exportProperty(PropsCoreHelper.PROPERTY_SUBJECT, subject);
    }
    String author = configuration.getMetadataAuthor();
    if (author != null) {
        coreHelper.exportProperty(PropsCoreHelper.PROPERTY_CREATOR, author);
    }
    String keywords = configuration.getMetadataKeywords();
    if (keywords != null) {
        coreHelper.exportProperty(PropsCoreHelper.PROPERTY_KEYWORDS, keywords);
    }

    Integer slideMasterReport = configuration.getSlideMasterReport();
    if (slideMasterReport == null) {
        slideMasterReport = 1;
    }
    int slideMasterReportIndex = slideMasterReport - 1;

    Integer slideMasterPage = configuration.getSlideMasterPage();
    if (slideMasterPage == null) {
        slideMasterPage = 1;
    }
    int slideMasterPageIndex = slideMasterPage - 1;

    //      DocxStyleHelper styleHelper = 
    //         new DocxStyleHelper(
    //            null,//pptxZip.getStylesEntry().getWriter(), 
    //            fontMap, 
    //            getExporterKey()
    //            );
    //      styleHelper.export(jasperPrintList);
    //      styleHelper.close();

    List<ExporterInputItem> items = exporterInput.getItems();

    boolean hasSlideMasterElements = false;

    createSlideMaster();

    if (0 <= slideMasterReportIndex && slideMasterReportIndex < items.size()) {
        if (Thread.interrupted()) {
            throw new ExportInterruptedException();
        }

        ExporterInputItem item = items.get(slideMasterReportIndex);

        setCurrentExporterInputItem(item);

        List<JRPrintPage> pages = jasperPrint.getPages();

        if (pages != null && pages.size() > 0) {
            PageRange pageRange = getPageRange();
            int startPageIndex = (pageRange == null || pageRange.getStartPageIndex() == null) ? 0
                    : pageRange.getStartPageIndex();
            int endPageIndex = (pageRange == null || pageRange.getEndPageIndex() == null) ? (pages.size() - 1)
                    : pageRange.getEndPageIndex();

            if (startPageIndex <= slideMasterPageIndex && slideMasterPageIndex <= endPageIndex) {
                hasSlideMasterElements = exportPageToSlideMaster(pages.get(slideMasterPageIndex),
                        configuration.isBackgroundAsSlideMaster());
            }
        }
    }

    closeSlideMaster();

    for (reportIndex = 0; reportIndex < items.size(); reportIndex++) {
        ExporterInputItem item = items.get(reportIndex);

        setCurrentExporterInputItem(item);

        List<JRPrintPage> pages = jasperPrint.getPages();
        if (pages != null && pages.size() > 0) {
            PageRange pageRange = getPageRange();
            int startPageIndex = (pageRange == null || pageRange.getStartPageIndex() == null) ? 0
                    : pageRange.getStartPageIndex();
            int endPageIndex = (pageRange == null || pageRange.getEndPageIndex() == null) ? (pages.size() - 1)
                    : pageRange.getEndPageIndex();

            net.sf.jasperreports.engine.util.PageRange[] hideSmPageRanges = null;
            String hideSlideMasterPages = getCurrentItemConfiguration().getHideSlideMasterPages();
            if (hideSlideMasterPages != null && hideSlideMasterPages.trim().length() > 0) {
                hideSmPageRanges = net.sf.jasperreports.engine.util.PageRange.parse(hideSlideMasterPages);
            }

            for (pageIndex = startPageIndex; pageIndex <= endPageIndex; pageIndex++) {
                if (Thread.interrupted()) {
                    throw new ExportInterruptedException();
                }

                JRPrintPage page = pages.get(pageIndex);

                createSlide(net.sf.jasperreports.engine.util.PageRange.isPageInRanges(pageIndex + 1,
                        hideSmPageRanges));

                slideIndex++;

                exportPage(page, configuration.isBackgroundAsSlideMaster(), hasSlideMasterElements);

                closeSlide();
            }
        }
    }

    fontHelper.exportFonts();
    fontWriter.close();

    presentationHelper.exportFooter(jasperPrint);
    presentationHelper.close();

    //      if ((hyperlinksMap != null && hyperlinksMap.size() > 0))
    //      {
    //         for(Iterator it = hyperlinksMap.keySet().iterator(); it.hasNext();)
    //         {
    //            String href = (String)it.next();
    //            String id = (String)hyperlinksMap.get(href);
    //
    //            relsHelper.exportHyperlink(id, href);
    //         }
    //      }

    presentationRelsHelper.exportFooter();
    presentationRelsHelper.close();

    ctHelper.exportFooter();
    ctHelper.close();

    appHelper.exportFooter();
    appHelper.close();

    coreHelper.exportFooter();
    coreHelper.close();

    pptxZip.zipEntries(os);

    fontWriter.dispose();

    pptxZip.dispose();
}

From source file:net.chaosserver.timelord.swingui.Timelord.java

/**
 * Shows the about dialog that tells about the application.
 *//*from w ww  .  j  av  a 2  s  . co  m*/
public void showAboutDialog() {
    Package packageInfo = Package.getPackage("net.chaosserver.timelord.swingui");

    if (log.isTraceEnabled()) {
        if (packageInfo != null) {
            StringBuffer sb = new StringBuffer();
            sb.append(packageInfo.getClass().getName());
            sb.append(" [name=");
            sb.append(packageInfo.getName());
            sb.append(", specificationTitle=");
            sb.append(packageInfo.getSpecificationTitle());
            sb.append(", specificationVersion=");
            sb.append(packageInfo.getSpecificationVersion());
            sb.append(", specificationVendor=");
            sb.append(packageInfo.getSpecificationVendor());
            sb.append(", implementationTitle=");
            sb.append(packageInfo.getImplementationTitle());
            sb.append(", implementationVersion=");
            sb.append(packageInfo.getImplementationVersion());
            sb.append(", implementationVendor=");
            sb.append(packageInfo.getImplementationVendor());
            sb.append("]");
            log.trace(sb.toString());
        }
    }

    StringBuffer sb = new StringBuffer();
    sb.append("Timelord");

    if ((packageInfo != null) && (packageInfo.getImplementationVersion() != null)) {
        sb.append(" [");
        sb.append(packageInfo.getImplementationVersion());
        sb.append("]");
    } else {
        Properties appProperties = getAppProperties();
        if (appProperties != null) {
            sb.append(" ");
            sb.append(appProperties.getProperty("implementation.version", "[Unknown Version]"));
        } else {
            sb.append(" [Unknown Version]");
        }
    }

    sb.append("\n");
    sb.append(resourceBundle.getString(RROOT + ".about"));

    JOptionPane.showMessageDialog(applicationFrame, sb.toString(), "About Timelord",
            JOptionPane.INFORMATION_MESSAGE, applicationIcon);
}

From source file:org.xmlsh.util.JavaUtils.java

public static Package convertToPackage(XValue arg) {
    if (arg.isAtomic() && arg.isString())
        return Package.getPackage(arg.toString());
    Object obj = arg.asObject();//from  w  ww  .  java  2s  .  c  o m
    if (obj instanceof Package)
        return (Package) arg.asObject();
    return null;

}

From source file:net.sf.jasperreports.engine.export.JRPdfExporter.java

/**
 *
 *///from  w ww . ja va 2 s . c o  m
protected void exportReportToStream(OutputStream os) throws JRException {
    //ByteArrayOutputStream baos = new ByteArrayOutputStream();

    PdfExporterConfiguration configuration = getCurrentConfiguration();

    pageFormat = jasperPrint.getPageFormat(0);

    document = new Document(new Rectangle(pageFormat.getPageWidth(), pageFormat.getPageHeight()));

    imageTesterDocument = new Document(new Rectangle(10, //jasperPrint.getPageWidth(),
            10 //jasperPrint.getPageHeight()
    ));

    boolean closeDocuments = true;
    try {
        pdfWriter = PdfWriter.getInstance(document, os);
        pdfWriter.setCloseStream(false);

        tagHelper.setPdfWriter(pdfWriter);

        PdfVersionEnum pdfVersion = configuration.getPdfVersion();
        if (pdfVersion != null) {
            pdfWriter.setPdfVersion(pdfVersion.getName().charAt(0));
        }

        if (minimalVersion != null) {
            pdfWriter.setAtLeastPdfVersion(minimalVersion.getName().charAt(0));
        }

        if (configuration.isCompressed()) {
            pdfWriter.setFullCompression();
        }
        if (configuration.isEncrypted()) {
            int perms = configuration.isOverrideHints() == null || configuration.isOverrideHints()
                    ? (configuration.getPermissions() != null ? (Integer) configuration.getPermissions()
                            : permissions)
                    : (permissions != 0 ? permissions
                            : (configuration.getPermissions() != null ? (Integer) configuration.getPermissions()
                                    : 0));

            pdfWriter.setEncryption(PdfWriter.getISOBytes(configuration.getUserPassword()),
                    PdfWriter.getISOBytes(configuration.getOwnerPassword()), perms,
                    configuration.is128BitKey() ? PdfWriter.STANDARD_ENCRYPTION_128
                            : PdfWriter.STANDARD_ENCRYPTION_40);
        }

        PdfPrintScalingEnum printScaling = configuration.getPrintScaling();
        if (PdfPrintScalingEnum.DEFAULT == printScaling) {
            pdfWriter.addViewerPreference(PdfName.PRINTSCALING, PdfName.APPDEFAULT);
        } else if (PdfPrintScalingEnum.NONE == printScaling) {
            pdfWriter.addViewerPreference(PdfName.PRINTSCALING, PdfName.NONE);
        }

        boolean justifiedLetterSpacing = propertiesUtil.getBooleanProperty(jasperPrint,
                PdfExporterConfiguration.PROPERTY_JUSTIFIED_LETTER_SPACING, false);
        if (!justifiedLetterSpacing) {
            pdfWriter.setSpaceCharRatio(PdfWriter.NO_SPACE_CHAR_RATIO);
        }

        // Add meta-data parameters to generated PDF document
        // mtclough@users.sourceforge.net 2005-12-05
        String title = configuration.getMetadataTitle();
        if (title != null) {
            document.addTitle(title);
            if (configuration.isDisplayMetadataTitle()) {
                pdfWriter.addViewerPreference(PdfName.DISPLAYDOCTITLE, new PdfBoolean(true));
            }
        }
        String author = configuration.getMetadataAuthor();
        if (author != null) {
            document.addAuthor(author);
        }
        String subject = configuration.getMetadataSubject();
        if (subject != null) {
            document.addSubject(subject);
        }
        String keywords = configuration.getMetadataKeywords();
        if (keywords != null) {
            document.addKeywords(keywords);
        }
        String creator = configuration.getMetadataCreator();
        if (creator == null) {
            creator = "JasperReports Library version "
                    + Package.getPackage("net.sf.jasperreports.engine").getImplementationVersion();
        }
        document.addCreator(creator);

        //accessibility check: tab order follows the structure of the document
        pdfWriter.setTabs(PdfName.S);

        //accessibility check: setting the document primary language
        String language = configuration.getTagLanguage();
        if (language != null) {
            pdfWriter.getExtraCatalog().put(PdfName.LANG, new PdfString(language));
        }

        // BEGIN: PDF/A support
        PdfaConformanceEnum pdfaConformance = configuration.getPdfaConformance();
        boolean gotPdfa = false;
        if (PdfaConformanceEnum.PDFA_1A == pdfaConformance) {
            pdfWriter.setPDFXConformance(PdfWriter.PDFA1A);
            gotPdfa = true;
        } else if (PdfaConformanceEnum.PDFA_1B == pdfaConformance) {
            pdfWriter.setPDFXConformance(PdfWriter.PDFA1B);
            gotPdfa = true;
        }

        if (gotPdfa) {
            if (PdfXmpCreator.supported()) {
                byte[] metadata = PdfXmpCreator.createXmpMetadata(pdfWriter);
                pdfWriter.setXmpMetadata(metadata);
            } else {
                if ((title != null || subject != null || keywords != null) && log.isWarnEnabled()) {
                    // iText 2.1.7 does not properly write localized properties and keywords
                    log.warn("XMP metadata might be non conforming, include the Adobe XMP library to correct");
                }

                pdfWriter.createXmpMetadata();
            }
        } else {
            pdfWriter.setRgbTransparencyBlending(true);
        }
        // END: PDF/A support

        document.open();
        // BEGIN: PDF/A support
        if (gotPdfa) {
            String iccProfilePath = configuration.getIccProfilePath();
            if (iccProfilePath != null) {
                PdfDictionary pdfDictionary = new PdfDictionary(PdfName.OUTPUTINTENT);
                pdfDictionary.put(PdfName.OUTPUTCONDITIONIDENTIFIER, new PdfString("sRGB IEC61966-2.1"));
                pdfDictionary.put(PdfName.INFO, new PdfString("sRGB IEC61966-2.1"));
                pdfDictionary.put(PdfName.S, PdfName.GTS_PDFA1);
                InputStream iccIs = RepositoryUtil.getInstance(jasperReportsContext)
                        .getInputStreamFromLocation(iccProfilePath);//FIXME use getRepository?
                PdfICCBased pdfICCBased = new PdfICCBased(ICC_Profile.getInstance(iccIs));
                pdfICCBased.remove(PdfName.ALTERNATE);
                pdfDictionary.put(PdfName.DESTOUTPUTPROFILE,
                        pdfWriter.addToBody(pdfICCBased).getIndirectReference());

                pdfWriter.getExtraCatalog().put(PdfName.OUTPUTINTENTS, new PdfArray(pdfDictionary));
            } else {
                throw new JRPdfaIccProfileNotFoundException();
            }
        }
        // END: PDF/A support

        String pdfJavaScript = configuration.getPdfJavaScript();
        if (pdfJavaScript != null) {
            pdfWriter.addJavaScript(pdfJavaScript);
        }

        pdfContentByte = pdfWriter.getDirectContent();

        tagHelper.init(pdfContentByte);

        PdfWriter imageTesterPdfWriter = PdfWriter.getInstance(imageTesterDocument, new NullOutputStream() // discard the output
        );
        imageTesterDocument.open();
        imageTesterDocument.newPage();
        imageTesterPdfContentByte = imageTesterPdfWriter.getDirectContent();
        imageTesterPdfContentByte.setLiteral("\n");

        List<ExporterInputItem> items = exporterInput.getItems();

        initBookmarks(items);

        boolean isCreatingBatchModeBookmarks = configuration.isCreatingBatchModeBookmarks();

        for (reportIndex = 0; reportIndex < items.size(); reportIndex++) {
            ExporterInputItem item = items.get(reportIndex);

            setCurrentExporterInputItem(item);

            pageFormat = jasperPrint.getPageFormat(0);

            setPageSize(null);

            List<JRPrintPage> pages = jasperPrint.getPages();
            if (pages != null && pages.size() > 0) {
                if (items.size() > 1) {
                    document.newPage();

                    if (isCreatingBatchModeBookmarks) {
                        //add a new level to our outline for this report
                        addBookmark(0, jasperPrint.getName(), 0, 0);
                    }
                }

                PdfReportConfiguration lcItemConfiguration = getCurrentItemConfiguration();

                boolean sizePageToContent = lcItemConfiguration.isSizePageToContent();

                PrintPageFormat oldPageFormat = null;

                PageRange pageRange = getPageRange();
                int startPageIndex = (pageRange == null || pageRange.getStartPageIndex() == null) ? 0
                        : pageRange.getStartPageIndex();
                int endPageIndex = (pageRange == null || pageRange.getEndPageIndex() == null)
                        ? (pages.size() - 1)
                        : pageRange.getEndPageIndex();

                for (int pageIndex = startPageIndex; pageIndex <= endPageIndex; pageIndex++) {
                    if (Thread.interrupted()) {
                        throw new ExportInterruptedException();
                    }

                    JRPrintPage page = pages.get(pageIndex);

                    pageFormat = jasperPrint.getPageFormat(pageIndex);

                    if (sizePageToContent || oldPageFormat != pageFormat) {
                        setPageSize(sizePageToContent ? page : null);
                    }

                    document.newPage();

                    pdfContentByte = pdfWriter.getDirectContent();

                    pdfContentByte.setLineCap(2);//PdfContentByte.LINE_CAP_PROJECTING_SQUARE since iText 1.02b

                    writePageAnchor(pageIndex);

                    crtDocumentPageNumber++;

                    /*   */
                    exportPage(page);

                    oldPageFormat = pageFormat;
                }
            } else {
                document.newPage();
                pdfContentByte = pdfWriter.getDirectContent();
                pdfContentByte.setLiteral("\n");
            }
        }

        closeDocuments = false;
        document.close();
        imageTesterDocument.close();
    } catch (DocumentException e) {
        throw new JRException(EXCEPTION_MESSAGE_KEY_DOCUMENT_ERROR, new Object[] { jasperPrint.getName() }, e);
    } catch (IOException e) {
        throw new JRException(EXCEPTION_MESSAGE_KEY_REPORT_GENERATION_ERROR,
                new Object[] { jasperPrint.getName() }, e);
    } finally {
        if (closeDocuments) //only on exception
        {
            try {
                document.close();
            } catch (Exception e) {
                // ignore, let the original exception propagate
            }

            try {
                imageTesterDocument.close();
            } catch (Exception e) {
                // ignore, let the original exception propagate
            }
        }
    }

    //return os.toByteArray();
}

From source file:com.cablelabs.sim.PCSim2.java

private static void logPackage() {
    Package p = Package.getPackage("com.cablelabs.sim");
    if (p == null) {
        logger.info(PC2LogCategory.Parser, subCat, "com.cablelabs.sim not loaded");
        return;// w  w w  . ja v  a 2 s  .com
    }

    logger.info(PC2LogCategory.Parser, subCat, "com.cablelabs.sim version " + p.getSpecificationVersion()
            + " build-" + p.getImplementationVersion());
    //      if (logFile.exists())    
    //         logDebugInfo(logFile);
    logger.logConfigSettings();

}

From source file:net.sf.jasperreports.engine.export.ooxml.JRXlsxExporter.java

@Override
protected void openWorkbook(OutputStream os) throws JRException {
    rendererToImagePathMap = new HashMap<String, String>();
    //      imageMaps = new HashMap();
    //      hyperlinksMap = new HashMap();
    definedNames = new StringBuilder();
    sheetMapping = new HashMap<String, Integer>();
    try {//  w  w  w.  jav  a  2 s . co m
        String memoryThreshold = jasperPrint.getPropertiesMap()
                .getProperty(FileBufferedOutputStream.PROPERTY_MEMORY_THRESHOLD);
        xlsxZip = new XlsxZip(jasperReportsContext, getRepository(),
                memoryThreshold == null ? null : JRPropertiesUtil.asInteger(memoryThreshold));

        wbHelper = new XlsxWorkbookHelper(jasperReportsContext, xlsxZip.getWorkbookEntry().getWriter(),
                definedNames);
        wbHelper.exportHeader();

        relsHelper = new XlsxRelsHelper(jasperReportsContext, xlsxZip.getRelsEntry().getWriter());
        ctHelper = new XlsxContentTypesHelper(jasperReportsContext, xlsxZip.getContentTypesEntry().getWriter());

        appHelper = new PropsAppHelper(jasperReportsContext, xlsxZip.getAppEntry().getWriter());
        coreHelper = new PropsCoreHelper(jasperReportsContext, xlsxZip.getCoreEntry().getWriter());

        XlsxExporterConfiguration configuration = getCurrentConfiguration();

        String macro = macroTemplate == null ? configuration.getMacroTemplate() : macroTemplate;
        if (macro != null) {
            xlsxZip.addMacro(macro);
            relsHelper.setContainsMacro(true);
            ctHelper.setContainsMacro(true);
        }
        relsHelper.exportHeader();
        ctHelper.exportHeader();

        appHelper.exportHeader();

        String application = configuration.getMetadataApplication();
        if (application == null) {
            application = "JasperReports Library version "
                    + Package.getPackage("net.sf.jasperreports.engine").getImplementationVersion();
        }
        appHelper.exportProperty(PropsAppHelper.PROPERTY_APPLICATION, application);

        coreHelper.exportHeader();

        String title = configuration.getMetadataTitle();
        if (title != null) {
            coreHelper.exportProperty(PropsCoreHelper.PROPERTY_TITLE, title);
        }
        String subject = configuration.getMetadataSubject();
        if (subject != null) {
            coreHelper.exportProperty(PropsCoreHelper.PROPERTY_SUBJECT, subject);
        }
        String author = configuration.getMetadataAuthor();
        if (author != null) {
            coreHelper.exportProperty(PropsCoreHelper.PROPERTY_CREATOR, author);
        }
        String keywords = configuration.getMetadataKeywords();
        if (keywords != null) {
            coreHelper.exportProperty(PropsCoreHelper.PROPERTY_KEYWORDS, keywords);
        }

        styleHelper = new XlsxStyleHelper(jasperReportsContext, xlsxZip.getStylesEntry().getWriter(),
                getExporterKey());

        firstPageNotSet = true;
        firstSheetName = null;
    } catch (IOException e) {
        throw new JRException(e);
    }
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 * @param args the command line arguments
 *///from w w w  .j  a v a  2  s  .  co  m
public static void main(String[] args) {
    Package pack = Package.getPackage("editeurpanovisu");
    System.setProperty("file.encoding", "UTF-8");
    numVersion = pack.getImplementationVersion();
    systemeExploitation = System.getProperty("os.name");
    //Properties properties = System.getProperties();
    //properties.list(System.out);
    launch(args);
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param stPrimaryStage/*from  w ww . ja v  a2  s.  co  m*/
 * @throws Exception Exceptions
 */
@Override

public void start(Stage stPrimaryStage) throws Exception {
    if (isLinux()) {
        stPrimaryStage.setFullScreen(true);
    }
    File fileRep = new File("");
    setbInternet(netIsAvailable());
    setStrCurrentDir(fileRep.getAbsolutePath());
    setStrRepertAppli(fileRep.getAbsolutePath());
    fileRepertConfig = new File(getStrRepertAppli() + File.separator + "configPV");
    rbLocalisation = ResourceBundle.getBundle("editeurpanovisu.i18n.PanoVisu", getLocale());
    Package pack = Package.getPackage("editeurpanovisu");
    strNumVersion = pack.getImplementationVersion() + "-b"
            + rbLocalisation.getString("build.numero").replace(" ", "").replace("", "");
    lisPreferences();
    setStPrincipal(stPrimaryStage);
    stPrimaryStage.setResizable(false);
    getStPrincipal().setResizable(true);
    getStPrincipal().setAlwaysOnTop(false);
    getStPrincipal().setTitle("PanoVisu v" + strNumVersion.split("-")[0]);
    stPrimaryStage.setMaximized(true);
    stPrimaryStage.setAlwaysOnTop(false);
    Rectangle2D tailleEcran = Screen.getPrimary().getBounds();
    int iHauteur;
    if (isMac()) {
        iHauteur = (int) tailleEcran.getHeight() - 60;
    } else {
        iHauteur = (int) tailleEcran.getHeight() - 20;
    }
    int iLargeur = (int) tailleEcran.getWidth() - 2;
    largeurMax = tailleEcran.getWidth() - 450.0d;
    creeEnvironnement(stPrimaryStage, iLargeur, iHauteur);

    File fileRepertTempFile = new File(getStrRepertAppli() + File.separator + "temp");
    setStrRepertTemp(fileRepertTempFile.getAbsolutePath());

    if (!fileRepertTempFile.exists()) {
        fileRepertTempFile.mkdirs();
    } else {
        deleteDirectory(getStrRepertTemp());
    }
    String strExtTemp = strGenereChaineAleatoire(20);
    setStrRepertTemp(getStrRepertTemp() + File.separator + "temp" + strExtTemp);
    fileRepertTempFile = new File(getStrRepertTemp());
    fileRepertTempFile.mkdirs();
    installeEvenements();
    projetsNouveau();
    stPrimaryStage.setOnCloseRequest((WindowEvent event) -> {
        try {
            sauvePreferences();
        } catch (IOException ex) {
            Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
        }
        ButtonType reponse = null;
        ButtonType buttonTypeOui = new ButtonType(rbLocalisation.getString("main.oui"));
        ButtonType buttonTypeNon = new ButtonType(rbLocalisation.getString("main.non"));
        ButtonType buttonTypeAnnule = new ButtonType(rbLocalisation.getString("main.annuler"));
        if (!isbDejaSauve()) {
            Alert alert = new Alert(AlertType.CONFIRMATION);
            alert.setTitle(rbLocalisation.getString("main.dialog.quitterApplication"));
            alert.setHeaderText(null);
            alert.setContentText(rbLocalisation.getString("main.dialog.chargeProjetMessage"));
            alert.getButtonTypes().clear();
            alert.getButtonTypes().setAll(buttonTypeOui, buttonTypeNon, buttonTypeAnnule);
            Optional<ButtonType> actReponse = alert.showAndWait();
            reponse = actReponse.get();
        }
        if (reponse == buttonTypeOui) {
            try {
                projetSauve();

            } catch (IOException ex) {
                Logger.getLogger(EditeurPanovisu.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
        if ((reponse == buttonTypeOui) || (reponse == buttonTypeNon) || (reponse == null)) {
            try {
                sauveHistoFichiers();

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

            deleteDirectory(getStrRepertTemp());
            File fileTemp = new File(getStrRepertTemp());
            fileTemp.delete();
        } else {
            event.consume();
        }
    });
}