Package org.openquark.cal.caldoc.CALDocToHTMLUtilities

Examples of org.openquark.cal.caldoc.CALDocToHTMLUtilities.ContentConvertibleToHTML


    private void generateStandardSupplementaryBlocks(final CALFeatureMetadata metadata, final CALDocComment docComment, ReferenceGenerator referenceGenerator) {
       
        /// Obtain the various blocks from the CALDoc comment, if docComment is not null
        //
        CALDocComment.TextBlock versionBlock = null;
        ContentConvertibleToHTML valueFromAuthorBlocks = null;
        ContentConvertibleToHTML valueFromSeeBlocks = null;
       
        if (docComment != null) {
            versionBlock = docComment.getVersionBlock();
           
            /// Construct a ContentConvertibleToHTML instance to represent the contents of *all* the author blocks
            //
            valueFromAuthorBlocks = new ContentConvertibleToHTML() {
                private final int nAuthorBlocks = docComment.getNAuthorBlocks();
                /** {@inheritDoc} */
                @Override
                boolean isEmpty() {
                    return nAuthorBlocks == 0;
                }
                /** {@inheritDoc} */
                @Override
                void generateHTML(HTMLBuilder currentPage, CALDocToHTMLUtilities.CrossReferenceHTMLGenerator referenceGenerator) {
                    for (int i = 0; i < nAuthorBlocks; i++) {
                        if (i > 0) {
                            currentPage.addText(LocalizableUserVisibleString.COMMA_AND_SPACE.toResourceString());
                        }
                        CALDocToHTMLUtilities.generateHTMLForCALDocTextBlock(docComment.getNthAuthorBlock(i), currentPage, referenceGenerator, StyleClassConstants.CODE_BLOCK, CODE_FORMATTING_TAG);
                    }
                }
            };
           
            /// Construct a ContentConvertibleToHTML instance to represent the contents of *all* the see blocks
            //
            valueFromSeeBlocks = new ContentConvertibleToHTML() {
                private final int nModuleReferences = docComment.getNModuleReferences();
                private final int nTypeClassModuleReferences = docComment.getNTypeClassReferences();
                private final int nTypeConstructorReferences = docComment.getNTypeConstructorReferences();
                private final int nDataConstructorReferences = docComment.getNDataConstructorReferences();
                private final int nFunctionOrClassMethodReferences = docComment.getNFunctionOrClassMethodReferences();
                /** {@inheritDoc} */
                @Override
                boolean isEmpty() {
                    return nModuleReferences + nTypeClassModuleReferences + nTypeConstructorReferences + nDataConstructorReferences + nFunctionOrClassMethodReferences == 0;
                }
                /** {@inheritDoc} */
                @Override
                void generateHTML(HTMLBuilder currentPage, CALDocToHTMLUtilities.CrossReferenceHTMLGenerator referenceGenerator) {
                    int masterCount = 0;
                   
                    for (int i = 0; i < nModuleReferences; i++, masterCount++) {
                        if (masterCount > 0) {
                            currentPage.addText(LocalizableUserVisibleString.COMMA_AND_SPACE.toResourceString());
                        }
                        currentPage.openTag(HTML.Tag.CODE);
                        generateModuleReference(docComment.getNthModuleReference(i).getName());
                        currentPage.closeTag(HTML.Tag.CODE);
                    }
                   
                    for (int i = 0; i < nTypeClassModuleReferences; i++, masterCount++) {
                        if (masterCount > 0) {
                            currentPage.addText(LocalizableUserVisibleString.COMMA_AND_SPACE.toResourceString());
                        }
                        currentPage.openTag(HTML.Tag.CODE);
                        generateTypeClassReference(docComment.getNthTypeClassReference(i).getName());
                        currentPage.closeTag(HTML.Tag.CODE);
                    }
                   
                    for (int i = 0; i < nTypeConstructorReferences; i++, masterCount++) {
                        if (masterCount > 0) {
                            currentPage.addText(LocalizableUserVisibleString.COMMA_AND_SPACE.toResourceString());
                        }
                        currentPage.openTag(HTML.Tag.CODE);
                        generateTypeConsReference(docComment.getNthTypeConstructorReference(i).getName());
                        currentPage.closeTag(HTML.Tag.CODE);
                    }
                   
                    for (int i = 0; i < nDataConstructorReferences; i++, masterCount++) {
                        if (masterCount > 0) {
                            currentPage.addText(LocalizableUserVisibleString.COMMA_AND_SPACE.toResourceString());
                        }
                        currentPage.openTag(HTML.Tag.CODE);
                        generateDataConsReference(docComment.getNthDataConstructorReference(i).getName());
                        currentPage.closeTag(HTML.Tag.CODE);
                    }
                   
                    for (int i = 0; i < nFunctionOrClassMethodReferences; i++, masterCount++) {
                        if (masterCount > 0) {
                            currentPage.addText(LocalizableUserVisibleString.COMMA_AND_SPACE.toResourceString());
                        }
                        currentPage.openTag(HTML.Tag.CODE);
                        generateFunctionOrClassMethodReference(docComment.getNthFunctionOrClassMethodReference(i).getName());
                        currentPage.closeTag(HTML.Tag.CODE);
                    }
                }
            };
        }
       
        /// Author block
        //
        if (shouldGenerateAuthorInfo()) {
            generateHTMLForAttribute(StyleClassConstants.AUTHOR_BLOCK, LocalizableUserVisibleString.AUTHOR_COLON.toResourceString(), metadata.getAuthor(), valueFromAuthorBlocks, referenceGenerator, false);
        }
       
        /// Version block
        //
        if (shouldGenerateVersionInfo()) {
            generateHTMLForAttribute(StyleClassConstants.VERSION_BLOCK, LocalizableUserVisibleString.VERSION_COLON.toResourceString(), metadata.getVersion(), versionBlock, referenceGenerator, false);
        }
       
        /// See blocks
        //
        ContentConvertibleToHTML relatedReferencesFromMetadata = new ContentConvertibleToHTML() {
            private final int nRelatedFeatures = metadata.getNRelatedFeatures();
            /** {@inheritDoc} */
            @Override
            boolean isEmpty() {
                return nRelatedFeatures == 0;
View Full Code Here

TOP

Related Classes of org.openquark.cal.caldoc.CALDocToHTMLUtilities.ContentConvertibleToHTML

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.