use of javax.swing.event.ChangeListener in project MassBank-web by MassBank.
the class DrawPane method makeZoomSpinner.
private JSpinner makeZoomSpinner(final DrawPane canvas, Action zoomIn, Action zoomOut) {
SpinnerNumberModel snm = new SpinnerNumberModel(0.8, 0.4, 3.0, 0.1);
final JSpinner zoomSpinner = new JSpinner(snm);
zoomSpinner.setMaximumSize(new Dimension(60, 30));
JSpinner.NumberEditor sne = new JSpinner.NumberEditor(zoomSpinner, "###%");
zoomSpinner.setEditor(sne);
zoomSpinner.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent ce) {
canvas.zoomChangeTo((float) ((Double) (zoomSpinner.getValue())).doubleValue());
}
});
zoomIn.setActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
Object o = zoomSpinner.getNextValue();
if (o != null)
zoomSpinner.setValue(o);
}
});
zoomOut.setActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
Object o = zoomSpinner.getPreviousValue();
if (o != null)
zoomSpinner.setValue(o);
}
});
return zoomSpinner;
}
use of javax.swing.event.ChangeListener in project knime-core by knime.
the class String2DateDialog method initializeModels.
private void initializeModels() {
// add listener to replace column
m_replaceModel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
// -> set new column name model enabled = !m_replace;
m_colNameModel.setEnabled(!m_replaceModel.getBooleanValue());
}
});
addColSelectionListener(m_colSelectionModel, m_colNameModel, m_suffix);
if (m_cancelOnFailModel != null && m_failNoModel != null) {
// if !canFail these models are null
m_cancelOnFailModel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
// if fail on cancel -> define max number of fails
m_failNoModel.setEnabled(m_cancelOnFailModel.getBooleanValue());
}
});
}
}
use of javax.swing.event.ChangeListener in project knime-core by knime.
the class NumericOutliersNodeDialogPane method addListeners.
/**
* Adds listeners to the different dialog components/ model settings.
*/
private void addListeners() {
// only enable estimation types if in-memory calculation is selected
m_heuristicDialog.getModel().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
toggleEstimationDialog();
}
});
// only enable groups dialog if apply to groups is selected
m_useGroupsDialog.getModel().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
toggleGroupsDialog();
}
});
m_outlierTreatmentDialog.getModel().addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
toggleReplacement();
}
});
}
use of javax.swing.event.ChangeListener in project knime-core by knime.
the class DateTimeToStringNodeModel method createSuffixModel.
/**
* @param replaceOrAppendModel model for the replace/append button group
* @return the string model, used in both dialog and model.
*/
public static SettingsModelString createSuffixModel(final SettingsModelString replaceOrAppendModel) {
final SettingsModelString suffixModel = new SettingsModelString("suffix", "(String)");
replaceOrAppendModel.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
if (replaceOrAppendModel.getStringValue().equals(OPTION_APPEND)) {
suffixModel.setEnabled(true);
} else {
suffixModel.setEnabled(false);
}
}
});
suffixModel.setEnabled(false);
return suffixModel;
}
use of javax.swing.event.ChangeListener in project knime-core by knime.
the class TemplatesPanel method setTemplateProvider.
/**
* Change template provider and regenerate category/template list.
* @param provider the {@link TemplateProvider} to use
*/
public void setTemplateProvider(final TemplateProvider<T> provider) {
m_provider = provider;
m_provider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent e) {
updateCategories();
updateTemplatesList(TemplateProvider.ALL_CATEGORY);
}
});
updateCategories();
updateTemplatesList(TemplateProvider.ALL_CATEGORY);
m_templates.setSelectedIndex(-1);
}
Aggregations