gt:         Insets leftCategoryInsets = new Insets(11, 8, 3, 8);
context: /*
   * ------------------------------------------------------------------------
   *  Copyright by KNIME GmbH, Konstanz, Germany
   *  Website: http://www.knime.org; Email: contact@knime.org
   *
   *  This program is free software; you can redistribute it and/or modify
   *  it under the terms of the GNU General Public License, Version 3, as
   *  published by the Free Software Foundation.
   *
   *  This program is distributed in the hope that it will be useful, but
   *  WITHOUT ANY WARRANTY; without even the implied warranty of
   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   *  GNU General Public License for more details.
   *
   *  You should have received a copy of the GNU General Public License
   *  along with this program; if not, see <http://www.gnu.org/licenses>.
   *
   *  Additional permission under GNU GPL version 3 section 7:
   *
   *  KNIME interoperates with ECLIPSE solely via ECLIPSE's plug-in APIs.
   *  Hence, KNIME and ECLIPSE are both independent programs and are not
   *  derived from each other. Should, however, the interpretation of the
   *  GNU GPL Version 3 ("License") under any applicable laws result in
   *  KNIME and ECLIPSE being a combined program, KNIME GMBH herewith grants
   *  you the additional permission to use and propagate KNIME together with
   *  ECLIPSE with only the license terms in place for ECLIPSE applying to
   *  ECLIPSE and the GNU GPL Version 3 applying for KNIME, provided the
   *  license terms of ECLIPSE themselves allow for the respective use and
   *  propagation of ECLIPSE together with KNIME.
   *
   *  Additional permission relating to nodes for KNIME that extend the Node
   *  Extension (and in particular that are based on subclasses of NodeModel,
   *  NodeDialog, and NodeView) and that only interoperate with KNIME through
   *  standard APIs ("Nodes"):
   *  Nodes are deemed to be separate and independent programs and to not be
   *  covered works.  Notwithstanding anything to the contrary in the
   *  License, the License does not apply to Nodes, you are not required to
   *  license Nodes under the License, and you are granted a license to
   *  prepare and propagate Nodes, in each case even if such Nodes are
   *  propagated with or for interoperation with KNIME.  The owner of a Node
   *  may freely choose the license terms applicable to such Node, including
   *  when such Node is propagated with or for interoperation with KNIME.
   * ------------------------------------------------------------------------
   *
   * History
   *   26.03.2012 (hofer): created
   */
  package de.pavloff.spark4knime.jsnippet.ui;
  
  
  import java.awt.BorderLayout;
  import java.awt.Component;
  import java.awt.Container;
  import java.awt.Dimension;
  import java.awt.FlowLayout;
  import java.awt.Frame;
  import java.awt.GridBagConstraints;
  import java.awt.GridBagLayout;
  import java.awt.Insets;
  import java.awt.Toolkit;
  import java.awt.event.ActionEvent;
  import java.awt.event.ActionListener;
  import java.util.HashMap;
  import java.util.HashSet;
  import java.util.Map;
  import java.util.Set;
  
  import javax.swing.ButtonGroup;
  import javax.swing.JButton;
  import javax.swing.JCheckBox;
  import javax.swing.JComboBox;
  import javax.swing.JDialog;
  import javax.swing.JLabel;
  import javax.swing.JList;
  import javax.swing.JPanel;
  import javax.swing.JRadioButton;
  import javax.swing.JTextField;
  import javax.swing.WindowConstants;
  
  import de.pavloff.spark4knime.jsnippet.JavaField;
  import de.pavloff.spark4knime.jsnippet.JavaField.OutCol;
  import de.pavloff.spark4knime.jsnippet.JavaField.OutVar;
  import de.pavloff.spark4knime.jsnippet.type.TypeProvider;
  import de.pavloff.spark4knime.jsnippet.ui.FieldsTableModel.Column;
  import de.pavloff.spark4knime.jsnippet.ui.OutFieldsTable.FieldType;
  import org.knime.core.data.DataColumnSpec;
  import org.knime.core.data.DataTableSpec;
  import org.knime.core.data.DataType;
  import org.knime.core.data.collection.ListCell;
  import org.knime.core.data.def.StringCell;
  import org.knime.core.node.util.DataColumnSpecListCellRenderer;
  import org.knime.core.node.util.DataTypeListCellRenderer;
  import org.knime.core.node.util.FlowVariableListCellRenderer;
  import org.knime.core.node.workflow.FlowVariable;
  
  /**
   * A dialog with most basic settings for an output field.
   *
   * @author Heiko Hofer
   */
  @SuppressWarnings("serial")
  public final class AddOutFieldDialog extends JDialog {
      private JavaField m_result;
  
      private final OutFieldsTableModel m_model;
      private final DataTableSpec m_spec;
      private final Map<String, FlowVariable> m_flowVars;
      private final boolean m_flowVarsOnly;
  
      private final JComboBox m_fieldType;
      private final JCheckBox m_isArray;
      private final JRadioButton m_replace;
      private final JRadioButton m_append;
  
      private final JComboBox m_replacedKnimeName;
      private final JTextField m_knimeName;
      private final JComboBox m_knimeType;
  
  
      /**
       * Create a new dialog.
       *
       * @param parent frame who owns this dialog
       * @param model the model used for validation
       * @param spec the DataTableSpec of the input table
       * @param flowVars the flow variables on the input
       * @param flowVarsOnly true when only flow variables can be defined
       */
      private AddOutFieldDialog(final Frame parent,
              final OutFieldsTableModel model,
              final DataTableSpec spec,
              final Map<String, FlowVariable> flowVars,
              final boolean flowVarsOnly) {
          super(parent, true);
  
          m_model = model;
          m_spec = spec;
          m_flowVars = flowVars;
          m_flowVarsOnly = flowVarsOnly;
  
          setTitle("Add output field");
  
          // initialize fields
          m_replace = new JRadioButton("Replace:");
          m_replace.setSelected(true);
          m_append = new JRadioButton("Append:");
          m_replacedKnimeName = new JComboBox();
  
          m_fieldType = new JComboBox();
          m_knimeName = new JTextField();
          m_knimeType = new JComboBox();
          m_isArray = new JCheckBox("Is array");
  
          // instantiate the components of the dialog
          JPanel p = createPanel();
  
          // the OK and Cancel button
          JPanel control = new JPanel(new FlowLayout(FlowLayout.RIGHT));
          JButton ok = new JButton("OK");
          // add action listener
          ok.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(final ActionEvent e) {
                  onOK();
              }
          });
          JButton cancel = new JButton("Cancel");
          // add action listener
          cancel.addActionListener(new ActionListener() {
              @Override
              public void actionPerformed(final ActionEvent event) {
                  onCancel();
              }
          });
          control.add(ok);
          control.add(cancel);
  
          // add dialog and control panel to the content pane
          Container cont = getContentPane();
          cont.setLayout(new BorderLayout());
          cont.add(p, BorderLayout.CENTER);
          cont.add(control, BorderLayout.SOUTH);
  
          setModal(true);
          setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  
      }
  
      private JPanel createPanel() {
          JPanel p = new JPanel(new GridBagLayout());
          GridBagConstraints c = new GridBagConstraints();
          c.fill = GridBagConstraints.HORIZONTAL;
          c.anchor = GridBagConstraints.BASELINE;
          c.insets = new Insets(2, 2, 2, 2);
          c.gridx = 0;
          c.gridy = 0;
          c.gridwidth = 1;
          c.weightx = 0;
          c.weighty = 0;
  
          Insets leftInsets = new Insets(3, 8, 3, 8);
          Insets rightInsets = new Insets(3, 0, 3, 8);
  