KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > columba > mail > gui > message > util > ColumbaURL


1 //The contents of this file are subject to the Mozilla Public License Version 1.1
2
//(the "License"); you may not use this file except in compliance with the
3
//License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
4
//
5
//Software distributed under the License is distributed on an "AS IS" basis,
6
//WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
7
//for the specific language governing rights and
8
//limitations under the License.
9
//
10
//The Original Code is "The Columba Project"
11
//
12
//The Initial Developers of the Original Code are Frederik Dietz and Timo
13
// Stich.
14
//Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
15
//Portions created by Celso Pinto are Copyright (C) 2004.
16
//All Rights Reserved.
17
package org.columba.mail.gui.message.util;
18
19 import java.net.URL JavaDoc;
20
21
22 /**
23  * This class is a substitute for java.net.URL. It allows one to add specific
24  * properties depending on the URL's protocol.<br>
25  * At the moment only handles mailto: protocol.<br>
26  * I.E.: URL might be mailto:cpinto@yimports.com and sender is Celso Pinto,
27  * resulting on getEmailAddress()==cpinto@yimports.com and getSender() on Celso Pinto.
28  *
29  * @author Celso Pinto &lt;cpinto@yimports.com&gt;
30  */

31 public class ColumbaURL
32 {
33
34   private URL JavaDoc iRealURL = null;
35   private String JavaDoc iSender = "";
36   
37   public ColumbaURL(URL JavaDoc aRealURL)
38   {
39     iRealURL = aRealURL;
40   }
41   
42   public String JavaDoc getEmailAddress()
43   {
44     if (iRealURL == null)
45       return "";
46     
47     return iRealURL.getFile();
48   }
49   public void setRealURL(URL JavaDoc aRealURL)
50   {
51     iRealURL = aRealURL;
52   }
53   public URL JavaDoc getRealURL()
54   {
55     return iRealURL;
56   }
57   
58   public String JavaDoc getSender()
59   {
60     return iSender;
61   }
62   public void setSender(String JavaDoc aSender)
63   {
64     iSender = aSender;
65   }
66   
67   public boolean isMailTo()
68   {
69     return iRealURL.getProtocol().equalsIgnoreCase("mailto");
70   }
71   
72 }
73
Popular Tags