Search in sources :

Example 1 with PreviewTableContentView

use of org.knime.base.node.io.filereader.PreviewTableContentView in project knime-core by knime.

the class FixedWidthFRNodeDialog method createPreviewPanel.

/**
 * @return jpanel with all the preview components
 */
private JPanel createPreviewPanel() {
    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Preview"));
    Box tableBox = Box.createHorizontalBox();
    PreviewTableContentView ptcv = new PreviewTableContentView();
    m_previewTableView = new TableView(ptcv);
    tableBox.add(m_previewTableView);
    panel.add(Box.createGlue());
    panel.add(tableBox);
    ptcv.addPropertyChangeListener(PreviewTableContentView.PROPERTY_SPEC_CHANGED, new PropertyChangeListener() {

        @Override
        public void propertyChange(final PropertyChangeEvent evt) {
            m_colIdx = (int) evt.getNewValue();
            m_colIdx = m_nodeSettings.getColIdxIncluded(m_colIdx);
            if (m_colIdx < m_nodeSettings.getNumberOfColumns() - 1) {
                // don't open edit dialog if clicked column equals
                // remaining characters column
                onEdit(m_colIdx);
            }
        }
    });
    return panel;
}
Also used : JPanel(javax.swing.JPanel) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) BoxLayout(javax.swing.BoxLayout) Box(javax.swing.Box) JCheckBox(javax.swing.JCheckBox) PreviewTableContentView(org.knime.base.node.io.filereader.PreviewTableContentView) TableView(org.knime.core.node.tableview.TableView)

Aggregations

PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 Box (javax.swing.Box)1 BoxLayout (javax.swing.BoxLayout)1 JCheckBox (javax.swing.JCheckBox)1 JPanel (javax.swing.JPanel)1 PreviewTableContentView (org.knime.base.node.io.filereader.PreviewTableContentView)1 TableView (org.knime.core.node.tableview.TableView)1