Preparing for internationalization as well as responding to the tighter

Eclipse 3.0 code checks.
This commit is contained in:
Robert Greene 2004-07-04 21:58:01 +00:00
parent 7503a1ce86
commit 991316badf
8 changed files with 123 additions and 98 deletions

View File

@ -48,7 +48,7 @@ public abstract class AppleImage {
*/ */
public static AppleImage create(int width, int height) { public static AppleImage create(int width, int height) {
String[] classes = { String[] classes = {
"ImageIoImage", "SunJpegImage", "SwtImage" }; "ImageIoImage", "SunJpegImage", "SwtImage" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
Class[] constructorArgClasses = new Class[] { Class[] constructorArgClasses = new Class[] {
int.class, int.class }; int.class, int.class };
Object[] constructorArgs = new Object[] { Object[] constructorArgs = new Object[] {
@ -56,7 +56,7 @@ public abstract class AppleImage {
for (int i=0; i<classes.length; i++) { for (int i=0; i<classes.length; i++) {
try { try {
Class appleImageClass = Class.forName( Class appleImageClass = Class.forName(
"com.webcodepro.applecommander.storage.filters.imagehandlers." "com.webcodepro.applecommander.storage.filters.imagehandlers." //$NON-NLS-1$
+ classes[i]); + classes[i]);
Constructor constructor = Constructor constructor =
appleImageClass.getConstructor(constructorArgClasses); appleImageClass.getConstructor(constructorArgClasses);

View File

@ -40,8 +40,10 @@ public class ImageIoImage extends AppleImage {
* as well as sets up the class. * as well as sets up the class.
*/ */
public ImageIoImage(int width, int height) throws ClassNotFoundException { public ImageIoImage(int width, int height) throws ClassNotFoundException {
super(new String[] { "PNG", "JPEG" }); // This lists all permutations of a format (ie, JPG, jpg, JPEG, jpeg, PNG, png):
Class.forName("javax.imageio.ImageIO"); // super(ImageIO.getWriterFormatNames());
super(new String[] { "PNG", "JPEG" }); //$NON-NLS-1$//$NON-NLS-2$
Class.forName("javax.imageio.ImageIO"); //$NON-NLS-1$
image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
} }
/** /**

View File

@ -40,8 +40,8 @@ public class SunJpegImage extends AppleImage {
* as well as sets up the class. * as well as sets up the class.
*/ */
public SunJpegImage(int width, int height) throws ClassNotFoundException { public SunJpegImage(int width, int height) throws ClassNotFoundException {
super(new String[] { "JPEG" }); super(new String[] { "JPEG" }); //$NON-NLS-1$
Class.forName("com.sun.image.codec.jpeg.JPEGCodec"); Class.forName("com.sun.image.codec.jpeg.JPEGCodec"); //$NON-NLS-1$
image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
} }
/** /**

View File

@ -27,7 +27,8 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.FormattedDisk; import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane; import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
/** /**
@ -38,6 +39,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene * @author Rob Greene
*/ */
public class DiskImageFormatPane extends WizardPane { public class DiskImageFormatPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private DiskImageWizard wizard; private DiskImageWizard wizard;
private Composite control; private Composite control;
private Composite parent; private Composite parent;
@ -60,15 +62,15 @@ public class DiskImageFormatPane extends WizardPane {
case DiskImageWizard.FORMAT_RDOS: case DiskImageWizard.FORMAT_RDOS:
case DiskImageWizard.FORMAT_CPM: case DiskImageWizard.FORMAT_CPM:
wizard.setOrder(DiskImageWizard.ORDER_DOS); wizard.setOrder(DiskImageWizard.ORDER_DOS);
wizard.setSize(FormattedDisk.APPLE_140KB_DISK); wizard.setSize(Disk.APPLE_140KB_DISK);
return new DiskImageNamePane(parent, wizard); return new DiskImageNamePane(parent, wizard);
case DiskImageWizard.FORMAT_UNIDOS: case DiskImageWizard.FORMAT_UNIDOS:
wizard.setOrder(DiskImageWizard.ORDER_DOS); wizard.setOrder(DiskImageWizard.ORDER_DOS);
wizard.setSize(FormattedDisk.APPLE_800KB_2IMG_DISK); wizard.setSize(Disk.APPLE_800KB_2IMG_DISK);
return new DiskImageNamePane(parent, wizard); return new DiskImageNamePane(parent, wizard);
case DiskImageWizard.FORMAT_OZDOS: case DiskImageWizard.FORMAT_OZDOS:
wizard.setOrder(DiskImageWizard.ORDER_PRODOS); wizard.setOrder(DiskImageWizard.ORDER_PRODOS);
wizard.setSize(FormattedDisk.APPLE_800KB_2IMG_DISK); wizard.setSize(Disk.APPLE_800KB_2IMG_DISK);
return new DiskImageNamePane(parent, wizard); return new DiskImageNamePane(parent, wizard);
case DiskImageWizard.FORMAT_PASCAL: case DiskImageWizard.FORMAT_PASCAL:
case DiskImageWizard.FORMAT_PRODOS: case DiskImageWizard.FORMAT_PRODOS:
@ -94,39 +96,33 @@ public class DiskImageFormatPane extends WizardPane {
control.setLayout(layout); control.setLayout(layout);
Label label = new Label(control, SWT.WRAP); Label label = new Label(control, SWT.WRAP);
label.setText( label.setText(
"Please choose the operating system with which to format\nthe disk image:"); textBundle.get("DiskImageFormatPrompt")); //$NON-NLS-1$
RowLayout subpanelLayout = new RowLayout(SWT.VERTICAL); RowLayout subpanelLayout = new RowLayout(SWT.VERTICAL);
subpanelLayout.justify = true; subpanelLayout.justify = true;
subpanelLayout.spacing = 3; subpanelLayout.spacing = 3;
Composite buttonSubpanel = new Composite(control, SWT.NULL); Composite buttonSubpanel = new Composite(control, SWT.NULL);
buttonSubpanel.setLayout(subpanelLayout); buttonSubpanel.setLayout(subpanelLayout);
createRadioButton(buttonSubpanel, "DOS 3.3", DiskImageWizard.FORMAT_DOS33, createRadioButton(buttonSubpanel, textBundle.get("Dos"), //$NON-NLS-1$
"This is Apple's DOS 3.3 format. The disk will automatically be\n" DiskImageWizard.FORMAT_DOS33,
+ "sized at 140K."); textBundle.get("DiskImageFormatDosTooltip")); //$NON-NLS-1$
createRadioButton(buttonSubpanel, "UniDOS", DiskImageWizard.FORMAT_UNIDOS, createRadioButton(buttonSubpanel, textBundle.get("Unidos"), //$NON-NLS-1$
"UniDOS was created to allow DOS 3.3 to operate with 800K disk\n" DiskImageWizard.FORMAT_UNIDOS,
+ "drives. The disk will default to 800K."); textBundle.get("DiskImageFormatUnidosTooltip")); //$NON-NLS-1$
createRadioButton(buttonSubpanel, "OzDOS", DiskImageWizard.FORMAT_OZDOS, createRadioButton(buttonSubpanel, textBundle.get("Ozdos"), //$NON-NLS-1$
"OzDOS was created to allow DOS 3.3 to operate with 800K disk\n" DiskImageWizard.FORMAT_OZDOS,
+ "drives. The disk will default to 800K."); textBundle.get("DiskImageFormatOzdosTooltip")); //$NON-NLS-1$
createRadioButton(buttonSubpanel, "ProDOS", DiskImageWizard.FORMAT_PRODOS, createRadioButton(buttonSubpanel, textBundle.get("Prodos"), //$NON-NLS-1$
"ProDOS was (is?) Apple's professional DOS for the Apple ][ series\n" DiskImageWizard.FORMAT_PRODOS,
+ "of computers. ProDOS allows subdirectories and can use devices\n" textBundle.get("DiskImageFormatProdosTooltip")); //$NON-NLS-1$
+ "up to 32MB in size. You will be presented with image sizing\n" createRadioButton(buttonSubpanel, textBundle.get("Pascal"), //$NON-NLS-1$
+ "options from the 140K disk to a 32MB hard disk."); DiskImageWizard.FORMAT_PASCAL,
createRadioButton(buttonSubpanel, "Pascal", DiskImageWizard.FORMAT_PASCAL, textBundle.get("DiskImageFormatPascalTooltip")); //$NON-NLS-1$
"Apple Pascal formatted disks are part of the Pascal environment.\n" createRadioButton(buttonSubpanel, textBundle.get("Rdos"), //$NON-NLS-1$
+ "Early implementations of Pascal only allowed 140K volumes, but\n" DiskImageWizard.FORMAT_RDOS,
+ "later versions allowed 800K volumes (and possibly more). You\n" textBundle.get("DiskImageFormatRdosTooltip")); //$NON-NLS-1$
+ "will be presented with options for 140K or 800K."); createRadioButton(buttonSubpanel, textBundle.get("Cpm"), //$NON-NLS-1$
createRadioButton(buttonSubpanel, "RDOS 2.1", DiskImageWizard.FORMAT_RDOS, DiskImageWizard.FORMAT_CPM,
"RDOS was created by (or for) SSI to protected their games. The\n" textBundle.get("DiskImageFormatCpmTooltip")); //$NON-NLS-1$
+ "original format appears to be a 13 sector disk. Most disk images\n"
+ "that I've seen have been mapped onto a 16 sector disk (leaving 3\n"
+ "sectors of each track unused. The only image size RDOS supports\n"
+ "is 140K.");
createRadioButton(buttonSubpanel, "CP/M", DiskImageWizard.FORMAT_CPM,
"CP/M for the Apple computer.");
control.pack(); control.pack();
} }
/** /**
@ -141,7 +137,7 @@ public class DiskImageFormatPane extends WizardPane {
button.setToolTipText(helpText); button.setToolTipText(helpText);
button.addSelectionListener(new SelectionAdapter() { button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
wizard.setFormat(format); getWizard().setFormat(format);
} }
}); });
} }
@ -151,4 +147,8 @@ public class DiskImageFormatPane extends WizardPane {
public void dispose() { public void dispose() {
control.dispose(); control.dispose();
} }
protected DiskImageWizard getWizard() {
return wizard;
}
} }

View File

@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.Text;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane; import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
/** /**
@ -38,6 +39,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene * @author Rob Greene
*/ */
public class DiskImageNamePane extends WizardPane { public class DiskImageNamePane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private DiskImageWizard wizard; private DiskImageWizard wizard;
private Composite control; private Composite control;
private Composite parent; private Composite parent;
@ -51,14 +53,14 @@ public class DiskImageNamePane extends WizardPane {
} }
/** /**
* Get the next visible pane. * Get the next visible pane.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#getNextPane() * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#getNextPane()
*/ */
public WizardPane getNextPane() { public WizardPane getNextPane() {
return new DiskImageOrderPane(parent, wizard); return new DiskImageOrderPane(parent, wizard);
} }
/** /**
* Create the wizard pane. * Create the wizard pane.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#open() * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#open()
*/ */
public void open() { public void open() {
control = new Composite(parent, SWT.NULL); control = new Composite(parent, SWT.NULL);
@ -74,9 +76,7 @@ public class DiskImageNamePane extends WizardPane {
control.setLayout(layout); control.setLayout(layout);
Label label = new Label(control, SWT.WRAP); Label label = new Label(control, SWT.WRAP);
label.setText( label.setText(
"Please choose a name for your disk image.\n" textBundle.get("DiskImageNamePrompt")); //$NON-NLS-1$
+ "Do not enter any file extensions, as the wizard\n"
+ "will do that for you.");
final Text filename = new Text(control, SWT.BORDER); final Text filename = new Text(control, SWT.BORDER);
filename.setFocus(); filename.setFocus();
RowData rowData = new RowData(); RowData rowData = new RowData();
@ -85,23 +85,25 @@ public class DiskImageNamePane extends WizardPane {
filename.setText(wizard.getFileName()); filename.setText(wizard.getFileName());
filename.addKeyListener(new KeyAdapter() { filename.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
wizard.setFileName(filename.getText()); getWizard().setFileName(filename.getText());
setButtonStatus(); setButtonStatus();
} }
}); });
if (wizard.isFormatProdos() || wizard.isFormatPascal()) { if (wizard.isFormatProdos() || wizard.isFormatPascal()) {
int maxLength = wizard.isFormatProdos() ? 15 : 7; int maxLength = wizard.isFormatProdos() ? 15 : 7;
label = new Label(control, SWT.WRAP); label = new Label(control, SWT.WRAP);
label.setText( Object[] objects = new Object[2];
(wizard.isFormatProdos() ? "ProDOS" : "Pascal") objects[0] = wizard.isFormatProdos() ? textBundle.get("Prodos") //$NON-NLS-1$
+ " requires a volume name.\nThe maximum length" : textBundle.get("Pascal"); //$NON-NLS-1$
+ " of the name is " + maxLength + " characters."); objects[1] = new Integer(maxLength);
label.setText(textBundle.format(
"DiskImageNameLengthText", objects)); //$NON-NLS-1$
final Text volumename = new Text(control, SWT.BORDER); final Text volumename = new Text(control, SWT.BORDER);
volumename.setText(wizard.getVolumeName()); volumename.setText(wizard.getVolumeName());
volumename.setTextLimit(maxLength); volumename.setTextLimit(maxLength);
volumename.addKeyListener(new KeyAdapter() { volumename.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent event) { public void keyPressed(KeyEvent event) {
wizard.setVolumeName(volumename.getText().toUpperCase()); getWizard().setVolumeName(volumename.getText().toUpperCase());
setButtonStatus(); setButtonStatus();
} }
}); });
@ -123,9 +125,13 @@ public class DiskImageNamePane extends WizardPane {
} }
/** /**
* Dispose of all resources. * Dispose of all resources.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#dispose() * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#dispose()
*/ */
public void dispose() { public void dispose() {
control.dispose(); control.dispose();
} }
protected DiskImageWizard getWizard() {
return wizard;
}
} }

View File

@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.Disk; import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane; import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
/** /**
@ -38,6 +39,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene * @author Rob Greene
*/ */
public class DiskImageOrderPane extends WizardPane { public class DiskImageOrderPane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private DiskImageWizard wizard; private DiskImageWizard wizard;
private Composite control; private Composite control;
private Composite parent; private Composite parent;
@ -51,14 +53,14 @@ public class DiskImageOrderPane extends WizardPane {
} }
/** /**
* Get the next visible pane. * Get the next visible pane.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#getNextPane() * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#getNextPane()
*/ */
public WizardPane getNextPane() { public WizardPane getNextPane() {
return null; return null;
} }
/** /**
* Create the wizard pane. * Create the wizard pane.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#open() * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#open()
*/ */
public void open() { public void open() {
control = new Composite(parent, SWT.NULL); control = new Composite(parent, SWT.NULL);
@ -74,44 +76,41 @@ public class DiskImageOrderPane extends WizardPane {
control.setLayout(layout); control.setLayout(layout);
Label label = new Label(control, SWT.WRAP); Label label = new Label(control, SWT.WRAP);
if (wizard.isHardDisk()) { if (wizard.isHardDisk()) {
label.setText("You have chosen a hard disk volume. The only\n" label.setText(textBundle.get("DiskImageOrderProdosOnly")); //$NON-NLS-1$
+ "order allowed is ProDOS.");
} else { } else {
label.setText("Please choose the order to use in this disk image:"); label.setText(textBundle.get("DiskImageOrderPrompt")); //$NON-NLS-1$
} }
RowLayout subpanelLayout = new RowLayout(SWT.VERTICAL); RowLayout subpanelLayout = new RowLayout(SWT.VERTICAL);
subpanelLayout.justify = true; subpanelLayout.justify = true;
subpanelLayout.spacing = 3; subpanelLayout.spacing = 3;
Composite buttonSubpanel = new Composite(control, SWT.NULL); Composite buttonSubpanel = new Composite(control, SWT.NULL);
buttonSubpanel.setLayout(subpanelLayout); buttonSubpanel.setLayout(subpanelLayout);
createRadioButton(buttonSubpanel, "DOS ordered", createRadioButton(buttonSubpanel, textBundle.get("DiskImageOrderDosLabel"), //$NON-NLS-1$
DiskImageWizard.ORDER_DOS, DiskImageWizard.ORDER_DOS,
"Indicates that image data should be stored by track and sector."); textBundle.get("DiskImageOrderDosText")); //$NON-NLS-1$
createRadioButton(buttonSubpanel, "ProDOS ordered", createRadioButton(buttonSubpanel, textBundle.get("DiskImageOrderProdosLabel"), //$NON-NLS-1$
DiskImageWizard.ORDER_PRODOS, DiskImageWizard.ORDER_PRODOS,
"Indicates that image data should be stored by block."); textBundle.get("DiskImageOrderProdosText")); //$NON-NLS-1$
if (wizard.getSize() == Disk.APPLE_140KB_DISK) { if (wizard.getSize() == Disk.APPLE_140KB_DISK) {
createRadioButton(buttonSubpanel, "Nibble ordered", createRadioButton(buttonSubpanel, textBundle.get("DiskImageOrderNibbleLabel"), //$NON-NLS-1$
DiskImageWizard.ORDER_NIBBLE, DiskImageWizard.ORDER_NIBBLE,
"Indicates that this is a disk stored as a nibble image. This is " textBundle.get("DiskImageOrderNibbleText")); //$NON-NLS-1$
+ "an image that consists of disk bytes. It is only available for "
+ "140KB 5.25\" disks.");
} }
label = new Label(control, SWT.WRAP); label = new Label(control, SWT.WRAP);
if (wizard.isHardDisk()) { if (wizard.isHardDisk()) {
label.setText("Compression is not available for hard disk images."); label.setText(textBundle.get("DiskImageOrderNoCompression")); //$NON-NLS-1$
} else { } else {
label.setText("Indicate if this disk image should be GZIP compressed:"); label.setText(textBundle.get("DiskImageOrderCompressionPrompt")); //$NON-NLS-1$
} }
final Button button = new Button(control, SWT.CHECK); final Button button = new Button(control, SWT.CHECK);
button.setText("GZip compression"); button.setText(textBundle.get("DiskImageOrderGzipCheckbox")); //$NON-NLS-1$
button.setToolTipText("Compresses the disk image (*.gz)."); button.setToolTipText(textBundle.get("DiskImageOrderGzipTooltip")); //$NON-NLS-1$
button.setSelection(wizard.isCompressed()); button.setSelection(wizard.isCompressed());
button.setEnabled(!wizard.isHardDisk()); button.setEnabled(!wizard.isHardDisk());
button.addSelectionListener(new SelectionAdapter() { button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
wizard.setCompressed(!wizard.isCompressed()); getWizard().setCompressed(!getWizard().isCompressed());
} }
}); });
} }
@ -128,15 +127,19 @@ public class DiskImageOrderPane extends WizardPane {
button.setEnabled(!wizard.isHardDisk()); button.setEnabled(!wizard.isHardDisk());
button.addSelectionListener(new SelectionAdapter() { button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
wizard.setOrder(order); getWizard().setOrder(order);
} }
}); });
} }
/** /**
* Dispose of all resources. * Dispose of all resources.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#dispose() * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#dispose()
*/ */
public void dispose() { public void dispose() {
control.dispose(); control.dispose();
} }
protected DiskImageWizard getWizard() {
return wizard;
}
} }

View File

@ -27,7 +27,8 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Label;
import com.webcodepro.applecommander.storage.FormattedDisk; import com.webcodepro.applecommander.storage.Disk;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane; import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
/** /**
@ -37,6 +38,7 @@ import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
* @author Rob Greene * @author Rob Greene
*/ */
public class DiskImageSizePane extends WizardPane { public class DiskImageSizePane extends WizardPane {
private TextBundle textBundle = TextBundle.getInstance();
private DiskImageWizard wizard; private DiskImageWizard wizard;
private Composite control; private Composite control;
private Composite parent; private Composite parent;
@ -50,14 +52,14 @@ public class DiskImageSizePane extends WizardPane {
} }
/** /**
* Get the next visible pane. * Get the next visible pane.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#getNextPane() * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#getNextPane()
*/ */
public WizardPane getNextPane() { public WizardPane getNextPane() {
return new DiskImageNamePane(parent, wizard); return new DiskImageNamePane(parent, wizard);
} }
/** /**
* Create the wizard pane. * Create the wizard pane.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#open() * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#open()
*/ */
public void open() { public void open() {
control = new Composite(parent, SWT.NULL); control = new Composite(parent, SWT.NULL);
@ -73,25 +75,31 @@ public class DiskImageSizePane extends WizardPane {
control.setLayout(layout); control.setLayout(layout);
Label label = new Label(control, SWT.WRAP); Label label = new Label(control, SWT.WRAP);
label.setText( label.setText(
"Please choose the disk image size:"); textBundle.get("DiskImageSizePrompt")); //$NON-NLS-1$
RowLayout subpanelLayout = new RowLayout(SWT.VERTICAL); RowLayout subpanelLayout = new RowLayout(SWT.VERTICAL);
subpanelLayout.justify = true; subpanelLayout.justify = true;
subpanelLayout.spacing = 3; subpanelLayout.spacing = 3;
Composite buttonSubpanel = new Composite(control, SWT.NULL); Composite buttonSubpanel = new Composite(control, SWT.NULL);
buttonSubpanel.setLayout(subpanelLayout); buttonSubpanel.setLayout(subpanelLayout);
createRadioButton(buttonSubpanel, "140KB", FormattedDisk.APPLE_140KB_DISK, createRadioButton(buttonSubpanel, textBundle.get("DiskImageSize140Kb"), //$NON-NLS-1$
"The Disk II 5.25\" floppy drive."); Disk.APPLE_140KB_DISK,
createRadioButton(buttonSubpanel, "800KB", FormattedDisk.APPLE_800KB_2IMG_DISK, textBundle.get("DiskImageSize140KbText")); //$NON-NLS-1$
"The Apple UniDisk 3.5\" drive."); createRadioButton(buttonSubpanel, textBundle.get("DiskImageSize800Kb"), //$NON-NLS-1$
Disk.APPLE_800KB_2IMG_DISK,
textBundle.get("DiskImageSize800KbText")); //$NON-NLS-1$
if (wizard.getFormat() == DiskImageWizard.FORMAT_PRODOS) { if (wizard.getFormat() == DiskImageWizard.FORMAT_PRODOS) {
createRadioButton(buttonSubpanel, "5MB", FormattedDisk.APPLE_5MB_HARDDISK, createRadioButton(buttonSubpanel, textBundle.get("DiskImageSize5Mb"), //$NON-NLS-1$
"A 5MB hard disk."); Disk.APPLE_5MB_HARDDISK,
createRadioButton(buttonSubpanel, "10MB", FormattedDisk.APPLE_10MB_HARDDISK, textBundle.get("DiskImageSize5MbText")); //$NON-NLS-1$
"A 10MB hard disk."); createRadioButton(buttonSubpanel, textBundle.get("DiskImageSize10Mb"), //$NON-NLS-1$
createRadioButton(buttonSubpanel, "20MB", FormattedDisk.APPLE_20MB_HARDDISK, Disk.APPLE_10MB_HARDDISK,
"A 20MB hard disk."); textBundle.get("DiskImageSize10MbText")); //$NON-NLS-1$
createRadioButton(buttonSubpanel, "32MB", FormattedDisk.APPLE_32MB_HARDDISK, createRadioButton(buttonSubpanel, textBundle.get("DiskImageSize20Mb"), //$NON-NLS-1$
"A 32MB hard disk."); Disk.APPLE_20MB_HARDDISK,
textBundle.get("DiskImageSize20MbText")); //$NON-NLS-1$
createRadioButton(buttonSubpanel, textBundle.get("DiskImageSize32Mb"), //$NON-NLS-1$
Disk.APPLE_32MB_HARDDISK,
textBundle.get("DiskImageSize32MbText")); //$NON-NLS-1$
} }
} }
/** /**
@ -106,15 +114,19 @@ public class DiskImageSizePane extends WizardPane {
button.setSelection(wizard.getSize() == size); button.setSelection(wizard.getSize() == size);
button.addSelectionListener(new SelectionAdapter() { button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
wizard.setSize(size); getWizard().setSize(size);
} }
}); });
} }
/** /**
* Dispose of all resources. * Dispose of all resources.
* @see com.webcodepro.applecommander.ui.swt.WizardPane#dispose() * @see com.webcodepro.applecommander.ui.swt.wizard.WizardPane#dispose()
*/ */
public void dispose() { public void dispose() {
control.dispose(); control.dispose();
} }
protected DiskImageWizard getWizard() {
return wizard;
}
} }

View File

@ -35,6 +35,7 @@ import com.webcodepro.applecommander.storage.physical.DosOrder;
import com.webcodepro.applecommander.storage.physical.ImageOrder; import com.webcodepro.applecommander.storage.physical.ImageOrder;
import com.webcodepro.applecommander.storage.physical.NibbleOrder; import com.webcodepro.applecommander.storage.physical.NibbleOrder;
import com.webcodepro.applecommander.storage.physical.ProdosOrder; import com.webcodepro.applecommander.storage.physical.ProdosOrder;
import com.webcodepro.applecommander.ui.TextBundle;
import com.webcodepro.applecommander.ui.swt.util.ImageManager; import com.webcodepro.applecommander.ui.swt.util.ImageManager;
import com.webcodepro.applecommander.ui.swt.wizard.Wizard; import com.webcodepro.applecommander.ui.swt.wizard.Wizard;
import com.webcodepro.applecommander.ui.swt.wizard.WizardPane; import com.webcodepro.applecommander.ui.swt.wizard.WizardPane;
@ -57,20 +58,21 @@ public class DiskImageWizard extends Wizard {
public static final int ORDER_PRODOS = 2; public static final int ORDER_PRODOS = 2;
public static final int ORDER_NIBBLE = 3; public static final int ORDER_NIBBLE = 3;
private int format = FORMAT_DOS33; private int format = FORMAT_DOS33;
private int size = FormattedDisk.APPLE_140KB_DISK; private int size = Disk.APPLE_140KB_DISK;
private String fileName = ""; private String fileName = new String();
private String volumeName = ""; private String volumeName = new String();
private int order = ORDER_PRODOS; private int order = ORDER_PRODOS;
private boolean compressed = false; private boolean compressed = false;
/** /**
* Constructor for ExportWizard. * Constructor for ExportWizard.
*/ */
public DiskImageWizard(Shell parent, ImageManager imageManager) { public DiskImageWizard(Shell parent, ImageManager imageManager) {
super(parent, imageManager.get(ImageManager.LOGO_DISK_IMAGE_WIZARD), "Disk Image Wizard"); super(parent, imageManager.get(ImageManager.LOGO_DISK_IMAGE_WIZARD),
TextBundle.getInstance().get("DiskImageWizardTitle")); //$NON-NLS-1$
} }
/** /**
* Create the initial display used in the wizard. * Create the initial display used in the wizard.
* @see com.webcodepro.applecommander.ui.swt.Wizard#createInitialWizardPane() * @see com.webcodepro.applecommander.ui.swt.wizard.Wizard#createInitialWizardPane()
*/ */
public WizardPane createInitialWizardPane() { public WizardPane createInitialWizardPane() {
return new DiskImageFormatPane(getContentPane(), this); return new DiskImageFormatPane(getContentPane(), this);
@ -81,14 +83,14 @@ public class DiskImageWizard extends Wizard {
public FormattedDisk[] getFormattedDisks() { public FormattedDisk[] getFormattedDisks() {
StringBuffer name = new StringBuffer(fileName); StringBuffer name = new StringBuffer(fileName);
if (isHardDisk()) { if (isHardDisk()) {
name.append(".hdv"); name.append(".hdv"); //$NON-NLS-1$
} else if (order == ORDER_DOS) { } else if (order == ORDER_DOS) {
name.append(".dsk"); name.append(".dsk"); //$NON-NLS-1$
} else { } else {
name.append(".po"); name.append(".po"); //$NON-NLS-1$
} }
if (isCompressed()) { if (isCompressed()) {
name.append(".gz"); name.append(".gz"); //$NON-NLS-1$
} }
ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(getSize()); ByteArrayImageLayout imageLayout = new ByteArrayImageLayout(getSize());
ImageOrder imageOrder = null; ImageOrder imageOrder = null;