Made TextBundle a general utility class and changed to the

UI-specific UiBundle.
This commit is contained in:
Robert Greene 2004-07-11 15:08:10 +00:00
parent 591924ce53
commit c4cd2c699b
3 changed files with 108 additions and 86 deletions

View File

@ -1,77 +0,0 @@
/*
* AppleCommander - An Apple ][ image utility.
* Copyright (C) 2002-2003 by Robert Greene
* robgreene at users.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.webcodepro.applecommander.ui;
import java.text.MessageFormat;
import java.util.ResourceBundle;
/**
* Manage the user-interface specific ResourceBundle. Initally, this is to actually clean up the
* text. Utilmately, it should allow AppleCommander to be translated into other languages.
*
* @author Rob Greene
*/
public class TextBundle {
private ResourceBundle resourceBundle;
private static TextBundle instance;
/**
* Get the singleton instance of the TextBundle.
*/
public static TextBundle getInstance() {
if (instance == null) {
instance = new TextBundle();
instance.initialize();
}
return instance;
}
/**
* Initialize the TextBundle.
*/
private void initialize() {
if (resourceBundle == null) {
resourceBundle = ResourceBundle.getBundle(getClass().getName());
}
}
/**
* Retrieve a value for the given resource name.
*/
public String get(String name) {
return resourceBundle.getString(name);
}
/**
* Format the given resource name with a single String value.
*/
public String format(String name, String value) {
return format(name, new Object[] { value });
}
/**
* Format the given resource name with multiple values.
*/
public String format(String name, Object[] values) {
String resourceValue = get(name);
MessageFormat messageFormat = new MessageFormat(resourceValue);
return messageFormat.format(values);
}
}

View File

@ -0,0 +1,43 @@
/*
* AppleCommander - An Apple ][ image utility.
* Copyright (C) 2002-2004 by Robert Greene
* robgreene at users.sourceforge.net
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package com.webcodepro.applecommander.ui;
import com.webcodepro.applecommander.util.TextBundle;
/**
* Manage the user-interface specific ResourceBundle. Inheritance is used to
* allow logical groupings of ResourceBundles and to reuse the common metods.
*
* @author Rob Greene
*/
public class UiBundle extends TextBundle {
private static UiBundle instance;
/**
* Get the singleton instance of the UiBundle.
*/
public static TextBundle getInstance() {
if (instance == null) {
instance = new UiBundle();
instance.initialize();
}
return instance;
}
}

View File

@ -75,7 +75,6 @@ CompileWizardToolItem=Compile
CompileWizardHoverText=Compile a BASIC program (CTRL+C)
ViewFileToolItem=View
ViewFileHoverText=View file (CTRL+V)
PrintDirectoryToolItem=Print
PrintDirectoryHoverText=Print directory listing...
ChangeDiskOrderToolItem=Re-order...
ChangeDiskOrderHoverText=Change image order (CTRL+O)
@ -106,18 +105,10 @@ CommandLineHelp = AppleCommander command line options:\n-l <imagename> list dire
UserPreferencesComment = AppleCommander user preferences
# AppleCommander
Copyright = Copyright (c) 2002-2004
SwingVersionNotAvailable = Sorry, the Swing GUI is not available.
CommandLineNotAvailable = Sorry, the command line user interface is not available.
AppleCommanderHelp = AppleCommander general options:\n-swt will launch the SWT version of AppleCommander.\n This requires the SWT jar and dll files to be present.\n-swing will launch the Swing version of AppleCommander.\n (This is not implemented yet.)\n-command will enter command interpreter mode. (This is also\n not implemented yet.)\n-help will show this help text.
# AppleUtil
HexDumpLine1 = Offset Hex Data Characters
HexDumpLine2 = ======= ================================================ =================
HexDumpEndMessage = ** END **
CannotChangeImageOrder=Cannot change ImageOrder unless the source and target are the same size!
CannotCompareDisks=Cannot compare disks unless the source and target are the same size!
# ImportWizard
ImportWizardTitle = Import Wizard
@ -220,6 +211,12 @@ EditButton=Edit...
BackButton=\< Back
NextButton=Next \>
FinishButton=Finish
OpenButton=Open...
CreateButton=Create...
CompareButton=Compare...
AboutButton=About
Copyright=Copyright (c) 2002-2004
PrintButton=Print
# DiskImageNamePane
DiskImageNamePrompt=Please choose a name for your disk image.\nDo not enter any file extensions, as the wizard\nwill do that for you.
@ -257,3 +254,62 @@ CompareDisksResultsPane.DifferentSizeError=The two disks are of differing format
CompareDisksResultsPane.DataDiffersMessage=The two disks do not contain the same data.\n
CompareDisksResultsPane.DifferentDataFormatError=The two disks are not the same data format.\n
CompareDisksResultsPane.DisksMatch=The disk images match.
# GraphicsFilterAdapter
GraphicsFilterAdapter.BadImageMessage=Unexpected graphic file encountered\!
# SwtAppleCommander
SwtAppleCommander.AppleCommander=AppleCommander
SwtAppleCommander.UnrecognizedFormatTitle=Unrecognized Disk Format
SwtAppleCommander.UnrecognizedFormatMessage=Unable to load "{0}".\n\nAppleCommander did not recognize the format\nof the disk. Either this is a new format\nor a protected disk.\n\nSorry\!
SwtAppleCommander.OpenDiskImageTooltip=Open a disk image (Ctrl+O)
SwtAppleCommander.CreateDiskImageTooltip=Create a disk image (Ctrl+C)
SwtAppleCommander.CompareDiskImageTooltip=Compare two disk images (Ctrl+E)
SwtAppleCommander.AboutTooltip=About AppleCommander (Ctrl+A)
SwtAppleCommander.AboutTitle=About AppleCommander
SwtAppleCommander.AboutMessage=AppleCommander\nVersion {0}\n{1}\n\nAppleCommander was created for the express\npurpose of assisting those-who-remember.\n\nI wish you many hours of vintage pleasure\!\n-Rob
# FileViewerWindow
FileViewerWindow.Title=AppleCommander File View - {0}
FileViewerWindow.ApplesoftButton=Applesoft
FileViewerWindow.ApplesoftTooltip=Displays file as an Applesoft BASIC program (F2)
FileViewerWindow.DatabaseButton=Database
FileViewerWindow.DatabaseTooltip=Displays file as a database file (F2)
FileViewerWindow.SpreadsheetButton=Spreadsheet
FileViewerWindow.SpreadsheetTooltip=Displays file as a spreadsheet file (F2)
FileViewerWindow.WordprocessorButton=Wordprocessor
FileViewerWindow.WordprocessorTooltip=Displays file as a wordprocessor file (F2)
FileViewerWindow.AssemblyButton=Assembly
FileViewerWindow.AssemblyTooltip=Displays file as assembly source file (F2)
FileViewerWindow.ImageButton=Image
FileViewerWindow.ImageTooltip=Displays file as an image (F2)
FileViewerWindow.IntegerBasicButton=Integer BASIC
FileViewerWindow.IntegerBasicTooltip=Displays file as an Integer BASIC program (F2)
FileViewerWindow.PascalTextButton=Pascal Text
FileViewerWindow.PascalTextTooltip=Displays file as Pascal text file (F2)
FileViewerWindow.TextButton=Text
FileViewerWindow.TextTooltip=Displays file as a text file (F2)
FileViewerWindow.HexDumpButton=Hex Dump
FileViewerWindow.HexDumpTooltip=Displays file as a hex dump (F3)
FileViewerWindow.RawDumpButton=Raw Dump
FileViewerWindow.RawDumpTooltip=Displays file as a raw hex dump (F4)
FileViewerWindow.CopyButton=Copy
FileViewerWindow.CopyTooltip=Copies selection to the clipboard (CTRL+C)
FileViewerWindow.PrintTooltip=Print contents... (CTRL+P)
# DiskWindow
DiskWindow.Title=AppleCommander Disk View - {0}
# DiskMapTab
DiskMapTab.MultipleTabsTitle=Disk Map \#{0}
DiskMapTab.SingleTabTitle=Disk Map
DiskMapTab.BlockDecriptiveLabel=This disk is organized by the {0}. Therefore, no organization has been forced on the {0} layout.
DiskMapTab.TrackAndSectorDecriptiveLabel=This disk is organized by {0} and {1}, and this implies a rigid layout to the disk. This will be reflected in the disk map.
DiskMapTab.FreeLegend=\ = Free
DiskMapTab.UsedLegend=\ = Used
DiskMapTab.DiskMapUnavailableMessage=A disk map is unavailable.
# DiskInfoTab
DiskInfoTab.Title=Disk Info
DiskInfoTab.LabelHeader=Label
DiskInfoTab.ValueHeader=Value