1 /*
2  * JasperReports - Free Java Reporting Library.
3  * Copyright (C) 2001 - 2019 TIBCO Software Inc. All rights reserved.
4  * http://www.jaspersoft.com
5  *
6  * Unless you have purchased a commercial license agreement from Jaspersoft,
7  * the following license terms apply:
8  *
9  * This program is part of JasperReports.
10  *
11  * JasperReports is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License as published by
13  * the Free Software Foundation, either version 3 of the License, or
14  * (at your option) any later version.
15  *
16  * JasperReports is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * along with JasperReports. If not, see <http://www.gnu.org/licenses/>.
23  */

24 package net.sf.jasperreports.engine.type;
25
26 import net.sf.jasperreports.engine.JRHyperlink;
27
28
29 /**
30  * @author Teodor Danciu (teodord@users.sourceforge.net)
31  */

32 public enum HyperlinkTypeEnum implements JREnum
33 {
34     /**
35      * Not set hyperlink type.
36      */

37     NULL((byte)0, "Null"),
38     
39     /**
40      * Constant useful for specifying that the element does not contain a hyperlink. This is the default value
41      * for a hyperlink type.
42      */

43     NONE((byte)1, "None"),
44
45     /**
46      * Constant useful for specifying that the hyperlink points to an external resource specified by the
47      * hyperlink reference expression.
48      * @see JRHyperlink#getHyperlinkReferenceExpression()
49      */

50     REFERENCE((byte)2, "Reference"),
51
52     /**
53      * Constant useful for specifying that the hyperlink points to a local anchor, specified by the hyperlink
54      * anchor expression.
55      * @see JRHyperlink#getHyperlinkAnchorExpression()
56      */

57     LOCAL_ANCHOR((byte)3, "LocalAnchor"),
58
59     /**
60      * Constant useful for specifying that the hyperlink points to a 1 based page index within the current document.
61      */

62     LOCAL_PAGE((byte)4, "LocalPage"),
63
64     /**
65      * Constant useful for specifying that the hyperlink points to a remote anchor (specified by the hyperlink
66      * anchor expression) within an external document (specified by the hyperlink reference expression).
67      * @see JRHyperlink#getHyperlinkAnchorExpression()
68      * @see JRHyperlink#getHyperlinkReferenceExpression()
69      */

70     REMOTE_ANCHOR((byte)5, "RemoteAnchor"),
71
72     /**
73      * Constant useful for specifying that the hyperlink points to a 1 based page index within an external document
74      * (specified by the hyperlink reference expression).
75      */

76     REMOTE_PAGE((byte)6, "RemotePage"),
77     
78     /**
79      * Custom hyperlink type.
80      * <p>
81      * The specific type is determined by {@link JRHyperlink#getLinkType() getLinkType()}.
82      */

83     CUSTOM((byte)7, "Custom");
84
85     /**
86      *
87      */

88     private final transient byte value;
89     private final transient String name;
90
91     private HyperlinkTypeEnum(byte value, String name)
92     {
93         this.value = value;
94         this.name = name;
95     }
96
97     /**
98      * @deprecated Used only by deprecated serialized fields.
99      */

100     @Override
101     public Byte getValueByte()
102     {
103         return value;
104     }
105     
106     /**
107      * @deprecated Used only by deprecated serialized fields.
108      */

109     @Override
110     public final byte getValue()
111     {
112         return value;
113     }
114     
115     @Override
116     public String getName()
117     {
118         return name;
119     }
120     
121     /**
122      *
123      */

124     public static HyperlinkTypeEnum getByName(String name)
125     {
126         return EnumUtil.getEnumByName(values(), name);
127     }
128     
129     /**
130      * @deprecated Used only by deprecated serialized fields.
131      */

132     public static HyperlinkTypeEnum getByValue(Byte value)
133     {
134         return (HyperlinkTypeEnum)EnumUtil.getByValue(values(), value);
135     }
136     
137     /**
138      * @deprecated Used only by deprecated serialized fields.
139      */

140     public static HyperlinkTypeEnum getByValue(byte value)
141     {
142         return getByValue((Byte)value);
143     }
144 }
145