use of javax.swing.event.TableModelListener in project blue by kunstmusik.
the class Arrangement 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);
}
if (arrangementListeners != null) {
fireArrangementChanged(new ArrangementEvent(ArrangementEvent.UPDATE, null, null));
}
}
use of javax.swing.event.TableModelListener in project blue by kunstmusik.
the class Line method fireTableChanged.
public void fireTableChanged(TableModelEvent e) {
if (listeners != null) {
for (Iterator iter = listeners.iterator(); iter.hasNext(); ) {
TableModelListener listener = (TableModelListener) iter.next();
listener.tableChanged(e);
}
}
}
use of javax.swing.event.TableModelListener in project blue by kunstmusik.
the class MarkersList method removeMarker.
public void removeMarker(int index) {
Marker m = (Marker) markers.remove(index);
m.removePropertyChangeListener(this);
if (listeners == null) {
return;
}
TableModelEvent tme = new TableModelEvent(this, index, index, TableModelEvent.ALL_COLUMNS, TableModelEvent.DELETE);
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 ParameterLineView method editPoints.
private void editPoints() {
TableView<LinePoint> table = new TableView<>();
TableColumn<LinePoint, Double> xCol = new TableColumn<>("x");
TableColumn<LinePoint, Double> yCol = new TableColumn<>("y");
table.getColumns().setAll(xCol, yCol);
table.setColumnResizePolicy(TableView.CONSTRAINED_RESIZE_POLICY);
table.setItems(getSelectedLine().getObservableList());
table.setEditable(true);
xCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<LinePoint, Double>, ObservableValue<Double>>() {
@Override
public ObservableValue<Double> call(TableColumn.CellDataFeatures<LinePoint, Double> param) {
return new ReadOnlyObjectWrapper<>(param.getValue().getX() * getDuration() + getStartTime());
}
});
xCol.setCellFactory(TextFieldTableCell.forTableColumn(new DoubleStringConverter()));
xCol.setOnEditCommit(te -> {
LinePoint lp = te.getRowValue();
ObservableList<LinePoint> lpList = getSelectedLine().getObservableList();
if (getSelectedLine().getLinePoint(0) == lp || getSelectedLine().getLinePoint(getSelectedLine().size() - 1) == lp) {
return;
}
int index = lpList.indexOf(lp);
double v = (te.getNewValue() - getStartTime()) / getDuration();
lp.setX(Utils.clamp(lpList.get(index - 1).getX(), v, lpList.get(index + 1).getX()));
});
xCol.setEditable(true);
yCol.setCellValueFactory(new PropertyValueFactory<>("y"));
yCol.setCellFactory(TextFieldTableCell.forTableColumn(new DoubleStringConverter()));
yCol.setOnEditCommit(te -> {
te.getRowValue().setY(Utils.clamp(getSelectedLine().getMin(), te.getNewValue(), getSelectedLine().getMax()));
});
yCol.setEditable(true);
Dialog<ButtonType> d = new Dialog<>();
d.initOwner(getScene().getWindow());
d.initModality(Modality.APPLICATION_MODAL);
d.getDialogPane().setContent(new ScrollPane(table));
d.getDialogPane().getStylesheets().add(BlueFX.getBlueFxCss());
d.getDialogPane().getButtonTypes().setAll(ButtonType.OK);
d.setTitle("Edit Points");
TableModelListener tml = tme -> {
repaint();
};
getSelectedLine().addTableModelListener(tml);
Optional<ButtonType> res = d.showAndWait();
getSelectedLine().removeTableModelListener(tml);
}
use of javax.swing.event.TableModelListener in project blue by kunstmusik.
the class LiveObjectSetListTableModel method fireTableDataChanged.
private void fireTableDataChanged(TableModelEvent tme) {
if (tableListeners == null) {
return;
}
for (Iterator iter = tableListeners.iterator(); iter.hasNext(); ) {
TableModelListener listener = (TableModelListener) iter.next();
listener.tableChanged(tme);
}
}
Aggregations