List of usage examples for java.beans PropertyChangeListener propertyChange
void propertyChange(PropertyChangeEvent evt);
From source file:com.toolsverse.mvc.model.ModelImpl.java
public void propertyChange(PropertyChangeEvent event) { if (_silentUpdate) return;/* ww w. j ava2 s. c o m*/ PropertyChangeListener[] listeners = _propertyChangeSupport.getPropertyChangeListeners(); if (listeners == null || listeners.length == 0) { if (getOwner() != null) getOwner().propertyChange(event); return; } for (PropertyChangeListener listener : listeners) listener.propertyChange(event); }
From source file:net.rim.ejde.internal.ui.launchers.SimulatorConfigurationTabBase.java
/** * Creates a checkbox control./*from w w w . j a v a 2s.c o m*/ * * @param parent * The parent composite * @param label * The label * @param tooltip * The tooltip * @param listener * The property change listener * @return The checkbox control */ protected static Button createCheckbox(final Composite parent, final int style, final String label, final String tooltip, final PropertyChangeListener listener) { Button checkboxButton = new Button(parent, style); checkboxButton.setText(label); if (tooltip != null) { checkboxButton.setToolTipText(tooltip); } checkboxButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { listener.propertyChange(null); } }); return checkboxButton; }
From source file:edu.ku.brc.specify.plugins.latlon.LatLonUI.java
public void setChanged(boolean isChanged) { this.isChanged = isChanged; if (isChanged) { for (PropertyChangeListener l : getPropertyChangeListeners()) { l.propertyChange(new PropertyChangeEvent(LatLonUI.this, "latlon", null, getLatLon())); }/*www . j av a2 s . co m*/ } if (!isChanged) { for (LatLonUIIFace panel : panels) { panel.setHasChanged(isChanged); } } }
From source file:net.rim.ejde.internal.ui.launchers.SimulatorConfigurationTabBase.java
/** * Creates a combo control.//from w ww . j a va 2s . co m * * @param parent * The parent composite * @param labelText * The label * @param tooltip * The tooltip * @param choices * The choices * @param listener * The property change listener * @return The combo control */ private static Combo createCombo(final Composite parent, final String labelText, final String tooltip, final PropertyChangeListener listener) { final Label label = new Label(parent, SWT.NONE | SWT.WRAP); label.setText(labelText); Combo combo = new Combo(parent, SWT.LEFT | SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, false); combo.setLayoutData(gridData); if (tooltip != null) { combo.setToolTipText(tooltip); } combo.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { listener.propertyChange(null); } }); return combo; }
From source file:edu.ku.brc.specify.config.SpecifyGUIDGeneratorFactory.java
@Override public void buildGUIDs(final PropertyChangeListener pcl) { Collection col = AppContextMgr.getInstance().getClassObject(Collection.class); File outFile = new File( UIRegistry.getAppDataDir() + File.separator + String.format("guids_%d.txt", col.getId())); try {//from w ww . j ava2 s .c o m pw = new PrintWriter(outFile); } catch (IOException ex) { ex.printStackTrace(); } if (frame != null) frame.setDesc("Updating GUIDs..."); // I18N setProgressValue(true, 0, 100); // Sets Overall Progress to 0 -> 100 int count = 1; double tot = CATEGORY_TYPE.values().length; for (CATEGORY_TYPE cat : CATEGORY_TYPE.values()) { if (pcl != null) { pcl.propertyChange(new PropertyChangeEvent(this, "COUNT", 0, count)); } try { buildGUIDs(DBConnection.getInstance().getConnection(), cat); } catch (Exception ex) { ex.printStackTrace(); } finally { if (pcl != null) { pcl.propertyChange(new PropertyChangeEvent(this, "COUNT", 0, count)); } } setProgressValue(true, (int) (((double) count / tot) * 100.0)); count++; } pw.close(); }
From source file:net.rim.ejde.internal.ui.launchers.SimulatorConfigurationTabBase.java
/** * Creates a text control.//from www.j av a2 s .c o m * * @param parent * The parent composite * @param labelText * The label * @param tooltip * The tooltip * @param listener * The property change listener * @return The text control */ private static Text createText(final Composite parent, final String labelText, final String tooltip, final PropertyChangeListener listener) { if (!StringUtils.isBlank(labelText)) { final Label label = new Label(parent, SWT.NONE | SWT.WRAP); label.setText(labelText); } Text text = new Text(parent, SWT.LEFT | SWT.SINGLE | SWT.BORDER | SWT.WRAP); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); text.setLayoutData(gridData); if (tooltip != null) { text.setToolTipText(tooltip); } text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { listener.propertyChange(null); } }); return text; }
From source file:net.rim.ejde.internal.ui.launchers.SimulatorConfigurationTabBase.java
/** * Create a text control with a browse button besides. * * @param parent/* ww w .j a va 2 s . c o m*/ * The parent composite * @param labelText * The label * @param tooltip * The tooltip * @param listener * The property change listener * @param dialogType * Browse for file or directory * @return The text and button wrapper */ private static TextButtonWrapper createTextBrowse(final Composite parent, final String labelText, final String tooltip, final PropertyChangeListener listener, final int dialogType) { final Label label = new Label(parent, SWT.NONE | SWT.WRAP); label.setText(labelText); Composite comp1 = CompositeFactory.gridComposite(parent, 2); final Text text = new Text(comp1, SWT.LEFT | SWT.SINGLE | SWT.BORDER | SWT.WRAP); GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); text.setLayoutData(gridData); if (tooltip != null) { text.setToolTipText(tooltip); } text.addModifyListener(new ModifyListener() { public void modifyText(ModifyEvent e) { listener.propertyChange(null); } }); final Button browseButton = new Button(comp1, SWT.NONE); browseButton.setText(Messages.IConstants_BROWSE_BUTTON_TITLE); gridData = new GridData(); gridData.widthHint = 75; browseButton.setLayoutData(gridData); browseButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { File file; if (dialogType == BROWSE_DIALOG_TYPE_OPEN_FILE) { file = RimIDEUtil.openFile(browseButton.getShell(), Messages.SimulatorConfigurationTab_openFile, null, SWT.OPEN, new String[] { Messages.SimulatorConfigurationTab_dmpFile }); } else { file = RimIDEUtil.openDirecotryDialog(browseButton.getShell(), Messages.SimulatorTab_DIR_DIALOG_TITLE); } if (file == null) { return; } text.setText(file.getPath()); } }); return new TextButtonWrapper(text, browseButton); }
From source file:edu.ku.brc.af.core.SchemaI18NService.java
/** * Creates a menu with the locate and a property listener. A property event is sent with the property * name set to "locale" with the current locale passed as the old value and the new locale as the new value. * @param frame the frame is passed in so the property listner can push and pop the frame before and after the listener is called. * @return the menu/*from ww w .j a v a 2 s . c o m*/ */ public JMenu createLocaleMenu(final JFrame frame, final PropertyChangeListener pcl) { JMenu localeMenu = createLocaleMenu(new ActionListener() { public void actionPerformed(ActionEvent e) { List<LocaleDlgItem> dlgItems = new ArrayList<LocaleDlgItem>(); for (Locale l : getStdLocaleList(true)) { if (!l.getLanguage().equals("-")) { dlgItems.add(new LocaleDlgItem(l)); } } ChooseFromListDlg<LocaleDlgItem> localeDlg = new ChooseFromListDlg<LocaleDlgItem>(frame, "Choose a Locale", dlgItems); UIHelper.centerAndShow(localeDlg); LocaleDlgItem selected = localeDlg.getSelectedObject(); if (!localeDlg.isCancelled() && selected != null) { Locale newLocale = selected.getLocale(); checkCurrentLocaleMenu(); UIRegistry.pushWindow(frame); pcl.propertyChange(new PropertyChangeEvent(this, "locale", currentLocale, newLocale)); //$NON-NLS-1$ UIRegistry.popWindow(frame); } } }); checkCurrentLocaleMenu(); return localeMenu; }
From source file:edu.ku.brc.af.tasks.subpane.formeditor.EditorPropPanelBase.java
/** * @param controlHash//w ww.j a va2s. com * @param subcontrolHash * @param fieldsNotUsedByLabels * @param addSaveBtn * @param pcl */ public EditorPropPanelBase(final Hashtable<String, Control> controlHash, final Hashtable<String, SubControl> subcontrolHash, final Vector<FormCellField> fieldsNotUsedByLabels, final boolean addSaveBtn, final PropertyChangeListener pcl) { setLayout(new BorderLayout()); this.controlHash = controlHash; this.subcontrolHash = subcontrolHash; this.fieldsNotUsedByLabels = fieldsNotUsedByLabels; if (addSaveBtn) { saveBtn = UIHelper.createButton("Accept"); saveBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (currentData instanceof FormCellField) { getDataFromUI((FormCellField) currentData); } else { getDataFromUI(currentData); } if (pcl != null) { pcl.propertyChange(new PropertyChangeEvent(EditorPropPanelBase.this, "accept", currentData, //$NON-NLS-1$ currentData)); } } }); } }
From source file:edu.ku.brc.af.tasks.subpane.formeditor.EditorPropPanel.java
/** * @param controlHash// w w w. j a v a 2 s.c o m * @param subcontrolHash * @param fieldsNotUsedByLabels * @param addSaveBtn * @param pcl */ public EditorPropPanel(final Hashtable<String, Control> controlHash, final Hashtable<String, SubControl> subcontrolHash, final Vector<FormCellField> fieldsNotUsedByLabels, final boolean addSaveBtn, final PropertyChangeListener pcl) { setLayout(new BorderLayout()); this.controlHash = controlHash; this.subcontrolHash = subcontrolHash; this.fieldsNotUsedByLabels = fieldsNotUsedByLabels; if (addSaveBtn) { saveBtn = UIHelper.createButton("Accept"); saveBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (currentFC instanceof FormCellField) { getDataFromUI((FormCellField) currentFC); } else { getDataFromUI(currentFC); } if (pcl != null) { pcl.propertyChange(new PropertyChangeEvent(EditorPropPanel.this, "accept", data, data)); //$NON-NLS-1$ } } }); } }