Commit 3b69b008 authored by Edoardo Putti's avatar Edoardo Putti Committed by Mart Lubbers

refactor code table resource chooser

parent 2ef8a586
......@@ -262,48 +262,42 @@ public class CodeTableModel extends AbstractTableModel
return res ;
}
public Object getValueAt( int row, int column )
{
Object res ;
Row r = rows.elementAt( row ) ;
if ( column == C_PC )
{
res = (r.memLoc == registers.getPC()) ? Images.redball : Images.white ;
}
else if ( column == C_BP )
{
res = r.hasBreakPoint ? Images.check : Images.white ;
}
else
{
if ( column == C_VALUE )
{
res = memory.getAsHexAt( r.memLoc ) ;
}
else if ( column == C_LABEL && r.labelName != null )
{
res = r.labelName ;
}
else if ( column == C_ADDRESS )
{
res = Utils.asHex( r.memLoc ) ;
}
else if ( column == C_INSTR )
{
res = r.getInstrRepr( r.memLoc ) ;
}
else if ( column == C_ARG1 && r.getNrInlineOpnds() > 0 )
{
res = memory.getAsHexAt( r.memLoc+1 ) ;
}
else if ( column == C_ARG2 && r.getNrInlineOpnds() > 1 )
{
res = memory.getAsHexAt( r.memLoc+2 ) ;
}
else
res = "" ;
}
return res ;
public Object getValueAt( int row, int column ) {
Object res = "";
Row r = rows.elementAt( row ) ;
switch (column) {
case C_PC:
res = (r.memLoc == registers.getPC()) ? Images.redball : Images.white ;
break;
case C_BP:
res = r.hasBreakPoint ? Images.check : Images.white ;
break;
case C_VALUE:
res = memory.getAsHexAt(r.memLoc);
break;
case C_LABEL:
res = r.labelName;
break;
case C_ADDRESS:
res = Utils.asHex(r.memLoc);
break;
case C_INSTR:
res = r.getInstrRepr( r.memLoc ) ;
break;
case C_ARG1:
if (r.getNrInlineOpnds() > 0) {
res = memory.getAsHexAt(r.memLoc + 1) ;
}
break;
case C_ARG2:
if (r.getNrInlineOpnds() > 1) {
res = memory.getAsHexAt(r.memLoc + 2) ;
}
break;
default:
res = "Error";
}
return res;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment