Refine search
public void saveData(@NotNull Element element) { if (isKeyRepeat != null) { final Element editor = new Element("editor"); element.addContent(editor); final Element keyRepeat = new Element("key-repeat"); keyRepeat.setAttribute("enabled", Boolean.toString(isKeyRepeat)); editor.addContent(keyRepeat); } }
private void saveData(@NotNull Element element, String key) { final HistoryBlock block = histories.get(key); if (block == null) { return; } final Element root = new Element("history-" + key); for (HistoryEntry entry : block.getEntries()) { final Element entryElement = new Element("entry"); StringHelper.setSafeXmlText(entryElement, entry.getEntry()); root.addContent(entryElement); } element.addContent(root); }
private Element createShortElement(final int value) { Element GeoKeyRecord = new Element(GeoTiffConstants.GEOTIFF_SHORT_TAG); GeoKeyRecord.setAttribute(GeoTiffConstants.VALUE_ATTRIBUTE, String .valueOf(value)); return GeoKeyRecord; }
public void saveData(@NotNull Element element) { final Element conflictsElement = new Element(SHORTCUT_CONFLICTS_ELEMENT); for (Map.Entry<KeyStroke, ShortcutOwner> entry : shortcutConflicts.entrySet()) { final ShortcutOwner owner = entry.getValue(); if (owner != ShortcutOwner.UNDEFINED) { final Element conflictElement = new Element(SHORTCUT_CONFLICT_ELEMENT); conflictElement.setAttribute(OWNER_ATTRIBUTE, owner.getName()); final Element textElement = new Element(TEXT_ELEMENT); StringHelper.setSafeXmlText(textElement, entry.getKey().toString()); conflictElement.addContent(textElement); conflictsElement.addContent(conflictElement); } } element.addContent(conflictsElement); }
private Element mapZone(Zone zone) { Element zoneElement = new Element(ZONE_ELMT); zoneElement.addContent(new Element(ZONE_ID_ELMT).setText(Integer.toString(zone.getId()))); String proximityListTest = StringUtils.join(zone.getProximityList().toArray(), ", "); zoneElement.addContent(new Element(ZONE_PROXIMITY_LIST_ELMT).setText(proximityListTest)); return zoneElement; }
private Element createAsciiElement(final String value) { Element param = new Element(GeoTiffConstants.GEOTIFF_ASCII_TAG); param.setAttribute(GeoTiffConstants.VALUE_ATTRIBUTE, String.valueOf(value)); return param; }
public void saveData(@NotNull final Element element) { logger.debug("saveData"); final Element registersElement = new Element("registers"); for (Character key : registers.keySet()) { final Register register = registers.get(key); final Element registerElement = new Element("register"); registerElement.setAttribute("name", String.valueOf(key)); registerElement.setAttribute("type", Integer.toString(register.getType().getValue())); final String text = register.getText(); if (text != null) { final Element textElement = new Element("text"); StringHelper.setSafeXmlText(textElement, text); registerElement.addContent(textElement); } else { final Element keys = new Element("keys"); final List<KeyStroke> list = register.getKeys(); for (KeyStroke stroke : list) { final Element k = new Element("key"); k.setAttribute("char", Integer.toString(stroke.getKeyChar())); k.setAttribute("code", Integer.toString(stroke.getKeyCode())); k.setAttribute("mods", Integer.toString(stroke.getModifiers())); keys.addContent(k); } registerElement.addContent(keys); } registersElement.addContent(registerElement); } element.addContent(registersElement); }
private Element mapServer(Node node, boolean displayZones) { Element server = new Element(SERVER_ELMT); server.addContent(new Element(SERVER_ID_ELMT).setText(Integer.toString(node.getId()))); server.addContent(new Element(HOST_ELMT).setText(node.getHost())); server.addContent(new Element(HTTP_PORT_ELMT).setText(Integer.toString(node.getHttpPort()))); server.addContent(new Element(SOCKET_PORT_ELMT).setText(Integer.toString(node.getSocketPort()))); server.addContent(new Element(ADMIN_PORT_ELMT).setText(Integer.toString(node.getAdminPort()))); if(node.getRestPort() > 0) { server.addContent(new Element(REST_PORT_ELMT).setText(Integer.toString(node.getRestPort()))); } String serverPartitionsText = StringUtils.join(node.getPartitionIds().toArray(), ", "); server.addContent(new Element(SERVER_PARTITIONS_ELMT).setText(serverPartitionsText)); if(displayZones) server.addContent(new Element(ZONE_ID_ELMT).setText(Integer.toString(node.getZoneId()))); return server; } }
private Element createFieldElement(final TIFFTag tag) { Element field = new Element(GeoTiffConstants.GEOTIFF_FIELD_TAG); field.setAttribute(GeoTiffConstants.NUMBER_ATTRIBUTE, String.valueOf(tag .getNumber())); field.setAttribute(GeoTiffConstants.NAME_ATTRIBUTE, tag.getName()); return field; }
@Override public Element getState() { LOG.debug("Saving state"); final Element element = new Element("ideavim"); // Save whether the plugin is enabled or not final Element state = new Element("state"); state.setAttribute("version", Integer.toString(STATE_VERSION)); state.setAttribute("enabled", Boolean.toString(enabled)); element.addContent(state); mark.saveData(element); register.saveData(element); search.saveData(element); history.saveData(element); key.saveData(element); editor.saveData(element); return element; }
public String writeCluster(Cluster cluster) { Document doc = new Document(new Element(CLUSTER_ELMT)); doc.getRootElement().addContent(new Element(CLUSTER_NAME_ELMT).setText(cluster.getName())); boolean displayZones = cluster.getZones().size() > 1; if(displayZones) { for(Zone n: cluster.getZones()) doc.getRootElement().addContent(mapZone(n)); } for(Node n: cluster.getNodes()) doc.getRootElement().addContent(mapServer(n, displayZones)); XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat()); return serializer.outputString(doc.getRootElement()); }
protected Element createRootElement(Feed feed) { Element root = new Element("feed",getFeedNamespace()); root.addNamespaceDeclaration(getFeedNamespace()); //Attribute version = new Attribute("version", getVersion()); //root.setAttribute(version); if (feed.getXmlBase() != null) { root.setAttribute("base", feed.getXmlBase(), Namespace.XML_NAMESPACE); } generateModuleNamespaceDefs(root); return root; }
/** * Creates {@link Element} with a list of the {@link UserTemplate} items. * * @param userTemplates templates * @return {@link Element} instance with user templates */ public static Element createTemplatesElement(@NotNull List<UserTemplate> userTemplates) { Element templates = new Element(KEY.USER_TEMPLATES.toString()); for (UserTemplate userTemplate : userTemplates) { Element templateElement = new Element(KEY.USER_TEMPLATES_TEMPLATE.toString()); templateElement.setAttribute(KEY.USER_TEMPLATES_NAME.toString(), userTemplate.getName()); templateElement.addContent(userTemplate.getContent()); templates.addContent(templateElement); } return templates; }
public void saveData(@NotNull Element element) { logger.debug("saveData"); Element search = new Element("search"); if (lastSearch != null) { search.addContent(createElementWithText("last-search", lastSearch)); } if (lastOffset != null) { search.addContent(createElementWithText("last-offset", lastOffset)); } if (lastPattern != null) { search.addContent(createElementWithText("last-pattern", lastPattern)); } if (lastReplace != null) { search.addContent(createElementWithText("last-replace", lastReplace)); } if (lastSubstitute != null) { search.addContent(createElementWithText("last-substitute", lastSubstitute)); } Element text = new Element("last-dir"); text.addContent(Integer.toString(lastDir)); search.addContent(text); text = new Element("show-last"); text.addContent(Boolean.toString(showSearchHighlight)); if (logger.isDebugEnabled()) logger.debug("text=" + text); search.addContent(text); element.addContent(search); }
protected Element createRootElement(Channel channel) { Element root = new Element("rss",getFeedNamespace()); Attribute version = new Attribute("version", getVersion()); root.setAttribute(version); root.addNamespaceDeclaration(getContentNamespace()); generateModuleNamespaceDefs(root); return root; }
public static void addSerializer(Element parent, SerializerDefinition def) { parent.addContent(new Element(STORE_SERIALIZATION_TYPE_ELMT).setText(def.getName())); if(def.hasSchemaInfo()) { for(Map.Entry<Integer, String> entry: def.getAllSchemaInfoVersions().entrySet()) { Element schemaElmt = new Element(STORE_SERIALIZATION_META_ELMT); if(def.hasVersion()) schemaElmt.setAttribute(STORE_VERSION_ATTR, Integer.toString(entry.getKey())); else schemaElmt.setAttribute(STORE_VERSION_ATTR, "none"); schemaElmt.setText(entry.getValue()); parent.addContent(schemaElmt); } } if(def.hasCompression()) { Compression compression = def.getCompression(); Element compressionElmt = new Element(STORE_COMPRESSION_ELMT); Element type = new Element(STORE_COMPRESSION_TYPE_ELMT); type.setText(compression.getType()); compressionElmt.addContent(type); String optionsText = compression.getOptions(); if(optionsText != null) { Element options = new Element(STORE_COMPRESSION_OPTIONS_ELMT); options.setText(optionsText); compressionElmt.addContent(options); } parent.addContent(compressionElmt); } }
/** * Given a storedefinition, constructs the xml string to be sent out in * response to a "schemata" fetch request * * @param storeDefinition * @return serialized store definition */ public static String constructSerializerInfoXml(StoreDefinition storeDefinition) { Element store = new Element(StoreDefinitionsMapper.STORE_ELMT); store.addContent(new Element(StoreDefinitionsMapper.STORE_NAME_ELMT).setText(storeDefinition.getName())); Element keySerializer = new Element(StoreDefinitionsMapper.STORE_KEY_SERIALIZER_ELMT); StoreDefinitionsMapper.addSerializer(keySerializer, storeDefinition.getKeySerializer()); store.addContent(keySerializer); Element valueSerializer = new Element(StoreDefinitionsMapper.STORE_VALUE_SERIALIZER_ELMT); StoreDefinitionsMapper.addSerializer(valueSerializer, storeDefinition.getValueSerializer()); store.addContent(valueSerializer); XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat()); return serializer.outputString(store); }
protected Element createRootElement(Feed feed) { Element root = new Element("feed",getFeedNamespace()); root.addNamespaceDeclaration(getFeedNamespace()); Attribute version = new Attribute("version", getVersion()); root.setAttribute(version); generateModuleNamespaceDefs(root); return root; }
public void saveData(@NotNull Element element) { Element marksElem = new Element("globalmarks"); for (Mark mark : globalMarks.values()) { if (!mark.isClear()) { Element markElem = new Element("mark"); markElem.setAttribute("key", Character.toString(mark.getKey())); markElem.setAttribute("line", Integer.toString(mark.getLogicalLine())); markElem.setAttribute("column", Integer.toString(mark.getCol())); marksElem.addContent(markElem); if (logger.isDebugEnabled()) { logger.debug("saved mark = " + mark); element.addContent(marksElem); Element fileMarksElem = new Element("filemarks"); Element fileMarkElem = new Element("file"); if (!mark.isClear() && !Character.isUpperCase(mark.getKey()) && SAVE_FILE_MARKS.indexOf(mark.getKey()) >= 0) { Element markElem = new Element("mark"); fileMarkElem.addContent(markElem); Element jumpsElem = new Element("jumps"); for (Jump jump : jumps) { if (!jump.isClear()) { Element jumpElem = new Element("jump");
public String writeStoreList(List<StoreDefinition> stores) { Element root = new Element(STORES_ELMT); for(StoreDefinition def: stores) { if(def.isView()) root.addContent(viewToElement(def)); else root.addContent(storeToElement(def)); } XMLOutputter serializer = new XMLOutputter(Format.getPrettyFormat()); return serializer.outputString(root); }