Example usage for java.awt Dimension getHeight

List of usage examples for java.awt Dimension getHeight

Introduction

In this page you can find the example usage for java.awt Dimension getHeight.

Prototype

public double getHeight() 

Source Link

Usage

From source file:view.WorkspacePanel.java

private void btnApplySignatureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnApplySignatureActionPerformed
    if (tempCCAlias != null) {
        signatureSettings.setPageNumber(imagePanel.getPageNumber());
        signatureSettings.setCcAlias(tempCCAlias);
        signatureSettings.setReason(tfReason.getText());
        signatureSettings.setLocation(tfLocation.getText());
        if (jRadioButton1.isSelected()) {
            signatureSettings.setCertificationLevel(PdfSignatureAppearance.NOT_CERTIFIED);
        } else if (jRadioButton2.isSelected()) {
            signatureSettings.setCertificationLevel(PdfSignatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED);
        } else if (jRadioButton3.isSelected()) {
            signatureSettings.setCertificationLevel(PdfSignatureAppearance.CERTIFIED_FORM_FILLING);
        } else if (jRadioButton4.isSelected()) {
            signatureSettings//from  w  w  w.  j a v  a  2  s .c  o m
                    .setCertificationLevel(PdfSignatureAppearance.CERTIFIED_FORM_FILLING_AND_ANNOTATIONS);
        }
        signatureSettings.setOcspClient(true);
        if (cbTimestamp.isSelected()) {
            signatureSettings.setTimestamp(true);
            if (tfTimestamp.getText().isEmpty()) {
                JOptionPane.showMessageDialog(mainWindow, Bundle.getBundle().getString("msg.timestampEmpty"),
                        "", JOptionPane.ERROR_MESSAGE);
                return;
            } else {
                signatureSettings.setTimestampServer(tfTimestamp.getText());
            }
        } else {
            signatureSettings.setTimestamp(false);
            cbTimestamp.setSelected(false);
            tfTimestamp.setVisible(false);
        }
        signatureSettings.setVisibleSignature(cbVisibleSignature.isSelected());

        if (cbVisibleSignature.isSelected()) {
            Point p = tempSignature.getScaledPositionOnDocument();
            Dimension d = tempSignature.getScaledSizeOnDocument();
            float p1 = (float) p.getX();
            float p3 = (float) d.getWidth() + p1;
            float p2 = (float) ((document.getPageDimension(imagePanel.getPageNumber(), 0).getHeight())
                    - (p.getY() + d.getHeight()));
            float p4 = (float) d.getHeight() + p2;

            signatureSettings.setVisibleSignature(true);
            if (tempSignature.getImageLocation() != null) {
                signatureSettings.getAppearance().setImageLocation(tempSignature.getImageLocation());
            }
            Rectangle rect = new Rectangle(p1, p2, p3, p4);
            signatureSettings.setSignaturePositionOnDocument(rect);
            signatureSettings.setText(tfText.getText());
        } else {
            signatureSettings.setVisibleSignature(false);
        }
        if (mainWindow.getOpenedFiles().size() > 1) {
            Object[] options = { Bundle.getBundle().getString("menuItem.allDocuments"),
                    Bundle.getBundle().getString("menuItem.onlyThis"),
                    Bundle.getBundle().getString("btn.cancel") };
            int i = JOptionPane.showOptionDialog(null,
                    Bundle.getBundle().getString("msg.multipleDocumentsOpened"),
                    Bundle.getBundle().getString("msg.multipleDocumentsOpenedTitle"),
                    JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options[0]);
            if (i == 0) {
                signBatch(signatureSettings);
            } else if (i == 1) {
                signDocument(document, true, true);
            }
        } else {
            signDocument(document, true, true);
        }
    } else {
        JOptionPane.showMessageDialog(mainWindow, Bundle.getBundle().getString("noSmartcardFound"),
                WordUtils.capitalize(Bundle.getBundle().getString("error")), JOptionPane.ERROR_MESSAGE);
        changeCard(CardEnum.SIGN_PANEL, false);
    }
}

From source file:org.rdv.viz.chart.ChartPanel.java

/**
 * Paints the component by drawing the chart to fill the entire component,
 * but allowing for the insets (which will be non-zero if a border has been
 * set for this component).  To increase performance (at the expense of
 * memory), an off-screen buffer image can be used.
 *
 * @param g  the graphics device for drawing on.
 */// w  w w . j  a  v a  2s  . c o  m
public void paintComponent(Graphics g) {
    super.paintComponent(g);
    if (this.chart == null) {
        return;
    }
    Graphics2D g2 = (Graphics2D) g.create();

    // first determine the size of the chart rendering area...
    Dimension size = getSize();
    Insets insets = getInsets();
    Rectangle2D available = new Rectangle2D.Double(insets.left, insets.top,
            size.getWidth() - insets.left - insets.right, size.getHeight() - insets.top - insets.bottom);

    // work out if scaling is required...
    boolean scale = false;
    double drawWidth = available.getWidth();
    double drawHeight = available.getHeight();
    this.scaleX = 1.0;
    this.scaleY = 1.0;

    if (drawWidth < this.minimumDrawWidth) {
        this.scaleX = drawWidth / this.minimumDrawWidth;
        drawWidth = this.minimumDrawWidth;
        scale = true;
    } else if (drawWidth > this.maximumDrawWidth) {
        this.scaleX = drawWidth / this.maximumDrawWidth;
        drawWidth = this.maximumDrawWidth;
        scale = true;
    }

    if (drawHeight < this.minimumDrawHeight) {
        this.scaleY = drawHeight / this.minimumDrawHeight;
        drawHeight = this.minimumDrawHeight;
        scale = true;
    } else if (drawHeight > this.maximumDrawHeight) {
        this.scaleY = drawHeight / this.maximumDrawHeight;
        drawHeight = this.maximumDrawHeight;
        scale = true;
    }

    Rectangle2D chartArea = new Rectangle2D.Double(0.0, 0.0, drawWidth, drawHeight);

    // are we using the chart buffer?
    if (this.useBuffer) {

        // if buffer is being refreshed, it needs clearing unless it is
        // new - use the following flag to track this...
        boolean clearBuffer = true;

        // do we need to resize the buffer?
        if ((this.chartBuffer == null) || (this.chartBufferWidth != available.getWidth())
                || (this.chartBufferHeight != available.getHeight())) {
            this.chartBufferWidth = (int) available.getWidth();
            this.chartBufferHeight = (int) available.getHeight();
            this.chartBuffer = createImage(this.chartBufferWidth, this.chartBufferHeight);
            //                GraphicsConfiguration gc = g2.getDeviceConfiguration();
            //                this.chartBuffer = gc.createCompatibleImage(
            //                        this.chartBufferWidth, this.chartBufferHeight,
            //                        Transparency.TRANSLUCENT);
            this.refreshBuffer = true;
            clearBuffer = false; // buffer is new, no clearing required
        }

        // do we need to redraw the buffer?
        if (this.refreshBuffer) {

            this.refreshBuffer = false; // clear the flag

            Rectangle2D bufferArea = new Rectangle2D.Double(0, 0, this.chartBufferWidth,
                    this.chartBufferHeight);

            Graphics2D bufferG2 = (Graphics2D) this.chartBuffer.getGraphics();
            if (clearBuffer) {
                bufferG2.clearRect(0, 0, this.chartBufferWidth, this.chartBufferHeight);
            }
            if (scale) {
                AffineTransform saved = bufferG2.getTransform();
                AffineTransform st = AffineTransform.getScaleInstance(this.scaleX, this.scaleY);
                bufferG2.transform(st);
                this.chart.draw(bufferG2, chartArea, this.anchor, this.info);
                bufferG2.setTransform(saved);
            } else {
                this.chart.draw(bufferG2, bufferArea, this.anchor, this.info);
            }

        }

        // zap the buffer onto the panel...
        g2.drawImage(this.chartBuffer, insets.left, insets.top, this);

    }

    // or redrawing the chart every time...
    else {

        AffineTransform saved = g2.getTransform();
        g2.translate(insets.left, insets.top);
        if (scale) {
            AffineTransform st = AffineTransform.getScaleInstance(this.scaleX, this.scaleY);
            g2.transform(st);
        }
        this.chart.draw(g2, chartArea, this.anchor, this.info);
        g2.setTransform(saved);

    }

    // Redraw the zoom rectangle (if present)
    drawZoomRectangle(g2);

    g2.dispose();

    this.anchor = null;
    this.verticalTraceLine = null;
    this.horizontalTraceLine = null;

}

From source file:com.rapidminer.gui.plotter.charts.AbstractChartPanel.java

/**
 * Paints the component by drawing the chart to fill the entire component, but allowing for the
 * insets (which will be non-zero if a border has been set for this component). To increase
 * performance (at the expense of memory), an off-screen buffer image can be used.
 * //from w w w  . ja v  a  2s  .c  o m
 * @param g
 *            the graphics device for drawing on.
 */

@Override
public void paintComponent(Graphics g) {
    if (this.chart == null) {
        return;
    }
    Graphics2D g2 = (Graphics2D) g.create();

    // first determine the size of the chart rendering area...
    Dimension size = getSize();
    Insets insets = getInsets();
    Rectangle2D available = new Rectangle2D.Double(insets.left, insets.top,
            size.getWidth() - insets.left - insets.right, size.getHeight() - insets.top - insets.bottom);

    // work out if scaling is required...
    boolean scale = false;
    double drawWidth = available.getWidth();
    double drawHeight = available.getHeight();
    this.scaleX = 1.0;
    this.scaleY = 1.0;

    if (drawWidth < this.minimumDrawWidth) {
        this.scaleX = drawWidth / this.minimumDrawWidth;
        drawWidth = this.minimumDrawWidth;
        scale = true;
    } else if (drawWidth > this.maximumDrawWidth) {
        this.scaleX = drawWidth / this.maximumDrawWidth;
        drawWidth = this.maximumDrawWidth;
        scale = true;
    }

    if (drawHeight < this.minimumDrawHeight) {
        this.scaleY = drawHeight / this.minimumDrawHeight;
        drawHeight = this.minimumDrawHeight;
        scale = true;
    } else if (drawHeight > this.maximumDrawHeight) {
        this.scaleY = drawHeight / this.maximumDrawHeight;
        drawHeight = this.maximumDrawHeight;
        scale = true;
    }

    Rectangle2D chartArea = new Rectangle2D.Double(0.0, 0.0, drawWidth, drawHeight);
    // redrawing the chart every time...

    AffineTransform saved = g2.getTransform();
    g2.translate(insets.left, insets.top);
    if (scale) {
        AffineTransform st = AffineTransform.getScaleInstance(this.scaleX, this.scaleY);
        g2.transform(st);
    }
    this.chart.draw(g2, chartArea, this.anchor, this.info);
    g2.setTransform(saved);

    Iterator<Overlay> iterator = this.overlays.iterator();
    while (iterator.hasNext()) {
        Overlay overlay = iterator.next();
        overlay.paintOverlay(g2, this);
    }

    // redraw the zoom rectangle (if present) - if useBuffer is false,
    // we use XOR so we can XOR the rectangle away again without redrawing
    // the chart
    drawSelectionRectangle(g2);

    g2.dispose();

    this.anchor = null;
    this.verticalTraceLine = null;
    this.horizontalTraceLine = null;

}

From source file:edu.ku.brc.specify.tasks.subpane.qb.QueryBldrPane.java

/**
 * @param report/*  w  w  w .  j ava  2  s . co m*/
 * 
 * Loads and runs the query that acts as data source for report. Then runs report.
 */
public static void runReport(final SpReport report, final String title, final RecordSetIFace rs) {
    //XXX This is now also used to run Workbench reports. Really should extract the general stuff out
    //to a higher level...
    boolean isQueryBuilderRep = report.getReportObject() instanceof SpQuery;
    if (isQueryBuilderRep) {
        UsageTracker.incrUsageCount("QB.RunReport." + report.getQuery().getContextName());
    } else {
        UsageTracker.incrUsageCount("WB.RunReport");
    }
    TableTree tblTree = null;
    Hashtable<String, TableTree> ttHash = null;
    QueryParameterPanel qpp = null;
    if (isQueryBuilderRep) {
        UsageTracker.incrUsageCount("QB.RunReport." + report.getQuery().getContextName());
        QueryTask qt = (QueryTask) ContextMgr.getTaskByClass(QueryTask.class);
        if (qt != null) {
            Pair<TableTree, Hashtable<String, TableTree>> trees = qt.getTableTrees();
            tblTree = trees.getFirst();
            ttHash = trees.getSecond();
        } else {
            log.error("Could not find the Query task when running report " + report.getName());
            //blow up
            throw new RuntimeException("Could not find the Query task when running report " + report.getName());
        }
        qpp = new QueryParameterPanel();
        qpp.setQuery(report.getQuery(), tblTree, ttHash);
    }
    boolean go = true;
    try {
        JasperCompilerRunnable jcr = new JasperCompilerRunnable(null, report.getName(), null);
        jcr.findFiles();
        if (jcr.isCompileRequired()) {
            jcr.get();
        }
        //if isCompileRequired() is still true, then an error probably occurred compiling the report.
        JasperReport jr = !jcr.isCompileRequired() ? (JasperReport) JRLoader.loadObject(jcr.getCompiledFile())
                : null;
        ReportParametersPanel rpp = jr != null ? new ReportParametersPanel(jr, true) : null;
        JRDataSource src = null;
        if (rs == null && ((qpp != null && qpp.getHasPrompts()) || (rpp != null && rpp.getParamCount() > 0))) {
            Component pane = null;
            if (qpp != null && qpp.getHasPrompts() && rpp != null && rpp.getParamCount() > 0) {
                pane = new JTabbedPane();
                ((JTabbedPane) pane).addTab(UIRegistry.getResourceString("QB_REP_RUN_CRITERIA_TAB_TITLE"),
                        new JScrollPane(qpp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));

                ((JTabbedPane) pane).addTab(UIRegistry.getResourceString("QB_REP_RUN_PARAM_TAB_TITLE"),
                        new JScrollPane(rpp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
            } else if (qpp != null && qpp.getHasPrompts()) {
                pane = new JScrollPane(qpp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            } else {
                pane = new JScrollPane(rpp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                        ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
            }
            CustomDialog cd = new CustomDialog((Frame) UIRegistry.getTopWindow(),
                    UIRegistry.getResourceString("QB_GET_REPORT_CONTENTS_TITLE"), true,
                    CustomDialog.OKCANCELHELP, pane);
            cd.setHelpContext("RepRunSettings");
            cd.createUI();
            Dimension ps = cd.getPreferredSize();
            ps.setSize(ps.getWidth() * 1.3, ps.getHeight());
            cd.setSize(ps);
            UIHelper.centerAndShow(cd);
            go = !cd.isCancelled();
            cd.dispose();
        }
        if (go) {
            if (isQueryBuilderRep) {
                TableQRI rootQRI = null;
                int cId = report.getQuery().getContextTableId();
                for (TableTree tt : ttHash.values()) {
                    if (cId == tt.getTableInfo().getTableId()) {
                        rootQRI = tt.getTableQRI();
                        break;
                    }
                }
                Vector<QueryFieldPanel> qfps = new Vector<QueryFieldPanel>(qpp.getFields());
                for (int f = 0; f < qpp.getFields(); f++) {
                    qfps.add(qpp.getField(f));
                }

                HQLSpecs sql = null;

                // XXX need to allow modification of SelectDistinct(etc) ???
                //boolean includeRecordIds = true;
                boolean includeRecordIds = !report.getQuery().isSelectDistinct();

                try {
                    //XXX Is it safe to assume that query is not an export query? 
                    sql = QueryBldrPane.buildHQL(rootQRI, !includeRecordIds, qfps, tblTree, rs,
                            report.getQuery().getSearchSynonymy() == null ? false
                                    : report.getQuery().getSearchSynonymy(),
                            false, null);
                } catch (Exception ex) {
                    String msg = StringUtils.isBlank(ex.getLocalizedMessage())
                            ? getResourceString("QB_RUN_ERROR")
                            : ex.getLocalizedMessage();
                    UIRegistry.getStatusBar().setErrorMessage(msg, ex);
                    UIRegistry.writeTimedSimpleGlassPaneMsg(msg, Color.RED);
                    return;
                }
                int smushedCol = (report.getQuery().getSmushed() != null && report.getQuery().getSmushed())
                        ? getSmushedCol(qfps) + 1
                        : -1;
                src = new QBDataSource(sql.getHql(), sql.getArgs(), sql.getSortElements(),
                        getColumnInfo(qfps, true, rootQRI.getTableInfo(), false), includeRecordIds,
                        report.getRepeats(), smushedCol, /*getRecordIdCol(qfps)*/0);
                ((QBDataSource) src).startDataAcquisition();
            } else {
                DataProviderSessionIFace session = DataProviderFactory.getInstance().createSession();
                try {
                    boolean loadedWB = false;
                    if (rs != null && rs.getOnlyItem() != null) {
                        Workbench wb = session.get(Workbench.class, rs.getOnlyItem().getRecordId());
                        if (wb != null) {
                            wb.forceLoad();
                            src = new WorkbenchJRDataSource(wb, true, report.getRepeats());
                            loadedWB = true;
                        }
                    }
                    if (!loadedWB) {
                        UIRegistry.displayErrorDlgLocalized("QueryBldrPane.WB_LOAD_ERROR_FOR_REPORT",
                                rs != null ? rs.getName() : "[" + UIRegistry.getResourceString("NONE") + "]");
                        return;
                    }
                } finally {
                    session.close();
                }
            }

            final CommandAction cmd = new CommandAction(ReportsBaseTask.REPORTS, ReportsBaseTask.PRINT_REPORT,
                    src);
            cmd.setProperty("title", title);
            cmd.setProperty("file", report.getName());
            if (rs == null) {
                cmd.setProperty("skip-parameter-prompt", "true");
            }
            //if isCompileRequired is true then an error probably occurred while compiling,
            //and, if so, it will be caught again and reported in the report results pane.
            if (!jcr.isCompileRequired()) {
                cmd.setProperty("compiled-file", jcr.getCompiledFile());
            }
            if (rpp != null && rpp.getParamCount() > 0) {
                StringBuilder params = new StringBuilder();
                for (int p = 0; p < rpp.getParamCount(); p++) {
                    Pair<String, String> param = rpp.getParam(p);
                    if (StringUtils.isNotBlank(param.getSecond())) {
                        params.append(param.getFirst());
                        params.append("=");
                        params.append(param.getSecond());
                        params.append(";");
                    }
                    cmd.setProperty("params", params.toString());
                }
            }
            CommandDispatcher.dispatch(cmd);
        }
    } catch (JRException ex) {
        UsageTracker.incrHandledUsageCount();
        edu.ku.brc.exceptions.ExceptionTracker.getInstance().capture(QueryBldrPane.class, ex);
        log.error(ex);
        ex.printStackTrace();
    }
}

From source file:editeurpanovisu.EditeurPanovisu.java

/**
 *
 * @param primaryStage/*  w  w w.j ava  2 s .c o  m*/
 * @throws Exception
 */
@Override
public void start(Stage primaryStage) throws Exception {
    File rep = new File("");
    currentDir = rep.getAbsolutePath();
    repertAppli = rep.getAbsolutePath();
    repertConfig = new File(repertAppli + File.separator + "configPV");
    if (!repertConfig.exists()) {
        repertConfig.mkdirs();
        locale = new Locale("fr", "FR");
        setUserAgentStylesheet("file:css/clair.css");
        repertoireProjet = repertAppli;
    } else {
        lisFichierConfig();
    }
    rb = ResourceBundle.getBundle("editeurpanovisu.i18n.PanoVisu", locale);
    stPrincipal = primaryStage;
    stPrincipal.setResizable(false);
    stPrincipal.setTitle("PanoVisu v" + numVersion);
    //AquaFx.style();
    //        setUserAgentStylesheet(STYLESHEET_MODENA);
    primaryStage.setMaximized(true);
    Dimension tailleEcran = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
    int hauteur = (int) tailleEcran.getHeight() - 20;
    int largeur = (int) tailleEcran.getWidth() - 20;
    largeurMax = tailleEcran.getWidth() - 450.0d;
    creeEnvironnement(primaryStage, largeur, hauteur);

    File repertTempFile = new File(repertAppli + File.separator + "temp");
    repertTemp = repertTempFile.getAbsolutePath();

    if (!repertTempFile.exists()) {
        repertTempFile.mkdirs();
    } else {
        deleteDirectory(repertTemp);
    }
    String extTemp = genereChaineAleatoire(20);
    repertTemp = repertTemp + File.separator + "temp" + extTemp;
    repertTempFile = new File(repertTemp);
    repertTempFile.mkdirs();
    installeEvenements();
    projetsNouveau();
    primaryStage.setOnCloseRequest((WindowEvent event) -> {
        Action reponse = null;
        Localization.setLocale(locale);
        if (!dejaSauve) {
            reponse = Dialogs.create().owner(null).title("Quitter l'diteur")
                    .masthead("ATTENTION ! Vous n'avez pas sauvegard votre projet")
                    .message("Voulez vous le sauver ?")
                    .actions(Dialog.Actions.YES, Dialog.Actions.NO, Dialog.Actions.CANCEL).showWarning();
        }
        if (reponse == Dialog.Actions.YES) {
            try {
                projetSauve();

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

            deleteDirectory(repertTemp);
            File ftemp = new File(repertTemp);
            ftemp.delete();
        } else {
            event.consume();
        }
    });
}

From source file:editeurpanovisu.EditeurPanovisu.java

private void genereVisite() throws IOException {
    if (!repertSauveChoisi) {
        repertoireProjet = currentDir;//  w  w w. j  a va2  s  .  c o m
    }
    if (!dejaSauve) {
        projetSauve();
    }
    if (dejaSauve) {
        deleteDirectory(repertTemp + "/panovisu/images");
        File imagesRepert = new File(repertTemp + "/panovisu/images");
        if (!imagesRepert.exists()) {
            imagesRepert.mkdirs();
        }
        File boutonRepert = new File(repertTemp + "/panovisu/images/navigation");
        if (!boutonRepert.exists()) {
            boutonRepert.mkdirs();
        }
        File boussoleRepert = new File(repertTemp + "/panovisu/images/boussoles");
        if (!boussoleRepert.exists()) {
            boussoleRepert.mkdirs();
        }
        copieDirectory(repertAppli + File.separator + "panovisu/images/boussoles",
                boussoleRepert.getAbsolutePath());
        File planRepert = new File(repertTemp + "/panovisu/images/plan");
        if (!planRepert.exists()) {
            planRepert.mkdirs();
        }
        copieDirectory(repertAppli + File.separator + "panovisu/images/plan", planRepert.getAbsolutePath());
        File reseauRepert = new File(repertTemp + "/panovisu/images/reseaux");
        if (!reseauRepert.exists()) {
            reseauRepert.mkdirs();
        }
        copieDirectory(repertAppli + File.separator + "panovisu/images/reseaux",
                reseauRepert.getAbsolutePath());
        File interfaceRepert = new File(repertTemp + "/panovisu/images/interface");
        if (!interfaceRepert.exists()) {
            interfaceRepert.mkdirs();
        }
        copieDirectory(repertAppli + File.separator + "panovisu/images/interface",
                interfaceRepert.getAbsolutePath());
        File MARepert = new File(repertTemp + "/panovisu/images/MA");
        if (!MARepert.exists()) {
            MARepert.mkdirs();
        }
        File hotspotsRepert = new File(repertTemp + "/panovisu/images/hotspots");
        if (!hotspotsRepert.exists()) {
            hotspotsRepert.mkdirs();
        }
        copieFichierRepertoire(repertAppli + File.separator + "panovisu" + File.separator + "images"
                + File.separator + "aide_souris.png", repertTemp + "/panovisu/images");
        copieFichierRepertoire(repertAppli + File.separator + "panovisu" + File.separator + "images"
                + File.separator + "fermer.png", repertTemp + "/panovisu/images");
        copieFichierRepertoire(repertAppli + File.separator + "panovisu" + File.separator + "images"
                + File.separator + "precedent.png", repertTemp + "/panovisu/images");
        copieFichierRepertoire(repertAppli + File.separator + "panovisu" + File.separator + "images"
                + File.separator + "suivant.png", repertTemp + "/panovisu/images");
        for (int i = 0; i < gestionnaireInterface.nombreImagesBouton - 1; i++) {
            ReadWriteImage.writePng(gestionnaireInterface.nouveauxBoutons[i],
                    boutonRepert.getAbsolutePath() + File.separator + gestionnaireInterface.nomImagesBoutons[i],
                    false, 0.f);
        }
        ReadWriteImage.writePng(
                gestionnaireInterface.nouveauxBoutons[gestionnaireInterface.nombreImagesBouton - 1],
                hotspotsRepert.getAbsolutePath() + File.separator + "hotspot.png", false, 0.f);
        ReadWriteImage.writePng(gestionnaireInterface.nouveauxBoutons[gestionnaireInterface.nombreImagesBouton],
                hotspotsRepert.getAbsolutePath() + File.separator + "hotspotImage.png", false, 0.f);
        ReadWriteImage.writePng(gestionnaireInterface.nouveauxMasque,
                MARepert.getAbsolutePath() + File.separator + "MA.png", false, 0.f);

        File xmlRepert = new File(repertTemp + File.separator + "xml");
        if (!xmlRepert.exists()) {
            xmlRepert.mkdirs();
        }
        File cssRepert = new File(repertTemp + File.separator + "css");
        if (!cssRepert.exists()) {
            cssRepert.mkdirs();
        }
        File jsRepert = new File(repertTemp + File.separator + "js");
        if (!jsRepert.exists()) {
            jsRepert.mkdirs();
        }
        String contenuFichier;
        File xmlFile;
        String chargeImages = "";

        for (int i = 0; i < nombrePanoramiques; i++) {
            String fPano = "panos/" + panoramiquesProjet[i].getNomFichier()
                    .substring(panoramiquesProjet[i].getNomFichier().lastIndexOf(File.separator) + 1,
                            panoramiquesProjet[i].getNomFichier().length())
                    .split("\\.")[0];
            if (panoramiquesProjet[i].getTypePanoramique().equals(Panoramique.CUBE)) {
                fPano = fPano.substring(0, fPano.length() - 2);
                chargeImages += "                images[" + i + "]=\"" + fPano + "_f.jpg\"\n";
                chargeImages += "                images[" + i + "]=\"" + fPano + "_b.jpg\"\n";
                chargeImages += "                images[" + i + "]=\"" + fPano + "_u.jpg\"\n";
                chargeImages += "                images[" + i + "]=\"" + fPano + "_d.jpg\"\n";
                chargeImages += "                images[" + i + "]=\"" + fPano + "_r.jpg\"\n";
                chargeImages += "                images[" + i + "]=\"" + fPano + "_l.jpg\"\n";
            } else {
                chargeImages += "                images[" + i + "]=\"" + fPano + ".jpg\"\n";
            }
            String affInfo = (panoramiquesProjet[i].isAfficheInfo()) ? "oui" : "non";
            String affTitre = (gestionnaireInterface.bAfficheTitre) ? "oui" : "non";
            double regX;
            double zN;
            if (panoramiquesProjet[i].getTypePanoramique().equals(Panoramique.SPHERE)) {
                regX = Math.round(((panoramiquesProjet[i].getLookAtX() - 180) % 360) * 10) / 10;
                zN = Math.round(((panoramiquesProjet[i].getZeroNord() - 180) % 360) * 10) / 10;
            } else {
                regX = Math.round(((panoramiquesProjet[i].getLookAtX() + 90) % 360) * 10) / 10;
                zN = Math.round(((panoramiquesProjet[i].getZeroNord() + 90) % 360) * 10) / 10;
            }
            int rouge = (int) (Color.valueOf(gestionnaireInterface.couleurDiaporama).getRed() * 255.d);
            int bleu = (int) (Color.valueOf(gestionnaireInterface.couleurDiaporama).getBlue() * 255.d);
            int vert = (int) (Color.valueOf(gestionnaireInterface.couleurDiaporama).getGreen() * 255.d);
            String coulDiapo = "rgba(" + rouge + "," + vert + "," + bleu + ","
                    + gestionnaireInterface.diaporamaOpacite + ")";

            Color coulTitre = Color.valueOf(gestionnaireInterface.couleurFondTitre);
            rouge = (int) (coulTitre.getRed() * 255.d);
            bleu = (int) (coulTitre.getBlue() * 255.d);
            vert = (int) (coulTitre.getGreen() * 255.d);
            String coulFondTitre = "rgba(" + rouge + "," + vert + "," + bleu + ","
                    + gestionnaireInterface.titreOpacite + ")";

            contenuFichier = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<!--\n"
                    + "     Visite gnre par l'diteur panoVisu \n" + "\n"
                    + "             Cration L.LANG      le monde  360  : http://lemondea360.fr\n"
                    + "-->\n" + "\n" + "\n" + "<scene>\n" + "   <pano \n" + "      image=\"" + fPano + "\"\n"
                    + "      titre=\"" + panoramiquesProjet[i].getTitrePanoramique() + "\"\n"
                    + "      titrePolice=\"" + gestionnaireInterface.titrePoliceNom + "\"\n"
                    + "      titreTaillePolice=\""
                    + Math.round(Double.parseDouble(gestionnaireInterface.titrePoliceTaille)) + "px\"\n"
                    + "      titreTaille=\"" + Math.round(gestionnaireInterface.titreTaille) + "%\"\n"
                    + "      titreFond=\"" + coulFondTitre + "\"\n" + "      titreCouleur=\""
                    + gestionnaireInterface.couleurTitre + "\"\n"
                    //                        + "      titreOpacite=\"" + gestionnaireInterface.titreOpacite + "\"\n"
                    + "      diaporamaCouleur=\"" + coulDiapo + "\"\n" + "      type=\""
                    + panoramiquesProjet[i].getTypePanoramique() + "\"\n" + "      multiReso=\"oui\"\n"
                    + "      nombreNiveaux=\"" + panoramiquesProjet[i].getNombreNiveaux() + "\"\n"
                    + "      zeroNord=\"" + zN + "\"\n" + "      regardX=\"" + regX + "\"\n"
                    + "      regardY=\"" + Math.round(panoramiquesProjet[i].getLookAtY() * 10) / 10 + "\"\n"
                    + "      affinfo=\"" + affInfo + "\"\n" + "      afftitre=\"" + affTitre + "\"\n"
                    + "   />\n" + "   <!--Dfinition de la Barre de navigation-->\n" + "   <boutons \n"
                    + "      styleBoutons=\"navigation\"\n" + "      couleur=\"rgba(255,255,255,0)\"\n"
                    + "      bordure=\"rgba(255,255,255,0)\"\n" + "      deplacements=\""
                    + gestionnaireInterface.toggleBarreDeplacements + "\" \n" + "      zoom=\""
                    + gestionnaireInterface.toggleBarreZoom + "\" \n" + "      outils=\""
                    + gestionnaireInterface.toggleBarreOutils + "\"\n" + "      fs=\""
                    + gestionnaireInterface.toggleBoutonFS + "\" \n" + "      souris=\""
                    + gestionnaireInterface.toggleBoutonSouris + "\" \n" + "      rotation=\""
                    + gestionnaireInterface.toggleBoutonRotation + "\" \n" + "      positionX=\""
                    + gestionnaireInterface.positionBarre.split(":")[1] + "\"\n" + "      positionY=\""
                    + gestionnaireInterface.positionBarre.split(":")[0] + "\" \n" + "      dX=\""
                    + gestionnaireInterface.dXBarre + "\" \n" + "      dY=\"" + gestionnaireInterface.dYBarre
                    + "\"\n" + "      espacement=\"" + Math.round(gestionnaireInterface.espacementBoutons)
                    + "\"\n" + "      visible=\"" + gestionnaireInterface.toggleBarreVisibilite + "\"\n"
                    + "   />\n";
            if (gestionnaireInterface.bAfficheBoussole) {
                String SAiguille = (gestionnaireInterface.bAiguilleMobileBoussole) ? "oui" : "non";
                contenuFichier += "<!--  Boussole -->\n" + "    <boussole \n" + "        affiche=\"oui\"\n"
                        + "        image=\"" + gestionnaireInterface.imageBoussole + "\"\n"
                        + "        taille=\"" + gestionnaireInterface.tailleBoussole + "\"\n"
                        + "        positionY=\"" + gestionnaireInterface.positionBoussole.split(":")[0] + "\"\n"
                        + "        positionX=\"" + gestionnaireInterface.positionBoussole.split(":")[1] + "\"\n"
                        + "        opacite=\"" + gestionnaireInterface.opaciteBoussole + "\"\n"
                        + "        dX=\"" + gestionnaireInterface.dXBoussole + "\"\n" + "        dY=\""
                        + gestionnaireInterface.dYBoussole + "\"\n" + "        aiguille=\"" + SAiguille + "\"\n"
                        + "    />\n";
            }
            if (gestionnaireInterface.bAfficheMenuContextuel) {
                String SPrecSuiv = (gestionnaireInterface.bAffichePrecSuivMC) ? "oui" : "non";
                String SPlanet = (gestionnaireInterface.bAffichePlanetNormalMC) ? "oui" : "non";
                String SPers1 = (gestionnaireInterface.bAffichePersMC1) ? "oui" : "non";
                String SPers2 = (gestionnaireInterface.bAffichePersMC2) ? "oui" : "non";
                contenuFichier += "<!--  MenuContextuel -->\n" + "    <menuContextuel \n"
                        + "        affiche=\"oui\"\n" + "        precSuiv=\"" + SPrecSuiv + "\"\n"
                        + "        planete=\"" + SPlanet + "\"\n" + "        pers1=\"" + SPers1 + "\"\n"
                        + "        lib1=\"" + gestionnaireInterface.stPersLib1 + "\"\n" + "        url1=\""
                        + gestionnaireInterface.stPersURL1 + "\"\n" + "        pers2=\"" + SPers2 + "\"\n"
                        + "        lib2=\"" + gestionnaireInterface.stPersLib2 + "\"\n" + "        url2=\""
                        + gestionnaireInterface.stPersURL2 + "\"\n" + "    />\n";
            }
            if (gestionnaireInterface.bSuivantPrecedent) {

                int panoPrecedent = (i == nombrePanoramiques - 1) ? 0 : i + 1;
                int panoSuivant = (i == 0) ? nombrePanoramiques - 1 : i - 1;
                String nomPano = panoramiquesProjet[panoSuivant].getNomFichier();
                String strPanoSuivant = "xml/"
                        + nomPano.substring(nomPano.lastIndexOf(File.separator) + 1, nomPano.lastIndexOf("."))
                        + ".xml";
                nomPano = panoramiquesProjet[panoPrecedent].getNomFichier();
                String strPanoPrecedent = "xml/"
                        + nomPano.substring(nomPano.lastIndexOf(File.separator) + 1, nomPano.lastIndexOf("."))
                        + ".xml";
                contenuFichier += "<!--  Bouton Suivant Precedent -->\n" + "    <suivantPrecedent\n"
                        + "        suivant=\"" + strPanoSuivant + "\"            \n" + "        precedent=\""
                        + strPanoPrecedent + "\"            \n" + "    />    \n" + "";
            }
            if (gestionnaireInterface.bAfficheMasque) {
                String SNavigation = (gestionnaireInterface.bMasqueNavigation) ? "oui" : "non";
                String SBoussole = (gestionnaireInterface.bMasqueBoussole) ? "oui" : "non";
                String STitre = (gestionnaireInterface.bMasqueTitre) ? "oui" : "non";
                String splan = (gestionnaireInterface.bMasquePlan) ? "oui" : "non";
                String SReseaux = (gestionnaireInterface.bMasqueReseaux) ? "oui" : "non";
                String SVignettes = (gestionnaireInterface.bMasqueVignettes) ? "oui" : "non";
                contenuFichier += "<!--  Bouton de Masquage -->\n" + "    <marcheArret \n"
                        + "        affiche=\"oui\"\n" + "        image=\"MA.png\"\n" + "        taille=\""
                        + gestionnaireInterface.tailleMasque + "\"\n" + "        positionY=\""
                        + gestionnaireInterface.positionMasque.split(":")[0] + "\"\n" + "        positionX=\""
                        + gestionnaireInterface.positionMasque.split(":")[1] + "\"\n" + "        opacite=\""
                        + gestionnaireInterface.opaciteMasque + "\"\n" + "        dX=\""
                        + gestionnaireInterface.dXMasque + "\"\n" + "        dy=\""
                        + gestionnaireInterface.dYMasque + "\"\n" + "        navigation=\"" + SNavigation
                        + "\"\n" + "        boussole=\"" + SBoussole + "\"\n" + "        titre=\"" + STitre
                        + "\"\n" + "        plan=\"" + splan + "\"\n" + "        reseaux=\"" + SReseaux + "\"\n"
                        + "        vignettes=\"" + SVignettes + "\"\n" + "    />\n";
            }

            if (gestionnaireInterface.bAfficheReseauxSociaux) {
                String STwitter = (gestionnaireInterface.bReseauxSociauxTwitter) ? "oui" : "non";
                String SGoogle = (gestionnaireInterface.bReseauxSociauxGoogle) ? "oui" : "non";
                String SFacebook = (gestionnaireInterface.bReseauxSociauxFacebook) ? "oui" : "non";
                String SEmail = (gestionnaireInterface.bReseauxSociauxEmail) ? "oui" : "non";
                contenuFichier += "<!--  Rseaux Sociaux -->\n" + "    <reseauxSociaux \n"
                        + "        affiche=\"oui\"\n" + "        taille=\""
                        + gestionnaireInterface.tailleReseauxSociaux + "\"\n" + "        positionY=\""
                        + gestionnaireInterface.positionReseauxSociaux.split(":")[0] + "\"\n"
                        + "        positionX=\"" + gestionnaireInterface.positionReseauxSociaux.split(":")[1]
                        + "\"\n" + "        opacite=\"" + gestionnaireInterface.opaciteReseauxSociaux + "\"\n"
                        + "        dX=\"" + gestionnaireInterface.dXReseauxSociaux + "\"\n" + "        dY=\""
                        + gestionnaireInterface.dYReseauxSociaux + "\"\n" + "        twitter=\"" + STwitter
                        + "\"\n" + "        google=\"" + SGoogle + "\"\n" + "        facebook=\"" + SFacebook
                        + "\"\n" + "        email=\"" + SEmail + "\"\n" + "    />\n";
            }
            if (gestionnaireInterface.bAfficheVignettes) {
                String SAfficheVignettes = (gestionnaireInterface.bAfficheVignettes) ? "oui" : "non";
                contenuFichier += "<!-- Barre des vignettes -->" + "    <vignettes \n" + "        affiche=\""
                        + SAfficheVignettes + "\"\n" + "        tailleImage=\""
                        + gestionnaireInterface.tailleImageVignettes + "\"\n" + "        fondCouleur=\""
                        + gestionnaireInterface.couleurFondVignettes + "\"\n" + "        texteCouleur=\""
                        + gestionnaireInterface.couleurTexteVignettes + "\"\n" + "        opacite=\""
                        + gestionnaireInterface.opaciteVignettes + "\"\n" + "        position=\""
                        + gestionnaireInterface.positionVignettes + "\"\n" + "    >\n";
                for (int j = 0; j < nombrePanoramiques; j++) {
                    String nomPano = panoramiquesProjet[j].getNomFichier();
                    String nFichier = nomPano.substring(nomPano.lastIndexOf(File.separator) + 1,
                            nomPano.lastIndexOf(".")) + "Vignette.jpg";
                    String nXML = nomPano.substring(nomPano.lastIndexOf(File.separator) + 1,
                            nomPano.lastIndexOf(".")) + ".xml";
                    ReadWriteImage.writeJpeg(panoramiquesProjet[j].getVignettePanoramique(),
                            repertTemp + "/panos/" + nFichier, 1.0f, false, 0.0f);
                    contenuFichier += "        <imageVignette \n" + "            image=\"panos/" + nFichier
                            + "\"\n" + "            xml=\"xml/" + nXML + "\"\n" + "        />\n";
                }
                contenuFichier += "    </vignettes>       \n" + "";

            }

            contenuFichier += "    <!--Dfinition des hotspots-->  \n" + "   <hotspots>\n";
            for (int j = 0; j < panoramiquesProjet[i].getNombreHotspots(); j++) {
                HotSpot HS = panoramiquesProjet[i].getHotspot(j);
                double longit;
                if (panoramiquesProjet[i].getTypePanoramique().equals(Panoramique.SPHERE)) {
                    longit = HS.getLongitude() - 180;
                } else {
                    longit = HS.getLongitude() + 90;
                }
                String txtAnime = (HS.isAnime()) ? "true" : "false";
                contenuFichier += "      <point \n" + "           type=\"panoramique\"\n" + "           long=\""
                        + longit + "\"\n" + "           lat=\"" + HS.getLatitude() + "\"\n"
                        + "           image=\"panovisu/images/hotspots/hotspot.png\"\n"
                        + "           xml=\"xml/" + HS.getFichierXML() + "\"\n" + "           info=\""
                        + HS.getInfo() + "\"\n" + "           anime=\"" + txtAnime + "\"\n" + "      />\n";
            }
            for (int j = 0; j < panoramiquesProjet[i].getNombreHotspotImage(); j++) {
                HotspotImage HS = panoramiquesProjet[i].getHotspotImage(j);
                double longit;
                if (panoramiquesProjet[i].getTypePanoramique().equals(Panoramique.SPHERE)) {
                    longit = HS.getLongitude() - 180;
                } else {
                    longit = HS.getLongitude() + 90;
                }
                String txtAnime = (HS.isAnime()) ? "true" : "false";
                contenuFichier += "      <point \n" + "           type=\"image\"\n" + "           long=\""
                        + longit + "\"\n" + "           lat=\"" + HS.getLatitude() + "\"\n"
                        + "           image=\"panovisu/images/hotspots/hotspotImage.png\"\n"
                        + "           img=\"images/" + HS.getLienImg() + "\"\n" + "           info=\""
                        + HS.getInfo() + "\"\n" + "           anime=\"" + txtAnime + "\"\n" + "      />\n";
            }
            contenuFichier += "   </hotspots>\n";
            contenuFichier += "\n" + "<!-- Dfinition des images de fond -->\n" + "\n";
            if (gestionnaireInterface.nombreImagesFond > 0) {
                for (int ii = 0; ii < gestionnaireInterface.nombreImagesFond; ii++) {
                    ImageFond imgFond = gestionnaireInterface.imagesFond[ii];
                    String strImgFond = "images/" + imgFond.getFichierImage().substring(
                            imgFond.getFichierImage().lastIndexOf(File.separator) + 1,
                            imgFond.getFichierImage().length());
                    String SMasquable = (imgFond.isMasquable()) ? "oui" : "non";

                    contenuFichier += "    <imageFond\n" + "        fichier=\"" + strImgFond + "\"\n"
                            + "        posX=\"" + imgFond.getPosX() + "\" \n" + "        posY=\""
                            + imgFond.getPosY() + "\" \n" + "        offsetX=\"" + imgFond.getOffsetX()
                            + "\" \n" + "        offsetY=\"" + imgFond.getOffsetY() + "\" \n"
                            + "        tailleX=\"" + imgFond.getTailleX() + "\" \n" + "        tailleY=\""
                            + imgFond.getTailleY() + "\" \n" + "        opacite=\"" + imgFond.getOpacite()
                            + "\" \n" + "        masquable=\"" + SMasquable + "\" \n" + "        url=\""
                            + imgFond.getUrl() + "\" \n" + "        infobulle=\"" + imgFond.getInfobulle()
                            + "\" \n" + "    />\n" + "";
                }
            }
            if (gestionnaireInterface.bAffichePlan && panoramiquesProjet[i].isAffichePlan()) {
                int numPlan = panoramiquesProjet[i].getNumeroPlan();
                Plan planPano = plans[numPlan];
                rouge = (int) (gestionnaireInterface.couleurFondPlan.getRed() * 255.d);
                bleu = (int) (gestionnaireInterface.couleurFondPlan.getBlue() * 255.d);
                vert = (int) (gestionnaireInterface.couleurFondPlan.getGreen() * 255.d);
                String SAfficheRadar = (gestionnaireInterface.bAfficheRadar) ? "oui" : "non";
                String coulFond = "rgba(" + rouge + "," + vert + "," + bleu + ","
                        + gestionnaireInterface.opacitePlan + ")";
                contenuFichier += "    <plan\n" + "        affiche=\"oui\" \n" + "        image=\"images/"
                        + planPano.getImagePlan() + "\"\n" + "        largeur=\""
                        + gestionnaireInterface.largeurPlan + "\"\n" + "        position=\""
                        + gestionnaireInterface.positionPlan + "\"\n" + "        couleurFond=\"" + coulFond
                        + "\"\n" + "        couleurTexte=\"#" + gestionnaireInterface.txtCouleurTextePlan
                        + "\"\n" + "        nord=\"" + planPano.getDirectionNord() + "\"\n"
                        + "        boussolePosition=\"" + planPano.getPosition() + "\"\n"
                        + "        boussoleX=\"" + planPano.getPositionX() + "\"\n" + "        boussoleY=\""
                        + planPano.getPositionX() + "\"\n" + "        radarAffiche=\"" + SAfficheRadar + "\"\n"
                        + "        radarTaille=\"" + Math.round(gestionnaireInterface.tailleRadar) + "\"\n"
                        + "        radarCouleurFond=\"#" + gestionnaireInterface.txtCouleurFondRadar + "\"\n"
                        + "        radarCouleurLigne=\"#" + gestionnaireInterface.txtCouleurLigneRadar + "\"\n"
                        + "        radarOpacite=\""
                        + Math.round(gestionnaireInterface.opaciteRadar * 100.d) / 100.d + "\"\n" + "    >\n";
                for (int iPoint = 0; iPoint < planPano.getNombreHotspots(); iPoint++) {
                    double posX = planPano.getHotspot(iPoint).getLongitude()
                            * gestionnaireInterface.largeurPlan;
                    double posY = planPano.getHotspot(iPoint).getLatitude() * planPano.getHauteurPlan()
                            * gestionnaireInterface.largeurPlan / planPano.getLargeurPlan();
                    if (planPano.getHotspot(iPoint).getNumeroPano() == i) {
                        contenuFichier += "        <pointPlan\n" + "            positX=\"" + posX + "\"\n"
                                + "            positY=\"" + posY + "\"\n" + "            xml=\"actif\"\n"
                                + "            />  \n";

                    } else {
                        contenuFichier += "        <pointPlan\n" + "            positX=\"" + posX + "\"\n"
                                + "            positY=\"" + posY + "\"\n" + "            xml=\"xml/"
                                + planPano.getHotspot(iPoint).getFichierXML() + "\"\n" + "            texte=\""
                                + planPano.getHotspot(iPoint).getInfo() + "\"\n" + "            />  \n";
                    }
                }
                contenuFichier += "    </plan>\n";
            }

            contenuFichier += "</scene>\n";
            String fichierPano = panoramiquesProjet[i].getNomFichier();
            String nomXMLFile = fichierPano
                    .substring(fichierPano.lastIndexOf(File.separator) + 1, fichierPano.length())
                    .split("\\.")[0] + ".xml";
            xmlFile = new File(xmlRepert + File.separator + nomXMLFile);
            xmlFile.setWritable(true);
            FileWriter fw = new FileWriter(xmlFile);
            try (BufferedWriter bw = new BufferedWriter(fw)) {
                bw.write(contenuFichier);
            }
        }
        Dimension tailleEcran = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
        int hauteur = (int) tailleEcran.getHeight() - 200;
        String titreVis = "Panovisu - visualiseur 100% html5 (three.js)";
        TextArea tfVisite = (TextArea) paneChoixPanoramique.lookup("#titreVisite");
        if (!tfVisite.getText().equals("")) {
            titreVis = tfVisite.getText() + " - " + titreVis;
        }
        String fPano1 = "panos/niveau0/" + panoramiquesProjet[0].getNomFichier().substring(
                panoramiquesProjet[0].getNomFichier().lastIndexOf(File.separator) + 1,
                panoramiquesProjet[0].getNomFichier().length());

        String fichierHTML = "<!DOCTYPE html>\n" + "<html lang=\"fr\">\n" + "    <head>\n" + "        <title>"
                + titreVis + "</title>\n" + "        <meta charset=\"utf-8\">\n"
                + "        <meta name=\"viewport\" content=\"width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0\">\n"
                + "        <link rel=\"stylesheet\" media=\"screen\" href=\"panovisu/libs/jqueryMenu/jquery.contextMenu.css\" type=\"text/css\"/>\n"
                + "        <meta property=\"og:title\" content=\"" + titreVis + "\" />\n"
                + "        <meta property=\"og:description\" content=\"Une page cre avec panoVisu Editeur : 100% Libre 100% HTML5\" />\n"
                + "        <meta property=\"og:image\" content=\"" + fPano1 + "\" />" + "    </head>\n"
                + "    <body>\n" + "        <header>\n" + "\n" + "        </header>\n"
                + "        <article style=\"height : " + hauteur + "px;\">\n"
                + "            <div id=\"pano\">\n" + "            </div>\n" + "        </article>\n"
                + "        <script src=\"panovisu/panovisuInit.js\"></script>\n"
                + "        <script src=\"panovisu/panovisu.js\"></script>\n" + "        <script>\n" + "\n"
                + "            $(function() {\n" + "                $(window).resize(function(){\n"
                + "                    $(\"article\").height($(window).height()-10);\n"
                + "                    $(\"#pano\").height($(window).height()-10);\n" + "                })\n"
                + "                $(\"article\").height($(window).height()-10);\n"
                + "                $(\"#pano\").height($(window).height()-10);\n"
                + "                ajoutePano({\n" + "                    langue : \"" + locale.toString()
                + "\",\n" + "                    panoramique: \"pano\",\n" + "                    minFOV: 35,\n"
                + "                    maxFOV: 120,\n" + "                    fenX: \"100%\",\n"
                + "                    fenY: \"100%\",\n" + "                    xml: \"xml/PANO.xml\"\n"
                + "                });\n"
                + "                $(\".reseauSocial-twitter\").on(\"click\", function() {\n"
                + "                    window.open(\n"
                + "                            \"https://twitter.com/share?url=\" + document.location.href\n"
                + "                            );\n" + "                    return false;\n"
                + "                });\n"
                + "                $(\".reseauSocial-fb\").on(\"click\", function() {\n"
                + "                    window.open(\n"
                + "                            \"http://www.facebook.com/share.php?u=\" + document.location.href\n"
                + "                            );\n" + "                    return false;\n"
                + "                });\n"
                + "                $(\".reseauSocial-google\").on(\"click\", function() {\n"
                + "                    window.open(\n"
                + "                            \"https://plus.google.com/share?url=\" + document.location.href + \"&amp;hl=fr\"\n"
                + "                            );\n" + "                    return false;\n"
                + "                });\n"
                + "                $(\".reseauSocial-email\").attr(\"href\",\"mailto:?body=\" + document.location.href + \"&amp;hl=fr\");\n"
                //                    + "                images=new Array();\n"
                //                    + chargeImages
                //                    + "                prechargeImages(images); \n \n"
                + "            });\n" + "        </script>\n" + "    </body>\n" + "</html>\n";
        if (panoEntree.equals("")) {
            fichierHTML = fichierHTML
                    .replace("PANO",
                            panoramiquesProjet[0].getNomFichier()
                                    .substring(panoramiquesProjet[0].getNomFichier().lastIndexOf(File.separator)
                                            + 1, panoramiquesProjet[0].getNomFichier().length())
                                    .split("\\.")[0]);
        } else {
            fichierHTML = fichierHTML.replace("PANO", panoEntree);
        }
        File fichIndexHTML = new File(repertTemp + File.separator + "index.html");
        fichIndexHTML.setWritable(true);
        FileWriter fw1 = new FileWriter(fichIndexHTML);
        try (BufferedWriter bw1 = new BufferedWriter(fw1)) {
            bw1.write(fichierHTML);
        }
        DirectoryChooser repertChoix = new DirectoryChooser();
        repertChoix.setTitle("Choix du repertoire de sauvegarde de la visite");
        File repert = new File(EditeurPanovisu.repertoireProjet);
        repertChoix.setInitialDirectory(repert);
        File repertVisite = repertChoix.showDialog(null);

        String nomRepertVisite = repertVisite.getAbsolutePath();
        copieDirectory(repertTemp, nomRepertVisite);
        Dialogs.create().title("Gnration de la visite")
                .message("Votre visite a bien t gnr dans le rpertoire : " + nomRepertVisite)
                .showInformation();
        if (Desktop.isDesktopSupported()) {
            if (Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
                Desktop dt = Desktop.getDesktop();
                File fIndex = new File(nomRepertVisite + File.separator + "index.html");
                dt.browse(fIndex.toURI());
            }
        }
    } else {
        Dialogs.create().title("Gnration de la visite")
                .message("Votre visite n'a pu tre gnre, votre fichier n'tant pas sauvegard")
                .showError();

    }
}

From source file:statos2_0.StatOS2_0.java

@Override
public void start(Stage primaryStage) {
    primaryStage.setTitle("");

    GridPane root = new GridPane();
    Dimension sSize = Toolkit.getDefaultToolkit().getScreenSize();
    root.setAlignment(Pos.CENTER);//from w w w .  j  a  v a  2 s.  com
    root.setHgap(10);
    root.setVgap(10);
    root.setPadding(new Insets(25, 25, 25, 25));

    Text scenetitle = new Text("");

    root.add(scenetitle, 0, 0, 2, 1);
    scenetitle.setId("welcome-text");
    Label userName = new Label(":");
    //userName.setId("label");
    root.add(userName, 0, 1);

    TextField userTextField = new TextField();
    root.add(userTextField, 1, 1);

    Label pw = new Label(":");
    root.add(pw, 0, 2);

    PasswordField pwBox = new PasswordField();
    root.add(pwBox, 1, 2);
    ComboBox store = new ComboBox();
    store.setItems(GetByTag());
    root.add(store, 1, 3);

    Button btn = new Button("");
    //btn.setPrefSize(100, 20);
    HBox hbBtn = new HBox(10);
    hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
    hbBtn.getChildren().add(btn);

    root.add(hbBtn, 1, 4);

    Button btn2 = new Button("");
    //btn2.setPrefSize(100, 20);
    HBox hbBtn2 = new HBox(10);
    hbBtn2.setAlignment(Pos.BOTTOM_RIGHT);
    hbBtn2.getChildren().add(btn2);
    root.add(hbBtn2, 1, 5);

    final Text actiontarget = new Text();
    root.add(actiontarget, 1, 6);

    btn2.setOnAction(new EventHandler<ActionEvent>() {
        @Override
        public void handle(ActionEvent e) {
            System.exit(0);
        }
    });

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

        @Override
        public void handle(ActionEvent e) {
            if (userTextField.getText().equals("")) {
                Alert alert = new Alert(Alert.AlertType.ERROR);
                alert.setTitle("!");
                alert.setHeaderText("!");
                alert.setContentText("   !");
                alert.showAndWait();
            } else if (pwBox.getText().equals("")) {
                Alert alert = new Alert(Alert.AlertType.ERROR);
                alert.setTitle("!");
                alert.setHeaderText("!");
                alert.setContentText("   !");
                alert.showAndWait();
            } else if (store.getSelectionModel().getSelectedIndex() < 0) {
                Alert alert = new Alert(Alert.AlertType.ERROR);
                alert.setTitle("!");
                alert.setHeaderText("!");
                alert.setContentText("   !");
                alert.showAndWait();
            } else {
                try {
                    String[] resu = checkpas(userTextField.getText(), pwBox.getText());
                    if (resu[0].equals("-1")) {
                        Alert alert = new Alert(Alert.AlertType.ERROR);
                        alert.setTitle("!");
                        alert.setHeaderText("!");
                        alert.setContentText("   !");
                        alert.showAndWait();
                    } else if (storecheck((store.getSelectionModel().getSelectedIndex() + 1)) == false) {
                        Alert alert = new Alert(Alert.AlertType.CONFIRMATION);
                        alert.setTitle("!");
                        alert.setHeaderText("!");
                        alert.setContentText("     !"
                                + "\n       -  ");
                        Optional<ButtonType> result = alert.showAndWait();
                        if (result.get() == ButtonType.OK) {
                            // ... user chose OK
                            idstore = store.getSelectionModel().getSelectedIndex() + 1;
                            updsel(idstore, Integer.parseInt(resu[0]));
                            MainA ma = new MainA();
                            ma.m = (idstore);
                            ma.MT = "m" + idstore;
                            ma.selid = Integer.parseInt(resu[0]);
                            ma.nameseller = resu[1];
                            ma.storename = store.getSelectionModel().getSelectedItem().toString();
                            ma.start(primaryStage);
                        } else {
                            // ... user chose CANCEL or closed the dialog
                        }

                    } else {
                        // 

                        idstore = store.getSelectionModel().getSelectedIndex() + 1;
                        updsel(idstore, Integer.parseInt(resu[0]));
                        MainA ma = new MainA();
                        ma.m = (idstore);
                        ma.MT = "m" + idstore;
                        ma.selid = Integer.parseInt(resu[0]);
                        ma.nameseller = resu[1];
                        ma.storename = store.getSelectionModel().getSelectedItem().toString();

                        ma.start(primaryStage);

                    }

                } catch (NoSuchAlgorithmException ex) {
                    Logger.getLogger(StatOS2_0.class.getName()).log(Level.SEVERE, null, ex);
                } catch (Exception ex) {
                    Logger.getLogger(StatOS2_0.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
            /**
             * if((userTextField.getText().equals("admin"))&(pwBox.getText().equals("admin"))){
             * actiontarget.setId("acttrue");
             * actiontarget.setText(" !");
             * MainA ma = new MainA();
             * ma.m=1;
             * try {
             * ma.m=1;
             * ma.MT="m1";
             * ma.start(primaryStage);
             * } catch (Exception ex) {
             * Logger.getLogger(StatOS2_0.class.getName()).log(Level.SEVERE, null, ex);
             * }
             * }else{
             * actiontarget.setId("actfalse");
             * actiontarget.setText(" !");
             * } **/

        }
    });
    //Dimension sSize = Toolkit.getDefaultToolkit().getScreenSize();
    //sSize.getHeight();
    Scene scene = new Scene(root, sSize.getWidth(), sSize.getHeight());

    primaryStage.setScene(scene);
    scene.getStylesheets().add(StatOS2_0.class.getResource("adminStatOS.css").toExternalForm());
    primaryStage.show();
}

From source file:v800_trainer.JCicloTronic.java

/** Creates new form JCicloTronic */
public JCicloTronic() {

    ScreenSize = new Dimension();
    SelectionChanged = false;//w  ww .j  a v  a 2  s .co  m
    ScreenSize.setSize(java.awt.Toolkit.getDefaultToolkit().getScreenSize().getWidth() - 50,
            java.awt.Toolkit.getDefaultToolkit().getScreenSize().getHeight() - 50);
    Size = new Dimension();

    Properties = new java.util.Properties();
    SystemProperties = java.lang.System.getProperties();
    chooser = new javax.swing.JFileChooser();
    RawData = new byte[98316];
    //        System.setProperty("jna.library.path" , "C:/WINDOWS/system32");

    try {
        FileInputStream in = new FileInputStream(SystemProperties.getProperty("user.dir")
                + SystemProperties.getProperty("file.separator") + "JCicloexp.cfg");
        Properties.load(in);
        in.close();
    } catch (Exception e) {
        FontSize = 20;
        setFontSizeGlobal("Tahoma", FontSize);

        JOptionPane.showMessageDialog(null,
                "Keine Config-Datei in:  " + SystemProperties.getProperty("user.dir"), "Achtung!",
                JOptionPane.ERROR_MESSAGE);
        Properties.put("working.dir", SystemProperties.getProperty("user.dir"));
        Eigenschaften = new Eigenschaften(new javax.swing.JFrame(), true, this);
        this.setExtendedState(Frame.MAXIMIZED_BOTH);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        double width = screenSize.getWidth();
        double height = screenSize.getHeight();
        this.setSize(new Dimension((int) width, (int) height));
        this.setPreferredSize(new Dimension((int) width, (int) height));
        this.setMinimumSize(new Dimension((int) width, (int) height));
        repaint();
    }
    try {

        UIManager.setLookAndFeel(Properties.getProperty("LookFeel"));
        SwingUtilities.updateComponentTreeUI(this);
        this.pack();
    } catch (Exception exc) {
    }

    if (debug) {
        try {
            System.setErr(new java.io.PrintStream(new FileOutputStream(Properties.getProperty("working.dir")
                    + SystemProperties.getProperty("file.separator") + "error.txt")));
            //        System.err =  new FileOutputStream(Properties.getProperty("working.dir") + SystemProperties.getProperty("file.separator") + "error.txt");
            System.setOut(new java.io.PrintStream(new FileOutputStream(Properties.getProperty("working.dir")
                    + SystemProperties.getProperty("file.separator") + "error.txt")));
        } catch (Exception err) {
        }
    }

    initComponents();

    setTitle("V800 Trainer    Datadir: " + Properties.getProperty("data.dir"));

    icon = new ImageIcon("hw.jpg");
    setIconImage(icon.getImage());

    if (Integer.parseInt(Properties.getProperty("View Geschw", "1")) == 1) {
        Graphik_check_Geschwindigkeit.setSelected(true);
    } else {
        Graphik_check_Geschwindigkeit.setSelected(false);
    }
    if (Integer.parseInt(Properties.getProperty("View Hhe", "1")) == 1) {
        Graphik_check_Hhe.setSelected(true);
    } else {
        Graphik_check_Hhe.setSelected(false);
    }
    if (Integer.parseInt(Properties.getProperty("View Hf", "1")) == 1) {
        Graphik_check_HF.setSelected(true);
    } else {
        Graphik_check_HF.setSelected(false);
    }
    if (Integer.parseInt(Properties.getProperty("View Temp", "1")) == 1) {
        Graphik_check_Temp.setSelected(true);
    } else {
        Graphik_check_Temp.setSelected(false);
    }
    if (Integer.parseInt(Properties.getProperty("View Steigp", "1")) == 1) {
        Graphik_check_Steigung_p.setSelected(true);
    } else {
        Graphik_check_Steigung_p.setSelected(false);
    }
    if (Integer.parseInt(Properties.getProperty("View Steigm", "1")) == 1) {
        Graphik_check_Steigung_m.setSelected(true);
    } else {
        Graphik_check_Steigung_m.setSelected(false);
    }
    if (Integer.parseInt(Properties.getProperty("View av_Geschw", "1")) == 1) {
        Graphik_check_av_Geschw.setSelected(true);
    } else {
        Graphik_check_av_Geschw.setSelected(false);
    }
    if (Integer.parseInt(Properties.getProperty("View Cadence", "1")) == 1) {
        Graphik_check_Cadence.setSelected(true);
    } else {
        Graphik_check_Cadence.setSelected(false);
    }
    if (Integer.parseInt(Properties.getProperty("View Schrittlnge", "1")) == 1) {
        Graphik_check_Schrittlnge.setSelected(true);
    } else {
        Graphik_check_Schrittlnge.setSelected(false);
    }

    if (Integer.parseInt(Properties.getProperty("ZeitStreckeAbstnde", "1")) == 1) {
        Graphik_check_Abstand.setSelected(true);
    } else {
        Graphik_check_Abstand.setSelected(false);
    }
    if (Integer.parseInt(Properties.getProperty("SummenHisto", "1")) == 1) {
        Summenhistogramm_Check.setSelected(true);
    } else {
        Summenhistogramm_Check.setSelected(false);
    }

    if (Integer.parseInt(Properties.getProperty("xy_Strecke", "1")) == 1) {
        Graphik_Radio_Strecke.setSelected(true);
        Graphik_Radio_Zeit.setSelected(false);
    } else {
        Graphik_Radio_Strecke.setSelected(false);
        Graphik_Radio_Zeit.setSelected(true);
    }

    //Buttons fr XY-Darstellung   (ber Strecke oder ber Zeit)
    X_Axis = new ButtonGroup();
    X_Axis.add(Graphik_Radio_Strecke);
    X_Axis.add(Graphik_Radio_Zeit);

    //Buttons fr Jahresbersicht
    bersicht = new ButtonGroup();
    bersicht.add(jRadioButton_jahresverlauf);
    bersicht.add(jRadioButton_monatsbersicht);

    Datenliste_Zeitabschnitt.addItem("nicht aktiv");
    Datenliste_Zeitabschnitt.addItem("vergangene Woche");
    Datenliste_Zeitabschnitt.addItem("vergangener Monat");
    Datenliste_Zeitabschnitt.addItem("vergangenes Jahr");
    Datenliste_Zeitabschnitt.addItem("Alles");

    if (Datentabelle.getRowCount() != 0) {
        Datentabelle.addRowSelectionInterval(0, 0);
        Datenliste_scroll_Panel.getViewport().setViewPosition(new java.awt.Point(0, 0));
    }
    //        if (Properties.getProperty("CommPort").equals("nocom")) {
    //            jMenuReceive.setEnabled(false);
    //        } else {
    //            jMenuReceive.setEnabled(true);
    //        }

    jLabel69_Selektiert.setText(Datentabelle.getSelectedRowCount() + " / " + Datentabelle.getRowCount());

    setFileChooserFont(chooser.getComponents());
    locmap = true;
    Map_Type.removeAllItems();
    Map_Type.addItem("OpenStreetMap");
    Map_Type.addItem("Virtual Earth Map");
    Map_Type.addItem("Virtual Earth Satelite");
    Map_Type.addItem("Virtual Earth Hybrid");
    locmap = false;
    //    ChangeModel();
}