@Test public void testCreateFromXMLWithNullSource() { URL context = null; Object source = null; Theme result = ThemeFactory.createFromXML(source, context); assertNull(result); }
public static Theme createFromXML(Object source, URL context) { Element element = XMLUtil.getElementFromSource(source); if (element == null) { return null; } BasicTheme theme = new BasicTheme(XMLUtil.getText(element, "ThemeName")); theme.setMenuBar(XMLUtil.getBoolean(element, "MenuBar", false)); theme.setToolBar(XMLUtil.getBoolean(element, "ToolBar", false)); theme.setStatusBar(XMLUtil.getBoolean(element, "StatusBar", false)); theme.setSideBar(XMLUtil.getBoolean(element, "SideBar", true)); theme.setFullscreen(XMLUtil.getBoolean(element, "Fullscreen", false)); theme.setHasWms(XMLUtil.getBoolean(element, "WmsBrowser", true)); theme.setPersistLayers(XMLUtil.getBoolean(element, "PersistLayers", true)); theme.setLayerPersistanceFilename(XMLUtil.getText(element, "LayersFilename")); theme.setCacheLocations(parseCacheLocations(element, "CacheLocation")); theme.setPersistPlaces(XMLUtil.getBoolean(element, "PersistPlaces", true)); theme.setPlacesPersistanceFilename(XMLUtil.getText(element, "PlacesFilename")); try { theme.setPlacesInitialisationPath(XMLUtil.getURL(element, "InitialPlaces", context)); } catch (MalformedURLException e) { } theme.setHUDs(parseHUDs(element, "HUD")); theme.setPanels(parsePanels(element, "Panel")); theme.setDatasets(parseDatasets(element, "Dataset", context)); theme.setLayers(parseLayers(element, "Layer", context)); theme.setInitialLatitude(XMLUtil.getDouble(element, "InitialLatitude", null)); theme.setInitialLongitude(XMLUtil.getDouble(element, "InitialLongitude", null)); theme.setInitialAltitude(XMLUtil.getDouble(element, "InitialAltitude", null)); theme.setInitialHeading(XMLUtil.getDouble(element, "InitialHeading", null)); theme.setInitialPitch(XMLUtil.getDouble(element, "InitialPitch", null)); theme.setVerticalExaggeration(XMLUtil.getDouble(element, "VerticalExaggeration", null)); theme.setFieldOfView(XMLUtil.getDouble(element, "FieldOfView", null)); return theme; }
ThemeFactory { public static Theme createFromXML(Object source, URL context) { Element element = XMLUtil.getElementFromSource(source); if (element == null) { return null; } BasicTheme theme = new BasicTheme(XMLUtil.getText(element, "ThemeName")); theme.setMenuBar(XMLUtil.getBoolean(element, "MenuBar", false)); theme.setToolBar(XMLUtil.getBoolean(element, "ToolBar", false)); theme.setStatusBar(XMLUtil.getBoolean(element, "StatusBar", false)); theme.setSideBar(XMLUtil.getBoolean(element, "SideBar", true)); theme.setFullscreen(XMLUtil.getBoolean(element, "Fullscreen", false)); theme.setHasWms(XMLUtil.getBoolean(element, "WmsBrowser", true)); theme.setPersistLayers(XMLUtil.getBoolean(element, "PersistLayers", true)); theme.setLayerPersistanceFilename(XMLUtil.getText(element, "LayersFilename")); theme.setCacheLocations(parseCacheLocations(element, "CacheLocation")); theme.setPersistPlaces(XMLUtil.getBoolean(element, "PersistPlaces", true)); theme.setPlacesPersistanceFilename(XMLUtil.getText(element, "PlacesFilename")); try { theme.setPlacesInitialisationPath(XMLUtil.getURL(element, "InitialPlaces", context)); } catch (MalformedURLException e) { } theme.setHUDs(parseHUDs(element, "HUD")); theme.setPanels(parsePanels(element, "Panel")); theme.setDatasets(parseDatasets(element, "Dataset", context)); theme.setLayers(parseLayers(element, "Layer", context)); theme.setInitialLatitude(XMLUtil.getDouble(element, "InitialLatitude", null)); theme.setInitialLongitude(XMLUtil.getDouble(element, "InitialLongitude", null)); theme.setInitialAltitude(XMLUtil.getDouble(element, "InitialAltitude", null)); theme.setInitialHeading(XMLUtil.getDouble(element, "InitialHeading", null)); theme.setInitialPitch(XMLUtil.getDouble(element, "InitialPitch", null)); theme.setVerticalExaggeration(XMLUtil.getDouble(element, "VerticalExaggeration", null)); theme.setFieldOfView(XMLUtil.getDouble(element, "FieldOfView", null)); return theme; } }
ThemeFactory { public static Theme createFromXML(Object source, URL context) { Element element = XMLUtil.getElementFromSource(source); if (element == null) { return null; } BasicTheme theme = new BasicTheme(XMLUtil.getText(element, "ThemeName")); theme.setMenuBar(XMLUtil.getBoolean(element, "MenuBar", false)); theme.setToolBar(XMLUtil.getBoolean(element, "ToolBar", false)); theme.setStatusBar(XMLUtil.getBoolean(element, "StatusBar", false)); theme.setSideBar(XMLUtil.getBoolean(element, "SideBar", true)); theme.setFullscreen(XMLUtil.getBoolean(element, "Fullscreen", false)); theme.setHasWms(XMLUtil.getBoolean(element, "WmsBrowser", true)); theme.setPersistLayers(XMLUtil.getBoolean(element, "PersistLayers", true)); theme.setLayerPersistanceFilename(XMLUtil.getText(element, "LayersFilename")); theme.setCacheLocations(parseCacheLocations(element, "CacheLocation")); theme.setPersistPlaces(XMLUtil.getBoolean(element, "PersistPlaces", true)); theme.setPlacesPersistanceFilename(XMLUtil.getText(element, "PlacesFilename")); try { theme.setPlacesInitialisationPath(XMLUtil.getURL(element, "InitialPlaces", context)); } catch (MalformedURLException e) { } theme.setHUDs(parseHUDs(element, "HUD")); theme.setPanels(parsePanels(element, "Panel")); theme.setDatasets(parseDatasets(element, "Dataset", context)); theme.setLayers(parseLayers(element, "Layer", context)); theme.setInitialLatitude(XMLUtil.getDouble(element, "InitialLatitude", null)); theme.setInitialLongitude(XMLUtil.getDouble(element, "InitialLongitude", null)); theme.setInitialAltitude(XMLUtil.getDouble(element, "InitialAltitude", null)); theme.setInitialHeading(XMLUtil.getDouble(element, "InitialHeading", null)); theme.setInitialPitch(XMLUtil.getDouble(element, "InitialPitch", null)); theme.setVerticalExaggeration(XMLUtil.getDouble(element, "VerticalExaggeration", null)); theme.setFieldOfView(XMLUtil.getDouble(element, "FieldOfView", null)); return theme; }  }
ThemeFactory { public static Theme createFromXML(Object source, URL context) { Element element = XMLUtil.getElementFromSource(source); if (element == null) { return null; } BasicTheme theme = new BasicTheme(XMLUtil.getText(element, "ThemeName")); theme.setMenuBar(XMLUtil.getBoolean(element, "MenuBar", false)); theme.setToolBar(XMLUtil.getBoolean(element, "ToolBar", false)); theme.setStatusBar(XMLUtil.getBoolean(element, "StatusBar", false)); theme.setSideBar(XMLUtil.getBoolean(element, "SideBar", true)); theme.setFullscreen(XMLUtil.getBoolean(element, "Fullscreen", false)); theme.setHasWms(XMLUtil.getBoolean(element, "WmsBrowser", true)); theme.setPersistLayers(XMLUtil.getBoolean(element, "PersistLayers", true)); theme.setLayerPersistanceFilename(XMLUtil.getText(element, "LayersFilename")); theme.setCacheLocations(parseCacheLocations(element, "CacheLocation")); theme.setPersistPlaces(XMLUtil.getBoolean(element, "PersistPlaces", true)); theme.setPlacesPersistanceFilename(XMLUtil.getText(element, "PlacesFilename")); try { theme.setPlacesInitialisationPath(XMLUtil.getURL(element, "InitialPlaces", context)); } catch (MalformedURLException e) { } theme.setHUDs(parseHUDs(element, "HUD")); theme.setPanels(parsePanels(element, "Panel")); theme.setDatasets(parseDatasets(element, "Dataset", context)); theme.setLayers(parseLayers(element, "Layer", context)); theme.setInitialLatitude(XMLUtil.getDouble(element, "InitialLatitude", null)); theme.setInitialLongitude(XMLUtil.getDouble(element, "InitialLongitude", null)); theme.setInitialAltitude(XMLUtil.getDouble(element, "InitialAltitude", null)); theme.setInitialHeading(XMLUtil.getDouble(element, "InitialHeading", null)); theme.setInitialPitch(XMLUtil.getDouble(element, "InitialPitch", null)); theme.setVerticalExaggeration(XMLUtil.getDouble(element, "VerticalExaggeration", null)); theme.setFieldOfView(XMLUtil.getDouble(element, "FieldOfView", null)); return theme; }  static Theme createFromXML(Object source, URL context); }
ThemeFactory { public static Theme createFromXML(Object source, URL context) { Element element = XMLUtil.getElementFromSource(source); if (element == null) { return null; } BasicTheme theme = new BasicTheme(XMLUtil.getText(element, "ThemeName")); theme.setMenuBar(XMLUtil.getBoolean(element, "MenuBar", false)); theme.setToolBar(XMLUtil.getBoolean(element, "ToolBar", false)); theme.setStatusBar(XMLUtil.getBoolean(element, "StatusBar", false)); theme.setSideBar(XMLUtil.getBoolean(element, "SideBar", true)); theme.setFullscreen(XMLUtil.getBoolean(element, "Fullscreen", false)); theme.setHasWms(XMLUtil.getBoolean(element, "WmsBrowser", true)); theme.setPersistLayers(XMLUtil.getBoolean(element, "PersistLayers", true)); theme.setLayerPersistanceFilename(XMLUtil.getText(element, "LayersFilename")); theme.setCacheLocations(parseCacheLocations(element, "CacheLocation")); theme.setPersistPlaces(XMLUtil.getBoolean(element, "PersistPlaces", true)); theme.setPlacesPersistanceFilename(XMLUtil.getText(element, "PlacesFilename")); try { theme.setPlacesInitialisationPath(XMLUtil.getURL(element, "InitialPlaces", context)); } catch (MalformedURLException e) { } theme.setHUDs(parseHUDs(element, "HUD")); theme.setPanels(parsePanels(element, "Panel")); theme.setDatasets(parseDatasets(element, "Dataset", context)); theme.setLayers(parseLayers(element, "Layer", context)); theme.setInitialLatitude(XMLUtil.getDouble(element, "InitialLatitude", null)); theme.setInitialLongitude(XMLUtil.getDouble(element, "InitialLongitude", null)); theme.setInitialAltitude(XMLUtil.getDouble(element, "InitialAltitude", null)); theme.setInitialHeading(XMLUtil.getDouble(element, "InitialHeading", null)); theme.setInitialPitch(XMLUtil.getDouble(element, "InitialPitch", null)); theme.setVerticalExaggeration(XMLUtil.getDouble(element, "VerticalExaggeration", null)); theme.setFieldOfView(XMLUtil.getDouble(element, "FieldOfView", null)); return theme; }  static Theme createFromXML(Object source, URL context);  }