View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.rule;
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.content.manage.rule.controlrule.ControlRuleTableUIModel;
27  import fr.ifremer.dali.ui.swing.content.manage.rule.department.ControlDepartmentTableUIModel;
28  import fr.ifremer.dali.ui.swing.content.manage.rule.pmfm.ControlPmfmTableUIModel;
29  import fr.ifremer.dali.ui.swing.content.manage.rule.program.ControlProgramTableUIModel;
30  import fr.ifremer.dali.ui.swing.content.manage.rule.rulelist.RuleListUIModel;
31  import fr.ifremer.quadrige3.ui.swing.model.AbstractEmptyUIModel;
32  
33  /**
34   * Modele pour l administration de contextes.
35   */
36  public class RulesUIModel extends AbstractEmptyUIModel<RulesUIModel> {
37  
38      /**
39       * Liste regles model.
40       */
41      private RuleListUIModel ruleListUIModel;
42  
43      /**
44       * Programmes model.
45       */
46      private ControlProgramTableUIModel programsUIModel;
47  
48      /**
49       * Services model.
50       */
51      private ControlDepartmentTableUIModel departmentsUIModel;
52  
53      /**
54       * ReEgles model.
55       */
56      private ControlRuleTableUIModel controlRuleUIModel;
57  
58      /**
59       * PSFMs model.
60       */
61      private ControlPmfmTableUIModel pmfmUIModel;
62  
63      private boolean saveEnabled;
64      public static final String PROPERTY_SAVE_ENABLED = "saveEnabled";
65  
66      /** {@inheritDoc} */
67      @Override
68      public void setModify(boolean modify) {
69  
70          if (!modify) {
71              ruleListUIModel.setModify(false);
72              programsUIModel.setModify(false);
73              departmentsUIModel.setModify(false);
74              controlRuleUIModel.setModify(false);
75              pmfmUIModel.setModify(false);
76          }
77          super.setModify(modify);
78      }
79  
80      /**
81       * <p>Getter for the field <code>ruleListUIModel</code>.</p>
82       *
83       * @return a {@link RuleListUIModel} object.
84       */
85      public RuleListUIModel getRuleListUIModel() {
86          return ruleListUIModel;
87      }
88  
89      /**
90       * <p>Setter for the field <code>ruleListUIModel</code>.</p>
91       *
92       * @param ruleListUIModel a {@link RuleListUIModel} object.
93       */
94      public void setRuleListUIModel(RuleListUIModel ruleListUIModel) {
95          this.ruleListUIModel = ruleListUIModel;
96          this.ruleListUIModel.setParentModel(this);
97      }
98  
99      /**
100      * <p>Getter for the field <code>programsUIModel</code>.</p>
101      *
102      * @return a {@link fr.ifremer.dali.ui.swing.content.manage.rule.program.ControlProgramTableUIModel} object.
103      */
104     public ControlProgramTableUIModel getProgramsUIModel() {
105         return programsUIModel;
106     }
107 
108     /**
109      * <p>Setter for the field <code>programsUIModel</code>.</p>
110      *
111      * @param programsUIModel a {@link fr.ifremer.dali.ui.swing.content.manage.rule.program.ControlProgramTableUIModel} object.
112      */
113     public void setProgramsUIModel(ControlProgramTableUIModel programsUIModel) {
114         this.programsUIModel = programsUIModel;
115         this.programsUIModel.setParentModel(this);
116     }
117 
118     /**
119      * <p>Getter for the field <code>departmentsUIModel</code>.</p>
120      *
121      * @return a {@link fr.ifremer.dali.ui.swing.content.manage.rule.department.ControlDepartmentTableUIModel} object.
122      */
123     public ControlDepartmentTableUIModel getDepartmentsUIModel() {
124         return departmentsUIModel;
125     }
126 
127     /**
128      * <p>Setter for the field <code>departmentsUIModel</code>.</p>
129      *
130      * @param departmentsUIModel a {@link fr.ifremer.dali.ui.swing.content.manage.rule.department.ControlDepartmentTableUIModel} object.
131      */
132     public void setDepartmentsUIModel(ControlDepartmentTableUIModel departmentsUIModel) {
133         this.departmentsUIModel = departmentsUIModel;
134         this.departmentsUIModel.setParentModel(this);
135     }
136 
137     /**
138      * <p>Getter for the field <code>controlRuleUIModel</code>.</p>
139      *
140      * @return a {@link fr.ifremer.dali.ui.swing.content.manage.rule.controlrule.ControlRuleTableUIModel} object.
141      */
142     public ControlRuleTableUIModel getControlRuleUIModel() {
143         return controlRuleUIModel;
144     }
145 
146     /**
147      * <p>Setter for the field <code>controlRuleUIModel</code>.</p>
148      *
149      * @param controlRuleUIModel a {@link fr.ifremer.dali.ui.swing.content.manage.rule.controlrule.ControlRuleTableUIModel} object.
150      */
151     public void setControlRuleUIModel(ControlRuleTableUIModel controlRuleUIModel) {
152         this.controlRuleUIModel = controlRuleUIModel;
153         this.controlRuleUIModel.setParentModel(this);
154     }
155 
156     /**
157      * <p>Getter for the field <code>pmfmUIModel</code>.</p>
158      *
159      * @return a {@link ControlPmfmTableUIModel} object.
160      */
161     public ControlPmfmTableUIModel getPmfmUIModel() {
162         return pmfmUIModel;
163     }
164 
165     /**
166      * <p>Setter for the field <code>pmfmUIModel</code>.</p>
167      *
168      * @param pmfmUIModel a {@link ControlPmfmTableUIModel} object.
169      */
170     public void setPmfmUIModel(ControlPmfmTableUIModel pmfmUIModel) {
171         this.pmfmUIModel = pmfmUIModel;
172         this.pmfmUIModel.setParentModel(this);
173     }
174 
175     public boolean isSaveEnabled() {
176         return saveEnabled;
177     }
178 
179     public void setSaveEnabled(boolean saveEnabled) {
180         boolean oldValue = isSaveEnabled();
181         this.saveEnabled = saveEnabled;
182         firePropertyChange(PROPERTY_SAVE_ENABLED, oldValue, saveEnabled);
183     }
184 }