View Javadoc
1   package fr.ifremer.reefdb.ui.swing.util.table;
2   
3   /*
4    * #%L
5    * Reef DB :: UI
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2014 - 2015 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Affero General Public License as published by
13   * the Free Software Foundation, either version 3 of the License, or
14   * (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU Affero General Public License
22   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23   * #L%
24   */
25  
26  
27  import org.jdesktop.swingx.table.TableColumnExt;
28  
29  import java.math.BigDecimal;
30  
31  /**
32   * A TableColumnExt for Pmfm
33   *
34   * Created by Ludovic on 12/06/2015.
35   */
36  public class PmfmTableColumn extends TableColumnExt {
37  
38      /**
39       * <p>Constructor for PmfmTableColumn.</p>
40       *
41       * @param columnCount a int.
42       */
43      public PmfmTableColumn(int columnCount) {
44          super(columnCount);
45      }
46  
47      /**
48       * <p>getPmfmIdentifier.</p>
49       *
50       * @param <R> a R object.
51       * @return a {@link ReefDbPmfmColumnIdentifier} object.
52       */
53      @SuppressWarnings("unchecked")
54      public <R extends AbstractReefDbRowUIModel> ReefDbPmfmColumnIdentifier<R> getPmfmIdentifier() {
55          if (getIdentifier() instanceof ReefDbPmfmColumnIdentifier){
56              return (ReefDbPmfmColumnIdentifier<R>) getIdentifier();
57          }
58          throw new IllegalArgumentException("the identifier is not instance of ReefDbPmfmColumnIdentifier");
59      }
60  
61      /**
62       * <p>getPmfmId.</p>
63       *
64       * @return a int.
65       */
66      public int getPmfmId() {
67          return getPmfmIdentifier().getPmfmId();
68      }
69  
70      /**
71       * <p>isNumerical.</p>
72       *
73       * @return a boolean.
74       */
75      public boolean isNumerical() {
76          return BigDecimal.class.isAssignableFrom(getPmfmIdentifier().getPropertyType());
77      }
78  }