use of javax.swing.event.TableModelListener in project ACS by ACS-Community.
the class LogLevelSelectorPanel method initLogLevelsPanel.
/**
* Initialize the log level panel (i.e. the table)
*
* @return The panel with the table of log levels
*
* @throws LogLvlSelNotSupportedException If the configurable does not support selection
*/
private JComponent initLogLevelsPanel() throws AcsJCORBAProblemEx {
LogLevelHelper[] levels = loggersLbl();
model = new LogLevelModel(levels);
model.addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent e) {
applyBtn.setEnabled(userChangedLogLevels());
}
});
table = new LogLevelTable(model);
JScrollPane scrollPane = new JScrollPane(table);
return scrollPane;
}
use of javax.swing.event.TableModelListener in project intellij-community by JetBrains.
the class AbstractTableView method initializeTable.
protected final void initializeTable() {
myTable.setModelAndUpdateColumns(myTableModel);
if (getEmptyPaneText() != null) {
final CardLayout cardLayout = ((CardLayout) myInnerPanel.getLayout());
myTable.getModel().addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
cardLayout.show(myInnerPanel, myTable.getRowCount() == 0 ? EMPTY_PANE : TREE);
}
});
}
tuneTable(myTable);
}
use of javax.swing.event.TableModelListener in project intellij-community by JetBrains.
the class JavaChangeSignatureDialog method customizeParametersTable.
@Override
protected void customizeParametersTable(TableView<ParameterTableModelItemBase<ParameterInfoImpl>> table) {
final JTable t = table.getComponent();
final TableColumn defaultValue = t.getColumnModel().getColumn(2);
final TableColumn varArg = t.getColumnModel().getColumn(3);
t.removeColumn(defaultValue);
t.removeColumn(varArg);
t.getModel().addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
if (e.getType() == TableModelEvent.INSERT) {
t.getModel().removeTableModelListener(this);
final TableColumnAnimator animator = new TableColumnAnimator(t);
animator.setStep(48);
animator.addColumn(defaultValue, (t.getWidth() - 48) / 3);
animator.addColumn(varArg, 48);
animator.startAndDoWhenDone(() -> t.editCellAt(t.getRowCount() - 1, 0));
animator.start();
}
}
});
}
use of javax.swing.event.TableModelListener in project intellij-community by JetBrains.
the class ChangeClassSignatureDialog method createCenterPanel.
protected JComponent createCenterPanel() {
myTable = new JBTable(myTableModel);
myTable.setStriped(true);
TableColumn nameColumn = myTable.getColumnModel().getColumn(NAME_COLUMN);
TableColumn boundColumn = myTable.getColumnModel().getColumn(BOUND_VALUE_COLUMN);
TableColumn valueColumn = myTable.getColumnModel().getColumn(DEFAULT_VALUE_COLUMN);
Project project = myClass.getProject();
nameColumn.setCellRenderer(new MyCellRenderer());
nameColumn.setCellEditor(new StringTableCellEditor(project));
boundColumn.setCellRenderer(new MyCodeFragmentTableCellRenderer());
boundColumn.setCellEditor(new JavaCodeFragmentTableCellEditor(project));
valueColumn.setCellRenderer(new MyCodeFragmentTableCellRenderer());
valueColumn.setCellEditor(new JavaCodeFragmentTableCellEditor(project));
myTable.setPreferredScrollableViewportSize(new Dimension(210, myTable.getRowHeight() * 4));
myTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
myTable.getSelectionModel().setSelectionInterval(0, 0);
myTable.setSurrendersFocusOnKeystroke(true);
myTable.setCellSelectionEnabled(true);
myTable.setFocusCycleRoot(true);
if (myHideDefaultValueColumn) {
final TableColumn defaultValue = myTable.getColumnModel().getColumn(DEFAULT_VALUE_COLUMN);
myTable.removeColumn(defaultValue);
myTable.getModel().addTableModelListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
if (e.getType() == TableModelEvent.INSERT) {
myTable.getModel().removeTableModelListener(this);
final TableColumnAnimator animator = new TableColumnAnimator(myTable);
animator.setStep(20);
animator.addColumn(defaultValue, myTable.getWidth() / 2);
animator.startAndDoWhenDone(() -> myTable.editCellAt(myTable.getRowCount() - 1, 0));
animator.start();
}
}
});
}
final JPanel panel = new JPanel(new BorderLayout());
panel.add(SeparatorFactory.createSeparator(RefactoringBundle.message("changeClassSignature.parameters.panel.border.title"), myTable), BorderLayout.NORTH);
panel.add(ToolbarDecorator.createDecorator(myTable).createPanel(), BorderLayout.CENTER);
return panel;
}
use of javax.swing.event.TableModelListener in project libgdx by libgdx.
the class DynamicsInfluencerPanel method initializeComponents.
protected void initializeComponents() {
super.initializeComponents();
JPanel velocitiesPanel = new JPanel();
velocitiesPanel.setLayout(new GridBagLayout());
{
JPanel sideButtons = new JPanel(new GridBagLayout());
velocitiesPanel.add(sideButtons, new GridBagConstraints(1, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
{
sideButtons.add(velocityBox = new JComboBox(new DefaultComboBoxModel()), new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
}
{
JButton newButton = new JButton("New");
sideButtons.add(newButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
newButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
createVelocity(velocityBox.getSelectedItem());
}
});
}
{
JButton deleteButton = new JButton("Delete");
sideButtons.add(deleteButton, new GridBagConstraints(0, -1, 1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 6, 0), 0, 0));
deleteButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event) {
deleteVelocity();
}
});
}
}
JScrollPane scroll = new JScrollPane();
velocitiesPanel.add(scroll, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 6), 0, 0));
velocityTable = new JTable() {
public Class getColumnClass(int column) {
return column == 1 ? Boolean.class : super.getColumnClass(column);
}
@Override
public Dimension getPreferredScrollableViewportSize() {
Dimension dim = super.getPreferredScrollableViewportSize();
dim.height = getPreferredSize().height;
return dim;
}
};
velocityTable.getTableHeader().setReorderingAllowed(false);
velocityTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
scroll.setViewportView(velocityTable);
velocityTableModel = new DefaultTableModel(new String[0][0], new String[] { "Velocity", "Active" });
velocityTable.setModel(velocityTableModel);
velocityTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent event) {
if (event.getValueIsAdjusting())
return;
velocitySelected();
}
});
velocityTableModel.addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent event) {
if (event.getColumn() != 1)
return;
velocityChecked(event.getFirstRow(), (Boolean) velocityTable.getValueAt(event.getFirstRow(), 1));
}
});
//Velocity values
emptyPanel = new ParticleValuePanel(editor, "", "", true, false);
strengthVelocityPanel = new StrengthVelocityPanel(editor, null, "Life", "", "");
angularVelocityPanel = new AngularVelocityPanel(editor, null, "Life", "", "");
strengthVelocityPanel.setVisible(false);
angularVelocityPanel.setVisible(false);
emptyPanel.setVisible(false);
strengthVelocityPanel.setIsAlwayShown(true);
angularVelocityPanel.setIsAlwayShown(true);
emptyPanel.setIsAlwayShown(true);
emptyPanel.setValue(null);
//Assemble
int i = 0;
addContent(i++, 0, velocitiesPanel);
addContent(i++, 0, strengthVelocityPanel);
addContent(i++, 0, angularVelocityPanel);
addContent(i++, 0, emptyPanel);
}
Aggregations