Sun, 24 Feb 2013 11:36:58 -0800
7112427: The doclet needs to be able to generate JavaFX documentation.
Reviewed-by: jjg
Contributed-by: jan.valenta@oracle.com
jjg@1606 | 1 | /* |
jjg@1606 | 2 | * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. |
jjg@1606 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
jjg@1606 | 4 | * |
jjg@1606 | 5 | * This code is free software; you can redistribute it and/or modify it |
jjg@1606 | 6 | * under the terms of the GNU General Public License version 2 only, as |
jjg@1606 | 7 | * published by the Free Software Foundation. Oracle designates this |
jjg@1606 | 8 | * particular file as subject to the "Classpath" exception as provided |
jjg@1606 | 9 | * by Oracle in the LICENSE file that accompanied this code. |
jjg@1606 | 10 | * |
jjg@1606 | 11 | * This code is distributed in the hope that it will be useful, but WITHOUT |
jjg@1606 | 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
jjg@1606 | 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
jjg@1606 | 14 | * version 2 for more details (a copy is included in the LICENSE file that |
jjg@1606 | 15 | * accompanied this code). |
jjg@1606 | 16 | * |
jjg@1606 | 17 | * You should have received a copy of the GNU General Public License version |
jjg@1606 | 18 | * 2 along with this work; if not, write to the Free Software Foundation, |
jjg@1606 | 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
jjg@1606 | 20 | * |
jjg@1606 | 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
jjg@1606 | 22 | * or visit www.oracle.com if you need additional information or have any |
jjg@1606 | 23 | * questions. |
jjg@1606 | 24 | */ |
jjg@1606 | 25 | |
jjg@1606 | 26 | package com.sun.tools.doclets.internal.toolkit.taglets; |
jjg@1606 | 27 | |
jjg@1606 | 28 | import java.util.Map; |
jjg@1606 | 29 | |
jjg@1606 | 30 | import com.sun.tools.doclets.Taglet; |
jjg@1606 | 31 | import com.sun.javadoc.Tag; |
jjg@1606 | 32 | |
jjg@1606 | 33 | /** |
jjg@1606 | 34 | * An inline Taglet used to denote information for experts. |
jjg@1606 | 35 | * |
jjg@1606 | 36 | * <p><b>This is NOT part of any supported API. |
jjg@1606 | 37 | * If you write code that depends on this, you do so at your own risk. |
jjg@1606 | 38 | * This code and its internal interfaces are subject to change or |
jjg@1606 | 39 | * deletion without notice.</b> |
jjg@1606 | 40 | * |
jjg@1606 | 41 | */ |
jjg@1606 | 42 | public class ExpertTaglet implements Taglet { |
jjg@1606 | 43 | |
jjg@1606 | 44 | private static final String NAME = "expert"; |
jjg@1606 | 45 | private static final String START_TAG = "<sub id=\"expert\">"; |
jjg@1606 | 46 | private static final String END_TAG = "</sub>"; |
jjg@1606 | 47 | |
jjg@1606 | 48 | /** |
jjg@1606 | 49 | * {@inheritDoc} |
jjg@1606 | 50 | */ |
jjg@1606 | 51 | public boolean inField() { |
jjg@1606 | 52 | return true; |
jjg@1606 | 53 | } |
jjg@1606 | 54 | |
jjg@1606 | 55 | public boolean inConstructor() { |
jjg@1606 | 56 | return true; |
jjg@1606 | 57 | } |
jjg@1606 | 58 | |
jjg@1606 | 59 | public boolean inMethod() { |
jjg@1606 | 60 | return true; |
jjg@1606 | 61 | } |
jjg@1606 | 62 | |
jjg@1606 | 63 | public boolean inOverview() { |
jjg@1606 | 64 | return true; |
jjg@1606 | 65 | } |
jjg@1606 | 66 | |
jjg@1606 | 67 | public boolean inPackage() { |
jjg@1606 | 68 | return true; |
jjg@1606 | 69 | } |
jjg@1606 | 70 | |
jjg@1606 | 71 | public boolean inType() { |
jjg@1606 | 72 | return true; |
jjg@1606 | 73 | } |
jjg@1606 | 74 | |
jjg@1606 | 75 | public boolean isInlineTag() { |
jjg@1606 | 76 | return false; |
jjg@1606 | 77 | } |
jjg@1606 | 78 | |
jjg@1606 | 79 | public String getName() { |
jjg@1606 | 80 | return NAME; |
jjg@1606 | 81 | } |
jjg@1606 | 82 | |
jjg@1606 | 83 | public static void register(Map<String, Taglet> map) { |
jjg@1606 | 84 | map.remove(NAME); |
jjg@1606 | 85 | map.put(NAME, new ExpertTaglet()); |
jjg@1606 | 86 | } |
jjg@1606 | 87 | |
jjg@1606 | 88 | public String toString(Tag tag) { |
jjg@1606 | 89 | return (tag.text() == null || tag.text().length() == 0) ? null : |
jjg@1606 | 90 | START_TAG + LiteralTaglet.textToString(tag.text()) + END_TAG; |
jjg@1606 | 91 | } |
jjg@1606 | 92 | |
jjg@1606 | 93 | |
jjg@1606 | 94 | public String toString(Tag[] tags) { |
jjg@1606 | 95 | if (tags == null || tags.length == 0) return null; |
jjg@1606 | 96 | |
jjg@1606 | 97 | StringBuffer sb = new StringBuffer(START_TAG); |
jjg@1606 | 98 | |
jjg@1606 | 99 | for(Tag t:tags) { |
jjg@1606 | 100 | sb.append(LiteralTaglet.textToString(t.text())); |
jjg@1606 | 101 | } |
jjg@1606 | 102 | sb.append(END_TAG); |
jjg@1606 | 103 | return sb.toString(); |
jjg@1606 | 104 | } |
jjg@1606 | 105 | |
jjg@1606 | 106 | } |