List of usage examples for java.beans PropertyChangeEvent getNewValue
public Object getNewValue()
From source file:com.dfki.av.sudplan.ui.MainFrame.java
@Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(EventHolder.LAYERINFO_RETREIVAL_COMPLETE)) { pbWMS.setIndeterminate(false);// www . j av a2 s . co m pbWMS.setVisible(false); cLayerList.removeAllItems(); if (evt.getNewValue() instanceof List<?>) { for (LayerInfo layerInfo : (List<LayerInfo>) evt.getNewValue()) { cLayerList.addItem(layerInfo); } } else if (evt.getNewValue() instanceof LayerInfo) { cLayerList.addItem((LayerInfo) evt.getNewValue()); } else { log.error("Wrong event value (not instanceof LayerInfo or List<LayerInfo>)"); } cLayerList.setEnabled(true); bAddWMSHeight.setEnabled(true); bGoWMSHeight.setEnabled(true); } if (evt.getPropertyName().equals(EventHolder.LAYERINFO_RETREIVAL_FAILED)) { resetWMSHeightDialog(); JOptionPane.showMessageDialog(dWMSHeight, "Could not retreive WMS data from server.", "WMS-Server Error", JOptionPane.WARNING_MESSAGE); } }
From source file:org.formic.wizard.impl.console.ConsoleWizard.java
/** * {@inheritDoc}/* ww w. j ava 2 s . com*/ * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(Wizard.ACTIVE_STEP)) { MultiPathModel model = (MultiPathModel) getModel(); org.pietschy.wizard.WizardStep step = model.getActiveStep(); // update step listening. if (activeStep != null) { activeStep.removePropertyChangeListener(this); } activeStep = step; activeStep.addPropertyChangeListener(this); if (step != null) { updateView(((ConsoleWizardStep) activeStep).getConsoleView()); WizardStep ws = ((ConsoleWizardStep) step).getStep(); updateButtonStatus(model, ws, step); // notify step that it is displayed. ws.displayed(); } } else if (evt.getPropertyName().equals(WizardStep.CANCEL)) { boolean cancelEnabled = ((Boolean) evt.getNewValue()).booleanValue(); cancelButton.setEnabled(cancelEnabled); } else if (evt.getPropertyName().equals(WizardStep.PREVIOUS)) { boolean previousEnabled = ((Boolean) evt.getNewValue()).booleanValue(); previousButton.setEnabled(previousEnabled); } else if (evt.getPropertyName().equals(WizardStep.VALID) || evt.getPropertyName().equals(WizardStep.BUSY)) { MultiPathModel model = (MultiPathModel) getModel(); org.pietschy.wizard.WizardStep step = model.getActiveStep(); final WizardStep ws = ((ConsoleWizardStep) step).getStep(); boolean nextEnabled = ws.isValid() && !ws.isBusy() && !model.isLastStep(step); nextButton.setEnabled(nextEnabled); // show inifinite wait for busy state. if (evt.getPropertyName().equals(WizardStep.BUSY) && ws.isBusyAnimated()) { final boolean busy = ((Boolean) evt.getNewValue()).booleanValue(); SwingUtilities.invokeLater(new Runnable() { public void run() { if (busy) { hiddenPanel = (JPanel) viewPanel.getComponents()[0]; updateView(new BusyPanel(ws)); } else { updateView(hiddenPanel); hiddenPanel = null; } } }); } } }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Creates the menu displaying the groups and users. * //w w w. java 2 s. co m * @param source The invoker. * @param p The location of the mouse clicked. */ private void createGroupsAndUsersMenu(Component source, Point p) { if (!source.isEnabled()) return; Collection groups = model.getGroups(); if (CollectionUtils.isEmpty(groups)) return; popupMenu.removeAll(); GroupData group; List sortedGroups = sorter.sort(groups); //Determine the group already displayed. Browser browser = model.getBrowser(Browser.PROJECTS_EXPLORER); List<TreeImageDisplay> nodes; ExperimenterVisitor visitor; //Find the user already added to the selected group. visitor = new ExperimenterVisitor(browser, -1); browser.accept(visitor); nodes = visitor.getNodes(); Iterator<TreeImageDisplay> k = nodes.iterator(); List<Long> groupIds = new ArrayList<Long>(); long id; while (k.hasNext()) { id = k.next().getUserObjectId(); if (id >= 0) groupIds.add(id); } //Create the group menu. Iterator i = sortedGroups.iterator(); int size = sortedGroups.size(); long userID = model.getExperimenter().getId(); //First add item to toggle between users and group display DataMenuItem data = new DataMenuItem(DataMenuItem.USERS_TEXT, null); data.setSelected(model.getDisplayMode() == LookupNames.EXPERIMENTER_DISPLAY); data.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (DataMenuItem.ITEM_SELECTED_PROPERTY.equals(name)) { DataMenuItem data = (DataMenuItem) evt.getNewValue(); handleSelectionDisplay(data.isSelected()); } } }); JPanel panel = new JPanel(); panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0)); panel.setBorder(null); IconManager icons = IconManager.getInstance(); panel.add(new JLabel(icons.getIcon(IconManager.TRANSPARENT))); panel.add(data); popupMenu.add(panel); popupMenu.add(new JSeparator()); GroupItem item; GroupItem allGroup = null; //First add option to add all the groups. if (size > 1) { item = new GroupItem(false); item.setUserID(userID); createGroupMenu(item, 0); popupMenu.add(item); popupMenu.add(new JSeparator()); allGroup = item; } boolean selected; int count = 0; while (i.hasNext()) { group = (GroupData) i.next(); boolean b = groupIds.contains(group.getId()); item = new GroupItem(group, b, size > 1); item.setUserID(userID); selected = createGroupMenu(item, size); popupMenu.add(item); if (selected) count++; } if (allGroup != null) { allGroup.setMenuSelected(count == sortedGroups.size(), false); } popupMenu.show(source, p.x, p.y); }
From source file:org.datavyu.controllers.component.MixerController.java
@Override public void propertyChange(final PropertyChangeEvent evt) { if (evt.getSource() == mixerModel.getViewportModel()) { final ViewportState oldViewport = (evt.getOldValue() instanceof ViewportState) ? (ViewportState) evt.getOldValue() : null;// w w w . j a va 2s .c o m final ViewportState newViewport = (evt.getNewValue() instanceof ViewportState) ? (ViewportState) evt.getNewValue() : null; handleViewportChanged(oldViewport, newViewport); } }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorControl.java
/** Brings up the folder chooser. */ private void download() { JFrame f = MetadataViewerAgent.getRegistry().getTaskBar().getFrame(); List<DataObject> list = view.getSelectedObjects(); ImageData image = view.getImage();//from ww w .j av a2 s . c om int type = FileChooser.SAVE; List<String> paths = new ArrayList<String>(); if (list != null && list.size() > 1) { type = FileChooser.FOLDER_CHOOSER; Iterator<DataObject> i = list.iterator(); DataObject data; while (i.hasNext()) { data = i.next(); if (data instanceof ImageData) { paths.add(FilenameUtils.getName(((ImageData) data).getName())); } } } FileChooser chooser = new FileChooser(f, type, FileChooser.DOWNLOAD_TEXT, FileChooser.DOWNLOAD_DESCRIPTION, null, true); try { File file = UIUtilities.getDefaultFolder(); if (file != null) chooser.setCurrentDirectory(file); } catch (Exception ex) { } if (type == FileChooser.SAVE) chooser.setSelectedFileFull(image.getName()); IconManager icons = IconManager.getInstance(); chooser.setTitleIcon(icons.getIcon(IconManager.DOWNLOAD_48)); chooser.setApproveButtonText(FileChooser.DOWNLOAD_TEXT); chooser.setCheckOverride(true); chooser.setSelectedFiles(paths); chooser.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); FileChooser src = (FileChooser) evt.getSource(); if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) { File path = null; if (src.getChooserType() == FileChooser.FOLDER_CHOOSER) { path = new File((String) evt.getNewValue()); } else { File[] files = (File[]) evt.getNewValue(); if (files == null || files.length == 0) return; path = files[0]; } if (path == null) { path = UIUtilities.getDefaultFolder(); } model.download(path, src.isOverride()); } } }); chooser.centerDialog(); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorComponent.java
/** * Implemented as specified by the {@link Editor} interface. * @see Editor#analysisResultsLoaded(AnalysisResultsItem) */// w w w . j ava 2 s . 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.apache.catalina.core.NamingContextListener.java
/** * Process property change events. Currently, only listens to such events * on the <code>NamingResources</code> instance for the global naming * resources./*from w ww. j a v a 2 s . co m*/ * * @param event The property change event that has occurred */ public void propertyChange(PropertyChangeEvent event) { if (!initialized) return; Object source = event.getSource(); if (source == namingResources) { // Setting the context in read/write mode ContextAccessController.setWritable(getName(), container); processGlobalResourcesChange(event.getPropertyName(), event.getOldValue(), event.getNewValue()); // Setting the context in read only mode ContextAccessController.setReadOnly(getName()); } }
From source file:org.isatools.isacreatorconfigurator.configui.DataEntryPanel.java
/** * Create the files necessary for loading into ISAcreator * * @throws IOException - When file cannot be found. Should never be thrown *//*from w w w .ja v a 2s . co m*/ private void createOutput() throws IOException { ExportConfigurationDialog exportDialog = new ExportConfigurationDialog(); exportDialog.createGUI(); applicationContainer.showJDialogAsSheet(exportDialog); exportDialog.addPropertyChangeListener("save", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { final String saveIn = propertyChangeEvent.getNewValue().toString(); SwingUtilities.invokeLater(new Runnable() { public void run() { applicationContainer.hideSheet(); try { showMessagePane(Utils.createTableConfigurationXML(saveIn, tableFields), JOptionPane.INFORMATION_MESSAGE); sourceFile = new File(saveIn); } catch (DataNotCompleteException e) { showMessagePane(e.getMessage(), JOptionPane.ERROR_MESSAGE); } catch (InvalidFieldOrderException ifoe) { showMessagePane(ifoe.getMessage(), JOptionPane.ERROR_MESSAGE); } catch (IOException ioe) { showMessagePane(ioe.getMessage(), JOptionPane.ERROR_MESSAGE); } } }); } }); exportDialog.addPropertyChangeListener("windowClosed", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { SwingUtilities.invokeLater(new Runnable() { public void run() { applicationContainer.hideSheet(); } }); } }); applicationContainer.showJDialogAsSheet(exportDialog); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorUI.java
/** * Returns the collection of attachments. * /*from w w w .j a v a 2 s . co m*/ * @param src The source of the mouse pressed. * @param location The location of the mouse pressed. */ void removeAttachedFiles(Component src, Point location) { if (!generalPane.hasAttachmentsToUnlink()) return; if (model.isAdministrator() || model.isGroupLeader()) { if (docMenu == null) { docMenu = new PermissionMenu(PermissionMenu.REMOVE, "Attachments"); docMenu.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { String n = evt.getPropertyName(); if (PermissionMenu.SELECTED_LEVEL_PROPERTY.equals(n)) { List<FileAnnotationData> toRemove = model .getFileAnnotatationsByLevel((Integer) evt.getNewValue()); model.fireFileAnnotationRemoveCheck(toRemove); } } }); } docMenu.show(src, location.x, location.y); return; } SwingUtilities.convertPointToScreen(location, src); MessageBox box = new MessageBox(model.getRefFrame(), "Remove All Attachments", "Are you sure you want to remove all Attachments?"); Dimension d = box.getPreferredSize(); Point p = new Point(location.x - d.width / 2, location.y); if (box.showMsgBox(p) == MessageBox.YES_OPTION) { List<FileAnnotationData> list = generalPane.removeAttachedFiles(); if (list.size() > 0) model.fireFileAnnotationRemoveCheck(list); } }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorControl.java
/** * Reacts to property change./*from ww w. ja v a 2 s . c o m*/ * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (SAVE_PROPERTY.equals(name) || DataComponent.DATA_MODIFIED_PROPERTY.equals(name) || PreviewPanel.PREVIEW_EDITED_PROPERTY.equals(name)) { view.setDataToSave(view.hasDataToSave()); } else if (MetadataViewer.SAVE_DATA_PROPERTY.equals(name)) { Boolean b = (Boolean) evt.getNewValue(); view.saveData(b.booleanValue()); } else if (MetadataViewer.CLEAR_SAVE_DATA_PROPERTY.equals(name) || MetadataViewer.ON_DATA_SAVE_PROPERTY.equals(name) || MetadataViewer.ADMIN_UPDATED_PROPERTY.equals(name)) { view.clearData(); } else if (UIUtilities.COLLAPSED_PROPERTY_JXTASKPANE.equals(name)) { view.handleTaskPaneCollapsed((JXTaskPane) evt.getSource()); } else if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) { File[] files = (File[]) evt.getNewValue(); view.attachFiles(files); } else if (AnnotationUI.REMOVE_ANNOTATION_PROPERTY.equals(name)) { Object object = evt.getNewValue(); if (object instanceof DocComponent) { DocComponent doc = (DocComponent) object; Object data = doc.getData(); if (data instanceof FileAnnotationData) { model.removeFileAnnotations(Collections.singletonList((FileAnnotationData) data)); } else if (data instanceof TagAnnotationData || data instanceof TermAnnotationData || data instanceof XMLAnnotationData || data instanceof LongAnnotationData || data instanceof DoubleAnnotationData || data instanceof BooleanAnnotationData) view.removeObject((DataObject) data); } else if (object instanceof TextualAnnotationComponent) { TextualAnnotationComponent doc = (TextualAnnotationComponent) object; view.removeObject(doc.getData()); } } else if (AnnotationUI.EDIT_TAG_PROPERTY.equals(name)) { Object object = evt.getNewValue(); if (object instanceof DocComponent) { //Save the tag w/o update. DataObject d = (DataObject) ((DocComponent) object).getData(); //Save the tag OmeroMetadataService svc = MetadataViewerAgent.getRegistry().getMetadataService(); long id = MetadataViewerAgent.getUserDetails().getId(); try { svc.saveData(model.getSecurityContext(), Arrays.asList(d), null, null, id); } catch (Exception e) { Logger l = MetadataViewerAgent.getRegistry().getLogger(); LogMessage msg = new LogMessage(); msg.print("Saving object"); msg.print(e); l.error(this, msg); } } } else if (OMEWikiComponent.WIKI_DATA_OBJECT_PROPERTY.equals(name)) { WikiDataObject object = (WikiDataObject) evt.getNewValue(); long id; switch (object.getIndex()) { case WikiDataObject.IMAGE: id = object.getId(); if (id < 0) viewImage(object.getName()); else viewImage(id); break; case WikiDataObject.PROTOCOL: viewProtocol(object.getId()); break; } } else if (SelectionWizard.SELECTED_ITEMS_PROPERTY.equals(name)) { Map m = (Map) evt.getNewValue(); if (m == null || m.size() != 1) return; Set set = m.entrySet(); Entry entry; Iterator i = set.iterator(); Class type; while (i.hasNext()) { entry = (Entry) i.next(); type = (Class) entry.getKey(); view.handleObjectsSelection(type, (Collection) entry.getValue()); } } else if (PreviewPanel.OPEN_FILE_PROPERTY.equals(name)) { Long id = (Long) evt.getNewValue(); if (id != null) viewProtocol(id.longValue()); } else if (MetadataViewer.SETTINGS_APPLIED_PROPERTY.equals(name)) { model.loadRenderingControl(RenderingControlLoader.RELOAD); view.onSettingsApplied(true); } else if (MetadataViewer.ACTIVITY_OPTIONS_PROPERTY.equals(name)) { List l = (List) evt.getNewValue(); view.activityOptions((Component) l.get(0), (Point) l.get(1), (Integer) l.get(2)); } else if (FigureDialog.CREATE_FIGURE_PROPERTY.equals(name)) { view.createFigure(evt.getNewValue()); } else if (FigureDialog.CLOSE_FIGURE_PROPERTY.equals(name)) { figureDialog = null; } else if (MetadataViewer.CLOSE_RENDERER_PROPERTY.equals(name)) { view.discardRenderer(evt.getNewValue()); } else if (MetadataViewer.RELATED_NODES_PROPERTY.equals(name)) { view.onRelatedNodesSet(); } else if (ScriptingDialog.RUN_SELECTED_SCRIPT_PROPERTY.equals(name)) { //view.manageScript((ScriptObject) evt.getNewValue(), // MetadataViewer.RUN); } else if (ScriptingDialog.DOWNLOAD_SELECTED_SCRIPT_PROPERTY.equals(name)) { Object value = evt.getNewValue(); if (value instanceof ScriptObject) view.manageScript((ScriptObject) value, MetadataViewer.DOWNLOAD); else if (value instanceof String) { ScriptObject script = view.getScriptFromName((String) value); if (script != null) view.manageScript(script, MetadataViewer.DOWNLOAD); } } else if (ScriptingDialog.VIEW_SELECTED_SCRIPT_PROPERTY.equals(name)) { Object value = evt.getNewValue(); if (value instanceof ScriptObject) view.manageScript((ScriptObject) value, MetadataViewer.VIEW); else if (value instanceof String) { ScriptObject script = view.getScriptFromName((String) value); if (script != null) view.manageScript(script, MetadataViewer.VIEW); } } else if (AnalysisResultsItem.ANALYSIS_RESULTS_DELETE.equals(name)) { AnalysisResultsItem item = (AnalysisResultsItem) evt.getNewValue(); List<FileAnnotationData> list = item.getAttachments(); view.fireAnnotationsDeletion(list); } else if (AnalysisResultsItem.ANALYSIS_RESULTS_VIEW.equals(name)) { AnalysisResultsItem item = (AnalysisResultsItem) evt.getNewValue(); if (view.getRndIndex() == MetadataViewer.RND_GENERAL) { model.displayAnalysisResults(item); /* ViewImage event = new ViewImage(item.getData(), null); event.setAnalysis(item); EventBus bus = MetadataViewerAgent.getRegistry().getEventBus(); bus.post(event); */ } else { model.displayAnalysisResults(item); } } else if (AnalysisResultsItem.ANALYSIS_RESULTS_CANCEL.equals(name)) { AnalysisResultsItem item = (AnalysisResultsItem) evt.getNewValue(); view.cancelAnalysisResultsLoading(item); } }