當前位置: 首頁>>代碼示例>>Java>>正文


Java Constants類代碼示例

本文整理匯總了Java中edu.mit.blocks.codeblocks.Constants的典型用法代碼示例。如果您正苦於以下問題:Java Constants類的具體用法?Java Constants怎麽用?Java Constants使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Constants類屬於edu.mit.blocks.codeblocks包,在下文中一共展示了Constants類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getSaveNode

import edu.mit.blocks.codeblocks.Constants; //導入依賴的package包/類
/**
 * Returns a DOM node for the entire workspace. This includes the block
 * workspace, any custom factories, canvas view state and position, pages
 *
 * @param validate If {@code true}, perform a validation of the output
 * against the code blocks schema
 * @return the DOM node for the entire workspace.
 */
public Node getSaveNode(final boolean validate) {
    try {
        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        factory.setNamespaceAware(true);

        DocumentBuilder builder = factory.newDocumentBuilder();
        Document document = builder.newDocument();

        Element documentElement = document.createElementNS(Constants.XML_CODEBLOCKS_NS, "cb:CODEBLOCKS");
        // schema reference
        documentElement.setAttributeNS(XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI, "xsi:schemaLocation", Constants.XML_CODEBLOCKS_NS+" "+Constants.XML_CODEBLOCKS_SCHEMA_URI);

        Node workspaceNode = workspace.getSaveNode(document);
        if (workspaceNode != null) {
            documentElement.appendChild(workspaceNode);
        }

        document.appendChild(documentElement);
        //if (validate) {
        //    validate(document);
        //}

        return document;
    }
    catch (ParserConfigurationException e) {
        throw new RuntimeException(e);
    }
}
 
開發者ID:heqichen,項目名稱:openblocks,代碼行數:37,代碼來源:WorkspaceController.java


注:本文中的edu.mit.blocks.codeblocks.Constants類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。