1 /*
2 * Copyright (c) 2006 Stiftung Deutsches Elektronen-Synchroton,
3 * Member of the Helmholtz Association, (DESY), HAMBURG, GERMANY.
4 *
5 * THIS SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN "../AS IS" BASIS.
6 * WITHOUT WARRANTY OF ANY KIND, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED
7 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR PARTICULAR PURPOSE AND
8 * NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
9 * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
10 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
11 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. SHOULD THE SOFTWARE PROVE DEFECTIVE
12 * IN ANY RESPECT, THE USER ASSUMES THE COST OF ANY NECESSARY SERVICING, REPAIR OR
13 * CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE.
14 * NO USE OF ANY SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
15 * DESY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
16 * OR MODIFICATIONS.
17 * THE FULL LICENSE SPECIFYING FOR THE SOFTWARE THE REDISTRIBUTION, MODIFICATION,
18 * USAGE AND OTHER RIGHTS AND OBLIGATIONS IS INCLUDED WITH THE DISTRIBUTION OF THIS
19 * PROJECT IN THE FILE LICENSE.HTML. IF THE LICENSE IS NOT INCLUDED YOU MAY FIND A COPY
20 * AT HTTP://WWW.DESY.DE/LEGAL/LICENSE.HTM
21 */
22
23 package de.desy.acop.displayers.table;
24
25 import com.cosylab.gui.adapters.Converter;
26
27 import de.desy.acop.displayers.tools.AcopDisplayerParameters;
28 import de.desy.acop.transport.ConnectionParameters;
29
30 /**
31 * <code>AcopTableParameters</code> are an instance of <code>AcopDisplayerParameters</code>
32 * usid in combination with <code>AcopTable</code>. Parameters provide remote connetion
33 * point as well as settings that define the <code>AcopTableColumn</code> type and
34 * its properties.
35 *
36 * @author Jaka Bobnar, Cosylab
37 * @see AcopTable
38 * @see AcopTableColumn
39 */
40 public class AcopTableParameters extends AcopDisplayerParameters {
41
42 private static final long serialVersionUID = -4689823006847926238L;
43
44 public AcopTableParameters() {
45 this(null, TableColumnType.VALUE, null);
46 }
47
48 /**
49 * Constructs new AcopTableParameters using the provided ConnectionParameters.
50 *
51 * @param parameters remote connection point
52 */
53 public AcopTableParameters(ConnectionParameters parameters) {
54 this(parameters, TableColumnType.VALUE, "");
55 }
56
57 /**
58 * Constructs new AcopTableParameters using the provided parameters
59 *
60 * @param parameters remote connection point
61 * @param type type of the column shown in the table
62 * @param name the name of the column
63 */
64 public AcopTableParameters(ConnectionParameters parameters, TableColumnType type, String name) {
65 this(parameters, type, null, name);
66 }
67
68 /**
69 * Constructs new AcopTableParameters using the provided parameters
70 *
71 * @param parameters remote connection point
72 * @param type type of the column shown in the table
73 * @param arrayIndex the index in the array data which should be the first row in the
74 * table column
75 * @param name the name of the column
76 */
77 public AcopTableParameters(ConnectionParameters parameters, TableColumnType type, int arrayIndex, String name) {
78 this(parameters, type, arrayIndex, null, name);
79 }
80
81 /**
82 * Constructs new AcopTableParameters using the supplied parameters.
83 * This constructor assumes the TableColumnType.VALUE.
84 *
85 * @param parameters the remote connection point
86 * @param converter converter associated with the data source
87 * @param name the name of column
88 * @see TableColumnType
89 */
90 public AcopTableParameters(ConnectionParameters parameters, Converter converter, String name) {
91 this(parameters, TableColumnType.VALUE, converter, name);
92 }
93
94 /**
95 * Constructs new AcopTableParameters using the supplied parameters.
96 *
97 * @param parameters the remote connection point
98 * @param type type of the column shown in the table
99 * @param converter converter associated with the data source
100 * @param name the name of the column
101 */
102 public AcopTableParameters(ConnectionParameters parameters, TableColumnType type, Converter converter, String name) {
103 this(parameters, type, 0, converter, name);
104 }
105
106 /**
107 * Constructs new AcopTableParameters using the supplied parameters.
108 *
109 * @param parameters the remote connection point
110 * @param type type of the column shown in the table
111 * @param arrayIndex the index in the array data which should be the first row in the
112 * table column
113 * @param converter converter associated with the data source
114 * @param name the name of the column
115 */
116 public AcopTableParameters(ConnectionParameters parameters, TableColumnType type, int arrayIndex, Converter converter, String name) {
117 super(parameters, arrayIndex, converter);
118 values.put("columnType", type);
119 values.put("columnName", name);
120 }
121
122 /**
123 * Returns the type of the column.
124 *
125 * @return the column type
126 */
127 public TableColumnType getColumnType() {
128 return (TableColumnType)values.get("columnType");
129 }
130
131 /**
132 * Returns the name of the column.
133 *
134 * @return the name
135 */
136 public String getColumnName() {
137 return (String) values.get("columnName");
138 }
139
140 /**
141 * Construct new AcopTableParameters which resembles this object but has
142 * a different ConnectionParameters.
143 *
144 * @param parameters new remote connection point
145 * @return new AcopTableParameters
146 */
147 public AcopTableParameters deriveWith(ConnectionParameters parameters) {
148 return new AcopTableParameters(parameters, getColumnType(), getArrayIndex(), getConverter(), getColumnName());
149 }
150
151 }