List of usage examples for java.beans PropertyChangeEvent getPropertyName
public String getPropertyName()
From source file:be.nbb.demetra.dfm.output.simulation.RMSEGraphView.java
/** * Creates new form RMSEGraphView//from w ww . j a va 2 s . c o m */ public RMSEGraphView(DfmDocument doc) { initComponents(); revealObs = new RevealObs(); demetraUI = DemetraUI.getDefault(); formatter = demetraUI.getDataFormat().numberFormatter(); defaultColorSchemeSupport = new SwingColorSchemeSupport() { @Override public ColorScheme getColorScheme() { return demetraUI.getColorScheme(); } }; this.dfmSimulation = Optional.absent(); dfmRenderer = new LineRenderer(DFM_INDEX); arimaRenderer = new LineRenderer(ARIMA_INDEX); stdevRenderer = new LineRenderer(STDEV_INDEX); highlight = null; chartPanel = new JChartPanel(createChart()); Charts.avoidScaling(chartPanel); Charts.enableFocusOnClick(chartPanel); comboBox.setRenderer(new ComboBoxRenderer()); comboBox.addItemListener((ItemEvent e) -> { filterPanel = null; updateChart(); }); addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { switch (evt.getPropertyName()) { case DFM_SIMULATION_PROPERTY: updateComboBox(); updateChart(); break; } } }); updateComboBox(); updateChart(); onColorSchemeChanged(); demetraUI.addPropertyChangeListener((PropertyChangeEvent evt) -> { switch (evt.getPropertyName()) { case DemetraUI.DATA_FORMAT_PROPERTY: onDataFormatChanged(); break; case DemetraUI.COLOR_SCHEME_NAME_PROPERTY: onColorSchemeChanged(); break; } }); chartPanel.setPopupMenu(buildMenu().getPopupMenu()); chartPanel.addChartMouseListener(new HighlightChartMouseListener2()); chartPanel.addKeyListener(revealObs); chartPanel.getChart().getPlot() .setNoDataMessage("Select evaluation sample by clicking on the toolbar button."); add(chartPanel, BorderLayout.CENTER); }
From source file:edu.ku.brc.specify.tools.schemalocale.SchemaLocalizerFrame.java
/** * /*from w w w . j av a2 s. com*/ */ protected void buildUI() { SchemaLocalizerXMLHelper slxh = new SchemaLocalizerXMLHelper(schemaType, tableMgr); localizableIO = slxh; localizableIO.load(false); //stripToSingleLocale("pt", slxh); LocalizableStrFactory localizableStrFactory = new LocalizableStrFactory() { public LocalizableStrIFace create() { SpLocaleItemStr str = new SpLocaleItemStr(); str.initialize(); return str; } public LocalizableStrIFace create(String text, Locale locale) { return new SpLocaleItemStr(text, locale); // no initialize needed for this constructor } }; LocalizerBasePanel.setLocalizableStrFactory(localizableStrFactory); SchemaLocalizerXMLHelper.setLocalizableStrFactory(localizableStrFactory); schemaLocPanel = new SchemaLocalizerPanel(null, dataObjFieldFormatMgrCache, uiFieldFormatterMgrCache, webLinkMgrCache, schemaType); schemaLocPanel.setLocalizableIO(localizableIO); schemaLocPanel.setStatusBar(statusBar); boolean useDisciplines = AppPreferences.getLocalPrefs().getBoolean("SCHEMA_DISP", false); schemaLocPanel.setUseDisciplines(useDisciplines); // rods - for now //schemaLocPanel.setIncludeHiddenUI(true); schemaLocPanel.buildUI(); schemaLocPanel.setHasChanged(localizableIO.didModelChangeDuringLoad()); statusBar.setSectionText(1, schemaType == SpLocaleContainer.CORE_SCHEMA ? getResourceString("SchemaLocalizerFrame.FULL_SCHEMA") //$NON-NLS-1$ : getResourceString("SchemaLocalizerFrame.WB_SCHEMA")); //$NON-NLS-1$ UIRegistry.setStatusBar(statusBar); JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar); String title = "File"; //$NON-NLS-1$ String mneu = "F"; //$NON-NLS-1$ JMenu fileMenu = UIHelper.createLocalizedMenu(menuBar, title, mneu); title = "Save"; //$NON-NLS-1$ mneu = "S"; //$NON-NLS-1$ JMenuItem saveMenuItem = UIHelper.createLocalizedMenuItem(fileMenu, title, mneu, "", false, //$NON-NLS-1$ new ActionListener() { public void actionPerformed(ActionEvent e) { write(); } }); saveMenuItem.setEnabled(false); title = "Export"; //$NON-NLS-1$ mneu = "E"; //$NON-NLS-1$ UIHelper.createLocalizedMenuItem(fileMenu, title, mneu, "", true, new ActionListener() //$NON-NLS-1$ { public void actionPerformed(ActionEvent e) { export(); } }); title = "SchemaLocalizerFrame.ExportLOCALE"; //$NON-NLS-1$ mneu = "SchemaLocalizerFrame.ExportLOCALEMnu"; //$NON-NLS-1$ UIHelper.createLocalizedMenuItem(fileMenu, title, mneu, "", true, new ActionListener() //$NON-NLS-1$ { public void actionPerformed(ActionEvent e) { exportSingleLocale(); } }); title = "Exit"; //$NON-NLS-1$ mneu = "x"; //$NON-NLS-1$ if (!UIHelper.isMacOS()) { fileMenu.addSeparator(); UIHelper.createLocalizedMenuItem(fileMenu, title, mneu, "", true, new ActionListener() //$NON-NLS-1$ { public void actionPerformed(ActionEvent e) { shutdown(); } }); } /* JMenu toolMenu = UIHelper.createMenu(menuBar, "Tools", "T"); UIHelper.createMenuItem(toolMenu, "Create Resource Files", "C", "", true, new ActionListener() { public void actionPerformed(ActionEvent e) { createResourceFiles(); } }); */ menuBar.add(SchemaI18NService.getInstance().createLocaleMenu(this, new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("locale")) //$NON-NLS-1$ { schemaLocPanel.localeChanged((Locale) evt.getNewValue()); statusBar.setSectionText(0, SchemaI18NService.getCurrentLocale().getDisplayName()); } } })); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setSize(800, 600); JPanel mainPanel = new JPanel(new BorderLayout()); mainPanel.add(schemaLocPanel, BorderLayout.CENTER); mainPanel.add(statusBar, BorderLayout.SOUTH); mainPanel.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); setContentPane(mainPanel); statusBar.setSectionText(0, SchemaI18NService.getCurrentLocale().getDisplayName()); schemaLocPanel.setSaveMenuItem(saveMenuItem); schemaLocPanel.getContainerList().setEnabled(true); AppPreferences localPrefs = AppPreferences.getLocalPrefs(); localPrefs.setDirPath(UIRegistry.getAppDataDir()); ImageIcon helpIcon = IconManager.getIcon("AppIcon", IconSize.Std16); //$NON-NLS-1$ HelpMgr.initializeHelp("SpecifyHelp", helpIcon.getImage()); //$NON-NLS-1$ AppPrefsCache.setUseLocalOnly(true); SpecifyAppPrefs.loadColorAndFormatPrefs(); if (localizableIO.didModelChangeDuringLoad()) { saveMenuItem.setEnabled(true); SwingUtilities.invokeLater(new Runnable() { public void run() { JFrame frame = new JFrame(getResourceString("SchemaLocalizerFrame.CHG_TO_SCHEMA")); //$NON-NLS-1$ frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JTextPane tp = new JTextPane(); JScrollPane js = new JScrollPane(); js.getViewport().add(tp); tp.setContentType("text/html"); tp.setText(((SchemaLocalizerXMLHelper) localizableIO).getChangesBuffer()); frame.setContentPane(js); frame.pack(); frame.setSize(400, 500); frame.setVisible(true); } }); } }
From source file:hydrograph.ui.graph.controller.ComponentEditPart.java
@Override public void propertyChange(PropertyChangeEvent evt) { String prop = evt.getPropertyName(); if (Component.Props.SIZE_PROP.equalsTo(prop) || Component.Props.LOCATION_PROP.equalsTo(prop) || Component.Props.EXECUTION_STATUS.equalsTo(prop)) { refreshVisuals();/* ww w .j av a2 s . co m*/ } else if (Component.Props.OUTPUTS.equalsTo(prop)) { refreshSourceConnections(); } else if (Component.Props.INPUTS.equalsTo(prop)) { refreshTargetConnections(); } }
From source file:org.yccheok.jstock.gui.portfolio.DividendSummaryJDialog.java
@Override public void propertyChange(PropertyChangeEvent evt) { if ("progress" == evt.getPropertyName()) { if (progressMonitor == null) { return; }/* w w w . ja v a 2 s . c om*/ int progress = (Integer) evt.getNewValue(); progressMonitor.setProgress(progress); int total = transactionSummaries.size(); int progressPercentage = total == 0 ? 0 : (int) (progress / (double) total * 100.); String template = GUIBundle.getString("DividendSummaryJDialog_Completed_template"); String message = MessageFormat.format(template, progressPercentage); progressMonitor.setNote(message); if (progressMonitor.isCanceled() || autoDividendTask.isDone()) { if (progressMonitor.isCanceled()) { autoDividendTask.cancel(true); } else { } jButton5.setEnabled(true); } } }
From source file:org.openmicroscopy.shoola.agents.imviewer.util.proj.ProjSavingDialog.java
/** * Creates a new dataset.//from w w w .j a va2 s. co m * @see PropertyChangeListener#propertyChange(PropertyChangeEvent) */ public void propertyChange(PropertyChangeEvent evt) { String name = evt.getPropertyName(); if (CreateFolderDialog.CREATE_FOLDER_PROPERTY.equals(name)) { String folderName = (String) evt.getNewValue(); if (folderName != null && folderName.trim().length() > 0) createDataset(folderName); } }
From source file:org.jaffa.flexfields.FlexBean.java
/** * Adds a default PropertyChangeListener to the listener list. *//* www . j av a2 s . c o m*/ private void addPropertyChangeListener() { addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { valueChanged(evt.getPropertyName(), evt.getOldValue()); if (log.isDebugEnabled()) log.debug("Field '" + evt.getPropertyName() + "' updated from '" + evt.getOldValue() + "' to '" + evt.getNewValue() + "'"); } }); }
From source file:biz.wolschon.fileformats.gnucash.jwsdpimpl.GnucashAccountWritingImpl.java
/** * same as getBalance(new Date()).<br/> * ignores transactions after the current date+time<br/> * This implementation caches the result.<br/> * We assume that time does never move backwards * @see #getBalance(Date)/*from w w w .ja va 2 s.c o m*/ */ @Override public FixedPointNumber getBalance() { if (myBalanceCached != null) { return myBalanceCached; } Collection<GnucashTransactionSplit> after = new LinkedList<GnucashTransactionSplit>(); FixedPointNumber balance = getBalance(new Date(), after); if (after.isEmpty()) { myBalanceCached = balance; // add a listener to keep the cache up to date if (myBalanceCachedInvalidtor != null) { myBalanceCachedInvalidtor = new PropertyChangeListener() { private final Collection<GnucashTransactionSplit> splitsWeAreAddedTo = new HashSet<GnucashTransactionSplit>(); public void propertyChange(final PropertyChangeEvent evt) { myBalanceCached = null; // we don't handle the case of removing an account // because that happenes seldomly enough if (evt.getPropertyName().equals("account") && evt.getSource() instanceof GnucashWritableTransactionSplit) { GnucashWritableTransactionSplit splitw = (GnucashWritableTransactionSplit) evt .getSource(); if (splitw.getAccount() != GnucashAccountWritingImpl.this) { splitw.removePropertyChangeListener("account", this); splitw.removePropertyChangeListener("quantity", this); splitw.getTransaction().removePropertyChangeListener("datePosted", this); splitsWeAreAddedTo.remove(splitw); } } if (evt.getPropertyName().equals("transactionSplits")) { Collection<GnucashTransactionSplit> splits = (Collection<GnucashTransactionSplit>) evt .getNewValue(); for (GnucashTransactionSplit split : splits) { if (!(split instanceof GnucashWritableTransactionSplit) || splitsWeAreAddedTo.contains(split)) { continue; } GnucashWritableTransactionSplit splitw = (GnucashWritableTransactionSplit) split; splitw.addPropertyChangeListener("account", this); splitw.addPropertyChangeListener("quantity", this); splitw.getTransaction().addPropertyChangeListener("datePosted", this); splitsWeAreAddedTo.add(splitw); } } } }; addPropertyChangeListener("currencyID", myBalanceCachedInvalidtor); addPropertyChangeListener("currencyNameSpace", myBalanceCachedInvalidtor); addPropertyChangeListener("transactionSplits", myBalanceCachedInvalidtor); } } return balance; }
From source file:org.geopublishing.atlasStyler.swing.PolygonSymbolEditGUI.java
/** * This method initializes jButton//from www.java2 s . c o m * * @return javax.swing.JButton */ private JButton getJButtonFillGraphic() { if (jButtonFillGraphic == null) { jButtonFillGraphic = new JButton(); boolean enabled = false; if (symbolizer.getFill() != null) { Graphic graphicFill = symbolizer.getFill().getGraphicFill(); enabled = (graphicFill != null); } jButtonFillGraphic.setAction(new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { if (symbolizer.getFill() == null) { symbolizer.setFill(StylingUtil.STYLE_BUILDER.createFill((Color) null, (Color) null, 1., StylingUtil.STYLE_BUILDER.createGraphic())); } JDialog editFillGraphicJDialog = new GraphicEditGUIinDialog(asv, SwingUtil.getParentWindow(PolygonSymbolEditGUI.this), symbolizer.getFill()); editFillGraphicJDialog.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(AbstractStyleEditGUI.PROPERTY_UPDATED)) { PolygonSymbolEditGUI.this.firePropertyChange(AbstractStyleEditGUI.PROPERTY_UPDATED, null, null); // Update the Button Icon jButtonFillGraphic.setIcon(new ImageIcon(ASUtil.getSymbolizerImage(symbolizer, FeatureUtil.createFeatureType(Polygon.class)))); } } }); SwingUtil.setRelativeFramePosition(editFillGraphicJDialog, PolygonSymbolEditGUI.this, SwingUtil.BOUNDS_OUTER, SwingUtil.NORTHEAST); editFillGraphicJDialog.setVisible(true); } }); // Initialize correctly jLabelFillGraphic.setEnabled(enabled); jButtonFillGraphic.setEnabled(enabled); if (enabled) { jButtonFillGraphic.setIcon(new ImageIcon( ASUtil.getSymbolizerImage(symbolizer, FeatureUtil.createFeatureType(Polygon.class)))); } } return jButtonFillGraphic; }
From source file:org.cubictest.ui.sections.IdentifierComposite.java
/** * The identifier has changed//from ww w. j a v a2 s. c o m */ public void propertyChange(PropertyChangeEvent event) { if (!this.isDisposed()) { String eventName = event.getPropertyName(); if (Identifier.VALUE.equals(eventName)) { value.setText((String) event.getNewValue()); } else if (Identifier.ACTUAL.equals(eventName)) { //TODO } else if (Identifier.TYPE.equals(eventName)) { } else if (Identifier.MODERATOR.equals(eventName)) { moderator.removeSelectionListener(moderatorListener); setModerator((Moderator) event.getNewValue()); moderator.addSelectionListener(moderatorListener); } else if (Identifier.PROBABILITY.equals(eventName)) { probability.removeSelectionListener(probabilityListener); setProbability((Integer) event.getNewValue()); probability.addSelectionListener(probabilityListener); } else if (PageElement.DIRECT_EDIT_IDENTIFIER.equals(eventName)) { dirEdit.removeSelectionListener(dirEditListener); dirEdit.setSelection(pageElement.getDirectEditIdentifier().equals(identifier)); dirEdit.addSelectionListener(dirEditListener); } refresh(); } }
From source file:ru.zinin.redis.session.RedisManager.java
@Override public void propertyChange(PropertyChangeEvent event) { log.trace(String.format("EXEC propertyChange(%s);", event)); if (!(event.getSource() instanceof Context)) { return;//from w w w. j a v a2 s.c om } if (event.getPropertyName().equals("sessionTimeout")) { try { setMaxInactiveInterval((Integer) event.getNewValue() * 60); } catch (NumberFormatException e) { log.error(sm.getString("managerBase.sessionTimeout", event.getNewValue())); } } }