Search in sources :

Example 21 with XMLNode

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

the class AbstractFolder method setAllowDAS.

public void setAllowDAS(final boolean allowDAS) {
    XMLNode node = getDxlNode("//item[@name='$WebFlags']/text");
    if (node == null) {
        node = getDxl().getDocumentElement().addChildElement("item");
        node.setAttribute("name", "$WebFlags");
        node = node.addChildElement("text");
    }
    if (allowDAS) {
        if (!node.getText().contains("A")) {
            node.setText(node.getText() + "A");
        }
    } else {
        if (node.getText().contains("A")) {
            node.setText(node.getText().replace("A", ""));
        }
    }
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 22 with XMLNode

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

the class AbstractFolder method getOnRefreshUISetting.

@Override
public OnRefreshType getOnRefreshUISetting() {
    XMLNode viewNode = getDxl().selectSingleNode("/view");
    String value = viewNode.getAttribute("onrefresh");
    for (OnRefreshType type : OnRefreshType.values()) {
        if (type.getPropertyName().equals(value)) {
            return type;
        }
    }
    return null;
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 23 with XMLNode

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

the class AbstractFolder method addColumn.

/*
	 * (non-Javadoc)
	 *
	 * @see org.openntf.domino.design.DesignColumnList#addColumn()
	 */
@Override
public DesignColumn addColumn() {
    // Create the column node and set the defaults
    // Make sure to add the node before any items
    XMLNode node;
    XMLNode item = getDxl().selectSingleNode("//item");
    if (item != null) {
        node = getDocumentElement().insertChildElementBefore("column", item);
    } else {
        node = getDocumentElement().addChildElement("column");
    }
    node.setAttribute("hidedetailrows", "false");
    node.setAttribute("width", "10");
    node.setAttribute("resizable", "true");
    node.setAttribute("separatemultiplevalues", "false");
    node.setAttribute("sortnoaccent", "false");
    node.setAttribute("sortnocase", "true");
    node.setAttribute("showaslinks", "false");
    return new DesignColumn(node);
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 24 with XMLNode

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

the class AbstractFolder method setOnRefreshUISetting.

@Override
public void setOnRefreshUISetting(final OnRefreshType onRefreshUISetting) {
    XMLNode viewNode = getDxl().selectSingleNode("/view");
    viewNode.setAttribute("onrefresh", onRefreshUISetting.getPropertyName());
}
Also used : XMLNode(org.openntf.domino.utils.xml.XMLNode)

Example 25 with XMLNode

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

the class AbstractDesignBase method getDxl.

protected final XMLDocument getDxl() {
    if (dxl_ == null) {
        DxlExporter exporter = getAncestorSession().createDxlExporter();
        exporter.setOutputDOCTYPE(false);
        exporter.setForceNoteFormat(enforceRawFormat());
        // TODO: You will get an exporter error, if the design is protected. This should be handled correctly
        String xml = doExport(exporter);
        loadDxl(xml);
        if (dxl_ == null) {
            // $NON-NLS-1$
            throw new IllegalStateException(getClass().getSimpleName() + ": Could not load DXL");
        }
        XMLNode docRoot = getDocumentElement();
        if (docRoot.getNodeName() == "note") {
            // $NON-NLS-1$
            if (!enforceRawFormat()) {
                throw new UnsupportedOperationException(// $NON-NLS-1$
                getClass().getSimpleName() + ": got note in RAW format. this was not expected. NoteID " + // $NON-NLS-1$
                (document_ == null ? "" : document_.getNoteID()));
            }
            dxlFormat_ = DxlFormat.RAWNOTE;
        } else {
            if (enforceRawFormat()) {
                throw new UnsupportedOperationException(// $NON-NLS-1$
                getClass().getSimpleName() + ": Raw format was enforced, but we got a " + docRoot.getNodeName());
            }
            dxlFormat_ = DxlFormat.DXL;
        }
    }
    return dxl_;
}
Also used : DxlExporter(org.openntf.domino.DxlExporter) 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