List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:org.jtrfp.trcl.flow.IndirectProperty.java
@Override public void propertyChange(PropertyChangeEvent evt) { final Object newVal = evt.getNewValue(); if (newVal != null) setTarget((PROPERTY_TYPE) newVal); }
From source file:com.anrisoftware.prefdialog.appdialogs.registerdialog.ApprovalActionListener.java
@Override public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException { Status status = (Status) evt.getNewValue(); if (status == Status.APPROVED) { if (isBlank(dialog.getName())) { throw new PropertyVetoException(name_not_set_message.toString(), evt); }/*w ww . java2 s . c o m*/ if (isBlank(dialog.getCode())) { throw new PropertyVetoException(code_not_set_message.toString(), evt); } } }
From source file:ActionChangedListener.java
public void propertyChange(PropertyChangeEvent e) { String propertyName = e.getPropertyName(); System.out.println(propertyName); if (e.getPropertyName().equals(Action.NAME)) { String text = (String) e.getNewValue(); button.setText(text);/*from ww w . j a v a2 s . c o m*/ button.repaint(); } else if (propertyName.equals("enabled")) { Boolean enabledState = (Boolean) e.getNewValue(); button.setEnabled(enabledState.booleanValue()); button.repaint(); } else if (e.getPropertyName().equals(Action.SMALL_ICON)) { Icon icon = (Icon) e.getNewValue(); button.setIcon(icon); button.invalidate(); button.repaint(); } }
From source file:Main.java
public TwoRoot() { setLayout(new GridLayout(0, 1)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); add(progressBar);/* ww w .ja v a 2 s.com*/ add(label); setSize(300, 100); setVisible(true); progressBar.setIndeterminate(true); TwoWorker task = new TwoWorker(); task.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent e) { if ("progress".equals(e.getPropertyName())) { progressBar.setIndeterminate(false); progressBar.setValue((Integer) e.getNewValue()); } } }); task.execute(); }
From source file:Main.java
public Main() { super(new BorderLayout()); JProgressBar progressBar = new JProgressBar(0, 100); progressBar.setValue(0);//from www. j a v a 2 s.c om progressBar.setStringPainted(true); taskOutput = new JTextArea(5, 20); taskOutput.setEditable(false); startButton = new JButton("Start"); startButton.setActionCommand("start"); startButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { startButton.setEnabled(false); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); final Task task = new Task(); task.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { if ("progress".equals(pce.getPropertyName())) { int progress = (Integer) pce.getNewValue(); progressBar.setValue(progress); taskOutput.append(String.format("Completed %d%% of task.\n", task.getProgress())); } } }); task.execute(); } }); JPanel panel = new JPanel(); panel.add(startButton); panel.add(progressBar); add(panel, BorderLayout.PAGE_START); add(new JScrollPane(taskOutput), BorderLayout.CENTER); }
From source file:pe.gob.sunat.tecnologia3.arquitectura.framework.desktop.core.LoginForm.java
private void actionListeners() { cancel.addActionListener(new ActionListener() { @Override//from w w w.j ava2 s. com public void actionPerformed(ActionEvent event) { log.log(Level.INFO, "Boton::: cancel "); exit(); } }); ok.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { LoginController controller = (LoginController) jfxPanel.getController(); String mensajeError = controller.autenticacionFx(); if (mensajeError != null) { mostrarMensajeError(mensajeError); // controller.setLabelUser(mensajeError); } else { mensajeError = LoginSeguridad.autenticacionSeguridad(getUsuarioPrincipal(controller)); if (StringUtils.isNotBlank(mensajeError)) { mostrarMensajeError(mensajeError); } } } }); this.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (NotifyDescriptor.CLOSED_OPTION.equals(evt.getNewValue())) { exit(); } } }); }
From source file:com.webcrawler.manager.impl.ProcessManagerImpl.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("progress")) { this.parentComponent.setProgressBarValue((Integer) evt.getNewValue()); }/*from w w w .jav a 2 s . co m*/ }
From source file:ProgressBarDemo.java
/** * Invoked when task's progress property changes. *///from w ww .j a va2s . c o m public void propertyChange(PropertyChangeEvent evt) { if ("progress" == evt.getPropertyName()) { int progress = (Integer) evt.getNewValue(); progressBar.setValue(progress); taskOutput.append(String.format("Completed %d%% of task.\n", task.getProgress())); } }
From source file:Main.java
public TestPane() { add(pbProgress);/*from w w w . j av a 2s.c o m*/ start = new JButton("Start"); add(start); start.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { start.setEnabled(false); ProgressWorker pw = new ProgressWorker(); pw.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (name.equals("progress")) { int progress = (int) evt.getNewValue(); pbProgress.setValue(progress); repaint(); } else if (name.equals("state")) { SwingWorker.StateValue state = (SwingWorker.StateValue) evt.getNewValue(); switch (state) { case DONE: start.setEnabled(true); break; } } } }); pw.execute(); } }); }
From source file:org.polymap.core.mapeditor.NavigationHistory.java
@EventHandler public void propertyChange(PropertyChangeEvent ev) { try {/*from w w w . ja va2 s . co m*/ if (ev.getNewValue() instanceof ReferencedEnvelope) { ReferencedEnvelope newExtent = (ReferencedEnvelope) ev.getNewValue(); if (lastMapExtent != null && !newExtent.equals(lastMapExtent)) { NavigationOperation op = new NavigationOperation(lastMapExtent, newExtent); op.addContext(context); history.execute(op, new NullProgressMonitor(), null); log.debug("propertyChange(): " + newExtent + ", history= " + history.getUndoHistory(context).length); } lastMapExtent = newExtent; } } catch (ExecutionException e) { PolymapWorkbench.handleError(MapEditorPlugin.PLUGIN_ID, this, e.getLocalizedMessage(), e); } }