use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.
the class ExcelReport method writeNoPermission.
public static void writeNoPermission(PrintWriter out) {
Resources resources = Resources.getDashBundle("Permissions");
String title = resources.getHTML("Export_Reports.No_Permission_Title");
out.print("<html>\n<head>\n<title>");
out.print(title);
out.print("</title>\n</head>\n<body>\n<h1>");
out.print(title);
out.print("</h1>\n<p>");
out.print(resources.getHTML("Export_Reports.No_Permission_Message"));
out.print("</p>\n</body>\n</html>\n");
}
use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.
the class EVReport method printAlternateViewLink.
private void printAlternateViewLink(Element view) {
// Get the URI of the report
String uri = view.getAttribute("href");
if (uri.startsWith("/"))
uri = uri.substring(1);
// Get the resource bundle for messages
String resourcePrefix = view.getAttribute("resources");
Resources res = Resources.getDashBundle(resourcePrefix);
// Construct the link HTML and print it
String linkHtml = StringUtils.findAndReplace(SHOW_ALT_LINK, "[URI]", uri);
interpOutLink(linkHtml, EVReportSettings.PURPOSE_OTHER, res);
}
use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.
the class TinyCGIBase method parseResourceFile.
protected void parseResourceFile(String context, String filename) throws IOException {
String bundleName = resolveRelativeURI(context, filename);
int pos = bundleName.indexOf("//");
if (pos != -1)
bundleName = bundleName.substring(pos + 1);
pos = bundleName.lastIndexOf('.');
if (pos != -1 && bundleName.indexOf('/', pos) == -1)
bundleName = bundleName.substring(0, pos);
try {
Resources bundle = Resources.getTemplateBundle(bundleName);
getInterpolator().addResources(bundle);
} catch (MissingResourceException mre) {
System.out.println("Couldn't find resource file: " + bundleName);
System.out.println("(Specified as '" + filename + "' from '" + context + "')");
}
}
use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.
the class TinyCGIBase method parseInputFile.
/* Read name=value pairs from the given URI. If the URI is not
* absolute (e.g. "/reports/foo"), it is interpreted relative
* to the current request. */
protected void parseInputFile(String scriptPath, String filename) throws IOException {
if (filename == null || filename.length() == 0)
return;
WebServer t = getTinyWebServer();
String origFilename = filename;
try {
filename = resolveRelativeURI(scriptPath, filename);
parseInput(filename, t.getRequestAsString(filename));
// values from it as well.
try {
String bundleName = filename;
int pos = bundleName.indexOf("//");
if (pos != -1)
bundleName = bundleName.substring(pos + 1);
pos = bundleName.lastIndexOf('.');
if (pos != -1 && bundleName.indexOf('/', pos) == -1)
bundleName = bundleName.substring(0, pos);
Resources bundle = Resources.getTemplateBundle(bundleName);
parameters.putAll(bundle.asMap());
} catch (Exception e) {
// it is not an error if no companion bundle was found.
}
} catch (IOException ioe) {
System.out.println("Couldn't read file: " + filename);
System.out.println("(Specified as '" + origFilename + "' from '" + scriptPath + "')");
}
}
use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.
the class BrokenDataFileHandler method repairLostFiles.
private boolean repairLostFiles(Component dialogParent) {
if (lostFiles == null || lostFiles.length == 0)
return true;
// sort the files so that backups are first, followed by temp files.
// this allows our repair logic to prefer applying a backup-based
// repair, as it is more reliable than a temp-file-based repair.
Arrays.sort(lostFiles, new Comparator<File>() {
public int compare(File f1, File f2) {
return getFileType(f1) - getFileType(f2);
}
private int getFileType(File f) {
return (isBackupFile(f) ? 1 : 2);
}
});
int unrepairedCount = 0;
for (int i = 0; i < lostFiles.length; i++) {
File file = lostFiles[i];
if (repairFile(file))
lostFiles[i] = null;
else
unrepairedCount++;
}
if (unrepairedCount == 0)
return true;
// If there are unrepaired files, display an error dialog
ProcessDashboard.dropSplashScreen();
Resources r = Resources.getDashBundle("ProcessDashboard.Errors");
String message = getCorruptFileStr() + "\n" + r.getString("Lost_Data_Message");
String title = r.getString("Lost_Data_Title");
int response = JOptionPane.showConfirmDialog(dialogParent, message, title, JOptionPane.YES_NO_OPTION, JOptionPane.ERROR_MESSAGE);
return response == JOptionPane.YES_OPTION;
}
Aggregations