use of blue.components.lines.Line in project blue by kunstmusik.
the class ZakLineListTableModel method setValueAt.
/**
* Sets value stored in table, difference from base class being the 2nd
* column is zak channel
*/
@Override
public void setValueAt(Object value, int row, int col) {
if (col == 1) {
Line line = lines.get(row);
String strChannel = (String) value;
try {
int tempChannel = Integer.parseInt(strChannel);
if (tempChannel < 0) {
throw new NumberFormatException("Zak Channel numbers must be 0 or greater");
}
line.setChannel(tempChannel);
fireTableCellUpdated(row, col);
} catch (NumberFormatException e) {
String errorMessage = BlueSystem.getString("message.line.channelParseErr");
JOptionPane.showMessageDialog(null, errorMessage, BlueSystem.getString("message.line.badChannel"), JOptionPane.ERROR_MESSAGE);
}
} else {
super.setValueAt(value, row, col);
}
}
use of blue.components.lines.Line in project blue by kunstmusik.
the class ZakLineListTableModel method getValueAt.
/**
* Gets value stored in table, difference from base class being the 2nd
* column is zak channel
*/
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
if (lines == null) {
return null;
}
if (columnIndex == 1) {
Line line = lines.get(rowIndex);
Integer tempChannel = new Integer(line.getChannel());
return tempChannel.toString();
} else {
return super.getValueAt(rowIndex, columnIndex);
}
}
use of blue.components.lines.Line in project blue by kunstmusik.
the class AbstractLineObject method generateFTables.
public void generateFTables(CompileData compileData, HashMap ftableNumMap) {
StringBuilder buffer = new StringBuilder();
// TODO - need to grab from tables in static var
Object obj = compileData.getCompilationVariable(LINE_OBJECT_CACHE);
if (obj == null) {
HashMap map = new HashMap();
compileData.setCompilationVariable(LINE_OBJECT_CACHE, map);
obj = map;
}
HashMap stringTables = (HashMap) obj;
for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
Line line = (Line) iter.next();
String table = createTable(line);
int tableNum;
if (stringTables.containsKey(table)) {
tableNum = ((Integer) stringTables.get(table)).intValue();
} else {
tableNum = compileData.getOpenFTableNumber();
stringTables.put(table, new Integer(tableNum));
buffer.append("f").append(tableNum);
buffer.append(table).append("\n");
}
ftableNumMap.put(line.getUniqueID(), new Integer(tableNum));
}
compileData.appendTables(buffer.toString());
}
use of blue.components.lines.Line in project blue by kunstmusik.
the class AbstractLineObject method generateInstruments.
public void generateInstruments(CompileData compileData, Integer[] instrLineArray, HashMap ftableNumMap) {
int i = 0;
for (Iterator iter = lines.iterator(); iter.hasNext(); ) {
Line line = (Line) iter.next();
String lineName;
if (line.isZak()) {
lineName = "zak" + line.getChannel();
} else {
lineName = line.getVarName();
}
String lineId = line.getUniqueID();
String key = "AbstractLineObject." + lineName;
Object val = compileData.getCompilationVariable(key);
int instrNum = -1;
Integer lineNum = (Integer) ftableNumMap.get(lineId);
if (val == null) {
String instrText = generateLineInstrument(line);
GenericInstrument instr = new GenericInstrument();
instr.setText(instrText);
instrNum = compileData.addInstrument(instr);
compileData.setCompilationVariable(key, new Integer(instrNum));
} else {
instrNum = ((Integer) val).intValue();
}
instrLineArray[i++] = new Integer(instrNum);
instrLineArray[i++] = lineNum;
}
}
use of blue.components.lines.Line in project blue by kunstmusik.
the class ParameterLinePanel method paintComponent.
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
if (paramList == null || paramList.size() == 0) {
return;
}
Graphics2D g2d = (Graphics2D) g;
g2d.setStroke(STROKE2);
RenderingHints hints = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHints(hints);
Color currentColor = null;
ModeManager modeManager = ModeManager.getInstance();
boolean editing = (modeManager.getMode() == ScoreMode.SINGLE_LINE);
// boolean multiLineMode = (modeManager.getMode() == ModeManager.MODE_MULTI_LINE);
boolean multiLineMode = !editing;
for (Parameter param : paramList) {
Line line = param.getLine();
if (multiLineMode) {
g2d.setColor(line.getColor().darker());
drawSelectionLine(g2d, param);
} else if (editing && param == currentParameter) {
currentColor = line.getColor();
} else {
g2d.setColor(line.getColor().darker());
drawLine(g2d, param, false);
}
}
if (multiLineMode) {
return;
}
if (currentColor != null) {
g2d.setColor(currentColor);
if (editing && marquee.isVisible() && marquee.intersects(this)) {
drawSelectionLine(g2d, currentParameter);
} else {
drawLine(g2d, currentParameter, true);
}
}
if (editing && selectedPoint != null) {
double min = currentParameter.getMin();
double max = currentParameter.getMax();
int x = doubleToScreenX(selectedPoint.getX());
int y = doubleToScreenY(selectedPoint.getY(), min, max);
g2d.setColor(Color.red);
g2d.fillOval(x - 3, y - 3, 7, 7);
g2d.setStroke(STROKE1);
g2d.drawOval(x - 3, y - 3, 7, 7);
g2d.setStroke(STROKE2);
if (currentParameter != null) {
drawPointInformation(g2d, x, y);
}
}
}
Aggregations