src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java

Tue, 25 May 2010 15:54:51 -0700

author
ohair
date
Tue, 25 May 2010 15:54:51 -0700
changeset 554
9d9f26857129
parent 182
47a62d8d98b4
child 1359
25e14ad23cef
permissions
-rw-r--r--

6943119: Rebrand source copyright notices
Reviewed-by: darcy

     1 /*
     2  * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 package com.sun.tools.doclets.internal.toolkit.util.links;
    28 import com.sun.javadoc.*;
    29 import com.sun.tools.doclets.internal.toolkit.Configuration;
    31 /**
    32  * Encapsulates information about a link.
    33  *
    34  * @author Jamie Ho
    35  * @since 1.5
    36  */
    37 public abstract class LinkInfo {
    39     /**
    40      * The ClassDoc we want to link to.  Null if we are not linking
    41      * to a ClassDoc.
    42      */
    43     public ClassDoc classDoc;
    45     /**
    46      * The executable member doc we want to link to.  Null if we are not linking
    47      * to an executable member.
    48      */
    49     public ExecutableMemberDoc executableMemberDoc;
    51     /**
    52      * The Type we want to link to.  Null if we are not linking to a type.
    53      */
    54     public Type type;
    56     /**
    57      * True if this is a link to a VarArg.
    58      */
    59     public boolean isVarArg = false;
    61     /**
    62      * Set this to true to indicate that you are linking to a type parameter.
    63      */
    64     public boolean isTypeBound = false;
    66     /**
    67      * The label for the link.
    68      */
    69     public String label;
    71     /**
    72      * True if the link should be strong.
    73      */
    74     public boolean isStrong = false;
    76     /**
    77      * True if we should include the type in the link label.  False otherwise.
    78      */
    79     public boolean includeTypeInClassLinkLabel = true;
    81     /**
    82      * True if we should include the type as seperate link.  False otherwise.
    83      */
    84     public boolean includeTypeAsSepLink = false;
    86     /**
    87      * True if we should exclude the type bounds for the type parameter.
    88      */
    89     public boolean excludeTypeBounds = false;
    91     /**
    92      * True if we should print the type parameters, but not link them.
    93      */
    94     public boolean excludeTypeParameterLinks = false;
    96     /**
    97      * True if we should print the type bounds, but not link them.
    98      */
    99     public boolean excludeTypeBoundsLinks = false;
   101     /**
   102      * By default, the link can be to the page it's already on.  However,
   103      * there are cases where we don't want this (e.g. heading of class page).
   104      */
   105     public boolean linkToSelf = true;
   107     /**
   108      * The display length for the link.
   109      */
   110     public int displayLength = 0;
   112     /**
   113      * Return the id indicating where the link appears in the documentation.
   114      * This is used for special processing of different types of links.
   115      *
   116      * @return the id indicating where the link appears in the documentation.
   117      */
   118     public abstract int getContext();
   120     /**
   121      * Set the context.
   122      *
   123      * @param c the context id to set.
   124      */
   125     public abstract void setContext(int c);
   127     /**
   128      * Return true if this link is linkable and false if we can't link to the
   129      * desired place.
   130      *
   131      * @return true if this link is linkable and false if we can't link to the
   132      * desired place.
   133      */
   134     public abstract boolean isLinkable();
   136     /**
   137      * Return the label for this class link.
   138      *
   139      * @param configuration the current configuration of the doclet.
   140      * @return the label for this class link.
   141      */
   142     public String getClassLinkLabel(Configuration configuration) {
   143         if (label != null && label.length() > 0) {
   144             return label;
   145         } else if (isLinkable()) {
   146             return classDoc.name();
   147         } else {
   148             return configuration.getClassName(classDoc);
   149         }
   150     }
   151 }

mercurial