List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:org.nbheaven.sqe.codedefects.dashboard.controlcenter.panels.Statistics.java
public void propertyChange(PropertyChangeEvent evt) { if (SQEManager.PROP_ACTIVE_PROJECT.equals(evt.getPropertyName())) { setActiveProject((Project) evt.getNewValue()); }/* w ww . j av a 2s.c om*/ updateView(); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.actions.TreeViewerAction.java
/** * Reacts to property changes//from ww w. j a v a 2 s. c o m * {@link Browser#SELECTED_TREE_NODE_DISPLAY_PROPERTY} * event fired by the {@link Browser} and to * the {@link TreeViewer#SELECTED_BROWSER_PROPERTY} event. * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (TreeViewer.SELECTED_BROWSER_PROPERTY.equals(name)) { onBrowserSelection((Browser) evt.getNewValue()); } else if (TreeViewer.DISPLAY_MODE_PROPERTY.equals(name)) { int displayMode = ((Integer) evt.getNewValue()).intValue(); switch (displayMode) { case TreeViewer.SEARCH_MODE: setEnabled(true); break; case TreeViewer.EXPLORER_MODE: setEnabled(true); Browser browser = model.getSelectedBrowser(); TreeImageDisplay v = null; if (browser != null) v = browser.getLastSelectedDisplay(); onBrowserStateChange(browser); onDisplayChange(v); break; } onDisplayMode(); } else if (TreeViewer.ON_COMPONENT_STATE_CHANGED_PROPERTY.equals(name) || TreeViewer.GROUP_CHANGED_PROPERTY.equals(name) || TreeViewer.SELECTION_PROPERTY.equals(name) || Browser.SELECTED_TREE_NODE_DISPLAY_PROPERTY.equals(name)) { Browser browser = model.getSelectedBrowser(); TreeImageDisplay v = null; if (browser != null) v = browser.getLastSelectedDisplay(); onDisplayChange(v); } else if (TreeViewer.IMPORT_PROPERTY.equals(name)) { onDataImport(); } }
From source file:com.moscaville.manager.TemplateManager.java
@PostConstruct private void init() { dataDirectory = Utility.getEnvironmentVariable(Utility.DATA_DIRECTORY, "."); template = new Template(); inputColumns = new ArrayList<>(); container = new BeanItemContainer<>(TemplateProperty.class, template.getList()); dataContainer = new IndexedContainer(); dataHeaders = new String[] {}; templateBeanItem = new BeanItem<>(template); template.addPropertyChangeListener((PropertyChangeEvent evt) -> { System.out.println(evt.getPropertyName()); if (Template.PROP_TEMPLATEFILENAME.equals(evt.getPropertyName())) { loadTemplate();/*from ww w .j a v a 2 s .c o m*/ } else if (Template.PROP_DATAFILENAME.equals(evt.getPropertyName())) { readCsvData(); } }); }
From source file:org.wsm.database.tools.editor.ui.GraphPane.java
public void propertyChange(PropertyChangeEvent evt) { if (qesi.getLtrAddedFiringPropName().equals(evt.getPropertyName())) { LoadTestResult ltr = (LoadTestResult) evt.getNewValue(); dcd.addValue(new Double(ltr.getQt().getQueryExecutionTime()).doubleValue() / 1000, "Time for query execution", String.valueOf(ltr.getThreadNumber())); dcd.addValue(new Double(ltr.getQt().getConnectionCreationTime()).doubleValue() / 1000, "Time to create connection", String.valueOf(ltr.getThreadNumber())); if (dcd.getColumnCount() > 1) { if (!viewLineGraph.isEnabled()) viewLineGraph.setEnabled(true); }/*from w w w. j av a2 s. co m*/ } }
From source file:ec.ui.view.res.ResidualsView.java
private void enableProperties() { this.addPropertyChangeListener(new PropertyChangeListener() { @Override//from w w w . ja v a 2 s.c o m public void propertyChange(PropertyChangeEvent evt) { switch (evt.getPropertyName()) { case "componentPopupMenu": onComponentPopupMenuChange(); break; } } }); }
From source file:com.sshtools.appframework.api.ui.ActionBuilder.java
protected void rebuildContextMenu(Collection<AppAction> enabledActions) { contextMenu.invalidate();/*from w ww. j a va 2 s .c o m*/ // Build the context menu action list List<AppAction> contextMenuActions = new ArrayList<AppAction>(); contextMenu.removeAll(); for (AppAction action : enabledActions) { if (Boolean.TRUE.equals(action.getValue(AppAction.ON_CONTEXT_MENU))) { contextMenuActions.add(action); } } log.debug("There are " + contextMenuActions.size() + " on the context menu"); Collections.sort(contextMenuActions, new ContextActionComparator()); // Build the context menu Integer grp = null; for (AppAction action : contextMenuActions) { if ((grp != null) && !grp.equals(action.getValue(AppAction.CONTEXT_MENU_GROUP))) { contextMenu.addSeparator(); } if (Boolean.TRUE.equals(action.getValue(AppAction.IS_TOGGLE_BUTTON))) { final JCheckBoxMenuItem item = new JCheckBoxMenuItem(action); action.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(AppAction.IS_SELECTED)) { item.setSelected(((Boolean) evt.getNewValue()).booleanValue()); } } }); contextMenu.add(item); item.setSelected(Boolean.TRUE.equals(action.getValue(AppAction.IS_SELECTED))); } else { contextMenu.add(action); } grp = (Integer) action.getValue(AppAction.CONTEXT_MENU_GROUP); } contextMenu.validate(); contextMenu.repaint(); }
From source file:org.kepler.monitor.FigureUpdater.java
public void propertyChange(PropertyChangeEvent evt) { String propName = evt.getPropertyName(); Object newValue = evt.getNewValue(); if (isDebugging) { log.debug(propName + " -> " + newValue); }//from w w w . j av a2s . com if (_figure instanceof StateFigure) { StateFigure fig = (StateFigure) _figure; if (State.STATE.equals(propName)) { Object state = newValue; fig.setState(state); fig.update(); } } else if (_figure instanceof QualityFigure) { QualityFigure fig = (QualityFigure) _figure; /** Check states and assign appropriate quality values*/ if (State.HIGH_QUALITY.equals(propName)) { fig.setHighQualityThreshold(newValue); } else if (State.LOW_QUALITY.equals(propName)) { fig.setLowQualityThreshold(newValue); } /** If state being passed is quality score, then update quality figure*/ else if (State.QUALITY_SCORE.equals(propName)) { fig.update2(newValue); } } else if (_figure instanceof ProgressBarFigure) { ProgressBarFigure fig = (ProgressBarFigure) _figure; // TODO: the current value for the bar should be taken from the // property? // .. fig.update(); } else if (_figure instanceof LabelFigure) { if (isDebugging) { log.debug("updating LabelFigure: _propNameForLabel=" + _propNameForLabel); } LabelFigure fig = (LabelFigure) _figure; if (propName.equals(_propNameForLabel)) { fig.setString(String.valueOf(newValue)); } } }
From source file:org.polymap.core.mapeditor.tooling.select.LayerSelectableDecorator.java
public void propertyChange(PropertyChangeEvent ev) { if (ev.getSource() instanceof SelectionTool) { ILayer layer = (ILayer) ev.getNewValue(); if (ev.getPropertyName().equals(SelectionTool.PROP_LAYER_ACTIVATED)) { selectableLayerIds.add(layer.id()); } else if (ev.getPropertyName().equals(SelectionTool.PROP_LAYER_DEACTIVATED)) { selectableLayerIds.remove(layer.id()); }/* ww w . j a v a 2 s . co m*/ Runnable runnable = new Runnable() { public void run() { // prevent deadlock on close if (!PlatformUI.getWorkbench().isClosing()) { fireLabelProviderChanged(new LabelProviderChangedEvent(LayerSelectableDecorator.this)); } } }; if (Display.getCurrent() != null) { runnable.run(); } else { Polymap.getSessionDisplay().asyncExec(runnable); } } }
From source file:TrackFocusDemo.java
public TrackFocusDemo() { super(new BorderLayout()); JPanel mugshots = new JPanel(new GridLayout(2, 3)); pic1 = new Picture(createImageIcon("images/" + mayaString + ".jpg", mayaString).getImage()); pic1.setName("1"); mugshots.add(pic1);//from w w w . j a va 2 s . c om pic2 = new Picture(createImageIcon("images/" + anyaString + ".jpg", anyaString).getImage()); pic2.setName("2"); mugshots.add(pic2); pic3 = new Picture(createImageIcon("images/" + laineString + ".jpg", laineString).getImage()); pic3.setName("3"); mugshots.add(pic3); pic4 = new Picture(createImageIcon("images/" + cosmoString + ".jpg", cosmoString).getImage()); pic4.setName("4"); mugshots.add(pic4); pic5 = new Picture(createImageIcon("images/" + adeleString + ".jpg", adeleString).getImage()); pic5.setName("5"); mugshots.add(pic5); pic6 = new Picture(createImageIcon("images/" + alexiString + ".jpg", alexiString).getImage()); pic6.setName("6"); mugshots.add(pic6); info = new JLabel("Nothing selected"); setPreferredSize(new Dimension(450, 350)); add(mugshots, BorderLayout.CENTER); add(info, BorderLayout.PAGE_END); setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); KeyboardFocusManager focusManager = KeyboardFocusManager.getCurrentKeyboardFocusManager(); focusManager.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent e) { String prop = e.getPropertyName(); if (("focusOwner".equals(prop)) && (e.getNewValue() != null) && ((e.getNewValue()) instanceof Picture)) { Component comp = (Component) e.getNewValue(); String name = comp.getName(); Integer num = new Integer(name); int index = num.intValue(); if (index < 0 || index > comments.length) { index = 0; } info.setText(comments[index]); } } }); }
From source file:FilterSample.java
public void propertyChange(PropertyChangeEvent changeEvent) { String changeName = changeEvent.getPropertyName(); if (changeName.equals(JFileChooser.SELECTED_FILE_CHANGED_PROPERTY)) { File file = (File) changeEvent.getNewValue(); if (file != null) { ImageIcon icon = new ImageIcon(file.getPath()); if (icon.getIconWidth() > PREFERRED_WIDTH) { icon = new ImageIcon( icon.getImage().getScaledInstance(PREFERRED_WIDTH, -1, Image.SCALE_DEFAULT)); if (icon.getIconHeight() > PREFERRED_HEIGHT) { icon = new ImageIcon( icon.getImage().getScaledInstance(-1, PREFERRED_HEIGHT, Image.SCALE_DEFAULT)); }// w ww .j av a2s .co m } setIcon(icon); } } }