List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:it.cnr.icar.eric.client.ui.swing.BusinessQueryPanel.java
/** * Process a ConceptsTreeDialog.PROPERTY_SELECTED_CONCEPTS change event. *///from w w w. j ava 2 s. c om private void processSelectedConceptsChange(PropertyChangeEvent ev) { try { Connection connection = RegistryBrowser.client.getConnection(); RegistryService service = connection.getRegistryService(); LifeCycleManager lcm = service.getBusinessLifeCycleManager(); ArrayList<?> selectedConcepts = (ArrayList<?>) ev.getNewValue(); ArrayList<Classification> classifications = new ArrayList<Classification>(); Iterator<?> iter = selectedConcepts.iterator(); while (iter.hasNext()) { Concept concept = (Concept) iter.next(); Classification classification = lcm.createClassification(concept); classifications.add(classification); } ((ClassificationsListModel) (classificationsList.getModel())).setModels(classifications); } catch (JAXRException e) { RegistryBrowser.displayError(e); } }
From source file:plugins.ImageRectificationPanel.java
/** * Invoked when task's progress property changes. *//*w w w . j a v a2 s . c o m*/ @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("progress")) { int progress = (Integer) evt.getNewValue(); progressBar.setValue(progress); } }
From source file:org.jaffa.flexfields.FlexBean.java
/** * Adds a default PropertyChangeListener to the listener list. *//*from w w w . j ava2 s . co m*/ private void addPropertyChangeListener() { addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { valueChanged(evt.getPropertyName(), evt.getOldValue()); if (log.isDebugEnabled()) log.debug("Field '" + evt.getPropertyName() + "' updated from '" + evt.getOldValue() + "' to '" + evt.getNewValue() + "'"); } }); }
From source file:com.m4rc310.cb.builders.ComponentBuilder.java
private void buildAllComponents() { for (Map.Entry<Field, AbstractComponetAdapter> entrySet : adapters.entrySet()) { Field field = entrySet.getKey(); Acomponent ac = field.getDeclaredAnnotation(Acomponent.class); AbstractComponetAdapter adapter = entrySet.getValue(); Object target = getTargetForField(field); adapter.setComponentsBuilder(this); adapter.build(field, target);//from www . j a v a2s . c o m Adialog adialog = objectAnnotated.getClass().getDeclaredAnnotation(Adialog.class); if (adialog.debug()) { try { Object component = adapter.getComponent(); StringBuilder sgroup = new StringBuilder(); for (String group : ac.groups()) { sgroup.append("[ "); sgroup.append(group); sgroup.append(" ]"); } String toolTipText = String.format("Name: %s - ToolTipText: %s - Groups: %s", ac.ref(), ac.toolTipText(), sgroup); MethodUtils.method(component, "setToolTipText", String.class).invoke(toolTipText); } catch (Exception e) { infoError(e); } } else { Object component = adapter.getComponent(); MethodUtils.method(component, "setToolTipText", String.class).invoke(getString(ac.toolTipText())); } try { Object value = field.get(target); adapter.update(field, value); if (ac.type().equals(EnumComponentType.PANEL)) { Object component = adapter.getComponent(); // Object[] components = ((JPanel) component).getComponents(); // // for (Object c : components) { // boolean bvalue = (boolean) MethodUtils.method(c, "isEnabled").invoke(); // mc.put(c, bvalue); // } PropertyChangeListener pcl = new PropertyChangeListener() { Map<Object, Boolean> mc = new HashMap<>(); @Override public void propertyChange(PropertyChangeEvent evt) { Object[] components = ((JPanel) component).getComponents(); if (evt.getPropertyName().equals("enabled")) { boolean enable = (boolean) evt.getNewValue(); for (Object com : components) { if (!mc.containsKey(com)) { boolean bvalue = (boolean) MethodUtils.method(com, "isEnabled").invoke(); mc.put(com, bvalue); } if (enable) { MethodUtils.method(com, "setEnabled", boolean.class).invoke(mc.get(com)); } else { MethodUtils.method(com, "setEnabled", boolean.class).invoke(enable); } } } } }; MethodUtils.method(component, "addPropertyChangeListener", PropertyChangeListener.class) .invoke(pcl); putContainer(value.hashCode(), component); } } catch (IllegalArgumentException | IllegalAccessException e) { infoError(e); throw new UnsupportedOperationException(e); } } }
From source file:com.mightypocket.ashot.Mediator.java
private void installListeners() { demon.addTaskListener(new Adapter<Void, ImageEx>() { @Override// www . ja va2 s . c o m public void process(TaskEvent<List<ImageEx>> event) { List<ImageEx> value = event.getValue(); if (!value.isEmpty()) { final ImageEx img = value.get(0); updateImageProcessor(img); final Image imgp = imageProcessor.process(img.getValue()); showImage(imgp); if (isRecording() && !(p.getBoolean(PREF_SAVE_SKIP_DUPLICATES, true) && img.isDuplicate())) { imageSaver.saveImage((saveOriginal) ? img.getValue() : imgp); } lastImage = img; } else { showImage(generateDummyImage()); } } }); addPropertyChangeListener(PROP_CONNECTED_DEVICE, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { final JRadioButtonMenuItem disconnected = devices.get((String) evt.getOldValue()); final JRadioButtonMenuItem connected = devices.get((String) evt.getNewValue()); if (disconnected != null) { disconnected.setSelected(false); } if (connected != null) { connected.setSelected(true); } else { devicesGroup.clearSelection(); } } }); addPropertyChangeListener(PROP_FULL_SCREEN, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { logger.debug("Full screen: {}", evt.getNewValue()); boolean fs = (Boolean) evt.getNewValue(); presenter = fs ? fullScreenFrame.getPresenter() : mainPanel.getPresenter(); } }); }
From source file:com.m4rc310.cb.builders.ComponentBuilder.java
public void _showDialog(Object objAnnotated, String ref, Object relative, Object... args) { if (objAnnotated != null) { objectAnnotated = objAnnotated;/*from w ww . j a v a 2 s.c o m*/ // Class[] classArgs = new Class[args.length]; // MethodUtils.method(objectAnnotated, "setValuesToSearch", classArgs).invoke(args[0]); } else { objectAnnotated = getNewInstanceObjectAnnotated(ref, args); } Class<? extends Object> objectAnnotatedClass = objectAnnotated.getClass(); dialog = new JDialogDefalt(); if (objectAnnotatedClass.isAnnotationPresent(Amethod.class)) { Amethod am = objectAnnotatedClass.getDeclaredAnnotation(Amethod.class); final String methodOnError = am.methodOnError(); LogServer.getInstance().debug(null, "Adicionando Listener de erro: {0}", methodOnError); if (!methodOnError.isEmpty()) { dialog.addPropertyChangeListener("onError", (PropertyChangeEvent evt) -> { getTargetsForMethodName(methodOnError).stream().forEach((tar) -> { MethodUtils.declaredMethod(tar, methodOnError, String.class, String.class) .invoke(evt.getPropertyName(), evt.getNewValue()); }); }); } } Adialog ad = objectAnnotatedClass.getDeclaredAnnotation(Adialog.class); String title = getString(ad.title(), ref); if (ad.debug()) { title = getString("title.title.mode.debug", title); } dialog.setTitle(title); dialog.addWindowListener(new WindowAdapter() { @Override public void windowOpened(WindowEvent e) { MethodUtils.method(objectAnnotated, "setComponentsBuilder", ComponentBuilder.class) .invoke(ComponentBuilder.this); MethodUtils.method(objectAnnotated, "setDialog", Dialog.class).invoke(dialog); MethodUtils.method(objectAnnotated, "setGui", GuiUtils.class).invoke(gui); } }); dialog.setLayout(new MigLayout(ad.layoutDialog())); dialog.abiliteCloseOnESC(); putContainer(objectAnnotated.hashCode(), dialog); addTargets(objectAnnotated); loadAllFields(objectAnnotated, objectAnnotated.getClass()); buildAllComponents(); printDialog(); dialog.setFontSize(ad.fontSize()); dialog.setModal(ad.modal()); dialog.setResizable(ad.resizable()); dialog.pack(); dialog.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG); dialog.setLocationRelativeTo((Component) relative); dialog.showWindow(); }
From source file:com.github.fritaly.dualcommander.DualCommander.java
@Override public void propertyChange(PropertyChangeEvent e) { if (e.getSource() == preferences) { if (logger.isDebugEnabled()) { logger.debug(String.format("User preference '%s' changed: '%s' -> '%s'", e.getPropertyName(), e.getOldValue(), e.getNewValue())); }//from w ww .j a v a 2 s . com // The 'show hidden' property changed, need to refresh the active // directory browsers // TODO Set a flag for the inactive directory browsers to refresh // when they get the focus this.leftPane.getActiveBrowser().refresh(); this.rightPane.getActiveBrowser().refresh(); } }
From source file:org.wings.SFrame.java
public void propertyChange(PropertyChangeEvent pe) { if ("lookAndFeel".equals(pe.getPropertyName())) { updateComponentTreeCG(getContentPane()); }/* w w w. j a va 2 s . c o m*/ if ("request.url".equals(pe.getPropertyName())) { setRequestURL((RequestURL) pe.getNewValue()); } }
From source file:op.care.med.inventory.DlgNewStocks.java
private void btnMedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnMedActionPerformed // String pzn = MedPackageTools.parsePZN(txtMedSuche.getText()); final JidePopup popup = new JidePopup(); WizardDialog wizard = new MedProductWizard(new Closure() { @Override/*from ww w . java 2 s . c om*/ public void execute(Object o) { if (o != null) { MedPackage aPackage = (MedPackage) o; txtMedSuche.setText(aPackage.getPzn()); } popup.hidePopup(); } }).getWizard(); popup.setMovable(false); popup.setPreferredSize((new Dimension(800, 450))); popup.setResizable(false); popup.getContentPane().setLayout(new BoxLayout(popup.getContentPane(), BoxLayout.LINE_AXIS)); popup.getContentPane().add(wizard.getContentPane()); popup.setOwner(btnMed); popup.removeExcludedComponent(btnMed); popup.setTransient(true); popup.setDefaultFocusComponent(wizard.getContentPane()); popup.addPropertyChangeListener("visible", new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent propertyChangeEvent) { OPDE.debug("popup property: " + propertyChangeEvent.getPropertyName() + " value: " + propertyChangeEvent.getNewValue() + " compCount: " + popup.getContentPane().getComponentCount()); popup.getContentPane().getComponentCount(); } }); GUITools.showPopup(popup, SwingConstants.WEST); // popup.showPopup(new Insets(-5, wizard.getPreferredSize().width * -1 - 200, -5, -100), btnMed); }
From source file:YoungDoubleSlit.YoungDoubleSlit.java
private void theWaveLengthSliderPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_theWaveLengthSliderPropertyChange // TODO add your handling code here: //System.out.println("Found PropertyChanged."); String property = evt.getPropertyName(); if ("value".equals(property)) { wavelength = (int) evt.getNewValue(); }//from w w w.j a va 2s. co m }