View Javadoc

1   /*
2    * Copyright (c) 2003-2008 by Cosylab d. d.
3    *
4    * This file is part of CosyBeans.
5    *
6    * CosyBeans is free software: you can redistribute it and/or modify
7    * it under the terms of the GNU General Public License as published by
8    * the Free Software Foundation, either version 3 of the License, or
9    * (at your option) any later version.
10   *
11   * CosyBeans is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   * GNU General Public License for more details.
15   *
16   * You should have received a copy of the GNU General Public License
17   * along with CosyBeans.  If not, see <http://www.gnu.org/licenses/>.
18   */
19  
20  package com.cosylab.gui.displayers;
21  
22  import javax.swing.Icon;
23  
24  import com.cosylab.gui.ValueIconPair;
25  
26  /**
27   * <code>IconDisplayer</code> can display long values (similar to LongDisplayer) 
28   * but instead of showing the number value it shows different icons for each of
29   * the received values. 
30   * 
31   * @author Jaka Bobnar, Cosylab
32   *
33   */
34  public interface IconDisplayer extends Displayer, LongConsumer {
35  
36  	/**
37  	 * Sets the value displayed by the displayer. This method may be invoked
38  	 * only by the adapter delivering a new value from the modeling layer.
39  	 *
40  	 * @param value new value to be displayed
41  	 */
42  	public void setValue(long value);
43  
44  	/**
45  	 * Gets the value displayed by the displayer. This method can be invoked by
46  	 * any object and will probably most often be invoked by the GUI rendition
47  	 * code.
48  	 *
49  	 * @return double currently displayed value
50  	 */
51  	public long getValue();
52  	
53  	/**
54  	 * Sets the default icon for this displayer. If there is no icon assigned to a specific
55  	 * value, a default icon is shown when that value arrives.
56  	 * 
57  	 * @param icon
58  	 */
59  	public void setDefaultIcon(Icon icon);
60  	
61  	/**
62  	 * Returns the default icon.
63  	 * 
64  	 * @return
65  	 */
66  	public Icon getDefaultIcon();
67  	
68  	/**
69  	 * Returns an array of all icons that were associated with values.
70  	 * 
71  	 * @return
72  	 */
73  	public ValueIconPair[] getIcons();
74  	
75  	/**
76  	 * Associates icons with values. This method overrides all previously loaded icons.
77  	 * 
78  	 * @param icons
79  	 */
80  	public void setIcons(ValueIconPair[] pairs);
81  	
82  	/**
83  	 * Associates icons with values. This methods adds icons to previously
84  	 * loded inventory and overrides only those values that were loaded before and now
85  	 * is a different values associated with them. 
86  	 * 
87  	 * @param icons
88  	 */
89  	public void addIcons(ValueIconPair[] icons);
90  	
91  	/**
92  	 * Associates icon with value. This methods adds icon to previously
93  	 * loded inventory. 
94  	 * 
95  	 * @param icons
96  	 */
97  	public void addIcon(ValueIconPair pair); 
98  	
99  	/**
100 	 * Removes icons.
101 	 * 
102 	 * @param icons
103 	 */
104 	public void removeIcon(ValueIconPair pair);
105 	
106 	/**
107 	 * Removes icons.
108 	 * 
109 	 * @param icons
110 	 */
111 	public void removeIcons(ValueIconPair[] pairs);
112 }