List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:org.jcurl.demo.tactics.sg.BroomPromptScenario.java
public void propertyChange(final PropertyChangeEvent evt) { if (evt.getSource() == model) { if ("idx16".equals(evt.getPropertyName())) syncIndexM2V((Integer) evt.getNewValue(), pie); else if ("outTurn".equals(evt.getPropertyName())) syncHandleM2V((Boolean) evt.getNewValue(), handle); else if ("broom".equals(evt.getPropertyName())) syncBroomM2V((Point2D) evt.getNewValue(), scene); else if ("splitTimeMillis".equals(evt.getPropertyName())) { final BoundedRangeModel os = (BoundedRangeModel) evt.getOldValue(); if (os != null) os.removeChangeListener(this); final BoundedRangeModel ns = (BoundedRangeModel) evt.getNewValue(); if (ns != null) ns.addChangeListener(this); syncSpeedM2V(ns);/*from ww w . j a v a 2 s. com*/ } else log.info(evt.getPropertyName() + " " + evt.getSource()); } else log.warn("Unconsumed event from " + evt.getSource()); }
From source file:net.chaosserver.timelord.data.TimelordData.java
/** * Genenerally catches a property change in of the contained tasks and * propogates that as a property change in one of the derrived properties of * this class./*from www . j a v a 2 s . c o m*/ * * @param evt the property change */ public void propertyChange(PropertyChangeEvent evt) { if ("hidden".equals(evt.getPropertyName())) { propertyChangeSupport.firePropertyChange("taskCollection", null, this.taskCollection); } }
From source file:com.jaxzin.iraf.forecast.swing.JForecaster.java
@SuppressWarnings({ "FieldRepeatedlyAccessedInMethod" }) private void initialize() { // final GridBagLayout gridbag = new GridBagLayout(); setLayout(new GridBagLayout());//new BoxLayout(this, BoxLayout.PAGE_AXIS)); controlPanel = new JForecasterControl(domain); final JFreeChart chart = createJFreeChart(); final JPanel chartPanel = new ChartPanel(chart, true); final GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.BOTH; c.weighty = 1.0;//from w ww .ja va2 s. c o m c.gridx = 0; c.gridy = 0; // gridbag.setConstraints(chartPanel, c); add(chartPanel, c); // todo: change to changelistener of JControlPanel domain.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent e) { chart.getXYPlot().setDataset(createDataset()); //noinspection CallToStringEquals if ("adjustForInflation".equals(e.getPropertyName())) { final String label; if (domain.isAdjustForInflation()) { label = "Account Value (Adjusted to Today's Value)"; } else { label = "Account Value"; } logAxis.setLabel(label); linearAxis.setLabel(label); } } }); controlPanel.addPropertyChangeListener("logScale", new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent e) { if (controlPanel.isLogScale()) { chart.getXYPlot().setRangeAxis(logAxis); } else { chart.getXYPlot().setRangeAxis(linearAxis); } } }); c.weighty = 0.0; c.gridx = 0; c.gridy = 1; c.anchor = GridBagConstraints.SOUTH; // gridbag.setConstraints(controlPanel, c1); add(controlPanel, c); }
From source file:net.chaosserver.timelord.swingui.TaskDayPanel.java
/** * Listens from property changes on the TaskName or TaskDay and triggers * updates to the UI.//from ww w .j a va 2 s . co m * * @param evt the property event */ public void propertyChange(PropertyChangeEvent evt) { if (evt.getSource().equals(getTodayTaskDay())) { if ("note".equals(evt.getPropertyName())) { updateTaskNameLabel(); } else if ("hours".equals(evt.getPropertyName())) { enabledButtons(); } } else if (evt.getSource().equals(getTimelordTask())) { if ("taskName".equals(evt.getPropertyName())) { updateTaskNameLabel(); } } }
From source file:org.formic.wizard.impl.console.ConsoleWizard.java
/** * {@inheritDoc}//from www .j a v a 2 s .c o m * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(Wizard.ACTIVE_STEP)) { MultiPathModel model = (MultiPathModel) getModel(); org.pietschy.wizard.WizardStep step = model.getActiveStep(); // update step listening. if (activeStep != null) { activeStep.removePropertyChangeListener(this); } activeStep = step; activeStep.addPropertyChangeListener(this); if (step != null) { updateView(((ConsoleWizardStep) activeStep).getConsoleView()); WizardStep ws = ((ConsoleWizardStep) step).getStep(); updateButtonStatus(model, ws, step); // notify step that it is displayed. ws.displayed(); } } else if (evt.getPropertyName().equals(WizardStep.CANCEL)) { boolean cancelEnabled = ((Boolean) evt.getNewValue()).booleanValue(); cancelButton.setEnabled(cancelEnabled); } else if (evt.getPropertyName().equals(WizardStep.PREVIOUS)) { boolean previousEnabled = ((Boolean) evt.getNewValue()).booleanValue(); previousButton.setEnabled(previousEnabled); } else if (evt.getPropertyName().equals(WizardStep.VALID) || evt.getPropertyName().equals(WizardStep.BUSY)) { MultiPathModel model = (MultiPathModel) getModel(); org.pietschy.wizard.WizardStep step = model.getActiveStep(); final WizardStep ws = ((ConsoleWizardStep) step).getStep(); boolean nextEnabled = ws.isValid() && !ws.isBusy() && !model.isLastStep(step); nextButton.setEnabled(nextEnabled); // show inifinite wait for busy state. if (evt.getPropertyName().equals(WizardStep.BUSY) && ws.isBusyAnimated()) { final boolean busy = ((Boolean) evt.getNewValue()).booleanValue(); SwingUtilities.invokeLater(new Runnable() { public void run() { if (busy) { hiddenPanel = (JPanel) viewPanel.getComponents()[0]; updateView(new BusyPanel(ws)); } else { updateView(hiddenPanel); hiddenPanel = null; } } }); } } }
From source file:edu.ucla.stat.SOCR.chart.SuperAreaChart_XY.java
public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); System.err.println("From RegCorrAnal:: propertyName =" + propertyName + "!!!"); if (propertyName.equals("DataUpdate")) { //update the local version of the dataTable by outside source dataTable = (JTable) (e.getNewValue()); dataPanel.removeAll();/*from w w w . j a va2 s . c o m*/ dataPanel.add(new JScrollPane(dataTable)); dataTable.doLayout(); System.err.println("From RegCorrAnal:: data UPDATED!!!"); } }
From source file:eu.ggnet.dwoss.stock.CommissioningManagerView.java
public void setModel(CommissioningManagerModel model) { this.model = model; updateStatus();/*from w w w . j av a 2 s . c om*/ model.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { updateStatus(); if (evt.getPropertyName().equals(CommissioningManagerModel.PROP_FULL)) { boolean temp = (Boolean) evt.getNewValue(); done1Button.setEnabled(temp); done2Button.setEnabled(temp); } if (evt.getPropertyName().equals(CommissioningManagerModel.PROP_PARTICIPANT_ONE)) { done1Button.setText("Authentifiziere " + evt.getNewValue().toString()); } if (evt.getPropertyName().equals(CommissioningManagerModel.PROP_PARTICIPANT_TWO)) { done2Button.setText("Authentifiziere " + evt.getNewValue().toString()); } if (evt.getPropertyName().equals(CommissioningManagerModel.PROP_COMPLETEABLE)) { boolean temp = (Boolean) evt.getNewValue(); confirmButton.setEnabled(temp); } } }); unitsList.setModel(model.getUnitModel()); transactionList.setModel(model.getTransactionModel()); }
From source file:org.tinymediamanager.ui.movies.MovieMediaFilesPanel.java
/** * Instantiates a new movie media information panel. * /*from w w w . j a v a 2 s. com*/ * @param model * the model */ public MovieMediaFilesPanel(MovieSelectionModel model) { this.movieSelectionModel = model; mediaFileEventList = new ObservableElementList<>( GlazedLists.threadSafeList(new BasicEventList<MediaFile>()), GlazedLists.beanConnector(MediaFile.class)); setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("200px:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.NARROW_LINE_GAP_ROWSPEC, })); lblDateAddedT = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$ add(lblDateAddedT, "2, 2"); lblDateAdded = new JLabel(""); add(lblDateAdded, "4, 2"); // btnPlay = new JButton("Play"); // btnPlay.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent arg0) { // try { // Desktop.getDesktop().open(movieSelectionModel.getSelectedMovie().getMediaFiles(MediaFileType.VIDEO).get(0).getFile()); // } // catch (Exception e) { // // } // } // if (!StringUtils.isEmpty(lblMoviePath.getNormalText())) { // // get the location from the label // StringBuilder movieFile = new // StringBuilder(lblMoviePath.getNormalText()); // movieFile.append(File.separator); // movieFile.append(movieSelectionModel.getSelectedMovie().getMediaFiles().get(0).getFilename()); // File f = new File(movieFile.toString()); // // try { // if (f.exists()) { // // String vlcF = f.getAbsolutePath(); // // F I X M E: german umlauts do not decode correctly; Bug in // // libDvdNav? so workaround; // if (vlcF.matches(".*[].*")) { // LOGGER.debug("VLC: workaround: german umlauts found - use system player"); // Desk4op.getDesktop().open(f); // } // else { // try { // // if (!vlcF.startsWith("/")) { // // add the missing 3rd / in not start with one (eg windows) // vlcF = "/" + vlcF; // } // String mrl = new FileMrl().file(vlcF).value(); // // final EmbeddedMediaPlayerComponent mediaPlayerComponent = new // EmbeddedMediaPlayerComponent(); // JFrame frame = new JFrame("player"); // frame.setLocation(100, 100); // frame.setSize(1050, 600); // frame.setDefaultCloseOperation(JInternalFrame.DISPOSE_ON_CLOSE); // frame.setVisible(true); // frame.setContentPane(mediaPlayerComponent); // // mrl = mrl.replace("file://", ""); // does not work either // // LOGGER.debug("VLC: playing " + mrl); // Boolean ok = mediaPlayerComponent.getMediaPlayer().playMedia(mrl); // if (!ok) { // LOGGER.error("VLC: couldn't create player window!"); // } // } // catch (RuntimeException e) { // LOGGER.warn("VLC: has not been initialized on startup - use system player"); // Desktop.getDesktop().open(f); // } // catch (NoClassDefFoundError e) { // LOGGER.warn("VLC: has not been initialized on startup - use system player"); // Desktop.getDesktop().open(f); // } // // } // end else // } // end exists // } // end try // catch (IOException e) { // LOGGER.error("Error opening file", e); // } // } // end isEmpty // } // }); // add(btnPlay, "10, 2"); lblMoviePathT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$ add(lblMoviePathT, "2, 4"); lblMoviePath = new LinkLabel(""); lblMoviePath.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (!StringUtils.isEmpty(lblMoviePath.getNormalText())) { Path path = Paths.get(lblMoviePath.getNormalText()); try { // get the location from the label // check whether this location exists if (Files.exists(path)) { TmmUIHelper.openFile(path); } } catch (Exception ex) { LOGGER.error("open filemanager", ex); MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, path, "message.erroropenfolder", new String[] { ":", ex.getLocalizedMessage() })); } } } }); lblMoviePathT.setLabelFor(lblMoviePath); lblMoviePathT.setLabelFor(lblMoviePath); add(lblMoviePath, "4, 4"); lblFilesT = new JLabel(BUNDLE.getString("metatag.files")); //$NON-NLS-1$ add(lblFilesT, "2, 6, default, top"); panelMediaFiles = new MediaFilesPanel(mediaFileEventList); add(panelMediaFiles, "4, 6, 1, 1, fill, fill"); initDataBindings(); // install the propertychangelistener PropertyChangeListener propertyChangeListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { String property = propertyChangeEvent.getPropertyName(); Object source = propertyChangeEvent.getSource(); // react on selection of a movie and change of media files if ((source.getClass() == MovieSelectionModel.class && "selectedMovie".equals(property)) || (source.getClass() == Movie.class && MEDIA_FILES.equals(property))) { // this does sometimes not work. simply wrap it try { mediaFileEventList.getReadWriteLock().writeLock().lock(); mediaFileEventList.clear(); mediaFileEventList.addAll(movieSelectionModel.getSelectedMovie().getMediaFiles()); } catch (Exception e) { } finally { mediaFileEventList.getReadWriteLock().writeLock().unlock(); } try { panelMediaFiles.adjustColumns(); } catch (Exception e) { } } } }; movieSelectionModel.addPropertyChangeListener(propertyChangeListener); }
From source file:edu.ucla.stat.SOCR.chart.SuperYIntervalChart.java
/** * Creates a panel for the demo (used by SuperDemo.java). * //from www . j av a 2 s.c o m * @return A panel. */ /* public static JPanel createDemoPanel() { JFreeChart chart = createChart(createDataset()); return new ChartPanel(chart); }*/ public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); System.err.println("From RegCorrAnal:: propertyName =" + propertyName + "!!!"); if (propertyName.equals("DataUpdate")) { //update the local version of the dataTable by outside source dataTable = (JTable) (e.getNewValue()); dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); System.err.println("From RegCorrAnal:: data UPDATED!!!"); } }
From source file:edu.ku.brc.specify.config.init.InstSetupPanel.java
/** * /*from w w w.j a va 2s.co m*/ */ protected void doCreate() { if (isOK == null || !isOK) { progressBar.setIndeterminate(true); progressBar.setVisible(true); setUIEnabled(false); label.setText(UIRegistry.getResourceString("CONN_DB")); testBtn.setVisible(false); SwingWorker<Object, Object> worker = new SwingWorker<Object, Object>() { @Override protected Object doInBackground() throws Exception { isOK = false; try { getValues(properties); firePropertyChange(propName, 0, 1); conn = DBConnection.getInstance(); AppContextMgr.getInstance().setHasContext(true); // override BuildSampleDatabase bsd = new BuildSampleDatabase(); bsd.setSession(HibernateUtil.getCurrentSession()); int treeDir = BuildSampleDatabase.getTreeDirForClass(properties, StorageTreeDef.class); isOK = bsd.createEmptyInstitution(properties, false, false, true, treeDir); AppContextMgr.getInstance().setClassObject(DataType.class, bsd.getDataType()); HibernateUtil.closeSession(); if (!isOK) { errorKey = "BAD_INST"; return null; } String userName = properties.getProperty("usrUsername"); String password = properties.getProperty("usrPassword"); String dbName = properties.getProperty("dbName"); firePropertyChange(propName, 0, 2); isOK = tryLogginIn(userName, password, dbName); if (!isOK) { errorKey = "BAD_LOGIN"; return null; } } catch (Exception ex) { ex.printStackTrace(); errorKey = "INST_UNRECOVERABLE"; } return null; } /* (non-Javadoc) * @see javax.swing.SwingWorker#done() */ @Override protected void done() { super.done(); progressBar.setIndeterminate(false); progressBar.setVisible(false); setUIEnabled(true); updateBtnUI(); label.setText(UIRegistry.getResourceString( isOK ? "INST_CREATED" : (errorKey != null ? errorKey : "ERR_CRE_INST"))); if (isOK) { setUIEnabled(false); prevBtn.setEnabled(false); } } }; worker.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(final PropertyChangeEvent evt) { if (propName.equals(evt.getPropertyName())) { String key = null; switch ((Integer) evt.getNewValue()) { case 1: key = "CREATING_INST"; break; case 2: key = "LOGIN_USER"; break; default: break; } if (key != null) { InstSetupPanel.this.label.setText(UIRegistry.getResourceString(key)); } } } }); worker.execute(); } }