Java Code Examples for java.beans.PropertyChangeListener

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project addis, under directory /application/src/main/java/org/drugis/addis/presentation/wizard/.

Source file: NetworkMetaAnalysisWizardPM.java

  18 
vote

private ObservableList<Study> createStudiesIndicationOutcome(){
  final FilteredObservableList<Study> studies=new FilteredObservableList<Study>(d_domain.getStudies(),getIndicationOutcomeFilter());
  PropertyChangeListener listener=new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      studies.setFilter(getIndicationOutcomeFilter());
    }
  }
;
  d_indicationHolder.addPropertyChangeListener(listener);
  d_outcomeHolder.addPropertyChangeListener(listener);
  return studies;
}
 

Example 2

From project beanmill_1, under directory /src/main/java/com/traxel/lumbermill/event/.

Source file: TableControl.java

  18 
vote

/** 
 * DOCUMENT ME!
 * @param property  DOCUMENT ME!
 * @param oldValue  DOCUMENT ME!
 * @param newValue  DOCUMENT ME!
 */
private void firePropertyChange(final String property,final Object oldValue,final Object newValue){
synchronized (LISTENERS) {
    final Iterator it;
    PropertyChangeListener listener;
    final PropertyChangeEvent event;
    event=new PropertyChangeEvent(this,property,oldValue,newValue);
    it=LISTENERS.iterator();
    while (it.hasNext()) {
      listener=(PropertyChangeListener)it.next();
      listener.propertyChange(event);
    }
  }
}
 

Example 3

From project c3p0, under directory /src/java/com/mchange/v2/c3p0/.

Source file: DriverManagerDataSource.java

  18 
vote

private void setUpPropertyListeners(){
  PropertyChangeListener driverClassListener=new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      if ("driverClass".equals(evt.getPropertyName()))       setDriverClassLoaded(false);
    }
  }
;
  this.addPropertyChangeListener(driverClassListener);
}
 

Example 4

From project drugis-common, under directory /common-gui/src/test/java/org/drugis/common/gui/task/.

Source file: TaskProgressModelTest.java

  18 
vote

@Test public void testDeterminate(){
  final MockTask task=new MockTask();
  final TextProgressModel model=new TaskProgressModel(task);
  task.start();
  PropertyChangeListener mock=JUnitUtil.mockListener(model,TextProgressModel.PROPERTY_DETERMINATE,false,true);
  model.addPropertyChangeListener(mock);
  task.progress(0,1000);
  verify(mock);
}
 

Example 5

From project echo3extras, under directory /src/server-java/app/nextapp/echo/extras/app/tree/.

Source file: DefaultTreeSelectionModel.java

  18 
vote

protected void firePropertyChange(String propertyName,int oldValue,int newValue){
  EventListener[] listeners=listenerList.getListeners(PropertyChangeListener.class);
  if (listeners.length == 0) {
    return;
  }
  PropertyChangeEvent evt=new PropertyChangeEvent(this,propertyName,new Integer(oldValue),new Integer(newValue));
  for (int i=0; i < listeners.length; i++) {
    PropertyChangeListener l=(PropertyChangeListener)listeners[i];
    l.propertyChange(evt);
  }
}
 

Example 6

From project etherpad, under directory /infrastructure/rhino1_7R1/src/org/mozilla/javascript/.

Source file: Context.java

  18 
vote

private void firePropertyChangeImpl(Object listeners,String property,Object oldValue,Object newValue){
  for (int i=0; ; ++i) {
    Object l=Kit.getListener(listeners,i);
    if (l == null)     break;
    if (l instanceof PropertyChangeListener) {
      PropertyChangeListener pcl=(PropertyChangeListener)l;
      pcl.propertyChange(new PropertyChangeEvent(this,property,oldValue,newValue));
    }
  }
}
 

Example 7

From project freemind, under directory /freemind/freemind/common/.

Source file: PropertyBean.java

  18 
vote

protected void firePropertyChangeEvent(){
  PropertyChangeEvent evt=new PropertyChangeEvent(this,getLabel(),null,getValue());
  for (Iterator i=mPropertyChangeListeners.iterator(); i.hasNext(); ) {
    PropertyChangeListener listener=(PropertyChangeListener)i.next();
    listener.propertyChange(evt);
  }
}
 

Example 8

From project asterisk-java, under directory /src/test/java/org/asteriskjava/live/internal/.

Source file: AsteriskChannelImplTest.java

  17 
vote

@Test public void testStateChange(){
  channel.addPropertyChangeListener(new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      assertEquals("wrong propertyName","state",evt.getPropertyName());
      assertEquals("wrong oldValue",ChannelState.DOWN,evt.getOldValue());
      assertEquals("wrong newValue",ChannelState.DIALING,evt.getNewValue());
      assertEquals("wrong source",channel,evt.getSource());
      numberOfChanges++;
    }
  }
);
  channel.stateChanged(DateUtil.getDate(),ChannelState.DIALING);
  assertEquals("wrong number of propagated changes",1,numberOfChanges);
}
 

Example 9

From project autopsy, under directory /Core/src/org/sleuthkit/autopsy/filesearch/.

Source file: FileSearchAction.java

  17 
vote

FileSearchAction(){
  super();
  setEnabled(false);
  Case.addPropertyChangeListener(new PropertyChangeListener(){
    @Override public void propertyChange(    PropertyChangeEvent evt){
      if (evt.getPropertyName().equals(Case.CASE_CURRENT_CASE)) {
        setEnabled(evt.getNewValue() != null);
      }
    }
  }
);
}
 

Example 10

From project beam-meris-icol, under directory /src/main/java/org/esa/beam/meris/icol/ui/.

Source file: IcolForm.java

  17 
vote

IcolForm(AppContext appContext,IcolModel icolModel,TargetProductSelector targetProductSelector){
  this.appContext=appContext;
  bc=new BindingContext(icolModel.getPropertyContainer());
  this.targetProductSelector=targetProductSelector;
  sourceProductSelector=new SourceProductSelector(appContext,"Input-Product (MERIS L1b, Landsat5 TM or Landsat7 ETM+):");
  cloudProductSelector=new SourceProductSelector(appContext,"Cloud-Product:");
  initComponents();
  JComboBox sourceComboBox=sourceProductSelector.getProductNameComboBox();
  final PropertyContainer valueContainer=targetProductSelector.getModel().getValueContainer();
  sourceComboBox.addActionListener(new ActionListener(){
    @Override public void actionPerformed(    ActionEvent e){
      updateProductTypeSettings();
      if (isEnvisatSourceProduct(IcolForm.this.sourceProductSelector.getSelectedProduct()) && radianceProductTypeButton.isSelected()) {
        valueContainer.setValue("formatName",EnvisatConstants.ENVISAT_FORMAT_NAME);
      }
    }
  }
);
  PropertyChangeListener formatNameChangeListener=new PropertyChangeListener(){
    @Override public void propertyChange(    PropertyChangeEvent evt){
      updateProductFormatChange();
    }
  }
;
  valueContainer.addPropertyChangeListener("formatName",formatNameChangeListener);
  icolContainer=icolModel.getPropertyContainer();
  bindComponents();
  updateUIStates();
}
 

Example 11

From project bndtools, under directory /bndtools.core/src/bndtools/editor/workspace/.

Source file: PluginSelectionWizard.java

  17 
vote

public PluginSelectionWizard(){
  addPage(classPage);
  addPage(propertiesPage);
  classPage.addPropertyChangeListener("selectedElement",new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      propertiesPage.setConfigElement((IConfigurationElement)evt.getNewValue());
    }
  }
);
}
 

Example 12

From project codjo-broadcast, under directory /codjo-broadcast-gui/src/test/java/net/codjo/broadcast/gui/wizard/.

Source file: BroadcastSelectionStepTest.java

  17 
vote

public void test_event() throws Exception {
  BroadcastSelectionStep step=new BroadcastSelectionStep(guiContext,new DefaultBroadcastSelector(madServerFixture.getOperations(),"selectAllBroadcastFiles"));
  Panel panel=new Panel(step);
  mockStart(step);
  ComboBox typeCombo=panel.getComboBox();
  step.addPropertyChangeListener(Step.FULFILLED_PROPERTY,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      log.call("propertyChange",evt.getNewValue());
    }
  }
);
  typeCombo.select("import1");
  log.assertContent("propertyChange(true)");
}
 

Example 13

From project codjo-imports, under directory /codjo-imports-gui/src/test/java/net/codjo/imports/gui/wizard/.

Source file: ImportSelectionStepTest.java

  17 
vote

public void test_event() throws Exception {
  mockStart(step);
  ComboBox typeCombo=panel.getComboBox();
  step.addPropertyChangeListener(Step.FULFILLED_PROPERTY,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      log.call("propertyChange",evt.getNewValue());
    }
  }
);
  typeCombo.select("to_import_1");
  File expectedPath=createFile("to_import.txt");
  selectFile(expectedPath);
  log.assertContent("propertyChange(true)");
}
 

Example 14

From project data-access, under directory /src/org/pentaho/platform/dataaccess/datasource/wizard/models/.

Source file: ModelInfo.java

  17 
vote

public ModelInfo(){
  columnCollection.addPropertyChangeListener("selectedCount",new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      validate();
    }
  }
);
}
 

Example 15

From project dawn-third, under directory /org.dawb.org.csstudio.swt.xygraph/src/org/csstudio/swt/xygraph/figures/.

Source file: Legend.java

  17 
vote

public Legend(XYGraph xyGraph){
  xyGraph.getPlotArea().addPropertyChangeListener(PlotArea.BACKGROUND_COLOR,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      setBackgroundColor((Color)evt.getNewValue());
    }
  }
);
  setBackgroundColor(xyGraph.getPlotArea().getBackgroundColor());
  setForegroundColor(BLACK_COLOR);
  setOpaque(false);
  setOutline(true);
}
 

Example 16

From project e4-rendering, under directory /com.toedter.e4.ui.workbench.renderers.swing/src/com/toedter/e4/ui/workbench/renderers/swing/.

Source file: SashRenderer.java

  17 
vote

@Override public void hookControllerLogic(MUIElement element){
  if (element instanceof MPartSashContainer) {
    final MPartSashContainer partSashContainer=(MPartSashContainer)element;
    final JSplitPane splitPane=(JSplitPane)partSashContainer.getWidget();
    splitPane.addPropertyChangeListener(JSplitPane.DIVIDER_LOCATION_PROPERTY,new PropertyChangeListener(){
      @Override public void propertyChange(      PropertyChangeEvent event){
        if (splitPane.getLeftComponent() != null && splitPane.getRightComponent() != null) {
          partSashContainer.setContainerData(((Integer)event.getNewValue()).toString());
        }
      }
    }
);
  }
}
 

Example 17

From project ANNIS, under directory /annis-kickstarter/src/main/java/de/hu_berlin/german/korpling/annis/kickstarter/.

Source file: MainFrame.java

  16 
vote

/** 
 * Creates new form MainFrame
 */
public MainFrame(){
  Integer[] sizes=new Integer[]{192,128,64,48,32,16,14};
  List<Image> allImages=new LinkedList<Image>();
  for (  int s : sizes) {
    try {
      BufferedImage imgIcon=ImageIO.read(MainFrame.class.getResource("logo/annis_" + s + ".png"));
      allImages.add(imgIcon);
    }
 catch (    IOException ex) {
      log.error(null,ex);
    }
  }
  this.setIconImages(allImages);
  System.setProperty("annis.home",".");
  this.corpusAdministration=(CorpusAdministration)AnnisBaseRunner.getBean("corpusAdministration",true,"file:" + Utils.getAnnisFile("conf/spring/Admin.xml").getAbsolutePath());
  try {
    UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  }
 catch (  Exception ex) {
    log.error(null,ex);
  }
  initComponents();
  serviceWorker=new MainFrameWorker();
  serviceWorker.addPropertyChangeListener(new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      if (serviceWorker.getProgress() == 1) {
        pbStart.setIndeterminate(true);
        lblStatusService.setText("<html>Starting ANNIS...</html>");
        lblStatusService.setIcon(new javax.swing.ImageIcon(getClass().getResource("/de/hu_berlin/german/korpling/annis/kickstarter/crystal_icons/quick_restart.png")));
      }
    }
  }
);
  if (isInitialized()) {
    btImport.setEnabled(true);
    btList.setEnabled(true);
    serviceWorker.execute();
  }
}
 

Example 18

From project codjo-segmentation, under directory /codjo-segmentation-gui/src/main/java/net/codjo/segmentation/gui/importParam/.

Source file: ImportParametersGui.java

  16 
vote

private void initListeners(){
  importFileName.addPropertyChangeListener("fileName",new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      importButton.setEnabled(!("".equals(evt.getNewValue())));
    }
  }
);
  cancelButton.addActionListener(new ActionListener(){
    public void actionPerformed(    ActionEvent event){
      dispose();
    }
  }
);
  classificationRadio.addActionListener(new TableListenerEvent("axeImportAnomaly",axeImportAnomaly));
  sleeveRadio.addActionListener(new TableListenerEvent("sleeveImportAnomaly",sleeveImportAnomaly));
  ClearLogButtonUpdater actionUpdater=new ClearLogButtonUpdater();
  axeImportAnomaly.getDataSource().addPropertyChangeListener(actionUpdater);
  sleeveImportAnomaly.getDataSource().addPropertyChangeListener(actionUpdater);
}
 

Example 19

From project droidex_1, under directory /src/com/commonsware/droidex/.

Source file: DroidEx.java

  16 
vote

private void initDeviceScreenView(){
  IImageProvider imageProvider=new DeviceScreenImageProvider(device);
  imageProvider.addImageFilter(new ScaleImageFilter(settings));
  imageProvider.addImageFilter(new RotateImageFilter(settings));
  imageProvider.addImageFilter(new RecordImageFilter(settings));
  deviceScreenView=new DeviceScreenView(imageProvider);
  deviceScreenView.setFrameRate(options.frameRate);
  deviceScreenView.play();
  settings.addPropertyChangeListener(new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent event){
      deviceScreenView.repaint();
    }
  }
);
}
 

Example 20

From project echo3, under directory /src/server-java/app/nextapp/echo/app/.

Source file: Table.java

  16 
vote

/** 
 * Creates a <code>Table</code> with the supplied  <code>TableModel</code> and the specified <code>TableColumnModel</code>.
 * @param model the initial model
 * @param columnModel the initial column model
 */
public Table(TableModel model,TableColumnModel columnModel){
  super();
  if (columnModel == null) {
    setColumnModel(new DefaultTableColumnModel());
    setAutoCreateColumnsFromModel(true);
  }
 else {
    setColumnModel(columnModel);
  }
  setSelectionModel(new DefaultListSelectionModel());
  setModel(model);
  addPropertyChangeListener(CHILD_VISIBLE_CHANGED_PROPERTY,new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent e){
      invalidate();
    }
  }
);
}
 

Example 21

From project Eclipse, under directory /com.mobilesorcery.sdk.ui/src/com/mobilesorcery/sdk/ui/.

Source file: MosyncUIPlugin.java

  16 
vote

public void registerGlobalProjectListener(){
  globalListener=new PropertyChangeListener(){
    @Override public void propertyChange(    PropertyChangeEvent event){
      Object source=event.getSource();
      if (MoSyncProject.BUILD_CONFIGURATION_CHANGED.equals(event.getPropertyName()) || MoSyncProject.BUILD_CONFIGURATION_SUPPORT_CHANGED.equals(event.getPropertyName()) || MoSyncProject.EXCLUDE_FILTER_KEY.equals(NameSpacePropertyOwner.getKey(event.getPropertyName()))) {
        try {
          final ExcludedResourceDecorator dec=(ExcludedResourceDecorator)PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(ExcludedResourceDecorator.ID);
          if (dec != null) {
            IWorkbenchWindow ww=PlatformUI.getWorkbench().getActiveWorkbenchWindow();
            if (ww != null) {
              Shell shell=ww.getShell();
              if (shell != null) {
                shell.getDisplay().asyncExec(new Runnable(){
                  @Override public void run(){
                    dec.updateDecorations();
                  }
                }
);
              }
            }
          }
        }
 catch (        Exception e) {
          CoreMoSyncPlugin.getDefault().log(e);
        }
      }
    }
  }
;
  MoSyncProject.addGlobalPropertyChangeListener(globalListener);
}
 

Example 22

From project en4j, under directory /NBPlatformApp/Synchronization/src/main/java/com/rubenlaguna/en4j/sync/.

Source file: SyncToolbarJPanel.java

  16 
vote

/** 
 * Creates new form SyncToolbarJPanel 
 */
public SyncToolbarJPanel(){
  initComponents();
  addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      new SyncAction().actionPerformed(new ActionEvent(this,ActionEvent.ACTION_PERFORMED,"SYNC"));
    }
  }
);
  sservice=getSyncService();
  sservice.addPropertyChangeListener(new PropertyChangeListener(){
    public void propertyChange(    PropertyChangeEvent evt){
      if (evt.getPropertyName().equals(SynchronizationServiceImpl.PROP_SYNCFAILED)) {
        if (evt.getNewValue().equals(Boolean.TRUE)) {
          rotatingLogo1.setFailed(true);
        }
 else {
          rotatingLogo1.setFailed(false);
        }
      }
    }
  }
);
}
 

Example 23

From project FML, under directory /common/cpw/mods/fml/relauncher/.

Source file: Downloader.java

  16 
vote

public JDialog makeDialog(){
  setMessageType(JOptionPane.INFORMATION_MESSAGE);
  setMessage(makeProgressPanel());
  setOptions(new Object[]{"Stop"});
  addPropertyChangeListener(new PropertyChangeListener(){
    @Override public void propertyChange(    PropertyChangeEvent evt){
      if (evt.getSource() == Downloader.this && evt.getPropertyName() == VALUE_PROPERTY) {
        requestClose("This will stop minecraft from launching\nAre you sure you want to do this?");
      }
    }
  }
);
  container=new JDialog(null,"Hello",ModalityType.MODELESS);
  container.setResizable(false);
  container.setLocationRelativeTo(null);
  container.add(this);
  this.updateUI();
  container.pack();
  container.setMinimumSize(container.getPreferredSize());
  container.setVisible(true);
  container.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
  container.addWindowListener(new WindowAdapter(){
    @Override public void windowClosing(    WindowEvent e){
      requestClose("Closing this window will stop minecraft from launching\nAre you sure you wish to do this?");
    }
  }
);
  return container;
}
 

Example 24

From project big-data-plugin, under directory /test-src/org/pentaho/di/job/entries/sqoop/.

Source file: PropertyFiringObjectTests.java

  15 
vote

/** 
 * Test that all private fields of the provided object have getter and setter methods, and they work as they should: the getter returns the value and the setter generates a  {@link PropertyChangeEvent} for that property.
 * @param o Object to test
 * @throws Exception if anything goes wrong
 */
private void testPropertyFiringForAllPrivateFieldsOf(XulEventSource o) throws Exception {
  final Method ADD_PROPERTY_CHANGE_LISTENER=o.getClass().getMethod("addPropertyChangeListener",PropertyChangeListener.class);
  final Method REMOVE_PROPERTY_CHANGE_LISTENER=o.getClass().getMethod("removePropertyChangeListener",PropertyChangeListener.class);
  PersistentPropertyChangeListener l=new PersistentPropertyChangeListener();
  ADD_PROPERTY_CHANGE_LISTENER.invoke(o,l);
  try {
    testPropertyFiringForAllPrivateFieldsOf(o,o.getClass(),l);
  }
  finally {
    REMOVE_PROPERTY_CHANGE_LISTENER.invoke(o,l);
  }
}
 

Example 25

From project ceres, under directory /ceres-binding/src/main/java/com/bc/ceres/binding/.

Source file: Property.java

  15 
vote

public void addPropertyChangeListener(PropertyChangeListener l){
  if (container == null) {
    throw new IllegalStateException("container == null");
  }
  container.getPropertyChangeSupport().addPropertyChangeListener(descriptor.getName(),l);
}
 

Example 26

From project dawn-isenciaui, under directory /com.teaminabox.eclipse.wiki/src/com/teaminabox/eclipse/wiki/properties/.

Source file: ProjectProperties.java

  15 
vote

public void removeListeners(){
  PropertyChangeListener[] propertyChangeListeners=listeners.getPropertyChangeListeners();
  for (  PropertyChangeListener propertyChangeListener : propertyChangeListeners) {
    listeners.removePropertyChangeListener(propertyChangeListener);
  }
}
 

Example 27

From project droolsjbpm-tools, under directory /drools-eclipse/org.drools.eclipse/src/main/java/org/drools/eclipse/editors/rete/model/.

Source file: ModelElement.java

  15 
vote

/** 
 * Attach a non-null PropertyChangeListener to this object.
 * @param l a non-null PropertyChangeListener instance
 * @throws IllegalArgumentException if the parameter is null
 */
public synchronized void addPropertyChangeListener(PropertyChangeListener l){
  if (l == null) {
    throw new IllegalArgumentException();
  }
  pcsDelegate.addPropertyChangeListener(l);
}
 

Example 28

From project echo2, under directory /src/app/java/nextapp/echo2/app/.

Source file: Component.java

  15 
vote

/** 
 * Adds a property change listener to this <code>Component</code>.
 * @param l the listener to add
 */
public void addPropertyChangeListener(PropertyChangeListener l){
  if (propertyChangeSupport == null) {
    propertyChangeSupport=new PropertyChangeSupport(this);
  }
  propertyChangeSupport.addPropertyChangeListener(l);
}
 

Example 29

From project eclipse-integration-commons, under directory /org.springsource.ide.eclipse.commons.content.core/src/org/springsource/ide/eclipse/commons/content/core/.

Source file: ContentManager.java

  15 
vote

public ContentManager(){
  itemById=new HashMap<String,ContentItem>();
  itemsByKind=new HashMap<String,Set<ContentItem>>();
  listeners=new CopyOnWriteArrayList<PropertyChangeListener>();
  isDirty=true;
}
 

Example 30

From project enclojure, under directory /netbeans/plugins/org-enclojure-plugin/src/main/java/org/enclojure/ide/nb/editor/.

Source file: ClojureMimeTypeDataObject.java

  15 
vote

public ClojureMimeTypeDataObject(FileObject pf,MultiFileLoader loader) throws DataObjectExistsException, IOException {
  super(pf,loader);
  LOG.log(Level.FINEST,"ctr()");
  CookieSet cookies=getCookieSet();
  ed=DataEditorSupport.create(this,getPrimaryEntry(),cookies);
  cookies.add((Node.Cookie)ed);
  try {
    this.addPropertyChangeListener((PropertyChangeListener)getNewPropertyListenerFn.invoke(this));
  }
 catch (  Throwable ex) {
    Exceptions.printStackTrace(ex);
  }
}
 

Example 31

From project extension_libero_manufacturing, under directory /extension/eevolution/libero/src/main/java/org/eevolution/form/action/.

Source file: PopupAction.java

  15 
vote

public void addPropertyChangeListener(PropertyChangeListener listener){
  if (propertyChange == null) {
    propertyChange=new PropertyChangeSupport(this);
  }
  propertyChange.addPropertyChangeListener(listener);
}