Example usage for org.dom4j DocumentHelper createElement

List of usage examples for org.dom4j DocumentHelper createElement

Introduction

In this page you can find the example usage for org.dom4j DocumentHelper createElement.

Prototype

public static Element createElement(String name) 

Source Link

Usage

From source file:cc.warlock.core.stormfront.settings.internal.CommandLineConfigurationProvider.java

License:Open Source License

@Override
protected void saveTo(List<Element> elements) {
    Element cElement = DocumentHelper.createElement("command-line");
    elements.add(cElement);/*  ww w  .  j  av  a 2 s .  com*/

    cElement.addAttribute("background", colorString(settings.getBackgroundColor()));
    cElement.addAttribute("foreground", colorString(settings.getForegroundColor()));
    cElement.addAttribute("barColor", colorString(settings.getBarColor()));
    addFontAttributes(settings.getFont(), cElement);
}

From source file:cc.warlock.core.stormfront.settings.StormFrontServerSettings.java

License:Open Source License

@Override
protected void saveTo(List<Element> elements) {
    Element element = DocumentHelper.createElement("stormfront-settings");

    element.addAttribute("client-version", clientVersion);
    element.addAttribute("major-version", majorVersion);
    element.addAttribute("crc", crc);

    elements.add(element);//from   w w  w  .  j a va 2s  .  co m
}

From source file:cc.warlock.rcp.application.WarlockPerspectiveLayout.java

License:Open Source License

public List<Element> getTopLevelElements() {
    Element windowLayout = DocumentHelper.createElement("window-layout");
    windowLayout.addAttribute("x", "" + bounds.x);
    windowLayout.addAttribute("y", "" + bounds.y);
    windowLayout.addAttribute("width", "" + bounds.width);
    windowLayout.addAttribute("height", "" + bounds.height);

    return Arrays.asList(new Element[] { windowLayout });
}

From source file:cc.warlock.rcp.configuration.GameViewConfiguration.java

License:Open Source License

public List<Element> getTopLevelElements() {
    ArrayList<Element> elements = new ArrayList<Element>();
    Element gameView = DocumentHelper.createElement("game-view");
    gameView.addAttribute("buffer", bufferLines + "");
    gameView.addAttribute("suppressPrompt", suppressPrompt + "");

    Element defaultColors = DocumentHelper.createElement("default-colors");
    gameView.add(defaultColors);//from  w w  w.  ja  v a  2  s . c  o  m

    defaultColors.addAttribute("background", defaultBackground.toHexString());
    defaultColors.addAttribute("foreground", defaultForeground.toHexString());
    defaultColors.addAttribute("echo-background", defaultEchoBackground.toHexString());
    defaultColors.addAttribute("echo-foreground", defaultEchoForeground.toHexString());

    Element defaultFont = DocumentHelper.createElement("default-font");
    gameView.add(defaultFont);
    defaultFont.addAttribute("face", defaultFontFace);
    defaultFont.addAttribute("size", defaultFontSize + "");

    elements.add(gameView);
    return elements;
}

From source file:cc.warlock.rcp.stormfront.StormFrontGameViewConfiguration.java

License:Open Source License

public List<Element> getTopLevelElements() {
    ArrayList<Element> elements = new ArrayList<Element>();

    for (Map.Entry<String, String> entry : profileViewMappings.entrySet()) {
        Element profileView = DocumentHelper.createElement("profileView");
        profileView.addAttribute("viewId", entry.getKey());
        profileView.addAttribute("profileId", entry.getValue());
        elements.add(profileView);// w w  w .  ja v  a2s . co  m
    }

    return elements;
}

From source file:ch.javasoft.xml.config.XmlConfig.java

License:BSD License

private static Document createDocument(Element configElement, String configName) {
    final Document doc = DocumentHelper.createDocument();
    final Element configList = DocumentHelper.createElement(XmlElement.config_list.getXmlName());
    configElement.addAttribute(XmlAttribute.name.getXmlName(), configName);
    configList.addAttribute(XmlAttribute.def.getXmlName(), configName);
    configList.add(configElement);// w w  w.  j  a v a  2 s. c  om
    doc.setRootElement(configList);
    return doc;
}

From source file:com.adspore.splat.xep0030.DiscoInfoHandler.java

License:Open Source License

protected void addAnonymousUser() {
    Element userIdentity = DocumentHelper.createElement("identity");
    userIdentity.addAttribute("category", "account");
    userIdentity.addAttribute("type", "anonymous");
    anonymousUserIdentities.add(userIdentity);
}

From source file:com.adspore.splat.xep0030.DiscoInfoHandler.java

License:Open Source License

protected void addRegisteredUser() {
    Element userIdentity = DocumentHelper.createElement("identity");
    userIdentity.addAttribute("category", "account");
    userIdentity.addAttribute("type", "registered");
    registeredUserIdentities.add(userIdentity);
}

From source file:com.adspore.splat.xep0030.DiscoItem.java

License:Open Source License

/**
* Creates a new DiscoItem instance.//from   w  w w  .  j a  v a2s . com
*
* @param jid
*            specifies the Jabber ID of the item "owner" or location
*            (required).
* @param name
*            specifies a natural-language name for the item (can be null).
* @param node
*            specifies the particular node associated with the JID of the
*            item "owner" or location (can be null).
* @param action
*            specifies the action to be taken for the item.
* @throws IllegalArgumentException
*             If a required parameter was null, or if the supplied 'action'
*             parameter has another value than 'null', "update" or
*             "remove".
*/
public DiscoItem(JID jid, String name, String node, String action) {
    if (jid == null) {
        throw new IllegalArgumentException("Argument 'jid' cannot be null.");
    }

    if (action != null && !action.equals("update") && !action.equals("remove")) {
        throw new IllegalArgumentException(
                "Argument 'jid' cannot have any other value than null, \"update\" or \"remove\".");
    }

    this.jid = jid;
    this.name = name;
    this.node = node;
    this.action = action;

    element = DocumentHelper.createElement("item");
    element.addAttribute("jid", jid.toString());
    if (action != null) {
        element.addAttribute("action", action);
    }
    if (name != null) {
        element.addAttribute("name", name);
    }
    if (node != null) {
        element.addAttribute("node", node);
    }
}

From source file:com.adspore.splat.xep0060.models.AuthorizeAccess.java

License:Open Source License

@Override
public Element getSubsriptionErrorDetail() {
    return DocumentHelper
            .createElement(QName.get("not-subscribed", "http://jabber.org/protocol/pubsub#errors"));
}