private static InputStream getFromStringContext(String path) { if(path.startsWith("classpath:")) { return getStream(path.split("classpath:")[1]); } return null; } }
/** * Get the single instance of icon reolver. When first time loading, it will search for spring bean * nammed 'IconDefinitionFiles", and will load all files inside it. */ public static ModelIconUtils instance() { if (instance == null) { instance = (ModelIconUtils) Services.getBean("ModelIconUtils"); List<String> iconDefinitionFiles = (List<String>) Services.getBean("IconDefinitionFiles"); for (String definition : iconDefinitionFiles) { Properties definitionMapping = new Properties(); try (InputStream is = ResourceUtils.getStream(ModelIconUtils.class, definition)) { definitionMapping.load(is); instance.iconMapping.putAll(definitionMapping); } catch (Exception ex) { ex.printStackTrace(); } } } return instance; }
/** * Merge views definitions corresponding to this view. View must define at least one * wizardConfiguration. */ @Override public VLViewConfigXML getConfigurationFile(final IEmaginController controller) { VLViewConfigXML finalResult = null; if(debug) { System.out.println("Searching for wiew : " + controller.getViewDefinitions().get(0)); } String file = controller.getViewDefinitions().get(0); if(file.endsWith(".xml")) { throw new RuntimeException("Only Json configurration file is supported, given" + file); } if(debug) { System.out.println("### Searching for wiew : " + file); } Gson gson = new Gson(); InputStream io = ResourceUtils.getStream(controller.getClass(), file); finalResult = gson.fromJson(new InputStreamReader(io), VLViewConfigXML.class); return finalResult; } }
try(InputStream io = ResourceUtils.getStream(getClass(), coreAttributes)){ Gson gson1 = new Gson(); VLViewConfigXML c = gson1.fromJson(new InputStreamReader(io), VLViewConfigXML.class); try(InputStream io = ResourceUtils.getStream(getClass(), coreComp)){ Gson gson = new Gson(); VLViewConfigXML c = gson.fromJson(new InputStreamReader(io), VLViewConfigXML.class); try(InputStream io = ResourceUtils.getStream(getClass(), coreActions)){ Gson gson = new Gson(); VLViewConfigXML c = gson.fromJson(new InputStreamReader(io), VLViewConfigXML.class); try(InputStream io = ResourceUtils.getStream(getClass(), coreActionsModel)){ Gson gson = new Gson(); VLViewConfigXML c = gson.fromJson(new InputStreamReader(io), VLViewConfigXML.class);
/** * @{inheritedDoc} */ @Override public void buildFrom(IEmaginController controller, VLViewComponentXML configuration) { NodeHelper.styleClassAddAll(this, configuration); try (InputStream is = ResourceUtils.getStream("/images/logo/EMAGIN_FX_WHITE.png")) { if(is != null) { final Image img = new Image(is, 200, 102, true, true); final ImageView imgView = new ImageView(img); // getChildren().add(imgView); } } catch (IOException e) { // e.printStackTrace(); } }
try (InputStream is = ResourceUtils.getStream("/images/logo/EMAGIN_FX_DEMOAPP_DARK.png")) { final Image img = new Image(is, 180, 180, true, true); final ImageView imgView = new ImageView(img);