use of org.knime.base.node.util.JSnippetPanel in project knime-core by knime.
the class StringManipulationNodeDialog method createStringManipulationPanel.
/**
* @return the controls for the string manipulation node
* @since 3.3
*/
public Component createStringManipulationPanel() {
m_snippetPanel = new JSnippetPanel(StringManipulatorProvider.getDefault(), createCompletionProvider(), !m_isOnlyVariables);
m_newNameField = new JTextField(10);
String radioButtonName;
String radioButtonToolTip;
radioButtonName = "Append " + WordUtils.capitalize(m_columnOrVariable) + ": ";
radioButtonToolTip = "Appends a new " + m_columnOrVariable + " to the input with a given name.";
m_appendRadio = new JRadioButton(radioButtonName);
m_appendRadio.setToolTipText(radioButtonToolTip);
radioButtonName = "Replace " + WordUtils.capitalize(m_columnOrVariable) + ": ";
if (m_isOnlyVariables) {
radioButtonToolTip = "Replaces the " + m_columnOrVariable + " if the type stays the same.";
} else {
radioButtonToolTip = "Replaces the " + m_columnOrVariable + " and changes the " + m_columnOrVariable + " type accordingly.";
}
m_replaceRadio = new JRadioButton(radioButtonName);
m_replaceRadio.setToolTipText(radioButtonToolTip);
if (m_isOnlyVariables) {
// show all variables
m_replaceVariableCombo = new JComboBox<FlowVariable>(new DefaultComboBoxModel<FlowVariable>());
m_replaceVariableCombo.setRenderer(new FlowVariableListCellRenderer());
} else {
// show all columns
m_replaceColumnCombo = new ColumnSelectionPanel((Border) null, DataValue.class);
m_replaceColumnCombo.setRequired(false);
}
ButtonGroup buttonGroup = new ButtonGroup();
buttonGroup.add(m_appendRadio);
buttonGroup.add(m_replaceRadio);
ActionListener actionListener = new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
if (m_isOnlyVariables) {
m_replaceVariableCombo.setEnabled(m_replaceRadio.isSelected());
} else {
m_replaceColumnCombo.setEnabled(m_replaceRadio.isSelected());
}
m_newNameField.setEnabled(m_appendRadio.isSelected());
}
};
m_appendRadio.addActionListener(actionListener);
m_replaceRadio.addActionListener(actionListener);
m_compileOnCloseChecker = new JCheckBox("Syntax check on close");
m_compileOnCloseChecker.setToolTipText("Checks the syntax of the expression on close.");
m_insertMissingAsNullChecker = new JCheckBox("Insert Missing As Null");
m_insertMissingAsNullChecker.setToolTipText("If unselected, missing values in the input will produce a missing cell result");
return createPanel();
}
Aggregations