Search in sources :

Example 1 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class ProcessDashboard method displayStartupPermissionError.

private void displayStartupPermissionError(String resourceKey) {
    Resources res = Resources.getDashBundle("Authentication.Errors");
    String title = res.getString(resourceKey + ".Title");
    Object message = res.getStrings(resourceKey + ".Message");
    JOptionPane.showMessageDialog(hideSS(), message, title, JOptionPane.ERROR_MESSAGE);
}
Also used : Resources(net.sourceforge.processdash.i18n.Resources)

Example 2 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class BrokenDataFileHandler method showMissingDataFileWarnings.

public void showMissingDataFileWarnings() {
    // no missing data files? Great! Do nothing and return.
    if (missingDataFiles.isEmpty())
        return;
    // prepare to display an error dialog.
    ProcessDashboard.dropSplashScreen();
    Resources resources = Resources.getDashBundle("ProcessDashboard.Errors");
    // find the errors which can be attributed to missing MCFs.
    Map<String, String> warnings = new HashMap(missingDataFiles);
    Map<String, List<String>> mcfProjects = findMissingMcfProjects(warnings);
    // If they are missing one of the standard MCFs, print a message
    // telling them to download and run the dashboard installer.
    showMcfWarning(resources, "Missing_MCF.TSP_Footer", "TSP", mcfProjects.remove("TSP"), DOWNLOAD_URL);
    showMcfWarning(resources, "Missing_MCF.TSP_Footer", "PDSSD", mcfProjects.remove("PDSSD"), DOWNLOAD_URL);
    // If they are missing a custom MCF, print a message telling them
    // to obtain it from their team leader and install it.
    String resKey = CompressedInstanceLauncher.isRunningFromCompressedData() ? "Missing_MCF.Custom_Footer_Zip_FMT" : "Missing_MCF.Custom_Footer_FMT";
    for (Map.Entry<String, List<String>> e : mcfProjects.entrySet()) showMcfWarning(resources, resKey, e.getKey(), e.getValue(), SHARE_MCF_URL);
    // if any other files are missing, display a more generic error.
    ErrorReporter errorReporter = new ErrorReporter(resources.getString("Broken_Data_Title"), resources.getStrings("Broken_Data_Header"), resources.getStrings("Broken_Data_Footer"));
    for (String dataPrefix : warnings.keySet()) errorReporter.logError(dataPrefix);
    errorReporter.done();
}
Also used : ErrorReporter(net.sourceforge.processdash.ui.lib.ErrorReporter) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) JList(javax.swing.JList) List(java.util.List) Resources(net.sourceforge.processdash.i18n.Resources) HashMap(java.util.HashMap) Map(java.util.Map)

Example 3 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class ProcessDashboard method displayPermissionsTamperingError.

private void displayPermissionsTamperingError() {
    Resources res = Resources.getDashBundle("Permissions.Tamper_Error");
    String title = res.getString("Title");
    Object message = res.getStrings("Message");
    JOptionPane.showMessageDialog(hideSS(), message, title, JOptionPane.ERROR_MESSAGE);
}
Also used : Resources(net.sourceforge.processdash.i18n.Resources)

Example 4 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class OpenDocument method getProp.

private String getProp(Element e, String resName, String defValue) {
    if (e == null)
        return defValue;
    Document doc = e.getOwnerDocument();
    if (doc == null)
        return defValue;
    Resources bundle = (Resources) resourceMap.get(doc);
    if (bundle == null)
        return defValue;
    resName = resName.replace(' ', '_');
    try {
        return resolveMetaReferences(bundle.getString(resName));
    } catch (MissingResourceException mre) {
    }
    return defValue;
}
Also used : MissingResourceException(java.util.MissingResourceException) Resources(net.sourceforge.processdash.i18n.Resources) Document(org.w3c.dom.Document)

Example 5 with Resources

use of net.sourceforge.processdash.i18n.Resources in project processdash by dtuma.

the class OpenDocument method getDocumentTree.

protected Document getDocumentTree(String url) throws IOException {
    Document result = null;
    if (parameters.get("init") == null)
        result = (Document) documentMap.get(url);
    if (result == null) {
        try {
            result = XMLUtils.parse(new ByteArrayInputStream(getRequest(url, true)));
            documentMap.put(url, result);
        } catch (SAXException se) {
            se.printStackTrace();
            return null;
        }
        try {
            String resourceName = url;
            int dotPos = resourceName.lastIndexOf('.');
            if (dotPos != -1) {
                resourceName = resourceName.substring(0, dotPos);
                dotPos = resourceName.indexOf('.');
                if (dotPos != -1)
                    resourceName = StringUtils.findAndReplace(resourceName, ".", "%2e");
            }
            resourceName = resourceName.replace('/', '.');
            if (resourceName.startsWith("."))
                resourceName = resourceName.substring(1);
            Resources bundle = Resources.getTemplateBundle(resourceName);
            resourceMap.put(result, bundle);
        } catch (Exception e) {
        }
    }
    return result;
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) Resources(net.sourceforge.processdash.i18n.Resources) Document(org.w3c.dom.Document) MalformedURLException(java.net.MalformedURLException) MissingResourceException(java.util.MissingResourceException) IOException(java.io.IOException) SAXException(org.xml.sax.SAXException) SAXException(org.xml.sax.SAXException)

Aggregations

Resources (net.sourceforge.processdash.i18n.Resources)20 MissingResourceException (java.util.MissingResourceException)5 Document (org.w3c.dom.Document)3 File (java.io.File)2 IOException (java.io.IOException)2 MalformedURLException (java.net.MalformedURLException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 List (java.util.List)2 ErrorReporter (net.sourceforge.processdash.ui.lib.ErrorReporter)2 SAXException (org.xml.sax.SAXException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 URL (java.net.URL)1 MessageFormat (java.text.MessageFormat)1 Date (java.util.Date)1 HashSet (java.util.HashSet)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1 Set (java.util.Set)1