コード例 #1
0
  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
コード例 #2
0
 /**
  * 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;
 }
コード例 #3
0
ファイル: AttributeObserver.java プロジェクト: brunodiniz/KSE
  @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();
    }
  }
コード例 #4
0
  protected void fireCollectionEvent() {

    final PropertyChangeListener[] listeners =
        listenerList.getListeners(PropertyChangeListener.class);

    for (PropertyChangeListener l : listeners) {
      l.propertyChange(null);
    }
  }
コード例 #5
0
 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));
     }
   }
 }
コード例 #6
0
ファイル: Directory.java プロジェクト: MalukuSeito/maptool
 protected void firePropertyChangeEvent(PropertyChangeEvent event) {
   // Me
   for (PropertyChangeListener listener : listenerList) {
     listener.propertyChange(event);
   }
   // Propagate up
   if (parent != null) {
     parent.firePropertyChangeEvent(event);
   }
 }
コード例 #7
0
ファイル: DynamicCustomizer.java プロジェクト: Rajmohan/acre
  /**
   * 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);
    }
  }
コード例 #8
0
ファイル: ProxyClient.java プロジェクト: summerpulse/openjdk7
    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);
      }
    }
コード例 #9
0
  /**
   * 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);
        }
      }
    }
  }
コード例 #10
0
  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);
  }
コード例 #11
0
ファイル: DataSetModelTest.java プロジェクト: drugis/mtc
 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);
 }
コード例 #12
0
 /*     */ 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;
   /*     */ }
コード例 #13
0
  /** 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);
    }
  }
コード例 #14
0
ファイル: KBase.java プロジェクト: ronggenliu/drools
 public void setAnnotations(List<String> annotations) {
   if (listener != null) {
     listener.propertyChange(
         new PropertyChangeEvent(this, "annotations", this.annotations, annotations));
   }
   this.annotations = annotations;
 }
コード例 #15
0
 public void propertyChange(String propertyName, Object oldValue, Object newValue) {
   if (listener != null) {
     if (oldValue != newValue) {
       listener.propertyChange(new PropertyChangeEvent(this, propertyName, oldValue, newValue));
     }
   }
 }
コード例 #16
0
 public void collectionChange(
     String propertyName, Object oldValue, Object newValue, int changeType) {
   if (listener != null) {
     listener.propertyChange(
         new CollectionChangeEvent(this, propertyName, oldValue, newValue, changeType));
   }
 }
コード例 #17
0
  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);
      }
    }
  }
コード例 #18
0
ファイル: KBase.java プロジェクト: ronggenliu/drools
 public void setEqualsBehavior(AssertBehaviorOption equalsBehaviour) {
   if (listener != null) {
     listener.propertyChange(
         new PropertyChangeEvent(this, "equalsBehavior", this.equalsBehavior, equalsBehavior));
   }
   this.equalsBehavior = equalsBehaviour;
 }
コード例 #19
0
ファイル: LogManager.java プロジェクト: pombredanne/Harpoon-1
  /**
   * 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);
  }
コード例 #20
0
ファイル: KBase.java プロジェクト: ronggenliu/drools
 public void setNamespace(String namespace) {
   if (listener != null) {
     listener.propertyChange(
         new PropertyChangeEvent(this, "namespace", this.namespace, namespace));
   }
   this.namespace = namespace;
 }
コード例 #21
0
 @Override
 public void propertyChange(PropertyChangeEvent evt) {
   String n = evt.getPropertyName();
   if (propertyName.equals(n)) {
     listener.propertyChange(evt);
   }
 }
コード例 #22
0
ファイル: KBase.java プロジェクト: ronggenliu/drools
 public void setEventProcessingMode(EventProcessingOption eventProcessingMode) {
   if (listener != null) {
     listener.propertyChange(
         new PropertyChangeEvent(
             this, "eventProcessingMode", this.eventProcessingMode, eventProcessingMode));
   }
   this.eventProcessingMode = eventProcessingMode;
 }
コード例 #23
0
 /**
  * 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));
     }
   }
 }
コード例 #24
0
ファイル: OrigamistToolBar.java プロジェクト: peci1/Origamist
  /**
   * 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;
  }
コード例 #25
0
ファイル: MainModelNode.java プロジェクト: pentaho/modeler
 @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;
 }
コード例 #26
0
ファイル: KBase.java プロジェクト: ronggenliu/drools
 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;
 }
コード例 #27
0
ファイル: Person.java プロジェクト: pmneo/eclipselink.runtime
 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));
   }
 }
コード例 #28
0
ファイル: OrigamistToolBar.java プロジェクト: peci1/Origamist
 /**
  * @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()));
 }
コード例 #29
0
  /**
   * @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";
            }
          });
    }
  }
コード例 #30
0
ファイル: SSBuilder.java プロジェクト: waqas64/debrief
  /** 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));
  }