Example usage for java.beans PropertyChangeEvent getPropertyName

List of usage examples for java.beans PropertyChangeEvent getPropertyName

Introduction

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

Prototype

public String getPropertyName() 

Source Link

Document

Gets the programmatic name of the property that was changed.

Usage

From source file:org.jitsi.videobridge.Conference.java

/**
 * Notifies this instance that there was a change in the value of a property
 * of an <tt>Endpoint</tt> participating in this multipoint conference.
 *
 * @param endpoint the <tt>Endpoint</tt> which is the source of the
 * event/notification and is participating in this multipoint conference
 * @param ev a <tt>PropertyChangeEvent</tt> which specifies the source of
 * the event/notification, the name of the property and the old and new
 * values of that property/*from  ww w  .j  a  va2 s  .  c  o  m*/
 */
private void endpointPropertyChange(Endpoint endpoint, PropertyChangeEvent ev) {
    String propertyName = ev.getPropertyName();
    boolean maybeRemoveEndpoint;

    if (Endpoint.SCTP_CONNECTION_PROPERTY_NAME.equals(propertyName)) {
        // The SctpConnection of/associated with an Endpoint has changed. We
        // may want to fire initial events over that SctpConnection (as soon
        // as it is ready).
        SctpConnection oldValue = (SctpConnection) ev.getOldValue();
        SctpConnection newValue = (SctpConnection) ev.getNewValue();

        endpointSctpConnectionChanged(endpoint, oldValue, newValue);

        // The SctpConnection may have expired.
        maybeRemoveEndpoint = (newValue == null);
    } else if (Endpoint.CHANNELS_PROPERTY_NAME.equals(propertyName)) {
        // An RtpChannel may have expired.
        maybeRemoveEndpoint = true;
    } else {
        maybeRemoveEndpoint = false;
    }
    if (maybeRemoveEndpoint) {
        // It looks like there is a chance that the Endpoint may have
        // expired. Endpoints are held by this Conference via WeakReferences
        // but WeakReferences are unpredictable. We have functionality
        // though which could benefit from discovering that an Endpoint has
        // expired as quickly as possible (e.g. ConferenceSpeechActivity).
        // Consequently, try to expedite the removal of expired Endpoints.
        if (endpoint.getSctpConnection() == null && endpoint.getChannelCount(null) == 0) {
            removeEndpoint(endpoint);
        }
    }
}

From source file:edu.ku.brc.specify.tasks.subpane.images.ImagesPane.java

/**
 * /*from  w w  w .ja va  2  s. c  o m*/
 */
private void searchForRecordSetAttachments() {
    final String MEGS = "MEGS";
    final String STATUSBAR_NAME = "ImageSearchStatusBar";

    rowsVector.clear();
    items = recordSet.getOrderedItems();

    final int numItems = items.size();

    SwingWorker<Integer, Integer> backupWorker = new SwingWorker<Integer, Integer>() {
        @Override
        protected Integer doInBackground() throws Exception {
            final DBTableInfo ti = DBTableIdMgr.getInstance().getInfoById(recordSet.getDbTableId());

            boolean isAttachmentTableItself = ti.getTableId() == Attachment.getClassTableId();

            String sql;
            if (!isAttachmentTableItself) {
                sql = "SELECT a.AttachmentID, a.TableID, a.Title, a.AttachmentLocation, a.MimeType FROM attachment a "
                        + "INNER JOIN %sattachment coa ON a.AttachmentID = coa.AttachmentID "
                        + "WHERE coa.%s IN (%s) %s ORDER BY FIELD(%s, %s)";
            } else {
                sql = "SELECT a.AttachmentID, a.TableID, a.Title, a.AttachmentLocation, a.MimeType FROM attachment a "
                        + "WHERE AttachmentID IN (%s) ORDER BY FIELD(a.AttachmentID, %s)";
            }

            int batchSize = 500;
            int attchIndex = 0;
            int batches = (numItems / batchSize) + (numItems % batchSize == 0 ? 0 : 1);
            if (numItems < batchSize) {
                batchSize = numItems;
            }

            Statement stmt = null;
            try {
                stmt = DBConnection.getInstance().getConnection().createStatement();

                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < batches; i++) {
                    firePropertyChange(MEGS, 0, i + 1);
                    sb.setLength(0);
                    for (int j = 0; j < batchSize && attchIndex < numItems; j++) {
                        RecordSetItemIFace rsi = items.get(attchIndex++);
                        if (j > 0)
                            sb.append(',');
                        sb.append(rsi.getRecordId().toString());
                    }

                    String filter = getFilterString();
                    if (StringUtils.isNotEmpty(filter)) {
                        filter = " AND " + filter;
                    }

                    String fullSQL;
                    if (!isAttachmentTableItself) {
                        fullSQL = String.format(sql, ti.getName(), ti.getIdColumnName(), sb.toString(), filter,
                                ti.getIdColumnName(), sb.toString());
                    } else {
                        fullSQL = String.format(sql, sb.toString(), filter, sb.toString());
                    }
                    log.debug(fullSQL);
                    ResultSet rs = stmt.executeQuery(fullSQL);
                    while (rs.next()) {
                        ImageDataItem imgDataItem = new ImageDataItem(rs.getInt(1), rs.getInt(2),
                                rs.getString(3), rs.getString(4), rs.getString(5));
                        rowsVector.add(imgDataItem);
                    }
                    rs.close();
                }

            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                try {
                    if (stmt != null)
                        stmt.close();
                } catch (Exception e) {
                }
            }
            return null;
        }

        @Override
        protected void done() {
            super.done();

            getStatusBar().setProgressDone(STATUSBAR_NAME);
            clearSimpleGlassPaneMsg();

            if (rowsVector != null && rowsVector.size() > 0) {
                gridPanel.setItemList(rowsVector);
                JScrollPane sb = new JScrollPane(gridPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
                        JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
                add(sb, BorderLayout.CENTER);

                ((AttachmentsTask) task).attachmentSearchDone(ImagesPane.this);

            } else {
                ((AttachmentsTask) task).attachmentSearchDone(null);
                writeTimedSimpleGlassPaneMsg(getNotFoundMessage());
            }
        }
    };

    final JStatusBar statusBar = getStatusBar();
    statusBar.setIndeterminate(STATUSBAR_NAME, true);

    writeSimpleGlassPaneMsg(getResourceString("ATTCH_SEARCH_IMGS"), 24);

    backupWorker.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(final PropertyChangeEvent evt) {
            if (MEGS.equals(evt.getPropertyName())) {
                Integer value = (Integer) evt.getNewValue();
                int val = (int) (((double) value / (double) numItems) * 100.0);
                statusBar.setText(Integer.toString(val));//getLocalizedMessage("MySQLBackupService.BACKUP_MEGS", val));
            }
        }
    });
    backupWorker.execute();
}

From source file:op.care.dfn.PnlDFN.java

private List<Component> addFilters() {
    List<Component> list = new ArrayList<Component>();

    jdcDate = new JDateChooser(new Date());
    jdcDate.setFont(new Font("Arial", Font.PLAIN, 14));

    jdcDate.setBackground(Color.WHITE);

    list.add(jdcDate);//from  ww  w . j a  v a 2  s.  c  o  m

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

    final JButton homeButton = new JButton(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_start.png")));
    homeButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            jdcDate.setDate(jdcDate.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));

    final 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(jdcDate.getDate());
            DateMidnight min = new DateMidnight(jdcDate.getMinSelectableDate());
            if (current.equals(min)) {
                return;
            }
            jdcDate.setDate(SYSCalendar.addDate(jdcDate.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));

    final 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(jdcDate.getDate());
            if (current.equals(new DateMidnight())) {
                return;
            }
            jdcDate.setDate(SYSCalendar.addDate(jdcDate.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));

    final JButton endButton = new JButton(
            new ImageIcon(getClass().getResource("/artwork/32x32/bw/player_end.png")));
    endButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent actionEvent) {
            jdcDate.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);

    jdcDate.addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (initPhase) {
                return;
            }
            if (evt.getPropertyName().equals("date")) {
                reloadDisplay();
            }
        }
    });

    return list;
}

From source file:it.cnr.icar.eric.client.ui.swing.RegistryObjectsTable.java

/**
 * Listens to property changes in the bound property
 * RegistryBrowser.PROPERTY_AUTHENTICATED.  Certain menuItems are
 * hidden when user is unAuthenticated./*from  w  w  w  .  j a va2  s  . c o m*/
 *
 * Listens to property changes in the bound property
 * RegistryBrowser.PROPERTY_LOCALE.  Updates locale and UI strings
 * when the property changes.
 */
public void propertyChange(PropertyChangeEvent ev) {
    if (ev.getPropertyName().equals(RegistryBrowser.PROPERTY_AUTHENTICATED)) {
        boolean authenticated = ((Boolean) ev.getNewValue()).booleanValue();

        setEditable(authenticated);
    } else if (ev.getPropertyName().equals(RegistryBrowser.PROPERTY_LOCALE)) {
        processLocaleChange((Locale) ev.getNewValue());
    }
}

From source file:co.com.soinsoftware.hotelero.view.JFRoom.java

private void watchPropertyChangeForJDateChooserControls() {
    this.jdcInitialDate.getDateEditor().addPropertyChangeListener(new PropertyChangeListener() {
        @Override//  w w  w.j a  v a 2  s  .  c  om
        public void propertyChange(PropertyChangeEvent e) {
            if ("date".equals(e.getPropertyName())) {
                final Date selectedDate = (Date) e.getNewValue();
                final Calendar calendar = Calendar.getInstance();
                calendar.setTime(selectedDate);
                setFinalDate(calendar);
            }
        }
    });

    this.jdcFinalDate.getDateEditor().addPropertyChangeListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent e) {
            if ("date".equals(e.getPropertyName())) {
                if (validateFinalDate()) {
                    refreshNotEnabledSet();
                }
            }
        }
    });
}

From source file:org.apache.catalina.loader.WebappLoader.java

/**
 * Process property change events from our associated Context.
 *
 * @param event The property change event that has occurred
 *///ww  w .  j av a  2  s . co m
public void propertyChange(PropertyChangeEvent event) {

    // Validate the source of this event
    if (!(event.getSource() instanceof Context))
        return;
    Context context = (Context) event.getSource();

    // Process a relevant property change
    if (event.getPropertyName().equals("reloadable")) {
        try {
            setReloadable(((Boolean) event.getNewValue()).booleanValue());
        } catch (NumberFormatException e) {
            log.error(sm.getString("webappLoader.reloadable", event.getNewValue().toString()));
        }
    }

}

From source file:uiuc.dm.miningTools.ui.ParametersSelectionFrame.java

@Override
public void propertyChange(PropertyChangeEvent evt) {
    if ("progress".equals(evt.getPropertyName())) {
        int progress = (Integer) evt.getNewValue();
        downloadDatasetProgressBar.setValue(progress);
    }/*w ww  .j ava2  s.  c om*/
}

From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.JPanCodeMatchMain.java

/**
 * This method initializes jPanel1   /*ww w .  ja v  a 2  s. com*/
 *    
 * @return javax.swing.JPanel   
 */
public JSplitPane getJSplitPaneSourceCode() {
    if (jSplitPaneSourceCode == null) {
        GridBagConstraints gridBagConstraints14 = new GridBagConstraints();
        gridBagConstraints14.fill = GridBagConstraints.BOTH;
        gridBagConstraints14.weighty = 1.0;
        gridBagConstraints14.weightx = 1.0;
        GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
        gridBagConstraints17.fill = GridBagConstraints.BOTH;
        gridBagConstraints17.weighty = 1.0;
        gridBagConstraints17.weightx = 1.0;
        jSplitPaneSourceCode = new JSplitPane();
        jSplitPaneSourceCode.setBorder(BorderFactory.createTitledBorder(null, "Source Code",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jSplitPaneSourceCode.setDividerSize(5);
        jSplitPaneSourceCode.setLeftComponent(getJPanMatchedSourceViewLeft());
        jSplitPaneSourceCode.setRightComponent(getJPanMatchedSourceViewRight());

        PropertyChangeListener propertyChangeListener = new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent changeEvent) {
                String propertyName = changeEvent.getPropertyName();
                if (propertyName.equals(JSplitPane.LAST_DIVIDER_LOCATION_PROPERTY)) {
                    if (getSimilarSnippets() != null) {
                        setNavigator();
                    }
                }
            }
        };

        jSplitPaneSourceCode.addPropertyChangeListener(propertyChangeListener);
    }
    return jSplitPaneSourceCode;
}

From source file:org.pentaho.ui.database.event.DataHandler.java

protected void getControls() {

    // Not all of these controls are created at the same time.. that's OK, for now, just check
    // each one for null before using.

    dialogDeck = (XulDeck) document.getElementById("dialog-panel-deck");
    deckOptionsBox = (XulListbox) document.getElementById("deck-options-list");
    connectionBox = (XulListbox) document.getElementById("connection-type-list");
    accessBox = (XulListbox) document.getElementById("access-type-list");
    connectionNameBox = (XulTextbox) document.getElementById("connection-name-text");
    hostNameBox = (XulTextbox) document.getElementById("server-host-name-text");
    databaseNameBox = (XulTextbox) document.getElementById("database-name-text");
    portNumberBox = (XulTextbox) document.getElementById("port-number-text");
    userNameBox = (XulTextbox) document.getElementById("username-text");
    passwordBox = (XulTextbox) document.getElementById("password-text");
    dataTablespaceBox = (XulTextbox) document.getElementById("data-tablespace-text");
    indexTablespaceBox = (XulTextbox) document.getElementById("index-tablespace-text");
    serverInstanceBox = (XulTextbox) document.getElementById("instance-text");
    serverNameBox = (XulTextbox) document.getElementById("server-name-text");
    customUrlBox = (XulTextbox) document.getElementById("custom-url-text");
    customDriverClassBox = (XulTextbox) document.getElementById("custom-driver-class-text");
    languageBox = (XulTextbox) document.getElementById("language-text");
    systemNumberBox = (XulTextbox) document.getElementById("system-number-text");
    clientBox = (XulTextbox) document.getElementById("client-text");
    doubleDecimalSeparatorCheck = (XulCheckbox) document.getElementById("decimal-separator-check");
    resultStreamingCursorCheck = (XulCheckbox) document.getElementById("result-streaming-check");
    poolingCheck = (XulCheckbox) document.getElementById("use-pool-check");
    clusteringCheck = (XulCheckbox) document.getElementById("use-cluster-check");
    clusterParameterDescriptionLabel = (XulLabel) document
            .getElementById("cluster-parameter-description-label");
    poolSizeLabel = (XulLabel) document.getElementById("pool-size-label");
    poolSizeBox = (XulTextbox) document.getElementById("pool-size-text");
    maxPoolSizeLabel = (XulLabel) document.getElementById("max-pool-size-label");
    maxPoolSizeBox = (XulTextbox) document.getElementById("max-pool-size-text");
    poolParameterTree = (XulTree) document.getElementById("pool-parameter-tree");
    clusterParameterTree = (XulTree) document.getElementById("cluster-parameter-tree");
    optionsParameterTree = (XulTree) document.getElementById("options-parameter-tree");
    poolingDescription = (XulTextbox) document.getElementById("pooling-description");
    poolingParameterDescriptionLabel = (XulLabel) document.getElementById("pool-parameter-description-label");
    poolingDescriptionLabel = (XulLabel) document.getElementById("pooling-description-label");
    supportBooleanDataType = (XulCheckbox) document.getElementById("supports-boolean-data-type");
    supportTimestampDataType = (XulCheckbox) document.getElementById("supports-timestamp-data-type");
    quoteIdentifiersCheck = (XulCheckbox) document.getElementById("quote-identifiers-check");
    lowerCaseIdentifiersCheck = (XulCheckbox) document.getElementById("force-lower-case-check");
    upperCaseIdentifiersCheck = (XulCheckbox) document.getElementById("force-upper-case-check");
    preserveReservedCaseCheck = (XulCheckbox) document.getElementById("preserve-reserved-case");
    preferredSchemaName = (XulTextbox) document.getElementById("preferred-schema-name-text");
    sqlBox = (XulTextbox) document.getElementById("sql-text");
    useIntegratedSecurityCheck = (XulCheckbox) document.getElementById("use-integrated-security-check");
    acceptButton = (XulButton) document.getElementById("general-datasource-window_accept");
    cancelButton = (XulButton) document.getElementById("general-datasource-window_cancel");
    testButton = (XulButton) document.getElementById("test-button");
    noticeLabel = (XulLabel) document.getElementById("notice-label");

    if (portNumberBox != null && serverInstanceBox != null) {
        if (Boolean.parseBoolean(serverInstanceBox.getAttributeValue("shouldDisablePortIfPopulated"))) {
            serverInstanceBox.addPropertyChangeListener(new PropertyChangeListener() {

                @Override//from  w w  w  .ja va 2 s . co m
                public void propertyChange(PropertyChangeEvent evt) {
                    if ("value".equals(evt.getPropertyName())) {
                        disablePortIfInstancePopulated();
                    }
                }
            });
        }
    }
}

From source file:ucar.unidata.idv.control.chart.ChartWrapper.java

/**
 * Handle the event//from ww w .  j  a v  a2  s  . c  o  m
 *
 * @param event The event
 */
public void propertyChange(PropertyChangeEvent event) {
    if (event.getPropertyName().equals(PROP_TIMERANGE)) {
        try {
            loadData();
        } catch (Exception exc) {
            LogUtil.logException("Error creating data set", exc);
        }
        return;
    } else if (event.getPropertyName().equals(PROP_REMOVED)) {
        Object source = event.getSource();
        if (source == timeFilterSource) {
            setTimeFilterSource(null);
        }
        if (source == timeSelectSource) {
            setTimeSelectSource(null);
        }
    }
    super.propertyChange(event);
}