List of usage examples for java.beans PropertyChangeEvent PropertyChangeEvent
public PropertyChangeEvent(Object source, String propertyName, Object oldValue, Object newValue)
From source file:edu.ku.brc.specify.tasks.subpane.ESResultsTablePanel.java
/** * @param e//from w w w . j av a 2s . co m */ protected void doDoubleClickOnRow(final MouseEvent e) { if (e.getClickCount() == 2 && e.getButton() == 1) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (propChangeListener != null) { propChangeListener.propertyChange(new PropertyChangeEvent(this, "doubleClick", 2, 0)); } if (serviceBtns != null) { for (ServiceInfo si : serviceBtns.keySet()) { if (si.isDefault()) { final JButton defBtn = serviceBtns.get(si); if (defBtn != null) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { defBtn.doClick(); } }); break; } } } } } }); } }
From source file:org.ngrinder.recorder.ui.RecordingControlPanel.java
/** * Create Filter Button Panel./*from www . j a v a 2 s . c o m*/ * * @return filter button panel */ protected JPanel createFilterButtonPanel() { JPanel panel = new JPanel(); panel.setLayout(new FlowLayout()); panel.add(createSimpleTextButton("Unselect All", new AbstractAction() { /** UUID */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { for (EndPoint each : connectionFilter.getConnectionEndPoints()) { connectionFilter.setFilter(each, true); } } })); DropDownButton resetDropDownButton = createSimpleDropDownButton("Reset", null); panel.add(resetDropDownButton); JPopupMenu menu = new JPopupMenu(); menu.add(createMenuItem("Clear all recording", new AbstractAction() { /** UUID */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { messageBus.getPublisher(Topics.RESET) .propertyChange(new PropertyChangeEvent(RecordingControlPanel.this, "RESET", null, null)); connectionFilter.makeZeroCount(); } })); menu.add(createMenuItem("Clear all filters", new AbstractAction() { /** UUID */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { connectionFilter.reset(); } })); menu.add(createMenuItem("Clear connection count", new AbstractAction() { /** UUID */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { connectionFilter.makeZeroCount(); } })); menu.add(createMenuItem("Reset browser cache", new AbstractAction() { /** UUID */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { BrowserServices browserServices = BrowserServices.getInstance(); for (BrowserType type : BrowserFactoryEx.getSupportedBrowser()) { clearCacheIfSupported(browserServices, type); } } private void clearCacheIfSupported(BrowserServices browserServices, BrowserType type) { if (type.isSupported()) { try { browserServices.getCacheStorage(type).clearCache(); } catch (Exception e) { NoOp.noOp(); } } } })); menu.add(createMenuItem("Reset cookies", new AbstractAction() { /** UUID */ private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { BrowserServices browserServices = BrowserServices.getInstance(); for (BrowserType type : BrowserFactoryEx.getSupportedBrowser()) { clearCookieIfSupported(browserServices, type); } } private void clearCookieIfSupported(BrowserServices browserServices, BrowserType type) { if (type.isSupported()) { try { HttpCookieStorage cookieStorage = browserServices.getCookieStorage(type); List<HttpCookie> cookies = cookieStorage.getCookies(); cookieStorage.deleteCookie(cookies); } catch (Exception e) { NoOp.noOp(); } } } })); resetDropDownButton.setMenu(menu); return panel; }
From source file:net.yasion.common.core.bean.wrapper.impl.ExtendedBeanWrapperImpl.java
private Object convertIfNecessary(String propertyName, Object oldValue, Object newValue, Class<?> requiredType, TypeDescriptor td) throws TypeMismatchException { try {//www. ja v a 2 s . c o m return this.typeConverterDelegate.convertIfNecessary(propertyName, oldValue, newValue, requiredType, td); } catch (ConverterNotFoundException ex) { PropertyChangeEvent pce = new PropertyChangeEvent(this.rootObject, this.nestedPath + propertyName, oldValue, newValue); throw new ConversionNotSupportedException(pce, td.getType(), ex); } catch (ConversionException ex) { PropertyChangeEvent pce = new PropertyChangeEvent(this.rootObject, this.nestedPath + propertyName, oldValue, newValue); throw new TypeMismatchException(pce, requiredType, ex); } catch (IllegalStateException ex) { PropertyChangeEvent pce = new PropertyChangeEvent(this.rootObject, this.nestedPath + propertyName, oldValue, newValue); throw new ConversionNotSupportedException(pce, requiredType, ex); } catch (IllegalArgumentException ex) { PropertyChangeEvent pce = new PropertyChangeEvent(this.rootObject, this.nestedPath + propertyName, oldValue, newValue); throw new TypeMismatchException(pce, requiredType, ex); } }
From source file:de.schlichtherle.xml.GenericCertificate.java
/** * Setter for the bound property <tt>encoded</tt>. * * @param encoded The new encoded representation of the signed object * - may be <tt>null</tt>. * * @throws GenericCertificateIsLockedException If this certificate is * already locked by signing or verifying it before. * Note that this is actually a subclass of * {@link PropertyVetoException}. *//*from w w w. ja v a2 s . c o m*/ public synchronized void setEncoded(String encoded) throws GenericCertificateIsLockedException { // Check parameters. if (encoded == this.encoded) return; // Check lock status. final PropertyChangeEvent evt = new PropertyChangeEvent(this, "encoded", getEncoded(), encoded); // NOI18N if (isLocked()) throw new GenericCertificateIsLockedException(evt); //vetoableChangeSupport.fireVetoableChange(evt); // Incompatible to sign! this.encoded = encoded; firePropertyChange(evt); }
From source file:org.springframework.beans.AbstractNestablePropertyAccessor.java
private void processLocalProperty(PropertyTokenHolder tokens, PropertyValue pv) { PropertyHandler ph = getLocalPropertyHandler(tokens.actualName); if (ph == null || !ph.isWritable()) { if (pv.isOptional()) { if (logger.isDebugEnabled()) { logger.debug("Ignoring optional value for property '" + tokens.actualName + "' - property not found on bean class [" + getRootClass().getName() + "]"); }//from w w w .j a v a2s . co m return; } else { throw createNotWritablePropertyException(tokens.canonicalName); } } Object oldValue = null; try { Object originalValue = pv.getValue(); Object valueToApply = originalValue; if (!Boolean.FALSE.equals(pv.conversionNecessary)) { if (pv.isConverted()) { valueToApply = pv.getConvertedValue(); } else { if (isExtractOldValueForEditor() && ph.isReadable()) { try { oldValue = ph.getValue(); } catch (Exception ex) { if (ex instanceof PrivilegedActionException) { ex = ((PrivilegedActionException) ex).getException(); } if (logger.isDebugEnabled()) { logger.debug("Could not read previous value of property '" + this.nestedPath + tokens.canonicalName + "'", ex); } } } valueToApply = convertForProperty(tokens.canonicalName, oldValue, originalValue, ph.toTypeDescriptor()); } pv.getOriginalPropertyValue().conversionNecessary = (valueToApply != originalValue); } ph.setValue(valueToApply); } catch (TypeMismatchException ex) { throw ex; } catch (InvocationTargetException ex) { PropertyChangeEvent propertyChangeEvent = new PropertyChangeEvent(getRootInstance(), this.nestedPath + tokens.canonicalName, oldValue, pv.getValue()); if (ex.getTargetException() instanceof ClassCastException) { throw new TypeMismatchException(propertyChangeEvent, ph.getPropertyType(), ex.getTargetException()); } else { Throwable cause = ex.getTargetException(); if (cause instanceof UndeclaredThrowableException) { // May happen e.g. with Groovy-generated methods cause = cause.getCause(); } throw new MethodInvocationException(propertyChangeEvent, cause); } } catch (Exception ex) { PropertyChangeEvent pce = new PropertyChangeEvent(getRootInstance(), this.nestedPath + tokens.canonicalName, oldValue, pv.getValue()); throw new MethodInvocationException(pce, ex); } }
From source file:org.kuali.kfs.module.tem.document.TravelAuthorizationDocument.java
/** * This method adds a new travel expense line to the managed collection * * @param travel expense line/* ww w . ja v a2 s. c o m*/ */ public void addActualExpenseLine(ActualExpense line) { line.setDocumentLineNumber(getActualExpenses().size() + 1); final String sequenceName = line.getSequenceName(); final Long sequenceNumber = getSequenceAccessorService().getNextAvailableSequenceNumber(sequenceName, ActualExpense.class); line.setId(sequenceNumber); line.setDocumentNumber(this.documentNumber); notifyChangeListeners(new PropertyChangeEvent(this, TemPropertyConstants.ACTUAL_EXPENSES, null, line)); getActualExpenses().add(line); logErrors(); }
From source file:de.schlichtherle.xml.GenericCertificate.java
/** * Setter for the bound property <tt>signature</tt>. * * @param signature The signature encoded as a string * - may be <tt>null</tt>. * * @throws GenericCertificateIsLockedException If this certificate is * already locked by signing or verifying it before. * Note that this is actually a subclass of * {@link PropertyVetoException}. *//* www .ja v a2 s . c o m*/ public synchronized void setSignature(String signature) throws GenericCertificateIsLockedException { // Check parameters. if (signature == this.signature) return; // Check lock status. final PropertyChangeEvent evt = new PropertyChangeEvent(this, "signature", getSignature(), signature); // NOI18N if (isLocked()) throw new GenericCertificateIsLockedException(evt); //vetoableChangeSupport.fireVetoableChange(evt); // Incompatible to sign! this.signature = signature; firePropertyChange(evt); }
From source file:de.schlichtherle.xml.GenericCertificate.java
/** * Setter for the bound property <tt>signatureAlgorithm</tt>. * * @param signatureAlgorithm The string identifying the signature algorithm * - may be <tt>null</tt>. * * @throws GenericCertificateIsLockedException If this certificate is * already locked by signing or verifying it before. * Note that this is actually a subclass of * {@link PropertyVetoException}. *//* www.j av a 2 s. c om*/ public synchronized void setSignatureAlgorithm(String signatureAlgorithm) throws GenericCertificateIsLockedException { // Check parameters. if (signatureAlgorithm == this.signatureAlgorithm) return; // Check lock status. final PropertyChangeEvent evt = new PropertyChangeEvent(this, "signatureAlgorithm", getSignatureAlgorithm(), signatureAlgorithm); // NOI18N if (isLocked()) throw new GenericCertificateIsLockedException(evt); //vetoableChangeSupport.fireVetoableChange(evt); // Incompatible to sign! this.signatureAlgorithm = signatureAlgorithm; firePropertyChange(evt); }
From source file:de.schlichtherle.xml.GenericCertificate.java
/** * Setter for the bound property <tt>signatureEncoding</tt>. * * @param signatureEncoding The string identifying the signature encoding * - may be <tt>null</tt>. * * @throws GenericCertificateIsLockedException If this certificate is * already locked by signing or verifying it before. * Note that this is actually a subclass of * {@link PropertyVetoException}. * * @deprecated Currently ignored by {@link #verify}. * Only provided to cause {@link XMLEncoder} to encode this * property for upwards compatibility. *//*from w w w . ja v a 2 s .c o m*/ public synchronized void setSignatureEncoding(String signatureEncoding) throws GenericCertificateIsLockedException { // Check parameters. if (signatureEncoding == this.signatureEncoding) return; // Check lock status. final PropertyChangeEvent evt = new PropertyChangeEvent(this, "signatureEncoding", getSignatureEncoding(), signatureEncoding); // NOI18N if (isLocked()) throw new GenericCertificateIsLockedException(evt); //vetoableChangeSupport.fireVetoableChange(evt); // Incompatible to sign! this.signatureEncoding = signatureEncoding; firePropertyChange(evt); }
From source file:org.springframework.beans.AbstractNestablePropertyAccessor.java
@Nullable private Object convertIfNecessary(@Nullable String propertyName, @Nullable Object oldValue, @Nullable Object newValue, @Nullable Class<?> requiredType, @Nullable TypeDescriptor td) throws TypeMismatchException { Assert.state(this.typeConverterDelegate != null, "No TypeConverterDelegate"); try {//from w w w . j a va 2 s .co m return this.typeConverterDelegate.convertIfNecessary(propertyName, oldValue, newValue, requiredType, td); } catch (ConverterNotFoundException | IllegalStateException ex) { PropertyChangeEvent pce = new PropertyChangeEvent(getRootInstance(), this.nestedPath + propertyName, oldValue, newValue); throw new ConversionNotSupportedException(pce, requiredType, ex); } catch (ConversionException | IllegalArgumentException ex) { PropertyChangeEvent pce = new PropertyChangeEvent(getRootInstance(), this.nestedPath + propertyName, oldValue, newValue); throw new TypeMismatchException(pce, requiredType, ex); } }