source: 3thparty/jmessenger/src/nu/fw/jeti/plugins/Word.java @ 3952

Revision 3952, 2.3 KB checked in by alexandrecorreia, 13 years ago (diff)

Ticket #1710 - Adicao do codigo fonte java do componente jmessenger(jabberit_messenger)

  • Property svn:executable set to *
Line 
1/*
2 *      Jeti, a Java Jabber client, Copyright (C) 2004 E.S. de Boer 
3 *
4 *  This program is free software; you can redistribute it and/or modify
5 *  it under the terms of the GNU General Public License as published by
6 *  the Free Software Foundation; either version 2 of the License, or
7 *  (at your option) any later version.
8 *
9 *  This program is distributed in the hope that it will be useful,
10 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
11 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 *      GNU General Public License for more details.
13 *
14 *  You should have received a copy of the GNU General Public License
15 *  along with this program; if not, write to the Free Software
16 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17 *
18 *      For questions, comments etc,
19 *      use the website at http://jeti.jabberstudio.org
20 *  or mail me at eric@jeti.tk
21 *
22 *      Created on 13-feb-2004
23 */
24 
25package nu.fw.jeti.plugins;
26
27import javax.swing.text.AttributeSet;
28import javax.swing.text.MutableAttributeSet;
29import javax.swing.text.SimpleAttributeSet;
30
31/**
32 * @author E.S. de Boer
33 *
34 */
35public class Word implements Cloneable
36{//TODO check attributes return not null ipv fontsize plugin
37        public String word;
38        private MutableAttributeSet attributes;
39        private MutableAttributeSet mas;
40
41        public Word(StringBuffer word)
42        {
43                this .word = word.toString();
44        }
45       
46        public Word(StringBuffer word,MutableAttributeSet al)
47        {
48                this .word = word.toString();
49                this.attributes = al;
50        }
51       
52        public Word(String word)
53        {
54                this .word = word;
55        }
56       
57        public Word(String word,MutableAttributeSet al)
58        {
59                this .word = word;
60                this.attributes = al;
61        }
62       
63        public void addAttributes(AttributeSet attr)
64        {
65                if(mas==null)
66                {       
67                        mas = new SimpleAttributeSet();
68                        if(attributes!=null)mas.addAttributes(attributes);
69                }
70                mas.addAttributes(attr);
71        }
72       
73        public MutableAttributeSet getAttributes()
74        {
75                if(mas!=null) return mas;
76                if(attributes== null) attributes = new SimpleAttributeSet();
77                return attributes;
78        }
79       
80        public String toString()
81        {
82                return word;
83        }
84       
85        public Object clone() throws CloneNotSupportedException
86        {
87                Word w = (Word) super.clone();
88                if(attributes!=null)w.attributes = new SimpleAttributeSet(attributes);
89                if(mas!=null)w.mas = new SimpleAttributeSet(mas);
90                return w;
91        }
92}
93
94/*
95 * Overrides for emacs
96 * Local variables:
97 * tab-width: 4
98 * End:
99 */
Note: See TracBrowser for help on using the repository browser.