List of usage examples for java.beans PropertyChangeEvent getOldValue
public Object getOldValue()
From source file:org.apache.catalina.core.NamingContextListener.java
/** * Process property change events. Currently, only listens to such events * on the <code>NamingResources</code> instance for the global naming * resources./*from w w w. ja va 2s .co m*/ * * @param event The property change event that has occurred */ public void propertyChange(PropertyChangeEvent event) { if (!initialized) return; Object source = event.getSource(); if (source == namingResources) { // Setting the context in read/write mode ContextAccessController.setWritable(getName(), container); processGlobalResourcesChange(event.getPropertyName(), event.getOldValue(), event.getNewValue()); // Setting the context in read only mode ContextAccessController.setReadOnly(getName()); } }
From source file:org.opencastproject.ingest.impl.IngestServiceImpl.java
private URI addContentToRepo(MediaPackage mp, String elementId, String filename, InputStream file) throws IOException { ProgressInputStream progressInputStream = new ProgressInputStream(file); progressInputStream.addPropertyChangeListener(new PropertyChangeListener() { @Override// w w w . j av a2s . com public void propertyChange(PropertyChangeEvent evt) { long totalNumBytesRead = (Long) evt.getNewValue(); long oldTotalNumBytesRead = (Long) evt.getOldValue(); ingestStatistics.add(totalNumBytesRead - oldTotalNumBytesRead); } }); return workingFileRepository.put(mp.getIdentifier().compact(), elementId, filename, progressInputStream); }
From source file:edu.ku.brc.specify.tasks.RecordSetTask.java
public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource() instanceof RolloverCommand) { RolloverCommand roc = (RolloverCommand) evt.getSource(); renameRecordSet(roc, (RecordSetIFace) roc.getData(), (String) evt.getOldValue(), (String) evt.getNewValue()); }/*from w ww .j a v a 2 s . c o m*/ }
From source file:uk.ac.lkl.cram.ui.chart.FeedbackChartMaker.java
/** * Create a dataset from the module//from w ww. j a v a 2 s. co m * @return a category dataset that is used to produce a bar chart */ @Override protected Dataset 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 feedbackListener = 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's tlaLineItems, as well as to each //tlaLineItem's activity //This means that whenever a tlaLineItem changes, or its activity changes, the listener is triggered //Causing the dataset to be repopulated for (TLALineItem lineItem : module.getTLALineItems()) { //LOGGER.info("adding listeners to : " + lineItem.getName()); lineItem.getActivity().addPropertyChangeListener(TLActivity.PROP_LEARNER_FEEDBACK, feedbackListener); lineItem.addPropertyChangeListener(feedbackListener); } //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 it and its activity //LOGGER.info("removing listeners from: " + lineItem.getName()); lineItem.getActivity().removePropertyChangeListener(TLActivity.PROP_LEARNER_FEEDBACK, feedbackListener); lineItem.removePropertyChangeListener(feedbackListener); } if (pce.getNewValue() != null) { //This has been added TLALineItem lineItem = (TLALineItem) pce.getNewValue(); //So add a listener to it and its activity //LOGGER.info("adding listeners to: " + lineItem); lineItem.getActivity().addPropertyChangeListener(TLActivity.PROP_LEARNER_FEEDBACK, feedbackListener); lineItem.addPropertyChangeListener(feedbackListener); } } //Assume the dataset is now out of date, so repopulate it populateDataset(categoryDataset, module); } }); return categoryDataset; }
From source file:uk.ac.lkl.cram.ui.chart.LearningTypeChartMaker.java
/** * Create a dataset from the module/*from w w w . j a v a2s . c om*/ * * @return a pie dataset that is used to produce a pie chart */ @Override protected Dataset createDataSet() { //Create the dataset to hold the data final DefaultPieDataset pieDataset = new DefaultPieDataset(); //Populate the dataset with the data populateDataset(pieDataset, module); //Create a listener, which repopulates the dataset when anything changes final PropertyChangeListener learningTypeListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { //LOGGER.info("property change: " + pce); populateDataset(pieDataset, module); } }; //Add the listener to each of the module's tlaLineItems, as well as to each //tlaLineItem's activity //This means that whenever a tlaLineItem changes, or its activity changes, the listener is triggered //Causing the dataset to be repopulated for (TLALineItem lineItem : module.getTLALineItems()) { //LOGGER.info("adding listeners to : " + lineItem.getName()); lineItem.getActivity().getLearningType().addPropertyChangeListener(learningTypeListener); lineItem.addPropertyChangeListener(learningTypeListener); } //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 it and its activity //LOGGER.info("removing listeners from: " + lineItem.getName()); lineItem.getActivity().getLearningType().removePropertyChangeListener(learningTypeListener); lineItem.removePropertyChangeListener(learningTypeListener); } if (pce.getNewValue() != null) { //This has been added TLALineItem lineItem = (TLALineItem) pce.getNewValue(); //So add a listener to it and its activity //LOGGER.info("adding listeners to: " + lineItem); lineItem.getActivity().getLearningType().addPropertyChangeListener(learningTypeListener); lineItem.addPropertyChangeListener(learningTypeListener); } } //Assume the dataset is now out of date, so repopulate it populateDataset(pieDataset, module); } }); return pieDataset; }
From source file:uk.ac.lkl.cram.ui.chart.LearningExperienceChartMaker.java
/** * Create a dataset from the module/* www. j a v a 2 s .co m*/ * @return a category dataset that is used to produce a stacked bar chart */ @Override protected CategoryDataset createDataSet() { //Create the 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 learningExperienceListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { //LOGGER.info("property change: " + pce); populateDataset(categoryDataset, module); } }; //Add the listener to each of the module's tlaLineItems, as well as to each //tlaLineItem's activity //This means that whenever a tlaLineItem changes, or its activity changes, the listener is triggered //Causing the dataset to be repopulated for (TLALineItem lineItem : module.getTLALineItems()) { //LOGGER.info("adding listeners to : " + lineItem.getName()); lineItem.getActivity().addPropertyChangeListener(TLActivity.PROP_LEARNING_EXPERIENCE, learningExperienceListener); lineItem.addPropertyChangeListener(learningExperienceListener); } //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 it and its activity //LOGGER.info("removing listeners from: " + lineItem.getName()); lineItem.getActivity().removePropertyChangeListener(TLActivity.PROP_LEARNING_EXPERIENCE, learningExperienceListener); lineItem.removePropertyChangeListener(learningExperienceListener); } if (pce.getNewValue() != null) { //This has been added TLALineItem lineItem = (TLALineItem) pce.getNewValue(); //So add a listener to it and its activity //LOGGER.info("adding listeners to: " + lineItem); lineItem.getActivity().addPropertyChangeListener(TLActivity.PROP_LEARNING_EXPERIENCE, learningExperienceListener); lineItem.addPropertyChangeListener(learningExperienceListener); } } //Assume the dataset is now out of date, so repopulate it populateDataset(categoryDataset, module); } }); return categoryDataset; }
From source file:ca.sqlpower.wabit.dao.session.WorkspacePersisterListener.java
public void propertyChanged(PropertyChangeEvent evt) { if (wouldEcho()) return;/*w w w . j a va 2s .c o m*/ this.transactionStarted(TransactionEvent.createStartTransactionEvent(this, "Creating start transaction event from propertyChange on object " + evt.getSource().getClass().getSimpleName() + " and property name " + evt.getPropertyName())); SPObject source = (SPObject) evt.getSource(); String uuid = source.getUUID(); String propertyName = evt.getPropertyName(); Object oldValue = evt.getOldValue(); Object newValue = evt.getNewValue(); PropertyDescriptor propertyDescriptor; try { propertyDescriptor = PropertyUtils.getPropertyDescriptor(source, propertyName); } catch (Exception ex) { this.rollback(); throw new RuntimeException(ex); } //Not persisting non-settable properties if (propertyDescriptor == null || propertyDescriptor.getWriteMethod() == null) { this.transactionEnded(TransactionEvent.createEndTransactionEvent(this)); return; } for (PropertyToIgnore ignoreProperty : ignoreList) { if (ignoreProperty.getPropertyName().equals(propertyName) && ignoreProperty.getClassType().isAssignableFrom(source.getClass())) { this.transactionEnded(TransactionEvent.createEndTransactionEvent(this)); return; } } //XXX special case that I want to remove even though I'm implementing it List<Object> additionalParams = new ArrayList<Object>(); if (source instanceof OlapQuery && propertyName.equals("currentCube")) { additionalParams.add(((OlapQuery) source).getOlapDataSource()); } DataType typeForClass = PersisterUtils.getDataType(newValue == null ? Void.class : newValue.getClass()); Object oldBasicType; Object newBasicType; oldBasicType = converter.convertToBasicType(oldValue, additionalParams.toArray()); newBasicType = converter.convertToBasicType(newValue, additionalParams.toArray()); logger.debug("Calling persistProperty on propertyChange"); this.persistProperty(uuid, propertyName, typeForClass, oldBasicType, newBasicType); this.transactionEnded(TransactionEvent.createEndTransactionEvent(this)); }
From source file:simulador.controle.GeradorGraficos.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (DEBUG) {/*ww w . j a va 2 s.co m*/ System.out.println("GeradorGraficos.propertyChange: " + evt.getPropertyName()); } switch (evt.getPropertyName()) { case BarraFerramentas.BT_SELECAO: Map<Integer, Point> pontosRadios = new HashMap(); Map<Integer, Boolean> valoresCheckbox = (Map) evt.getNewValue(); Map<Integer, Radio2D> radios2D = painelDesign.getRadios2D(); for (Map.Entry<Integer, Boolean> parCheckbox : valoresCheckbox.entrySet()) { System.out.println("parCheckbox[" + parCheckbox.getKey() + ", " + parCheckbox.getValue() + "]"); if (parCheckbox.getValue()) { Radio2D r2D = radios2D.get(parCheckbox.getKey()); Rectangle forma = (Rectangle) r2D.getForma(); Point localizacao = new Point((int) forma.getCenterX(), (int) forma.getCenterY()); System.out .println("radioCheckBox - localizacao: (" + localizacao.x + ", " + localizacao.y + ")"); pontosRadios.put(parCheckbox.getKey(), localizacao); } } //int[] coordCelPontoClicado = painelDesign.buscarCelula((Point) evt.getOldValue()); //PainelDesign.Celula cel = painelDesign.getMapaCelulas().get(coordCelPontoClicado[0]).get(coordCelPontoClicado[1]); //Point pontoFinal = new Point(cel.x, cel.y); Point pontoClicado = (Point) evt.getOldValue(); criarGraficoRadiais(pontosRadios, pontoClicado); break; } }
From source file:org.apache.catalina.mbeans.ServerLifecycleListener.java
/** * Handle a <code>PropertyChangeEvent</code> from one of the Containers * we are interested in.//from ww w . ja v a 2 s . co m * * @param event The event that has occurred */ public void propertyChange(PropertyChangeEvent event) { if (event.getSource() instanceof Container) { try { processContainerPropertyChange((Container) event.getSource(), event.getPropertyName(), event.getOldValue(), event.getNewValue()); } catch (Exception e) { log.error("Exception handling Container property change", e); } } else if (event.getSource() instanceof DefaultContext) { try { processDefaultContextPropertyChange((DefaultContext) event.getSource(), event.getPropertyName(), event.getOldValue(), event.getNewValue()); } catch (Exception e) { log.error("Exception handling DefaultContext property change", e); } } else if (event.getSource() instanceof NamingResources) { try { processNamingResourcesPropertyChange((NamingResources) event.getSource(), event.getPropertyName(), event.getOldValue(), event.getNewValue()); } catch (Exception e) { log.error("Exception handling NamingResources property change", e); } } else if (event.getSource() instanceof Server) { try { processServerPropertyChange((Server) event.getSource(), event.getPropertyName(), event.getOldValue(), event.getNewValue()); } catch (Exception e) { log.error("Exception handing Server property change", e); } } else if (event.getSource() instanceof Service) { try { processServicePropertyChange((Service) event.getSource(), event.getPropertyName(), event.getOldValue(), event.getNewValue()); } catch (Exception e) { log.error("Exception handing Service property change", e); } } }
From source file:fr.ritaly.dungeonmaster.champion.Champion.java
@Override public void propertyChange(PropertyChangeEvent event) { if (event.getSource() != stats) { // On ignore cet vnement return;/*from www . ja v a 2 s . c om*/ } if (Stats.PROPERTY_HEALTH.equals(event.getPropertyName())) { final int oldHealth = ((Integer) event.getOldValue()).intValue(); final int newHealth = ((Integer) event.getNewValue()).intValue(); if ((oldHealth > 0) && (newHealth == 0)) { // Le hros vient de mourir if (log.isDebugEnabled()) { log.debug(name + " is dying ..."); } kill(); } else if ((oldHealth == 0) && (newHealth > 0)) { if (log.isInfoEnabled()) { // Le hros vient de ressusciter log.info(name + " has been resurrected ..."); } // Inutile de le rintgrer au groupe, il y est dj ! } } }