use of javax.swing.AbstractButton in project knime-core by knime.
the class AbstractHistogramProperties method addAggrMethodListener.
/**
* @param listener adds the listener to the aggregation method button
* group
*/
protected void addAggrMethodListener(final ActionListener listener) {
final Enumeration<AbstractButton> buttons = m_aggrMethButtonGrp.getElements();
while (buttons.hasMoreElements()) {
final AbstractButton button = buttons.nextElement();
button.addActionListener(listener);
}
}
use of javax.swing.AbstractButton in project knime-core by knime.
the class RankNodeDialog method saveSettingsTo.
/**
* {@inheritDoc}
*/
@Override
protected void saveSettingsTo(final NodeSettingsWO settings) throws InvalidSettingsException {
String[] rankColNames = new String[m_rankTableModel.getRowCount()];
String[] order = new String[m_rankTableModel.getRowCount()];
for (int r = 0; r < m_rankTableModel.getRowCount(); r++) {
rankColNames[r] = ((DataColumnSpec) m_rankTableModel.getValueAt(r, 0)).getName();
order[r] = (String) m_rankTableModel.getValueAt(r, 1);
}
String[] groupColNames = new String[m_groupTableModel.getRowCount()];
for (int r = 0; r < m_groupTableModel.getRowCount(); r++) {
groupColNames[r] = ((DataColumnSpec) m_groupTableModel.getValueAt(r, 0)).getName();
}
// get selected mode
Enumeration<AbstractButton> buttons = m_modusGroup.getElements();
String modus = null;
while (buttons.hasMoreElements()) {
AbstractButton currentButton = buttons.nextElement();
if (m_modusGroup.isSelected(currentButton.getModel())) {
modus = currentButton.getText();
}
}
m_rankMode.setStringValue(modus);
m_rankColsModel.setStringArrayValue(rankColNames);
m_rankOrderModel.setStringArrayValue(order);
m_groupColsModel.setStringArrayValue(groupColNames);
m_retainRowOrder.setBooleanValue(m_retainOrderCheckBox.isSelected());
m_rankOutColName.setStringValue(m_outColNameTextField.getText());
m_rankAsLong.setBooleanValue(m_rankAsLongCheckBox.isSelected());
validateSettings(settings);
// save settings models
m_rankColsModel.saveSettingsTo(settings);
m_rankOrderModel.saveSettingsTo(settings);
m_groupColsModel.saveSettingsTo(settings);
m_rankMode.saveSettingsTo(settings);
m_rankOutColName.saveSettingsTo(settings);
m_retainRowOrder.saveSettingsTo(settings);
m_rankAsLong.saveSettingsTo(settings);
}
use of javax.swing.AbstractButton in project knime-core by knime.
the class PieProperties method updatePanel.
/**
* @param vizModel the actual {@link PieVizModel}
*/
public void updatePanel(final D vizModel) {
if (vizModel == null) {
return;
}
// select the actual aggregation method
final Enumeration<AbstractButton> buttons = m_aggrMethButtonGrp.getElements();
while (buttons.hasMoreElements()) {
final AbstractButton button = buttons.nextElement();
if (button.getActionCommand().equals(vizModel.getAggregationMethod().name())) {
button.setSelected(true);
}
button.setEnabled(vizModel.getAggregationColumnName() != null);
}
m_explodeSelectedSections.setSelected(vizModel.explodeSelectedSections());
final Enumeration<AbstractButton> labels = m_labelDisplayPolicy.getElements();
while (labels.hasMoreElements()) {
final AbstractButton button = labels.nextElement();
if (button.getActionCommand().equals(vizModel.getLabelDisplayPolicy().getActionCommand())) {
button.setSelected(true);
}
}
m_pieSize.setValue((int) (vizModel.getPieSize() * 100));
m_explodeSize.setValue((int) vizModel.getExplodeSize() * 100);
m_showDetails.setSelected(vizModel.showDetails());
m_showMissingValSection.setSelected(vizModel.showMissingValSection());
enableMissingSectionOption(vizModel.hasMissingSection());
enableShowDetailsOption(vizModel.detailsAvailable());
m_showSectionOutline.setSelected(vizModel.drawSectionOutline());
updatePanelInternal(vizModel);
}
use of javax.swing.AbstractButton in project knime-core by knime.
the class CharsetNamePanel method overrideSettings.
/**
* Writes the current settings of the panel into the passed settings object.
*
* @param settings the object to write settings in
* @return true if the new settings are different from the one passed in.
* @since 3.2
*/
public boolean overrideSettings(final FileReaderNodeSettings settings) {
String oldCSN = settings.getCharsetName();
String newCSN = null;
Enumeration<AbstractButton> buttons = m_group.getElements();
while (buttons.hasMoreElements()) {
AbstractButton b = buttons.nextElement();
if (b.isSelected()) {
newCSN = b.getActionCommand();
if (CUSTOM_LABEL.equals(newCSN)) {
newCSN = m_customName.getText();
} else if (DEFAULT_LABEL.equals(newCSN)) {
newCSN = null;
}
settings.setCharsetName(newCSN);
break;
}
}
boolean changed;
if (oldCSN == null) {
changed = newCSN != null;
} else {
changed = !oldCSN.equals(newCSN);
}
if (changed) {
settings.setCharsetUserSet(true);
}
return changed;
}
use of javax.swing.AbstractButton in project knime-core by knime.
the class CharsetNamePanel method loadSettings.
/**
* @param settings
* @since 3.1
*/
public void loadSettings(final FileReaderSettings settings) {
String csName = settings.getCharsetName();
if (csName == null) {
// the default
m_default.setSelected(true);
} else {
boolean foundIt = false;
Enumeration<AbstractButton> buttons = m_group.getElements();
while (buttons.hasMoreElements()) {
AbstractButton b = buttons.nextElement();
if (csName.equals(b.getActionCommand())) {
foundIt = true;
b.setSelected(true);
break;
}
}
if (!foundIt) {
m_custom.setSelected(true);
m_customName.setText(csName);
}
}
}
Aggregations