use of javax.swing.JSplitPane in project knime-core by knime.
the class DataValidatorNodeDialogPane method updateDataTableSpecComparison.
private void updateDataTableSpecComparison() {
m_refTableSpecTab.removeAll();
JPanel northern = new JPanel(new GridLayout(0, 1));
DataTableSpecView refTableSpecView = new DataTableSpecView(m_referenceDataTableSpec);
refTableSpecView.setPreferredSize(new Dimension(-1, 150));
northern.add(new JScrollPane(refTableSpecView, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));
northern.setBorder(BorderFactory.createTitledBorder("Reference Table Spec"));
if (!m_referenceDataTableSpec.equals(m_inputDataTableSpec)) {
m_refTableSpecTab.add(northern);
JPanel southern = new JPanel(new GridLayout(0, 1));
southern.setBorder(BorderFactory.createTitledBorder("Input Table Spec"));
DataTableSpecView inputTableSpec = new DataTableSpecView(m_inputDataTableSpec);
inputTableSpec.setPreferredSize(new Dimension(-1, 150));
southern.add(new JScrollPane(inputTableSpec, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED));
m_refTableSpecTab.add(new JSplitPane(JSplitPane.VERTICAL_SPLIT, northern, southern));
} else {
m_refTableSpecTab.add(northern);
}
}
use of javax.swing.JSplitPane in project knime-core by knime.
the class ParameterizedDBQueryPanel method createColumnsAndVariablesPanel.
private JComponent createColumnsAndVariablesPanel() {
/* Create database column list */
final JPanel dbColumnsPanel = new JPanel(new BorderLayout());
dbColumnsPanel.setPreferredSize(new Dimension(200, 150));
final JLabel dbColumnsLabel = new JLabel("Database Column List");
dbColumnsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
dbColumnsPanel.add(dbColumnsLabel, BorderLayout.NORTH);
dbColumnsPanel.add(new JScrollPane(m_dbColumnsList), BorderLayout.CENTER);
m_dbColumnsList.setCellRenderer(new DataColumnSpecListCellRenderer());
m_dbColumnsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
m_dbColumnsList.addKeyListener(new KeyAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void keyTyped(final KeyEvent evt) {
if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
onSelectionInDatabaseList();
}
}
});
m_dbColumnsList.addMouseListener(new MouseAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void mouseClicked(final MouseEvent evt) {
if (evt.getClickCount() == 2) {
onSelectionInDatabaseList();
}
}
});
/* Create Knime column list */
final JPanel knimeColumnsPanel = new JPanel(new BorderLayout());
knimeColumnsPanel.setPreferredSize(new Dimension(200, 150));
final JLabel knimeColumnsLabel = new JLabel("Column List");
knimeColumnsLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
knimeColumnsPanel.add(knimeColumnsLabel, BorderLayout.NORTH);
knimeColumnsPanel.add(new JScrollPane(m_knimeColumnsList), BorderLayout.CENTER);
m_knimeColumnsList.setCellRenderer(new DataColumnSpecListCellRenderer());
m_knimeColumnsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
m_knimeColumnsList.addKeyListener(new KeyAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void keyTyped(final KeyEvent evt) {
if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
onSelectionInColumnList();
}
}
});
m_knimeColumnsList.addMouseListener(new MouseAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void mouseClicked(final MouseEvent evt) {
if (evt.getClickCount() == 2) {
onSelectionInColumnList();
}
}
});
final JSplitPane columnsSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
columnsSplitPane.setResizeWeight(0.5);
columnsSplitPane.setOneTouchExpandable(true);
columnsSplitPane.setDividerSize(8);
columnsSplitPane.setTopComponent(dbColumnsPanel);
columnsSplitPane.setBottomComponent(knimeColumnsPanel);
columnsSplitPane.setDividerLocation(150);
/* Create flow variables list*/
final JPanel variablesPanel = new JPanel(new BorderLayout());
variablesPanel.setPreferredSize(new Dimension(200, 150));
final JLabel variablesLabel = new JLabel("Flow Variable List");
variablesLabel.setBorder(new EmptyBorder(5, 5, 5, 5));
variablesPanel.add(variablesLabel, BorderLayout.NORTH);
variablesPanel.add(new JScrollPane(m_flowVariablesList), BorderLayout.CENTER);
m_flowVariablesList.setCellRenderer(new FlowVariableListCellRenderer());
m_flowVariablesList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
m_flowVariablesList.addKeyListener(new KeyAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void keyTyped(final KeyEvent evt) {
if (evt.getKeyChar() == KeyEvent.VK_ENTER) {
onSelectionInFlowVariableList();
}
}
});
m_flowVariablesList.addMouseListener(new MouseAdapter() {
/**
* {@inheritDoc}
*/
@Override
public void mouseClicked(final MouseEvent evt) {
if (evt.getClickCount() == 2) {
onSelectionInFlowVariableList();
}
}
});
final JSplitPane columnsVariableSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
columnsVariableSplitPane.setResizeWeight(0.5);
columnsVariableSplitPane.setOneTouchExpandable(true);
columnsVariableSplitPane.setDividerSize(8);
columnsVariableSplitPane.setTopComponent(columnsSplitPane);
columnsVariableSplitPane.setBottomComponent(variablesPanel);
columnsVariableSplitPane.setDividerLocation(300);
return columnsVariableSplitPane;
}
use of javax.swing.JSplitPane in project knime-core by knime.
the class JavaScriptingPanel method createEditorPanel.
private JComponent createEditorPanel() {
final JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
split.setOneTouchExpandable(true);
if (m_customizer.getShowGlobalDeclarationList()) {
JScrollPane headerScroller = new JScrollPane(m_headerEdit);
String borderTitle = "Global Variable Declaration";
headerScroller.setBorder(createEmptyTitledBorder(borderTitle));
split.setTopComponent(headerScroller);
}
JScrollPane bodyScroller = new JScrollPane(m_expEdit);
String borderTitle = "Method Body";
bodyScroller.setBorder(createEmptyTitledBorder(borderTitle));
split.setBottomComponent(bodyScroller);
split.setResizeWeight(0.2);
return split;
}
use of javax.swing.JSplitPane in project knime-core by knime.
the class JavaSnippetNodeDialog method createColsAndVarsPanel.
/**
* The panel at the left with the column and variables at the input. Override this method when the columns are
* variables should not be displayed.
*
* @return the panel at the left with the column and variables at the input.
*/
protected JComponent createColsAndVarsPanel() {
final JSplitPane varSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
m_colList = new ColumnList();
final JScrollPane colListScroller = new JScrollPane(m_colList);
colListScroller.setBorder(createEmptyTitledBorder("Column List"));
varSplitPane.setTopComponent(colListScroller);
// set variable panel
m_flowVarsList = new FlowVariableList();
final JScrollPane flowVarScroller = new JScrollPane(m_flowVarsList);
flowVarScroller.setBorder(createEmptyTitledBorder("Flow Variable List"));
varSplitPane.setBottomComponent(flowVarScroller);
varSplitPane.setOneTouchExpandable(true);
varSplitPane.setResizeWeight(0.9);
return varSplitPane;
}
use of javax.swing.JSplitPane in project knime-core by knime.
the class JavaSnippetNodeDialog method createPanel.
private JPanel createPanel(final boolean isPreview) {
final JPanel p = new JPanel(new BorderLayout());
final JComponent snippet = createSnippetPanel();
final JComponent colsAndVars = createColsAndVarsPanel();
final JPanel centerPanel = new JPanel(new GridLayout(0, 1));
final JSplitPane centerSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
centerSplitPane.setLeftComponent(colsAndVars);
centerSplitPane.setRightComponent(snippet);
// colsAndVars expands to 0.3, the snippet to 0.7
centerSplitPane.setResizeWeight(0.3);
m_inFieldsTable = createInFieldsTable();
m_outFieldsTable = createOutFieldsTable();
final TableModelListener tableModelListener = e -> {
if (e.getType() != TableModelEvent.DELETE) {
// Updating completion can result in a small delay,
// so we don't update when fields are removed.
updateAutocompletion();
}
};
m_inFieldsTable.getTable().getModel().addTableModelListener(tableModelListener);
m_outFieldsTable.getTable().getModel().addTableModelListener(tableModelListener);
// use split pane for fields
m_inFieldsTable.setBorder(BorderFactory.createTitledBorder("Input"));
m_outFieldsTable.setBorder(BorderFactory.createTitledBorder("Output"));
final JSplitPane fieldsPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
fieldsPane.setTopComponent(m_inFieldsTable);
fieldsPane.setBottomComponent(m_outFieldsTable);
fieldsPane.setOneTouchExpandable(true);
final JSplitPane mainSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
mainSplitPane.setTopComponent(centerSplitPane);
// minimize size of tables at the bottom
fieldsPane.setPreferredSize(fieldsPane.getMinimumSize());
mainSplitPane.setBottomComponent(fieldsPane);
mainSplitPane.setOneTouchExpandable(true);
// snippet gets more space, table with in/out gets less extra space
mainSplitPane.setResizeWeight(0.7);
centerPanel.add(mainSplitPane);
p.add(centerPanel, BorderLayout.CENTER);
final JPanel templateInfoPanel = createTemplateInfoPanel(isPreview);
p.add(templateInfoPanel, BorderLayout.NORTH);
final JPanel optionsPanel = createOptionsPanel();
if (optionsPanel != null) {
p.add(optionsPanel, BorderLayout.SOUTH);
}
return p;
}
Aggregations