use of blue.blueLive.LiveObject in project blue by kunstmusik.
the class LiveDataTest method testSerialization.
public void testSerialization() {
LiveData liveData = new LiveData();
final LiveObjectBins liveObjectBins = liveData.getLiveObjectBins();
liveObjectBins.setLiveObject(0, 0, new LiveObject(new GenericScore()));
liveObjectBins.setLiveObject(0, 2, new LiveObject(new GenericScore()));
liveObjectBins.setLiveObject(0, 4, new LiveObject(new GenericScore()));
liveObjectBins.setLiveObject(0, 6, new LiveObject(new GenericScore()));
Element elem1 = liveData.saveAsXML(null);
Element elem2;
try {
elem2 = LiveData.loadFromXML(elem1, null).saveAsXML(null);
System.out.println(elem1.toString() + "\n\n" + elem2.toString());
assertEquals(elem1.toString(), elem2.toString());
} catch (Exception ex) {
ex.printStackTrace();
fail("Did not load from xml");
}
}
use of blue.blueLive.LiveObject in project blue by kunstmusik.
the class BlueLiveTopComponent method addSoundObject.
protected void addSoundObject(int column, int row, SoundObject sObj) {
model.setValueAt(new LiveObject(sObj), row, column);
liveObjectsTable.setRowSelectionInterval(row, row);
liveObjectsTable.setColumnSelectionInterval(column, column);
}
use of blue.blueLive.LiveObject in project blue by kunstmusik.
the class LiveObjectsTableModel method scoreObjectChanged.
@Override
public void scoreObjectChanged(ScoreObjectEvent event) {
if (event.getPropertyChanged() == ScoreObjectEvent.NAME) {
LiveObject lObj = getLiveObjectForSoundObject((SoundObject) event.getScoreObject());
if (lObj != null) {
int row = bins.getRowForObject(lObj);
int column = bins.getColumnForObject(lObj);
fireTableDataChanged(new TableModelEvent(this, row, row, column, TableModelEvent.UPDATE));
}
}
}
use of blue.blueLive.LiveObject in project blue by kunstmusik.
the class LiveObjectsTableModel method setLiveObjectBins.
public void setLiveObjectBins(LiveObjectBins bins) {
if (this.bins != null) {
for (int i = 0; i < this.bins.getColumnCount(); i++) {
for (int j = 0; j < this.bins.getRowCount(); j++) {
LiveObject lObj = this.bins.getLiveObject(i, j);
if (lObj != null && lObj.getSoundObject() != null) {
lObj.getSoundObject().removeScoreObjectListener(this);
}
}
}
bins.removePropertyChangeListener(this);
}
this.bins = bins;
for (int i = 0; i < bins.getColumnCount(); i++) {
for (int j = 0; j < bins.getRowCount(); j++) {
LiveObject lObj = bins.getLiveObject(i, j);
if (lObj != null && lObj.getSoundObject() != null) {
lObj.getSoundObject().addScoreObjectListener(this);
}
}
}
fireTableDataChanged(new TableModelEvent(this, TableModelEvent.HEADER_ROW));
bins.addPropertyChangeListener(this);
}
use of blue.blueLive.LiveObject in project blue by kunstmusik.
the class LiveObjectsTableModel method setValueAt.
@Override
public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
if (rowIndex >= 0 && rowIndex < bins.getRowCount() && columnIndex >= 0 && columnIndex < bins.getColumnCount()) {
LiveObject oldLiveObj = bins.getLiveObject(columnIndex, rowIndex);
LiveObject newObj = (LiveObject) aValue;
if (oldLiveObj != null && oldLiveObj.getSoundObject() != null) {
oldLiveObj.getSoundObject().removeScoreObjectListener(this);
}
bins.setLiveObject(columnIndex, rowIndex, newObj);
if (newObj != null && newObj.getSoundObject() != null) {
newObj.getSoundObject().addScoreObjectListener(this);
}
fireTableDataChanged();
}
}
Aggregations