/** * Returns the stream to a resource. * * @param name the resource name * @return a stream to the resource * @throws ResourceNotFoundException if the resource cannot be found * @throws ResourceException for any other resource error */ @Override public InputStream getInputStream(String name) { // TODO - this is invoked to get multi-volume info, so should check on web dir. return resources.getInputStream(name); }
/** * Loads an image. * * @return The image icon. */ private ImageIcon getImage() { ImageIcon img; try { img = resources.getImageIcon("installer.langsel.img"); } catch (Exception err) { img = null; } return img; }
/** * Load GUI preference information. * * @param installData the GUI installation data * @throws Exception */ private void loadGUIInstallData(GUIInstallData installData, Resources resources) throws Exception { installData.guiPrefs = (GUIPrefs) resources.getObject("GUIPrefs"); }
Info info = (Info) resources.getObject("info"); List<Panel> panelsOrder = (List<Panel>) resources.getObject("panelsOrder"); InputStream in = resources.getInputStream("packs.info"); ObjectInputStream objIn = new ObjectInputStream(in); List<PackInfo> packs; Properties properties = (Properties) resources.getObject("vars"); if (properties != null)
private URL loadHTMLInfoContent() { Resources resources = getResources(); if (getMetadata() != null && getMetadata().getPanelId() != null) { try { String panelSpecificResName = panelResourcePrefixStr + '.' + this.getMetadata().getPanelId(); String panelspecificResContent = resources.getString(panelSpecificResName, null); if (panelspecificResContent != null) { panelResourceNameStr = panelSpecificResName; } } catch (Exception e) { // Those ones can be skipped } } try { return resources.getURL(panelResourceNameStr); } catch (Exception ex) { ex.printStackTrace(); } return null; }
/** * Returns the text to display. * * @return the text */ @Override protected String getText() { String defaultValue = "Error : could not load the info text !"; return resources.getString("InfoPanel.info", defaultValue); } }
/** * This method is called when Help button has been clicked. By default it doesn't do anything. */ public void showHelp() { // System.out.println("Help function called, helpName: " + helpName); if (helpUrl != null) { URL resourceUrl = resources.getURL(helpUrl); getHelpWindow().showHelp(getString("installer.help"), resourceUrl); } }
/** * Returns the text to display. * * @return the text. A {@code null} indicates failure */ @Override protected String getText() { String result = null; if (panelId != null) { result = resources.getString(resourcePrefix + "." + panelId, null); } if (result == null) { result = resources.getString(resourcePrefix + ".info", null); } if (result != null) { result = removeHTML(result); } return result; }
URL url = resources.getURL(path); this.path = url.getPath(); this.installData = installData;
/** * Returns a stream to a local pack. * * @param name the pack name * @return the pack stream */ private InputStream getLocalPackStream(String name) { return resources.getInputStream("packs/pack-" + name); }
/** * Load GUI preference information. * * @param installData the console installation data * @throws Exception */ private void loadConsoleInstallData(ConsoleInstallData installData, Resources resources) throws Exception { installData.consolePrefs = (ConsolePrefs) resources.getObject("ConsolePrefs"); }
/** * Loads the info text. */ private void loadInfo() { String defaultValue = "Error : could not load the info text !"; info = getResources().getString("InfoPanel.info", defaultValue); }
ImageIcon splashIcon = resources.getImageIcon("/resources/Splash.image"); if (splashIcon != null)
/** * Gets the stream to a resource. * * @param res The resource id. * @return The resource value, null if not found */ public InputStream getResource(String res) { try { // System.out.println ("retrieving resource " + res); return resources.getInputStream(res); } catch (ResourceNotFoundException exception) { return null; } }
/** * Returns the supported locales. * * @return the supported locales * @throws ResourceException if the supported locales exist but cannot be read */ @SuppressWarnings("unchecked") private List<String> getSupportedLocales() { List<String> locales = null; try { locales = (List<String>) resources.getObject("langpacks.info"); } catch (ResourceNotFoundException ignore) { // do nothing } return (locales != null) ? locales : Collections.<String>emptyList(); }
/** * Loads the info text. */ private void loadInfo() { info = getResources().getString("XInfoPanel.info", null, "Error : could not load the info text !"); }
/** * Pre-loads the images. */ private void preLoadImages() { int size = this.installData.getAvailablePacks().size(); images = new HashMap<String, ImageIcon>(size); Resources resources = getResources(); for (Pack pack : this.installData.getAvailablePacks()) { String imageId = pack.getImageId(); if (imageId != null) { try { ImageIcon img = resources.getImageIcon(imageId); images.put(imageId, img); } catch (Exception err) { err.printStackTrace(); } } } }
/** * Returns a stream to the messages for the given ISO code. * * @param code the 2 or 3 character ISO language code * @return the stream, or {@code null} if none was found */ private InputStream getMessagesStream(String code) { InputStream result = null; try { String path = "langpacks/" + code + ".xml"; result = resources.getInputStream(path); } catch (ResourceNotFoundException ignore) { logger.fine("Locale has no langpack for code: " + code); } return result; }
/** * Reads conditions using the resources. * <p/> * This looks for a serialized resource named <em>"rules"</em>. * * @param resources the resources * @return the conditions, keyed on id, or <tt>null</tt> if the resource doesn't exist or cannot be read */ @SuppressWarnings("unchecked") private Map<String, Condition> readConditions(Resources resources) { Map<String, Condition> rules = null; try { rules = (Map<String, Condition>) resources.getObject("rules"); } catch (ResourceNotFoundException rnfe) { logger.fine("No optional rules defined"); } catch (ResourceException re) { logger.log(Level.SEVERE, "Optional rules could not be loaded", re); } return rules; }