View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.referential.samplingequipment.table;
2   
3   /*
4    * #%L
5    * Dali :: 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  import fr.ifremer.dali.dto.referential.UnitDTO;
27  import fr.ifremer.dali.ui.swing.util.table.AbstractDaliTableModel;
28  import fr.ifremer.dali.ui.swing.util.table.DaliColumnIdentifier;
29  import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
30  import fr.ifremer.quadrige3.ui.swing.table.SwingTableColumnModel;
31  
32  import java.util.Date;
33  
34  import static org.nuiton.i18n.I18n.n;
35  
36  /**
37   * Model.
38   */
39  public class SamplingEquipmentsTableModel extends AbstractDaliTableModel<SamplingEquipmentsTableRowModel> {
40  
41  	
42  	/**
43  	 * <p>Constructor for SamplingEquipmentsTableModel.</p>
44  	 *
45  	 * @param createNewRowAllowed a boolean.
46  	 */
47  	public SamplingEquipmentsTableModel(final SwingTableColumnModel columnModel, boolean createNewRowAllowed) {
48  		super(columnModel, createNewRowAllowed, false);
49  	}
50  	
51  	/** Constant <code>NAME</code> */
52  	public static final DaliColumnIdentifier<SamplingEquipmentsTableRowModel> NAME = DaliColumnIdentifier.newId(
53  			SamplingEquipmentsTableRowModel.PROPERTY_NAME,
54  			n("dali.property.name"),
55  			n("dali.property.name"),
56  			String.class,
57  			true);
58  	
59  	/** Constant <code>STATUS</code> */
60  	public static final DaliColumnIdentifier<SamplingEquipmentsTableRowModel> STATUS = DaliColumnIdentifier.newId(
61  			SamplingEquipmentsTableRowModel.PROPERTY_STATUS,
62  			n("dali.property.status"),
63  			n("dali.property.status"),
64  			StatusDTO.class,
65  			true);
66  	
67  	/** Constant <code>SIZE</code> */
68  	public static final DaliColumnIdentifier<SamplingEquipmentsTableRowModel> SIZE = DaliColumnIdentifier.newId(
69  			SamplingEquipmentsTableRowModel.PROPERTY_SIZE,
70  			n("dali.property.samplingEquipment.size"),
71  			n("dali.property.samplingEquipment.size.tip"),
72  			Double.class);
73  	
74  	/** Constant <code>UNIT</code> */
75  	public static final DaliColumnIdentifier<SamplingEquipmentsTableRowModel> UNIT = DaliColumnIdentifier.newId(
76  			SamplingEquipmentsTableRowModel.PROPERTY_UNIT,
77  			n("dali.property.pmfm.unit"),
78  			n("dali.property.pmfm.unit"),
79  			UnitDTO.class);
80  	
81  	/** Constant <code>DESCRIPTION</code> */
82  	public static final DaliColumnIdentifier<SamplingEquipmentsTableRowModel> DESCRIPTION = DaliColumnIdentifier.newId(
83  			SamplingEquipmentsTableRowModel.PROPERTY_DESCRIPTION,
84  			n("dali.property.description"),
85  			n("dali.property.description"),
86  			String.class);
87  
88  	public static final DaliColumnIdentifier<SamplingEquipmentsTableRowModel> COMMENT = DaliColumnIdentifier.newId(
89  		SamplingEquipmentsTableRowModel.PROPERTY_COMMENT,
90  		n("dali.property.comment"),
91  		n("dali.property.comment"),
92  		String.class,
93  		false);
94  
95  	public static final DaliColumnIdentifier<SamplingEquipmentsTableRowModel> CREATION_DATE = DaliColumnIdentifier.newReadOnlyId(
96  		SamplingEquipmentsTableRowModel.PROPERTY_CREATION_DATE,
97  		n("dali.property.date.creation"),
98  		n("dali.property.date.creation"),
99  		Date.class);
100 
101 	public static final DaliColumnIdentifier<SamplingEquipmentsTableRowModel> UPDATE_DATE = DaliColumnIdentifier.newReadOnlyId(
102 		SamplingEquipmentsTableRowModel.PROPERTY_UPDATE_DATE,
103 		n("dali.property.date.modification"),
104 		n("dali.property.date.modification"),
105 		Date.class);
106 
107 
108 	/** {@inheritDoc} */
109 	@Override
110 	public SamplingEquipmentsTableRowModel createNewRow() {
111 		return new SamplingEquipmentsTableRowModel();
112 	}
113 
114 	/** {@inheritDoc} */
115 	@Override
116 	public DaliColumnIdentifier<SamplingEquipmentsTableRowModel> getFirstColumnEditing() {
117 		return NAME;
118 	}
119 }