List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:org.goko.serial.bindings.SerialConnectionController.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (StringUtils.equals(evt.getPropertyName(), "serialPort")) { getDataModel().setConnectionAllowed(false); if (getDataModel().getSerialPort() != null && !getDataModel().isConnected()) { getDataModel().setConnectionAllowed(true); }//from w w w .j a va 2 s. c om } }
From source file:org.jcurl.demo.tactics.CurlerSwingBean.java
public void propertyChange(final PropertyChangeEvent evt) { log.warn("Unconsumed event '" + evt.getPropertyName() + "' from " + evt.getSource().getClass().getName() + ": " + evt.getOldValue() + " -> " + evt.getNewValue()); }
From source file:org.polymap.core.mapeditor.NavigationHistory.java
public NavigationHistory(MapEditor mapEditor) { this.mapEditor = mapEditor; this.context = new ObjectUndoContext(this, "Navigation Context"); this.history = new DefaultOperationHistory(); // approver = new AdvancedValidationUserApprover( context ); // history.addOperationApprover( approver ); this.history.setLimit(context, 10); mapEditor.getMap().addPropertyChangeListener(this, new EventFilter<PropertyChangeEvent>() { public boolean apply(PropertyChangeEvent ev) { String name = ev.getPropertyName(); return !ignoreEvents && NavigationHistory.this.mapEditor != null && NavigationHistory.this.mapEditor.getMap().equals(ev.getSource()) // XXX the extent events are often followed by an update // event with different extent (diskrete scales); processing just // the update event solves this but we are potentially loosing // map extent chnages && (IMap.PROP_EXTENT.equals(name) || IMap.PROP_EXTENT_UPDATE.equals(name)); }//from www . j ava 2 s. co m }); }
From source file:ambit.ui.data.AmbitResultViewer.java
public void propertyChange(PropertyChangeEvent e) { result = e.getNewValue();/* ww w .ja v a2 s . c o m*/ System.out.println(e.getPropertyName()); if (result == null) { image = null; return; } if (result instanceof FingerprintProfile) { String[] seriesNames = new String[] { ((FingerprintProfile) result).toString() }; FingerprintProfile fp = (FingerprintProfile) result; String[] categoryNames = new String[fp.getLength()]; DefaultCategoryDataset dataset = new DefaultCategoryDataset(); for (int i = 0; i < fp.getLength(); i++) { dataset.addValue(fp.getBitFrequency(i), seriesNames[0], new Integer(i)); } JFreeChart chart = ChartFactory.createBarChart3D("Consensus fingerprint", "Bits", "Frequency", dataset, PlotOrientation.VERTICAL, true, false, false); chart.setBackgroundPaint(Color.white); chart.setAntiAlias(true); image = chart.createBufferedImage(450, 200); chart = null; } if (result instanceof SimilarityMatrix) { image = ((SimilarityMatrix) result).toImage(); } if (image == null) label.setIcon(null); else label.setIcon(new ImageIcon(image)); }
From source file:Sketch.java
public void propertyChange(PropertyChangeEvent e) { if (e.getPropertyName() == "value") { Graphics g = board.getGraphics(); g.setColor(getForeground());//from w w w . jav a 2 s . com g.drawLine(lastX, lastY, shuttle1.getValue(), shuttle2.getValue()); lastX = shuttle1.getValue(); lastY = shuttle2.getValue(); } }
From source file:components.CustomDialog.java
/** This method reacts to state changes in the option pane. */ public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (isVisible() && (e.getSource() == optionPane) && (JOptionPane.VALUE_PROPERTY.equals(prop) || JOptionPane.INPUT_VALUE_PROPERTY.equals(prop))) { Object value = optionPane.getValue(); if (value == JOptionPane.UNINITIALIZED_VALUE) { //ignore reset return; }//from w w w. jav a2 s .c o m //Reset the JOptionPane's value. //If you don't do this, then if the user //presses the same button next time, no //property change event will be fired. optionPane.setValue(JOptionPane.UNINITIALIZED_VALUE); if (btnString1.equals(value)) { typedText = textField.getText(); String ucText = typedText.toUpperCase(); if (magicWord.equals(ucText)) { //we're done; clear and dismiss the dialog clearAndHide(); } else { //text was invalid textField.selectAll(); JOptionPane .showMessageDialog( CustomDialog.this, "Sorry, \"" + typedText + "\" " + "isn't a valid response.\n" + "Please enter " + magicWord + ".", "Try again", JOptionPane.ERROR_MESSAGE); typedText = null; textField.requestFocusInWindow(); } } else { //user closed dialog or clicked cancel dd.setLabel("It's OK. " + "We won't force you to type " + magicWord + "."); typedText = null; clearAndHide(); } } }
From source file:de.genvlin.plugins.jfreechart.JFreeChartPluginImpl.java
public boolean plot(final XYPool xyVectorPool, final ID id) { final GTask t = new GTask() { ChartPanel panel;//from w w w . j ava 2s .c o m public void runTask() { XYVectorPoolWrapper dataset = new XYVectorPoolWrapper(xyVectorPool); JFreeChart chart = ChartFactory.createXYLineChart("JFreechart Plot Panel.", // chart title "X Title", // x axis label "Y Title", // y axis label dataset, // data PlotOrientation.VERTICAL, true, // include legend true, // tooltips false // urls ); panel = new ChartPanel(chart); panel.setName("plot:" + dataset.getID()); } public Object getResult() { return panel; } };//GTask t.addChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName() == GTask.FINISHED) { showPanel((ChartPanel) t.getResult(), "east"); } } }); t.start(); return true; }
From source file:com.sec.ose.osi.thread.job.analysis.AnalysisMonitorThread.java
private void startAnalysis() { setStatus(STATUS_EXECUTING);// w w w. j a va 2 s . co m log.debug("AnalysisMonitorThread STATUS : " + getStatus()); ManageMediator.getInstance().updateUIForStartAnalysis(); ManageMediator.getInstance().setStatusText("analyzing..."); mAnalyzeTask = new AnalyzeExecutionThread(ManageMediator.getInstance().getAnalysisProjects(), ManageMediator.getInstance()); mAnalyzeTask.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if ("progress".equals(evt.getPropertyName())) { ManageMediator.getInstance().setProgressValue((Integer) evt.getNewValue()); } } }); mAnalyzeTask.execute(); }
From source file:org.cubictest.ui.gef.controller.CustomTestStepEditPart.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (PropertyAwareObject.STATUS.equals(evt.getPropertyName())) { if (evt.getNewValue() instanceof TestPartStatus) { customTestStepFigure.setStatus((TestPartStatus) evt.getNewValue()); }/*from ww w. jav a2 s . c om*/ } else super.propertyChange(evt); }
From source file:org.jcurl.mr.gui.BroomPanel0.java
public void propertyChange(final PropertyChangeEvent arg0) { log.debug(arg0);/*from w w w. jav a 2 s. co m*/ if (model == arg0.getSource()) if ("broomX".equals(arg0.getPropertyName())) { final Measure raw = (Measure) arg0.getNewValue(); final Measure val; if (raw.unit == Unit.NONE) val = new Measure(raw.value, dim); else val = raw.to(dim); slider.setValue((int) (val.value * Granularity)); text.setText(val.toString()); } }