Search in sources :

Example 31 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class IconNote method setDisableViewExport.

@Override
public void setDisableViewExport(final boolean enabled) {
    // $NON-NLS-1$ //$NON-NLS-2$
    XMLNode node = getDxlNode("/note/item[@name='" + DbProperties.NO_EXPORT_VIEW.getPropertyName() + "']");
    if (enabled) {
        if (node == null) {
            // $NON-NLS-1$ //$NON-NLS-2$
            node = getDxlNode("/note").addChildElement("item");
            // $NON-NLS-1$
            node.setAttribute("name", DbProperties.NO_EXPORT_VIEW.getPropertyName());
            // $NON-NLS-1$ //$NON-NLS-2$
            node.addChildElement("text").setTextContent("1");
        }
    } else {
        if (node != null) {
            node.getParentNode().removeChild(node);
        }
    }
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 32 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class IconNote method setBlockICAA.

@Override
public void setBlockICAA(final boolean enabled) {
    // $NON-NLS-1$ //$NON-NLS-2$
    XMLNode node = getDxlNode("/note/item[@name='" + DbProperties.BLOCK_ICAA.getPropertyName() + "']");
    if (enabled) {
        if (node == null) {
            // $NON-NLS-1$ //$NON-NLS-2$
            node = getDxlNode("/note").addChildElement("item");
            // $NON-NLS-1$
            node.setAttribute("name", DbProperties.BLOCK_ICAA.getPropertyName());
            // $NON-NLS-1$ //$NON-NLS-2$
            node.addChildElement("text").setTextContent("1");
        }
    } else {
        if (node != null) {
            node.getParentNode().removeChild(node);
        }
    }
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 33 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class Subform method getComputedSubforms.

/* (non-Javadoc)
	 * @see org.openntf.domino.design.AnyFormOrSubform#getComputedSubforms()
	 */
@Override
public List<String> getComputedSubforms() {
    XMLNodeList nodes = getSubformNodes();
    ArrayList<String> subforms = new ArrayList<String>();
    for (XMLNode node : nodes) {
        // $NON-NLS-1$
        String name = node.getAttribute("name");
        if (Strings.isBlankString(name)) {
            // $NON-NLS-1$
            subforms.add(node.selectSingleNode("code[@event='value']/formula").getText());
        }
    }
    return subforms;
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode) ArrayList(java.util.ArrayList) XMLNodeList(org.openntf.domino.utils.xml.XMLNodeList)

Example 34 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class Subform method addField.

@Override
public FormField addField() {
    XMLNode body = getBody();
    // Create an appropriate paragraph definition
    // $NON-NLS-1$
    XMLNode finalPardef = getDxl().selectSingleNode("//pardef[last()]");
    // $NON-NLS-1$
    int nextId = Integer.valueOf(finalPardef.getAttribute("id")) + 1;
    // $NON-NLS-1$
    XMLNode pardef = body.addChildElement("pardef");
    // $NON-NLS-1$
    pardef.setAttribute("id", String.valueOf(nextId));
    // Now create the par and the field
    // $NON-NLS-1$
    XMLNode par = body.addChildElement("par");
    // $NON-NLS-1$ //$NON-NLS-2$
    par.setAttribute("def", pardef.getAttribute("id"));
    // Now add the field
    // $NON-NLS-1$
    XMLNode field = par.addChildElement("field");
    // $NON-NLS-1$ //$NON-NLS-2$
    field.setAttribute("kind", "editable");
    // $NON-NLS-1$ //$NON-NLS-2$
    field.setAttribute("name", "");
    // $NON-NLS-1$ //$NON-NLS-2$
    field.setAttribute("type", "text");
    return new org.openntf.domino.design.impl.FormField(field);
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode) FormField(org.openntf.domino.design.FormField)

Example 35 with XMLNode

use of org.openntf.domino.utils.xml.XMLNode in project org.openntf.domino by OpenNTF.

the class DesignColumn method setTitle.

@Override
public void setTitle(final String title) {
    // $NON-NLS-1$
    XMLNode columnHeader = node_.selectSingleNode("columnheader");
    if (columnHeader == null) {
        XMLNode firstChild = node_.getFirstChild();
        if (firstChild != null) {
            // $NON-NLS-1$
            columnHeader = node_.insertChildElementBefore("columnheader", firstChild);
        } else {
            // $NON-NLS-1$
            columnHeader = node_.addChildElement("columnheader");
        }
    }
    // $NON-NLS-1$
    columnHeader.setAttribute("title", title);
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Aggregations

XMLNode (org.openntf.domino.utils.xml.XMLNode)35 ArrayList (java.util.ArrayList)7 XMLNodeList (org.openntf.domino.utils.xml.XMLNodeList)3 CDResourceFile (org.openntf.domino.nsfdata.structs.obj.CDResourceFile)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 Database (org.openntf.domino.Database)1 DxlExporter (org.openntf.domino.DxlExporter)1 DatabaseDesign (org.openntf.domino.design.DatabaseDesign)1 FormField (org.openntf.domino.design.FormField)1 OpenNTFNotesException (org.openntf.domino.exceptions.OpenNTFNotesException)1 CData (org.openntf.domino.nsfdata.structs.cd.CData)1 CDObject (org.openntf.domino.nsfdata.structs.obj.CDObject)1 CDResourceEvent (org.openntf.domino.nsfdata.structs.obj.CDResourceEvent)1