public void setXMLEntity(XMLEntity xml) { setDescription(xml.getStringProperty("desc")); setIsShapeVisible(xml.getBooleanProperty("isShapeVisible")); markerSymbol = (AbstractMarkerSymbol) SymbologyFactory.createSymbolFromXML(xml.getChild(0), null); markerFillProperties = (SimpleMarkerFillPropertiesStyle) SymbologyFactory.createStyleFromXML(xml.getChild(1), null); if (xml.contains("unit")) { // remove this line when done // measure unit (for outline) setUnit(xml.getIntProperty("unit")); // reference system (for outline) setReferenceSystem(xml.getIntProperty("referenceSystem")); } if (xml.contains("hasOutline")) { XMLEntity outlineXML = xml.firstChild("id", "outline symbol"); if (outlineXML != null) { setOutline((ILineSymbol) SymbologyFactory.createSymbolFromXML(outlineXML, "outline")); } } }
/** * Reads the stored toolbars' status from plugin-persinstence.xml, and sets the toolbars * accordingly. */ private void getPersistedStatus() { PluginServices ps = PluginServices.getPluginServices(this); XMLEntity xml = ps.getPersistentXML(); XMLEntity child = null; for (int i = xml.getChildrenCount() - 1; i >= 0; i--) { if (xml.getChild(i).getName().equals("Toolbars")) child = xml.getChild(i).getChild(0); } if (child != null) { SelectableToolBar[] toolBars = PluginServices.getMainFrame().getToolbars(); for (int i = toolBars.length - 1; i >= 0; i--) { if (child.contains(toolBars[i].getName())) toolBars[i].setAndamiVisibility( child.getStringProperty(toolBars[i].getName()).equals("visible")); } } }
/** * Save the status of the provided toolbar. * * @param toolbarName The toolbar name whose status wants to be saved. * @param visible Whether or not the toolbar is visible. */ private void persistStatus(String toolbarName, boolean visible) { PluginServices ps = PluginServices.getPluginServices(this); XMLEntity xml = ps.getPersistentXML(); XMLEntity child = null; for (int i = xml.getChildrenCount() - 1; i >= 0; i--) { if (xml.getChild(i).getName().equals("Toolbars")) child = xml.getChild(i).getChild(0); } if (child == null) { XMLEntity toolbars = new XMLEntity(); toolbars.setName("Toolbars"); child = new XMLEntity(); toolbars.addChild(child); xml.addChild(toolbars); } if (visible) { child.putProperty(toolbarName, "visible"); } else { child.putProperty(toolbarName, "hidden"); } ps.setPersistentXML(xml); }