PageRenderTime 27ms CodeModel.GetById 22ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/bundles/plugins-trunk/SideKick/sidekick/util/SideKickAsset.java

#
Java | 74 lines | 31 code | 11 blank | 32 comment | 1 complexity | c1e278c070e55cd74b698c151481500e MD5 | raw file
 1/*
 2Copyright (c) 2006, Dale Anson
 3All rights reserved.
 4
 5Redistribution and use in source and binary forms, with or without modification, 
 6are permitted provided that the following conditions are met:
 7
 8* Redistributions of source code must retain the above copyright notice, 
 9this list of conditions and the following disclaimer.
10* Redistributions in binary form must reproduce the above copyright notice, 
11this list of conditions and the following disclaimer in the documentation 
12and/or other materials provided with the distribution.
13* Neither the name of the <ORGANIZATION> nor the names of its contributors 
14may be used to endorse or promote products derived from this software without 
15specific prior written permission.
16
17THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
18ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
19WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
20DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 
21ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
22(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
23LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 
24ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
25(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
26SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27*/
28
29package sidekick.util;
30
31import sidekick.Asset;
32import javax.swing.Icon;
33
34/**
35 * danson: simple concrete implementation of an Asset that wraps some sort of
36 * SideKickElement.  A SideKickElement provides both Location and Position
37 * information.
38 */
39public class SideKickAsset extends Asset {
40    
41    private SideKickElement element = null;
42    private String name = "";
43    private String longString = null;
44    
45    public SideKickAsset(SideKickElement element) {
46        super(element.toString());    
47        this.element = element;
48        this.name = element.toString();
49    }
50    
51    public SideKickElement getElement() {
52        return element;   
53    }
54    
55	public Icon getIcon() { 
56        return null; 
57    }
58
59    public String getShortString() { 
60        return name; 
61    }
62    
63    public String toString() {
64        return name;   
65    }
66
67	public String getLongString() {
68        return longString == null ? name : longString;
69    }
70    
71    public void setLongString(String s) {
72        longString = s;   
73    }
74}