use of javax.swing.Box in project knime-core by knime.
the class EditNominalDomainNodeDialogPane method createLegend.
/**
* UI creation methods.
*/
private Component createLegend() {
Box buttonBox = Box.createVerticalBox();
buttonBox.add(createLabel("Created value", Color.GREEN));
buttonBox.add(createLabel("Sorted value <br/>which does not exist", Color.RED));
buttonBox.setBorder(BorderFactory.createTitledBorder("Legend"));
return buttonBox;
}
use of javax.swing.Box in project knime-core by knime.
the class InteractiveHistogramProperties method createColumnSettingsBox.
/**
* The columns settings panel which contains the x column
* and aggregation column selection box.
*
* @return the columns selection panel
*/
private Box createColumnSettingsBox() {
// the x column box
final Box xColumnBox = Box.createHorizontalBox();
// xColumnBox.setBorder(BorderFactory
// .createEtchedBorder(EtchedBorder.RAISED));
final JLabel xColLabelLabel = new JLabel(X_COLUMN_LABEL);
xColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
xColumnBox.add(xColLabelLabel);
xColumnBox.add(Box.createHorizontalGlue());
xColumnBox.add(m_xCol);
xColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
// the aggregation column box
final Box aggrColumnBox = Box.createHorizontalBox();
// xColumnBox.setBorder(BorderFactory
// .createEtchedBorder(EtchedBorder.RAISED));
final JLabel aggrColLabelLabel = new JLabel(AGGREGATION_COLUMN_LABEL);
aggrColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
aggrColumnBox.add(aggrColLabelLabel);
aggrColumnBox.add(Box.createHorizontalGlue());
aggrColumnBox.add(m_aggrCol);
aggrColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
// final Box aggrColumnBox = Box.createHorizontalBox();
// aggrColumnBox.add(m_aggrCol);
// aggrColumnBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
// the box which surround both column selection boxes
final Box columnsBox = Box.createVerticalBox();
columnsBox.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
columnsBox.add(Box.createVerticalGlue());
columnsBox.add(xColumnBox);
columnsBox.add(Box.createVerticalGlue());
columnsBox.add(aggrColumnBox);
columnsBox.add(Box.createVerticalGlue());
return columnsBox;
}
use of javax.swing.Box in project knime-core by knime.
the class RankNodeDialog method initRankButtonBox.
private Box initRankButtonBox() {
Box buttonBox = Box.createVerticalBox();
buttonBox.setBorder(new TitledBorder("Actions"));
JButton buttonAdd = new JButton("Add");
JButton buttonRemove = new JButton("Remove");
JButton buttonRemoveAll = new JButton("Remove All");
JButton buttonUp = new JButton("Up");
JButton buttonDown = new JButton("Down");
Dimension allButtons = buttonRemoveAll.getPreferredSize();
buttonAdd.setMinimumSize(allButtons);
buttonAdd.setMaximumSize(allButtons);
buttonRemove.setMinimumSize(allButtons);
buttonRemove.setMaximumSize(allButtons);
buttonRemoveAll.setMinimumSize(allButtons);
buttonRemoveAll.setMaximumSize(allButtons);
buttonUp.setMinimumSize(allButtons);
buttonUp.setMaximumSize(allButtons);
buttonDown.setMinimumSize(allButtons);
buttonDown.setMaximumSize(allButtons);
buttonBox.add(buttonAdd);
buttonBox.add(buttonRemove);
buttonBox.add(buttonRemoveAll);
buttonBox.add(buttonUp);
buttonBox.add(buttonDown);
buttonAdd.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
if (!m_availableCols.isEmpty()) {
if (m_rankJTable.isEditing()) {
m_rankJTable.getCellEditor().stopCellEditing();
}
DataColumnSpec colSpec = m_availableCols.peek();
Object[] row = new Object[] { colSpec, "Ascending" };
m_rankTableModel.addRow(row);
m_rankCols.add(colSpec);
m_availableCols.remove(colSpec);
removeItemGroupColEditor(colSpec);
}
}
});
buttonRemove.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
int index = m_rankJTable.getSelectedRow();
if (index == -1) {
index = m_rankJTable.getEditingRow();
}
if (index != -1) {
if (m_rankJTable.isEditing()) {
m_rankJTable.getCellEditor().stopCellEditing();
}
DataColumnSpec colSpec = (DataColumnSpec) m_rankTableModel.getValueAt(index, 0);
m_rankTableModel.removeRow(index);
m_rankCols.remove(colSpec);
if (!m_rankCols.contains(colSpec)) {
add2AvailableList(colSpec);
addItemGroupColEditor(colSpec);
}
}
}
});
buttonRemoveAll.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent arg0) {
if (m_rankJTable.isEditing()) {
m_rankJTable.getCellEditor().stopCellEditing();
}
if (m_rankJTable.getRowCount() > 0) {
m_rankCols.clear();
for (int r = 0; r < m_rankTableModel.getRowCount(); r++) {
DataColumnSpec colSpec = (DataColumnSpec) m_rankTableModel.getValueAt(r, 0);
add2AvailableList(colSpec);
addItemGroupColEditor(colSpec);
}
m_rankTableModel.setRowCount(0);
}
}
});
buttonUp.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
int row = m_rankJTable.getSelectedRow();
if (row == -1) {
row = m_rankJTable.getEditingRow();
}
if (row > 0) {
m_availableEdited = true;
if (m_rankJTable.isEditing()) {
m_rankJTable.getCellEditor().stopCellEditing();
}
m_rankTableModel.moveRow(row, row, row - 1);
m_availableEdited = false;
}
}
});
buttonDown.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
int row = m_rankJTable.getSelectedRow();
if (row == -1) {
m_rankJTable.getEditingRow();
}
if (row != -1 && row < m_rankJTable.getRowCount() - 1) {
if (m_rankJTable.isEditing()) {
m_rankJTable.getCellEditor().stopCellEditing();
}
m_rankTableModel.moveRow(row, row, row + 1);
}
}
});
return buttonBox;
}
use of javax.swing.Box in project knime-core by knime.
the class RankNodeDialog method initPanel.
private JPanel initPanel() {
JPanel jp = new JPanel();
jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
Box rankColSelection = Box.createHorizontalBox();
// add column list
Box rankCols = initRankTableBox();
rankColSelection.add(rankCols);
// add buttons
Box rankButtonBox = initRankButtonBox();
rankColSelection.add(rankButtonBox);
Box groupColSelection = Box.createHorizontalBox();
groupColSelection.add(initGroupTableBox());
groupColSelection.add(initGroupButtonBox());
Box otherOptions = Box.createHorizontalBox();
otherOptions.add(Box.createHorizontalGlue());
Box modusBox = Box.createHorizontalBox();
modusBox.setBorder(new TitledBorder("Ranking Mode"));
modusBox.add(new JLabel("Mode: "));
Box radioPanel = Box.createVerticalBox();
ButtonGroup modusGroup = new ButtonGroup();
m_modusGroup = modusGroup;
for (RankMode rankMode : RankMode.values()) {
JRadioButton radio = new JRadioButton(rankMode.toString());
modusGroup.add(radio);
radioPanel.add(radio);
if (m_rankMode.getStringValue().equals(radio.getText())) {
radio.setSelected(true);
}
}
modusBox.add(radioPanel);
otherOptions.add(modusBox);
otherOptions.add(Box.createHorizontalGlue());
otherOptions.add(initOtherOptionsBox());
otherOptions.add(Box.createHorizontalGlue());
jp.add(rankColSelection);
jp.add(groupColSelection);
jp.add(otherOptions);
otherOptions.revalidate();
otherOptions.repaint();
return jp;
}
use of javax.swing.Box in project knime-core by knime.
the class PieProperties method createVizSettingsPanel.
/**
* The visualization panel with the following options:
* <ol>
* <li>Show grid line</li>
* <li>Show bar outline</li>
* </ol>.
*
* @return the visualization settings panel
*/
private JPanel createVizSettingsPanel() {
final JPanel vizPanel = new JPanel();
// visualisation box
final Box vizBox = Box.createVerticalBox();
vizBox.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Display option"));
vizBox.add(Box.createVerticalGlue());
vizBox.add(m_showMissingValSection);
vizBox.add(Box.createVerticalGlue());
vizBox.add(Box.createVerticalGlue());
vizBox.add(m_showSectionOutline);
vizBox.add(Box.createVerticalGlue());
vizBox.add(m_explodeSelectedSections);
vizBox.add(Box.createVerticalGlue());
vizBox.add(m_showDetails);
vizBox.add(Box.createVerticalGlue());
// label layout box
final Box labelBox = GUIUtils.createButtonGroupBox(m_labelDisplayPolicy, true, "Labels", true);
// scale box
final Box scaleBox = GUIUtils.createButtonGroupBox(m_valueScale, true, "Scale", true);
// bar layout box
final Box pieLayoutBox = Box.createVerticalBox();
pieLayoutBox.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Pie Layout"));
pieLayoutBox.add(Box.createVerticalGlue());
pieLayoutBox.add(new JLabel(PIE_SIZE_LABEL));
pieLayoutBox.add(Box.createVerticalGlue());
pieLayoutBox.add(m_pieSize);
pieLayoutBox.add(Box.createVerticalGlue());
pieLayoutBox.add(new JLabel(EXPLODE_SIZE_LABEL));
pieLayoutBox.add(Box.createVerticalGlue());
pieLayoutBox.add(m_explodeSize);
pieLayoutBox.add(Box.createVerticalGlue());
final Box rootBox = Box.createHorizontalBox();
rootBox.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED));
rootBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
rootBox.add(vizBox);
rootBox.add(Box.createHorizontalGlue());
rootBox.add(labelBox);
rootBox.add(Box.createHorizontalGlue());
rootBox.add(Box.createHorizontalGlue());
rootBox.add(scaleBox);
rootBox.add(Box.createHorizontalGlue());
rootBox.add(pieLayoutBox);
rootBox.add(Box.createRigidArea(HORIZONTAL_SPACER_DIM));
vizPanel.add(rootBox);
return vizPanel;
}
Aggregations