public static String checkDesign(String pDesign) { // Design without Style String dDesign = getDefaultDesignName(); String dStyle = getDefaultStyleName(); if (dStyle != null) dDesign += '.' + dStyle; if (pDesign == null) return dDesign; String[] DS = split(pDesign); String lDesign = DS[0]; String lStyle = DS[1]; Design tmpDesign; synchronized (gsBuffer) { tmpDesign = (Design) gsBuffer.get(lDesign); } if (tmpDesign == null) return dDesign; else { if (lStyle == null) return pDesign; // pDesign exists WITHOUT style else { lStyle = (String) tmpDesign.getStyle().get(lStyle); if (lStyle == null) return dDesign; // pDesign exists, but not // the style else return pDesign; // pDesign exists WITH style } } }
/** * Returns the <code>StreamSource</code> of the given design. * * @param pDesign design which is in the point of view * @return <code>StreamSource</code> of the design * @throws IOException */ public static StreamSource Design2Stream(Design pDesign) throws IOException { if (pDesign == null) return null; File lFile = pDesign.getFile(); try { /* * StreamSource ss=new StreamSource(new * StringReader(FileManager.load(lFile))); ss.setSystemId(lFile); * return ss; */ return new StreamSource(lFile); } catch (Exception e) { throw new IOException( "DesignManager.Design2Stream: Unable to load File (" + lFile.getName() + ")\n" + e); } }