Example usage for org.jdom2 Element setAttribute

List of usage examples for org.jdom2 Element setAttribute

Introduction

In this page you can find the example usage for org.jdom2 Element setAttribute.

Prototype

public Element setAttribute(final String name, final String value) 

Source Link

Document

This sets an attribute value for this element.

Usage

From source file:de.openVJJ.InputComponents.java

License:Open Source License

private static Element componetToXML(VJJComponent component) {
    Element element = new Element(COMPONENT_ELEMENT_NAME);

    element.setAttribute(CLASS_NAME_ATTRIBUTE_NAME, component.getClass().getName());

    Element componentSetup = new Element(COMPONENT_SETUP_ELEMENT_NAME);
    component.getConfig(componentSetup);
    element.addContent(componentSetup);//  ww  w .  j  a  va 2 s.c o m

    if (ImagePublisher.class.isInstance(component)) {
        ImagePublisher imagePublisher = (ImagePublisher) component;
        Element compnetsElement = new Element(COMPONENTS_ELEMENT_NAME);
        for (ImageListener imageListener : imagePublisher.getImageListenerList()) {
            compnetsElement.addContent(componetToXML(imageListener));
        }
        element.addContent(compnetsElement);
    }

    return element;
}

From source file:de.openVJJ.plugins.LineFromSorbel2DIntArray.java

License:Open Source License

/**
 * for saving configuration /*from w ww .ja va  2  s .  c  o  m*/
 * @param element to save configuration to.
 */
public void getConfig(Element element) {
    Element myConfigElement = new Element(ELEMENT_NAME_LineFromSorbel2DIntArray_CONFIG);
    element.addContent(myConfigElement);
    myConfigElement.setAttribute("directionx", String.valueOf(xDirection));
    myConfigElement.setAttribute("lineLimit", String.valueOf(lineLimit));
    myConfigElement.setAttribute("histery", String.valueOf(histery));
    myConfigElement.setAttribute("minLength", String.valueOf(minLength));
    super.getConfig(element);
}

From source file:de.openVJJ.plugins.PixelLineToVectors.java

License:Open Source License

/**
 * for saving configuration /*w ww  . ja  v  a  2  s .co m*/
 * @param element to save configuration to.
 */
public void getConfig(Element element) {
    Element myConfigElement = new Element(ELEMENT_NAME_PixelLineToVectors_CONFIG);
    element.addContent(myConfigElement);
    myConfigElement.setAttribute("horizontal", String.valueOf(horizontal));
    super.getConfig(element);
}

From source file:de.openVJJ.plugins.PointsToLineOfBestFit.java

License:Open Source License

/**
 * for saving configuration //from w  w  w  . j a va  2 s.  c  o m
 * @param element to save configuration to.
 */
public void getConfig(Element element) {
    Element myConfigElement = new Element(ELEMENT_NAME_PointsToLineOfBestFit_CONFIG);
    element.addContent(myConfigElement);
    myConfigElement.setAttribute("directionx", String.valueOf(xDirection));
    myConfigElement.setAttribute("minLength", String.valueOf(minLength));
    super.getConfig(element);
}

From source file:de.openVJJ.plugins.XuggleWebCam.java

License:Open Source License

/**
 * for saving configuration //  w  w  w.j a  va 2  s. co  m
 * @param element to save configuration to.
 */
public void getConfig(Element element) {
    Element myConfigElement = new Element(ELEMENT_NAME_XuggleWebCam_CONFIG);
    element.addContent(myConfigElement);
    myConfigElement.setAttribute("driverName", driverName);
    myConfigElement.setAttribute("deviceName", deviceName);
    myConfigElement.setAttribute("framerateLimit", String.valueOf(framerateLimit));
    super.getConfig(element);
}

From source file:de.openVJJ.processor.GammaCorrection.java

License:Open Source License

@Override
public void getConfig(Element element) {
    element.setAttribute("gammaR", String.valueOf(gammaR));
    element.setAttribute("gammaG", String.valueOf(gammaG));
    element.setAttribute("gammaB", String.valueOf(gammaB));
}

From source file:de.openVJJ.processor.LinearRGBCorrection.java

License:Open Source License

@Override
public void getConfig(Element element) {
    element.setAttribute("mulR", String.valueOf(mulR));
    element.setAttribute("mulG", String.valueOf(mulG));
    element.setAttribute("mulB", String.valueOf(mulB));
}

From source file:de.openVJJ.processor.Resolution.java

License:Open Source License

@Override
public void getConfig(Element element) {
    element.setAttribute("width", String.valueOf(width));
    element.setAttribute("height", String.valueOf(height));
}

From source file:de.openVJJ.processor.Warping.java

License:Open Source License

@Override
public void getConfig(Element element) {
    element.setAttribute("pointTLx", String.valueOf(pointTL.x));
    element.setAttribute("pointTLy", String.valueOf(pointTL.y));
    element.setAttribute("pointBLx", String.valueOf(pointBL.x));
    element.setAttribute("pointBLy", String.valueOf(pointBL.y));
    element.setAttribute("pointTRx", String.valueOf(pointTR.x));
    element.setAttribute("pointTRy", String.valueOf(pointTR.y));
    element.setAttribute("pointBRx", String.valueOf(pointBR.x));
    element.setAttribute("pointBRy", String.valueOf(pointBR.y));
}

From source file:de.relaunch64.popelganda.database.CustomScripts.java

License:Open Source License

/**
 * Adds a new script./*from  w w w.  ja v  a2s .  c o m*/
 * 
 * @param name the name of the new script
 * @param content the content of the new script
 * @return {@code true} if script was successfully added.
 */
public boolean addScript(String name, String content) {
    // check for valid values
    if (null == name || name.isEmpty() || null == content || content.isEmpty())
        return false;
    // check if element exists
    int pos = findScript(name);
    // script already exists, so update
    if (pos != -1) {
        // retrieve element
        Element el = retrieveElement(pos);
        // change content
        if (el != null) {
            el.setText(content);
        } else {
            return false;
        }
    }
    // script does not exist, so add
    else {
        // create new element
        Element el = new Element(ELEMENT_SCRIPT);
        // add attribute
        el.setAttribute(ATTR_NAME, name);
        // add content
        el.setText(content);
        // add to document
        scriptFile.getRootElement().addContent(el);
    }
    return true;
}