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  /**
23   * <code>MultipleDataConsumer</code> is data consumer, which is able to process
24   * at the same time several dynamic data sources by allocation own simple data
25   * consumer for each source.
26   *
27   * @author <a href="mailto:igor.kriznar@cosylab.com">Igor Kriznar</a>
28   * @version $Id: MultipleDataConsumer.java,v 1.4 2008-04-22 12:31:02 jbobnar Exp $
29   *
30   * @since Nov 24, 2003.
31   */
32  public interface MultipleDataConsumer
33  {
34  	/**
35  	 * <p>
36  	 * Returns data consumer of specified data consumer type and for specified
37  	 * string name. The organization of data is indicated with name (list,
38  	 * table, tree organization). Multiple consumer might interprete this by
39  	 * it's own preferences or abilities. The name of returned consuer must
40  	 * equals to provided name.
41  	 * </p>
42  	 * 
43  	 * <p>
44  	 * Example. Names: <tt>PS1/current, PS1/readback, PS2/current,
45  	 * PS2/readback</tt> migth table displayer interprete as two rows (PS1 and
46  	 * PS2) wtih two columns (current and readback). Tree displayer migth
47  	 * interprete this names as two branches with two subbranches.
48  	 * </p>
49  	 * 
50  	 * <p>
51  	 * Note that name is not fixed consumer property. Some displayers migth
52  	 * expect for name to be same as DISPLAY_NAME and is changed if display
53  	 * name is changed.
54  	 * </p>
55  	 *
56  	 * @param name organized data name
57  	 * @param type required data soncumer type
58  	 *
59  	 * @return newly allocated consumer for required name and type
60  	 */
61  	public <D extends DataConsumer> D getConsumer(String name, Class<D> type);
62  
63  	/**
64  	 * Requests frm this multiple consumer to release all resources connectet
65  	 * to provided single consumer. Provided consumer must be created by this
66  	 * multiple consumer.
67  	 *
68  	 * @param consumer the consumer to be released
69  	 */
70  	public void releaseConsumer(DataConsumer consumer);
71  
72  	/**
73  	 * Returns all data consumers created by this multiple data consumer.
74  	 *
75  	 * @return all data consumers created by this multiple data consumer
76  	 */
77  	public DataConsumer[] getConsumers();
78  
79  	/**
80  	 * Returns array of supported data consumer types, which can be used as
81  	 * parameter and returnned  with <code>getConsumer(String,Class)</code>
82  	 * method.
83  	 *
84  	 * @return array of supported data consumer types
85  	 */
86  	public Class<DataConsumer>[] getSupportedConsumerTypes();
87  }
88  
89  /* __oOo__ */