private void okButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_okButtonActionPerformed // Validation boolean ok = true; String name = nameTextField.getText(); if (name == null || name.trim().length() == 0) { JOptionPane.showMessageDialog(this, "Name is required", "Error", JOptionPane.ERROR_MESSAGE); ok = false; } if (commandComboBox.isVisible()) { String command = (String) commandComboBox.getSelectedItem(); if (command == null || command.trim().length() == 0) { JOptionPane.showMessageDialog( this, "Command is required", "Error", JOptionPane.ERROR_MESSAGE); ok = false; } } if (ok) { this.setVisible(false); AbstractMenuItemType newValue = getValue(); PropertyChangeEvent event = new PropertyChangeEvent(this, "value", oldValue, newValue); for (PropertyChangeListener listener : getPropertyChangeListeners()) { listener.propertyChange(event); } } } // GEN-LAST:event_okButtonActionPerformed
/** * Check whether property change listener exists * * @param listener property change listener * @return boolean true if exists */ public boolean hasPropertyChangeListener(PropertyChangeListener listener) { for (PropertyChangeListener propertyChangeListener : supporter.getPropertyChangeListeners()) { if (propertyChangeListener.equals(listener)) { return true; } } return false; }
@Override public void referenceModified(RefObject target, PropertyChangeEvent evt) { if (((RefObject) evt.getNewValue()).refMetaObject().refGetValue("name").equals("Model")) return; if (!(makeKuaba(evt.getPropertyName()))) return; RefObject source = (RefObject) evt.getSource(); if (!KuabaSubsystem.facade.existsDomainIdea(target)) { PropertyChangeEvent nameEvt = new PropertyChangeEvent(target, "name", "", target.refGetValue("name")); PropertyChangeListener listener = KuabaSubsystem.eventPump.getObserver(target); if (listener == null) { listener = this.createListener(target); if (listener == null) return; KuabaSubsystem.eventPump.addModelElementObserver(listener, target); } listener.propertyChange(nameEvt); Reference ref = MofHelper.getReference(evt.getPropertyName(), (MofClass) source.refMetaObject()); if (!(ref == null)) { String otherSide = MofHelper.getExposedEndName(ref); try { PropertyChangeEvent referenceEvt = new PropertyChangeEvent(target, otherSide, null, target.refGetValue(otherSide)); listener.propertyChange(referenceEvt); } catch (Exception e) { // TODO: handle exception } } } // para evitar a criação do feature if (evt.getPropertyName().equals("feature")) return; // aqui que cria as outras questões do tipo participant e owner Decision d = KuabaSubsystem.facade.referenceChanged( (RefObject) evt.getSource(), target, evt.getPropertyName()); Idea sourceDomainIdea = KuabaHelper.getDomainIdea( modelRepository(), KuabaSubsystem.resolver.resolveXmiId((RefObject) evt.getSource()), this.getNamePropertyValue((RefObject) evt.getSource())); Idea sourceDesignIdea = KuabaHelper.getAcceptedDesignIdea( sourceDomainIdea, (String) ((RefObject) evt.getSource()).refMetaObject().refGetValue("name")); askReferenceChangeArguments( d.getConcludes(), (Question) KuabaHelper.getReasoningElementInTree(sourceDesignIdea, evt.getPropertyName() + "?"), evt); // tirando as ideias de dominio extras if (sourceDesignIdea.getHasText().equals("AssociationEnd")) { sourceDomainIdea.listSuggests().next().remove(); sourceDomainIdea.remove(); } }
protected void fireCollectionEvent() { final PropertyChangeListener[] listeners = listenerList.getListeners(PropertyChangeListener.class); for (PropertyChangeListener l : listeners) { l.propertyChange(null); } }
protected void notifyListeners(String property, String before, String after) { synchronized (listeners) { for (Iterator<PropertyChangeListener> it = listeners.iterator(); it.hasNext(); ) { PropertyChangeListener propertyChangeListener = it.next(); propertyChangeListener.propertyChange( new PropertyChangeEvent(this, property, before, after)); } } }
protected void firePropertyChangeEvent(PropertyChangeEvent event) { // Me for (PropertyChangeListener listener : listenerList) { listener.propertyChange(event); } // Propagate up if (parent != null) { parent.firePropertyChangeEvent(event); } }
/** * Fire a property change event to each listener. * * @param bean Bean being edited. * @param propName Name of the property. * @param oldValue Old value. * @param newValue New value. */ protected void firePropertyChange( Object bean, String propName, Object oldValue, Object newValue) { PropertyChangeEvent e = new PropertyChangeEvent(bean, propName, oldValue, newValue); Iterator it = _changeListeners.iterator(); while (it.hasNext()) { PropertyChangeListener l = (PropertyChangeListener) it.next(); l.propertyChange(e); } }
public void propertyChange(PropertyChangeEvent pce) { PropertyChangeListener pcl = get(); if (pcl == null) { // The referent listener was GC'ed, we're no longer // interested in PropertyChanges, remove the listener. dispose(); } else { pcl.propertyChange(pce); } }
/** * Fires off a list of property change events to any interested listeners. * * @param changes The list of property changes to fire off. */ private void notifyChanges(Iterable<PropertyChangeEvent> changes) { List<PropertyChangeListener> activeListeners = listeners.getActiveListeners(); if (activeListeners != null) { for (PropertyChangeListener listener : activeListeners) { for (PropertyChangeEvent event : changes) { listener.propertyChange(event); } } } }
public void testNotifyListeners() throws Exception { PropertyChangeListener listener = EasyMock.createMock(PropertyChangeListener.class); listener.propertyChange(EasyMock.isA(PropertyChangeEvent.class)); EasyMock.replay(listener); BarsDataSeriesFunction function = new BarsDataSeriesFunction(); function.addPropertyChangeListener(BarsDataSeriesFunction.PROP_BARS, listener); Bar bar = new Bar(new Date(), TimeSpan.days(1), 10.0, 11.0, 9.0, 10.0, 1000L); function.append(bar); EasyMock.verify(listener); }
private static void assertRevisions( final DataSetModel model, long r0, long r1, Runnable runnable) { PropertyChangeListener listener = EasyMock.createStrictMock(PropertyChangeListener.class); for (long r = r0; r < r1; ++r) { listener.propertyChange( JUnitUtil.eqPropertyChangeEvent( new PropertyChangeEvent(model, DataSetModel.PROPERTY_REVISION, r, r + 1))); } EasyMock.replay(listener); model.addPropertyChangeListener(listener); runnable.run(); EasyMock.verify(listener); model.removePropertyChangeListener(listener); }
/* */ public Object put(Object paramObject1, Object paramObject2) /* */ { /* 72 */ Object localObject = this.theMap.put(paramObject1, paramObject2); /* */ PropertyChangeEvent localPropertyChangeEvent; /* 73 */ if ((paramObject2 != localObject) && (!this.listenerList.isEmpty())) /* */ { /* 75 */ localPropertyChangeEvent = new PropertyChangeEvent(this, (String) paramObject1, localObject, paramObject2); /* */ /* 78 */ for (PropertyChangeListener localPropertyChangeListener : this.listenerList) { /* 79 */ localPropertyChangeListener.propertyChange(localPropertyChangeEvent); /* */ } /* */ } /* 82 */ return localObject; /* */ }
/** Report that we have been modified to any interested listeners. */ public void firePropertyChange() { Vector<PropertyChangeListener> targets; synchronized (this) { if (listeners == null) { return; } targets = new Vector<PropertyChangeListener>(listeners); } // Tell our listeners that "everything" has changed. PropertyChangeEvent evt = new PropertyChangeEvent(this.editor, "value", null, null); for (PropertyChangeListener l : targets) { l.propertyChange(evt); } }
public void setAnnotations(List<String> annotations) { if (listener != null) { listener.propertyChange( new PropertyChangeEvent(this, "annotations", this.annotations, annotations)); } this.annotations = annotations; }
public void propertyChange(String propertyName, Object oldValue, Object newValue) { if (listener != null) { if (oldValue != newValue) { listener.propertyChange(new PropertyChangeEvent(this, propertyName, oldValue, newValue)); } } }
public void collectionChange( String propertyName, Object oldValue, Object newValue, int changeType) { if (listener != null) { listener.propertyChange( new CollectionChangeEvent(this, propertyName, oldValue, newValue, changeType)); } }
private void firePropertyChanged(String name, String oldValue, String newValue) { List listeners = (List) this.changeListeners.get(name); if (listeners == null || listeners.size() == 0) return; // Making a shallow copy of the list prevents a // ConcurrentModificationException List l2 = new ArrayList(listeners); PropertyChangeEvent evt = new PropertyChangeEvent(this, name, oldValue, newValue); for (int i = 0; i < l2.size(); i++) { PropertyChangeListener l = (PropertyChangeListener) l2.get(i); if (l != null) { l.propertyChange(evt); } } }
public void setEqualsBehavior(AssertBehaviorOption equalsBehaviour) { if (listener != null) { listener.propertyChange( new PropertyChangeEvent(this, "equalsBehavior", this.equalsBehavior, equalsBehavior)); } this.equalsBehavior = equalsBehaviour; }
/** * Registers a listener which will be notified when the * logging properties are re-read. */ public synchronized void addPropertyChangeListener(PropertyChangeListener listener) { /* do not register null. */ listener.getClass(); pcs.addPropertyChangeListener(listener); }
public void setNamespace(String namespace) { if (listener != null) { listener.propertyChange( new PropertyChangeEvent(this, "namespace", this.namespace, namespace)); } this.namespace = namespace; }
@Override public void propertyChange(PropertyChangeEvent evt) { String n = evt.getPropertyName(); if (propertyName.equals(n)) { listener.propertyChange(evt); } }
public void setEventProcessingMode(EventProcessingOption eventProcessingMode) { if (listener != null) { listener.propertyChange( new PropertyChangeEvent( this, "eventProcessingMode", this.eventProcessingMode, eventProcessingMode)); } this.eventProcessingMode = eventProcessingMode; }
/** * Set the value of the appropriate attribute of target to attributeValue. In this case, place the * value inside the target's ValueHolder. if trackChanges is true, set the value in the object as * if the user was setting it. Allow change tracking to pick up the change. */ @Override public void setRealAttributeValueInObject( Object target, Object attributeValue, boolean trackChanges) { Object oldValue = null; if (trackChanges && (target instanceof ChangeTracker)) { oldValue = getRealAttributeValueFromObject(target, mapping.getAttributeValueFromObject(target)); } setRealAttributeValueInObject(target, attributeValue); if (trackChanges && (target instanceof ChangeTracker)) { PropertyChangeListener listener = ((ChangeTracker) target)._persistence_getPropertyChangeListener(); if (listener != null && attributeValue != oldValue) { listener.propertyChange( new PropertyChangeEvent(target, mapping.getAttributeName(), oldValue, attributeValue)); } } }
/** * Create a horizontal "separator" that can have a title and can be used in a {@link JPopupMenu}. * * @param bundleName The resource bundle string used to get this separator's text. * @return A horizontal "separator" that can have a title and can be used in a {@link JPopupMenu}. */ public JTitledSeparator createToolbarDropdownSeparator(final String bundleName) { final JTitledSeparator separator = new JTitledSeparator(""); PropertyChangeListener listener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { try { separator.setTitle(messages.getString(bundleName)); } catch (MissingResourceException e) { separator.setTitle(""); } } }; listener.propertyChange(new PropertyChangeEvent(this, "messages", null, messages)); addPropertyChangeListener("messages", listener); return separator; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((dimensions == null) ? 0 : dimensions.hashCode()); result = prime * result + ((listener == null) ? 0 : listener.hashCode()); result = prime * result + ((measures == null) ? 0 : measures.hashCode()); result = prime * result + ((name == null) ? 0 : name.hashCode()); return result; }
public void setKSessions(Map<String, KSession> kSessions) { if (listener != null) { listener.propertyChange( new PropertyChangeEvent(this, "kSessions", this.kSessions, kSessions)); for (KSession ksession : kSessions.values()) { // make sure the listener is set for each ksession ksession.setListener(listener); } } this.kSessions = kSessions; }
public void collectionChange( String propertyName, Collection changedCollection, Object newObject, int changeType, boolean isChangeApplied) { if (listener != null) { listener.propertyChange( new CollectionChangeEvent( this, propertyName, changedCollection, newObject, changeType, isChangeApplied)); } }
/** * @param bundleName The name of the resource bundle this toolbar will fetch the localizations * from. */ public OrigamistToolBar(String bundleName) { super(); this.bundleName = bundleName; PropertyChangeListener l = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { ResourceBundle oldAppMessages = messages; messages = ResourceBundle.getBundle( OrigamistToolBar.this.bundleName, (Locale) evt.getNewValue()); if (oldAppMessages == null || !oldAppMessages.equals(messages)) firePropertyChange("messages", oldAppMessages, messages); } }; ServiceLocator.get(ConfigurationManager.class).get().addPropertyChangeListener("locale", l); l.propertyChange( new PropertyChangeEvent( this, "locale", null, ServiceLocator.get(ConfigurationManager.class).get().getLocale())); }
/** * @see ChangeSupport.Notifier#propertyChange(java.beans.PropertyChangeListener, * java.beans.PropertyChangeEvent) */ public void propertyChange( final PropertyChangeListener listener, final PropertyChangeEvent event) { if (EventQueue.isDispatchThread()) { listener.propertyChange(event); } else { this.invoke( new Runnable() { public void run() { listener.propertyChange(event); } public String toString() { return "propertyChange"; } }); } }
/** add a blue participant */ void addBlueFile(final String val) { // read in this participant try { final ParticipantType newPart = ASSET.Util.XML.ASSETReaderWriter.importParticipant(val, new java.io.FileInputStream(val)); if (newPart != null) { // update the time to match the scenario newPart.getStatus().setTime(_myScenario.getTime()); // and add to the scenario _myScenario.addBlueParticipant(0, newPart); } } catch (java.io.FileNotFoundException fe) { fe.printStackTrace(); } // inform the listener _listener.propertyChange(new PropertyChangeEvent(this, "blue", null, null)); }