List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:org.talend.designer.runprocess.ui.views.ProcessView.java
@Override public void createPartControl(Composite parent) { this.parent = parent; parent.setLayout(new FillLayout()); sash = new SashForm(parent, SWT.HORIZONTAL | SWT.SMOOTH); sash.setLayoutData(new GridData(GridData.FILL_BOTH)); sash.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); GridLayout layout = new GridLayout(); sash.setLayout(layout);/*from w w w .j ava2s. co m*/ Composite left = new Composite(sash, SWT.NONE); left.setLayout(new FillLayout()); Composite right = new Composite(sash, SWT.NONE); right.setLayout(new FormLayout()); FormData layouDatag = new FormData(); layouDatag.left = new FormAttachment(0, 0); layouDatag.width = 32; layouDatag.top = new FormAttachment(0, 0); layouDatag.bottom = new FormAttachment(100, 0); final Composite buttonComposite = new Composite(right, SWT.ERROR); buttonComposite.setLayoutData(layouDatag); buttonComposite.setLayout(new GridLayout()); Composite cotextCom = new Composite(right, SWT.NONE); layouDatag = new FormData(); layouDatag.left = new FormAttachment(0, 32); layouDatag.right = new FormAttachment(100, 0); layouDatag.top = new FormAttachment(0, 0); layouDatag.bottom = new FormAttachment(100, 0); cotextCom.setLayoutData(layouDatag); cotextCom.setLayout(new GridLayout()); tabFactory.initComposite(left, false); moveButton = new Button(buttonComposite, SWT.PUSH); moveButton.setText(">>"); //$NON-NLS-1$ moveButton.setToolTipText(Messages.getString("ProcessComposite.hideContext")); final GridData layoutData = new GridData(); layoutData.verticalAlignment = GridData.CENTER; layoutData.horizontalAlignment = GridData.CENTER; layoutData.grabExcessHorizontalSpace = true; layoutData.grabExcessVerticalSpace = true; moveButton.setLayoutData(layoutData); addListeners(); sash.setSashWidth(5); sash.setWeights(new int[] { 18, 5 }); contextComposite = new ProcessContextComposite(cotextCom, SWT.NONE); contextComposite.setBackground(right.getDisplay().getSystemColor(SWT.COLOR_WHITE)); // processComposite = new ProcessComposite(tabFactory.getTabComposite(), SWT.H_SCROLL | SWT.V_SCROLL | // SWT.NO_FOCUS); // dc = processComposite; // createBasicComposite(tabFactory.getTabComposite(), element, null); tabFactory.getTabComposite().layout(); tabFactory.addSelectionChangedListener(new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); TalendPropertyTabDescriptor descriptor = (TalendPropertyTabDescriptor) selection.getFirstElement(); if (descriptor == null) { return; } if (currentSelectedTab != null && (currentSelectedTab.getCategory() != descriptor.getCategory())) { for (Control curControl : tabFactory.getTabComposite().getChildren()) { curControl.dispose(); } } if (currentSelectedTab == null || currentSelectedTab.getCategory() != descriptor.getCategory() || selectedPrimary) { currentSelectedTab = descriptor; selectedPrimary = false; createDynamicComposite(tabFactory.getTabComposite(), (Element) descriptor.getData(), descriptor.getCategory()); } } }); setElement(); IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class); IHandler handler1; IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault() .getService(IBrandingService.class); if (brandingService.getBrandingConfiguration().isAllowDebugMode()) { Action debugAction = new DebugAction(); handler1 = new ActionHandler(debugAction); handlerService.activateHandler(debugAction.getActionDefinitionId(), handler1); } Action killAction = new KillAction(); handler1 = new ActionHandler(killAction); handlerService.activateHandler(killAction.getActionDefinitionId(), handler1); FocusListener fl = new FocusListener() { @Override public void focusGained(FocusEvent e) { log.trace(Messages.getString("ProcessView.gainFocusLog")); //$NON-NLS-1$ IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench() .getAdapter(IContextService.class); ca = contextService.activateContext("talend.runProcess"); //$NON-NLS-1$ } @Override public void focusLost(FocusEvent e) { log.trace(Messages.getString("ProcessView.lostFocusLog")); //$NON-NLS-1$ if (ca != null) { IContextService contextService = (IContextService) RunProcessPlugin.getDefault().getWorkbench() .getAdapter(IContextService.class); contextService.deactivateContext(ca); } } }; addListenerOnChildren(parent, fl); rubjobManager.setProcessShell(getSite().getShell()); contextManagerListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (RunProcessContextManager.PROP_ACTIVE.equals(evt.getPropertyName())) { // rubjobManager.setBooleanTrace(false); runningProcessChanged(); } } }; RunProcessPlugin.getDefault().getRunProcessContextManager() .addPropertyChangeListener(contextManagerListener); runAction = new RunAction(); }
From source file:org.shaman.rpg.editor.dialog.DialogVisualElement.java
public DialogVisualElement(Lookup lkp) { obj = lkp.lookup(DialogDataObject.class); assert obj != null; undoRedo = new UndoRedo.Manager(); undoRedo.addChangeListener(new ChangeListener() { @Override//www . ja v a2 s .c o m public void stateChanged(ChangeEvent e) { obj.setModified(true); } }); initComponents(); contentPanel = new JPanel() { @Override public void paint(Graphics g) { super.paint(g); for (JComponent c : overlayComponents) { c.setBounds(this.getBounds()); c.paint(g); } } }; contentPanel.setLayout(new VerticalFlowLayout(GAP_Y * 2)); contentPanel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { if (!e.isConsumed()) { requestFocus(); callback.requestActive(); } } }); personsList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { personsListSelectionEvent(); } }); removeButton.setEnabled(false); Action editNames = new EditListAction(); ListAction ls = new ListAction(personsList, editNames); personsList.getModel().addListDataListener(new ListDataListener() { @Override public void intervalAdded(ListDataEvent e) { updatePersons(); } @Override public void intervalRemoved(ListDataEvent e) { updatePersons(); } @Override public void contentsChanged(ListDataEvent e) { updatePersons(); } }); setupVisuals(); contentParent = new JPanel(); contentParent.setLayout(new BorderLayout()); // contentPanel.setBounds(contentPanel.getBounds()); // contentParent.setBounds(contentPanel.getBounds()); contentParent.add(contentPanel); scrollPane.setViewportView(contentParent); jumpListener = new JumpListener(this); dropListener = new DropListener(this); DropTarget dt = new DropTarget(contentParent, dropListener); contentParent.setDropTarget(dt); obj.getPrimaryFile().addFileChangeListener(new FileChangeAdapter() { @Override public void fileChanged(FileEvent fe) { refresh(); } }); obj.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (DataObject.PROP_MODIFIED.equals(evt.getPropertyName()) && callback != null) { if (obj.isModified()) { callback.updateTitle("<html><b>" + obj.getName() + "</b></html>"); } else { callback.updateTitle("<html>" + obj.getName() + "</html>"); } } } }); }
From source file:org.jitsi.videobridge.ConferenceSpeechActivity.java
/** * Notifies this instance that there was a change in the value of a property * of an object in which this instance is interested. * * @param ev a <tt>PropertyChangeEvent</tt> which specifies the object of * interest, the name of the property and the old and new values of that * property// w ww . ja v a 2 s . c o m */ @Override public void propertyChange(PropertyChangeEvent ev) { // Cease to execute as soon as the Conference expires. Conference conference = getConference(); if ((conference == null) || conference.isExpired()) return; String propertyName = ev.getPropertyName(); if (Conference.ENDPOINTS_PROPERTY_NAME.equals(propertyName)) { if (conference.equals(ev.getSource())) { synchronized (syncRoot) { endpointsChanged = true; maybeStartEventDispatcher(); } } } else if (DominantSpeakerIdentification.DOMINANT_SPEAKER_PROPERTY_NAME.equals(propertyName)) { DominantSpeakerIdentification dominantSpeakerIdentification = this.dominantSpeakerIdentification; if ((dominantSpeakerIdentification != null) && dominantSpeakerIdentification.equals(ev.getSource())) { // TODO Auto-generated method stub } } }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorControl.java
/** Download the original metadata.*/ private void downloadMetadata() { JFrame f = MetadataViewerAgent.getRegistry().getTaskBar().getFrame(); FileChooser chooser = new FileChooser(f, FileChooser.SAVE, "Download Metadata", "Download the metadata file.", null, true); chooser.setSelectedFileFull(FileAnnotationData.ORIGINAL_METADATA_NAME); chooser.setCheckOverride(true);/*from w w w . j ava 2 s .com*/ FileAnnotationData data = view.getOriginalMetadata(); String name = ""; if (data != null) name = data.getFileName(); else { ImageData img = view.getImage(); name = FilenameUtils.removeExtension(img.getName()); } chooser.setSelectedFileFull(name); chooser.setApproveButtonText("Download"); IconManager icons = IconManager.getInstance(); chooser.setTitleIcon(icons.getIcon(IconManager.DOWNLOAD_48)); chooser.addPropertyChangeListener(new PropertyChangeListener() { /** * Handles the download of the original files */ public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) { File[] files = (File[]) evt.getNewValue(); File folder = files[0]; if (folder == null) folder = UIUtilities.getDefaultFolder(); UserNotifier un = MetadataViewerAgent.getRegistry().getUserNotifier(); ImageData img = view.getImage(); if (img == null) return; IconManager icons = IconManager.getInstance(); DownloadActivityParam activity = new DownloadActivityParam(img.getId(), DownloadActivityParam.METADATA_FROM_IMAGE, folder, icons.getIcon(IconManager.DOWNLOAD_22)); un.notifyActivity(model.getSecurityContext(), activity); } } }); chooser.centerDialog(); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorControl.java
/** Brings up the folder chooser. */ private void export() { DowngradeChooser chooser = new DowngradeChooser(new RefWindow(), FileChooser.SAVE, "Export", "Select where to export the image as OME-TIFF.", exportFilters); try {/*from w w w .j av a 2 s .co m*/ String path = MetadataViewerAgent.getRegistry().getTaskBar() .getLibFileRelative(TransformsParser.SPECIFICATION + ".jar"); chooser.parseData(path); } catch (Exception e) { LogMessage msg = new LogMessage(); msg.print(e); MetadataViewerAgent.getRegistry().getLogger().debug(this, msg); } String s = UIUtilities.removeFileExtension(view.getRefObjectName()); chooser.setSelectedFileFull(s); chooser.setCheckOverride(true); chooser.setApproveButtonText("Export"); IconManager icons = IconManager.getInstance(); chooser.setTitleIcon(icons.getIcon(IconManager.EXPORT_AS_OMETIFF_48)); chooser.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) { File[] files = (File[]) evt.getNewValue(); File folder = files[0]; if (folder == null) folder = UIUtilities.getDefaultFolder(); Object src = evt.getSource(); Target target = null; if (src instanceof DowngradeChooser) { ((FileChooser) src).setVisible(false); ((FileChooser) src).dispose(); target = ((DowngradeChooser) src).getSelectedSchema(); } model.exportImageAsOMETIFF(folder, target); } else if (DowngradeChooser.HELP_DOWNGRADE_PROPERTY.equals(name)) { Registry reg = MetadataViewerAgent.getRegistry(); String url = (String) reg.lookup("HelpDowngrade"); reg.getTaskBar().openURL(url); } } }); chooser.centerDialog(); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.EditorControl.java
/** Brings up the folder chooser to select where to save the files. * /*from w w w . j a v a 2s .co m*/ * @param format One of the formats defined by <code>FigureParam</code>. * @see org.openmicroscopy.shoola.env.data.model.FigureParam */ void saveAs(final int format) { String v = FigureParam.FORMATS.get(format); JFrame f = MetadataViewerAgent.getRegistry().getTaskBar().getFrame(); List<FileFilter> filters = new ArrayList<FileFilter>(); switch (format) { case FigureParam.JPEG: filters.add(new JPEGFilter()); break; case FigureParam.PNG: filters.add(new PNGFilter()); break; case FigureParam.TIFF: filters.add(new TIFFFilter()); } FileChooser chooser = new FileChooser(f, FileChooser.FOLDER_CHOOSER, "Save As", "Select where to save locally the images as " + v, filters); try { File file = UIUtilities.getDefaultFolder(); if (file != null) chooser.setCurrentDirectory(file); } catch (Exception ex) { } String s = UIUtilities.removeFileExtension(view.getRefObjectName()); if (s != null && s.trim().length() > 0) chooser.setSelectedFile(s); chooser.setApproveButtonText("Save"); IconManager icons = IconManager.getInstance(); chooser.setTitleIcon(icons.getIcon(IconManager.SAVE_AS_48)); chooser.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) { String value = (String) evt.getNewValue(); File folder = null; if (StringUtils.isEmpty(value)) folder = UIUtilities.getDefaultFolder(); else folder = new File(value); Object src = evt.getSource(); if (src instanceof FileChooser) { ((FileChooser) src).setVisible(false); ((FileChooser) src).dispose(); } model.saveAs(folder, format); } } }); chooser.centerDialog(); }
From source file:org.openmicroscopy.shoola.env.ui.ActivityComponent.java
/** * Downloads the passed object is supported. * /* www .j a v a2s .co m*/ * @param text The text used if the object is not loaded. * @param object The object to handle. * @param folder Indicates where to download the file or <code>null</code>. */ void download(String text, Object object, File folder) { if (!(object instanceof FileAnnotationData || object instanceof OriginalFile)) return; int index = -1; if (text == null) text = ""; String name = ""; String description = ""; long dataID = -1; OriginalFile of = null; if (object instanceof FileAnnotationData) { FileAnnotationData data = (FileAnnotationData) object; if (data.isLoaded()) { name = data.getFileName(); description = data.getDescription(); of = (OriginalFile) data.getContent(); } else { of = null; dataID = data.getId(); index = DownloadActivityParam.FILE_ANNOTATION; if (text.length() == 0) text = "Annotation"; name = text + "_" + dataID; } } else { of = (OriginalFile) object; if (!of.isLoaded()) { dataID = of.getId().getValue(); index = DownloadActivityParam.ORIGINAL_FILE; if (text.length() == 0) text = "File"; name = text + "_" + dataID; of = null; } } final OriginalFile original = of; final int type = index; final String desc = description; final long id = dataID; if (folder != null) { if (original == null && type == -1) return; DownloadActivityParam activity; IconManager icons = IconManager.getInstance(registry); if (original != null) { activity = new DownloadActivityParam(original, folder, icons.getIcon(IconManager.DOWNLOAD_22)); } else { activity = new DownloadActivityParam(id, type, folder, icons.getIcon(IconManager.DOWNLOAD_22)); } activity.setLegend(desc); activity.setUIRegister(false); viewer.notifyActivity(ctx, activity); return; } JFrame f = registry.getTaskBar().getFrame(); FileChooser chooser = new FileChooser(f, FileChooser.SAVE, "Download", "Select where to download the file.", null, true, true); IconManager icons = IconManager.getInstance(registry); chooser.setTitleIcon(icons.getIcon(IconManager.DOWNLOAD_48)); chooser.setSelectedFileFull(name); chooser.setApproveButtonText("Download"); chooser.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (FileChooser.APPROVE_SELECTION_PROPERTY.equals(name)) { File[] files = (File[]) evt.getNewValue(); File folder = files[0]; if (original == null && type == -1) return; IconManager icons = IconManager.getInstance(registry); DownloadActivityParam activity; if (original != null) { activity = new DownloadActivityParam(original, folder, icons.getIcon(IconManager.DOWNLOAD_22)); } else { activity = new DownloadActivityParam(id, type, folder, icons.getIcon(IconManager.DOWNLOAD_22)); } activity.setLegend(desc); viewer.notifyActivity(ctx, activity); } } }); chooser.centerDialog(); }
From source file:edu.chalmers.dat255.audiobookplayer.view.MainActivity.java
/** * Whenever the model component changes, an event is received here. The new * value property of the event contains a reference to a copy of the model. * /*from w w w. j a v a 2s . c om*/ * @param event * Event object that contains information about the change. */ public void propertyChange(PropertyChangeEvent event) { if (event.getNewValue() instanceof Bookshelf) { // Get the model copy from the update Bookshelf bs = (Bookshelf) event.getNewValue(); // Update the fragments updateFragments(event.getPropertyName(), bs); } }
From source file:ca.sqlpower.sqlobject.SQLDatabase.java
/** * Listens for changes in DBCS properties, and resets this * SQLDatabase if a critical property (url, driver, username) * changes./*from www .j a v a 2s .c o m*/ */ public void propertyChange(PropertyChangeEvent e) { String pn = e.getPropertyName(); if ((e.getOldValue() == null && e.getNewValue() != null) || (e.getOldValue() != null && e.getNewValue() == null) || (e.getOldValue() != null && e.getNewValue() != null && !e.getOldValue().equals(e.getNewValue()))) { if ("url".equals(pn) || "driverClass".equals(pn) || "user".equals(pn)) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ reset(); } else if ("name".equals(pn)) { //$NON-NLS-1$ firePropertyChange("shortDisplayName", e.getOldValue(), e.getNewValue()); //$NON-NLS-1$ } } }
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();/*w ww . ja va2s.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(); }