List of usage examples for java.beans PropertyChangeEvent getOldValue
public Object getOldValue()
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 w ww .j av a 2 s . com*/ */ 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:uk.ac.diamond.scisoft.analysis.rcp.inspector.InspectionTab.java
@Override public void setParameters(ILazyDataset data, List<AxisSelection> datasetAxisList, List<PlotAxisProperty> plotAxisList) { if (axesListener != null && daxes != null) { for (AxisSelection a : daxes) { a.removePropertyChangeListener(axesListener); }/* w w w . j a v a 2 s. c o m*/ } super.setParameters(data, datasetAxisList, plotAxisList); if (daxes != null) { if (axesListener == null) { axesListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { repopulateCombos(evt.getOldValue().toString(), evt.getNewValue().toString()); } }; } for (AxisSelection a : daxes) { a.addPropertyChangeListener(axesListener); } } if (combos != null) populateCombos(); }
From source file:com.eviware.soapui.impl.wsdl.WsdlProject.java
public void propertyChange(PropertyChangeEvent evt) { if ("projectPassword".equals(evt.getPropertyName())) { if (encrypted == 0 & (evt.getOldValue() == null || ((String) evt.getOldValue()).length() == 0)) { encrypted = 1;//from ww w .ja v a 2 s. c o m } if (encrypted == 1 & (evt.getNewValue() == null || ((String) evt.getNewValue()).length() == 0)) { encrypted = 0; } if (SoapUI.getNavigator() != null) SoapUI.getNavigator().repaint(); } }
From source file:com.googlecode.vfsjfilechooser2.plaf.metal.MetalVFSFileChooserUI.java
@Override public PropertyChangeListener createPropertyChangeListener(VFSJFileChooser fc) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String s = e.getPropertyName(); if (s.equals(VFSJFileChooserConstants.SELECTED_FILE_CHANGED_PROPERTY)) { doSelectedFileChanged(e); } else if (s.equals(VFSJFileChooserConstants.SELECTED_FILES_CHANGED_PROPERTY)) { doSelectedFilesChanged(e); } else if (s.equals(VFSJFileChooserConstants.DIRECTORY_CHANGED_PROPERTY)) { doDirectoryChanged(e);//from w w w.ja va 2s . c o m } else if (s.equals(VFSJFileChooserConstants.FILE_FILTER_CHANGED_PROPERTY)) { doFilterChanged(e); } else if (s.equals(VFSJFileChooserConstants.FILE_SELECTION_MODE_CHANGED_PROPERTY)) { doFileSelectionModeChanged(e); } else if (s.equals(VFSJFileChooserConstants.ACCESSORY_CHANGED_PROPERTY)) { doAccessoryChanged(e); } else if (s.equals(VFSJFileChooserConstants.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY) || s.equals(VFSJFileChooserConstants.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY)) { doApproveButtonTextChanged(e); } else if (s.equals(VFSJFileChooserConstants.DIALOG_TYPE_CHANGED_PROPERTY)) { doDialogTypeChanged(e); } else if (s.equals(VFSJFileChooserConstants.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY)) { doApproveButtonMnemonicChanged(e); } else if (s.equals(VFSJFileChooserConstants.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY)) { doControlButtonsChanged(e); } else if (s.equals("componentOrientation")) { ComponentOrientation o = (ComponentOrientation) e.getNewValue(); VFSJFileChooser cc = (VFSJFileChooser) e.getSource(); if (o != (ComponentOrientation) e.getOldValue()) { cc.applyComponentOrientation(o); } } else if (s.equals("FileChooser.useShellFolder")) { updateUseShellFolder(); doDirectoryChanged(e); } else if (s.equals("ancestor")) { if ((e.getOldValue() == null) && (e.getNewValue() != null)) { // Ancestor was added, set initial focus fileNameTextField.selectAll(); fileNameTextField.requestFocus(); } } } }; }
From source file:uk.ac.lkl.cram.ui.chart.HoursChartMaker.java
/** * Create a dataset from the module//w w w .jav a2 s . c o m * @return a category dataset that is used to produce a stacked bar chart */ @Override protected CategoryDataset createDataSet() { //Create a dataset to hold the data final DefaultCategoryDataset categoryDataset = new DefaultCategoryDataset(); //populate the dataset with the data populateDataset(categoryDataset, module); //Create a listener, which repopulates the dataset when anything changes final PropertyChangeListener presentationListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { //LOGGER.info("event propertyName: " + pce.getPropertyName() + " newValue: " + pce.getNewValue()); populateDataset(categoryDataset, module); } }; //Add the listener to each of the module presentations for (ModulePresentation modulePresentation : module.getModulePresentations()) { //Listen for when the number of home or overseas students changes //This means when the number of home or overseas students changes, the dataset will be repopulated modulePresentation.addPropertyChangeListener(ModulePresentation.PROP_HOME_STUDENT_COUNT, presentationListener); modulePresentation.addPropertyChangeListener(ModulePresentation.PROP_OVERSEAS_STUDENT_COUNT, presentationListener); //Add the listener to the support time and preparation time of //each of the module's tlaLineItems, for each presentation //This means that whenever a support time or a preparation time changes, //or its activity changes, the listener is triggered //Causing the dataset to be repopulated //Also add the listener to the activity for the tlaLineItem so that //when the tutor group size changes, the chart is updated for (TLALineItem lineItem : module.getTLALineItems()) { //LOGGER.info("adding listener to : " + lineItem.getName()); SupportTime st = lineItem.getSupportTime(modulePresentation); st.addPropertyChangeListener(presentationListener); PreparationTime pt = lineItem.getPreparationTime(modulePresentation); pt.addPropertyChangeListener(presentationListener); lineItem.getActivity().addPropertyChangeListener(TLActivity.PROP_MAX_GROUP_SIZE, presentationListener); } //Add the listener to the support time of each of the module's //module line items, for each presentation for (ModuleLineItem lineItem : module.getModuleItems()) { //LOGGER.info("adding listener to : " + lineItem.getName()); SupportTime st = lineItem.getSupportTime(modulePresentation); st.addPropertyChangeListener(presentationListener); } } //Add a listener to the module, listening for changes where a tlaLineItem is added or removed module.addPropertyChangeListener(Module.PROP_TLA_LINEITEM, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { //A tlaLineItem has been added or removed if (pce instanceof IndexedPropertyChangeEvent) { //LOGGER.info("indexed change: " + pce); if (pce.getOldValue() != null) { //This has been removed TLALineItem lineItem = (TLALineItem) pce.getOldValue(); //So remove the listener from the preparation and support time //for each presentation of this line item //LOGGER.info("removing listeners from: " + lineItem.getName()); for (ModulePresentation modulePresentation : module.getModulePresentations()) { SupportTime st = lineItem.getSupportTime(modulePresentation); st.removePropertyChangeListener(presentationListener); PreparationTime pt = lineItem.getPreparationTime(modulePresentation); pt.removePropertyChangeListener(presentationListener); } //Also remove the listener from the activity lineItem.removePropertyChangeListener(TLActivity.PROP_MAX_GROUP_SIZE, presentationListener); } if (pce.getNewValue() != null) { //This has been added TLALineItem lineItem = (TLALineItem) pce.getNewValue(); //So add the listener to the preparation and support time //For each presentation of this line item //LOGGER.info("adding listeners to: " + lineItem); for (ModulePresentation modulePresentation : module.getModulePresentations()) { SupportTime st = lineItem.getSupportTime(modulePresentation); st.addPropertyChangeListener(presentationListener); PreparationTime pt = lineItem.getPreparationTime(modulePresentation); pt.addPropertyChangeListener(presentationListener); } //Also add the listener to the activity lineItem.addPropertyChangeListener(TLActivity.PROP_MAX_GROUP_SIZE, presentationListener); } } //Assume the dataset is now out of date populateDataset(categoryDataset, module); } }); //Do the same as above for module line items module.addPropertyChangeListener(Module.PROP_MODULE_LINEITEM, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { if (pce instanceof IndexedPropertyChangeEvent) { //LOGGER.info("indexed change: " + pce); if (pce.getOldValue() != null) { //This has been removed ModuleLineItem lineItem = (ModuleLineItem) pce.getOldValue(); //LOGGER.info("removing listeners from: " + lineItem.getName()); for (ModulePresentation modulePresentation : module.getModulePresentations()) { SupportTime st = lineItem.getSupportTime(modulePresentation); st.removePropertyChangeListener(presentationListener); } } if (pce.getNewValue() != null) { //This has been added ModuleLineItem lineItem = (ModuleLineItem) pce.getNewValue(); //LOGGER.info("adding listeners to: " + lineItem); for (ModulePresentation modulePresentation : module.getModulePresentations()) { SupportTime st = lineItem.getSupportTime(modulePresentation); st.addPropertyChangeListener(presentationListener); } } } populateDataset(categoryDataset, module); } }); //Add the listner to be triggered if the tutor group size of the module changes module.addPropertyChangeListener(Module.PROP_GROUP_SIZE, presentationListener); return categoryDataset; }
From source file:com.googlecode.vfsjfilechooser2.filepane.VFSFilePane.java
public void propertyChange(PropertyChangeEvent e) { if (viewType == -1) { setViewType(VIEWTYPE_LIST);/* w w w . j a va2s.c om*/ } String s = e.getPropertyName(); if (s.equals(VFSJFileChooserConstants.SELECTED_FILE_CHANGED_PROPERTY)) { doSelectedFileChanged(e); } else if (s.equals(VFSJFileChooserConstants.SELECTED_FILES_CHANGED_PROPERTY)) { doSelectedFilesChanged(e); } else if (s.equals(VFSJFileChooserConstants.DIRECTORY_CHANGED_PROPERTY)) { doDirectoryChanged(e); } else if (s.equals(VFSJFileChooserConstants.FILE_FILTER_CHANGED_PROPERTY)) { doFilterChanged(e); } else if (s.equals(VFSJFileChooserConstants.FILE_SELECTION_MODE_CHANGED_PROPERTY)) { doFileSelectionModeChanged(e); } else if (s.equals(VFSJFileChooserConstants.MULTI_SELECTION_ENABLED_CHANGED_PROPERTY)) { doMultiSelectionChanged(e); } else if (s.equals(VFSJFileChooserConstants.CANCEL_SELECTION)) { applyEdit(); } else if (s.equals("busy")) { setCursor((Boolean) e.getNewValue() ? waitCursor : null); } else if (s.equals("componentOrientation")) { ComponentOrientation o = (ComponentOrientation) e.getNewValue(); VFSJFileChooser cc = (VFSJFileChooser) e.getSource(); if (o != e.getOldValue()) { cc.applyComponentOrientation(o); } } }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Reacts to property fired by the table. * /*from ww w. jav a 2 s. co m*/ * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (FileSelectionTable.ADD_PROPERTY.equals(name)) { showLocationDialog(); } else if (FileSelectionTable.REMOVE_PROPERTY.equals(name)) { int n = handleFilesSelection(chooser.getSelectedFiles()); table.allowAddition(n > 0); importButton.setEnabled(table.hasFilesToImport()); } else if (JFileChooser.SELECTED_FILES_CHANGED_PROPERTY.equals(name)) { int n = handleFilesSelection(chooser.getSelectedFiles()); table.allowAddition(n > 0); } else if (NumericalTextField.TEXT_UPDATED_PROPERTY.equals(name)) { if (partialName.isSelected()) { Integer number = (Integer) numberOfFolders.getValueAsNumber(); if (number != null && number >= 0) table.applyToAll(); } } else if (SelectionWizard.SELECTED_ITEMS_PROPERTY.equals(name)) { Map m = (Map) evt.getNewValue(); if (m == null || m.size() != 1) return; Set set = m.entrySet(); Entry entry; Iterator i = set.iterator(); Class type; while (i.hasNext()) { entry = (Entry) i.next(); type = (Class) entry.getKey(); if (TagAnnotationData.class.getName().equals(type.getName())) handleTagsSelection((Collection<TagAnnotationData>) entry.getValue()); } } else if (ImportDialog.PROPERTY_GROUP_CHANGED.equals(name) || ImportDialog.REFRESH_LOCATION_PROPERTY.equals(name) || ImportDialog.CREATE_OBJECT_PROPERTY.equals(name)) { firePropertyChange(name, evt.getOldValue(), evt.getNewValue()); } else if (LocationDialog.ADD_TO_QUEUE_PROPERTY.equals(name)) { Object src = evt.getSource(); if (src != detachedDialog) { addImageJFiles(null, null); } } }
From source file:org.openmicroscopy.shoola.agents.fsimporter.util.FileImportComponent.java
/** * Listens to property fired by the <code>StatusLabel</code>. * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) *//* w w w. j a v a 2 s . c om*/ public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (StatusLabel.FILES_SET_PROPERTY.equals(name)) { if (isCancelled()) { busyLabel.setBusy(false); busyLabel.setVisible(false); return; } Map<File, StatusLabel> files = (Map<File, StatusLabel>) evt.getNewValue(); int n = files.size(); insertFiles(files); firePropertyChange(IMPORT_FILES_NUMBER_PROPERTY, null, n); } else if (StatusLabel.FILE_IMPORT_STARTED_PROPERTY.equals(name)) { resultIndex = ImportStatus.STARTED; StatusLabel sl = (StatusLabel) evt.getNewValue(); if (sl.equals(statusLabel) && busyLabel != null) { cancelButton.setEnabled(sl.isCancellable()); firePropertyChange(StatusLabel.FILE_IMPORT_STARTED_PROPERTY, null, this); } } else if (StatusLabel.UPLOAD_DONE_PROPERTY.equals(name)) { StatusLabel sl = (StatusLabel) evt.getNewValue(); if (sl.equals(statusLabel) && hasParent()) { if (sl.isMarkedAsCancel()) cancel(true); else { formatResult(); firePropertyChange(StatusLabel.UPLOAD_DONE_PROPERTY, null, this); } } } else if (StatusLabel.CANCELLABLE_IMPORT_PROPERTY.equals(name)) { StatusLabel sl = (StatusLabel) evt.getNewValue(); if (sl.equals(statusLabel)) cancelButton.setVisible(sl.isCancellable()); } else if (StatusLabel.SCANNING_PROPERTY.equals(name)) { StatusLabel sl = (StatusLabel) evt.getNewValue(); if (sl.equals(statusLabel)) { if (busyLabel != null && !isCancelled()) { busyLabel.setBusy(true); busyLabel.setVisible(true); } } } else if (StatusLabel.FILE_RESET_PROPERTY.equals(name)) { importable.setFile((File) evt.getNewValue()); fileNameLabel.setText(getFile().getName()); } else if (ThumbnailLabel.BROWSE_PLATE_PROPERTY.equals(name)) { firePropertyChange(BROWSE_PROPERTY, evt.getOldValue(), evt.getNewValue()); } else if (StatusLabel.CONTAINER_FROM_FOLDER_PROPERTY.equals(name)) { containerFromFolder = (DataObject) evt.getNewValue(); if (containerFromFolder instanceof DatasetData) { containerObject = containerFromFolder; } else if (containerFromFolder instanceof ScreenData) { containerObject = containerFromFolder; } } else if (StatusLabel.DEBUG_TEXT_PROPERTY.equals(name)) { firePropertyChange(name, evt.getOldValue(), evt.getNewValue()); } else if (ThumbnailLabel.VIEW_IMAGE_PROPERTY.equals(name)) { //use the group SecurityContext ctx = new SecurityContext(importable.getGroup().getId()); EventBus bus = ImporterAgent.getRegistry().getEventBus(); Long id = (Long) evt.getNewValue(); bus.post(new ViewImage(ctx, new ViewImageObject(id), null)); } else if (StatusLabel.IMPORT_DONE_PROPERTY.equals(name) || StatusLabel.PROCESSING_ERROR_PROPERTY.equals(name)) { StatusLabel sl = (StatusLabel) evt.getNewValue(); if (sl.equals(statusLabel)) firePropertyChange(StatusLabel.IMPORT_DONE_PROPERTY, null, this); } }
From source file:org.nuclos.client.ui.collect.CollectController.java
protected void initTab() { // prevent that the frame is closed when changes are pending: getTab().addVetoableChangeListener(new VetoableChangeListener() { @Override//from w w w . jav a2s .com public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { if (evt.getPropertyName().equals(JInternalFrame.IS_CLOSED_PROPERTY)) { final Boolean bOldValue = (Boolean) evt.getOldValue(); final Boolean bNewValue = (Boolean) evt.getNewValue(); if (bOldValue == Boolean.FALSE && bNewValue == Boolean.TRUE) { // We need bFrameMayBeClosed as a member variable here, as it is set in // cmdFrameClosing and must be checked here. // JInternalFrame.setClosed() first sends a frame closing event, then a vetoable change event. // Note that this is totally weird. See JInternalFrame.setClosed() if (!CollectController.this.bFrameMayBeClosed) { throw new PropertyVetoException("do not close", evt); } } } } }); // override close behavior: getTab().addMainFrameTabListener(new MainFrameTabAdapter() { @Override public void tabSelected(MainFrameTab tab) { setDefaultButton(); } @Override public void tabClosing(MainFrameTab tab, final ResultListener<Boolean> rl) { askAndSaveIfNecessary(new ResultListener<Boolean>() { @Override public void done(Boolean result) { rl.done(Boolean.TRUE.equals(result)); } }); } @Override public void tabClosed(MainFrameTab tab) { CollectController.this.close(); tab.removeMainFrameTabListener(this); } }); }