Preparing for internationalization as well as responding to the tighter

Eclipse 3.0 code checks.
This commit is contained in:
Robert Greene 2004-07-11 15:07:56 +00:00
parent 9629944ab8
commit 591924ce53
63 changed files with 883 additions and 735 deletions

View File

@ -45,6 +45,7 @@ import com.webcodepro.applecommander.storage.physical.ProdosOrder;
import com.webcodepro.applecommander.storage.physical.UniversalDiskImageLayout;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.StreamUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Abstract representation of an Apple2 disk (floppy, 800k, hard disk).
@ -86,6 +87,7 @@ public class Disk {
public static final int APPLE_32MB_HARDDISK = 33553920; // short one block!
private static FilenameFilter[] filenameFilters;
private TextBundle textBundle = StorageBundle.getInstance();
private String filename;
private boolean newImage = false;
private ByteArrayImageLayout diskImageManager;
@ -108,22 +110,22 @@ public class Disk {
*/
private Disk() {
filenameFilters = new FilenameFilter[] {
new FilenameFilter("All Emulator Images",
"*.do; *.dsk; *.po; *.nib; *.2mg; *.2img; *.hdv; *.do.gz; *.dsk.gz; *.po.gz; *.nib.gz; *.2mg.gz; *.2img.gz"),
new FilenameFilter("140K DOS Ordered Images (*.do, *.dsk)",
"*.do; *.dsk; *.do.gz; *.dsk.gz"),
new FilenameFilter("140K Nibbilized Images (*.nib)",
"*.nib; *.nib.gz"),
new FilenameFilter("140K ProDOS Ordered Images (*.po)",
"*.po; *.po.gz"),
new FilenameFilter("800K ProDOS Ordered Images (*.2mg, *.2img)",
"*.2mg; *.2img; *.2mg.gz, *.2img.gz"),
new FilenameFilter("ApplePC Hard Disk Images (*.hdv)",
"*.hdv"),
new FilenameFilter("All Compressed Images",
"*.do.gz; *.dsk.gz; *.po.gz; *.2mg.gz; *.2img.gz"),
new FilenameFilter("All Files",
"*.*")
new FilenameFilter(textBundle.get("Disk.AllImages"), //$NON-NLS-1$
"*.do; *.dsk; *.po; *.nib; *.2mg; *.2img; *.hdv; *.do.gz; *.dsk.gz; *.po.gz; *.nib.gz; *.2mg.gz; *.2img.gz"), //$NON-NLS-1$
new FilenameFilter(textBundle.get("Disk.140kDosImages"), //$NON-NLS-1$
"*.do; *.dsk; *.do.gz; *.dsk.gz"), //$NON-NLS-1$
new FilenameFilter(textBundle.get("Disk.140kNibbleImages"), //$NON-NLS-1$
"*.nib; *.nib.gz"), //$NON-NLS-1$
new FilenameFilter(textBundle.get("Disk.140kProdosImages"), //$NON-NLS-1$
"*.po; *.po.gz"), //$NON-NLS-1$
new FilenameFilter(textBundle.get("Disk.800kProdosImages"), //$NON-NLS-1$
"*.2mg; *.2img; *.2mg.gz, *.2img.gz"), //$NON-NLS-1$
new FilenameFilter(textBundle.get("Disk.ApplePcImages"), //$NON-NLS-1$
"*.hdv"), //$NON-NLS-1$
new FilenameFilter(textBundle.get("Disk.CompressedImages"), //$NON-NLS-1$
"*.do.gz; *.dsk.gz; *.po.gz; *.2mg.gz; *.2img.gz"), //$NON-NLS-1$
new FilenameFilter(textBundle.get("Disk.AllFiles"), //$NON-NLS-1$
"*.*") //$NON-NLS-1$
};
}
@ -237,9 +239,8 @@ public class Disk {
public ByteArrayImageLayout getDiskImageManager() {
if (imageOrder != null) {
return imageOrder.getDiskImageManager();
} else {
return diskImageManager;
}
return diskImageManager;
}
/**
@ -261,17 +262,17 @@ public class Disk {
* Indicate if this disk is GZIP compressed.
*/
public boolean isCompressed() {
return filename.toLowerCase().endsWith(".gz");
return filename.toLowerCase().endsWith(".gz"); //$NON-NLS-1$
}
/**
* Indicate if this disk is ProDOS ordered (beginning with block 0).
*/
public boolean isProdosOrder() {
return filename.toLowerCase().endsWith(".po")
|| filename.toLowerCase().endsWith(".po.gz")
return filename.toLowerCase().endsWith(".po") //$NON-NLS-1$
|| filename.toLowerCase().endsWith(".po.gz") //$NON-NLS-1$
|| is2ImgOrder()
|| filename.toLowerCase().endsWith(".hdv")
|| filename.toLowerCase().endsWith(".hdv") //$NON-NLS-1$
|| getPhysicalSize() >= APPLE_800KB_2IMG_DISK;
}
@ -279,10 +280,10 @@ public class Disk {
* Indicate if this disk is DOS ordered (T0,S0 - T35,S15).
*/
public boolean isDosOrder() {
return filename.toLowerCase().endsWith(".do")
|| filename.toLowerCase().endsWith(".do.gz")
|| filename.toLowerCase().endsWith(".dsk")
|| filename.toLowerCase().endsWith(".dsk.gz");
return filename.toLowerCase().endsWith(".do") //$NON-NLS-1$
|| filename.toLowerCase().endsWith(".do.gz") //$NON-NLS-1$
|| filename.toLowerCase().endsWith(".dsk") //$NON-NLS-1$
|| filename.toLowerCase().endsWith(".dsk.gz"); //$NON-NLS-1$
}
/**
@ -290,18 +291,18 @@ public class Disk {
* This is ProDOS ordered, but with a header on the disk.
*/
public boolean is2ImgOrder() {
return filename.toLowerCase().endsWith(".2img")
|| filename.toLowerCase().endsWith(".2img.gz")
|| filename.toLowerCase().endsWith(".2mg")
|| filename.toLowerCase().endsWith(".2mg.gz");
return filename.toLowerCase().endsWith(".2img") //$NON-NLS-1$
|| filename.toLowerCase().endsWith(".2img.gz") //$NON-NLS-1$
|| filename.toLowerCase().endsWith(".2mg") //$NON-NLS-1$
|| filename.toLowerCase().endsWith(".2mg.gz"); //$NON-NLS-1$
}
/**
* Indicate if this disk is a nibbilized disk..
*/
public boolean isNibbleOrder() {
return filename.toLowerCase().endsWith(".nib")
|| filename.toLowerCase().endsWith(".nib.gz");
return filename.toLowerCase().endsWith(".nib") //$NON-NLS-1$
|| filename.toLowerCase().endsWith(".nib.gz"); //$NON-NLS-1$
}
/**
@ -310,9 +311,8 @@ public class Disk {
public int getPhysicalSize() {
if (getDiskImageManager() != null) {
return getDiskImageManager().getPhysicalSize();
} else {
return getImageOrder().getPhysicalSize();
}
return getImageOrder().getPhysicalSize();
}
/**
@ -325,7 +325,7 @@ public class Disk {
protected void resizeDiskImage(int newSize) {
if (newSize < getPhysicalSize()) {
throw new IllegalArgumentException(
"Cannot resize a disk to be smaller than the current size!");
textBundle.get("Disk.ResizeDiskError")); //$NON-NLS-1$
}
byte[] newDiskImage = new byte[newSize];
byte[] oldDiskImage = imageOrder.getDiskImageManager().getDiskImage();
@ -525,7 +525,7 @@ public class Disk {
if (!is140KbDisk()) return false;
byte[] block = readSector(0, 0x0d);
String id = AppleUtil.getString(block, 0xe0, 4);
return "RDOS".equals(id);
return "RDOS".equals(id); //$NON-NLS-1$
}
/**

View File

@ -64,9 +64,8 @@ public class FileEntryComparator implements Comparator {
int int1 = toInt(column1);
int int2 = toInt(column2);
return int1 - int2;
} else {
return column1.compareTo(column2);
}
return column1.compareTo(column2);
}
/**

View File

@ -27,6 +27,7 @@ import java.util.Date;
import java.util.List;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Abstract representation of a formatted Apple2 disk (floppy, 800k, hard disk).
@ -35,6 +36,7 @@ import com.webcodepro.applecommander.storage.physical.ImageOrder;
* @author Rob Greene
*/
public abstract class FormattedDisk extends Disk implements DirectoryEntry {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* Use this inner class for label/value mappings in the disk info page.
*/
@ -50,12 +52,14 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
this.value = Integer.toString(value);
}
public DiskInformation(String label, Date value) {
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
SimpleDateFormat dateFormat = new SimpleDateFormat(
StorageBundle.getInstance().get("DateFormat")); //$NON-NLS-1$
this.label = label;
if (value != null) {
this.value = dateFormat.format(value);
} else {
this.value = "-None-";
this.value = StorageBundle.getInstance()
.get("FormattedDisk.NullDate"); //$NON-NLS-1$
}
}
public String getLabel() {
@ -121,8 +125,6 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
/**
* Constructor for FormattedDisk.
* @param filename
* @param diskImage
*/
public FormattedDisk(String filename, ImageOrder imageOrder) {
super(filename, imageOrder);
@ -180,19 +182,19 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
*/
public List getDiskInformation() {
List list = new ArrayList();
list.add(new DiskInformation("File Name", getFilename()));
list.add(new DiskInformation("Disk Name", getDiskName()));
list.add(new DiskInformation("Physical Size (bytes)", getPhysicalSize()));
list.add(new DiskInformation("Free Space (bytes)", getFreeSpace()));
list.add(new DiskInformation("Used Space (bytes)", getUsedSpace()));
list.add(new DiskInformation("Physical Size (KB)", getPhysicalSize() / 1024));
list.add(new DiskInformation("Free Space (KB)", getFreeSpace() / 1024));
list.add(new DiskInformation("Used Space (KB)", getUsedSpace() / 1024));
list.add(new DiskInformation("Archive Order",
is2ImgOrder() ? "2IMG" :
isDosOrder() ? "DOS 3.3" :
isProdosOrder() ? "ProDOS" : "Unknown"));
list.add(new DiskInformation("Disk Format", getFormat()));
list.add(new DiskInformation(textBundle.get("FormattedDisk.FileName"), getFilename())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.DiskName"), getDiskName())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.PhysicalSizeInBytes"), getPhysicalSize())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.FreeSpaceInBytes"), getFreeSpace())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.UsedSpaceInBytes"), getUsedSpace())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.PhysicalSizeInKb"), getPhysicalSize() / 1024)); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.FreeSpaceInKb"), getFreeSpace() / 1024)); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.UsedSpaceInKb"), getUsedSpace() / 1024)); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FormattedDisk.ArchiveOrder"), //$NON-NLS-1$
is2ImgOrder() ? textBundle.get("FormattedDisk.2Img") : //$NON-NLS-1$
isDosOrder() ? textBundle.get("Dos33") : //$NON-NLS-1$
isProdosOrder() ? textBundle.get("Prodos") : textBundle.get("FormattedDisk.Unknown"))); //$NON-NLS-1$ //$NON-NLS-2$
list.add(new DiskInformation(textBundle.get("FormattedDisk.DiskFormat"), getFormat())); //$NON-NLS-1$
return list;
}
@ -202,10 +204,14 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
*/
public List getFileColumnHeaders(int displayMode) {
List list = new ArrayList();
list.add(new FileColumnHeader("Name", 30, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Type", 8, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Size (bytes)", 6, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Locked?", 6, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle
.get("Name"), 30, FileColumnHeader.ALIGN_LEFT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle
.get("Type"), 8, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle
.get("SizeInBytes"), 6, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle
.get("LockedQ"), 6, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
return list;
}
@ -303,13 +309,14 @@ public abstract class FormattedDisk extends Disk implements DirectoryEntry {
*/
protected void writeBootCode() {
InputStream inputStream = getClass().
getResourceAsStream("AppleCommander-boot.dump");
getResourceAsStream("AppleCommander-boot.dump"); //$NON-NLS-1$
if (inputStream != null) {
byte[] bootCode = new byte[SECTOR_SIZE];
try {
inputStream.read(bootCode, 0, bootCode.length);
writeSector(0, 0, bootCode);
} catch (IOException ignored) {
// Ignored
}
}
}

View File

@ -24,7 +24,9 @@ import java.io.PrintWriter;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FileFilter;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Export an AppleWorks database file to a text file.
@ -45,6 +47,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class AppleWorksDataBaseFileFilter implements FileFilter {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* The number of bytes in the remainder of the header record.
*/
@ -91,7 +94,7 @@ public class AppleWorksDataBaseFileFilter implements FileFilter {
* Count of the number of bytes in the remainder of the
* data record.
*/
private static final int DATA_LENGTH_WORD = 0;
// private static final int DATA_LENGTH_WORD = 0;
/**
* Data control record indicating that a number of
* categories need to be skipped. This (minus $80)
@ -120,9 +123,18 @@ public class AppleWorksDataBaseFileFilter implements FileFilter {
* List of months used for date conversion.
*/
private static final String[] months = {
"January", "February", "March", "April",
"May", "June", "July", "August", "September",
"October", "November", "December"
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.January"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.February"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.March"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.April"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.May"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.June"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.July"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.August"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.September"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.October"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.November"), //$NON-NLS-1$
StorageBundle.getInstance().get("AppleWorksDataBaseFileFilter.December") //$NON-NLS-1$
};
/**
* ASCII day of the month, like "31" ($33 $31).
@ -179,7 +191,7 @@ public class AppleWorksDataBaseFileFilter implements FileFilter {
int offset = HEADER_CATEGORY_STRING;
for (int i=0; i<categoryCount; i++) {
String name = AppleUtil.getProdosString(fileData, offset);
if (i > 0) printWriter.print(",");
if (i > 0) printWriter.print(","); //$NON-NLS-1$
printWriter.print('"');
printWriter.print(name);
printWriter.print('"');
@ -188,7 +200,7 @@ public class AppleWorksDataBaseFileFilter implements FileFilter {
printWriter.println();
if (offset != headerLength) {
throw new IndexOutOfBoundsException(
"AppleWorks Data Base file header lenth does not check. Aborting.");
textBundle.get("AppleWorksDataBaseFileFilter.InvalidHeaderLengthError")); //$NON-NLS-1$
}
// skip reports:
offset+= (reportCount * REPORT_LENGTH);
@ -221,7 +233,7 @@ public class AppleWorksDataBaseFileFilter implements FileFilter {
} else {
int repeats = controlByte - DATA_CONTROL_SKIP;
while (repeats > 0) {
printWriter.print("\",\"");
printWriter.print("\",\""); //$NON-NLS-1$
repeats--;
}
}
@ -238,16 +250,15 @@ public class AppleWorksDataBaseFileFilter implements FileFilter {
* @see com.webcodepro.applecommander.storage.FileFilter#getSuggestedFileName(FileEntry)
*/
public String getSuggestedFileName(FileEntry fileEntry) {
return fileEntry.getFilename() + ".csv";
return fileEntry.getFilename() + ".csv"; //$NON-NLS-1$
}
/**
* Convert the date entry.
*/
protected void convertDate(PrintWriter printWriter, String date) {
if (date.length() != DATE_LENGTH) {
printWriter.print("[Invalid Date=");
printWriter.print(date);
printWriter.print("]");
printWriter.print(textBundle.
format("AppleWorksDataBaseFileFilter.InvalidDate", date)); //$NON-NLS-1$
}
printWriter.print((char)('0' + (date.charAt(DATE_YEAR_OFFSET) - 0x30)));
@ -263,9 +274,8 @@ public class AppleWorksDataBaseFileFilter implements FileFilter {
*/
protected void convertTime(PrintWriter printWriter, String time) {
if (time.length() != TIME_LENGTH) {
printWriter.print("[Invalid Time=");
printWriter.print(time);
printWriter.print("]");
printWriter.print(textBundle.
format("AppleWorksDataBaseFileFilter.InvalidTime", time)); //$NON-NLS-1$
}
printWriter.print(time.charAt(TIME_HOUR_OFFSET) - 'A');

View File

@ -94,14 +94,14 @@ public class AppleWorksSpreadSheetFileFilter implements FileFilter {
* These are the formulas starting at FORMULA_OFFSET.
*/
private static final String[] formulaText = {
"@Deg", "@Rad", "@Pi", "@True", "@False", "@Not", "@IsBlank",
"@IsNA", "@IsError", "@Exp", "@Ln", "@Log", "@Cos", "@Sin",
"@Tan", "@ACos", "@ASin", "@ATan2", "@ATan", "@Mod", "@FV",
"@PV", "@PMT", "@Term", "@Rate", "@Round", "@Or", "@And",
"@Sum", "@Avg", "@Choose", "@Count", "@Error", "@IRR", "@If",
"@Int", "@Lookup", "@Max", "@Min", "@NA", "@NPV", "@Sqrt",
"@Abs", null, "<>", ">=", "<=", "=", ">", "<", ",", "^",
")", "-", "+", "/", "*", "(", "-", "+", "..", null, null,
"@Deg", "@Rad", "@Pi", "@True", "@False", "@Not", "@IsBlank", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"@IsNA", "@IsError", "@Exp", "@Ln", "@Log", "@Cos", "@Sin", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"@Tan", "@ACos", "@ASin", "@ATan2", "@ATan", "@Mod", "@FV", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"@PV", "@PMT", "@Term", "@Rate", "@Round", "@Or", "@And", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"@Sum", "@Avg", "@Choose", "@Count", "@Error", "@IRR", "@If", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"@Int", "@Lookup", "@Max", "@Min", "@NA", "@NPV", "@Sqrt", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"@Abs", null, "<>", ">=", "<=", "=", ">", "<", ",", "^", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
")", "-", "+", "/", "*", "(", "-", "+", "..", null, null, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
null
};
/**
@ -153,7 +153,7 @@ public class AppleWorksSpreadSheetFileFilter implements FileFilter {
* @see com.webcodepro.applecommander.storage.FileFilter#getSuggestedFileName(FileEntry)
*/
public String getSuggestedFileName(FileEntry fileEntry) {
return fileEntry.getFilename() + ".csv";
return fileEntry.getFilename() + ".csv"; //$NON-NLS-1$
}
/**
* Process an entire row.
@ -163,12 +163,12 @@ public class AppleWorksSpreadSheetFileFilter implements FileFilter {
while (true) {
int rowControl = AppleUtil.getUnsignedByte(fileData[offset]);
if (rowControl <= 0x7f) { // process row
if (column > 0) printWriter.print(",");
if (column > 0) printWriter.print(","); //$NON-NLS-1$
processCell(printWriter, fileData, offset+1, rowControl,
rowNumber, column);
offset+= rowControl;
} else if (rowControl < 0xff) { // skip rows
if (column > 0) printWriter.print(",");
if (column > 0) printWriter.print(","); //$NON-NLS-1$
int columns = rowControl - 0x80;
skipColumns(column, printWriter, columns);
column+= columns;
@ -185,8 +185,8 @@ public class AppleWorksSpreadSheetFileFilter implements FileFilter {
*/
protected void skipColumns(int column, PrintWriter printWriter, int columns) {
while (columns > 0) {
if (column > 0) printWriter.print(",");
printWriter.print("\",\"");
if (column > 0) printWriter.print(","); //$NON-NLS-1$
printWriter.print("\",\""); //$NON-NLS-1$
columns--;
column++;
}
@ -253,7 +253,7 @@ public class AppleWorksSpreadSheetFileFilter implements FileFilter {
printWriter.print(string);
printWriter.print('"');
} else {
printWriter.print("\"Unknown Cell Contents!\"");
printWriter.print("\"Unknown Cell Contents!\""); //$NON-NLS-1$
}
}
/**
@ -264,7 +264,7 @@ public class AppleWorksSpreadSheetFileFilter implements FileFilter {
int pos2 = column % 26;
StringBuffer buf = new StringBuffer();
if (pos1 > 0) {
buf.append((char) '@' + pos1);
buf.append((char)('@' + pos1));
}
buf.append((char)('@' + pos2));
return buf.toString();

View File

@ -79,60 +79,60 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
private static final int CODE_UNDERLINE_ON = 0x07;
private static final int CODE_UNDERLINE_OFF = 0x08;
private static final int CODE_PAGE_NUMBER = 0x09;
private static final int CODE_ENTER_KEYBOARD = 0x0a;
// private static final int CODE_ENTER_KEYBOARD = 0x0a;
private static final int CODE_STICKY_SPACE = 0x0b;
private static final int CODE_MAILMERGE_BEGIN = 0x0c;
private static final int CODE_RESERVED1 = 0x0d;
// private static final int CODE_MAILMERGE_BEGIN = 0x0c;
// private static final int CODE_RESERVED1 = 0x0d;
private static final int CODE_DATE = 0x0e;
private static final int CODE_TIME = 0x0f;
private static final int CODE_SPECIAL_1 = 0x10;
private static final int CODE_SPECIAL_2 = 0x11;
private static final int CODE_SPECIAL_3 = 0x12;
private static final int CODE_SPECIAL_4 = 0x13;
private static final int CODE_SPECIAL_5 = 0x14;
private static final int CODE_SPECIAL_6 = 0x15;
private static final int CODE_TAB = 0x16;
private static final int CODE_TAB_FILL = 0x17;
private static final int CODE_RESERVED2 = 0x18;
// private static final int CODE_SPECIAL_1 = 0x10;
// private static final int CODE_SPECIAL_2 = 0x11;
// private static final int CODE_SPECIAL_3 = 0x12;
// private static final int CODE_SPECIAL_4 = 0x13;
// private static final int CODE_SPECIAL_5 = 0x14;
// private static final int CODE_SPECIAL_6 = 0x15;
// private static final int CODE_TAB = 0x16;
// private static final int CODE_TAB_FILL = 0x17;
// private static final int CODE_RESERVED2 = 0x18;
/*
* Identifies the commands embedded in the AppleWorks file.
*/
private static final int COMMAND_RESERVED = 0xd4;
// private static final int COMMAND_RESERVED = 0xd4;
private static final int COMMAND_PAGEHEADER_END = 0xd5;
private static final int COMMAND_PAGEFOOTER_END = 0xd6;
private static final int COMMAND_RIGHT = 0xd7;
private static final int COMMAND_PLATEN_WIDTH = 0xd8; // 10ths of an inch
private static final int COMMAND_MARGIN_LEFT = 0xd9; // 10ths of an inch
private static final int COMMAND_MARGIN_RIGHT = 0xda; // 10ths of an inch
private static final int COMMAND_CHARS_PER_INCH = 0xdb;
private static final int COMMAND_PROPORTIONAL_1 = 0xdc;
private static final int COMMAND_PROPORTIONAL_2 = 0xdd;
private static final int COMMAND_INDENT = 0xde; // in characters
// private static final int COMMAND_CHARS_PER_INCH = 0xdb;
// private static final int COMMAND_PROPORTIONAL_1 = 0xdc;
// private static final int COMMAND_PROPORTIONAL_2 = 0xdd;
// private static final int COMMAND_INDENT = 0xde; // in characters
private static final int COMMAND_JUSTIFY = 0xdf;
private static final int COMMAND_LEFT = 0xe0;
private static final int COMMAND_CENTER = 0xe1;
private static final int COMMAND_PAPER_LENGTH = 0xe2; // 10ths of an inch
private static final int COMMAND_MARGIN_TOP = 0xe3; // 10ths of an inch
private static final int COMMAND_MARGIN_BOTTOM = 0xe4; // 10ths of an inch
private static final int COMMAND_LINES_PER_INCH = 0xe5;
private static final int COMMAND_SINGLE_SPACE = 0xe6;
private static final int COMMAND_DOUBLE_SPACE = 0xe7;
private static final int COMMAND_TRIPLE_SPACE = 0xe8;
// private static final int COMMAND_LINES_PER_INCH = 0xe5;
// private static final int COMMAND_SINGLE_SPACE = 0xe6;
// private static final int COMMAND_DOUBLE_SPACE = 0xe7;
// private static final int COMMAND_TRIPLE_SPACE = 0xe8;
private static final int COMMAND_NEW_PAGE = 0xe9;
private static final int COMMAND_GROUP_BEGIN = 0xea;
private static final int COMMAND_GROUP_END = 0xeb;
// private static final int COMMAND_GROUP_BEGIN = 0xea;
// private static final int COMMAND_GROUP_END = 0xeb;
private static final int COMMAND_PAGEHEADER = 0xed; // may be mixed up
private static final int COMMAND_PAGEFOOTER = 0xec; // with this...
private static final int COMMAND_SKIP_LINES = 0xee;
private static final int COMMAND_PAGE_NUMBER = 0xef;
private static final int COMMAND_PAUSE_EACH_PAGE = 0xf0;
private static final int COMMAND_PAUSE_HERE = 0xf1;
private static final int COMMAND_SET_MARKER = 0xf2;
private static final int COMMAND_PAGE_NUMBER_256 = 0xf3; // add 256
// private static final int COMMAND_PAGE_NUMBER = 0xef;
// private static final int COMMAND_PAUSE_EACH_PAGE = 0xf0;
// private static final int COMMAND_PAUSE_HERE = 0xf1;
// private static final int COMMAND_SET_MARKER = 0xf2;
// private static final int COMMAND_PAGE_NUMBER_256 = 0xf3; // add 256
private static final int COMMAND_PAGE_BREAK = 0xf4; // byte page#
private static final int COMMAND_PAGE_BREAK_256 = 0xf5; // byte page# + 256
private static final int COMMAND_PP_PAGE_BREAK = 0xf6; // break in midl/par.
private static final int COMMAND_PP_PAGE_BREAK_256 = 0xf7; // +256 ??
// private static final int COMMAND_PP_PAGE_BREAK = 0xf6; // break in midl/par.
// private static final int COMMAND_PP_PAGE_BREAK_256 = 0xf7; // +256 ??
private static final int COMMAND_EOF = 0xff; // END OF FILE
/**
@ -151,14 +151,14 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
ByteArrayOutputStream byteArray = new ByteArrayOutputStream(fileData.length);
PrintWriter printWriter = new PrintWriter(byteArray, true);
if (isHtmlRendering()) {
printWriter.println("<html><style>BODY { font-family: monospace; }</style><body>");
printWriter.println("<html><style>BODY { font-family: monospace; }</style><body>"); //$NON-NLS-1$
} else if (isRtfRendering()) {
printWriter.print("{\\rtf1");
printWriter.print("{\\fonttbl{\\f0\\fmodern\\fprq1\\fcharset0 Courier New;}}");
printWriter.print("{\\*\\generator AppleCommander ");
printWriter.print("{\\rtf1"); //$NON-NLS-1$
printWriter.print("{\\fonttbl{\\f0\\fmodern\\fprq1\\fcharset0 Courier New;}}"); //$NON-NLS-1$
printWriter.print("{\\*\\generator AppleCommander "); //$NON-NLS-1$
printWriter.print(AppleCommander.VERSION);
printWriter.println(";}");
printWriter.print("\\f0 ");
printWriter.println(";}"); //$NON-NLS-1$
printWriter.print("\\f0 "); //$NON-NLS-1$
}
boolean version3 = (fileData[183] != 0);
int offset = 300 + (version3 ? 2 : 0); // version 3.0's first line record is invalid
@ -183,9 +183,9 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
}
}
if (isHtmlRendering()) {
printWriter.println("</body></html>");
printWriter.println("</body></html>"); //$NON-NLS-1$
} else if (isRtfRendering()) {
printWriter.println("}");
printWriter.println("}"); //$NON-NLS-1$
}
return byteArray.toByteArray();
}
@ -211,11 +211,11 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
extraSpaces++;
}
if (extraSpaces > 0) {
printWriter.print("&nbsp;");
printWriter.print("&nbsp;"); //$NON-NLS-1$
while (fileData[offset] == ' ') {
offset++;
length--;
printWriter.print("&nbsp;");
printWriter.print("&nbsp;"); //$NON-NLS-1$
}
} else {
printWriter.print((char)ch);
@ -232,8 +232,8 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
* Deal with carriage-return.
*/
protected void handleReturn(PrintWriter printWriter) {
if (isHtmlRendering()) printWriter.println("<br>");
else if (isRtfRendering()) printWriter.println("\\par");
if (isHtmlRendering()) printWriter.println("<br>"); //$NON-NLS-1$
else if (isRtfRendering()) printWriter.println("\\par"); //$NON-NLS-1$
else printWriter.println();
}
/**
@ -242,31 +242,31 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
protected void handleSpecialCodesAsHtml(PrintWriter printWriter, byte ch) {
switch (ch) {
case CODE_BOLD_ON:
printWriter.print("<b>");
printWriter.print("<b>"); //$NON-NLS-1$
break;
case CODE_BOLD_OFF:
printWriter.print("</b>");
printWriter.print("</b>"); //$NON-NLS-1$
break;
case CODE_SUPERSCRIPT_ON:
printWriter.print("<sup>");
printWriter.print("<sup>"); //$NON-NLS-1$
break;
case CODE_SUPERSCRIPT_OFF:
printWriter.print("</sup>");
printWriter.print("</sup>"); //$NON-NLS-1$
break;
case CODE_SUBSCRIPT_ON:
printWriter.print("<sub>");
printWriter.print("<sub>"); //$NON-NLS-1$
break;
case CODE_SUBSCRIPT_OFF:
printWriter.print("</sub>");
printWriter.print("</sub>"); //$NON-NLS-1$
break;
case CODE_UNDERLINE_ON:
printWriter.print("<u>");
printWriter.print("<u>"); //$NON-NLS-1$
break;
case CODE_UNDERLINE_OFF:
printWriter.print("</u>");
printWriter.print("</u>"); //$NON-NLS-1$
break;
case CODE_STICKY_SPACE:
printWriter.print("&nbsp;");
printWriter.print("&nbsp;"); //$NON-NLS-1$
break;
default: handleSpecialCodesAsText(printWriter, ch);
break;
@ -278,32 +278,32 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
protected void handleSpecialCodesAsRtf(PrintWriter printWriter, byte ch) {
switch (ch) {
case CODE_PAGE_NUMBER:
printWriter.print("{\\chpgn}");
printWriter.print("{\\chpgn}"); //$NON-NLS-1$
break;
case CODE_BOLD_ON:
printWriter.print("\\b ");
printWriter.print("\\b "); //$NON-NLS-1$
break;
case CODE_BOLD_OFF:
printWriter.print("\\b0 ");
printWriter.print("\\b0 "); //$NON-NLS-1$
break;
case CODE_UNDERLINE_ON:
printWriter.print("\\ul ");
printWriter.print("\\ul "); //$NON-NLS-1$
break;
case CODE_UNDERLINE_OFF:
printWriter.print("\\ulnone");
printWriter.print("\\ulnone"); //$NON-NLS-1$
break;
case CODE_SUPERSCRIPT_ON:
printWriter.print("\\super ");
printWriter.print("\\super "); //$NON-NLS-1$
break;
case CODE_SUBSCRIPT_ON:
printWriter.print("\\sub ");
printWriter.print("\\sub "); //$NON-NLS-1$
break;
case CODE_SUPERSCRIPT_OFF:
case CODE_SUBSCRIPT_OFF:
printWriter.print("\\nosupersub ");
printWriter.print("\\nosupersub "); //$NON-NLS-1$
break;
case CODE_STICKY_SPACE:
printWriter.print(" ");
printWriter.print(" "); //$NON-NLS-1$
break;
default: handleSpecialCodesAsText(printWriter, ch);
break;
@ -315,14 +315,14 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
protected void handleSpecialCodesAsText(PrintWriter printWriter, byte ch) {
switch (ch) {
case CODE_PAGE_NUMBER:
printWriter.print("[Page#]");
printWriter.print("[Page#]"); //$NON-NLS-1$
break;
case CODE_DATE:
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yy");
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yy"); //$NON-NLS-1$
printWriter.print(dateFormat.format(new Date()));
break;
case CODE_TIME:
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss"); //$NON-NLS-1$
printWriter.print(timeFormat.format(new Date()));
break;
}
@ -335,16 +335,16 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
switch (byte1) {
case COMMAND_RIGHT:
printWriter.println("<style>BODY: text-align: right;</style>");
printWriter.println("<style>BODY: text-align: right;</style>"); //$NON-NLS-1$
break;
case COMMAND_JUSTIFY:
printWriter.println("<style>BODY: text-align: justify;</style>");
printWriter.println("<style>BODY: text-align: justify;</style>"); //$NON-NLS-1$
break;
case COMMAND_LEFT:
printWriter.println("<style>BODY: text-align: left;</style>");
printWriter.println("<style>BODY: text-align: left;</style>"); //$NON-NLS-1$
break;
case COMMAND_CENTER:
printWriter.println("<style>BODY: text-align: center;</style>");
printWriter.println("<style>BODY: text-align: center;</style>"); //$NON-NLS-1$
break;
default: offset = handleCommandRecordAsText(byte0, byte1,
printWriter, offset);
@ -359,69 +359,69 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
PrintWriter printWriter, int offset) {
if (inHeaderOrFooter) {
printWriter.print("}\\f0 ");
printWriter.print("}\\f0 "); //$NON-NLS-1$
inHeaderOrFooter = false;
}
int twipDistance = byte0 * TWIPS_PER_INCH / 10;
switch (byte1) {
case COMMAND_PAGEHEADER:
printWriter.print("{\\header ");
printWriter.print("{\\header "); //$NON-NLS-1$
inHeaderOrFooter = true;
break;
case COMMAND_PAGEFOOTER:
printWriter.print("{\\footer ");
printWriter.print("{\\footer "); //$NON-NLS-1$
inHeaderOrFooter = true;
break;
case COMMAND_PAGEHEADER_END:
case COMMAND_PAGEFOOTER_END:
printWriter.print("}");
printWriter.print("}"); //$NON-NLS-1$
break;
case COMMAND_RIGHT:
printWriter.println("\\pard\\qr ");
printWriter.println("\\pard\\qr "); //$NON-NLS-1$
break;
case COMMAND_LEFT:
printWriter.println("\\pard ");
printWriter.println("\\pard "); //$NON-NLS-1$
break;
case COMMAND_CENTER:
printWriter.println("\\pard\\qc ");
printWriter.println("\\pard\\qc "); //$NON-NLS-1$
break;
case COMMAND_JUSTIFY:
printWriter.print("\\qj ");
printWriter.print("\\qj "); //$NON-NLS-1$
break;
case COMMAND_PAGE_BREAK:
case COMMAND_PAGE_BREAK_256:
case COMMAND_NEW_PAGE:
printWriter.print("\\page ");
printWriter.print("\\page "); //$NON-NLS-1$
break;
case COMMAND_PLATEN_WIDTH:
printWriter.print("\\paperw");
printWriter.print("\\paperw"); //$NON-NLS-1$
printWriter.print(twipDistance);
printWriter.print(" ");
printWriter.print(" "); //$NON-NLS-1$
break;
case COMMAND_PAPER_LENGTH:
printWriter.print("\\paperl");
printWriter.print("\\paperl"); //$NON-NLS-1$
printWriter.print(twipDistance);
printWriter.print(" ");
printWriter.print(" "); //$NON-NLS-1$
break;
case COMMAND_MARGIN_LEFT:
printWriter.print("\\margl");
printWriter.print("\\margl"); //$NON-NLS-1$
printWriter.print(twipDistance);
printWriter.print(" ");
printWriter.print(" "); //$NON-NLS-1$
break;
case COMMAND_MARGIN_RIGHT:
printWriter.print("\\margr");
printWriter.print("\\margr"); //$NON-NLS-1$
printWriter.print(twipDistance);
printWriter.print(" ");
printWriter.print(" "); //$NON-NLS-1$
break;
case COMMAND_MARGIN_TOP:
printWriter.print("\\margt");
printWriter.print("\\margt"); //$NON-NLS-1$
printWriter.print(twipDistance);
printWriter.print(" ");
printWriter.print(" "); //$NON-NLS-1$
break;
case COMMAND_MARGIN_BOTTOM:
printWriter.print("\\margb");
printWriter.print("\\margb"); //$NON-NLS-1$
printWriter.print(twipDistance);
printWriter.print(" ");
printWriter.print(" "); //$NON-NLS-1$
break;
default: offset = handleCommandRecordAsText(byte0, byte1,
printWriter, offset);
@ -450,9 +450,9 @@ public class AppleWorksWordProcessorFileFilter implements FileFilter {
*/
public String getSuggestedFileName(FileEntry fileEntry) {
String fileName = fileEntry.getFilename().trim();
String extension = ".txt";
if (isHtmlRendering()) extension = ".html";
else if (isRtfRendering()) extension = ".rtf";
String extension = ".txt"; //$NON-NLS-1$
if (isHtmlRendering()) extension = ".html"; //$NON-NLS-1$
else if (isRtfRendering()) extension = ".rtf"; //$NON-NLS-1$
if (!fileName.toLowerCase().endsWith(extension)) {
fileName = fileName + extension;

View File

@ -61,7 +61,7 @@ public class ApplesoftFileFilter implements FileFilter {
printWriter.println();
}
printWriter.print(token.getLineNumber());
printWriter.print(" ");
printWriter.print(" "); //$NON-NLS-1$
} else if (token.isToken()) {
printWriter.print(token.getTokenString());
} else {
@ -77,8 +77,8 @@ public class ApplesoftFileFilter implements FileFilter {
*/
public String getSuggestedFileName(FileEntry fileEntry) {
String fileName = fileEntry.getFilename().trim();
if (!fileName.toLowerCase().endsWith(".bas")) {
fileName = fileName + ".bas";
if (!fileName.toLowerCase().endsWith(".bas")) { //$NON-NLS-1$
fileName = fileName + ".bas"; //$NON-NLS-1$
}
return fileName;
}

View File

@ -31,11 +31,11 @@ import com.webcodepro.applecommander.storage.FileFilter;
* @author Rob Greene
*/
public class AssemblySourceFileFilter implements FileFilter {
private int[] tabStops = new int[] { 10, 15 };;
private int[] tabStops = new int[] { 10, 15 };
private int commentTabStop = 25;
private String tabChars = "\t ";
private String commentTabChars = ";";
private String commentNoTabChars = "*";
private String tabChars = "\t "; //$NON-NLS-1$
private String commentTabChars = ";"; //$NON-NLS-1$
private String commentNoTabChars = "*"; //$NON-NLS-1$
/**
* Process the given FileEntry and return a byte array
@ -103,8 +103,8 @@ public class AssemblySourceFileFilter implements FileFilter {
*/
public String getSuggestedFileName(FileEntry fileEntry) {
String fileName = fileEntry.getFilename().trim();
if (!fileName.toLowerCase().endsWith(".s")) {
fileName += ".s";
if (!fileName.toLowerCase().endsWith(".s")) { //$NON-NLS-1$
fileName += ".s"; //$NON-NLS-1$
}
return fileName;
}

View File

@ -38,7 +38,7 @@ public class BinaryFileFilter implements FileFilter {
/**
* Process the given FileEntry and return a byte array with filtered data.
* @see com.webcodepro.applecommander.storage.FileFilter#filter(byte[])
* @see com.webcodepro.applecommander.storage.FileFilter#filter(FileEntry)
*/
public byte[] filter(FileEntry fileEntry) {
return fileEntry.getFileData(); // should be nothing to do
@ -49,8 +49,8 @@ public class BinaryFileFilter implements FileFilter {
*/
public String getSuggestedFileName(FileEntry fileEntry) {
String fileName = fileEntry.getFilename().trim();
if (!fileName.toLowerCase().endsWith(".dump")) {
fileName = fileName + ".dump";
if (!fileName.toLowerCase().endsWith(".dump")) { //$NON-NLS-1$
fileName = fileName + ".dump"; //$NON-NLS-1$
}
return fileName;
}

View File

@ -410,7 +410,8 @@ public class GraphicsFileFilter implements FileFilter {
* Construct a series of icons based on the QuickDraw II Icon file format.
* In ProDOS, this is the ICN ($Ca) file format.
* <p>
* @see http://www.gno.org/pub/apple2/doc/apple/filetypes/ftn.ca.xxxx
* See <a href='http://www.gno.org/pub/apple2/doc/apple/filetypes/ftn.ca.xxxx'>this
* page</a> for details.
*/
public AppleImage[] buildQuickDraw2Icons(FileEntry fileEntry) {
List icons = new ArrayList();
@ -509,8 +510,8 @@ public class GraphicsFileFilter implements FileFilter {
*/
public String getSuggestedFileName(FileEntry fileEntry) {
String fileName = fileEntry.getFilename().trim();
if (!fileName.toLowerCase().endsWith("." + getExtension())) {
fileName = fileName + "." + getExtension();
if (!fileName.toLowerCase().endsWith("." + getExtension())) { //$NON-NLS-1$
fileName = fileName + "." + getExtension(); //$NON-NLS-1$
}
return fileName;
}

View File

@ -39,7 +39,7 @@ public class HexDumpFileFilter implements FileFilter {
/**
* Create the hex dump format.
* @see com.webcodepro.applecommander.storage.FileFilter#filter(byte[])
* @see com.webcodepro.applecommander.storage.FileFilter#filter(FileEntry)
*/
public byte[] filter(FileEntry fileEntry) {
return AppleUtil.getHexDump(fileEntry.getFileData()).getBytes();
@ -50,8 +50,8 @@ public class HexDumpFileFilter implements FileFilter {
*/
public String getSuggestedFileName(FileEntry fileEntry) {
String fileName = fileEntry.getFilename().trim();
if (!fileName.toLowerCase().endsWith(".txt")) {
fileName = fileName + ".txt";
if (!fileName.toLowerCase().endsWith(".txt")) { //$NON-NLS-1$
fileName = fileName + ".txt"; //$NON-NLS-1$
}
return fileName;
}

View File

@ -47,22 +47,22 @@ import com.webcodepro.applecommander.util.AppleUtil;
*/
public class IntegerBasicFileFilter implements FileFilter {
private static String[] tokens = {
null, null, null, ": ", "LOAD ", "SAVE ", null, "RUN ", // $00-$07
null, "DEL ", ", ", "NEW ", "CLR ", "AUTO ", null, "MAN ", // $08-$0F
"HIMEM: ", "LOMEM: ", "+", "-", "*", "/", "=", "#", // $10-$17
">=", ">", "<=", "<>", "<", " AND ", " OR ", " MOD ",// $18-$1F
"^", null, "(", ",", " THEN ", " THEN ", ",", ",", // $20-$27
"\"", "\"", "(", null, null, "(", " PEEK ", "RND ", // $28-$2F
"SGN ", "ABS ", "PDL ", null, "(", "+", "-", "NOT ", // $30-$37
"(", "=", "#", " LEN(", " ASC(", " SCRN(", ",", " (", // $38-$3F
"$", null, "(", ",", ",", ";", ";", ";", // $40-$47
",", ",", ",", "TEXT ", "GR ", "CALL ", "DIM ", "DIM ", // $48-$4F
"TAB ", "END ", "INPUT ", "INPUT ", "INPUT ", "FOR ", "=", " TO ", // $50-$57
" STEP ", "NEXT ", ",", "RETURN ", "GOSUB ", "REM ", "LET ", "GOTO ",// $58-$5F
"IF ", "PRINT ", "PRINT ", "PRINT ", " POKE ", ",", "COLOR= ", "PLOT ",// $60-$67
",", "HLIN ", ",", " AT ", "VLIN ", ",", " AT ", "VTAB ",// $68-$6F
"=", "=", ")", null, "LIST ", ",", null, "POP ", // $70-$77
null, "NO DSP ", "NO TRACE ", "DSP ", "DSP ", "TRACE ", "PR # ", "IN # " // $78-$7F
null, null, null, ": ", "LOAD ", "SAVE ", null, "RUN ", // $00-$07 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
null, "DEL ", ", ", "NEW ", "CLR ", "AUTO ", null, "MAN ", // $08-$0F //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"HIMEM: ", "LOMEM: ", "+", "-", "*", "/", "=", "#", // $10-$17 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
">=", ">", "<=", "<>", "<", " AND ", " OR ", " MOD ",// $18-$1F //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"^", null, "(", ",", " THEN ", " THEN ", ",", ",", // $20-$27 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"\"", "\"", "(", null, null, "(", " PEEK ", "RND ", // $28-$2F //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
"SGN ", "ABS ", "PDL ", null, "(", "+", "-", "NOT ", // $30-$37 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
"(", "=", "#", " LEN(", " ASC(", " SCRN(", ",", " (", // $38-$3F //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"$", null, "(", ",", ",", ";", ";", ";", // $40-$47 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
",", ",", ",", "TEXT ", "GR ", "CALL ", "DIM ", "DIM ", // $48-$4F //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"TAB ", "END ", "INPUT ", "INPUT ", "INPUT ", "FOR ", "=", " TO ", // $50-$57 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
" STEP ", "NEXT ", ",", "RETURN ", "GOSUB ", "REM ", "LET ", "GOTO ",// $58-$5F //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"IF ", "PRINT ", "PRINT ", "PRINT ", " POKE ", ",", "COLOR= ", "PLOT ",// $60-$67 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
",", "HLIN ", ",", " AT ", "VLIN ", ",", " AT ", "VTAB ",// $68-$6F //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
"=", "=", ")", null, "LIST ", ",", null, "POP ", // $70-$77 //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
null, "NO DSP ", "NO TRACE ", "DSP ", "DSP ", "TRACE ", "PR # ", "IN # " // $78-$7F //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
};
/**
@ -99,15 +99,15 @@ public class IntegerBasicFileFilter implements FileFilter {
} else {
char ch = (char)(byt&0x7f);
if (ch < 0x20) { // handle control characters
printWriter.print("<CTRL-");
printWriter.print("<CTRL-"); //$NON-NLS-1$
printWriter.print((char)('@' + ch));
printWriter.print(">");
printWriter.print(">"); //$NON-NLS-1$
} else {
printWriter.print(ch);
}
}
} else {
String token = tokens[(int)byt];
String token = tokens[byt];
if (token != null) {
printWriter.print(token);
inComment = (byt == 0x5d); // REM statement
@ -128,8 +128,8 @@ public class IntegerBasicFileFilter implements FileFilter {
*/
public String getSuggestedFileName(FileEntry fileEntry) {
String fileName = fileEntry.getFilename().trim();
if (!fileName.toLowerCase().endsWith(".int")) {
fileName = fileName + ".int";
if (!fileName.toLowerCase().endsWith(".int")) { //$NON-NLS-1$
fileName = fileName + ".int"; //$NON-NLS-1$
}
return fileName;
}

View File

@ -114,8 +114,8 @@ public class PascalTextFileFilter implements FileFilter {
*/
public String getSuggestedFileName(FileEntry fileEntry) {
String fileName = fileEntry.getFilename().trim();
if (!fileName.toLowerCase().endsWith(".txt")) {
fileName = fileName + ".txt";
if (!fileName.toLowerCase().endsWith(".txt")) { //$NON-NLS-1$
fileName = fileName + ".txt"; //$NON-NLS-1$
}
return fileName;
}

View File

@ -70,8 +70,8 @@ public class TextFileFilter implements FileFilter {
*/
public String getSuggestedFileName(FileEntry fileEntry) {
String fileName = fileEntry.getFilename().trim();
if (!fileName.toLowerCase().endsWith(".txt")) {
fileName = fileName + ".txt";
if (!fileName.toLowerCase().endsWith(".txt")) { //$NON-NLS-1$
fileName = fileName + ".txt"; //$NON-NLS-1$
}
return fileName;
}

View File

@ -8,9 +8,11 @@ import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FileFilter;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.filters.BinaryFileFilter;
import com.webcodepro.applecommander.storage.filters.TextFileFilter;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Support the CP/M file entry. Note that this may actually contain references
@ -19,6 +21,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class CpmFileEntry implements FileEntry {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* The standard CP/M file entry length.
*/
@ -84,7 +87,9 @@ public class CpmFileEntry implements FileEntry {
* A short collection of known text-type files.
*/
public static final String[] TEXT_FILETYPES = {
"TXT", "ASM", "MAC", "DOC", "PRN", "PAS", "ME", "INC", "HLP"
"TXT", "ASM", "MAC", "DOC", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"PRN", "PAS", "ME", "INC", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"HLP" //$NON-NLS-1$
};
/**
* Reference to the disk this FileEntry is attached to.
@ -382,15 +387,15 @@ public class CpmFileEntry implements FileEntry {
list.add(getFilename());
list.add(getFiletype());
list.add(numberFormat.format(getSize()));
list.add("0x" + AppleUtil.getFormattedByte(getUserNumber(0)));
list.add(isDeleted() ? "Deleted" : "");
list.add(isLocked() ? "Locked" : "");
list.add("0x" + AppleUtil.getFormattedByte(getUserNumber(0))); //$NON-NLS-1$
list.add(isDeleted() ? textBundle.get("Deleted") : ""); //$NON-NLS-1$//$NON-NLS-2$
list.add(isLocked() ? textBundle.get("Locked") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
default: // FILE_DISPLAY_STANDARD
list.add(getFilename());
list.add(getFiletype());
list.add(numberFormat.format(getSize()));
list.add(isLocked() ? "Locked" : "");
list.add(isLocked() ? textBundle.get("Locked") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
}
return list;

View File

@ -28,8 +28,10 @@ import java.util.StringTokenizer;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Manages a disk that is in the Apple CP/M format.
@ -37,6 +39,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class CpmFormatDisk extends FormattedDisk {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* The size of the CP/M sector. Assumed to be 128.
*/
@ -115,7 +118,7 @@ public class CpmFormatDisk extends FormattedDisk {
* @see com.webcodepro.applecommander.storage.FormattedDisk#getDiskName()
*/
public String getDiskName() {
return "CP/M Volume";
return textBundle.get("CpmFormatDisk.DiskName"); //$NON-NLS-1$
}
/**
@ -123,7 +126,7 @@ public class CpmFormatDisk extends FormattedDisk {
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFormat()
*/
public String getFormat() {
return "CP/M";
return textBundle.get("CpmFormatDisk.Cpm"); //$NON-NLS-1$
}
/**
@ -205,7 +208,7 @@ public class CpmFormatDisk extends FormattedDisk {
* @see com.webcodepro.applecommander.storage.FormattedDisk#getBitmapLabels()
*/
public String[] getBitmapLabels() {
return new String[] { "CP/M 1K BLOCK" };
return new String[] { textBundle.get("CpmFormatDisk.BitmapLabel") }; //$NON-NLS-1$
}
/**
@ -308,7 +311,7 @@ public class CpmFormatDisk extends FormattedDisk {
* @see com.webcodepro.applecommander.storage.FormattedDisk#getSuggestedFilename(java.lang.String)
*/
public String getSuggestedFilename(String filename) {
StringTokenizer tokenizer = new StringTokenizer(filename, ".");
StringTokenizer tokenizer = new StringTokenizer(filename, "."); //$NON-NLS-1$
filename = tokenizer.nextToken(); // grab just the first part of the name..
StringBuffer newName = new StringBuffer();
if (!Character.isLetter(filename.charAt(0))) {
@ -332,9 +335,9 @@ public class CpmFormatDisk extends FormattedDisk {
* @see com.webcodepro.applecommander.storage.FormattedDisk#getSuggestedFiletype(java.lang.String)
*/
public String getSuggestedFiletype(String filetype) {
StringTokenizer tokenizer = new StringTokenizer(filetype, ".");
StringTokenizer tokenizer = new StringTokenizer(filetype, "."); //$NON-NLS-1$
tokenizer.nextToken();
filetype = "";
filetype = ""; //$NON-NLS-1$
while (tokenizer.hasMoreTokens()) {
filetype = tokenizer.nextToken(); // grab just the last part of the name...
}
@ -383,8 +386,8 @@ public class CpmFormatDisk extends FormattedDisk {
CpmFileEntry fileEntry = new CpmFileEntry(this, offset);
if (!fileEntry.isEmpty()) {
// Files are unique by name, type, and user number.
String key = fileEntry.getFilename().trim() + "."
+ fileEntry.getFiletype().trim() + ":"
String key = fileEntry.getFilename().trim() + "." //$NON-NLS-1$
+ fileEntry.getFiletype().trim() + ":" //$NON-NLS-1$
+ fileEntry.getUserNumber(0);
if (index.containsKey(key)) {
fileEntry = (CpmFileEntry) index.get(key);
@ -473,16 +476,24 @@ public class CpmFormatDisk extends FormattedDisk {
List list = new ArrayList();
switch (displayMode) {
case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader("Name", 8, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Type", 3, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(textBundle.get("Name"), 8, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(textBundle.get("Type"), 3, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
break;
case FILE_DISPLAY_DETAIL:
list.add(new FileColumnHeader("Name", 8, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Type", 3, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Size (bytes)", 6, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("User#", 4, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Deleted?", 7, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Locked?", 6, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle.get("Name"), 8, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(textBundle.get("Type"), 3, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(textBundle.get("SizeInBytes"), 6, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("CpmFormatDisk.UserNumber"), 4, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("DeletedQ"), 7, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle.get("LockedQ"), 6, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
break;
default: // FILE_DISPLAY_STANDARD
list.addAll(super.getFileColumnHeaders(displayMode));

View File

@ -28,6 +28,7 @@ import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FileFilter;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.filters.ApplesoftFileFilter;
import com.webcodepro.applecommander.storage.filters.AssemblySourceFileFilter;
import com.webcodepro.applecommander.storage.filters.BinaryFileFilter;
@ -35,6 +36,7 @@ import com.webcodepro.applecommander.storage.filters.GraphicsFileFilter;
import com.webcodepro.applecommander.storage.filters.IntegerBasicFileFilter;
import com.webcodepro.applecommander.storage.filters.TextFileFilter;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Represents a DOS file entry on disk.
@ -43,6 +45,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class DosFileEntry implements FileEntry {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* Indicates the length in bytes of the DOS file entry field.
*/
@ -95,9 +98,9 @@ public class DosFileEntry implements FileEntry {
*/
protected void writeFileEntry(byte[] fileEntry) {
if (fileEntry.length != FILE_DESCRIPTIVE_ENTRY_LENGTH) {
throw new IllegalArgumentException(
"A DOS 3.3 file entry must be " + FILE_DESCRIPTIVE_ENTRY_LENGTH
+ " bytes long!");
throw new IllegalArgumentException(textBundle.
format("DosFileEntry.DosFileEntryLengthError", //$NON-NLS-1$
FILE_DESCRIPTIVE_ENTRY_LENGTH));
}
byte[] sectorData = disk.readSector(track, sector);
System.arraycopy(fileEntry, 0, sectorData, offset, fileEntry.length);
@ -134,18 +137,18 @@ public class DosFileEntry implements FileEntry {
*/
public String getFiletype() {
int filetype = (AppleUtil.getUnsignedByte(readFileEntry()[2]) & 0x7f);
if (filetype == 0x00) return "T";
if (filetype == 0x00) return "T"; //$NON-NLS-1$
// the "^" operator is exclusive or - used to ensure only that
// bit was turned on. if others are turned on, fall through and
// return a "?" as the file type
if ((filetype ^ 0x01) == 0) return "I";
if ((filetype ^ 0x02) == 0) return "A";
if ((filetype ^ 0x04) == 0) return "B";
if ((filetype ^ 0x08) == 0) return "S";
if ((filetype ^ 0x10) == 0) return "R";
if ((filetype ^ 0x20) == 0) return "a";
if ((filetype ^ 0x40) == 0) return "b";
return "?"; // should never occur (read the code!)
if ((filetype ^ 0x01) == 0) return "I"; //$NON-NLS-1$
if ((filetype ^ 0x02) == 0) return "A"; //$NON-NLS-1$
if ((filetype ^ 0x04) == 0) return "B"; //$NON-NLS-1$
if ((filetype ^ 0x08) == 0) return "S"; //$NON-NLS-1$
if ((filetype ^ 0x10) == 0) return "R"; //$NON-NLS-1$
if ((filetype ^ 0x20) == 0) return "a"; //$NON-NLS-1$
if ((filetype ^ 0x40) == 0) return "b"; //$NON-NLS-1$
return "?"; // should never occur (read the code!) //$NON-NLS-1$
}
/**
@ -154,14 +157,14 @@ public class DosFileEntry implements FileEntry {
public void setFiletype(String filetype) {
byte[] data = readFileEntry();
int type = 0x04; // assume binary
if ("T".equals(filetype)) type = 0x00;
if ("I".equals(filetype)) type = 0x01;
if ("A".equals(filetype)) type = 0x02;
if ("B".equals(filetype)) type = 0x04;
if ("S".equals(filetype)) type = 0x08;
if ("R".equals(filetype)) type = 0x10;
if ("a".equals(filetype)) type = 0x20;
if ("b".equals(filetype)) type = 0x40;
if ("T".equals(filetype)) type = 0x00; //$NON-NLS-1$
if ("I".equals(filetype)) type = 0x01; //$NON-NLS-1$
if ("A".equals(filetype)) type = 0x02; //$NON-NLS-1$
if ("B".equals(filetype)) type = 0x04; //$NON-NLS-1$
if ("S".equals(filetype)) type = 0x08; //$NON-NLS-1$
if ("R".equals(filetype)) type = 0x10; //$NON-NLS-1$
if ("a".equals(filetype)) type = 0x20; //$NON-NLS-1$
if ("b".equals(filetype)) type = 0x40; //$NON-NLS-1$
type = (type | (data[2] & 0x80));
data[2] = (byte) type;
writeFileEntry(data);
@ -201,10 +204,10 @@ public class DosFileEntry implements FileEntry {
int size = (getSectorsUsed()-1) * Disk.SECTOR_SIZE;
if (size < 1) size = 0; // we assume a T/S block is included (may not be)
if (rawdata != null) {
if ("B".equals(getFiletype())) {
if ("B".equals(getFiletype())) { //$NON-NLS-1$
// binary
return AppleUtil.getWordValue(rawdata, 2);
} else if ("A".equals(getFiletype()) || "I".equals(getFiletype())) {
} else if ("A".equals(getFiletype()) || "I".equals(getFiletype())) { //$NON-NLS-1$ //$NON-NLS-2$
// applesoft, integer basic
return AppleUtil.getWordValue(rawdata, 0);
}
@ -236,15 +239,6 @@ public class DosFileEntry implements FileEntry {
return false;
}
/**
* Retrieve the list of files in this directory.
* Always returns null for DOS.
* @see com.webcodepro.applecommander.storage.FileEntry#getFiles()
*/
public List getFiles() {
return null;
}
/**
* Identify if this file has been deleted.
* @see com.webcodepro.applecommander.storage.FileEntry#isDeleted()
@ -275,27 +269,27 @@ public class DosFileEntry implements FileEntry {
List list = new ArrayList();
switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(isLocked() ? "*" : " ");
list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$
list.add(getFiletype());
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getSectorsUsed()));
list.add(getFilename());
break;
case FormattedDisk.FILE_DISPLAY_DETAIL:
list.add(isLocked() ? "*" : " ");
list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$
list.add(getFiletype());
list.add(getFilename());
list.add(numberFormat.format(getSize()));
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getSectorsUsed()));
list.add(isDeleted() ? "Deleted" : "");
list.add("T" + getTrack() + " S" + getSector());
list.add(isDeleted() ? textBundle.get("Deleted") : ""); //$NON-NLS-1$//$NON-NLS-2$
list.add("T" + getTrack() + " S" + getSector()); //$NON-NLS-1$ //$NON-NLS-2$
break;
default: // FILE_DISPLAY_STANDARD
list.add(getFilename());
list.add(getFiletype());
list.add(numberFormat.format(getSize()));
list.add(isLocked() ? "Locked" : "");
list.add(isLocked() ? textBundle.get("Locked") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
}
return list;
@ -428,8 +422,8 @@ public class DosFileEntry implements FileEntry {
*/
public boolean isAssemblySourceFile() {
boolean rightFiletype = isTextFile() || isBinaryFile();
if (rightFiletype && getFilename().endsWith(".S")) return true;
if (rightFiletype && getFilename().startsWith("T.")) return true;
if (rightFiletype && getFilename().endsWith(".S")) return true; //$NON-NLS-1$
if (rightFiletype && getFilename().startsWith("T.")) return true; //$NON-NLS-1$
return false;
}
@ -437,28 +431,28 @@ public class DosFileEntry implements FileEntry {
* Determine if this is a text file.
*/
public boolean isTextFile() {
return "T".equals(getFiletype());
return "T".equals(getFiletype()); //$NON-NLS-1$
}
/**
* Determine if this is an Applesoft BASIC file.
*/
public boolean isApplesoftBasicFile() {
return "A".equals(getFiletype());
return "A".equals(getFiletype()); //$NON-NLS-1$
}
/**
* Determine if this is an Integer BASIC file.
*/
public boolean isIntegerBasicFile() {
return "I".equals(getFiletype());
return "I".equals(getFiletype()); //$NON-NLS-1$
}
/**
* Determine if this is a binary file.
*/
public boolean isBinaryFile() {
return "B".equals(getFiletype());
return "B".equals(getFiletype()); //$NON-NLS-1$
}
/**
@ -494,8 +488,8 @@ public class DosFileEntry implements FileEntry {
}
} catch (DiskFullException e) {
// Should not be possible when the file isn't being modified!!
throw new IllegalStateException("Unable to set address for DosFileEntry ["
+ getFilename() + "]");
throw new IllegalStateException(textBundle.
format("DosFileEntry.UnableToSetAddressError", getFilename())); //$NON-NLS-1$
}
}

View File

@ -25,8 +25,10 @@ import java.util.List;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Manages a disk that is in Apple DOS 3.3 format.
@ -35,6 +37,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class DosFormatDisk extends FormattedDisk {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* Indicates the index of the track in the location array.
*/
@ -59,7 +62,8 @@ public class DosFormatDisk extends FormattedDisk {
* The list of filetypes available.
*/
private static final String[] filetypes = {
"T", "A", "I", "B", "S", "R", "a", "b"
"T", "A", "I", "B", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
"S", "R", "a", "b" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
};
/**
@ -89,7 +93,8 @@ public class DosFormatDisk extends FormattedDisk {
*/
public boolean isFree() {
if (location == null || location.length != 2) {
throw new IllegalArgumentException("Invalid dimension for isFree! Did you call next first?");
throw new IllegalArgumentException(StorageBundle.getInstance()
.get("DosFormatDisk.InvalidDimensionError")); //$NON-NLS-1$
}
return isSectorFree(location[TRACK_LOCATION_INDEX],
location[SECTOR_LOCATION_INDEX], readVtoc());
@ -101,9 +106,6 @@ public class DosFormatDisk extends FormattedDisk {
/**
* Constructor for DosFormatDisk.
* @param filename
* @param diskImage
* @param order
*/
public DosFormatDisk(String filename, ImageOrder imageOrder) {
super(filename, imageOrder);
@ -121,15 +123,15 @@ public class DosFormatDisk extends FormattedDisk {
/**
* Identify the operating system format of this disk as DOS 3.3.
* @see com.webcodepro.applecommander.storage.Disk#getFormat()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFormat()
*/
public String getFormat() {
return "DOS 3.3";
return textBundle.get("Dos33"); //$NON-NLS-1$
}
/**
* Retrieve a list of files.
* @see com.webcodepro.applecommander.storage.Disk#getFiles()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
*/
public List getFiles() {
List list = new ArrayList();
@ -171,7 +173,7 @@ public class DosFormatDisk extends FormattedDisk {
track = catalogSector[1];
sector = catalogSector[2];
}
throw new DiskFullException("Unable to allocate more space for another file!");
throw new DiskFullException(textBundle.get("DosFormatDisk.NoMoreSpaceError")); //$NON-NLS-1$
}
/**
@ -197,7 +199,7 @@ public class DosFormatDisk extends FormattedDisk {
* Compute the amount of freespace available on the disk.
* This algorithm completely ignores tracks and sectors by
* running through the entire bitmap stored on the VTOC.
* @see com.webcodepro.applecommander.storage.Disk#getFreeSpace()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFreeSpace()
*/
public int getFreeSpace() {
return getFreeSectors() * SECTOR_SIZE;
@ -218,7 +220,7 @@ public class DosFormatDisk extends FormattedDisk {
/**
* Return the amount of used space in bytes.
* @see com.webcodepro.applecommander.storage.Disk#getUsedSpace()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getUsedSpace()
*/
public int getUsedSpace() {
return getUsedSectors() * SECTOR_SIZE;
@ -244,11 +246,11 @@ public class DosFormatDisk extends FormattedDisk {
* Return the DOS disk name. Basically, the DISK VOLUME #xxx
* that a CATALOG command would show. Note that Java bytes are
* signed, so a little mojo is in order.
* @see com.webcodepro.applecommander.storage.Disk#getDiskName()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getDiskName()
*/
public String getDiskName() {
int volumeNumber = AppleUtil.getUnsignedByte(readVtoc()[0x06]);
return "DISK VOLUME #" + volumeNumber;
return textBundle.get("DosFormatDisk.DiskVolume") + volumeNumber; //$NON-NLS-1$
}
/**
@ -310,7 +312,7 @@ public class DosFormatDisk extends FormattedDisk {
* Get the labels to use in the bitmap.
*/
public String[] getBitmapLabels() {
return new String[] { "Track", "Sector" };
return new String[] { textBundle.get("DosFormatDisk.Track"), textBundle.get("DosFormatDisk.Sector") }; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@ -318,11 +320,11 @@ public class DosFormatDisk extends FormattedDisk {
*/
public List getDiskInformation() {
List list = super.getDiskInformation();
list.add(new DiskInformation("Total Sectors", getTotalSectors()));
list.add(new DiskInformation("Free Sectors", getFreeSectors()));
list.add(new DiskInformation("Used Sectors", getUsedSectors()));
list.add(new DiskInformation("Tracks On Disk", getTracks()));
list.add(new DiskInformation("Sectors On Disk", getSectors()));
list.add(new DiskInformation(textBundle.get("DosFormatDisk.TotalSectors"), getTotalSectors())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("DosFormatDisk.FreeSectors"), getFreeSectors())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("DosFormatDisk.UsedSectors"), getUsedSectors())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("DosFormatDisk.TracksOnDisk"), getTracks())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("DosFormatDisk.SectorsOnDisk"), getSectors())); //$NON-NLS-1$
return list;
}
@ -334,19 +336,23 @@ public class DosFormatDisk extends FormattedDisk {
List list = new ArrayList();
switch (displayMode) {
case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Type", 1, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Size (sectors)", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Name", 30, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("DosFormatDisk.Type"), 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("DosFormatDisk.SizeInSectors"), 3, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Name"), 30, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
break;
case FILE_DISPLAY_DETAIL:
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Type", 1, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Name", 30, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Size (bytes)", 6, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Size (sectors)", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Deleted?", 7, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Track/Sector List", 7, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("DosFormatDisk.Type"), 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Name"), 30, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(textBundle.get("SizeInBytes"), 6, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("DosFormatDisk.SizeInSectors"), 3, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("DeletedQ"), 7, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle.get("DosFormatDisk.TrackAndSectorList"), 7, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
break;
default: // FILE_DISPLAY_STANDARD
list.addAll(super.getFileColumnHeaders(displayMode));
@ -378,7 +384,7 @@ public class DosFormatDisk extends FormattedDisk {
/**
* Identify if this disk format as not capable of having directories.
* @see com.webcodepro.applecommander.storage.Disk#hasDirectories()
* @see com.webcodepro.applecommander.storage.FormattedDisk#canHaveDirectories()
*/
public boolean canHaveDirectories() {
return false;
@ -396,7 +402,7 @@ public class DosFormatDisk extends FormattedDisk {
*/
public byte[] getFileData(FileEntry fileEntry) {
if ( !(fileEntry instanceof DosFileEntry)) {
throw new IllegalArgumentException("Most have a DOS 3.3 file entry!");
throw new IllegalArgumentException(textBundle.get("DosFormatDisk.InvalidFileEntryError")); //$NON-NLS-1$
}
DosFileEntry dosEntry = (DosFileEntry) fileEntry;
// Size is calculated by sectors used - not actual size - as size varies
@ -448,9 +454,9 @@ public class DosFormatDisk extends FormattedDisk {
int numberOfSectors = numberOfDataSectors +
(numberOfDataSectors + TRACK_SECTOR_PAIRS - 1) / TRACK_SECTOR_PAIRS;
if (numberOfSectors > getFreeSectors() + fileEntry.getSectorsUsed()) {
throw new DiskFullException("This file requires " + numberOfSectors
+ " sectors but there are only " + getFreeSectors() + " sectors"
+ " available on the disk.");
throw new DiskFullException(
textBundle.format("DosFormatDisk.NotEnoughSectorsError", //$NON-NLS-1$
numberOfSectors, getFreeSectors()));
}
// free "old" data and just rewrite stuff...
freeSectors(fileEntry);
@ -658,8 +664,8 @@ public class DosFormatDisk extends FormattedDisk {
protected void checkRange(int track, int sector) {
if (track > 50 || sector > 32) {
throw new IllegalArgumentException(
"Invalid track (" + track + "), sector (" + sector
+ ") combination.");
textBundle.format("DosFormatDisk.InvalidTrackAndSectorCombinationError", //$NON-NLS-1$
track, sector));
}
}
@ -687,12 +693,12 @@ public class DosFormatDisk extends FormattedDisk {
* as to the filetype.
*/
public String getSuggestedFiletype(String filename) {
String filetype = "B";
int pos = filename.lastIndexOf(".");
String filetype = "B"; //$NON-NLS-1$
int pos = filename.lastIndexOf("."); //$NON-NLS-1$
if (pos > 0) {
String what = filename.substring(pos+1);
if ("txt".equalsIgnoreCase(what)) {
filetype = "T";
if ("txt".equalsIgnoreCase(what)) { //$NON-NLS-1$
filetype = "T"; //$NON-NLS-1$
}
}
return filetype;
@ -711,7 +717,7 @@ public class DosFormatDisk extends FormattedDisk {
* For DOS, only the Binary type needs an address.
*/
public boolean needsAddress(String filetype) {
return "B".equals(filetype);
return "B".equals(filetype); //$NON-NLS-1$
}
/**

View File

@ -19,7 +19,9 @@
*/
package com.webcodepro.applecommander.storage.os.dos33;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Manages a disk that is in OzDOS format.
@ -32,6 +34,7 @@ import com.webcodepro.applecommander.storage.physical.ImageOrder;
* @author Rob Greene
*/
public class OzDosFormatDisk extends DosFormatDisk {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* Use this indicator to work with logical disk #1.
* It is essentially the offset into the block.
@ -49,8 +52,6 @@ public class OzDosFormatDisk extends DosFormatDisk {
private int logicalOffset;
/**
* Constructor for OzDosFormatDisk.
* @param filename
* @param diskImage
*/
public OzDosFormatDisk(String filename, ImageOrder imageOrder, int logicalOffset) {
super(filename, imageOrder);
@ -72,9 +73,9 @@ public class OzDosFormatDisk extends DosFormatDisk {
*/
public String getDiskName() {
if (logicalOffset == OZDOS_DISK_1) {
return super.getDiskName() + " (Disk 1)";
return textBundle.format("DiskNameN", super.getDiskName(), 1); //$NON-NLS-1$
} else if (logicalOffset == OZDOS_DISK_2) {
return super.getDiskName() + " (Disk 2)";
return textBundle.format("DiskNameN", super.getDiskName(), 2); //$NON-NLS-1$
} else {
return super.getDiskName();
}

View File

@ -19,7 +19,9 @@
*/
package com.webcodepro.applecommander.storage.os.dos33;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Manages a disk that is in UniDOS format.
@ -30,6 +32,7 @@ import com.webcodepro.applecommander.storage.physical.ImageOrder;
* @author Rob
*/
public class UniDosFormatDisk extends DosFormatDisk {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* Use this indicator to work with logical disk #1.
* It is essentially the track offset into the disk image.
@ -47,8 +50,6 @@ public class UniDosFormatDisk extends DosFormatDisk {
private int logicalOffset;
/**
* Constructor for UniDosFormatDisk.
* @param filename
* @param diskImage
*/
public UniDosFormatDisk(String filename, ImageOrder imageOrder, int logicalOffset) {
super(filename, imageOrder);
@ -70,9 +71,9 @@ public class UniDosFormatDisk extends DosFormatDisk {
*/
public String getDiskName() {
if (logicalOffset == UNIDOS_DISK_1) {
return super.getDiskName() + " (Disk 1)";
return textBundle.format("DiskNameN", super.getDiskName(), 1); //$NON-NLS-1$
} else if (logicalOffset == UNIDOS_DISK_2) {
return super.getDiskName() + " (Disk 2)";
return textBundle.format("DiskNameN", super.getDiskName(), 2); //$NON-NLS-1$
} else {
return super.getDiskName();
}

View File

@ -30,11 +30,13 @@ import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FileFilter;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.filters.BinaryFileFilter;
import com.webcodepro.applecommander.storage.filters.GraphicsFileFilter;
import com.webcodepro.applecommander.storage.filters.PascalTextFileFilter;
import com.webcodepro.applecommander.storage.filters.TextFileFilter;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Represents a Pascal file entry on disk.
@ -43,6 +45,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class PascalFileEntry implements FileEntry {
private TextBundle textBundle = StorageBundle.getInstance();
private byte[] fileEntry;
private PascalFormatDisk disk;
@ -97,10 +100,9 @@ public class PascalFileEntry implements FileEntry {
String[] filetypes = disk.getFiletypes();
int filetype = fileEntry[4] & 0x0f;
if (filetype == 0 || filetype > filetypes.length) {
return "unknown (" + filetype + ")";
} else {
return filetypes[filetype-1];
return textBundle.format("PascalFileEntry.UnknownFiletype", filetype); //$NON-NLS-1$
}
return filetypes[filetype-1];
}
/**
@ -190,7 +192,8 @@ public class PascalFileEntry implements FileEntry {
*/
public List getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MMM-yy");
SimpleDateFormat dateFormat = new SimpleDateFormat(
textBundle.get("PascalFileEntry.PascalDateFormat")); //$NON-NLS-1$
List list = new ArrayList();
switch (displayMode) {
@ -218,7 +221,7 @@ public class PascalFileEntry implements FileEntry {
list.add(getFilename());
list.add(getFiletype());
list.add(numberFormat.format(getSize()));
list.add(isLocked() ? "Locked" : "");
list.add(isLocked() ? textBundle.get("Locked") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
}
return list;
@ -246,13 +249,12 @@ public class PascalFileEntry implements FileEntry {
* of guessing the appropriate filter.
*/
public FileFilter getSuggestedFilter() {
if ("textfile".equals(getFiletype())) {
if (getFilename().toLowerCase().endsWith(".text")) {
if ("textfile".equals(getFiletype())) { //$NON-NLS-1$
if (getFilename().toLowerCase().endsWith(".text")) { //$NON-NLS-1$
return new PascalTextFileFilter();
} else {
return new TextFileFilter();
}
} else if ("datafile".equals(getFiletype()) && getSize() >= 8184 && getSize() <= 8192) {
return new TextFileFilter();
} else if ("datafile".equals(getFiletype()) && getSize() >= 8184 && getSize() <= 8192) { //$NON-NLS-1$
GraphicsFileFilter filter = new GraphicsFileFilter();
filter.setMode(GraphicsFileFilter.MODE_HGR_COLOR);
return filter;

View File

@ -28,8 +28,10 @@ import java.util.List;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Manages a disk that is in the Pascal format.
@ -38,6 +40,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class PascalFormatDisk extends FormattedDisk {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* The size of the Pascal file entry.
*/
@ -48,22 +51,22 @@ public class PascalFormatDisk extends FormattedDisk {
public static final int PASCAL_BLOCKS_ON_140K_DISK = 280;
// filetypes used elsewhere in the code:
private static final String TEXTFILE = "textfile";
private static final String CODEFILE = "codefile";
private static final String DATAFILE = "datafile";
private static final String TEXTFILE = "textfile"; //$NON-NLS-1$
private static final String CODEFILE = "codefile"; //$NON-NLS-1$
private static final String DATAFILE = "datafile"; //$NON-NLS-1$
/**
* The know filetypes for a Pascal disk.
*/
private static final String[] filetypes = {
"xdskfile",
"xdskfile", //$NON-NLS-1$
CODEFILE,
TEXTFILE,
"infofile",
"infofile", //$NON-NLS-1$
DATAFILE,
"graffile",
"fotofile",
"securedir" };
"graffile", //$NON-NLS-1$
"fotofile", //$NON-NLS-1$
"securedir" }; //$NON-NLS-1$
/**
* Use this inner interface for managing the disk usage data.
@ -109,8 +112,6 @@ public class PascalFormatDisk extends FormattedDisk {
/**
* Constructor for PascalFormatDisk.
* @param filename
* @param diskImage
*/
public PascalFormatDisk(String filename, ImageOrder imageOrder) {
super(filename, imageOrder);
@ -128,15 +129,15 @@ public class PascalFormatDisk extends FormattedDisk {
/**
* Identify the operating system format of this disk.
* @see com.webcodepro.applecommander.storage.Disk#getFormat()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFormat()
*/
public String getFormat() {
return "Pascal";
return textBundle.get("PascalFormatDisk.Pascal"); //$NON-NLS-1$
}
/**
* Retrieve a list of files.
* @see com.webcodepro.applecommander.storage.Disk#getFiles()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
*/
public List getFiles() {
List list = new ArrayList();
@ -158,7 +159,7 @@ public class PascalFormatDisk extends FormattedDisk {
* Create a new FileEntry.
*/
public FileEntry createFile() throws DiskFullException {
throw new DiskFullException("Unable to create files (yet).");
throw new DiskFullException(textBundle.get("FileCreationNotSupported")); //$NON-NLS-1$
}
/**
@ -197,7 +198,7 @@ public class PascalFormatDisk extends FormattedDisk {
*/
public void writeDirectory(byte[] directory) {
if (directory == null || directory.length != 2048) {
throw new IllegalArgumentException("Invalid Pascal directory.");
throw new IllegalArgumentException(textBundle.get("PascalFormatDisk.InvalidPascalDirectory")); //$NON-NLS-1$
}
for (int i=0; i<4; i++) {
byte[] block = new byte[BLOCK_SIZE];
@ -208,7 +209,7 @@ public class PascalFormatDisk extends FormattedDisk {
/**
* Identify if this disk format is capable of having directories.
* @see com.webcodepro.applecommander.storage.Disk#canHaveDirectories()
* @see com.webcodepro.applecommander.storage.FormattedDisk#canHaveDirectories()
*/
public boolean canHaveDirectories() {
return false;
@ -216,7 +217,7 @@ public class PascalFormatDisk extends FormattedDisk {
/**
* Return the amount of free space in bytes.
* @see com.webcodepro.applecommander.storage.Disk#getFreeSpace()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFreeSpace()
*/
public int getFreeSpace() {
return getFreeBlocks() * BLOCK_SIZE;
@ -277,7 +278,7 @@ public class PascalFormatDisk extends FormattedDisk {
/**
* Return the amount of used space in bytes.
* @see com.webcodepro.applecommander.storage.Disk#getUsedSpace()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getUsedSpace()
*/
public int getUsedSpace() {
return getUsedBlocks() * BLOCK_SIZE;
@ -301,10 +302,10 @@ public class PascalFormatDisk extends FormattedDisk {
/**
* Return the name of the disk. This is stored on block #2
* offset +6 (string[7]).
* @see com.webcodepro.applecommander.storage.Disk#getDiskName()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getDiskName()
*/
public String getDiskName() {
return AppleUtil.getPascalString(readBlock(2), 6) + ":";
return AppleUtil.getPascalString(readBlock(2), 6) + ":"; //$NON-NLS-1$
}
/**
@ -343,7 +344,7 @@ public class PascalFormatDisk extends FormattedDisk {
* Get the labels to use in the bitmap.
*/
public String[] getBitmapLabels() {
return new String[] { "Block" };
return new String[] { textBundle.get("Block") }; //$NON-NLS-1$
}
/**
@ -351,12 +352,15 @@ public class PascalFormatDisk extends FormattedDisk {
*/
public List getDiskInformation() {
List list = super.getDiskInformation();
list.add(new DiskInformation("Total Blocks", getBlocksOnDisk()));
list.add(new DiskInformation("Free Blocks", getFreeBlocks()));
list.add(new DiskInformation("Used Blocks", getUsedBlocks()));
list.add(new DiskInformation("Files On Disk", getFilesOnDisk()));
list.add(new DiskInformation("Last Access Date", getLastAccessDate()));
list.add(new DiskInformation("Most Recent Date Setting", getMostRecentDateSetting()));
list.add(new DiskInformation(textBundle.get("TotalBlocks"), getBlocksOnDisk())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FreeBlocks"), getFreeBlocks())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("UsedBlocks"), getUsedBlocks())); //$NON-NLS-1$
list.add(new DiskInformation(
textBundle.get("PascalFormatDisk.FilesOnDisk"), getFilesOnDisk())); //$NON-NLS-1$
list.add(new DiskInformation(
textBundle.get("PascalFormatDisk.LastAccessDate"), getLastAccessDate())); //$NON-NLS-1$
list.add(new DiskInformation(
textBundle.get("PascalFormatDisk.MostRecentDateSetting"), getMostRecentDateSetting())); //$NON-NLS-1$
return list;
}
@ -368,20 +372,35 @@ public class PascalFormatDisk extends FormattedDisk {
List list = new ArrayList();
switch (displayMode) {
case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader("Modified", 8, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Blocks", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Filetype", 8, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Name", 15, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(textBundle.get("Modified"), 8, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle.get("Blocks"), 3, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("Filetype"), 8, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle.get("Name"), 15, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
break;
case FILE_DISPLAY_DETAIL:
list.add(new FileColumnHeader("Modified", 8, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Blocks", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Bytes in last block", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Size (bytes)", 6, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Filetype", 8, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Name", 15, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("First Block", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Last Block", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("Modified"), 8, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle.get("Blocks"), 3, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(
textBundle.get("PascalFormatDisk.BytesInLastBlock"), 3, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("SizeInBytes"), 6, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("Filetype"), 8, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle.get("Name"), 15, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(
textBundle.get("PascalFormatDisk.FirstBlock"), 3, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(
textBundle.get("PascalFormatDisk.LastBlock"), 3, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
break;
default: // FILE_DISPLAY_STANDARD
list.addAll(super.getFileColumnHeaders(displayMode));
@ -423,7 +442,7 @@ public class PascalFormatDisk extends FormattedDisk {
*/
public byte[] getFileData(FileEntry fileEntry) {
if ( !(fileEntry instanceof PascalFileEntry)) {
throw new IllegalArgumentException("Most have a Pascal file entry!");
throw new IllegalArgumentException(textBundle.get("PascalFormatDisk.IncorrectFileEntryError")); //$NON-NLS-1$
}
PascalFileEntry pascalEntry = (PascalFileEntry) fileEntry;
int firstBlock = pascalEntry.getFirstBlock();
@ -433,7 +452,8 @@ public class PascalFormatDisk extends FormattedDisk {
for (int block = firstBlock; block < lastBlock; block++) {
byte[] blockData = readBlock(block);
if (block == lastBlock-1) {
System.arraycopy(blockData, 0, fileData, offset, pascalEntry.getBytesUsedInLastBlock());
System.arraycopy(blockData, 0, fileData, offset,
pascalEntry.getBytesUsedInLastBlock());
} else {
System.arraycopy(blockData, 0, fileData, offset, blockData.length);
}
@ -498,12 +518,12 @@ public class PascalFormatDisk extends FormattedDisk {
*/
public String getSuggestedFiletype(String filename) {
String filetype = DATAFILE;
int pos = filename.lastIndexOf(".");
int pos = filename.lastIndexOf("."); //$NON-NLS-1$
if (pos > 0) {
String what = filename.substring(pos+1);
if ("txt".equalsIgnoreCase(what)) {
if ("txt".equalsIgnoreCase(what)) { //$NON-NLS-1$
filetype = TEXTFILE;
} else if ("pas".equalsIgnoreCase(what)) {
} else if ("pas".equalsIgnoreCase(what)) { //$NON-NLS-1$
filetype = CODEFILE;
}
}

View File

@ -31,7 +31,6 @@ public class ProdosCommonDirectoryHeader extends ProdosCommonEntry {
/**
* Constructor for ProdosCommonDirectoryHeader.
* @param fileEntry
*/
public ProdosCommonDirectoryHeader(ProdosFormatDisk disk, int block) {
super(disk, block, 4); // directory entries are always offset 4, right?

View File

@ -29,6 +29,7 @@ import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FileFilter;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.filters.AppleWorksDataBaseFileFilter;
import com.webcodepro.applecommander.storage.filters.AppleWorksSpreadSheetFileFilter;
import com.webcodepro.applecommander.storage.filters.AppleWorksWordProcessorFileFilter;
@ -39,6 +40,7 @@ import com.webcodepro.applecommander.storage.filters.GraphicsFileFilter;
import com.webcodepro.applecommander.storage.filters.IntegerBasicFileFilter;
import com.webcodepro.applecommander.storage.filters.TextFileFilter;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Represents a ProDOS file entry on disk.
@ -47,6 +49,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* Constructor for ProdosFileEntry.
*/
@ -344,68 +347,75 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
*/
public List getFileColumnData(int displayMode) {
NumberFormat numberFormat = NumberFormat.getNumberInstance();
SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
SimpleDateFormat dateFormat = new SimpleDateFormat(
textBundle.get("DateFormat")); //$NON-NLS-1$
List list = new ArrayList();
switch (displayMode) {
case FormattedDisk.FILE_DISPLAY_NATIVE:
list.add(isLocked() ? "*" : " ");
list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$
list.add(getFilename());
list.add(getFiletype());
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getBlocksUsed()));
list.add(getLastModificationDate() == null ? "<NO DATE> " :
list.add(getLastModificationDate() == null ?
textBundle.get("ProdosFileEntry.NullDate") : //$NON-NLS-1$
dateFormat.format(getLastModificationDate()));
list.add(getCreationDate() == null ? "<NO DATE> " :
list.add(getCreationDate() == null ?
textBundle.get("ProdosFileEntry.NullDate") : //$NON-NLS-1$
dateFormat.format(getCreationDate()));
numberFormat.setMinimumIntegerDigits(1);
list.add(numberFormat.format(getEofPosition()));
if ("TXT".equals(getFiletype()) && getAuxiliaryType() > 0) {
if ("TXT".equals(getFiletype()) && getAuxiliaryType() > 0) { //$NON-NLS-1$
numberFormat.setMinimumIntegerDigits(1);
list.add("L=" + numberFormat.format(getAuxiliaryType()).trim());
} else if (("BIN".equals(getFiletype()) || "BAS".equals(getFiletype())
|| "VAR".equals(getFiletype()) || "SYS".equals(getFiletype()))
list.add("L=" + numberFormat.format(getAuxiliaryType()).trim()); //$NON-NLS-1$
} else if (("BIN".equals(getFiletype()) || "BAS".equals(getFiletype()) //$NON-NLS-1$ //$NON-NLS-2$
|| "VAR".equals(getFiletype()) || "SYS".equals(getFiletype())) //$NON-NLS-1$ //$NON-NLS-2$
&& getAuxiliaryType() > 0) {
list.add("A=$" + AppleUtil.getFormattedWord(getAuxiliaryType()));
list.add("A=$" + AppleUtil.getFormattedWord(getAuxiliaryType())); //$NON-NLS-1$
} else {
list.add("");
list.add(""); //$NON-NLS-1$
}
break;
case FormattedDisk.FILE_DISPLAY_DETAIL:
list.add(isLocked() ? "*" : " ");
list.add(isLocked() ? "*" : " "); //$NON-NLS-1$ //$NON-NLS-2$
list.add(getFilename());
list.add(isDeleted() ? "Deleted" : "");
String permissions = "";
if (canDestroy()) permissions+= "Destroy ";
if (canRead()) permissions+= "Read ";
if (canRename()) permissions+= "Rename ";
if (canWrite()) permissions+= "Write ";
list.add(isDeleted() ? textBundle.get("Deleted") : ""); //$NON-NLS-1$//$NON-NLS-2$
String permissions = ""; //$NON-NLS-1$
if (canDestroy()) permissions+= textBundle.get("Destroy"); //$NON-NLS-1$
if (canRead()) permissions+= textBundle.get("Read"); //$NON-NLS-1$
if (canRename()) permissions+= textBundle.get("Rename"); //$NON-NLS-1$
if (canWrite()) permissions+= textBundle.get("Write"); //$NON-NLS-1$
list.add(permissions);
list.add(getFiletype());
list.add(isDirectory() ? "Directory" : "");
list.add(isDirectory() ? textBundle.get("ProdosFileEntry.Directory") : ""); //$NON-NLS-1$//$NON-NLS-2$
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getBlocksUsed()));
list.add(getLastModificationDate() == null ? "<NO DATE> " :
list.add(getLastModificationDate() == null ?
textBundle.get("ProdosFileEntry.NullDate") : //$NON-NLS-1$
dateFormat.format(getLastModificationDate()));
list.add(getCreationDate() == null ? "<NO DATE> " :
list.add(getCreationDate() == null ? textBundle.get("ProdosFileEntry.NullDate") : //$NON-NLS-1$
dateFormat.format(getCreationDate()));
numberFormat.setMinimumIntegerDigits(1);
list.add(numberFormat.format(getEofPosition()));
if ("TXT".equals(getFiletype()) && getAuxiliaryType() > 0) {
if ("TXT".equals(getFiletype()) && getAuxiliaryType() > 0) { //$NON-NLS-1$
numberFormat.setMinimumIntegerDigits(1);
list.add("L=" + numberFormat.format(getAuxiliaryType()).trim());
} else if (("BIN".equals(getFiletype()) || "BAS".equals(getFiletype())
|| "VAR".equals(getFiletype()) || "SYS".equals(getFiletype()))
list.add("L=" + numberFormat.format(getAuxiliaryType()).trim()); //$NON-NLS-1$
} else if (("BIN".equals(getFiletype()) || "BAS".equals(getFiletype()) //$NON-NLS-1$ //$NON-NLS-2$
|| "VAR".equals(getFiletype()) || "SYS".equals(getFiletype())) //$NON-NLS-1$ //$NON-NLS-2$
&& getAuxiliaryType() > 0) {
list.add("A=$" + AppleUtil.getFormattedWord(getAuxiliaryType()));
list.add("A=$" + AppleUtil.getFormattedWord(getAuxiliaryType())); //$NON-NLS-1$
} else {
list.add("$" + AppleUtil.getFormattedWord(getAuxiliaryType()));
list.add("$" + AppleUtil.getFormattedWord(getAuxiliaryType())); //$NON-NLS-1$
}
list.add(AppleUtil.getFormattedWord(getHeaderPointer()));
list.add(AppleUtil.getFormattedWord(getKeyPointer()));
list.add(isSaplingFile() ? "Sapling" : isSeedlingFile() ? "Seedling" :
isTreeFile() ? "Tree" : "Unknown (" + getFileTypeString() + ")");
list.add(hasChanged() ? "Changed" : "");
list.add(isSaplingFile() ? textBundle.get("ProdosFileEntry.Sapling") : //$NON-NLS-1$
isSeedlingFile() ? textBundle.get("ProdosFileEntry.Seedling") : //$NON-NLS-1$
isTreeFile() ? textBundle.get("ProdosFileEntry.Tree") : //$NON-NLS-1$
textBundle.format("ProdosFileEntry.UnknownFileType", getFileTypeString())); //$NON-NLS-1$
list.add(hasChanged() ?
textBundle.get("ProdosFileEntry.Changed") : ""); //$NON-NLS-1$//$NON-NLS-2$
numberFormat.setMinimumIntegerDigits(1);
list.add(numberFormat.format(getMinimumProdosVersion()));
list.add(numberFormat.format(getProdosVersion()));
@ -414,7 +424,7 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
list.add(getFilename());
list.add(getFiletype());
list.add(numberFormat.format(getSize()));
list.add(isLocked() ? "Locked" : "");
list.add(isLocked() ? textBundle.get("Locked") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
}
return list;
@ -424,7 +434,7 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
* Return the ProDOS file type as a hex string.
*/
public String getFileTypeString() {
return "$" + AppleUtil.getFormattedByte(getStorageType());
return "$" + AppleUtil.getFormattedByte(getStorageType()); //$NON-NLS-1$
}
/**
@ -457,7 +467,7 @@ public class ProdosFileEntry extends ProdosCommonEntry implements FileEntry {
switch (filetype) {
case 0x04: // TXT
if (getFilename().endsWith(".S")) {
if (getFilename().endsWith(".S")) { //$NON-NLS-1$
return new AssemblySourceFileFilter();
}
return new TextFileFilter();

View File

@ -29,8 +29,10 @@ import java.util.Properties;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Manages a disk that is in the ProDOS format.
@ -39,6 +41,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class ProdosFormatDisk extends FormattedDisk {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* The location of the "next block" pointer in a directory entry.
* This is a 2-byte word (lo/hi) format. $0000 is end of directory.
@ -107,7 +110,7 @@ public class ProdosFormatDisk extends FormattedDisk {
private int location = -1;
private transient byte[] data = null;
public boolean hasNext() {
return location == -1 || location < volumeHeader.getTotalBlocks() - 1;
return location == -1 || location < getVolumeHeader().getTotalBlocks() - 1;
}
public void next() {
location++;
@ -117,7 +120,8 @@ public class ProdosFormatDisk extends FormattedDisk {
*/
public boolean isFree() {
if (location == -1) {
throw new IllegalArgumentException("Invalid dimension for isFree! Did you call next first?");
throw new IllegalArgumentException(StorageBundle.getInstance()
.get("ProdosFormatDisk.InvalidDimensionError")); //$NON-NLS-1$
}
if (data == null) {
data = readVolumeBitMap();
@ -132,7 +136,6 @@ public class ProdosFormatDisk extends FormattedDisk {
/**
* Constructor for ProdosFormatDisk.
* @param filename
* @param diskImage
*/
public ProdosFormatDisk(String filename, ImageOrder imageOrder) {
super(filename, imageOrder);
@ -148,23 +151,24 @@ public class ProdosFormatDisk extends FormattedDisk {
fileTypes = new ProdosFileType[256];
InputStream inputStream =
getClass().getResourceAsStream("ProdosFileTypes.properties");
getClass().getResourceAsStream("ProdosFileTypes.properties"); //$NON-NLS-1$
Properties properties = new Properties();
try {
properties.load(inputStream);
for (int i=0; i<256; i++) {
String byt = AppleUtil.getFormattedByte(i).toLowerCase();
String string = (String) properties.get("filetype." + byt);
String string = (String) properties.get("filetype." + byt); //$NON-NLS-1$
if (string == null || string.length() == 0) {
string = "$" + byt.toUpperCase();
string = "$" + byt.toUpperCase(); //$NON-NLS-1$
}
boolean addressRequired = Boolean.valueOf((String) properties.get(
"filetype." + byt + ".address")).booleanValue();
"filetype." + byt + ".address")).booleanValue(); //$NON-NLS-1$ //$NON-NLS-2$
boolean canCompile = Boolean.valueOf((String) properties.get(
"filetype." + byt + ".compile")).booleanValue();
"filetype." + byt + ".compile")).booleanValue(); //$NON-NLS-1$ //$NON-NLS-2$
fileTypes[i] = new ProdosFileType((byte)i, string, addressRequired, canCompile);
}
} catch (IOException ignored) {
// Ignored
}
}
@ -180,10 +184,10 @@ public class ProdosFormatDisk extends FormattedDisk {
/**
* Identify the operating system format of this disk.
* @see com.webcodepro.applecommander.storage.Disk#getFormat()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFormat()
*/
public String getFormat() {
return "ProDOS";
return textBundle.get("Prodos"); //$NON-NLS-1$
}
/**
@ -219,7 +223,7 @@ public class ProdosFormatDisk extends FormattedDisk {
fileEntry.setCanWrite(true);
fileEntry.setSeedlingFile();
fileEntry.setHeaderPointer(headerBlock);
fileEntry.setFilename("BLANK");
fileEntry.setFilename(textBundle.get("ProdosFormatDisk.Blank")); //$NON-NLS-1$
directory.incrementFileCount();
return fileEntry;
}
@ -245,12 +249,12 @@ public class ProdosFormatDisk extends FormattedDisk {
}
blockNumber = nextBlockNumber;
}
throw new DiskFullException("Unable to allocate more space for another file!");
throw new DiskFullException(textBundle.get("ProdosFormatDisk.UnableToAllocateSpaceError")); //$NON-NLS-1$
}
/**
* Retrieve a list of files.
* @see com.webcodepro.applecommander.storage.Disk#getFiles()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFiles()
*/
public List getFiles() {
return getFiles(VOLUME_DIRECTORY_BLOCK);
@ -292,7 +296,7 @@ public class ProdosFormatDisk extends FormattedDisk {
/**
* Return the amount of free space in bytes.
* @see com.webcodepro.applecommander.storage.Disk#getFreeSpace()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getFreeSpace()
*/
public int getFreeSpace() {
return getFreeBlocks() * BLOCK_SIZE;
@ -316,7 +320,7 @@ public class ProdosFormatDisk extends FormattedDisk {
/**
* Return the amount of used space in bytes.
* @see com.webcodepro.applecommander.storage.Disk#getUsedSpace()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getUsedSpace()
*/
public int getUsedSpace() {
return getUsedBlocks() * BLOCK_SIZE;
@ -350,10 +354,10 @@ public class ProdosFormatDisk extends FormattedDisk {
/**
* Return the name of the disk.
* @see com.webcodepro.applecommander.storage.Disk#getDiskName()
* @see com.webcodepro.applecommander.storage.FormattedDisk#getDiskName()
*/
public String getDiskName() {
return "/" + volumeHeader.getVolumeName() + "/";
return "/" + volumeHeader.getVolumeName() + "/"; //$NON-NLS-1$ //$NON-NLS-2$
}
/**
@ -389,7 +393,7 @@ public class ProdosFormatDisk extends FormattedDisk {
* Get the labels to use in the bitmap.
*/
public String[] getBitmapLabels() {
return new String[] { "Block" };
return new String[] { textBundle.get("Block") }; //$NON-NLS-1$
}
/**
@ -397,23 +401,26 @@ public class ProdosFormatDisk extends FormattedDisk {
*/
public List getDiskInformation() {
List list = super.getDiskInformation();
list.add(new DiskInformation("Total Blocks", volumeHeader.getTotalBlocks()));
list.add(new DiskInformation("Free Blocks", getFreeBlocks()));
list.add(new DiskInformation("Used Blocks", getUsedBlocks()));
list.add(new DiskInformation("Volume Access",
(volumeHeader.canDestroy() ? "Destroy " : "") +
(volumeHeader.canRead() ? "Read " : "") +
(volumeHeader.canRename() ? "Rename " : "") +
(volumeHeader.canWrite() ? "Write" : "")));
list.add(new DiskInformation("Block Number of Bitmap", volumeHeader.getBitMapPointer()));
list.add(new DiskInformation("Creation Date", volumeHeader.getCreationDate()));
list.add(new DiskInformation("File Entries Per Block", volumeHeader.getEntriesPerBlock()));
list.add(new DiskInformation("File Entry Length (bytes)", volumeHeader.getEntryLength()));
list.add(new DiskInformation("Active Files in Root Directory", volumeHeader.getFileCount()));
list.add(new DiskInformation("Minimum ProDOS Version Required",
list.add(new DiskInformation(textBundle.get("TotalBlocks"), //$NON-NLS-1$
volumeHeader.getTotalBlocks()));
list.add(new DiskInformation(textBundle.get("FreeBlocks"), //$NON-NLS-1$
getFreeBlocks()));
list.add(new DiskInformation(textBundle.get("UsedBlocks"), //$NON-NLS-1$
getUsedBlocks()));
list.add(new DiskInformation(textBundle.get("ProdosFormatDisk.VolumeAccess"), //$NON-NLS-1$
(volumeHeader.canDestroy() ? textBundle.get("Destroy") : "") + //$NON-NLS-1$//$NON-NLS-2$
(volumeHeader.canRead() ? textBundle.get("Read") : "") + //$NON-NLS-1$//$NON-NLS-2$
(volumeHeader.canRename() ? textBundle.get("Rename") : "") + //$NON-NLS-1$//$NON-NLS-2$
(volumeHeader.canWrite() ? textBundle.get("Write") : ""))); //$NON-NLS-1$//$NON-NLS-2$
list.add(new DiskInformation(textBundle.get("ProdosFormatDisk.BitmapBlockNumber"), volumeHeader.getBitMapPointer())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("ProdosFormatDisk.CreationDate"), volumeHeader.getCreationDate())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("ProdosFormatDisk.FileEntriesPerBlock"), volumeHeader.getEntriesPerBlock())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("ProdosFormatDisk.FileEntryLength"), volumeHeader.getEntryLength())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("ProdosFormatDisk.ActiveFilesInRootDirectory"), volumeHeader.getFileCount())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("ProdosFormatDisk.MinimumVersionProdos"), //$NON-NLS-1$
volumeHeader.getMinimumProdosVersion()));
list.add(new DiskInformation("Volume Created By ProDOS Version", volumeHeader.getProdosVersion()));
list.add(new DiskInformation("Volume Name", volumeHeader.getVolumeName()));
list.add(new DiskInformation(textBundle.get("ProdosFormatDisk.CreationVersionProdos"), volumeHeader.getProdosVersion())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("ProdosFormatDisk.VolumeName"), volumeHeader.getVolumeName())); //$NON-NLS-1$
return list;
}
@ -425,33 +432,46 @@ public class ProdosFormatDisk extends FormattedDisk {
List list = new ArrayList();
switch (displayMode) {
case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Name", 15, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Filetype", 8, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Blocks", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Modified", 10, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Created", 10, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Length", 10, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Aux. Type", 8, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Name"), 15, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(textBundle.get("Filetype"), 8, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle.get("Blocks"), 3, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("Modified"), 10, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(
textBundle.get("ProdosFormatDisk.Created"), 10, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(
textBundle.get("ProdosFormatDisk.Length"), 10, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(
textBundle.get("ProdosFormatDisk.AuxType"), 8, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
break;
case FILE_DISPLAY_DETAIL:
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Name", 15, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Deleted?", 7, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Permissions", 8, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Filetype", 8, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Directory?", 9, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Blocks", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Modified", 10, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Created", 10, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Length", 10, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Aux. Type", 8, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Dir. Header", 5, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Key Block", 5, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Key Type", 8, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Changed", 5, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Min. ProDOS Ver.", 2, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("ProDOS Ver.", 2, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(" ", 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Name"), 15, //$NON-NLS-1$
FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader(textBundle.get("DeletedQ"), 7, //$NON-NLS-1$
FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.Permissions"), 8, FileColumnHeader.ALIGN_LEFT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Filetype"), 8, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.DirectoryQ"), 9, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Blocks"), 3, //$NON-NLS-1$
FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("Modified"), 10, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.Created"), 10, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.Length"), 10, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.AuxType"), 8, FileColumnHeader.ALIGN_LEFT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.DirectoryHeader"), 5, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.KeyBlock"), 5, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.KeyType"), 8, FileColumnHeader.ALIGN_LEFT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.Changed"), 5, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.MinimumProdosVersion"), 2, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("ProdosFormatDisk.ProdosVersion"), 2, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
break;
default: // FILE_DISPLAY_STANDARD
list.addAll(super.getFileColumnHeaders(displayMode));
@ -476,7 +496,7 @@ public class ProdosFormatDisk extends FormattedDisk {
/**
* Identify if this disk format is capable of having directories.
* @see com.webcodepro.applecommander.storage.Disk#canHaveDirectories()
* @see com.webcodepro.applecommander.storage.FormattedDisk#canHaveDirectories()
*/
public boolean canHaveDirectories() {
return true;
@ -502,7 +522,7 @@ public class ProdosFormatDisk extends FormattedDisk {
*/
public byte[] getFileData(FileEntry fileEntry) {
if ( !(fileEntry instanceof ProdosFileEntry)) {
throw new IllegalArgumentException("Most have a ProDOS file entry!");
throw new IllegalArgumentException(textBundle.get("ProdosFormatDisk.MustHaveEntry")); //$NON-NLS-1$
}
ProdosFileEntry prodosEntry = (ProdosFileEntry) fileEntry;
byte[] fileData = new byte[prodosEntry.getEofPosition()];
@ -524,7 +544,7 @@ public class ProdosFormatDisk extends FormattedDisk {
}
}
} else {
throw new IllegalArgumentException("Unknown ProDOS storage type!");
throw new IllegalArgumentException(textBundle.get("ProdosFormatDisk.UnknownStorageType")); //$NON-NLS-1$
}
return fileData;
}
@ -565,7 +585,6 @@ public class ProdosFormatDisk extends FormattedDisk {
/**
* Read file data from the given index block.
* Note that block number 0 is an unused block.
* @see #getFileData()
*/
protected int getIndexBlockData(byte[] fileData, byte[] indexBlock, int offset) {
for (int i=0; i<0x100; i++) {
@ -576,10 +595,9 @@ public class ProdosFormatDisk extends FormattedDisk {
if (blockNumber != 0) System.arraycopy(blockData, 0, fileData, offset, bytesToCopy);
offset+= bytesToCopy;
break;
} else {
if (blockNumber != 0) System.arraycopy(blockData, 0, fileData, offset, blockData.length);
offset+= blockData.length;
}
if (blockNumber != 0) System.arraycopy(blockData, 0, fileData, offset, blockData.length);
offset+= blockData.length;
}
return offset;
}
@ -601,9 +619,9 @@ public class ProdosFormatDisk extends FormattedDisk {
}
}
if (numberOfBlocks > getFreeBlocks() + fileEntry.getBlocksUsed()) {
throw new DiskFullException("This file requires " + numberOfBlocks
+ " blocks but there are only " + getFreeBlocks() + " blocks"
+ " available on the disk.");
throw new DiskFullException(textBundle.
format("ProdosFormatDisk.NotEnoughSpaceOnDiskError", //$NON-NLS-1$
numberOfBlocks, getFreeBlocks()));
}
// free "old" data and just rewrite stuff...
freeBlocks(fileEntry);
@ -691,12 +709,12 @@ public class ProdosFormatDisk extends FormattedDisk {
return block;
}
throw new ProdosDiskSizeDoesNotMatchException(
"The ProDOS physical disk size does not match the formatted size.");
textBundle.get("ProdosFormatDisk.ProdosDiskSizeDoesNotMatchError")); //$NON-NLS-1$
}
block++;
}
throw new DiskFullException(
"Unable to locate a free block in the Volume Bitmap!");
textBundle.get("ProdosFormatDisk.NoFreeBlockAvailableError")); //$NON-NLS-1$
}
/**
@ -723,7 +741,7 @@ public class ProdosFormatDisk extends FormattedDisk {
int blocksToWrite = (volumeBitmapBlocks / 4096) + 1;
if (data.length != blocksToWrite * BLOCK_SIZE) {
throw new IllegalArgumentException(
"The ProDOS Volume Bit Map is not the correct size.");
textBundle.get("ProdosFormatDisk.UnexpectedVolumeBitMapSizeError")); //$NON-NLS-1$
}
byte[] dataBlock = new byte[BLOCK_SIZE];
for (int i=0; i<blocksToWrite; i++) {
@ -852,8 +870,8 @@ public class ProdosFormatDisk extends FormattedDisk {
* as to the filetype.
*/
public String getSuggestedFiletype(String filename) {
String filetype = "BIN";
int pos = filename.lastIndexOf(".");
String filetype = "BIN"; //$NON-NLS-1$
int pos = filename.lastIndexOf("."); //$NON-NLS-1$
if (pos > 0) {
String what = filename.substring(pos+1);
ProdosFileType type = findFileType(what);
@ -957,4 +975,8 @@ public class ProdosFormatDisk extends FormattedDisk {
public void setFileData(FileEntry fileEntry, byte[] fileData) throws DiskFullException {
setFileData((ProdosFileEntry)fileEntry, fileData);
}
protected ProdosVolumeDirectoryHeader getVolumeHeader() {
return volumeHeader;
}
}

View File

@ -32,7 +32,6 @@ public class ProdosSubdirectoryHeader extends ProdosCommonDirectoryHeader {
/**
* Constructor for ProdosSubdirectoryHeader.
* @param fileEntry
*/
public ProdosSubdirectoryHeader(ProdosFormatDisk disk, int block) {
super(disk, block);

View File

@ -31,7 +31,6 @@ public class ProdosVolumeDirectoryHeader extends ProdosCommonDirectoryHeader {
/**
* Constructor for ProdosVolumeDirectoryHeaderEntry.
* @param fileEntry
*/
public ProdosVolumeDirectoryHeader(ProdosFormatDisk disk) {
super(disk, 2);

View File

@ -27,12 +27,14 @@ import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FileFilter;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.filters.ApplesoftFileFilter;
import com.webcodepro.applecommander.storage.filters.BinaryFileFilter;
import com.webcodepro.applecommander.storage.filters.GraphicsFileFilter;
import com.webcodepro.applecommander.storage.filters.IntegerBasicFileFilter;
import com.webcodepro.applecommander.storage.filters.TextFileFilter;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Handle RDOS file entry format.
@ -54,6 +56,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class RdosFileEntry implements FileEntry {
private TextBundle textBundle = StorageBundle.getInstance();
private byte[] fileEntry;
private RdosFormatDisk disk;
@ -91,7 +94,7 @@ public class RdosFileEntry implements FileEntry {
* Return the name of this file.
*/
public String getFilename() {
return isDeleted() ? "<NOT IN USE> " : AppleUtil.getString(fileEntry, 0, 24);
return isDeleted() ? textBundle.get("RdosFileEntry.NotInUse") : AppleUtil.getString(fileEntry, 0, 24); //$NON-NLS-1$
}
/**
@ -112,7 +115,7 @@ public class RdosFileEntry implements FileEntry {
* Return the filetype of this file.
*/
public String getFiletype() {
return isDeleted() ? " " : AppleUtil.getString(fileEntry, 0x18, 1);
return isDeleted() ? " " : AppleUtil.getString(fileEntry, 0x18, 1); //$NON-NLS-1$
}
/**
@ -201,14 +204,14 @@ public class RdosFileEntry implements FileEntry {
list.add(numberFormat.format(getSize()));
numberFormat.setMinimumIntegerDigits(3);
list.add(numberFormat.format(getStartingBlock()));
list.add("$" + AppleUtil.getFormattedWord(getAddress()));
list.add(isDeleted() ? "Deleted" : "");
list.add("$" + AppleUtil.getFormattedWord(getAddress())); //$NON-NLS-1$
list.add(isDeleted() ? textBundle.get("Deleted") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
default: // FILE_DISPLAY_STANDARD
list.add(getFilename());
list.add(getFiletype());
list.add(numberFormat.format(getSize()));
list.add(isLocked() ? "Locked" : "");
list.add(isLocked() ? textBundle.get("Locked") : ""); //$NON-NLS-1$//$NON-NLS-2$
break;
}
return list;
@ -267,28 +270,28 @@ public class RdosFileEntry implements FileEntry {
* Determine if this is a text file.
*/
public boolean isTextFile() {
return "T".equals(getFiletype());
return "T".equals(getFiletype()); //$NON-NLS-1$
}
/**
* Determine if this is an Applesoft BASIC file.
*/
public boolean isApplesoftBasicFile() {
return "A".equals(getFiletype());
return "A".equals(getFiletype()); //$NON-NLS-1$
}
/**
* Determine if this is an Integer BASIC file.
*/
public boolean isIntegerBasicFile() {
return "I".equals(getFiletype());
return "I".equals(getFiletype()); //$NON-NLS-1$
}
/**
* Determine if this is a binary file.
*/
public boolean isBinaryFile() {
return "B".equals(getFiletype());
return "B".equals(getFiletype()); //$NON-NLS-1$
}
/**

View File

@ -27,8 +27,10 @@ import java.util.List;
import com.webcodepro.applecommander.storage.DiskFullException;
import com.webcodepro.applecommander.storage.FileEntry;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Manages a disk that is in the RDOS format.
@ -47,6 +49,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class RdosFormatDisk extends FormattedDisk {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* The RDOS disks are structured in a different order than DOS 3.3.
* This table interpolates between the RDOS ordering and the DOS
@ -69,7 +72,7 @@ public class RdosFormatDisk extends FormattedDisk {
/**
* The known filetypes for a RDOS disk.
*/
public static final String[] filetypes = { "B", "A", "T" };
public static final String[] filetypes = { "B", "A", "T" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
/**
* Use this inner interface for managing the disk usage data.
@ -123,8 +126,6 @@ public class RdosFormatDisk extends FormattedDisk {
/**
* Constructor for RdosFormatDisk.
* @param filename
* @param diskImage
*/
public RdosFormatDisk(String filename, ImageOrder imageOrder) {
super(filename, imageOrder);
@ -200,7 +201,7 @@ public class RdosFormatDisk extends FormattedDisk {
* Create a new FileEntry.
*/
public FileEntry createFile() throws DiskFullException {
throw new DiskFullException("Cannot create a file (yet).");
throw new DiskFullException(textBundle.get("FileCreationNotSupported")); //$NON-NLS-1$
}
/**
@ -226,7 +227,7 @@ public class RdosFormatDisk extends FormattedDisk {
* Identify the operating system format of this disk.
*/
public String getFormat() {
return "RDOS 2.1";
return textBundle.get("RdosFormatDisk.Rdos21"); //$NON-NLS-1$
}
/**
@ -289,7 +290,7 @@ public class RdosFormatDisk extends FormattedDisk {
* Get the labels to use in the bitmap.
*/
public String[] getBitmapLabels() {
return new String[] { "Block" };
return new String[] { textBundle.get("Block") }; //$NON-NLS-1$
}
/**
@ -297,9 +298,9 @@ public class RdosFormatDisk extends FormattedDisk {
*/
public List getDiskInformation() {
List list = super.getDiskInformation();
list.add(new DiskInformation("Total Blocks", BLOCKS_ON_DISK));
list.add(new DiskInformation("Free Blocks", getFreeBlocks()));
list.add(new DiskInformation("Used Blocks", getUsedBlocks()));
list.add(new DiskInformation(textBundle.get("TotalBlocks"), BLOCKS_ON_DISK)); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("FreeBlocks"), getFreeBlocks())); //$NON-NLS-1$
list.add(new DiskInformation(textBundle.get("UsedBlocks"), getUsedBlocks())); //$NON-NLS-1$
return list;
}
@ -311,20 +312,20 @@ public class RdosFormatDisk extends FormattedDisk {
List list = new ArrayList();
switch (displayMode) {
case FILE_DISPLAY_NATIVE:
list.add(new FileColumnHeader("Type", 1, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Blocks", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Name", 24, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Size", 6, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Starting Block", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader(textBundle.get("Type"), 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Blocks"), 3, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Name"), 24, FileColumnHeader.ALIGN_LEFT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("RdosFormatDisk.Size"), 6, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("RdosFormatDisk.StartingBlock"), 3, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
break;
case FILE_DISPLAY_DETAIL:
list.add(new FileColumnHeader("Type", 1, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader("Blocks", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Name", 24, FileColumnHeader.ALIGN_LEFT));
list.add(new FileColumnHeader("Size", 6, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Starting Block", 3, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Address", 5, FileColumnHeader.ALIGN_RIGHT));
list.add(new FileColumnHeader("Deleted?", 7, FileColumnHeader.ALIGN_CENTER));
list.add(new FileColumnHeader(textBundle.get("Type"), 1, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Blocks"), 3, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("Name"), 24, FileColumnHeader.ALIGN_LEFT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("RdosFormatDisk.Size"), 6, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("RdosFormatDisk.StartingBlock"), 3, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("RdosFormatDisk.Address"), 5, FileColumnHeader.ALIGN_RIGHT)); //$NON-NLS-1$
list.add(new FileColumnHeader(textBundle.get("DeletedQ"), 7, FileColumnHeader.ALIGN_CENTER)); //$NON-NLS-1$
break;
default: // FILE_DISPLAY_STANDARD
list.addAll(super.getFileColumnHeaders(displayMode));
@ -373,7 +374,7 @@ public class RdosFormatDisk extends FormattedDisk {
*/
public byte[] getFileData(FileEntry fileEntry) {
if ( !(fileEntry instanceof RdosFileEntry)) {
throw new IllegalArgumentException("Most have a RDOS file entry!");
throw new IllegalArgumentException(textBundle.get("RdosFormatDisk.IncorrectFileEntryError")); //$NON-NLS-1$
}
RdosFileEntry rdosEntry = (RdosFileEntry) fileEntry;
int startingBlock = rdosEntry.getStartingBlock();
@ -403,7 +404,7 @@ public class RdosFormatDisk extends FormattedDisk {
// minor hack - ensure that AppleCommander itself recognizes the
// RDOS disk!
byte[] block = readSector(0, 0x0d);
AppleUtil.setString(block, 0xe0, "RDOS FORMATTED BY APPLECOMMANDER", 0x20);
AppleUtil.setString(block, 0xe0, textBundle.get("RdosFormatDisk.IdentifierText"), 0x20); //$NON-NLS-1$
writeSector(0, 0x0d, block);
// a hack - until real code goes here.
block = new byte[256];
@ -412,8 +413,8 @@ public class RdosFormatDisk extends FormattedDisk {
// write the first directory entry
// FIXME - this should use FileEntry!
byte[] data = readRdosBlock(13);
AppleUtil.setString(data, 0x00, "RDOS 2.1 FORMAT NOBOOT", 0x18);
AppleUtil.setString(data, 0x18, "B", 0x01);
AppleUtil.setString(data, 0x00, textBundle.get("RdosFormatDisk.InitialSystemFile"), 0x18); //$NON-NLS-1$
AppleUtil.setString(data, 0x18, "B", 0x01); //$NON-NLS-1$
data[0x19] = 26;
AppleUtil.setWordValue(data, 0x1a, 0x1000);
AppleUtil.setWordValue(data, 0x1c, 6656);
@ -445,12 +446,12 @@ public class RdosFormatDisk extends FormattedDisk {
* as to the filetype.
*/
public String getSuggestedFiletype(String filename) {
String filetype = "B";
int pos = filename.lastIndexOf(".");
String filetype = "B"; //$NON-NLS-1$
int pos = filename.lastIndexOf("."); //$NON-NLS-1$
if (pos > 0) {
String what = filename.substring(pos+1);
if ("txt".equalsIgnoreCase(what)) {
filetype = "T";
if ("txt".equalsIgnoreCase(what)) { //$NON-NLS-1$
filetype = "T"; //$NON-NLS-1$
}
}
return filetype;
@ -470,7 +471,7 @@ public class RdosFormatDisk extends FormattedDisk {
* address.
*/
public boolean needsAddress(String filetype) {
return "B".equals(filetype);
return "B".equals(filetype); //$NON-NLS-1$
}
/**

View File

@ -20,6 +20,8 @@
package com.webcodepro.applecommander.storage.physical;
import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Supports disk images stored in DOS physical order.
@ -27,6 +29,7 @@ import com.webcodepro.applecommander.storage.Disk;
* @author Rob Greene (RobGreene@users.sourceforge.net)
*/
public class DosOrder extends ImageOrder {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* Construct a DosOrder.
*/
@ -73,16 +76,16 @@ public class DosOrder extends ImageOrder {
&& !isSizeApprox(Disk.APPLE_800KB_DISK)
&& !isSizeApprox(Disk.APPLE_800KB_2IMG_DISK)
&& track != 0 && sector != 0) { // HACK: Allows boot sector writing
throw new IllegalArgumentException("Unrecognized DOS format!");
throw new IllegalArgumentException(
textBundle.get("DosOrder.UnrecognizedFormatError")); //$NON-NLS-1$
}
int offset = (track * getSectorsPerTrack() + sector) * Disk.SECTOR_SIZE;
if (offset > getPhysicalSize()) {
throw new IllegalArgumentException(
"The track (" + track + ") and sector (" + sector
+ ") do not match the disk image size.");
} else {
return offset;
textBundle.format("DosOrder.InvalidSizeError", //$NON-NLS-1$
track, sector));
}
return offset;
}
/**

View File

@ -21,7 +21,9 @@ package com.webcodepro.applecommander.storage.physical;
import java.util.Arrays;
import com.webcodepro.applecommander.storage.StorageBundle;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Supports disk images stored in nibbilized DOS physical order.
@ -29,6 +31,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene (RobGreene@users.sourceforge.net)
*/
public class NibbleOrder extends DosOrder {
private TextBundle textBundle = StorageBundle.getInstance();
/**
* This is the 6 and 2 write translate table, as given in Beneath
* Apple DOS, pg 3-21.
@ -111,8 +114,8 @@ public class NibbleOrder extends DosOrder {
found = (t == track && s == sector);
}
if (!found) {
throw new IllegalArgumentException("Unable to locate physical sector "
+ sector + " on track " + track + "(#2)");
throw new IllegalArgumentException(textBundle
.format("NibbleOrder.InvalidPhysicalSectorError", sector, track, 1)); //$NON-NLS-1$
}
// 3. read data field that immediately follows the address field
byte[] dataField = new byte[349];
@ -218,8 +221,8 @@ public class NibbleOrder extends DosOrder {
while (!found && offset < trackData.length) {
int nextOffset = locateField(0xd5, 0xaa, 0x96, trackData, addressField, offset);
if (nextOffset < offset) { // we wrapped!
throw new IllegalArgumentException("Unable to locate physical sector "
+ sector + " on track " + track);
throw new IllegalArgumentException(textBundle
.format("NibbleOrder.InvalidPhysicalSectorError", sector, track, 2)); //$NON-NLS-1$
}
offset = nextOffset;
int t = decodeOddEven(addressField, 5);
@ -227,8 +230,8 @@ public class NibbleOrder extends DosOrder {
found = (t == track && s == sector);
}
if (!found) {
throw new IllegalArgumentException("Unable to locate physical sector "
+ sector + " on track " + track + "(#2)");
throw new IllegalArgumentException(textBundle
.format("NibbleOrder.InvalidPhysicalSectorError", sector, track, 2)); //$NON-NLS-1$
}
// 3. PRENIBBLE: This is Java translated from assembly @ $B800

View File

@ -22,6 +22,8 @@ package com.webcodepro.applecommander.ui;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Launch AppleCommander.
* This application attempts to identify which type of user-interface to
@ -39,7 +41,7 @@ import java.lang.reflect.Method;
*/
public class AppleCommander {
public static final String VERSION = "1.3.4pre"; //$NON-NLS-1$
private static TextBundle textBundle = TextBundle.getInstance();
private static TextBundle textBundle = UiBundle.getInstance();
/**
* Launch AppleCommander.
*/

View File

@ -73,7 +73,7 @@ public class UserPreferences {
public void save() {
try {
FileOutputStream outputStream = new FileOutputStream(FILENAME);
properties.store(outputStream, TextBundle.getInstance().
properties.store(outputStream, UiBundle.getInstance().
get("UserPreferencesComment")); //$NON-NLS-1$
outputStream.close();
} catch (Exception ignored) {

View File

@ -34,9 +34,10 @@ import com.webcodepro.applecommander.storage.os.prodos.ProdosFormatDisk;
import com.webcodepro.applecommander.storage.physical.ByteArrayImageLayout;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
import com.webcodepro.applecommander.util.TextBundle;
public class ac {
private static TextBundle textBundle = TextBundle.getInstance();
private static TextBundle textBundle = UiBundle.getInstance();
public static void main(String[] args) {
try {

View File

@ -94,7 +94,7 @@ import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.storage.physical.NibbleOrder;
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
import com.webcodepro.applecommander.ui.ImportSpecification;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.UserPreferences;
import com.webcodepro.applecommander.ui.swt.util.DropDownSelectionListener;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
@ -104,6 +104,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.exportfile.ExportWizard;
import com.webcodepro.applecommander.ui.swt.wizard.importfile.ImportWizard;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.StreamUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Build the Disk File tab for the Disk Window.
@ -146,7 +147,7 @@ public class DiskExplorerTab {
private Menu changeImageOrderMenu;
private UserPreferences userPreferences = UserPreferences.getInstance();
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private FileFilter fileFilter;
private GraphicsFileFilter graphicsFilter = new GraphicsFileFilter();
private AppleWorksWordProcessorFileFilter awpFilter = new AppleWorksWordProcessorFileFilter();
@ -591,7 +592,7 @@ public class DiskExplorerTab {
item = new MenuItem(menu, SWT.NONE);
item.setText(textBundle.get("ExportAsGraphicsMenuItem")); //$NON-NLS-1$
item.setEnabled(graphicsFilter.isCodecAvailable());
item.setEnabled(GraphicsFileFilter.isCodecAvailable());
item.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
setFileFilter(getGraphicsFilter());
@ -602,7 +603,7 @@ public class DiskExplorerTab {
// Add graphics mode
item = new MenuItem(menu, SWT.CASCADE);
item.setText(textBundle.get("ExportGraphicsModeMenuItem")); //$NON-NLS-1$
item.setEnabled(graphicsFilter.isCodecAvailable());
item.setEnabled(GraphicsFileFilter.isCodecAvailable());
subMenu = new Menu(shell, SWT.DROP_DOWN);
item.setMenu(subMenu);
subMenu.addMenuListener(new MenuAdapter() {
@ -694,11 +695,11 @@ public class DiskExplorerTab {
});
// Add graphics formats, if any are defined.
String[] formats = graphicsFilter.getFileExtensions();
String[] formats = GraphicsFileFilter.getFileExtensions();
if (formats != null && formats.length > 0) {
item = new MenuItem(menu, SWT.CASCADE);
item.setText(textBundle.get("ExportGraphicsFormatMenuItem")); //$NON-NLS-1$
item.setEnabled(graphicsFilter.isCodecAvailable());
item.setEnabled(GraphicsFileFilter.isCodecAvailable());
subMenu = new Menu(shell, SWT.DROP_DOWN);
item.setMenu(subMenu);
subMenu.addMenuListener(new MenuAdapter() {
@ -1255,7 +1256,7 @@ public class DiskExplorerTab {
});
printToolItem = new ToolItem(toolBar, SWT.PUSH);
printToolItem.setImage(imageManager.get(ImageManager.ICON_PRINT_FILE));
printToolItem.setText(textBundle.get("PrintDirectoryToolItem")); //$NON-NLS-1$
printToolItem.setText(textBundle.get("PrintButton")); //$NON-NLS-1$
printToolItem.setToolTipText(textBundle.get("PrintDirectoryHoverText")); //$NON-NLS-1$
printToolItem.setEnabled(true);
printToolItem.addSelectionListener(new SelectionAdapter () {
@ -1616,8 +1617,8 @@ public class DiskExplorerTab {
private Rectangle clientArea;
private GC gc;
private List fileHeaders;
private int[] columnWidths;
private int[] columnPosition;
private int[] printColumnWidths;
private int[] printColumnPosition;
private Font normalFont;
private Font headerFont;
private String filename;
@ -1677,13 +1678,13 @@ public class DiskExplorerTab {
header.getMaximumWidth() : header.getTitle().length();
totalWidth+= widths[i];
}
columnWidths = new int[fileHeaders.size()];
columnPosition = new int[fileHeaders.size()];
printColumnWidths = new int[fileHeaders.size()];
printColumnPosition = new int[fileHeaders.size()];
int position = clientArea.x;
for (int i=0; i<fileHeaders.size(); i++) {
columnWidths[i] = (widths[i] * clientArea.width) / totalWidth;
columnPosition[i] = position;
position+= columnWidths[i];
printColumnWidths[i] = (widths[i] * clientArea.width) / totalWidth;
printColumnPosition[i] = position;
position+= printColumnWidths[i];
}
}
protected void printFileHeaders() {
@ -1694,10 +1695,10 @@ public class DiskExplorerTab {
println(new String());
}
protected void print(int column, String text, int alignment) {
int x0 = columnPosition[column];
int x1 = (column+1 < columnPosition.length) ?
columnPosition[column+1] : clientArea.width;
int w = columnWidths[column];
int x0 = printColumnPosition[column];
int x1 = (column+1 < printColumnPosition.length) ?
printColumnPosition[column+1] : clientArea.width;
int w = printColumnWidths[column];
switch (alignment) {
case FileColumnHeader.ALIGN_LEFT:
x = x0;
@ -1734,7 +1735,7 @@ public class DiskExplorerTab {
y - dpiY + point.y);
}
protected void printFooter() {
TextBundle textBundle = TextBundle.getInstance();
TextBundle textBundle = UiBundle.getInstance();
String text = textBundle.format("PageNumberText", Integer.toString(page)); //$NON-NLS-1$
Point point = gc.stringExtent(text);
gc.drawString(text,

View File

@ -37,6 +37,8 @@ import org.eclipse.swt.widgets.TableItem;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.FormattedDisk.DiskInformation;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Build the Disk Info tab for the Disk Window.
@ -45,6 +47,7 @@ import com.webcodepro.applecommander.storage.FormattedDisk.DiskInformation;
* @author Rob Greene
*/
public class DiskInfoTab {
private TextBundle textBundle = UiBundle.getInstance();
private Table infoTable;
private Composite composite;
private FormattedDisk[] formattedDisks;
@ -55,12 +58,12 @@ public class DiskInfoTab {
this.formattedDisks = disks;
CTabItem ctabitem = new CTabItem(tabFolder, SWT.NULL);
ctabitem.setText("Disk Info");
ctabitem.setText(textBundle.get("DiskInfoTab.Title")); //$NON-NLS-1$
tabFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
infoTable.removeAll();
buildDiskInfoTable(formattedDisks[0]); // FIXME!
getInfoTable().removeAll();
buildDiskInfoTable(getFormattedDisk(0)); // FIXME!
}
});
@ -98,11 +101,11 @@ public class DiskInfoTab {
infoTable.setHeaderVisible(true);
TableColumn column = new TableColumn(infoTable, SWT.LEFT);
column.setResizable(true);
column.setText("Label");
column.setText(textBundle.get("DiskInfoTab.LabelHeader")); //$NON-NLS-1$
column.setWidth(200);
column = new TableColumn(infoTable, SWT.LEFT);
column.setResizable(true);
column.setText("Value");
column.setText(textBundle.get("DiskInfoTab.ValueHeader")); //$NON-NLS-1$
column.setWidth(400);
}
/**
@ -124,4 +127,10 @@ public class DiskInfoTab {
infoTable.dispose();
composite.dispose();
}
protected Table getInfoTable() {
return infoTable;
}
protected FormattedDisk getFormattedDisk(int diskNumber) {
return formattedDisks[diskNumber];
}
}

View File

@ -37,6 +37,8 @@ import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.FormattedDisk.DiskUsage;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Build the Disk Map tab for the Disk Window.
@ -46,6 +48,7 @@ import com.webcodepro.applecommander.storage.FormattedDisk.DiskUsage;
*/
public class DiskMapTab {
private FormattedDisk disk;
private TextBundle textBundle = UiBundle.getInstance();
// used locally - not shared between windows; hopefully will
// not be a resource drain!
private Color freeFill;
@ -72,9 +75,9 @@ public class DiskMapTab {
protected void createDiskMapTab(CTabFolder tabFolder) {
CTabItem item = new CTabItem(tabFolder, SWT.NULL);
if (disk.getLogicalDiskNumber() > 0) {
item.setText("Disk Map #" + disk.getLogicalDiskNumber());
item.setText(textBundle.get("DiskMapTab.MultipleTabsTitle") + disk.getLogicalDiskNumber()); //$NON-NLS-1$
} else {
item.setText("Disk Map");
item.setText(textBundle.get("DiskMapTab.SingleTabTitle")); //$NON-NLS-1$
}
Canvas canvas = new Canvas(tabFolder, SWT.NULL);
@ -91,19 +94,13 @@ public class DiskMapTab {
Label title = new Label(canvas, SWT.LEFT);
StringBuffer buf = new StringBuffer();
if (labels.length == 1) {
buf.append("This disk is organized by the ");
buf.append(labels[0].toLowerCase());
buf.append(". Therefore, no organization has been forced on the ");
buf.append(labels[0].toLowerCase());
buf.append(" layout.");
buf.append(textBundle.format("DiskMapTab.BlockDecriptiveLabel", //$NON-NLS-1$
labels[0].toLowerCase()));
} else {
buf.append("This disk is organized by ");
for (int i=0; i<labels.length; i++) {
if (i > 0) buf.append(" and ");
buf.append(labels[i].toLowerCase());
}
buf.append(", and this implies a rigid layout to the disk. ");
buf.append("This will be reflected in the disk map.");
buf.append(textBundle.format("DiskMapTab.TrackAndSectorDecriptiveLabel", //$NON-NLS-1$
new Object[] {
labels[0].toLowerCase(),
labels[1].toLowerCase() }));
}
title.setText(buf.toString());
title.setLayoutData(data);
@ -169,8 +166,9 @@ public class DiskMapTab {
/**
* Handle paint requests for horizontal ruler.
*/
private void paintHorizontalRuler(PaintEvent event) {
String label = (disk.getBitmapLabels()[0] + "s").toUpperCase();
protected void paintHorizontalRuler(PaintEvent event) {
// FIXME - not i18n safe!!
String label = (disk.getBitmapLabels()[0] + "s").toUpperCase(); //$NON-NLS-1$
Canvas canvas = (Canvas) event.widget;
Rectangle area = canvas.getClientArea();
event.gc.drawLine(area.x, area.y + area.height/2, area.x + area.width, area.y + area.height/2);
@ -180,14 +178,15 @@ public class DiskMapTab {
/**
* Handle paint requests for vertical ruler.
*/
private void paintVerticalRuler(PaintEvent event) {
String label = (disk.getBitmapLabels()[0] + "s").toUpperCase();
protected void paintVerticalRuler(PaintEvent event) {
// FIXME - not i18n safe!!
String label = (disk.getBitmapLabels()[0] + "s").toUpperCase(); //$NON-NLS-1$
if (disk.getBitmapLabels().length == 2) {
label = (disk.getBitmapLabels()[1] + "s").toUpperCase();
label = (disk.getBitmapLabels()[1] + "s").toUpperCase(); //$NON-NLS-1$
}
StringBuffer buf = new StringBuffer();
for (int i=0; i<label.length(); i++) {
if (i>0) buf.append("\n");
if (i>0) buf.append("\n"); //$NON-NLS-1$
buf.append(label.charAt(i));
}
label = buf.toString();
@ -200,7 +199,7 @@ public class DiskMapTab {
/**
* Handle paint requests for disk map.
*/
private void paintMap(PaintEvent event) {
protected void paintMap(PaintEvent event) {
if (disk.getDiskUsage() == null) {
paintNoMap(event);
} else if (disk.getBitmapDimensions() == null) {
@ -212,13 +211,13 @@ public class DiskMapTab {
/**
* Handle paint requests for legend.
*/
private void paintLegend(PaintEvent event) {
protected void paintLegend(PaintEvent event) {
Color background = event.gc.getBackground();
Canvas canvas = (Canvas) event.widget;
int height = event.gc.getFontMetrics().getHeight();
String freeText = " = Free";
String usedText = " = Used";
String freeText = textBundle.get("DiskMapTab.FreeLegend"); //$NON-NLS-1$
String usedText = textBundle.get("DiskMapTab.UsedLegend"); //$NON-NLS-1$
int padding = 50; // space between items
int totalWidth =
@ -240,13 +239,13 @@ public class DiskMapTab {
drawBox(box, event.gc, usedFill, black, gray);
offset+= height;
event.gc.setBackground(background);
event.gc.drawText(" = Used", offset, 0);
event.gc.drawText(usedText, offset, 0);
}
/**
* Display message to user regarding no disk map being available.
*/
private void paintNoMap(PaintEvent event) {
event.gc.drawString("A disk map is unavailable.", 0, 0);
event.gc.drawString(textBundle.get("DiskMapTab.DiskMapUnavailableMessage"), 0, 0); //$NON-NLS-1$
}
/**
* Paint a track/sector map.

View File

@ -27,6 +27,7 @@ import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Shell;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
/**
@ -44,7 +45,6 @@ public class DiskWindow {
private DiskInfoTab diskInfoTab;
private DiskMapTab[] diskMapTabs;
private DiskExplorerTab diskExplorerTab;
/**
* Construct the disk window.
@ -70,8 +70,7 @@ public class DiskWindow {
});
CTabFolder tabFolder = new CTabFolder(shell, SWT.BOTTOM);
diskExplorerTab = new DiskExplorerTab(tabFolder, disks,
imageManager, this);
new DiskExplorerTab(tabFolder, disks, imageManager, this);
diskMapTabs = new DiskMapTab[disks.length];
for (int i=0; i<disks.length; i++) {
if (disks[i].supportsDiskMap()) {
@ -90,13 +89,14 @@ public class DiskWindow {
* This is referenced in DiskWindow as well as DiskExplorerTab.
*/
public void setStandardWindowTitle() {
shell.setText("AppleCommander - " + disks[0].getFilename());
shell.setText(UiBundle.getInstance().format(
"DiskWindow.Title", disks[0].getFilename())); //$NON-NLS-1$
}
/**
* Dispose of all shared resources.
*/
private void dispose(DisposeEvent event) {
protected void dispose(DisposeEvent event) {
for (int i=0; i<diskMapTabs.length; i++) {
if (diskMapTabs[i] != null) diskMapTabs[i].dispose();
}

View File

@ -51,6 +51,7 @@ import com.webcodepro.applecommander.storage.filters.GraphicsFileFilter;
import com.webcodepro.applecommander.storage.filters.IntegerBasicFileFilter;
import com.webcodepro.applecommander.storage.filters.PascalTextFileFilter;
import com.webcodepro.applecommander.storage.filters.TextFileFilter;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.filteradapter.ApplesoftFilterAdapter;
import com.webcodepro.applecommander.ui.swt.filteradapter.FilterAdapter;
import com.webcodepro.applecommander.ui.swt.filteradapter.GraphicsFilterAdapter;
@ -60,6 +61,7 @@ import com.webcodepro.applecommander.ui.swt.filteradapter.TextFilterAdapter;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
import com.webcodepro.applecommander.ui.swt.util.SwtUtil;
import com.webcodepro.applecommander.ui.swt.util.contentadapter.ContentTypeAdapter;
import com.webcodepro.applecommander.util.TextBundle;
/**
* View a particular files content.
@ -71,6 +73,8 @@ public class FileViewerWindow {
private static final char CTRL_A = 'A' - '@';
private static final char CTRL_P = 'P' - '@';
private static final char CTRL_C = 'C' - '@';
private TextBundle textBundle = UiBundle.getInstance();
private Shell parentShell;
private ImageManager imageManager;
@ -84,7 +88,6 @@ public class FileViewerWindow {
private ToolItem nativeToolItem;
private ToolItem hexDumpToolItem;
private ToolItem rawDumpToolItem;
private ToolItem printToolItem;
private ToolItem copyToolItem;
private Font courier;
@ -124,7 +127,8 @@ public class FileViewerWindow {
shell = new Shell(parentShell, SWT.SHELL_TRIM);
shell.setLayout(new FillLayout());
shell.setImage(imageManager.get(ImageManager.ICON_DISK));
shell.setText("File Viewer - " + fileEntry.getFilename());
shell.setText(textBundle.format("FileViewerWindow.Title", //$NON-NLS-1$
fileEntry.getFilename()));
shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
dispose(event);
@ -143,7 +147,7 @@ public class FileViewerWindow {
content.setLayoutData(gridData);
content.addListener(SWT.KeyUp, createToolbarCommandHandler());
courier = new Font(shell.getDisplay(), "Courier", 10, SWT.NORMAL);
courier = new Font(shell.getDisplay(), "Courier", 10, SWT.NORMAL); //$NON-NLS-1$
black = new Color(shell.getDisplay(), 0, 0, 0);
blue = new Color(shell.getDisplay(), 0, 0, 192);
green = new Color(shell.getDisplay(), 0, 192, 0);
@ -161,48 +165,48 @@ public class FileViewerWindow {
nativeFilterAdapterMap = new HashMap();
nativeFilterAdapterMap.put(ApplesoftFileFilter.class,
new ApplesoftFilterAdapter(this, "Applesoft",
"Displays file as an Applesoft BASIC program (F2)",
new ApplesoftFilterAdapter(this, textBundle.get("FileViewerWindow.ApplesoftButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.ApplesoftTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_AS_BASIC_PROGRAM)
));
nativeFilterAdapterMap.put(AppleWorksDataBaseFileFilter.class,
new TextFilterAdapter(this, "Database",
"Displays file as a database file (F2)",
new TextFilterAdapter(this, textBundle.get("FileViewerWindow.DatabaseButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.DatabaseTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_AS_DATABASE)
));
nativeFilterAdapterMap.put(AppleWorksSpreadSheetFileFilter.class,
new TextFilterAdapter(this, "Spreadsheet",
"Displays file as a spreadsheet file (F2)",
new TextFilterAdapter(this, textBundle.get("FileViewerWindow.SpreadsheetButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.SpreadsheetTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_AS_SPREADSHEET)
));
nativeFilterAdapterMap.put(AppleWorksWordProcessorFileFilter.class,
new TextFilterAdapter(this, "Wordprocessor",
"Displays file as a wordprocessor file (F2)",
new TextFilterAdapter(this, textBundle.get("FileViewerWindow.WordprocessorButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.WordprocessorTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_AS_WORDPROCESSOR)
));
nativeFilterAdapterMap.put(AssemblySourceFileFilter.class,
new TextFilterAdapter(this, "Assembly",
"Displays file as assembly source file (F2)",
new TextFilterAdapter(this, textBundle.get("FileViewerWindow.AssemblyButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.AssemblyTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_AS_TEXTFILE)
));
nativeFilterAdapterMap.put(GraphicsFileFilter.class,
new GraphicsFilterAdapter(this, "Image",
"Displays file as an image (F2)",
new GraphicsFilterAdapter(this, textBundle.get("FileViewerWindow.ImageButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.ImageTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_AS_IMAGE)
));
nativeFilterAdapterMap.put(IntegerBasicFileFilter.class,
new TextFilterAdapter(this, "Integer BASIC",
"Displays file as an Integer BASIC program (F2)",
new TextFilterAdapter(this, textBundle.get("FileViewerWindow.IntegerBasicButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.IntegerBasicTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_AS_BASIC_PROGRAM)
));
nativeFilterAdapterMap.put(PascalTextFileFilter.class,
new TextFilterAdapter(this, "Pascal Text",
"Displays file as Pascal text file (F2)",
new TextFilterAdapter(this, textBundle.get("FileViewerWindow.PascalTextButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.PascalTextTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_AS_TEXTFILE)
));
nativeFilterAdapterMap.put(TextFileFilter.class,
new TextFilterAdapter(this, "Text",
"Displays file as a text file (F2)",
new TextFilterAdapter(this, textBundle.get("FileViewerWindow.TextButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.TextTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_AS_TEXTFILE)
));
}
@ -210,7 +214,7 @@ public class FileViewerWindow {
/**
* Dispose of all shared resources.
*/
private void dispose(DisposeEvent event) {
protected void dispose(DisposeEvent event) {
courier.dispose();
black.dispose();
blue.dispose();
@ -247,7 +251,7 @@ public class FileViewerWindow {
new ToolItem(toolBar, SWT.SEPARATOR);
copyToolItem = createCopyToolItem();
new ToolItem(toolBar, SWT.SEPARATOR);
printToolItem = createPrintToolItem();
createPrintToolItem();
toolBar.pack();
}
@ -255,8 +259,8 @@ public class FileViewerWindow {
* Create the hex dump tool item (button).
*/
protected ToolItem createHexDumpToolItem() {
hexFilterAdapter = new HexFilterAdapter(this, "Hex Dump",
"Displays file as a hex dump (F3)",
hexFilterAdapter = new HexFilterAdapter(this, textBundle.get("FileViewerWindow.HexDumpButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.HexDumpTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_IN_HEX));
hexFilterAdapter.setHexSelected();
ToolItem toolItem = hexFilterAdapter.create(toolBar);
@ -267,8 +271,8 @@ public class FileViewerWindow {
* Create the raw dump tool item (button).
*/
protected ToolItem createRawDumpToolItem() {
rawDumpFilterAdapter = new RawDumpFilterAdapter(this, "Raw Dump",
"Displays file as a raw hex dump (F4)",
rawDumpFilterAdapter = new RawDumpFilterAdapter(this, textBundle.get("FileViewerWindow.RawDumpButton"), //$NON-NLS-1$
textBundle.get("FileViewerWindow.RawDumpTooltip"), //$NON-NLS-1$
imageManager.get(ImageManager.ICON_VIEW_IN_RAW_HEX));
rawDumpFilterAdapter.setDumpSelected();
ToolItem toolItem = rawDumpFilterAdapter.create(toolBar);
@ -281,12 +285,12 @@ public class FileViewerWindow {
protected ToolItem createCopyToolItem() {
ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
toolItem.setImage(imageManager.get(ImageManager.ICON_COPY));
toolItem.setText("Copy");
toolItem.setToolTipText("Copies selection to the clipboard (CTRL+C)");
toolItem.setText(textBundle.get("FileViewerWindow.CopyButton")); //$NON-NLS-1$
toolItem.setToolTipText(textBundle.get("FileViewerWindow.CopyTooltip")); //$NON-NLS-1$
toolItem.setEnabled(true);
toolItem.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
contentTypeAdapter.copy();
getContentTypeAdapter().copy();
}
});
return toolItem;
@ -298,12 +302,12 @@ public class FileViewerWindow {
protected ToolItem createPrintToolItem() {
ToolItem toolItem = new ToolItem(toolBar, SWT.PUSH);
toolItem.setImage(imageManager.get(ImageManager.ICON_PRINT_FILE));
toolItem.setText("Print");
toolItem.setToolTipText("Print contents... (CTRL+P)");
toolItem.setText(textBundle.get("PrintButton")); //$NON-NLS-1$
toolItem.setToolTipText(textBundle.get("FileViewerWindow.PrintTooltip")); //$NON-NLS-1$
toolItem.setEnabled(true);
toolItem.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
contentTypeAdapter.print();
getContentTypeAdapter().print();
}
});
return toolItem;
@ -321,27 +325,27 @@ public class FileViewerWindow {
if ((event.stateMask & SWT.CTRL) != 0) { // CTRL+key
switch (event.character) {
case CTRL_C:
contentTypeAdapter.copy();
getContentTypeAdapter().copy();
break;
case CTRL_A:
contentTypeAdapter.selectAll();
getContentTypeAdapter().selectAll();
break;
case CTRL_P:
contentTypeAdapter.print();
getContentTypeAdapter().print();
break;
}
} else if ((event.stateMask & SWT.ALT) == 0) { // key alone
switch (event.keyCode) {
case SWT.F2: // the "native" file format (image, text, etc)
nativeFilterAdapter.display();
getNativeFilterAdapter().display();
setFilterToolItemSelection(true, false, false);
break;
case SWT.F3: // Hex format
hexFilterAdapter.display();
getHexFilterAdapter().display();
setFilterToolItemSelection(false, true, false);
break;
case SWT.F4: // "Raw" hex format
rawDumpFilterAdapter.display();
getRawDumpFilterAdapter().display();
setFilterToolItemSelection(false, false, true);
break;
}
@ -383,4 +387,16 @@ public class FileViewerWindow {
hexDumpToolItem.setSelection(hexSelected);
rawDumpToolItem.setSelection(dumpSelected);
}
protected ContentTypeAdapter getContentTypeAdapter() {
return contentTypeAdapter;
}
protected FilterAdapter getHexFilterAdapter() {
return hexFilterAdapter;
}
protected FilterAdapter getNativeFilterAdapter() {
return nativeFilterAdapter;
}
protected FilterAdapter getRawDumpFilterAdapter() {
return rawDumpFilterAdapter;
}
}

View File

@ -40,12 +40,13 @@ import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.Disk.FilenameFilter;
import com.webcodepro.applecommander.ui.AppleCommander;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.UserPreferences;
import com.webcodepro.applecommander.ui.swt.util.ImageCanvas;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
import com.webcodepro.applecommander.ui.swt.wizard.comparedisks.CompareDisksWizard;
import com.webcodepro.applecommander.ui.swt.wizard.diskimage.DiskImageWizard;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Main class for the SwtAppleCommander interface.
@ -54,11 +55,10 @@ import com.webcodepro.applecommander.ui.swt.wizard.diskimage.DiskImageWizard;
* @author Rob Greene
*/
public class SwtAppleCommander implements Listener {
private Display display;
private Shell shell;
private ToolBar toolBar;
private UserPreferences userPreferences = UserPreferences.getInstance();
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private ImageCanvas imageCanvas;
private static ImageManager imageManager;
@ -104,11 +104,10 @@ public class SwtAppleCommander implements Listener {
/**
* Opens the main program.
*/
private Shell open(Display display) {
this.display = display;
Display.setAppName("AppleCommander");
protected Shell open(Display display) {
Display.setAppName(textBundle.get("SwtAppleCommander.AppleCommander")); //$NON-NLS-1$
shell = new Shell(display, SWT.BORDER | SWT.CLOSE | SWT.MIN | SWT.TITLE);
shell.setText("AppleCommander");
shell.setText(textBundle.get("SwtAppleCommander.AppleCommander")); //$NON-NLS-1$
shell.setImage(imageManager.get(ImageManager.ICON_DISK));
shell.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent event) {
@ -141,7 +140,7 @@ public class SwtAppleCommander implements Listener {
/**
* Dispose of all shared resources.
*/
private void dispose(DisposeEvent event) {
protected void dispose(DisposeEvent event) {
imageCanvas.dispose();
toolBar.dispose();
imageManager.dispose();
@ -150,7 +149,7 @@ public class SwtAppleCommander implements Listener {
/**
* Open a file.
*/
private void openFile() {
protected void openFile() {
FileDialog fileDialog = new FileDialog(shell, SWT.OPEN);
FilenameFilter[] fileFilters = Disk.getFilenameFilters();
String[] names = new String[fileFilters.length];
@ -186,23 +185,20 @@ public class SwtAppleCommander implements Listener {
* Displays the unrecognized disk format message.
* @param fullpath
*/
private void showUnrecognizedDiskFormatMessage(String fullpath) {
protected void showUnrecognizedDiskFormatMessage(String fullpath) {
Shell finalShell = shell;
MessageBox box = new MessageBox(finalShell, SWT.ICON_ERROR | SWT.OK);
box.setText("Unrecognized Disk Format");
box.setText(textBundle.get("SwtAppleCommander.UnrecognizedFormatTitle")); //$NON-NLS-1$
box.setMessage(
"Unable to load '" + fullpath + "'.\n\n"
+ "AppleCommander did not recognize the format\n"
+ "of the disk. Either this is a new format\n"
+ "or a protected disk.\n\n"
+ "Sorry!");
textBundle.format("SwtAppleCommander.UnrecognizedFormatMessage", //$NON-NLS-1$
fullpath));
box.open();
}
/**
* Create a disk image.
*/
private void createDiskImage() {
protected void createDiskImage() {
DiskImageWizard wizard = new DiskImageWizard(shell, imageManager);
wizard.open();
if (wizard.isWizardCompleted()) {
@ -221,9 +217,9 @@ public class SwtAppleCommander implements Listener {
ToolItem item = new ToolItem(toolBar, SWT.PUSH);
item.setImage(imageManager.get(ImageManager.ICON_OPEN_DISK_IMAGE));
item.setText("Open...");
item.setText(textBundle.get("OpenButton")); //$NON-NLS-1$
item.setSelection(false);
item.setToolTipText("Open a disk image (Ctrl+O)");
item.setToolTipText(textBundle.get("SwtAppleCommander.OpenDiskImageTooltip")); //$NON-NLS-1$
item.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
openFile();
@ -233,8 +229,8 @@ public class SwtAppleCommander implements Listener {
item = new ToolItem(toolBar, SWT.PUSH);
item.setImage(imageManager.get(ImageManager.ICON_NEW_DISK_IMAGE));
item.setText("Create...");
item.setToolTipText("Create a disk image (Ctrl+C)");
item.setText(textBundle.get("CreateButton")); //$NON-NLS-1$
item.setToolTipText(textBundle.get("SwtAppleCommander.CreateDiskImageTooltip")); //$NON-NLS-1$
item.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
createDiskImage();
@ -244,8 +240,8 @@ public class SwtAppleCommander implements Listener {
item = new ToolItem(toolBar, SWT.PUSH);
item.setImage(imageManager.get(ImageManager.ICON_COMPARE_DISKS));
item.setText("Compare...");
item.setToolTipText("Compare two disk images (Ctrl+E)");
item.setText(textBundle.get("CreateButton")); //$NON-NLS-1$
item.setToolTipText(textBundle.get("SwtAppleCommander.CompareDiskImageTooltip")); //$NON-NLS-1$
item.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
compareDiskImages();
@ -255,8 +251,8 @@ public class SwtAppleCommander implements Listener {
item = new ToolItem(toolBar, SWT.PUSH);
item.setImage(imageManager.get(ImageManager.ICON_ABOUT_APPLECOMMANDER));
item.setText("About");
item.setToolTipText("About AppleCommander (Ctrl+A)");
item.setText(textBundle.get("AboutButton")); //$NON-NLS-1$
item.setToolTipText(textBundle.get("SwtAppleCommander.AboutTooltip")); //$NON-NLS-1$
item.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
showAboutAppleCommander();
@ -270,15 +266,10 @@ public class SwtAppleCommander implements Listener {
public void showAboutAppleCommander() {
final Shell finalShell = shell;
MessageBox box = new MessageBox(finalShell, SWT.ICON_INFORMATION | SWT.OK);
box.setText("About AppleCommander");
box.setMessage(
"AppleCommander\n"
+ "Version " + AppleCommander.VERSION + "\n"
+ textBundle.get("Copyright") + "\n\n"
+ "AppleCommander was created for the express\n"
+ "purpose of assisting those-who-remember.\n\n"
+ "I wish you many hours of vintage pleasure!\n"
+ "-Rob");
box.setText(textBundle.get("SwtAppleCommander.AboutTitle")); //$NON-NLS-1$
box.setMessage(
textBundle.format("SwtAppleCommander.AboutMessage", //$NON-NLS-1$
new Object[] { AppleCommander.VERSION, textBundle.get("Copyright") })); //$NON-NLS-1$
box.open();
}

View File

@ -78,14 +78,14 @@ public class ApplesoftFilterAdapter extends FilterAdapter {
if (firstLine) {
firstLine = false;
} else {
styledText.append("\n");
styledText.append("\n"); //$NON-NLS-1$
}
styledText.append(Integer.toString(token.getLineNumber()));
styledText.append(" ");
styledText.append(" "); //$NON-NLS-1$
} else if (token.isCommandSeparator() || token.isExpressionSeparator()) {
styledText.append(token.getStringValue());
} else if (token.isEndOfCommand()) {
styledText.append("\n");
styledText.append("\n"); //$NON-NLS-1$
} else if (token.isString()) {
int caretOffset = styledText.getCharCount();
styledText.append(token.getStringValue());

View File

@ -63,6 +63,7 @@ public abstract class FilterAdapter {
public abstract void display();
public void dispose() {
// nothing to dispose
}
public ToolItem create(ToolBar toolBar) {
@ -75,7 +76,8 @@ public abstract class FilterAdapter {
toolItem.addSelectionListener(new SelectionAdapter () {
public void widgetSelected(SelectionEvent e) {
display();
window.setFilterToolItemSelection(nativeSelected, hexSelected, dumpSelected);
getWindow().setFilterToolItemSelection(
isNativeSelected(), isHexSelected(), isDumpSelected());
}
});
}
@ -139,4 +141,16 @@ public abstract class FilterAdapter {
hexSelected = false;
dumpSelected = false;
}
protected boolean isDumpSelected() {
return dumpSelected;
}
protected boolean isHexSelected() {
return hexSelected;
}
protected boolean isNativeSelected() {
return nativeSelected;
}
protected FileViewerWindow getWindow() {
return window;
}
}

View File

@ -29,6 +29,7 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.FileViewerWindow;
import com.webcodepro.applecommander.ui.swt.util.ImageCanvas;
import com.webcodepro.applecommander.ui.swt.util.contentadapter.ImageCanvasAdapter;
@ -77,7 +78,8 @@ public class GraphicsFilterAdapter extends FilterAdapter {
setContentTypeAdapter(new ImageCanvasAdapter(imageCanvas, getFileEntry().getFilename()));
} else {
Label label = new Label(getComposite(), SWT.NULL);
label.setText("Unexpected graphic file encountered!");
label.setText(UiBundle.getInstance().get(
"GraphicsFilterAdapter.BadImageMessage")); //$NON-NLS-1$
getComposite().setContent(label);
getComposite().setExpandHorizontal(true);
getComposite().setExpandVertical(true);

View File

@ -31,7 +31,8 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.util.TextBundle;
/**
* SWT-related utility code.
@ -40,7 +41,7 @@ import com.webcodepro.applecommander.ui.TextBundle;
* @author Rob Greene
*/
public class SwtUtil {
private static TextBundle textBundle = TextBundle.getInstance();
private static TextBundle textBundle = UiBundle.getInstance();
/**
* Center the child shell within the parent shell window.

View File

@ -33,16 +33,17 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.util.ImageCanvas;
import com.webcodepro.applecommander.ui.swt.util.SwtUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* A framework for displaying a wizard-like user interface.
* @author Rob Greene
*/
public abstract class Wizard {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private Shell parent;
private Shell dialog;
private Image logo;

View File

@ -26,9 +26,10 @@ import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Shows the result of the disk image comparison.
@ -36,7 +37,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class CompareDisksResultsPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private Composite parent;
private Object layoutData;
private Composite control;

View File

@ -33,8 +33,9 @@ import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Provides the wizard pane which gets the disks to compare.
@ -42,7 +43,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class CompareDisksStartPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private Composite parent;
private Object layoutData;
private Composite control;

View File

@ -21,7 +21,7 @@ package com.webcodepro.applecommander.ui.swt.wizard.comparedisks;
import org.eclipse.swt.widgets.Shell;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
@ -39,7 +39,7 @@ public class CompareDisksWizard extends Wizard {
*/
public CompareDisksWizard(Shell parent, ImageManager imageManager) {
super(parent, imageManager.get(ImageManager.LOGO_COMPARE_IMAGE_WIZARD),
TextBundle.getInstance().get("CompareDisksTitle")); //$NON-NLS-1$
UiBundle.getInstance().get("CompareDisksTitle")); //$NON-NLS-1$
}
/**
* Create the initial display used in the wizard.

View File

@ -33,8 +33,9 @@ import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Provides the wizard pane which gets the export filter.
@ -43,7 +44,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class CompileFileStartPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private Composite parent;
private Object layoutData;
private Composite control;
@ -99,7 +100,7 @@ public class CompileFileStartPane extends WizardPane {
DirectoryDialog directoryDialog = new DirectoryDialog(
getControl().getShell());
directoryDialog.setFilterPath(getDirectoryText().getText());
directoryDialog.setMessage(TextBundle.getInstance().
directoryDialog.setMessage(UiBundle.getInstance().
get("CompileFileDirectoryPrompt")); //$NON-NLS-1$
String directory = directoryDialog.open();
if (directory != null) {

View File

@ -22,7 +22,7 @@ package com.webcodepro.applecommander.ui.swt.wizard.compilefile;
import org.eclipse.swt.widgets.Shell;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
@ -41,7 +41,7 @@ public class CompileWizard extends Wizard {
*/
public CompileWizard(Shell parent, ImageManager imageManager, FormattedDisk disk) {
super(parent, imageManager.get(ImageManager.LOGO_COMPILE_WIZARD),
TextBundle.getInstance().get("CompileWizardTitle")); //$NON-NLS-1$
UiBundle.getInstance().get("CompileWizardTitle")); //$NON-NLS-1$
this.disk = disk;
}
/**

View File

@ -28,8 +28,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Allow the user to choose the which operating system to format the
@ -39,7 +40,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class DiskImageFormatPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private DiskImageWizard wizard;
private Composite control;
private Composite parent;

View File

@ -28,8 +28,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Allow the user to choose the names of the disk image, as well as the
@ -39,7 +40,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class DiskImageNamePane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private DiskImageWizard wizard;
private Composite control;
private Composite parent;

View File

@ -28,8 +28,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Allow the user to choose the order of the disk image, as well as
@ -39,7 +40,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class DiskImageOrderPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private DiskImageWizard wizard;
private Composite control;
private Composite parent;

View File

@ -28,8 +28,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Allow the user to choose the size of the disk image, as appropriate.
@ -38,7 +39,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class DiskImageSizePane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private DiskImageWizard wizard;
private Composite control;
private Composite parent;

View File

@ -35,7 +35,7 @@ import com.webcodepro.applecommander.storage.physical.DosOrder;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.storage.physical.NibbleOrder;
import com.webcodepro.applecommander.storage.physical.ProdosOrder;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
@ -68,7 +68,7 @@ public class DiskImageWizard extends Wizard {
*/
public DiskImageWizard(Shell parent, ImageManager imageManager) {
super(parent, imageManager.get(ImageManager.LOGO_DISK_IMAGE_WIZARD),
TextBundle.getInstance().get("DiskImageWizardTitle")); //$NON-NLS-1$
UiBundle.getInstance().get("DiskImageWizardTitle")); //$NON-NLS-1$
}
/**
* Create the initial display used in the wizard.

View File

@ -28,8 +28,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.filters.AppleWorksWordProcessorFileFilter;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Choose format for AppleWorks Word Processor export.
@ -38,7 +39,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class AppleWorksWordProcessorPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private Composite parent;
private Object layoutData;
private Composite control;

View File

@ -34,8 +34,9 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Set locations and file names for the export.
@ -44,7 +45,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class ExportFileDestinationPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private Composite parent;
private Object layoutData;
private Composite control;
@ -106,7 +107,7 @@ public class ExportFileDestinationPane extends WizardPane {
DirectoryDialog directoryDialog = new DirectoryDialog(getShell());
directoryDialog.setFilterPath(getDirectoryText().getText());
directoryDialog.setMessage(
TextBundle.getInstance().get("ExportFileDirectoryPrompt")); //$NON-NLS-1$
UiBundle.getInstance().get("ExportFileDirectoryPrompt")); //$NON-NLS-1$
String directory = directoryDialog.open();
if (directory != null) {
getDirectoryText().setText(directory);

View File

@ -38,8 +38,9 @@ import com.webcodepro.applecommander.storage.filters.HexDumpFileFilter;
import com.webcodepro.applecommander.storage.filters.IntegerBasicFileFilter;
import com.webcodepro.applecommander.storage.filters.PascalTextFileFilter;
import com.webcodepro.applecommander.storage.filters.TextFileFilter;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Provides the wizard pane which gets the export filter.
@ -48,7 +49,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class ExportFileStartPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private Composite parent;
private Object layoutData;
private Composite control;

View File

@ -28,8 +28,9 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.filters.GraphicsFileFilter;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Choose graphics options for file export.
@ -38,7 +39,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene
*/
public class ExportGraphicsTypePane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private Composite parent;
private Object layoutData;
private Composite control;

View File

@ -23,7 +23,7 @@ import org.eclipse.swt.widgets.Shell;
import com.webcodepro.applecommander.storage.FileFilter;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
@ -43,7 +43,7 @@ public class ExportWizard extends Wizard {
*/
public ExportWizard(Shell parent, ImageManager imageManager, FormattedDisk disk) {
super(parent, imageManager.get(ImageManager.LOGO_EXPORT_WIZARD),
TextBundle.getInstance().get("ExportWizardTitle")); //$NON-NLS-1$
UiBundle.getInstance().get("ExportWizardTitle")); //$NON-NLS-1$
this.disk = disk;
}
/**

View File

@ -23,11 +23,12 @@ import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
import com.webcodepro.applecommander.ui.ImportSpecification;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.UserPreferences;
import com.webcodepro.applecommander.ui.swt.util.SwtUtil;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
import com.webcodepro.applecommander.util.AppleUtil;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Allow the used to choose the files to import into the disk image.
@ -36,7 +37,7 @@ import com.webcodepro.applecommander.util.AppleUtil;
* @author Rob Greene
*/
public class ImportSelectFilesWizardPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private TextBundle textBundle = UiBundle.getInstance();
private ImportWizard wizard;
private Composite control;
private Composite parent;

View File

@ -26,7 +26,7 @@ import org.eclipse.swt.widgets.Shell;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.ui.ImportSpecification;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.UiBundle;
import com.webcodepro.applecommander.ui.swt.util.ImageManager;
import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
@ -45,7 +45,7 @@ public class ImportWizard extends Wizard {
*/
public ImportWizard(Shell parent, ImageManager imageManager, FormattedDisk disk) {
super(parent, imageManager.get(ImageManager.LOGO_IMPORT_WIZARD),
TextBundle.getInstance().get("ImportWizardTitle")); //$NON-NLS-1$
UiBundle.getInstance().get("ImportWizardTitle")); //$NON-NLS-1$
this.disk = disk;
}
/**

View File

@ -29,7 +29,6 @@ import java.util.GregorianCalendar;
import com.webcodepro.applecommander.storage.FormattedDisk;
import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.ui.TextBundle;
/**
* This class contains helper methods for dealing with Apple2 data.
@ -540,8 +539,8 @@ public class AppleUtil {
public static String getHexDump(byte[] bytes) {
ByteArrayOutputStream output = new ByteArrayOutputStream();
PrintWriter printer = new PrintWriter(output);
printer.println(textBundle.get("HexDumpLine1")); //$NON-NLS-1$
printer.println(textBundle.get("HexDumpLine2")); //$NON-NLS-1$
printer.println(textBundle.get("AppleUtil.HexDumpLine1")); //$NON-NLS-1$
printer.println(textBundle.get("AppleUtil.HexDumpLine2")); //$NON-NLS-1$
for (int offset=0; offset<bytes.length; offset+= BYTES_PER_LINE) {
printer.print("$"); //$NON-NLS-1$
printer.print(AppleUtil.getFormatted3ByteAddress(offset));
@ -570,7 +569,7 @@ public class AppleUtil {
}
printer.println();
}
printer.println(textBundle.get("HexDumpEndMessage")); //$NON-NLS-1$
printer.println(textBundle.get("AppleUtil.HexDumpEndMessage")); //$NON-NLS-1$
printer.flush();
printer.close();
return output.toString();
@ -581,7 +580,8 @@ public class AppleUtil {
*/
public static void changeImageOrderByTrackAndSector(ImageOrder sourceOrder, ImageOrder targetOrder) {
if (!sameSectorsPerDisk(sourceOrder, targetOrder)) {
throw new IllegalArgumentException(textBundle.get("CannotChangeImageOrder")); //$NON-NLS-1$
throw new IllegalArgumentException(textBundle.
get("AppleUtil.CannotChangeImageOrder")); //$NON-NLS-1$
}
for (int track = 0; track < sourceOrder.getTracksPerDisk(); track++) {
for (int sector = 0; sector < sourceOrder.getSectorsPerTrack(); sector++) {
@ -605,7 +605,8 @@ public class AppleUtil {
ImageOrder sourceOrder = sourceDisk.getImageOrder();
ImageOrder targetOrder = targetDisk.getImageOrder();
if (!sameSectorsPerDisk(sourceOrder, targetOrder)) {
throw new IllegalArgumentException(textBundle.get("CannotCompareDisks")); //$NON-NLS-1$
throw new IllegalArgumentException(textBundle.
get("AppleUtil.CannotCompareDisks")); //$NON-NLS-1$
}
for (int track = 0; track < sourceOrder.getTracksPerDisk(); track++) {
for (int sector = 0; sector < sourceOrder.getSectorsPerTrack(); sector++) {
@ -624,7 +625,8 @@ public class AppleUtil {
*/
public static void changeImageOrderByBlock(ImageOrder sourceOrder, ImageOrder targetOrder) {
if (!sameBlocksPerDisk(sourceOrder, targetOrder)) {
throw new IllegalArgumentException(textBundle.get("CannotChangeImageOrder")); //$NON-NLS-1$
throw new IllegalArgumentException(textBundle.
get("AppleUtil.CannotChangeImageOrder")); //$NON-NLS-1$
}
for (int block = 0; block < sourceOrder.getBlocksOnDevice(); block++) {
byte[] blockData = sourceOrder.readBlock(block);
@ -646,7 +648,8 @@ public class AppleUtil {
ImageOrder sourceOrder = sourceDisk.getImageOrder();
ImageOrder targetOrder = targetDisk.getImageOrder();
if (!sameBlocksPerDisk(sourceOrder, targetOrder)) {
throw new IllegalArgumentException(textBundle.get("CannotCompareDisks")); //$NON-NLS-1$
throw new IllegalArgumentException(textBundle.
get("AppleUtil.CannotCompareDisks")); //$NON-NLS-1$
}
for (int block = 0; block < sourceOrder.getBlocksOnDevice(); block++) {
byte[] sourceData = sourceOrder.readBlock(block);