List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorComponent.java
/** * Implemented as specified by the {@link Editor} interface. * @see Editor#analysisResultsLoaded(AnalysisResultsItem) *///from w w w . ja v a 2s . co m public void analysisResultsLoaded(AnalysisResultsItem analysis) { if (analysis == null) return; analysis.notifyLoading(false); model.removeAnalysisResultsLoading(analysis); //now display results. String name = analysis.getNameSpace(); if (FileAnnotationData.FLIM_NS.equals(name)) { DataObject data = analysis.getData(); if (data instanceof ImageData) { /* FLIMResultsEvent event = new FLIMResultsEvent((ImageData) data, analysis.getResults()); EventBus bus = MetadataViewerAgent.getRegistry().getEventBus(); bus.post(event); */ ImageData image = (ImageData) data; IconManager icons = IconManager.getInstance(); FLIMResultsDialog d = new FLIMResultsDialog(null, EditorUtil.getPartialName(image.getName()), icons.getIcon(IconManager.FLIM_48), analysis.getResults()); d.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (FLIMResultsDialog.SAVED_FLIM_RESULTS_PROPERTY.equals(name)) { boolean b = ((Boolean) evt.getNewValue()).booleanValue(); UserNotifier un = MetadataViewerAgent.getRegistry().getUserNotifier(); if (b) { un.notifyInfo("Saving Results", "The file has " + "successfully been saved."); } else { un.notifyInfo("Saving Results", "An error " + "occurred while saving the results."); } } } }); UIUtilities.centerAndShow(d); } } }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Creates the menu hosting the users belonging to the specified group. * Returns <code>true</code> if the group is selected, <code>false</code> * otherwise./*from w w w .ja v a 2 s. co m*/ * * @param groupItem The item hosting the group. * @param size The number of groups. * @return See above. */ private boolean createGroupMenu(GroupItem groupItem, int size) { long loggedUserID = model.getUserDetails().getId(); GroupData group = groupItem.getGroup(); //Determine the user already added to the display Browser browser = model.getBrowser(Browser.PROJECTS_EXPLORER); TreeImageDisplay refNode = null; List<TreeImageDisplay> nodes; ExperimenterVisitor visitor; List<Long> users = new ArrayList<Long>(); //Find the group already displayed if (group != null && size > 0) { visitor = new ExperimenterVisitor(browser, group.getId()); browser.accept(visitor); nodes = visitor.getNodes(); if (nodes.size() == 1) { refNode = nodes.get(0); } visitor = new ExperimenterVisitor(browser, -1, -1); if (refNode != null) refNode.accept(visitor); else if (size == 1) browser.accept(visitor); nodes = visitor.getNodes(); TreeImageDisplay n; if (CollectionUtils.isNotEmpty(nodes)) { Iterator<TreeImageDisplay> j = nodes.iterator(); while (j.hasNext()) { n = j.next(); if (n.getUserObject() instanceof ExperimenterData) { users.add(((ExperimenterData) n.getUserObject()).getId()); } } if (size == 1) { groupItem.setMenuSelected(true, false); } } } //now add the users List<DataMenuItem> items = new ArrayList<DataMenuItem>(); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); List l = null; if (group != null) l = sorter.sort(group.getLeaders()); Iterator i; ExperimenterData exp; DataMenuItem item, allUser; JPanel list; boolean view = true; if (group != null) { int level = group.getPermissions().getPermissionsLevel(); if (level == GroupData.PERMISSIONS_PRIVATE) { view = model.isAdministrator() || model.isGroupOwner(group); } } list = new JPanel(); list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS)); allUser = new DataMenuItem(DataMenuItem.ALL_USERS_TEXT, true); items.add(allUser); if (view) list.add(allUser); p.add(UIUtilities.buildComponentPanel(list)); int count = 0; int total = 0; if (CollectionUtils.isNotEmpty(l)) { total += l.size(); i = l.iterator(); list = new JPanel(); list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS)); while (i.hasNext()) { exp = (ExperimenterData) i.next(); if (view || exp.getId() == loggedUserID) { item = new DataMenuItem(exp, true); item.setSelected(users.contains(exp.getId())); if (item.isSelected()) count++; item.addPropertyChangeListener(groupItem); items.add(item); list.add(item); } } if (list.getComponentCount() > 0) { p.add(formatHeader("Group owners")); p.add(UIUtilities.buildComponentPanel(list)); } } if (group != null) l = sorter.sort(group.getMembersOnly()); if (CollectionUtils.isNotEmpty(l)) { total += l.size(); i = l.iterator(); list = new JPanel(); list.setLayout(new BoxLayout(list, BoxLayout.Y_AXIS)); while (i.hasNext()) { exp = (ExperimenterData) i.next(); if (view || exp.getId() == loggedUserID) { item = new DataMenuItem(exp, true); item.setSelected(users.contains(exp.getId())); if (item.isSelected()) count++; item.addPropertyChangeListener(groupItem); items.add(item); list.add(item); } } if (list.getComponentCount() > 0) { p.add(formatHeader("Members")); p.add(UIUtilities.buildComponentPanel(list)); } } allUser.setSelected(total != 0 && total == count); allUser.addPropertyChangeListener(groupItem); JScrollPane pane = new JScrollPane(p); Dimension d = p.getPreferredSize(); int max = 500; if (d.height > max) { Insets insets = pane.getInsets(); pane.setPreferredSize(new Dimension(d.width + insets.left + insets.right + 20, max)); } groupItem.add(pane); groupItem.setUsersItem(items); groupItem.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (GroupItem.USER_SELECTION_PROPERTY.equals(name)) handleSelection(); else if (GroupItem.ALL_GROUPS_SELECTION_PROPERTY.equals(name)) handleAllGroupsSelection(true); else if (GroupItem.ALL_GROUPS_DESELECTION_PROPERTY.equals(name)) handleAllGroupsSelection(false); else if (GroupItem.ALL_USERS_SELECTION_PROPERTY.equals(name)) handleAllUsersSelection((Boolean) evt.getNewValue()); } }); return groupItem.isMenuSelected(); }
From source file:org.openmicroscopy.shoola.agents.metadata.view.MetadataViewerComponent.java
/** * Implemented as specified by the {@link MetadataViewer} interface. * @see MetadataViewer#makeMovie(int, Color) *//*from ww w. j a va 2 s. c o m*/ public void makeMovie(int scaleBar, Color overlayColor) { Object refObject = model.getRefObject(); if (refObject instanceof WellSampleData) { WellSampleData wsd = (WellSampleData) refObject; refObject = wsd.getImage(); } if (!(refObject instanceof ImageData)) return; PixelsData data = null; ImageData img = (ImageData) refObject; try { data = ((ImageData) refObject).getDefaultPixels(); } catch (Exception e) { } if (data == null) return; int maxT = data.getSizeT(); int maxZ = data.getSizeZ(); int defaultZ = maxZ; int defaultT = maxT; Object value = data.getSizeC(); if (model.getEditor().getChannelData() != null) value = model.getEditor().getChannelData(); String name = EditorUtil.getPartialName(img.getName()); JFrame f = MetadataViewerAgent.getRegistry().getTaskBar().getFrame(); MovieExportDialog dialog = new MovieExportDialog(f, name, maxT, maxZ, defaultZ, defaultT, value); dialog.setBinaryAvailable(MetadataViewerAgent.isBinaryAvailable()); dialog.setScaleBarDefault(scaleBar, overlayColor); dialog.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (MovieExportDialog.CREATE_MOVIE_PROPERTY.equals(name)) { Object src = evt.getSource(); if (src instanceof MovieExportDialog) { MovieExportDialog d = (MovieExportDialog) src; createMovie(d.getParameters()); } } } }); dialog.centerDialog(); }
From source file:net.sourceforge.squirrel_sql.client.Application.java
private void preferencesHaveChanged(PropertyChangeEvent evt) { final String propName = evt != null ? evt.getPropertyName() : null; if (propName == null || propName.equals(SquirrelPreferences.IPropertyNames.SHOW_TOOLTIPS)) { ToolTipManager.sharedInstance().setEnabled(_prefs.getShowToolTips()); }/*from w ww. ja va 2s . c o m*/ if (propName == null || propName.equals(SquirrelPreferences.IPropertyNames.JDBC_DEBUG_TYPE)) { setupJDBCLogging(); } if (propName == null || propName.equals(SquirrelPreferences.IPropertyNames.LOGIN_TIMEOUT)) { DriverManager.setLoginTimeout(_prefs.getLoginTimeout()); } if (propName == null || propName == SquirrelPreferences.IPropertyNames.PROXY) { new ProxyHandler().apply(_prefs.getProxySettings()); } }
From source file:edu.ku.brc.af.ui.forms.IconViewObj.java
/** * // w ww . j a v a 2 s. c om */ protected void initMainComp() { if (isEditing) { String delTTStr = ResultSetController.createTooltip("DeleteRecordTT", view.getObjTitle()); String edtTTStr = ResultSetController.createTooltip("EditRecordTT", view.getObjTitle()); String newTTStr = ResultSetController.createTooltip("NewRecordTT", view.getObjTitle()); editBtn = UIHelper.createIconBtnTT("EditForm", IconManager.IconSize.Std16, edtTTStr, false, null); newBtn = UIHelper.createIconBtnTT("CreateObj", IconManager.IconSize.Std16, newTTStr, false, null); delBtn = UIHelper.createIconBtnTT("DeleteRecord", IconManager.IconSize.Std16, delTTStr, false, null); validationInfoBtn = FormViewObj.createValidationIndicator(mainComp, getValidator()); editBtn.setEnabled(false); delBtn.setEnabled(false); newBtn.setEnabled(true); } else { String srchTTStr = ResultSetController.createTooltip("ShowRecordInfoTT", view.getObjTitle()); viewBtn = UIHelper.createIconBtnTT("InfoIcon", IconManager.IconSize.Std16, srchTTStr, false, null); viewBtn.setEnabled(false); } altViewsList = new Vector<AltViewIFace>(); switcherUI = FormViewObj.createMenuSwitcherPanel(mvParent, view, altView, altViewsList, mainComp, cellName, dataClass); Dimension maxSize = Thumbnailer.getInstance().getMaxSize(); iconTray = new OrderedIconTray(IconTray.SINGLE_ROW, maxSize.width, maxSize.height); iconTray.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equalsIgnoreCase("item order")) { rootHasChanged(); } } }); iconTray.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 1) { updateEnableUI(); } else if (e.getClickCount() > 1) { doDoubleClick(); } } @Override public void mousePressed(MouseEvent e) { if (e.isPopupTrigger()) { showContextMenu(e); } } }); iconTray.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { updateEnableUI(); } } }); if (isEditing) { addActionListenerToEditButton(); addActionListenerToNewButton(); addActionListenerToDeleteButton(); IconViewTransferHandler ivth = new IconViewTransferHandler(this); iconTray.setTransferHandler(ivth); } else { addActionListenerToViewButton(); } mainComp = new RestrictablePanel(); mainComp.setLayout(new BorderLayout()); if (mvParent == null) { mainComp.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); } boolean isAbove = mvParent.getSeparator() != null; int defCnt = (isEditing ? 3 : 1) + (switcherUI != null ? 1 : 0) + (validationInfoBtn != null ? 1 : 0); String colDef = (isAbove ? "1px," : "f:1px:g,") + UIHelper.createDuplicateJGoodiesDef("p", "1px", defCnt); PanelBuilder builder = new PanelBuilder(new FormLayout(colDef, "p")); CellConstraints cc = new CellConstraints(); int x = 2; if (isEditing) { builder.add(editBtn, cc.xy(x, 1)); x += 2; builder.add(newBtn, cc.xy(x, 1)); x += 2; builder.add(delBtn, cc.xy(x, 1)); x += 2; if (validationInfoBtn != null) // is null when genrating form images { builder.add(validationInfoBtn, cc.xy(x, 1)); x += 2; } } else { builder.add(viewBtn, cc.xy(x, 1)); x += 2; } if (switcherUI != null) { builder.add(switcherUI, cc.xy(x, 1)); x += 2; } if (isAbove) { sepController = builder.getPanel(); } else { southPanel = builder.getPanel(); mainComp.add(southPanel, BorderLayout.SOUTH); } mainComp.add(iconTray, BorderLayout.CENTER); }
From source file:ome.formats.importer.gui.GuiImporter.java
public void update(IObservable importLibrary, ImportEvent event) { // Keep alive has failed, call logout if (event instanceof ImportEvent.LOGGED_OUT) { logout();/* w ww .ja v a2 s. co m*/ showLogoutMessage(); } if (event instanceof ImportEvent.LOADING_IMAGE) { ImportEvent.LOADING_IMAGE ev = (ImportEvent.LOADING_IMAGE) event; getStatusBar().setProgress(true, -1, "Loading file " + ev.numDone + " of " + ev.total); appendToOutput("> [" + ev.index + "] Loading image \"" + ev.shortName + "\"...\n"); getStatusBar().setStatusIcon("gfx/import_icon_16.png", "Prepping file \"" + ev.shortName); } else if (event instanceof ImportEvent.LOADED_IMAGE) { ImportEvent.LOADED_IMAGE ev = (ImportEvent.LOADED_IMAGE) event; getStatusBar().setProgress(true, -1, "Analyzing file " + ev.numDone + " of " + ev.total); appendToOutput(" Succesfully loaded.\n"); appendToOutput("> [" + ev.index + "] Importing metadata for " + "image \"" + ev.shortName + "\"... "); getStatusBar().setStatusIcon("gfx/import_icon_16.png", "Analyzing the metadata for file \"" + ev.shortName); } else if (event instanceof ImportEvent.BEGIN_SAVE_TO_DB) { ImportEvent.BEGIN_SAVE_TO_DB ev = (ImportEvent.BEGIN_SAVE_TO_DB) event; appendToOutput("> [" + ev.index + "] Saving metadata for " + "image \"" + ev.filename + "\"... "); getStatusBar().setStatusIcon("gfx/import_icon_16.png", "Saving metadata for file \"" + ev.filename); } else if (event instanceof ImportEvent.DATASET_STORED) { ImportEvent.DATASET_STORED ev = (ImportEvent.DATASET_STORED) event; int num = ev.numDone; int tot = ev.total; int pro = num - 1; appendToOutputLn("Successfully stored to " + ev.target.getClass().getSimpleName() + " \"" + ev.filename + "\" with id \"" + ev.target.getId().getValue() + "\"."); appendToOutputLn( "> [" + ev.series + "] Importing pixel data for " + "image \"" + ev.filename + "\"... "); getStatusBar().setProgress(true, 0, "Importing file " + num + " of " + tot); getStatusBar().setProgressValue(pro); getStatusBar().setStatusIcon("gfx/import_icon_16.png", "Importing the pixel data for file \"" + ev.filename); appendToOutput("> Importing plane: "); } else if (event instanceof ImportEvent.DATA_STORED) { ImportEvent.DATA_STORED ev = (ImportEvent.DATA_STORED) event; appendToOutputLn("> Successfully stored with pixels id \"" + ev.pixId + "\"."); appendToOutputLn("> [" + ev.filename + "] Image imported successfully!"); } else if (event instanceof FILE_EXCEPTION) { FILE_EXCEPTION ev = (FILE_EXCEPTION) event; if (IOException.class.isAssignableFrom(ev.exception.getClass())) { final JOptionPane optionPane = new JOptionPane( "The importer cannot retrieve one of your images in a timely manner.\n" + "The file in question is:\n'" + ev.filename + "'\n\n" + "There are a number of reasons you may see this error:\n" + " - The file has been deleted.\n" + " - There was a networking error retrieving a remotely saved file.\n" + " - An archived file has not been fully retrieved from backup.\n\n" + "The importer should now continue with the remainer of your imports.\n", JOptionPane.ERROR_MESSAGE); final JDialog dialog = new JDialog(this, "IO Error"); dialog.setAlwaysOnTop(true); dialog.setContentPane(optionPane); dialog.pack(); dialog.setVisible(true); optionPane.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (dialog.isVisible() && (e.getSource() == optionPane) && (prop.equals(JOptionPane.VALUE_PROPERTY))) { dialog.dispose(); } } }); } } else if (event instanceof EXCEPTION_EVENT) { EXCEPTION_EVENT ev = (EXCEPTION_EVENT) event; log.error("EXCEPTION_EVENT", ev.exception); } else if (event instanceof INTERNAL_EXCEPTION) { INTERNAL_EXCEPTION e = (INTERNAL_EXCEPTION) event; log.error("INTERNAL_EXCEPTION", e.exception); // What else should we do here? Why are EXCEPTION_EVENTs being // handled here? } else if (event instanceof ImportEvent.ERRORS_PENDING) { tPane.setIconAt(4, GuiCommonElements.getImageIcon(ERROR_ICON_ANIM)); errors_pending = true; error_notification = true; } else if (event instanceof ImportEvent.ERRORS_COMPLETE) { tPane.setIconAt(4, GuiCommonElements.getImageIcon(ERROR_ICON)); error_notification = false; } else if (event instanceof ImportEvent.ERRORS_COMPLETE) { tPane.setIconAt(4, GuiCommonElements.getImageIcon(ERROR_ICON)); error_notification = false; } else if (event instanceof ImportEvent.ERRORS_FAILED) { sendingErrorsFailed(this); } else if (event instanceof ImportEvent.IMPORT_QUEUE_DONE && errors_pending == true) { errors_pending = false; importErrorsCollected(this); } }
From source file:net.sf.jabref.EntryEditor.java
/** * Update the JTextArea when a field has changed. * //from ww w. jav a2 s . c om * @see java.beans.VetoableChangeListener#vetoableChange(java.beans.PropertyChangeEvent) */ public void vetoableChange(PropertyChangeEvent e) { String newValue = ((e.getNewValue() != null) ? e.getNewValue().toString() : ""); setField(e.getPropertyName(), newValue); }
From source file:org.jitsi.android.gui.call.VideoCallActivity.java
public void propertyChange(PropertyChangeEvent evt) { /*/* w ww. j ava 2 s. co m*/ * If a Call is added to or removed from the CallConference depicted * by this CallPanel, an update of the view from its model will most * likely be required. */ if (evt.getPropertyName().equals(CallConference.CALLS)) onCallConferenceEventObject(evt); }
From source file:org.tinymediamanager.core.movie.MovieList.java
/** * Instantiates a new movie list./*from w ww . j a va2 s . co m*/ */ private MovieList() { // create all lists tagsObservable = ObservableCollections.observableList(new CopyOnWriteArrayList<String>()); videoCodecsObservable = ObservableCollections.observableList(new CopyOnWriteArrayList<String>()); audioCodecsObservable = ObservableCollections.observableList(new CopyOnWriteArrayList<String>()); certificationsObservable = ObservableCollections.observableList(new CopyOnWriteArrayList<Certification>()); // the tag listener: its used to always have a full list of all tags used in tmm tagListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { // listen to changes of tags if ("tag".equals(evt.getPropertyName())) { Movie movie = (Movie) evt.getSource(); updateTags(movie); } if (MEDIA_FILES.equals(evt.getPropertyName()) || MEDIA_INFORMATION.equals(evt.getPropertyName())) { Movie movie = (Movie) evt.getSource(); updateMediaInformationLists(movie); } if (CERTIFICATION.equals(evt.getPropertyName())) { Movie movie = (Movie) evt.getSource(); updateCertifications(movie); } } }; movieSettings = MovieModuleManager.MOVIE_SETTINGS; }
From source file:com.googlecode.vfsjfilechooser2.plaf.metal.MetalVFSFileChooserUI.java
@Override public PropertyChangeListener createPropertyChangeListener(VFSJFileChooser fc) { return new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String s = e.getPropertyName(); if (s.equals(VFSJFileChooserConstants.SELECTED_FILE_CHANGED_PROPERTY)) { doSelectedFileChanged(e); } else if (s.equals(VFSJFileChooserConstants.SELECTED_FILES_CHANGED_PROPERTY)) { doSelectedFilesChanged(e); } else if (s.equals(VFSJFileChooserConstants.DIRECTORY_CHANGED_PROPERTY)) { doDirectoryChanged(e);//w w w .java 2 s.c o m } else if (s.equals(VFSJFileChooserConstants.FILE_FILTER_CHANGED_PROPERTY)) { doFilterChanged(e); } else if (s.equals(VFSJFileChooserConstants.FILE_SELECTION_MODE_CHANGED_PROPERTY)) { doFileSelectionModeChanged(e); } else if (s.equals(VFSJFileChooserConstants.ACCESSORY_CHANGED_PROPERTY)) { doAccessoryChanged(e); } else if (s.equals(VFSJFileChooserConstants.APPROVE_BUTTON_TEXT_CHANGED_PROPERTY) || s.equals(VFSJFileChooserConstants.APPROVE_BUTTON_TOOL_TIP_TEXT_CHANGED_PROPERTY)) { doApproveButtonTextChanged(e); } else if (s.equals(VFSJFileChooserConstants.DIALOG_TYPE_CHANGED_PROPERTY)) { doDialogTypeChanged(e); } else if (s.equals(VFSJFileChooserConstants.APPROVE_BUTTON_MNEMONIC_CHANGED_PROPERTY)) { doApproveButtonMnemonicChanged(e); } else if (s.equals(VFSJFileChooserConstants.CONTROL_BUTTONS_ARE_SHOWN_CHANGED_PROPERTY)) { doControlButtonsChanged(e); } else if (s.equals("componentOrientation")) { ComponentOrientation o = (ComponentOrientation) e.getNewValue(); VFSJFileChooser cc = (VFSJFileChooser) e.getSource(); if (o != (ComponentOrientation) e.getOldValue()) { cc.applyComponentOrientation(o); } } else if (s.equals("FileChooser.useShellFolder")) { updateUseShellFolder(); doDirectoryChanged(e); } else if (s.equals("ancestor")) { if ((e.getOldValue() == null) && (e.getNewValue() != null)) { // Ancestor was added, set initial focus fileNameTextField.selectAll(); fileNameTextField.requestFocus(); } } } }; }