KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jxl > write > WritableHyperlink


1 /*********************************************************************
2 *
3 * Copyright (C) 2002 Andrew Khan
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ***************************************************************************/

19
20 package jxl.write;
21
22 import java.io.File JavaDoc;
23 import java.net.URL JavaDoc;
24
25 import jxl.Hyperlink;
26 import jxl.write.biff.HyperlinkRecord;
27
28 /**
29  * A writable hyperlink. Provides API to modify the contents of the hyperlink
30  */

31 public class WritableHyperlink extends HyperlinkRecord implements Hyperlink
32 {
33   /**
34    * Constructor used internally by the worksheet when making a copy
35    * of worksheet
36    *
37    * @param h the hyperlink being read in
38    * @param ws the writable sheet containing the hyperlink
39    */

40   public WritableHyperlink(Hyperlink h, WritableSheet ws)
41   {
42     super(h, ws);
43   }
44
45   /**
46    * Constructs a URL hyperlink in a single cell
47    *
48    * @param col the column containing this hyperlink
49    * @param row the row containing this hyperlink
50    * @param url the hyperlink
51    */

52   public WritableHyperlink(int col, int row, URL JavaDoc url)
53   {
54     this(col, row, col, row, url);
55   }
56
57   /**
58    * Constructs a url hyperlink to a range of cells
59    *
60    * @param col the column containing this hyperlink
61    * @param row the row containing this hyperlink
62    * @param lastcol the last column which activates this hyperlink
63    * @param lastrow the last row which activates this hyperlink
64    * @param url the hyperlink
65    */

66   public WritableHyperlink(int col, int row, int lastcol, int lastrow, URL JavaDoc url)
67   {
68     this(col, row, lastcol, lastrow, url, null);
69   }
70
71   /**
72    * Constructs a url hyperlink to a range of cells
73    *
74    * @param col the column containing this hyperlink
75    * @param row the row containing this hyperlink
76    * @param lastcol the last column which activates this hyperlink
77    * @param lastrow the last row which activates this hyperlink
78    * @param url the hyperlink
79    * @param desc the description text to place in the cell
80    */

81   public WritableHyperlink(int col, int row, int lastcol, int lastrow,
82                            URL JavaDoc url,
83                            String JavaDoc desc)
84   {
85     super(col, row, lastcol, lastrow, url, desc);
86   }
87
88   /**
89    * Constructs a file hyperlink in a single cell
90    *
91    * @param col the column containing this hyperlink
92    * @param row the row containing this hyperlink
93    * @param file the hyperlink
94    */

95   public WritableHyperlink(int col, int row, File JavaDoc file)
96   {
97     this(col, row, col, row, file, null);
98   }
99
100   /**
101    * Constructs a file hyperlink in a single cell
102    *
103    * @param col the column containing this hyperlink
104    * @param row the row containing this hyperlink
105    * @param file the hyperlink
106    * @param desc the hyperlink description
107    */

108   public WritableHyperlink(int col, int row, File JavaDoc file, String JavaDoc desc)
109   {
110     this(col, row, col, row, file, desc);
111   }
112
113   /**
114    * Constructs a File hyperlink to a range of cells
115    *
116    * @param col the column containing this hyperlink
117    * @param row the row containing this hyperlink
118    * @param lastcol the last column which activates this hyperlink
119    * @param lastrow the last row which activates this hyperlink
120    * @param file the hyperlink
121    */

122   public WritableHyperlink(int col, int row, int lastcol, int lastrow,
123                            File JavaDoc file)
124   {
125     super(col, row, lastcol, lastrow, file, null);
126   }
127
128   /**
129    * Constructs a File hyperlink to a range of cells
130    *
131    * @param col the column containing this hyperlink
132    * @param row the row containing this hyperlink
133    * @param lastcol the last column which activates this hyperlink
134    * @param lastrow the last row which activates this hyperlink
135    * @param file the hyperlink
136    * @param file the description
137    */

138   public WritableHyperlink(int col, int row, int lastcol, int lastrow,
139                            File JavaDoc file, String JavaDoc desc)
140   {
141     super(col, row, lastcol, lastrow, file, desc);
142   }
143
144   /**
145    * Constructs a hyperlink to some cells within this workbook
146    *
147    * @param col the column containing this hyperlink
148    * @param row the row containing this hyperlink
149    * @param desc the cell contents for this hyperlink
150    * @param sheet the sheet containing the cells to be linked to
151    * @param destcol the column number of the first destination linked cell
152    * @param destrow the row number of the first destination linked cell
153    */

154   public WritableHyperlink(int col, int row,
155                            String JavaDoc desc,
156                            WritableSheet sheet,
157                            int destcol, int destrow)
158   {
159     this(col, row, col, row,
160          desc,
161          sheet, destcol, destrow, destcol, destrow);
162   }
163
164   /**
165    * Constructs a hyperlink to some cells within this workbook
166    *
167    * @param col the column containing this hyperlink
168    * @param row the row containing this hyperlink
169    * @param lastcol the last column which activates this hyperlink
170    * @param lastrow the last row which activates this hyperlink
171    * @param desc the cell contents for this hyperlink
172    * @param sheet the sheet containing the cells to be linked to
173    * @param destcol the column number of the first destination linked cell
174    * @param destrow the row number of the first destination linked cell
175    * @param lastdestcol the column number of the last destination linked cell
176    * @param lastdestrow the row number of the last destination linked cell
177    */

178   public WritableHyperlink(int col, int row,
179                            int lastcol, int lastrow,
180                            String JavaDoc desc,
181                            WritableSheet sheet,
182                            int destcol, int destrow,
183                            int lastdestcol, int lastdestrow)
184   {
185     super(col, row, lastcol, lastrow,
186           desc,
187           sheet, destcol, destrow,
188           lastdestcol, lastdestrow);
189   }
190
191   /**
192    * Sets the URL of this hyperlink
193    *
194    * @param url the url
195    */

196   public void setURL(URL JavaDoc url)
197   {
198     super.setURL(url);
199   }
200
201   /**
202    * Sets the file activated by this hyperlink
203    *
204    * @param file the file
205    */

206   public void setFile(File JavaDoc file)
207   {
208     super.setFile(file);
209   }
210
211   /**
212    * Sets the description to appear in the hyperlink cell
213    *
214    * @param desc the description
215    */

216   public void setDescription(String JavaDoc desc)
217   {
218     super.setContents(desc);
219   }
220
221   /**
222    * Sets the location of the cells to be linked to within this workbook
223    *
224    * @param desc the label describing the link
225    * @param sheet the sheet containing the cells to be linked to
226    * @param destcol the column number of the first destination linked cell
227    * @param destrow the row number of the first destination linked cell
228    * @param lastdestcol the column number of the last destination linked cell
229    * @param lastdestrow the row number of the last destination linked cell
230    */

231   public void setLocation(String JavaDoc desc,
232                           WritableSheet sheet,
233                           int destcol, int destrow,
234                           int lastdestcol, int lastdestrow)
235   {
236     super.setLocation(desc, sheet, destcol, destrow, lastdestcol, lastdestrow);
237   }
238
239 }
240
241
242
Popular Tags