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