@Test public void testKnownTemplates() throws IOException { List<String> knownTemplates = LatticeGUIMustache.getKnownTemplates().collect(Collectors.toList()); assertTrue(knownTemplates.size()>0); assertTrue(knownTemplates.stream().anyMatch( t -> t.endsWith(LatticeGUIMustache.TEMPLATE_3DMOL)) ); assertTrue(knownTemplates.stream().anyMatch( t -> t.endsWith(LatticeGUIMustache.TEMPLATE_ASSEMBLY_DIAGRAM_FULL)) ); }
public static Stream<String> getKnownTemplates() throws IOException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL knownDirURL = cl.getResource(TEMPLATE_DIR); if( knownDirURL == null) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } URI knownDirURI; try { knownDirURI = knownDirURL.toURI(); } catch (URISyntaxException e) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } Path knownDirPath; Function<Path,String> pathToStr; if(knownDirURI.getScheme().equals("jar")) { FileSystem fs = FileSystems.newFileSystem(knownDirURI, Collections.<String,Object>emptyMap()); knownDirPath = fs.getPath(TEMPLATE_DIR); pathToStr = path -> path.toString().charAt(0) == '/' ? path.toString().substring(1) : path.toString(); } else { knownDirPath = Paths.get(knownDirURI); pathToStr = Path::toString; } return Files.walk(knownDirPath, 1) .map( pathToStr ); }
LatticeGUIMustache { public static Stream<String> getKnownTemplates() throws IOException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL knownDirURL = cl.getResource(TEMPLATE_DIR); if( knownDirURL == null) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } URI knownDirURI; try { knownDirURI = knownDirURL.toURI(); } catch (URISyntaxException e) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } Path knownDirPath; Function<Path,String> pathToStr; if(knownDirURI.getScheme().equals("jar")) { FileSystem fs = FileSystems.newFileSystem(knownDirURI, Collections.<String,Object>emptyMap()); knownDirPath = fs.getPath(TEMPLATE_DIR); pathToStr = path -> path.toString().charAt(0) == '/' ? path.toString().substring(1) : path.toString(); } else { knownDirPath = Paths.get(knownDirURI); pathToStr = Path::toString; } return Files.walk(knownDirPath, 1) .map( pathToStr ); } }
LatticeGUIMustache { public static Stream<String> getKnownTemplates() throws IOException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL knownDirURL = cl.getResource(TEMPLATE_DIR); if( knownDirURL == null) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } URI knownDirURI; try { knownDirURI = knownDirURL.toURI(); } catch (URISyntaxException e) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } Path knownDirPath; Function<Path,String> pathToStr; if(knownDirURI.getScheme().equals("jar")) { FileSystem fs = FileSystems.newFileSystem(knownDirURI, Collections.<String,Object>emptyMap()); knownDirPath = fs.getPath(TEMPLATE_DIR); pathToStr = path -> path.toString().charAt(0) == '/' ? path.toString().substring(1) : path.toString(); } else { knownDirPath = Paths.get(knownDirURI); pathToStr = Path::toString; } return Files.walk(knownDirPath, 1) .map( pathToStr ); } LatticeGUIMustache(String template, Structure struc,Collection<Integer> interfaceIds);  LatticeGUIMustache(String template, Structure struc,Collection<Integer> interfaceIds, List<StructureInterface> allInterfaces);  LatticeGUIMustache(String template, LatticeGraph3D latticeGraph); }
LatticeGUIMustache { public static Stream<String> getKnownTemplates() throws IOException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL knownDirURL = cl.getResource(TEMPLATE_DIR); if( knownDirURL == null) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } URI knownDirURI; try { knownDirURI = knownDirURL.toURI(); } catch (URISyntaxException e) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } Path knownDirPath; Function<Path,String> pathToStr; if(knownDirURI.getScheme().equals("jar")) { FileSystem fs = FileSystems.newFileSystem(knownDirURI, Collections.<String,Object>emptyMap()); knownDirPath = fs.getPath(TEMPLATE_DIR); pathToStr = path -> path.toString().charAt(0) == '/' ? path.toString().substring(1) : path.toString(); } else { knownDirPath = Paths.get(knownDirURI); pathToStr = Path::toString; } return Files.walk(knownDirPath, 1) .map( pathToStr ); } LatticeGUIMustache(String template, Structure struc,Collection<Integer> interfaceIds);  LatticeGUIMustache(String template, Structure struc,Collection<Integer> interfaceIds, List<StructureInterface> allInterfaces);  LatticeGUIMustache(String template, LatticeGraph3D latticeGraph); static LatticeGUIMustache createLatticeGUIMustache(String template,Structure struc,Collection<Integer> interfaceIds); static String expandTemplatePath(String template); static Stream<String> getKnownTemplates(); void execute(PrintWriter out); LatticeGraph3D getGraph(); String getPdbId(); void setPdbId(String pdbId); String getPdbIdMiddle2(); String getTitle(); void setTitle(String title); String getSize(); void setSize(String size); String getDpi(); void setDpi(String dpi); void writeCIFfile(PrintWriter out); GraphLayout<ChainVertex3D,InterfaceEdge3D> getLayout2D(); void setLayout2D(GraphLayout<ChainVertex3D,InterfaceEdge3D> layout2d); UndirectedGraph<ChainVertex3D, InterfaceEdge3DSourced<ChainVertex3D>> getGraph2D(); static void main(String[] args); }
LatticeGUIMustache { public static Stream<String> getKnownTemplates() throws IOException { ClassLoader cl = Thread.currentThread().getContextClassLoader(); URL knownDirURL = cl.getResource(TEMPLATE_DIR); if( knownDirURL == null) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } URI knownDirURI; try { knownDirURI = knownDirURL.toURI(); } catch (URISyntaxException e) { throw new IllegalStateException("Unable to find mustache templates. Error building jar?"); } Path knownDirPath; Function<Path,String> pathToStr; if(knownDirURI.getScheme().equals("jar")) { FileSystem fs = FileSystems.newFileSystem(knownDirURI, Collections.<String,Object>emptyMap()); knownDirPath = fs.getPath(TEMPLATE_DIR); pathToStr = path -> path.toString().charAt(0) == '/' ? path.toString().substring(1) : path.toString(); } else { knownDirPath = Paths.get(knownDirURI); pathToStr = Path::toString; } return Files.walk(knownDirPath, 1) .map( pathToStr ); } LatticeGUIMustache(String template, Structure struc,Collection<Integer> interfaceIds);  LatticeGUIMustache(String template, Structure struc,Collection<Integer> interfaceIds, List<StructureInterface> allInterfaces);  LatticeGUIMustache(String template, LatticeGraph3D latticeGraph); static LatticeGUIMustache createLatticeGUIMustache(String template,Structure struc,Collection<Integer> interfaceIds); static String expandTemplatePath(String template); static Stream<String> getKnownTemplates(); void execute(PrintWriter out); LatticeGraph3D getGraph(); String getPdbId(); void setPdbId(String pdbId); String getPdbIdMiddle2(); String getTitle(); void setTitle(String title); String getSize(); void setSize(String size); String getDpi(); void setDpi(String dpi); void writeCIFfile(PrintWriter out); GraphLayout<ChainVertex3D,InterfaceEdge3D> getLayout2D(); void setLayout2D(GraphLayout<ChainVertex3D,InterfaceEdge3D> layout2d); UndirectedGraph<ChainVertex3D, InterfaceEdge3DSourced<ChainVertex3D>> getGraph2D(); static void main(String[] args); static final String TEMPLATE_ASSEMBLY_DIAGRAM_FULL; static final String TEMPLATE_ASSEMBLY_DIAGRAM_THUMB; static final String TEMPLATE_3DMOL; static final String MUSTACHE_TEMPLATE_NGL; }