Example usage for javax.swing JScrollPane setBorder

List of usage examples for javax.swing JScrollPane setBorder

Introduction

In this page you can find the example usage for javax.swing JScrollPane setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:org.nuclos.client.dbtransfer.DBTransferImport.java

private PanelWizardStep newStep1(final MainFrameTab ifrm) {
    final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate();
    final PanelWizardStep step = new PanelWizardStep(
            localeDelegate.getMessage("dbtransfer.import.step1.1", "Konfigurationsdatei"),
            localeDelegate.getMessage("dbtransfer.import.step1.2",
                    "Bitte w\u00e4hlen Sie eine Konfigurationsdatei aus."));

    final JLabel lbFile = new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.3", "Datei"));

    utils.initJPanel(step,//from  w w  w .  j  a  v a  2 s  .c om
            new double[] { TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED,
                    TableLayout.FILL },
            new double[] { 20, TableLayout.PREFERRED, lbFile.getPreferredSize().height, TableLayout.FILL });

    final JButton btnBrowse = new JButton("...");
    //final JProgressBar progressBar = new JProgressBar(0, 230);
    final JCheckBox chbxImportAsNuclon = new JCheckBox(
            localeDelegate.getMessage("configuration.transfer.import.as.nuclon", "Import als Nuclon"));
    chbxImportAsNuclon.setEnabled(false);
    final JEditorPane editWarnings = new JEditorPane();
    editWarnings.setContentType("text/html");
    editWarnings.setEditable(false);
    editWarnings.setBackground(Color.WHITE);

    final JScrollPane scrollWarn = new JScrollPane(editWarnings);
    scrollWarn.setPreferredSize(new Dimension(680, 250));
    scrollWarn.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    scrollWarn.getVerticalScrollBar().setUnitIncrement(20);
    scrollWarn.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollWarn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    final JScrollPane scrollPrev = new JScrollPane(jpnPreviewContent);
    scrollPrev.setPreferredSize(new Dimension(680, 250));
    scrollPrev.setBorder(new LineBorder(Color.LIGHT_GRAY, 1));
    scrollPrev.getVerticalScrollBar().setUnitIncrement(20);
    scrollPrev.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scrollPrev.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    final JPanel jpnPreview = new JPanel(new BorderLayout());
    jpnPreview.add(jpnPreviewHeader, BorderLayout.NORTH);
    jpnPreview.add(scrollPrev, BorderLayout.CENTER);
    jpnPreview.add(jpnPreviewFooter, BorderLayout.SOUTH);
    jpnPreview.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    jpnPreview.setBackground(Color.WHITE);
    jpnPreviewHeader.setBackground(Color.WHITE);
    jpnPreviewContent.setBackground(Color.WHITE);
    jpnPreviewFooter.setBackground(Color.WHITE);

    final JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab(localeDelegate.getMessage("configuration.transfer.prepare.warnings.tab", "Warnungen"),
            scrollWarn);
    final String sDefaultPreparePreviewTabText = localeDelegate
            .getMessage("configuration.transfer.prepare.preview.tab", "Vorschau der Schema Aenderungen");
    tabbedPane.addTab(sDefaultPreparePreviewTabText, jpnPreview);

    final JLabel lbNewUser = new JLabel();

    step.add(lbFile, "0,0");
    step.add(tfTransferFile, "1,0");
    step.add(btnBrowse, "2,0");
    step.add(chbxImportAsNuclon, "1,1");//step.add(progressBar, "1,1");
    step.add(lbNewUser, "0,2,3,2");
    step.add(tabbedPane, "0,3,3,3");

    tfTransferFile.setEditable(false);

    final ActionListener prepareImportAction = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ev) {
            ifrm.lockLayerWithProgress(Transfer.TOPIC_CORRELATIONID_PREPARE);

            Thread t = new Thread() {
                @Override
                public void run() {
                    step.setComplete(false);
                    boolean blnTransferWithWarnings = false;
                    //progressBar.setValue(0);
                    //progressBar.setVisible(true);
                    try {
                        String fileName = tfTransferFile.getText();
                        if (StringUtils.isNullOrEmpty(fileName)) {
                            return;
                        }
                        File f = new File(fileName);
                        long size = f.length();

                        final InputStream fin = new BufferedInputStream(new FileInputStream(f));
                        final byte[] transferFile;
                        try {
                            transferFile = utils.getBytes(fin, (int) size);
                        } finally {
                            fin.close();
                        }

                        resetStep2();
                        importTransferObject = getTransferFacadeRemote().prepareTransfer(isNuclon,
                                transferFile);
                        chbxImportAsNuclon.setEnabled(importTransferObject.getTransferOptions()
                                .containsKey(TransferOption.IS_NUCLON_IMPORT_ALLOWED));

                        step.setComplete(!importTransferObject.result.hasCriticals());

                        if (!importTransferObject.result.hasCriticals()
                                && !importTransferObject.result.hasWarnings()) {
                            editWarnings.setText(localeDelegate.getMessage(
                                    "configuration.transfer.prepare.no.warnings", "Keine Warnungen"));
                        } else {
                            editWarnings.setText("<html><body><font color=\"#800000\">"
                                    + importTransferObject.result.getCriticals() + "</font>"
                                    + (importTransferObject.result.hasCriticals() ? "<br />" : "")
                                    + importTransferObject.result.getWarnings() + "</body></html>");
                        }

                        int iPreviewSize = importTransferObject.getPreviewParts().size();
                        blnTransferWithWarnings = setupPreviewPanel(importTransferObject.getPreviewParts());
                        tabbedPane.setTitleAt(1, sDefaultPreparePreviewTabText
                                + (iPreviewSize == 0 ? "" : " (" + iPreviewSize + ")"));
                        lbNewUser.setText(
                                "Neue Benutzer" + ": " + (importTransferObject.getNewUserCount() == 0 ? "keine"
                                        : importTransferObject.getNewUserCount()));
                    } catch (Exception e) {
                        //                              progressBar.setVisible(false);
                        Errors.getInstance().showExceptionDialog(ifrm, e);
                    } finally {
                        btnBrowse.setEnabled(true);
                        //                              progressBar.setVisible(false);
                        ifrm.unlockLayer();
                    }
                    if (blnTransferWithWarnings) {
                        JOptionPane.showMessageDialog(jpnPreviewContent, localeDelegate.getMessage(
                                "dbtransfer.import.step1.19",
                                "Nicht alle Statements knnen durchgefhrt werden!\nBitte kontrollieren Sie die mit rot markierten Eintrge!",
                                "Warning", JOptionPane.WARNING_MESSAGE));
                    }
                }

            };

            t.start();
        }
    };
    final ActionListener browseAction = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ev) {
            final JFileChooser filechooser = utils.getFileChooser(
                    localeDelegate.getMessage("configuration.transfer.file.nuclet", "Nuclet-Dateien"),
                    ".nuclet");
            final int iBtn = filechooser.showOpenDialog(ifrm);

            if (iBtn == JFileChooser.APPROVE_OPTION) {

                final File file = filechooser.getSelectedFile();
                if (file != null) {
                    tfTransferFile.setText("");
                    btnBrowse.setEnabled(false);
                    //progressBar.setVisible(true);

                    String fileName = file.getPath();
                    if (StringUtils.isNullOrEmpty(fileName)) {
                        return;
                    }

                    tfTransferFile.setText(fileName);

                    prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare"));
                }
            }
        }
    };
    final ActionListener importAsNuclonAction = new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            isNuclon = chbxImportAsNuclon.isSelected();
            prepareImportAction.actionPerformed(new ActionEvent(this, 0, "prepare"));
        }
    };
    btnBrowse.addActionListener(browseAction);
    chbxImportAsNuclon.addActionListener(importAsNuclonAction);

    //      progressBar.setVisible(false);

    return step;
}

From source file:org.nuclos.client.dbtransfer.DBTransferImport.java

private boolean setupPreviewPanel(List<PreviewPart> previewParts) {
    boolean blnTransferWithWarnings = false;
    jpnPreviewHeader.removeAll();/*w w  w . j  a  va  2s.  c o  m*/
    jpnPreviewFooter.removeAll();

    // setup parameter scroll pane
    jpnPreviewContent.removeAll();

    double[] rowContraints = new double[previewParts.size()];
    for (int i = 0; i < previewParts.size(); i++)
        rowContraints[i] = TableLayout.PREFERRED;
    final int iWidthBeginnigSpace = 3;
    final int iWidthSeparator = 6;

    final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate();
    JLabel lbPreviewHeaderEntity = new JLabel(
            localeDelegate.getMessage("dbtransfer.import.step1.11", "Entit\u00e4t"));
    JLabel lbPreviewHeaderTable = new JLabel(
            localeDelegate.getMessage("dbtransfer.import.step1.12", "Tabellenname"));
    JLabel lbPreviewHeaderRecords = new JLabel(
            localeDelegate.getMessage("dbtransfer.import.step1.4", "Datens\u00e4tze"));
    lbPreviewHeaderRecords.setToolTipText(
            localeDelegate.getMessage("dbtransfer.import.step1.5", "Anzahl der betroffenen Datens\u00e4tze"));
    utils.initJPanel(jpnPreviewContent,
            new double[] { iWidthBeginnigSpace, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED,
                    iWidthSeparator, TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED,
                    TableLayout.PREFERRED, iWidthSeparator, TableLayout.PREFERRED },
            rowContraints);

    int iWidthEntityLabelSize = 0;
    int iWidthTableLabelSize = 0;
    int iWidthRecordsLabelSize = 0;

    int iCountNew = 0;
    int iCountDeleted = 0;
    int iCountChanged = 0;

    int iRow = 0;
    for (final PreviewPart pp : previewParts) {
        String tooltip = "";
        JLabel lbEntity = new JLabel(pp.getEntity());
        JLabel lbTable = new JLabel(pp.getTable());
        JLabel lbRecords = new JLabel(String.valueOf(pp.getDataRecords()));
        lbRecords.setHorizontalAlignment(SwingConstants.RIGHT);
        if (lbEntity.getPreferredSize().width < lbPreviewHeaderEntity.getPreferredSize().width)
            lbEntity.setPreferredSize(lbPreviewHeaderEntity.getPreferredSize());
        if (lbTable.getPreferredSize().width < lbPreviewHeaderTable.getPreferredSize().width)
            lbTable.setPreferredSize(lbPreviewHeaderTable.getPreferredSize());
        if (lbRecords.getPreferredSize().width < lbPreviewHeaderRecords.getPreferredSize().width)
            lbRecords.setPreferredSize(lbPreviewHeaderRecords.getPreferredSize());
        iWidthEntityLabelSize = iWidthEntityLabelSize < lbEntity.getPreferredSize().width
                ? lbEntity.getPreferredSize().width
                : iWidthEntityLabelSize;
        iWidthTableLabelSize = iWidthTableLabelSize < lbTable.getPreferredSize().width
                ? lbTable.getPreferredSize().width
                : iWidthTableLabelSize;
        iWidthRecordsLabelSize = iWidthRecordsLabelSize < lbRecords.getPreferredSize().width
                ? lbRecords.getPreferredSize().width
                : iWidthRecordsLabelSize;

        Icon icoStatement = null;
        switch (pp.getType()) {
        case PreviewPart.NEW:
            tooltip = localeDelegate.getMessage("dbtransfer.import.step1.6",
                    "Entit\u00e4t wird hinzugef\u00fcgt");
            icoStatement = ParameterEditor.COMPARE_ICON_NEW;
            iCountNew++;
            break;
        case PreviewPart.CHANGE:
            tooltip = localeDelegate.getMessage("dbtransfer.import.step1.7", "Entit\u00e4t wird ge\u00e4ndert");
            icoStatement = ParameterEditor.COMPARE_ICON_VALUE_CHANGED;
            iCountChanged++;
            break;
        case PreviewPart.DELETE:
            tooltip = localeDelegate.getMessage("dbtransfer.import.step1.8", "Entit\u00e4t wird gel\u00f6scht");
            icoStatement = ParameterEditor.COMPARE_ICON_DELETED;
            iCountDeleted++;
            break;
        }

        JLabel lbIcon = new JLabel(icoStatement);
        JLabel lbStatemnts = new JLabel("<html><u>"
                + localeDelegate.getMessage("dbtransfer.import.step1.9", "Script anzeigen") + "...</u></html>");
        lbStatemnts.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        lbStatemnts.addMouseListener(new MouseListener() {
            @Override
            public void mouseReleased(MouseEvent e) {
            }

            @Override
            public void mousePressed(MouseEvent e) {
            }

            @Override
            public void mouseExited(MouseEvent e) {
            }

            @Override
            public void mouseEntered(MouseEvent e) {
            }

            @Override
            public void mouseClicked(MouseEvent e) {
                String statements = "";
                for (String statement : pp.getStatements()) {
                    statements = statements + statement + ";\n\n";
                }
                JTextArea txtArea = new JTextArea(statements);

                txtArea.setEditable(false);
                txtArea.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
                JScrollPane scroll = new JScrollPane(txtArea);
                scroll.getVerticalScrollBar().setUnitIncrement(20);
                scroll.setPreferredSize(new Dimension(600, 300));
                scroll.setBorder(BorderFactory.createEmptyBorder());
                MainFrameTab overlayFrame = new MainFrameTab(
                        localeDelegate.getMessage("dbtransfer.import.step1.10", "Script f\u00fcr") + " "
                                + pp.getEntity() + " (" + pp.getTable() + ")");
                overlayFrame.setLayeredComponent(scroll);
                ifrm.add(overlayFrame);
            }
        });

        lbIcon.setToolTipText(tooltip);
        lbStatemnts.setToolTipText(tooltip);
        lbEntity.setToolTipText(tooltip);
        lbTable.setToolTipText(tooltip);

        jpnPreviewContent.add(lbEntity, "1," + iRow + ",l,c");
        jpnPreviewContent.add(lbTable, "3," + iRow + ",l,c");
        jpnPreviewContent.add(lbRecords, "5," + iRow + ",r,c");
        jpnPreviewContent.add(lbIcon, "7," + iRow + ",l,c");
        jpnPreviewContent.add(lbStatemnts, "8," + iRow + ",l,c");
        if (pp.getWarning() > 0) {
            lbIcon.setIcon(Icons.getInstance().getIconPriorityCancel16());
            blnTransferWithWarnings = true;
        }
        iRow++;
    }

    jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "2,0,2," + (iRow - 1));
    jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "4,0,4," + (iRow - 1));
    jpnPreviewContent.add(new JSeparator(JSeparator.VERTICAL), "6,0,6," + (iRow - 1));

    // setup preview header   
    utils.initJPanel(jpnPreviewHeader,
            new double[] { iWidthBeginnigSpace, iWidthEntityLabelSize, iWidthSeparator, iWidthTableLabelSize,
                    iWidthSeparator, iWidthRecordsLabelSize, iWidthSeparator, TableLayout.PREFERRED,
                    iWidthSeparator, TableLayout.PREFERRED, TableLayout.PREFERRED },
            new double[] { TableLayout.PREFERRED });

    if (previewParts.isEmpty()) {
        jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.18",
                "Keine Struktur\u00e4nderungen am Datenbankschema.")), "0,0,8,0");
        return blnTransferWithWarnings;
    }

    jpnPreviewHeader.add(lbPreviewHeaderEntity, "1,0");
    jpnPreviewHeader.add(lbPreviewHeaderTable, "3,0");
    jpnPreviewHeader.add(lbPreviewHeaderRecords, "5,0");

    jpnPreviewHeader.add(new JLabel(localeDelegate.getMessage("dbtransfer.import.step1.13", "\u00c4nderung")),
            "7,0");

    // setup preview footer
    utils.initJPanel(jpnPreviewFooter, new double[] { TableLayout.FILL, TableLayout.PREFERRED,
            TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED },
            new double[] { TableLayout.PREFERRED });

    final JLabel lbCompare = new JLabel(
            localeDelegate.getMessage("dbtransfer.import.step1.14", "\u00c4nderungen") + ":");
    final JLabel lbCompareNew = new JLabel(iCountNew + "");
    final JLabel lbCompareDeleted = new JLabel(iCountDeleted + "");
    final JLabel lbCompareValueChanged = new JLabel(iCountChanged + "");

    lbCompareNew.setIcon(ParameterEditor.COMPARE_ICON_NEW);
    lbCompareDeleted.setIcon(ParameterEditor.COMPARE_ICON_DELETED);
    lbCompareValueChanged.setIcon(ParameterEditor.COMPARE_ICON_VALUE_CHANGED);

    lbCompareNew.setToolTipText(localeDelegate.getMessage("dbtransfer.import.step1.15", "Neue Entit\u00e4ten"));
    lbCompareDeleted.setToolTipText(
            localeDelegate.getMessage("dbtransfer.import.step1.17", "Gel\u00f6schte Entit\u00e4ten"));
    lbCompareValueChanged.setToolTipText(
            localeDelegate.getMessage("dbtransfer.import.step1.16", "Ge\u00e4nderte Entit\u00e4ten"));

    jpnPreviewFooter.add(lbCompare, "1,0,r,c");
    jpnPreviewFooter.add(lbCompareNew, "2,0,r,c");
    jpnPreviewFooter.add(lbCompareValueChanged, "3,0,r,c");
    jpnPreviewFooter.add(lbCompareDeleted, "4,0,r,c");

    return blnTransferWithWarnings;
}

From source file:org.nuclos.client.dbtransfer.DBTransferImport.java

private PanelWizardStep newStep3(final MainFrameTab ifrm) {
    final SpringLocaleDelegate localeDelegate = getSpringLocaleDelegate();
    final PanelWizardStep step = new PanelWizardStep(
            localeDelegate.getMessage("dbtransfer.import.step3.1", "System Parameter"),
            localeDelegate.getMessage("dbtransfer.import.step3.2",
                    "Bestimmen Sie die Parameter dieses Systems. Sie k\u00f6nnen w\u00e4hlen zwischen dem aktuellen Zustand und dem aus der Konfigurationsdatei importierten Zustand (default). Sollte keine der beiden Vorgaben stimmen, so k\u00f6nnen Sie auch einen anderen Wert setzen.")) {

        @Override//from w w w.  j  a  v  a2  s .co m
        public void prepare() {
            setupParameterPanel(importTransferObject.getParameter());
        }

        @Override
        public void applyState() throws InvalidStateException {
            setSelectedIncomingParameter.clear();
            setSelectedCurrentParameter.clear();
            mapSelectedOtherParameter.clear();

            for (ParameterEditor pe : lstParameterEditors) {
                if (pe.isCurrentValue())
                    setSelectedCurrentParameter.add(pe.getName());
                if (pe.isIncomingValue())
                    setSelectedIncomingParameter.add(pe.getName());
                if (pe.isOtherValue())
                    mapSelectedOtherParameter.put(pe.getName(), pe.getValue());
            }
        }
    };
    step.setComplete(true);

    utils.initJPanel(step, new double[] { TableLayout.FILL },
            new double[] { TableLayout.PREFERRED, TableLayout.FILL, TableLayout.PREFERRED });

    rbCurrentAll.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            resetParameterEditors(true);
        }
    });
    rbIncomingAll.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            resetParameterEditors(false);
        }
    });

    final JScrollPane scroll = new JScrollPane(jpnParameter);
    scroll.setPreferredSize(new Dimension(680, 250));
    scroll.setBorder(new LineBorder(Color.LIGHT_GRAY, 1));
    scroll.getVerticalScrollBar().setUnitIncrement(20);
    scroll.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    scroll.getViewport().addChangeListener(new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            Dimension parameterPanelSize = new Dimension(scroll.getViewport().getWidth(),
                    jpnParameter.getPreferredSize().height);
            jpnParameter.setPreferredSize(parameterPanelSize);
        }
    });

    step.add(jpnParameterHeader, "0,0");
    step.add(scroll, "0,1");
    step.add(jpnParameterFooter, "0,2");

    return step;
}

From source file:org.nuxeo.launcher.gui.NuxeoFrame.java

/**
 * @param logFile// w  w w  .  j a  v a  2  s. c  om
 */
protected JComponent buildLogPanel(String logFile) {
    ColoredTextPane textArea = new ColoredTextPane();
    textArea.setEditable(false);
    textArea.setAutoscrolls(true);
    textArea.setBackground(new Color(54, 55, 67));
    textArea.setMaxSize(LOG_MAX_SIZE);

    JScrollPane logsScroller = new JScrollPane(textArea);
    logsScroller.setVisible(true);
    logsScroller.setBorder(BorderFactory.createLineBorder(Color.BLACK));
    logsScroller.setAutoscrolls(true);
    logsScroller.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    logsScroller.setWheelScrollingEnabled(true);
    logsScroller.setPreferredSize(new Dimension(450, 160));

    controller.initLogsManagement(logFile, textArea);
    logsScroller.addComponentListener(new LogsPanelListener(logFile));
    return logsScroller;
}

From source file:org.ohdsi.whiteRabbit.WhiteRabbitMain.java

private JComponent createConsolePanel() {
    JTextArea consoleArea = new JTextArea();
    consoleArea.setToolTipText("General progress information");
    consoleArea.setEditable(false);//from w  w  w . jav a 2  s.  c o m
    Console console = new Console();
    console.setTextArea(consoleArea);
    System.setOut(new PrintStream(console));
    System.setErr(new PrintStream(console));
    JScrollPane consoleScrollPane = new JScrollPane(consoleArea);
    consoleScrollPane.setBorder(BorderFactory.createTitledBorder("Console"));
    consoleScrollPane.setPreferredSize(new Dimension(800, 200));
    consoleScrollPane.setAutoscrolls(true);
    ObjectExchange.console = console;
    return consoleScrollPane;
}

From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java

public void loadAsynchronous() {

    // On recupere les differents journaux
    SQLTable journalTable = base.getTable("JOURNAL");

    List<SQLRow> liste = SQLBackgroundTableCache.getInstance().getCacheForTable(journalTable).getRows();
    for (int k = 0; k < liste.size(); k++) {
        SQLRow row = liste.get(k);/* w w  w. jav  a  2 s. c om*/
        fireIsLoading(true);
        final Journal jrnlTmp = new Journal(row.getID(), row.getString("NOM"), row.getString("CODE"));
        new SwingWorker<JPanel, Object>() {
            @Override
            protected JPanel doInBackground() throws Exception {

                final JPanel initJournalPanel = initJournalPanel(jrnlTmp);
                return initJournalPanel;
            }

            @Override
            protected void done() {
                JPanel initJournalPanel;
                try {
                    initJournalPanel = get();

                    initJournalPanel.setOpaque(false);
                    JScrollPane scroll = new JScrollPane(initJournalPanel);
                    scroll.setBorder(null);
                    scroll.setOpaque(false);
                    scroll.getViewport().setOpaque(false);
                    EtatJournauxPanel.this.tabbedJournaux.addTab(jrnlTmp.getNom(), scroll);
                } catch (InterruptedException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                } catch (ExecutionException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
                fireIsLoading(false);
                super.done();
            }
        }.execute();

    }
}

From source file:org.openconcerto.erp.core.finance.accounting.ui.GrandLivrePanel.java

public void loadAsynchronous() {
    // On recupere les differentes classes
    List<ClasseCompte> liste = ClasseCompte.getClasseCompte();

    if (liste.size() != 0) {
        for (int k = 0; k < liste.size(); k++) {

            final ClasseCompte ccTmp = liste.get(k);
            fireLoading(true);//from   www  . java  2s . c o  m
            new SwingWorker<JPanel, Object>() {
                @Override
                protected JPanel doInBackground() throws Exception {
                    // TODO Auto-generated method stub
                    return initClassePanel(ccTmp);

                }

                @Override
                protected void done() {
                    JPanel initClassePanel;
                    try {
                        initClassePanel = get();

                        initClassePanel.setOpaque(false);

                        final JScrollPane scrollPane = new JScrollPane(initClassePanel);
                        scrollPane.setOpaque(false);
                        scrollPane.setBorder(null);
                        scrollPane.getViewport().setOpaque(false);
                        // On crer les comptes de chaque classe
                        GrandLivrePanel.this.tabbedClasse.addTab(ccTmp.getNom(), scrollPane);

                    } catch (InterruptedException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    } catch (ExecutionException e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                    fireLoading(false);
                    super.done();
                }
            }.execute();

        }
    }
}

From source file:org.openconcerto.erp.core.sales.order.component.CommandeClientSQLComponent.java

public void addViews() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();

    // Numero du commande
    c.gridx = 0;//from w  w  w. j a  v  a2s. c  o m
    this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c);

    this.numeroUniqueCommande = new JUniqueTextField(16);
    c.fill = GridBagConstraints.NONE;
    c.gridx++;
    c.weightx = 1;
    this.add(this.numeroUniqueCommande, c);

    // Date
    JLabel labelDate = new JLabel(getLabelFor("DATE"));
    labelDate.setHorizontalAlignment(SwingConstants.RIGHT);
    c.gridx = 2;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    this.add(labelDate, c);

    JDate dateCommande = new JDate(true);
    c.gridx++;
    c.fill = GridBagConstraints.NONE;
    this.add(dateCommande, c);

    // Champ Module
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();

    this.setAdditionalFieldsPanel(new FormLayouter(addP, 2));
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    this.add(addP, c);

    c.gridy++;
    c.gridwidth = 1;

    this.comboDevis = new ElementComboBox();

    // Reference
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.fill = GridBagConstraints.HORIZONTAL;

    JLabel labelObjet = new JLabel(getLabelFor("NOM"));
    labelObjet.setHorizontalAlignment(SwingConstants.RIGHT);
    c.weightx = 0;
    this.add(labelObjet, c);

    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    this.add(this.textObjet, c);

    String field;
    field = "ID_COMMERCIAL";
    c.fill = GridBagConstraints.HORIZONTAL;
    // Commercial
    JLabel labelCommercial = new JLabel(getLabelFor(field));
    labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT);

    c.gridx++;
    c.weightx = 0;
    this.add(labelCommercial, c);

    this.comboCommercial = new ElementComboBox(false, 25);
    this.comboCommercial.setListIconVisible(false);
    c.gridx++;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 1;
    this.add(this.comboCommercial, c);
    addRequiredSQLObject(this.comboCommercial, field);

    // Ligne 3: Client
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), c);

    this.comboClient = new ElementComboBox();
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridwidth = 3;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    this.add(this.comboClient, c);
    final ElementComboBox boxTarif = new ElementComboBox();
    this.comboClient.addValueListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (!isFilling() && comboClient.getValue() != null) {
                Integer id = comboClient.getValue();

                if (id > 1) {

                    SQLRow row = comboClient.getElement().getTable().getRow(id);
                    if (comboClient.getElement().getTable().getFieldsName().contains("ID_TARIF")) {

                        SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
                        if (!foreignRow.isUndefined()
                                && (boxTarif.getSelectedRow() == null
                                        || boxTarif.getSelectedId() != foreignRow.getID())
                                && JOptionPane.showConfirmDialog(null,
                                        "Appliquer les tarifs associs au client?") == JOptionPane.YES_OPTION) {
                            boxTarif.setValue(foreignRow.getID());
                            // SaisieVenteFactureSQLComponent.this.tableFacture.setTarif(foreignRow,
                            // true);
                        } else {
                            boxTarif.setValue(foreignRow.getID());
                        }
                        // SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
                        // if (foreignRow.isUndefined() &&
                        // !row.getForeignRow("ID_DEVISE").isUndefined()) {
                        // SQLRowValues rowValsD = new SQLRowValues(foreignRow.getTable());
                        // rowValsD.put("ID_DEVISE", row.getObject("ID_DEVISE"));
                        // foreignRow = rowValsD;
                        //
                        // }
                        // table.setTarif(foreignRow, true);
                    }
                }
            }

        }
    });
    // tarif
    if (this.getTable().getFieldsName().contains("ID_TARIF")) {
        // TARIF
        c.gridy++;
        c.gridx = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        this.add(new JLabel("Tarif  appliquer"), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;

        c.weightx = 1;
        this.add(boxTarif, c);
        this.addView(boxTarif, "ID_TARIF");
        boxTarif.addModelListener("wantedID", new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                SQLRow selectedRow = boxTarif.getRequest().getPrimaryTable().getRow(boxTarif.getWantedID());
                table.setTarif(selectedRow, false);
            }
        });
    }

    // Table d'lment
    this.table = new CommandeClientItemTable();
    c.fill = GridBagConstraints.BOTH;
    c.gridy++;
    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    this.add(this.table, c);

    DeviseField textPortHT = new DeviseField();
    DeviseField textRemiseHT = new DeviseField();

    // INfos
    c.gridx = 0;
    c.gridy++;
    c.gridheight = 1;
    c.weighty = 0;
    c.weightx = 1;
    c.anchor = GridBagConstraints.WEST;
    c.gridwidth = 2;
    this.add(new TitledSeparator(getLabelFor("INFOS")), c);

    c.gridy++;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.BOTH;
    final JScrollPane scrollPane = new JScrollPane(this.infos);
    scrollPane.setBorder(null);
    this.add(scrollPane, c);

    // Poids
    c.gridwidth = 1;

    DefaultProps props = DefaultNXProps.getInstance();
    Boolean b = props.getBooleanValue("ArticleShowPoids");
    final JTextField textPoidsTotal = new JTextField(8);
    if (b) {
        JPanel panel = new JPanel();

        panel.add(new JLabel(getLabelFor("T_POIDS")), c);

        textPoidsTotal.setEnabled(false);
        textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT);
        textPoidsTotal.setDisabledTextColor(Color.BLACK);
        panel.add(textPoidsTotal, c);

        panel.setOpaque(false);
        DefaultGridBagConstraints.lockMinimumSize(panel);

        c.gridx = 2;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        c.fill = GridBagConstraints.NONE;
        c.anchor = GridBagConstraints.NORTHEAST;
        this.add(panel, c);
    }

    // Total
    DeviseField fieldHT = new DeviseField();
    DeviseField fieldTVA = new DeviseField();
    DeviseField fieldTTC = new DeviseField();
    DeviseField fieldDevise = new DeviseField();
    DeviseField fieldService = new DeviseField();
    DeviseField fieldHA = new DeviseField();
    fieldHT.setOpaque(false);
    fieldHA.setOpaque(false);
    fieldTVA.setOpaque(false);
    fieldTTC.setOpaque(false);
    fieldService.setOpaque(false);
    addSQLObject(fieldDevise, "T_DEVISE");
    addRequiredSQLObject(fieldHT, "T_HT");
    addRequiredSQLObject(fieldTVA, "T_TVA");
    addRequiredSQLObject(fieldTTC, "T_TTC");
    addRequiredSQLObject(fieldService, "T_SERVICE");
    if (getTable().contains("PREBILAN")) {
        addSQLObject(fieldHA, "PREBILAN");
    } else if (getTable().contains("T_HA")) {
        addSQLObject(fieldHA, "T_HA");
    }

    JTextField poids = new JTextField();
    // addSQLObject(poids, "T_POIDS");
    final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT,
            textRemiseHT, fieldService, fieldHA, fieldDevise, poids, null);

    c.gridx = GridBagConstraints.RELATIVE;
    c.gridy--;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 2;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.fill = GridBagConstraints.NONE;
    c.weighty = 0;

    this.add(totalTTC, c);

    this.panelOO = new PanelOOSQLComponent(this);
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;
    c.gridx = 0;
    c.gridy += 3;
    c.weightx = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    this.add(this.panelOO, c);

    textPortHT.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void removeUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void insertUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });

    textRemiseHT.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void removeUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void insertUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });

    addRequiredSQLObject(this.comboClient, "ID_CLIENT");
    addSQLObject(this.textObjet, "NOM");
    addSQLObject(textPoidsTotal, "T_POIDS");
    addRequiredSQLObject(dateCommande, "DATE");
    // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS");
    addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO");
    addSQLObject(this.infos, "INFOS");
    addSQLObject(this.comboDevis, "ID_DEVIS");

    this.numeroUniqueCommande
            .setText(NumerotationAutoSQLElement.getNextNumero(CommandeClientSQLElement.class, new Date()));

    this.table.getModel().addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            textPoidsTotal.setText(String.valueOf(CommandeClientSQLComponent.this.table.getPoidsTotal()));
        }
    });
    DefaultGridBagConstraints.lockMinimumSize(comboClient);
    DefaultGridBagConstraints.lockMinimumSize(comboCommercial);
    DefaultGridBagConstraints.lockMinimumSize(comboDevis);
    DefaultGridBagConstraints.lockMinimumSize(totalTTC);
    DefaultGridBagConstraints.lockMaximumSize(totalTTC);
    DefaultGridBagConstraints.lockMinimumSize(numeroUniqueCommande);

}

From source file:org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent.java

private JPanel getBottomPanel() {
    final JPanel panel = new JPanel(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();

    // Colonne 1 : Infos
    c.gridx = 0;//from www.  ja v a2  s  .  com
    c.weightx = 1;
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.HORIZONTAL;

    panel.add(new TitledSeparator(getLabelFor("INFOS")), c);

    c.gridy++;
    c.weighty = 0;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    final JScrollPane scrollPane = new JScrollPane(this.infos);
    scrollPane.setBorder(null);
    panel.add(scrollPane, c);

    // Colonne 2 : Poids & autres
    DefaultProps props = DefaultNXProps.getInstance();
    Boolean b = props.getBooleanValue("ArticleShowPoids");
    final JTextField textPoidsTotal = new JTextField(8);
    JTextField poids = new JTextField();
    if (b) {
        final JPanel panelPoids = new JPanel();

        panelPoids.add(new JLabel(getLabelFor("T_POIDS")), c);

        textPoidsTotal.setEnabled(false);
        textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT);
        textPoidsTotal.setDisabledTextColor(Color.BLACK);

        panelPoids.add(textPoidsTotal, c);

        c.gridx++;
        c.gridy = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        c.gridheight = 2;
        c.fill = GridBagConstraints.NONE;
        c.anchor = GridBagConstraints.NORTHEAST;
        panel.add(panelPoids, c);
        DefaultGridBagConstraints.lockMinimumSize(panelPoids);
        addSQLObject(textPoidsTotal, "T_POIDS");
    } else {
        addSQLObject(poids, "T_POIDS");
    }

    DeviseField textPortHT = new DeviseField();
    ElementComboBox comboTaxePort = new ElementComboBox();

    if (getTable().contains("PORT_HT")) {
        addRequiredSQLObject(textPortHT, "PORT_HT");
        final JPanel panelPoids = new JPanel(new GridBagLayout());
        GridBagConstraints cPort = new DefaultGridBagConstraints();
        cPort.gridx = 0;
        cPort.weightx = 0;
        panelPoids.add(new JLabel(getLabelFor("PORT_HT")), cPort);
        textPortHT.setHorizontalAlignment(JTextField.RIGHT);
        cPort.gridx++;
        cPort.weightx = 1;
        panelPoids.add(textPortHT, cPort);

        cPort.gridy++;
        cPort.gridx = 0;
        cPort.weightx = 0;
        addRequiredSQLObject(comboTaxePort, "ID_TAXE_PORT");
        panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT")), cPort);
        cPort.gridx++;
        cPort.weightx = 0;
        panelPoids.add(comboTaxePort, cPort);

        c.gridx++;
        c.gridy = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        c.gridheight = 2;
        c.fill = GridBagConstraints.NONE;
        c.anchor = GridBagConstraints.NORTHEAST;
        panel.add(panelPoids, c);
        DefaultGridBagConstraints.lockMinimumSize(panelPoids);
    }
    // Total

    DeviseField textRemiseHT = new DeviseField();
    DeviseField fieldHT = new DeviseField();
    DeviseField fieldTVA = new DeviseField();
    DeviseField fieldTTC = new DeviseField();
    DeviseField fieldDevise = new DeviseField();
    DeviseField fieldService = new DeviseField();
    fieldHT.setOpaque(false);
    fieldTVA.setOpaque(false);
    fieldTTC.setOpaque(false);
    fieldService.setOpaque(false);
    addRequiredSQLObject(fieldDevise, "T_DEVISE");
    addRequiredSQLObject(fieldHT, "T_HT");
    addRequiredSQLObject(fieldTVA, "T_TVA");

    addRequiredSQLObject(fieldTTC, "T_TTC");
    addRequiredSQLObject(fieldService, "T_SERVICE");
    final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT,
            textRemiseHT, fieldService, null, fieldDevise, null, null,
            (getTable().contains("ID_TAXE_PORT") ? comboTaxePort : null));

    c.gridx++;
    c.gridy--;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 2;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.fill = GridBagConstraints.BOTH;
    c.weighty = 0;
    DefaultGridBagConstraints.lockMinimumSize(totalTTC);

    panel.add(totalTTC, c);

    c.gridy += 3;
    c.gridheight = 2;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;
    panel.add(getModuleTotalPanel(), c);

    table.getModel().addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            textPoidsTotal.setText(String.valueOf(table.getPoidsTotal()));
        }
    });

    textPortHT.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void removeUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void insertUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });

    comboTaxePort.addValueListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            // TODO Raccord de mthode auto-gnr
            totalTTC.updateTotal();
        }
    });

    textRemiseHT.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void removeUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void insertUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });
    return panel;
}

From source file:org.openmicroscopy.shoola.agents.fsimporter.view.ImporterUIElement.java

/** Builds and lays out the UI. */
private void buildGUI() {
    layoutEntries(false);//from   w  w w  .  j  a  v  a 2  s  .  c  o  m
    JScrollPane pane = new JScrollPane(entries);
    pane.setOpaque(false);
    pane.setBorder(new LineBorder(Color.LIGHT_GRAY));
    setLayout(new BorderLayout(0, 0));
    add(buildHeader(), BorderLayout.NORTH);
    add(pane, BorderLayout.CENTER);
}