List of usage examples for java.beans PropertyChangeListener PropertyChangeListener
PropertyChangeListener
From source file:com.vmware.vfabric.ide.eclipse.tcserver.livegraph.LiveBeansGraphEditorSection.java
private void addPropertyChangeListener() { propertyListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { if (TcServer.PROPERTY_ADD_EXTRA_VMARGS.equals(evt.getPropertyName())) { updateMbeanButton();// w w w. j a v a2s . co m } } }; server.addPropertyChangeListener(propertyListener); }
From source file:org.jtrfp.trcl.Crosshairs.java
private void installReactiveListeners(final TR tr) { tr.config.addPropertyChangeListener(TRConfiguration.CROSSHAIRS_ENABLED, new PropertyChangeListener() { @Override// w w w .java 2s .co m public void propertyChange(PropertyChangeEvent evt) { updateCrosshairsVisibilityState((Boolean) evt.getNewValue(), tr.getGame().getCurrentMission().isSatelliteView()); } }); IndirectProperty<Mission> currentMission = new IndirectProperty<Mission>(); currentMission.addTargetPropertyChangeListener(Mission.SATELLITE_VIEW, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { updateCrosshairsVisibilityState(tr.config.isCrosshairsEnabled(), (Boolean) evt.getNewValue()); } }); tr.getGame().addPropertyChangeListener(Game.CURRENT_MISSION, currentMission); }
From source file:fi.smaa.jsmaa.gui.JSMAAMainFrame.java
public JSMAAMainFrame(SMAAModel model) { super(AppInfo.getAppName()); ChartFactory.setChartTheme(StandardChartTheme.createLegacyTheme()); ToolTipManager.sharedInstance().setInitialDelay(0); setPreferredSize(new Dimension(950, 700)); setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); modelManager = new ModelFileManager(); modelManager.addPropertyChangeListener(ModelFileManager.PROPERTY_TITLE, new PropertyChangeListener() { @Override/*from w ww. j a va 2s.c o m*/ public void propertyChange(PropertyChangeEvent ev) { setTitle((String) ev.getNewValue()); } }); modelManager.addPropertyChangeListener(ModelFileManager.PROPERTY_MODEL, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { initWithModel((SMAAModel) evt.getNewValue()); } }); modelManager.setModel(model); }
From source file:com.stefanbrenner.droplet.ui.AddDeviceDialog.java
public AddDeviceDialog(final JFrame frame, final IDropletContext dropletContext) { super(frame, dropletContext, Messages.getString("AddDeviceDialog.title")); //$NON-NLS-1$ droplet = dropletContext.getDroplet(); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.setLayout(new GridLayout(1, 0, 7, 7)); btnValve = new JButton(Messages.getString("AddDeviceDialog.valve")); //$NON-NLS-1$ btnValve.addActionListener(this); panel.add(btnValve);/*from w w w . j a v a 2s.c o m*/ btnFlash = new JButton(Messages.getString("AddDeviceDialog.flash")); //$NON-NLS-1$ btnFlash.addActionListener(this); panel.add(btnFlash); btnCamera = new JButton(Messages.getString("AddDeviceDialog.camera")); //$NON-NLS-1$ btnCamera.addActionListener(this); panel.add(btnCamera); btnButton = new JButton(Messages.getString("AddDeviceDialog.button")); //$NON-NLS-1$ btnButton.addActionListener(this); panel.add(btnButton); btnClose = new JButton(Messages.getString("AddDeviceDialog.close")); //$NON-NLS-1$ btnClose.addActionListener(this); panel.add(btnClose); add(panel); setAlwaysOnTop(true); setResizable(false); pack(); setLocationRelativeTo(frame); droplet.addPropertyChangeListener(IDroplet.ASSOCIATION_DEVICES, new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent event) { updateComponents(); } }); updateComponents(); }
From source file:com.croer.javaorange.diviner.SimpleOrangeDiviner.java
public SimpleOrangeDiviner(Mediator mediator) { super((Frame) null, true); initComponents();/*from w w w .ja v a2 s. com*/ setUndecorated(true); Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("ENTER")); //Efectua la seleccin Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("control CONTROL")); //Cancela la consulta y oculta el dilogo Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("alt SPACE")); //Reinicia la seleccin de toda la tabla Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction(configuration.getString("Plus"))); //Incrementa en uno la cantidad Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("alt DOWN")); //Decrementa en uno la cantidad Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("UP")); //Recorrido hacia arriba Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("DOWN")); //Recorrido hacia abajo Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("PAGE_UP")); //Retrocede una pgina Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("PAGE_DOWN")); //Avanza una pgina Util.activateFunctionKey(SimpleOrangeDiviner.this, new FormAction("F5")); // // getRootPane().getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(KeyStroke.getKeyStroke("pressed UP"), "go"); // getRootPane().getActionMap().put("go", new AbstractAction() { // // @Override // public void actionPerformed(ActionEvent e) { // System.out.println("Yepa " + System.currentTimeMillis()); // } // }); // getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_CONTROL, InputEvent.CTRL_MASK), "collapse"); // getRootPane().getActionMap().put("collapse", new AbstractAction() { // // @Override // public void actionPerformed(ActionEvent e) { // SimpleOrangeDiviner.this.setVisible(false); // } // }); jPanel1.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { System.out.println("Evento: " + evt.getPropertyName() + "-" + evt.getNewValue()); } }); }
From source file:org.eclipse.virgo.ide.runtime.internal.ui.editor.StaticResourcesEditorSection.java
protected void addConfigurationChangeListener() { this.listener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent event) { if (org.eclipse.virgo.ide.runtime.core.IServer.PROPERTY_STATIC_FILENAMES .equals(event.getPropertyName())) { StaticResourcesEditorSection.this.filenamesTableViewer .setInput(StaticResourcesEditorSection.this.server); }/*from w ww . j a v a 2 s .c o m*/ } }; this.serverWorkingCopy.addConfigurationChangeListener(this.listener); }
From source file:org.kalypso.ui.rrm.internal.map.editRelation.EditRelationWidget.java
/** * empty constructor so widget can be used with SelectWidgetHandler *//*from w w w.ja va 2 s . co m*/ public EditRelationWidget() { super(Messages.getString("org.kalypso.ogc.gml.map.widgets.editrelation.EditRelationWidget.2"), //$NON-NLS-1$ StringUtils.EMPTY); m_data.addPropertyChangeListener(EditRelationData.PROPERTY_MODIFICATION_MODE, new PropertyChangeListener() { @Override public void propertyChange(final PropertyChangeEvent evt) { updateCursor(); } }); }
From source file:uk.ac.lkl.cram.ui.chart.FeedbackChartMaker.java
/** * Create a dataset from the module//from ww w . j a v a2 s .c o m * @return a category dataset that is used to produce a bar chart */ @Override protected Dataset createDataSet() { //Create a dataset to hold the data final DefaultCategoryDataset categoryDataset = new DefaultCategoryDataset(); //populate the dataset with the data populateDataset(categoryDataset, module); //Create a listener, which repopulates the dataset when anything changes final PropertyChangeListener feedbackListener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { //LOGGER.info("event propertyName: " + pce.getPropertyName() + " newValue: " + pce.getNewValue()); populateDataset(categoryDataset, module); } }; //Add the listener to each of the module's tlaLineItems, as well as to each //tlaLineItem's activity //This means that whenever a tlaLineItem changes, or its activity changes, the listener is triggered //Causing the dataset to be repopulated for (TLALineItem lineItem : module.getTLALineItems()) { //LOGGER.info("adding listeners to : " + lineItem.getName()); lineItem.getActivity().addPropertyChangeListener(TLActivity.PROP_LEARNER_FEEDBACK, feedbackListener); lineItem.addPropertyChangeListener(feedbackListener); } //Add a listener to the module, listening for changes where a tlaLineItem is added or removed module.addPropertyChangeListener(Module.PROP_TLA_LINEITEM, new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent pce) { //A tlaLineItem has been added or removed if (pce instanceof IndexedPropertyChangeEvent) { //LOGGER.info("indexed change: " + pce); if (pce.getOldValue() != null) { //This has been removed TLALineItem lineItem = (TLALineItem) pce.getOldValue(); //So remove the listener from it and its activity //LOGGER.info("removing listeners from: " + lineItem.getName()); lineItem.getActivity().removePropertyChangeListener(TLActivity.PROP_LEARNER_FEEDBACK, feedbackListener); lineItem.removePropertyChangeListener(feedbackListener); } if (pce.getNewValue() != null) { //This has been added TLALineItem lineItem = (TLALineItem) pce.getNewValue(); //So add a listener to it and its activity //LOGGER.info("adding listeners to: " + lineItem); lineItem.getActivity().addPropertyChangeListener(TLActivity.PROP_LEARNER_FEEDBACK, feedbackListener); lineItem.addPropertyChangeListener(feedbackListener); } } //Assume the dataset is now out of date, so repopulate it populateDataset(categoryDataset, module); } }); return categoryDataset; }
From source file:it.unibas.spicygui.vista.wizard.RelationalPanel.java
public void initListener() { this.relationalPropertyChangeListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { campoIstanzeTargetPropertyChange(evt); }//from w w w . j a v a2 s . co m private void campoIstanzeTargetPropertyChange(PropertyChangeEvent evt) { if (selectedPanel == 1) { pannPanelWizardImplExportDB.fireChangeEvent(); } else { pannPanelWizardImpl.fireChangeEvent(); } } }; relationalConfigurationPM.addPropertyChangeListener(this.relationalPropertyChangeListener); }
From source file:mulavito.gui.components.LayerDataPanel.java
public LayerDataPanel(FloatingTabbedPane owner) { super("Layer Data", owner); textArea = new JTextArea(defaultText); textArea.setEditable(false);//from w w w. jav a 2 s . c o m textArea.setCaretPosition(0); // Scroll up the text area. JScrollPane textPane = new JScrollPane(textArea); add(textPane, BorderLayout.CENTER); // updates the data mouseListener = new MouseAdapter() { @SuppressWarnings("unchecked") @Override public void mouseEntered(MouseEvent e) { if (e.getSource() instanceof LayerViewer<?, ?>) { LayerViewer<V, E> vv = (LayerViewer<V, E>) e.getSource(); showData(vv.getLayer()); } } @Override public void mouseExited(MouseEvent e) { showData(null); } }; // adds/removes focus listeners on layers graphPanelListener = new PropertyChangeListener() { @SuppressWarnings("unchecked") @Override public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("Viewers")) { if (evt.getOldValue() instanceof LayerViewer<?, ?> && evt.getNewValue() == null) { // GraphPanel#removeLayer ((LayerViewer<?, ?>) evt.getOldValue()).removeMouseListener(mouseListener); } else if (evt.getOldValue() instanceof List<?>) { System.out.println("Replace"); for (LayerViewer<?, ?> vv : ((List<LayerViewer<?, ?>>) evt.getOldValue())) vv.removeMouseListener(mouseListener); } if (evt.getNewValue() instanceof LayerViewer<?, ?> && evt.getOldValue() == null) { // GraphPanel#addLayer ((LayerViewer<?, ?>) evt.getNewValue()).addMouseListener(mouseListener); } else if (evt.getNewValue() instanceof List<?>) { // New Layer List on start up for (LayerViewer<?, ?> vv : ((List<LayerViewer<?, ?>>) evt.getNewValue())) vv.addMouseListener(mouseListener); } showData(current); } } }; }