View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.rule.rulelist;
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.MonthDTO;
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 RuleListTableModel extends AbstractDaliTableModel<RuleListRowModel> {
39  
40  	/** Constant <code>CODE</code> */
41  	public static final DaliColumnIdentifier<RuleListRowModel> CODE = DaliColumnIdentifier.newId(
42  			RuleListRowModel.PROPERTY_CODE,
43  			n("dali.property.code"),
44  			n("dali.property.code"),
45  			String.class,
46              true);
47  	
48  	/** Constant <code>ACTIVE</code> */
49  	public static final DaliColumnIdentifier<RuleListRowModel> ACTIVE = DaliColumnIdentifier.newId(
50  			RuleListRowModel.PROPERTY_ACTIVE,
51  			n("dali.rule.ruleList.active.short"),
52  			n("dali.rule.ruleList.active.tip"),
53  			Boolean.class,
54              false);
55  	
56  	/** Constant <code>START_MONTH</code> */
57  	public static final DaliColumnIdentifier<RuleListRowModel> START_MONTH = DaliColumnIdentifier.newId(
58  			RuleListRowModel.PROPERTY_START_MONTH,
59  			n("dali.rule.ruleList.startMonth.short"),
60  			n("dali.rule.ruleList.startMonth.tip"),
61  			MonthDTO.class);
62  	
63  	/** Constant <code>END_MONTH</code> */
64  	public static final DaliColumnIdentifier<RuleListRowModel> END_MONTH = DaliColumnIdentifier.newId(
65  			RuleListRowModel.PROPERTY_END_MONTH,
66  			n("dali.rule.ruleList.endMonth.short"),
67  			n("dali.rule.ruleList.endMonth.tip"),
68  			MonthDTO.class);
69  	
70  	/** Constant <code>DESCRIPTION</code> */
71  	public static final DaliColumnIdentifier<RuleListRowModel> DESCRIPTION = DaliColumnIdentifier.newId(
72  			RuleListRowModel.PROPERTY_DESCRIPTION,
73  			n("dali.property.description"),
74  			n("dali.rule.ruleList.description.tip"),
75  			String.class,
76              true);
77  
78  	public static final DaliColumnIdentifier<RuleListRowModel> CREATION_DATE = DaliColumnIdentifier.newReadOnlyId(
79  		RuleListRowModel.PROPERTY_CREATION_DATE,
80  		n("dali.property.date.creation"),
81  		n("dali.property.date.creation"),
82  		Date.class);
83  
84  	public static final DaliColumnIdentifier<RuleListRowModel> UPDATE_DATE = DaliColumnIdentifier.newReadOnlyId(
85  		RuleListRowModel.PROPERTY_UPDATE_DATE,
86  		n("dali.property.date.modification"),
87  		n("dali.property.date.modification"),
88  		Date.class);
89  
90  
91  	/**
92  	 * <p>Constructor for RuleListTableModel.</p>
93  	 *
94  	 */
95  	public RuleListTableModel(final SwingTableColumnModel columnModel) {
96  		super(columnModel, true, false);
97  	}
98  
99  	/** {@inheritDoc} */
100 	@Override
101 	public RuleListRowModel createNewRow() {
102 		return new RuleListRowModel();
103 	}
104 
105 	/** {@inheritDoc} */
106 	@Override
107 	public DaliColumnIdentifier<RuleListRowModel> getFirstColumnEditing() {
108 		return START_MONTH;
109 	}
110 }