⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flowdoctagshandler.java

📁 一个java写的business process management系统
💻 JAVA
字号:
/*
 * Copyright (c) 2001, 2002 The XDoclet team
 * All rights reserved.
 */
package net.orthanc.flow4j.tools.xdoclet;

import java.util.Properties;
import java.util.StringTokenizer;

import xdoclet.XDocletException;
import xdoclet.XDocletTagSupport;
import xdoclet.modules.doc.XDocletModulesDocMessages;
import xdoclet.tagshandler.ClassTagsHandler;
import xdoclet.tagshandler.PackageTagsHandler;
import xdoclet.template.TemplateException;
import xdoclet.util.Translator;

/**
 * @author               greifa
 * @created              Oct 15, 2001
 * @xdoclet.taghandler   namespace="Flowdoc"
 * @version              $Revision: 1.1 $
 */
public class FlowdocTagsHandler extends XDocletTagSupport
{

    public String classTagValue() throws XDocletException
    {
        return getClassTagsHandler().classTagValue(getProperties());
    }

    public String rootlink() throws XDocletException
    {
        String packageName = "";

        if (getPackageTagsHandler().packageName() != null) {
            packageName = getPackageTagsHandler().packageName();
        }

        StringTokenizer st = new StringTokenizer(packageName, ".");
        int n = st.countTokens();
        StringBuffer sbuf = new StringBuffer();

        for (int i = 0; i < n; i++) {
            sbuf.append("../");
        }
        return sbuf.toString();
    }


    public void forAllProperties(String template, Properties attributes) throws XDocletException
    {
        Properties myAttribs = new Properties();

        myAttribs.setProperty("tagName", getCurrentClassTag().getName());
        myAttribs.setProperty("paramName", attributes.getProperty("names"));
        getClassTagsHandler().forAllClassTagTokens(template, myAttribs);
    }


    public void propertyName() throws XDocletException
    {
        getEngine().print(getClassTagsHandler().currentToken(null));
    }

    public void propertyValue(Properties attributes) throws XDocletException
    {
        Properties myAttribs = new Properties();

        myAttribs.setProperty("tagName", getCurrentClassTag().getName());
        myAttribs.setProperty("paramName", "value-" + getClassTagsHandler().currentToken(null));

        String value = getClassTagsHandler().classTagValue(myAttribs) != null
            ? getClassTagsHandler().classTagValue(myAttribs)
            : (attributes.getProperty("default") != null ? attributes.getProperty("default") : "");

        getEngine().print(value);
    }

    public void propertyDescription(Properties attributes) throws XDocletException
    {
        Properties myAttribs = new Properties();

        myAttribs.setProperty("tagName", getCurrentClassTag().getName());
        myAttribs.setProperty("paramName", "desc-" + getClassTagsHandler().currentToken(null));

        String value = getClassTagsHandler().classTagValue(myAttribs) != null
            ? getClassTagsHandler().classTagValue(myAttribs)
            : (attributes.getProperty("default") != null ? attributes.getProperty("default") : "");

        getEngine().print(value);
    }

    public void propertyType(Properties attributes) throws XDocletException
    {
        Properties myAttribs = new Properties();

        myAttribs.setProperty("tagName", getCurrentClassTag().getName());
        myAttribs.setProperty("paramName", "type-" + getClassTagsHandler().currentToken(null));

        String value = getClassTagsHandler().classTagValue(myAttribs) != null
            ? getClassTagsHandler().classTagValue(myAttribs)
            : (attributes.getProperty("default") != null ? attributes.getProperty("default") : "");

        getEngine().print(value);
    }


    /**
     * Gets the PackageTagsHandler attribute of the InfoTagsHandler object
     *
     * @return                      The PackageTagsHandler value
     * @exception XDocletException  Describe the exception
     */
    private PackageTagsHandler getPackageTagsHandler()
         throws XDocletException
    {
        try {
            return (
                (PackageTagsHandler) getEngine().getTagHandlerFor("Package"));
        }
        catch (TemplateException ex) {
            throw new XDocletException(
                ex,
                Translator.getString(
                XDocletModulesDocMessages.class,
                XDocletModulesDocMessages.TAGSHANDLER_NOT_FOUND,
                new String[]{"PackageTagsHandler", "Package"}));
        }
    }

    /**
     * Gets the ClassTagsHandler attribute
     *
     * @return                      The ClassTagsHandler value
     * @exception XDocletException  Describe the exception
     */
    private ClassTagsHandler getClassTagsHandler() throws XDocletException
    {
        try {
            return ((ClassTagsHandler) getEngine().getTagHandlerFor("Class"));
        }
        catch (TemplateException ex) {
            throw new RuntimeException(ex);
            //throw new XDocletException(ex, Translator.getString(XDocletModulesDocMessages.class, XDocletModulesDocMessages.TAGSHANDLER_NOT_FOUND, new String[]{"ClassTagsHandler", "Class"}));
        }
    }

    /**
     * Gets the Properties attribute of the InfoTagsHandler object
     *
     * @return   The Properties value
     */
    private Properties getProperties()
    {
        Properties properties =
            ((FlowHtmlSubTask) getDocletContext().getActiveSubTask())
            .getProperties();

        return properties;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -