public byte[] saveFile(byte[] binData) { binData = xAxis.saveFile(binData); binData = yAxis.saveFile(binData); int offset = 0; for (int x = 0; x < yAxis.getDataSize(); x++) { for (int y = 0; y < xAxis.getDataSize(); y++) { byte[] output = RomAttributeParser.parseIntegerValue(data[y][x].getBinValue(), endian, storageType); for (int z = 0; z < storageType; z++) { binData[offset * storageType + storageAddress - ramOffset] = output[z]; offset++; } } } return binData; }
public void populateTable(byte[] input) throws NullPointerException, ArrayIndexOutOfBoundsException { // fill first empty cell centerPanel.add(new JLabel()); if (!beforeRam) ramOffset = container.getRomID().getRamOffset(); // populate axiis try { xAxis.setContainer(container); xAxis.populateTable(input); yAxis.setContainer(container); yAxis.populateTable(input); } catch (ArrayIndexOutOfBoundsException ex) { throw new ArrayIndexOutOfBoundsException(); } for (int i = 0; i < xAxis.getDataSize(); i++) { centerPanel.add(xAxis.getDataCell(i)); } int offset = 0; for (int x = 0; x < yAxis.getDataSize(); x++) { centerPanel.add(yAxis.getDataCell(x)); for (int y = 0; y < xAxis.getDataSize(); y++) { data[y][x] = new DataCell(scale); data[y][x].setTable(this); try { data[y][x].setBinValue( RomAttributeParser.parseByteValue( input, endian, storageAddress + offset * storageType - ramOffset, storageType)); } catch (ArrayIndexOutOfBoundsException ex) { throw new ArrayIndexOutOfBoundsException(); } centerPanel.add(data[y][x]); data[y][x].setXCoord(y); data[y][x].setYCoord(x); data[y][x].setOriginalValue(data[y][x].getBinValue()); offset++; } } this.colorize(); GridLayout topLayout = new GridLayout(2, 1); JPanel topPanel = new JPanel(topLayout); this.add(topPanel, BorderLayout.NORTH); topPanel.add( new JLabel(name + " (" + scale.getUnit() + ")", JLabel.CENTER), BorderLayout.NORTH); topPanel.add( new JLabel(xAxis.getName() + " (" + xAxis.getScale().getUnit() + ")", JLabel.CENTER), BorderLayout.NORTH); JLabel yLabel = new JLabel(); yLabel.setFont(new Font("Arial", Font.BOLD, 12)); VTextIcon icon = new VTextIcon( yLabel, yAxis.getName() + " (" + yAxis.getScale().getUnit() + ")", VTextIcon.ROTATE_LEFT); yLabel.setIcon(icon); this.add(yLabel, BorderLayout.WEST); }