@Test public void testLoader() throws Exception { String testXml = "<nifty>" + "<registerSound id=\"gong\" filename=\"sound/19546__tobi123__Gong_mf2.wav\" />" + "<style id=\"test\" base=\"else\">" + "<attributes align=\"left\"/>" + "<interact onMouseMove=\"doSomething2()\" />" + "<effect stuff=\"a\">" + "<onStartScreen name=\"start\" />" + "<onHover name=\"test\">" + "<hover name=\"anc\" />" + "</onHover>" + "<onStartScreen name=\"start-2\" />" + "</effect>" + "</style>" + "<style id=\"test2\" base=\"else2\">" + "<attributes align=\"right\"/>" + "</style>" + "<screen id=\"screen\" controller=\"de.lessvoid.nifty.loaderv2.NiftyLoaderTest#DummyScreenController\">" + "<layer id=\"layer1\">" + "<panel id=\"panel-1\">" + "<image id=\"image-3\">" + "<label id=\"label-1\">" + "</label>" + "</image>" + "</panel>" + "<panel id=\"panel-2\">" + "</panel>" + "<image id=\"image-1\">" + "</image>" + "<image id=\"image-2\">" + "</image>" + "</layer>" + "</screen>" + "</nifty>"; niftyLoader.loadNiftyXml("nifty.nxs", new ByteArrayInputStream(testXml.getBytes("ISO-8859-1"))); }
@Nonnull public NiftyType loadNiftyXml( @Nonnull final String schemaId, @Nonnull @WillClose final InputStream inputStreamXml) throws Exception { try { long start = timeProvider.getMsTime(); log.fine("loading new nifty xml file with schemaId [" + schemaId + "]"); XmlParser parser = new XmlParser(parserFactory.newPullParser()); parser.read(inputStreamXml); NiftyType niftyType = (NiftyType) getSchema(schemaId).loadXml(parser); niftyType.loadStyles(this, nifty); niftyType.loadControls(this); long end = timeProvider.getMsTime(); log.fine("loaded nifty xml file with schemaId [" + schemaId + "] took [" + (end - start) + " ms]"); return niftyType; } finally { closeSilently(inputStreamXml); } }
NiftyLoader { @Nonnull public NiftyType loadNiftyXml( @Nonnull final String schemaId, @Nonnull @WillClose final InputStream inputStreamXml) throws Exception { try { long start = timeProvider.getMsTime(); log.fine("loading new nifty xml file with schemaId [" + schemaId + "]"); XmlParser parser = new XmlParser(parserFactory.newPullParser()); parser.read(inputStreamXml); NiftyType niftyType = (NiftyType) getSchema(schemaId).loadXml(parser); niftyType.loadStyles(this, nifty); niftyType.loadControls(this); long end = timeProvider.getMsTime(); log.fine("loaded nifty xml file with schemaId [" + schemaId + "] took [" + (end - start) + " ms]"); return niftyType; } finally { closeSilently(inputStreamXml); } } }
NiftyLoader { @Nonnull public NiftyType loadNiftyXml( @Nonnull final String schemaId, @Nonnull @WillClose final InputStream inputStreamXml) throws Exception { try { long start = timeProvider.getMsTime(); log.fine("loading new nifty xml file with schemaId [" + schemaId + "]"); XmlParser parser = new XmlParser(parserFactory.newPullParser()); parser.read(inputStreamXml); NiftyType niftyType = (NiftyType) getSchema(schemaId).loadXml(parser); niftyType.loadStyles(this, nifty); niftyType.loadControls(this); long end = timeProvider.getMsTime(); log.fine("loaded nifty xml file with schemaId [" + schemaId + "] took [" + (end - start) + " ms]"); return niftyType; } finally { closeSilently(inputStreamXml); } } NiftyLoader(@Nonnull final Nifty nifty, @Nonnull final TimeProvider timeProvider); }
NiftyLoader { @Nonnull public NiftyType loadNiftyXml( @Nonnull final String schemaId, @Nonnull @WillClose final InputStream inputStreamXml) throws Exception { try { long start = timeProvider.getMsTime(); log.fine("loading new nifty xml file with schemaId [" + schemaId + "]"); XmlParser parser = new XmlParser(parserFactory.newPullParser()); parser.read(inputStreamXml); NiftyType niftyType = (NiftyType) getSchema(schemaId).loadXml(parser); niftyType.loadStyles(this, nifty); niftyType.loadControls(this); long end = timeProvider.getMsTime(); log.fine("loaded nifty xml file with schemaId [" + schemaId + "] took [" + (end - start) + " ms]"); return niftyType; } finally { closeSilently(inputStreamXml); } } NiftyLoader(@Nonnull final Nifty nifty, @Nonnull final TimeProvider timeProvider); @Nonnull NiftyType loadNiftyXml(
      @Nonnull final String schemaId,
      @Nonnull @WillClose final InputStream inputStreamXml); @Deprecated boolean validateNiftyXml(@Nonnull @WillClose final InputStream inputStreamXml); boolean validateNiftyXml(
      @Nonnull final String schemaId,
      @Nonnull @WillClose final InputStream inputStreamXml); void loadStyleFile(
      @Nonnull final String schemaId,
      @Nonnull final String styleFilename,
      @Nonnull final NiftyType niftyType,
      @Nonnull final Nifty nifty); void loadControlFile(
      @Nonnull final String schemaId,
      @Nonnull final String controlFilename,
      @Nonnull final NiftyType niftyType); void registerSchema(
      @Nonnull final String schemaId,
      @Nonnull @WillClose final InputStream inputStreamSchema); }
NiftyLoader { @Nonnull public NiftyType loadNiftyXml( @Nonnull final String schemaId, @Nonnull @WillClose final InputStream inputStreamXml) throws Exception { try { long start = timeProvider.getMsTime(); log.fine("loading new nifty xml file with schemaId [" + schemaId + "]"); XmlParser parser = new XmlParser(parserFactory.newPullParser()); parser.read(inputStreamXml); NiftyType niftyType = (NiftyType) getSchema(schemaId).loadXml(parser); niftyType.loadStyles(this, nifty); niftyType.loadControls(this); long end = timeProvider.getMsTime(); log.fine("loaded nifty xml file with schemaId [" + schemaId + "] took [" + (end - start) + " ms]"); return niftyType; } finally { closeSilently(inputStreamXml); } } NiftyLoader(@Nonnull final Nifty nifty, @Nonnull final TimeProvider timeProvider); @Nonnull NiftyType loadNiftyXml(
      @Nonnull final String schemaId,
      @Nonnull @WillClose final InputStream inputStreamXml); @Deprecated boolean validateNiftyXml(@Nonnull @WillClose final InputStream inputStreamXml); boolean validateNiftyXml(
      @Nonnull final String schemaId,
      @Nonnull @WillClose final InputStream inputStreamXml); void loadStyleFile(
      @Nonnull final String schemaId,
      @Nonnull final String styleFilename,
      @Nonnull final NiftyType niftyType,
      @Nonnull final Nifty nifty); void loadControlFile(
      @Nonnull final String schemaId,
      @Nonnull final String controlFilename,
      @Nonnull final NiftyType niftyType); void registerSchema(
      @Nonnull final String schemaId,
      @Nonnull @WillClose final InputStream inputStreamSchema);  }