use of javax.swing.event.TableModelListener in project sldeditor by robward-scisys.
the class DataSourceConfigPanel method createTable.
/**
* Creates the table.
*
* @return the component
*/
private Component createTable() {
final UndoActionInterface parentObj = this;
dataModel = new DataSourceAttributeModel();
dataModel.addTableModelListener(new TableModelListener() {
/**
* Table changed.
*
* @param arg0 the arg0
*/
@Override
public void tableChanged(TableModelEvent arg0) {
if (!isPopulatingTable()) {
dataChanged = true;
updateButtonState();
}
}
});
table = new JTable();
table.setModel(dataModel);
table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override
public void valueChanged(ListSelectionEvent arg0) {
updateButtonState();
}
});
TableColumn tmpColum = table.getColumnModel().getColumn(1);
JComboBox<String> comboBox = new JComboBox<String>(dataModel.getTypeData());
DefaultCellEditor defaultCellEditor = new DefaultCellEditor(comboBox);
tmpColum.setCellEditor(defaultCellEditor);
tmpColum.setCellRenderer(new ComboBoxCellRenderer(comboBox));
JPanel buttonPanel = new JPanel();
FlowLayout flowLayout = (FlowLayout) buttonPanel.getLayout();
flowLayout.setHgap(1);
flowLayout.setAlignment(FlowLayout.TRAILING);
add(buttonPanel, BorderLayout.SOUTH);
btnDisconnect = new JButton(Localisation.getString(DataSourceConfigPanel.class, "DataSourceConfigPanel.disconnect"));
btnDisconnect.setEnabled(false);
btnDisconnect.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
SLDEditorFile.getInstance().getSLDData().setDataSourceProperties(DataSourceConnectorFactory.getNoDataSource());
applyData(parentObj);
}
});
buttonPanel.add(btnDisconnect);
btnAddField = new JButton(Localisation.getString(DataSourceConfigPanel.class, "DataSourceConfigPanel.add"));
btnAddField.setEnabled(false);
btnAddField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
addNewField();
}
});
buttonPanel.add(btnAddField);
btnRemoveField = new JButton(Localisation.getString(DataSourceConfigPanel.class, "DataSourceConfigPanel.remove"));
btnRemoveField.setEnabled(false);
btnRemoveField.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
removeField();
}
});
buttonPanel.add(btnRemoveField);
btnApply = new JButton(Localisation.getString(DataSourceConfigPanel.class, "common.apply"));
btnApply.setEnabled(false);
btnApply.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
applyData(parentObj);
}
});
buttonPanel.add(btnApply);
btnCancel = new JButton(Localisation.getString(DataSourceConfigPanel.class, "common.cancel"));
btnCancel.setEnabled(false);
btnCancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
cancelData();
}
});
buttonPanel.add(btnCancel);
JScrollPane scrollPane = new JScrollPane(table);
return scrollPane;
}
use of javax.swing.event.TableModelListener in project Spark by igniterealtime.
the class OTRPrefPanel method loadRemoteKeys.
private void loadRemoteKeys() {
for (RosterEntry entry : Roster.getInstanceFor(SparkManager.getConnection()).getEntries()) {
SessionID curSession = new SessionID(SparkManager.getConnection().getUser(), entry.getUser(), "Scytale");
String remoteKey = _keyManager.getRemoteFingerprint(curSession);
if (remoteKey != null) {
boolean isVerified = _keyManager.isVerified(curSession);
_keytable.addEntry(entry.getUser(), remoteKey, isVerified);
}
}
_keytable.addTableChangeListener(new TableModelListener() {
@Override
public void tableChanged(TableModelEvent e) {
int col = e.getColumn();
int row = e.getFirstRow();
if (col == 2) {
boolean selection = (Boolean) _keytable.getValueAt(row, col);
String JID = (String) _keytable.getValueAt(row, 0);
SessionID curSelectedSession = new SessionID(SparkManager.getConnection().getUser(), JID, "Scytale");
if (!selection) {
_keyManager.verify(curSelectedSession);
} else {
_keyManager.unverify(curSelectedSession);
}
}
}
});
}
use of javax.swing.event.TableModelListener in project blue by kunstmusik.
the class OpcodeList method fireTableDataChanged.
private void fireTableDataChanged() {
if (listeners == null) {
return;
}
TableModelEvent tme = new TableModelEvent(this);
for (Iterator<TableModelListener> iter = listeners.iterator(); iter.hasNext(); ) {
TableModelListener listener = iter.next();
listener.tableChanged(tme);
}
}
use of javax.swing.event.TableModelListener in project blue by kunstmusik.
the class TrackList method fireTableModelEvent.
private void fireTableModelEvent(TableModelEvent tme) {
if (listeners != null) {
for (Iterator iter = listeners.iterator(); iter.hasNext(); ) {
TableModelListener listener = (TableModelListener) iter.next();
listener.tableChanged(tme);
}
}
}
use of javax.swing.event.TableModelListener in project blue by kunstmusik.
the class PatternObject method fireTableDataChanged.
private void fireTableDataChanged() {
if (listeners == null) {
return;
}
TableModelEvent tme = new TableModelEvent(this);
for (Iterator iter = listeners.iterator(); iter.hasNext(); ) {
TableModelListener listener = (TableModelListener) iter.next();
listener.tableChanged(tme);
}
}
Aggregations