Example usage for java.beans PropertyChangeListener PropertyChangeListener

List of usage examples for java.beans PropertyChangeListener PropertyChangeListener

Introduction

In this page you can find the example usage for java.beans PropertyChangeListener PropertyChangeListener.

Prototype

PropertyChangeListener

Source Link

Usage

From source file:hr.fer.zemris.vhdllab.platform.ui.wizard.testbench.TestbenchFileForm.java

private void installSuggestionTestbenchName() {
    getFormModel().getValueModel("targetFile").addValueChangeListener(new PropertyChangeListener() {
        @Override//from   www  . j  a va2 s.  c  o m
        public void propertyChange(PropertyChangeEvent evt) {
            File selectedFile = (File) evt.getNewValue();
            String testbenchName = null;
            if (selectedFile != null) {
                testbenchName = selectedFile.getName() + "_tb";
            }
            getFormModel().getValueModel("testbenchName").setValue(testbenchName);
        }
    });
}

From source file:org.kalypso.kalypsomodel1d2d.ui.map.channeledit.SwitchProfileAction.java

public SwitchProfileAction(final ChannelEditData data, final int offset) {
    m_data = data;/*w  w  w .j  av a2s  . com*/
    m_offset = offset;

    m_data.addPropertyChangeListener(ChannelEditData.PROPERTY_ACTIVE_PROFILE, new PropertyChangeListener() {
        @Override
        public void propertyChange(final PropertyChangeEvent evt) {
            handleActiveProfileChanged();
        }
    });
}

From source file:hr.fer.zemris.vhdllab.platform.ui.wizard.simulator.SimulationFileForm.java

private void installSuggestionSimulationName() {
    getFormModel().getValueModel("targetFile").addValueChangeListener(new PropertyChangeListener() {
        @Override/*ww w.j ava  2 s.co m*/
        public void propertyChange(PropertyChangeEvent evt) {
            File selectedFile = (File) evt.getNewValue();
            String testbenchName = null;
            if (selectedFile != null) {
                testbenchName = selectedFile.getName() + "_sim";
            }
            getFormModel().getValueModel("simulationName").setValue(testbenchName);
        }
    });
}

From source file:org.openconcerto.utils.checks.EmptyObjFromVO.java

public EmptyObjFromVO(ValueObject<V> vo, IPredicate<V> testEmptiness) {
    super();//from   ww w .  j  a v a  2s. co  m

    this.vo = vo;
    if (testEmptiness == null)
        throw new IllegalArgumentException("null testEmptiness");
    this.testEmptiness = testEmptiness;

    this.supp = new EmptyChangeSupport(this, this.isEmpty());
    // ecoute les changements de notre cible pour dcider si elle devient vide ou non
    this.vo.addValueListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            valueChanged();
        }
    });
}

From source file:com.codecrate.shard.ui.binder.MoneyBinder.java

protected Binding doBind(JComponent control, FormModel formModel, String formPropertyPath, Map context) {
    final MoneyInputPanel moneyInput = (MoneyInputPanel) control;
    return new CustomBinding(formModel, formPropertyPath, Money.class) {

        protected JComponent doBindControl() {
            moneyInput.setMoney((Money) getValue());
            moneyInput.amount.addPropertyChangeListener("value", new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    controlValueChanged(moneyInput.getMoney());
                }// ww w .  j  a  v a 2  s . com
            });
            moneyInput.currency.addPropertyChangeListener("value", new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    controlValueChanged(moneyInput.getMoney());
                }
            });
            return moneyInput;
        }

        protected void readOnlyChanged() {
            moneyInput.setEnabled(isEnabled() && !isReadOnly());
        }

        protected void enabledChanged() {
            moneyInput.setEnabled(isEnabled() && !isReadOnly());
        }

        protected void valueModelChanged(Object newValue) {
            moneyInput.setMoney((Money) newValue);
        }
    };
}

From source file:org.drugis.addis.presentation.NetworkInconsistencyFactorsTableModel.java

public NetworkInconsistencyFactorsTableModel(NetworkMetaAnalysisPresentation pm) {
    d_pm = pm;//from  ww  w. j a v a 2 s.  c  o  m

    d_listener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            fireTableDataChanged();
        }
    };

    d_modelConstructed = d_pm.getWrappedModel(d_pm.getInconsistencyModel()).isModelConstructed();
    if (d_modelConstructed.getValue().equals(true)) {
        attachListeners();
    }

    d_modelConstructed.addValueChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getNewValue().equals(true)) {
                fireTableStructureChanged();
                attachListeners();
            }
        }
    });
}

From source file:org.jtrfp.trcl.flow.GameShell.java

public GameShell(TR tr) {
    this.tr = tr;
    tr.addPropertyChangeListener(TR.GAME, new PropertyChangeListener() {
        @Override/*from w  ww  .  j  a va 2 s  .c  o  m*/
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getNewValue() == null) {
                earlyLoadingScreen.setStatusText("No game loaded.");
                showGameshellScreen();
            } else {
                hideGameshellScreen();
            }
        }
    });
}

From source file:com.konifar.material_icon_generator.FilterComboBox.java

private void initListener() {
    final JTextField textfield = (JTextField) this.getEditor().getEditorComponent();
    textfield.addKeyListener(new KeyAdapter() {
        public void keyReleased(KeyEvent event) {
            switch (event.getKeyCode()) {
            case KeyEvent.VK_ENTER:
            case KeyEvent.VK_ESCAPE:
                requestFocus(false);// ww w  .  jav a2 s  .c om
                break;
            case KeyEvent.VK_UP:
            case KeyEvent.VK_DOWN:
                break;
            default:
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        filter(textfield.getText());
                    }
                });
            }
        }
    });

    getAccessibleContext().addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent event) {
            if (AccessibleContext.ACCESSIBLE_STATE_PROPERTY.equals(event.getPropertyName())
                    && AccessibleState.FOCUSED.equals(event.getNewValue())
                    && getAccessibleContext().getAccessibleChild(0) instanceof ComboPopup) {
                ComboPopup popup = (ComboPopup) getAccessibleContext().getAccessibleChild(0);
                JList list = popup.getList();

                if (list.getSelectedValue() != null) {
                    setSelectedItem(String.valueOf(list.getSelectedValue()));
                }
            }
        }
    });
}

From source file:EnrollFingerprint.Enroll.java

/**
 * Creates new form Enroll/*from   ww w  . ja va 2s  . c  om*/
 */
public Enroll() {
    initComponents();
    updateStatus();

    // Event listener actived when fingerprint template is ready
    this.addPropertyChangeListener(TEMPLATE_PROPERTY, new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            btnSave.setEnabled(template != null);
            if (evt.getNewValue() == evt.getOldValue()) {
                return;
            }
            if (template != null) {
                JOptionPane.showMessageDialog(Enroll.this, "La huella capturada esta lista para ser guardada.",
                        "Captura y Registro de huellas", JOptionPane.INFORMATION_MESSAGE);
            }
        }
    });
}

From source file:org.drugis.mtc.presentation.results.NetworkInconsistencyFactorsTableModel.java

public NetworkInconsistencyFactorsTableModel(InconsistencyWrapper<?> networkModel,
        ValueModel modelConstructed) {/*  w  w w .  j a  v a  2 s .  c  om*/
    d_model = networkModel;
    d_modelConstructed = modelConstructed;
    d_listener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            fireTableDataChanged();
        }
    };

    if (d_modelConstructed.getValue().equals(true)) {
        attachListeners();
    }
    d_modelConstructed.addValueChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getNewValue().equals(true)) {
                fireTableStructureChanged();
                attachListeners();
            }
        }
    });
}