Example usage for java.beans PropertyChangeListener PropertyChangeListener

List of usage examples for java.beans PropertyChangeListener PropertyChangeListener

Introduction

In this page you can find the example usage for java.beans PropertyChangeListener PropertyChangeListener.

Prototype

PropertyChangeListener

Source Link

Usage

From source file:br.com.jinsync.view.FrmJInSync.java

private void processFile(String nameCopy) {

    loadColumnsLayoutTableFile();/*from   w  w w  .  j  ava  2  s .c  om*/

    String arq = nameCopy;
    int lenFile = 0;

    int qtdColumns = columnNamesFile.length;
    tableFileModel = new FileTableModel(columnNamesFile, qtdColumns);

    isProcessStarted = true;
    tabFile.setFocusable(true);
    tabFile.requestFocusInWindow();

    grpFontes.setEnabledAt(0, false);
    grpFontes.setEnabledAt(1, false);

    try {
        lenFile = Integer.parseInt(txtLength.getText());
    } catch (NumberFormatException e) {
        lenFile = qtdLargerGrp;
    }

    tbWorker = new TableSwingWorker(tableFileModel, listTotCopy, arq, lenFile, progressBar, tabFile);
    tbWorker.execute();

    loadLayoutTableFile();

    tbWorker.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("state")) {
                SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue();
                switch (state) {
                case DONE:
                    isProcessStarted = false;
                    grpFontes.setEnabledAt(0, true);
                    grpFontes.setEnabledAt(1, true);
                }
            }
        }
    });

}

From source file:ca.uhn.hl7v2.testpanel.ui.conn.Hl7ConnectionPanel.java

public void setConnection(AbstractConnection theConnection) {
    myConnection = theConnection;/*from  w w  w.  ja  va 2s  .c  o  m*/

    myHohSecurityKeyPwTextBox.setText(myConnection.getTlsKeystorePassword());
    myHohSecurityKeystoreTextbox.setText(myConnection.getTlsKeystoreLocation());
    myHohSecurityProfileKeystoreStatus.setText("");

    myHohSignatureEnabled.setSelected(myConnection.isHohSignatureEnabled());
    myHohSignatureKeystoreTextbox.setText(myConnection.getHohSignatureKeystore());
    myHohSignatureKeystorePasswordTextbox.setText(myConnection.getHohSignatureKeystorePassword());
    myHohSignatureKeyPass.setText(myConnection.getHohSignatureKeyPassword());
    updateHohSignatureKeyCombo();

    myCharsetCombo.setSelectedItem(theConnection.getCharSet());

    myTlsCheckbox.setSelected(theConnection.isTls());
    myHohTlsCheckbox.setSelected(theConnection.isTls());
    myCaptureByteStreamCheckbox.setSelected(theConnection.isCaptureBytes());

    myHohAuthEnabledCheckbox.setSelected(myConnection.isHohAuthenticationEnabled());
    myHohAuthUsernameTextbox.setText(myConnection.getHohAuthenticationUsername());
    myHohAuthPasswordTextbox.setText(myConnection.getHohAuthenticationPassword());

    updateCharset();

    Hl7V2EncodingTypeEnum encoding = theConnection.getEncoding();
    myEr7Radio.setSelected(encoding == Hl7V2EncodingTypeEnum.ER_7);
    myXmlRadio.setSelected(encoding == Hl7V2EncodingTypeEnum.XML);
    myHostBox.setText(theConnection.getHost());

    updatePortsUi();

    myStatusPropertyChangeListener = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent theEvt) {
            updateStatus();
        }
    };
    myConnection.addPropertyChangeListener(OutboundConnection.STATUS_PROPERTY, myStatusPropertyChangeListener);

    myStatusLinePropertyChangeListener = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent theEvt) {
            updateStatus();
        }
    };
    myConnection.addPropertyChangeListener(OutboundConnection.STATUS_LINE_PROPERTY,
            myStatusLinePropertyChangeListener);

    myHohSecurityProfileKeystoreStatusListener = new KeystoreStatusListener(myHohSecurityProfileKeystoreStatus);
    myConnection.addPropertyChangeListener(AbstractConnection.TLS_KEYSTORE_STATUS,
            myHohSecurityProfileKeystoreStatusListener);

    myHohSignatureStatusListener = new KeystoreStatusListener(myHohSignatureStatusLabel);
    myConnection.addPropertyChangeListener(AbstractConnection.HOH_SIGNATURE_KEYSTORE_STATUS,
            myHohSignatureStatusListener);

    myHohSignerAvailableAliasesListener = new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent theEvt) {
            updateHohSignatureKeyCombo();
        }

    };
    myConnection.addPropertyChangeListener(AbstractConnection.HOH_SIGNER_AVAILABLE_ALIASES_PROPERTY,
            myHohSignerAvailableAliasesListener);

    updateStatus();

}

From source file:br.com.jinsync.view.FrmJInSync.java

private void expExcelBook() {

    ExportExcelBook expBook = new ExportExcelBook();
    expBook.setTableName(tableCopy);/*  w w  w  .  jav  a2  s  .  c o m*/
    expBook.setNameFile(txtPath.getText());

    EnableComponents.enable(tabCopybook, false);
    grpFontes.setEnabledAt(1, false);
    grpFontes.setEnabledAt(2, false);

    expBook.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("state")) {
                SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue();
                switch (state) {
                case DONE:
                    EnableComponents.enable(tabCopybook, true);
                    grpFontes.setEnabledAt(1, true);
                    grpFontes.setEnabledAt(2, true);
                }
            }
        }
    });

    expBook.execute();

}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

/**
 * // w  w  w .  ja  v  a2  s  .  c  o m
 * Added by Ben. 14/10/2013.
 */
private void setMultipleRootFromFolders_startThread() {

    BuildIEWorker buildIE = new BuildIEWorker("SetMultipleRootFromFolders");
    buildIE.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (Integer) evt.getNewValue();
                manualDepositFrame.setProgressLevel(progress);
            }
        }
    });
    buildIE.execute();

    return;
}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

/**
 * //from  w w w  . jav  a 2 s.  c  o m
 * Added by Ben. 14/10/2013.
 */
private void setMultipleRoot_startThread() {

    BuildIEWorker buildIE = new BuildIEWorker("SetMultipleRoot");
    buildIE.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (Integer) evt.getNewValue();
                manualDepositFrame.setProgressLevel(progress);
            }
        }
    });
    buildIE.execute();

    return;
}

From source file:br.com.jinsync.view.FrmJInSync.java

private void expExcelString() {

    ExportExcelString expString = new ExportExcelString();
    expString.setTableName(tableString);
    expString.setNameFile(txtPath.getText());

    expString.setTipoConteudo(contentType);
    expString.setTamanhoConteudo(contentLength);
    expString.setDecimalConteudo(contentDecimal);
    expString.setTotalConteudo(contentTotal);

    EnableComponents.enable(tabString, false);
    grpFontes.setEnabledAt(0, false);/*  www. j a  v  a2  s .c  o m*/
    grpFontes.setEnabledAt(2, false);

    expString.addPropertyChangeListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("state")) {
                SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue();
                switch (state) {
                case DONE:
                    EnableComponents.enable(tabString, true);
                    grpFontes.setEnabledAt(0, true);
                    grpFontes.setEnabledAt(2, true);
                }
            }
        }
    });

    expString.execute();

}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

/**
 * //from w ww  . j a v  a 2s  .  com
 * Added by Ben. 14/10/2013.
 */
private void setRoot_startThread(String entityName, String filePrefix, boolean updateScreen,
        boolean childrenLoaded) {

    BuildIEWorker buildIE = new BuildIEWorker("SetRoot", entityName, filePrefix, updateScreen, childrenLoaded);
    buildIE.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (Integer) evt.getNewValue();
                manualDepositFrame.setProgressLevel(progress);
            }
        }
    });
    buildIE.execute();

    return;
}

From source file:br.com.jinsync.view.FrmJInSync.java

private void expExcelFile() {

    progressBar.setStringPainted(true);//from   ww  w.  j a  v a2s  .com
    progressBar.setValue(0);

    btnExcelFile.setEnabled(false);

    ExportExcelFile exportExcelFile = new ExportExcelFile();

    exportExcelFile.setTableName(tableFile);
    exportExcelFile.setName(txtFile.getText());

    EnableComponents.enable(tabFile, false);
    grpFontes.setEnabledAt(0, false);
    grpFontes.setEnabledAt(1, false);

    exportExcelFile.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (int) evt.getNewValue();
                progressBar.setValue(progress);
                progressBar.setString(Language.msgExportingExcel + progress + "%");
                repaint();
            } else if (name.equals("state")) {
                SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue();
                switch (state) {
                case DONE:
                    EnableComponents.enable(tabFile, true);
                    grpFontes.setEnabledAt(0, true);
                    grpFontes.setEnabledAt(1, true);
                }
            }
        }
    });

    exportExcelFile.execute();

}

From source file:nz.govt.natlib.ndha.manualdeposit.ManualDepositPresenter.java

/**
 * //  www.j  av a 2  s . com
 * Added by Ben. 14/10/2013.
 */
private void dragFromFileSystemTree_startThread(List<FileGroupCollection> entities, FileSystemObject rootNode,
        boolean recursive, boolean isEditingEntity) {

    BuildIEWorker buildIE = new BuildIEWorker("dragFromFileSystemTree", entities, rootNode, recursive,
            isEditingEntity);
    buildIE.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            String name = evt.getPropertyName();
            if (name.equals("progress")) {
                int progress = (Integer) evt.getNewValue();
                manualDepositFrame.setProgressLevel(progress);
            }
        }
    });
    buildIE.execute();

    return;
}

From source file:op.care.bhp.PnlBHP.java

private java.util.List<Component> addFilter() {
    java.util.List<Component> list = new ArrayList<Component>();

    jdcDatum = new JDateChooser(new Date());
    jdcDatum.setFont(new Font("Arial", Font.PLAIN, 18));
    jdcDatum.setMinSelectableDate(BHPTools.getMinDatum(resident));

    jdcDatum.setBackground(Color.WHITE);
    jdcDatum.addPropertyChangeListener(new PropertyChangeListener() {
        @Override//from   w ww.  j  a  v  a  2  s  .co  m
        public void propertyChange(PropertyChangeEvent evt) {
            if (initPhase) {
                return;
            }
            if (evt.getPropertyName().equals("date")) {
                reloadDisplay();
            }
        }
    });
    list.add(jdcDatum);

    JPanel buttonPanel = new JPanel();
    buttonPanel.setBackground(Color.WHITE);
    buttonPanel.setLayout(new HorizontalLayout(5));
    buttonPanel.setBorder(new EmptyBorder(0, 0, 0, 0));

    JButton homeButton = new JButton(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start.png")));
    homeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            jdcDatum.setDate(jdcDatum.getMinSelectableDate());
        }
    });
    homeButton.setPressedIcon(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start_pressed.png")));
    homeButton.setBorder(null);
    homeButton.setBorderPainted(false);
    homeButton.setOpaque(false);
    homeButton.setContentAreaFilled(false);
    homeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JButton backButton = new JButton(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back.png")));
    backButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DateMidnight current = new DateMidnight(jdcDatum.getDate());
            DateMidnight min = new DateMidnight(jdcDatum.getMinSelectableDate());
            if (current.equals(min)) {
                return;
            }
            jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), -1));
        }
    });
    backButton
            .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_back_pressed.png")));
    backButton.setBorder(null);
    backButton.setBorderPainted(false);
    backButton.setOpaque(false);
    backButton.setContentAreaFilled(false);
    backButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JButton fwdButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play.png")));
    fwdButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            DateMidnight current = new DateMidnight(jdcDatum.getDate());
            if (current.equals(new DateMidnight())) {
                return;
            }
            jdcDatum.setDate(SYSCalendar.addDate(jdcDatum.getDate(), 1));
        }
    });
    fwdButton
            .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_play_pressed.png")));
    fwdButton.setBorder(null);
    fwdButton.setBorderPainted(false);
    fwdButton.setOpaque(false);
    fwdButton.setContentAreaFilled(false);
    fwdButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    JButton endButton = new JButton(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end.png")));
    endButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            jdcDatum.setDate(new Date());
        }
    });
    endButton.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end_pressed.png")));
    endButton.setBorder(null);
    endButton.setBorderPainted(false);
    endButton.setOpaque(false);
    endButton.setContentAreaFilled(false);
    endButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));

    buttonPanel.add(homeButton);
    buttonPanel.add(backButton);
    buttonPanel.add(fwdButton);
    buttonPanel.add(endButton);

    list.add(buttonPanel);

    //        panelFilter.setContentPane(labelPanel);

    return list;
}