View Javadoc
1   package fr.ifremer.tutti.ui.swing.content.operation.catches.species.create;
2   
3   /*
4    * #%L
5    * Tutti :: UI
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2012 - 2017 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU General Public License as
13   * published by the Free Software Foundation, either version 3 of the
14   * License, or (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 General Public
22   * License along with this program.  If not, see
23   * <http://www.gnu.org/licenses/gpl-3.0.html>.
24   * #L%
25   */
26  
27  import fr.ifremer.tutti.persistence.entities.data.SampleCategoryModelEntry;
28  import fr.ifremer.tutti.persistence.entities.referential.CaracteristicQualitativeValue;
29  import fr.ifremer.tutti.persistence.entities.referential.Species;
30  import fr.ifremer.tutti.ui.swing.TuttiHelpBroker;
31  import fr.ifremer.tutti.ui.swing.util.TuttiUI;
32  import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
33  import java.awt.BorderLayout;
34  import java.awt.Color;
35  import java.awt.Component;
36  import java.awt.Container;
37  import java.awt.Font;
38  import java.awt.GridBagConstraints;
39  import java.awt.GridLayout;
40  import java.awt.Insets;
41  import java.awt.LayoutManager;
42  import java.util.ArrayList;
43  import java.util.HashMap;
44  import java.util.List;
45  import java.util.Map;
46  import java.util.TreeMap;
47  import javax.swing.JButton;
48  import javax.swing.JLabel;
49  import javax.swing.JPanel;
50  import javax.swing.JScrollPane;
51  import javax.swing.JSeparator;
52  import javax.swing.JTextField;
53  import javax.swing.ListSelectionModel;
54  import jaxx.runtime.JAXXBinding;
55  import jaxx.runtime.JAXXContext;
56  import jaxx.runtime.JAXXObject;
57  import jaxx.runtime.JAXXObjectDescriptor;
58  import jaxx.runtime.JAXXUtil;
59  import jaxx.runtime.JAXXValidator;
60  import jaxx.runtime.SwingUtil;
61  import jaxx.runtime.binding.DefaultJAXXBinding;
62  import jaxx.runtime.binding.SimpleJAXXObjectBinding;
63  import jaxx.runtime.context.DefaultJAXXContext;
64  import jaxx.runtime.swing.Table;
65  import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
66  import jaxx.runtime.swing.help.JAXXHelpUI;
67  import jaxx.runtime.validator.swing.SwingValidator;
68  import jaxx.runtime.validator.swing.SwingValidatorUtil;
69  import jaxx.runtime.validator.swing.meta.Validator;
70  import jaxx.runtime.validator.swing.meta.ValidatorField;
71  import jaxx.runtime.validator.swing.ui.ImageValidationUI;
72  import org.apache.commons.logging.Log;
73  import org.apache.commons.logging.LogFactory;
74  import org.jdesktop.swingx.JXTable;
75  import org.nuiton.jaxx.widgets.number.NumberEditor;
76  import static jaxx.runtime.SwingUtil.getStringValue;
77  import static org.nuiton.i18n.I18n.t;
78  
79  public class CreateSpeciesBatchUI extends JPanel implements JAXXHelpUI<TuttiHelpBroker>, TuttiUI<CreateSpeciesBatchUIModel, CreateSpeciesBatchUIHandler>, JAXXObject, JAXXValidator {
80  
81      /*-----------------------------------------------------------------------*/
82      /*------------------ Constants for all public bindings ------------------*/
83      /*-----------------------------------------------------------------------*/
84  
85      public static final String BINDING_BATCH_COUNT_FIELD_NUMBER_PATTERN = "batchCountField.numberPattern";
86      public static final String BINDING_BATCH_COUNT_FIELD_NUMBER_VALUE = "batchCountField.numberValue";
87      public static final String BINDING_BATCH_COUNT_LABEL_BACKGROUND = "batchCountLabel.background";
88      public static final String BINDING_BATCH_COUNT_LABEL_FONT_WEIGHT = "batchCountLabel.font-weight";
89      public static final String BINDING_BATCH_COUNT_LABEL_FOREGROUND = "batchCountLabel.foreground";
90      public static final String BINDING_BATCH_COUNT_LABEL_OPAQUE = "batchCountLabel.opaque";
91      public static final String BINDING_BATCH_SAMPLE_CATEGORY_WEIGHT_FIELD_NUMBER_VALUE = "batchSampleCategoryWeightField.numberValue";
92      public static final String BINDING_BATCH_WEIGHT_FIELD_NUMBER_VALUE = "batchWeightField.numberValue";
93      public static final String BINDING_CATEGORY_COMBO_BOX_DATA = "categoryComboBox.data";
94      public static final String BINDING_CATEGORY_COMBO_BOX_ENABLED = "categoryComboBox.enabled";
95      public static final String BINDING_CATEGORY_COMBO_BOX_SELECTED_ITEM = "categoryComboBox.selectedItem";
96      public static final String BINDING_CATEGORY_PANEL_VISIBLE = "categoryPanel.visible";
97      public static final String BINDING_SAMPLE_CATEGORY_COMBO_BOX_SELECTED_ITEM = "sampleCategoryComboBox.selectedItem";
98      public static final String BINDING_SAMPLE_WEIGHT_FIELD_TEXT = "sampleWeightField.text";
99      public static final String BINDING_SAVE_AND_CLOSE_BUTTON_ENABLED = "saveAndCloseButton.enabled";
100     public static final String BINDING_SAVE_AND_CONTINUE_BUTTON_ENABLED = "saveAndContinueButton.enabled";
101     public static final String BINDING_SAVE_AND_FREQUENCIES_BUTTON_BACKGROUND = "saveAndFrequenciesButton.background";
102     public static final String BINDING_SAVE_AND_FREQUENCIES_BUTTON_ENABLED = "saveAndFrequenciesButton.enabled";
103     public static final String BINDING_SAVE_AND_FREQUENCIES_BUTTON_FONT_WEIGHT = "saveAndFrequenciesButton.font-weight";
104     public static final String BINDING_SAVE_AND_FREQUENCIES_BUTTON_FOREGROUND = "saveAndFrequenciesButton.foreground";
105     public static final String BINDING_SPECIES_COMBO_BOX_DATA = "speciesComboBox.data";
106     public static final String BINDING_SPECIES_COMBO_BOX_SELECTED_ITEM = "speciesComboBox.selectedItem";
107     public static final String BINDING_SPECIES_FREQUENCY_MEASUREMENT_LABEL_TEXT = "speciesFrequencyMeasurementLabel.text";
108     public static final String BINDING_SPECIES_FREQUENCY_MEASUREMENT_LABEL_VISIBLE = "speciesFrequencyMeasurementLabel.visible";
109     public static final String BINDING_TABLE_ENABLED = "table.enabled";
110 
111     /*-----------------------------------------------------------------------*/
112     /*------------------------- Other static fields -------------------------*/
113     /*-----------------------------------------------------------------------*/
114 
115     private static final String $jaxxObjectDescriptor = "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";
116     private static final Log log = LogFactory.getLog(CreateSpeciesBatchUI.class);
117     private static final long serialVersionUID = 1L;
118 
119     /*-----------------------------------------------------------------------*/
120     /*--------------------------- Internal states ---------------------------*/
121     /*-----------------------------------------------------------------------*/
122 
123     protected List<Object> $activeBindings = new ArrayList<Object>();
124     protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
125     protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
126     protected Map<String, Object> $objectMap = new HashMap<String, Object>();
127     protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
128     private boolean allComponentsCreated;
129     protected final JAXXContext delegateContext = new DefaultJAXXContext();
130 
131     /*-----------------------------------------------------------------------*/
132     /*------------------------ Protected components  ------------------------*/
133     /*-----------------------------------------------------------------------*/
134 
135     protected JButton addSpeciesButton;
136     @ValidatorField( validatorId = "validator",  propertyName = "batchCount",  editorName = "batchCountField")
137     protected NumberEditor batchCountField;
138     protected JLabel batchCountLabel;
139     @ValidatorField( validatorId = "validator",  propertyName = "batchSampleCategoryWeight",  editorName = "batchSampleCategoryWeightField")
140     protected NumberEditor batchSampleCategoryWeightField;
141     protected JLabel batchSampleCategoryWeightLabel;
142     @ValidatorField( validatorId = "validator",  propertyName = "batchWeight",  editorName = "batchWeightField")
143     protected NumberEditor batchWeightField;
144     protected JLabel batchWeightLabel;
145     protected TuttiHelpBroker broker;
146     protected JButton cancelButton;
147     @ValidatorField( validatorId = "validator",  propertyName = "selectedCategory",  editorName = "categoryComboBox")
148     protected BeanFilterableComboBox<SampleCategoryModelEntry> categoryComboBox;
149     protected Table categoryConfigurationPanel;
150     protected JLabel categoryLabel;
151     protected JPanel categoryPanel;
152     protected Table configurationPanel;
153     protected CreateSpeciesBatchUI createSpeciesBatchTopPanel = this;
154     protected final CreateSpeciesBatchUIHandler handler = createHandler();
155     protected CreateSpeciesBatchUIModel model;
156     @ValidatorField( validatorId = "validator",  propertyName = "sampleCategory",  editorName = "sampleCategoryComboBox")
157     protected BeanFilterableComboBox<CaracteristicQualitativeValue> sampleCategoryComboBox;
158     protected JLabel sampleCategoryLabel;
159     @ValidatorField( validatorId = "validator",  propertyName = "sampleWeight",  editorName = "sampleWeightField")
160     protected JTextField sampleWeightField;
161     protected JLabel sampleWeightLabel;
162     protected JButton saveAndCloseButton;
163     protected JButton saveAndContinueButton;
164     protected JButton saveAndFrequenciesButton;
165     @ValidatorField( validatorId = "validator",  propertyName = "species",  editorName = "speciesComboBox")
166     protected BeanFilterableComboBox<Species> speciesComboBox;
167     protected JLabel speciesFrequencyMeasurementLabel;
168     protected JLabel speciesLabel;
169     protected JXTable table;
170     protected JScrollPane tableScrollPane;
171     @Validator( validatorId = "validator")
172     protected SwingValidator<CreateSpeciesBatchUIModel> validator;
173     protected List<String> validatorIds = new ArrayList<String>();
174 
175     /*-----------------------------------------------------------------------*/
176     /*------------------------- Private components  -------------------------*/
177     /*-----------------------------------------------------------------------*/
178 
179     private JLabel $JLabel0;
180     private JPanel $JPanel0;
181     private JSeparator $JSeparator0;
182 
183     /*-----------------------------------------------------------------------*/
184     /*---------------------- Raw body code from script ----------------------*/
185     /*-----------------------------------------------------------------------*/
186 
187     // Pour savoir sur quel modèle on est (espèce ou benthos)
188     private String speciesOrBenthosContext;
189     
190     
191     public String getSpeciesOrBenthosContext() { return speciesOrBenthosContext; }
192 
193     /*-----------------------------------------------------------------------*/
194     /*---------------------------- Constructors  ----------------------------*/
195     /*-----------------------------------------------------------------------*/
196 
197     public CreateSpeciesBatchUI(TuttiUI parentUI, String speciesOrBenthosContext) {
198         TuttiUIUtil.setParentUI(this, parentUI);
199             this.speciesOrBenthosContext = speciesOrBenthosContext;
200             $initialize();
201     }
202 
203     public CreateSpeciesBatchUI(LayoutManager param0, boolean param1) {
204         super(param0 ,param1);
205         $initialize();
206     }
207 
208     public CreateSpeciesBatchUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
209         super(param1 ,param2);
210         JAXXUtil.initContext(this, parentContext);
211         $initialize();
212     }
213 
214     public CreateSpeciesBatchUI(LayoutManager param0) {
215         super(param0);
216         $initialize();
217     }
218 
219     public CreateSpeciesBatchUI(JAXXContext parentContext, LayoutManager param1) {
220         super(param1);
221         JAXXUtil.initContext(this, parentContext);
222         $initialize();
223     }
224 
225     public CreateSpeciesBatchUI() {
226         $initialize();
227     }
228 
229     public CreateSpeciesBatchUI(JAXXContext parentContext) {
230         JAXXUtil.initContext(this, parentContext);
231         $initialize();
232     }
233 
234     public CreateSpeciesBatchUI(boolean param0) {
235         super(param0);
236         $initialize();
237     }
238 
239     public CreateSpeciesBatchUI(JAXXContext parentContext, boolean param1) {
240         super(param1);
241         JAXXUtil.initContext(this, parentContext);
242         $initialize();
243     }
244 
245     /*-----------------------------------------------------------------------*/
246     /*--------------------------- Statics methods ---------------------------*/
247     /*-----------------------------------------------------------------------*/
248 
249     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
250         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
251     }
252 
253     /*-----------------------------------------------------------------------*/
254     /*---------------------- JAXXObject implementation ----------------------*/
255     /*-----------------------------------------------------------------------*/
256 
257     @Override
258     public void applyDataBinding(String $binding) {
259         if (allComponentsCreated && $bindings.containsKey($binding)) {
260             getDataBinding($binding).applyDataBinding();
261         }
262         processDataBinding($binding);
263     }
264 
265     @Override
266     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
267         super.firePropertyChange(propertyName, oldValue, newValue);
268     }
269 
270     @Override
271     public Map<String, Object> get$objectMap() {
272         return $objectMap;
273     }
274 
275     @Override
276     public JAXXBinding getDataBinding(String bindingId) {
277         return $bindings.get(bindingId);
278     }
279 
280     @Override
281     public JAXXBinding[] getDataBindings() {
282         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
283     }
284 
285     @Override
286     public Object getObjectById(String id) {
287         return $objectMap.get(id);
288     }
289 
290     @Override
291     public void processDataBinding(String $binding, boolean $force) {
292         if (!$force && $activeBindings.contains($binding)) { 
293             return;
294         }
295         $activeBindings.add($binding);
296         try {
297             if (allComponentsCreated && $bindings.containsKey($binding)) {
298                 getDataBinding($binding).processDataBinding();
299             }
300         } finally {
301             $activeBindings.remove($binding);
302         }
303     }
304 
305     @Override
306     public void processDataBinding(String $binding) {
307         processDataBinding($binding, false);
308     }
309 
310     @Override
311     public void registerDataBinding(JAXXBinding binding) {
312         $bindings.put(binding.getId(), binding);
313     }
314 
315     @Override
316     public void removeDataBinding(String $binding) {
317         if (allComponentsCreated && $bindings.containsKey($binding)) {
318             getDataBinding($binding).removeDataBinding();
319         }
320     }
321 
322     /*-----------------------------------------------------------------------*/
323     /*--------------------- JAXXContext implementation  ---------------------*/
324     /*-----------------------------------------------------------------------*/
325 
326     @Override
327     public <T> T getContextValue(Class<T> clazz) {
328         return delegateContext.getContextValue(clazz, null);
329     }
330 
331     @Override
332     public <T> T getContextValue(Class<T> clazz, String name) {
333         return delegateContext.getContextValue(clazz, name);
334     }
335 
336     @Override
337     public JAXXContext getDelegateContext() {
338         return delegateContext;
339     }
340 
341     @Override
342     public <O extends Container> O getParentContainer(Class<O> clazz) {
343         return SwingUtil.getParentContainer(this, clazz);
344     }
345 
346     @Override
347     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
348         return SwingUtil.getParentContainer(source, clazz);
349     }
350 
351     @Override
352     public <T> void removeContextValue(Class<T> clazz) {
353         delegateContext.removeContextValue(clazz, null);
354     }
355 
356     @Override
357     public <T> void removeContextValue(Class<T> clazz, String name) {
358         delegateContext.removeContextValue(clazz, name);
359     }
360 
361     @Override
362     public <T> void setContextValue(T o) {
363         delegateContext.setContextValue(o, null);
364     }
365 
366     @Override
367     public <T> void setContextValue(T o, String name) {
368         delegateContext.setContextValue(o, name);
369     }
370 
371     /*-----------------------------------------------------------------------*/
372     /*-------------------- JAXXValidator implementation  --------------------*/
373     /*-----------------------------------------------------------------------*/
374 
375     @Override
376     public SwingValidator<?> getValidator(String validatorId) {
377         return (SwingValidator<?>) (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);
378     }
379 
380     @Override
381     public List<String> getValidatorIds() {
382         return validatorIds;
383     }
384 
385     @Override
386     public void registerValidatorFields() {
387         SwingValidatorUtil.detectValidatorFields(this);
388     }
389 
390     /*-----------------------------------------------------------------------*/
391     /*----------------------- Public acessor methods  -----------------------*/
392     /*-----------------------------------------------------------------------*/
393 
394     public JButton getAddSpeciesButton() {
395         return addSpeciesButton;
396     }
397 
398     public NumberEditor getBatchCountField() {
399         return batchCountField;
400     }
401 
402     public JLabel getBatchCountLabel() {
403         return batchCountLabel;
404     }
405 
406     public NumberEditor getBatchSampleCategoryWeightField() {
407         return batchSampleCategoryWeightField;
408     }
409 
410     public JLabel getBatchSampleCategoryWeightLabel() {
411         return batchSampleCategoryWeightLabel;
412     }
413 
414     public NumberEditor getBatchWeightField() {
415         return batchWeightField;
416     }
417 
418     public JLabel getBatchWeightLabel() {
419         return batchWeightLabel;
420     }
421 
422     public TuttiHelpBroker getBroker() {
423         return broker;
424     }
425 
426     public JButton getCancelButton() {
427         return cancelButton;
428     }
429 
430     public BeanFilterableComboBox<SampleCategoryModelEntry> getCategoryComboBox() {
431         return categoryComboBox;
432     }
433 
434     public Table getCategoryConfigurationPanel() {
435         return categoryConfigurationPanel;
436     }
437 
438     public JLabel getCategoryLabel() {
439         return categoryLabel;
440     }
441 
442     public JPanel getCategoryPanel() {
443         return categoryPanel;
444     }
445 
446     public Table getConfigurationPanel() {
447         return configurationPanel;
448     }
449 
450     public CreateSpeciesBatchUIHandler getHandler() {
451         return handler;
452     }
453 
454     public CreateSpeciesBatchUIModel getModel() {
455         return model;
456     }
457 
458     public BeanFilterableComboBox<CaracteristicQualitativeValue> getSampleCategoryComboBox() {
459         return sampleCategoryComboBox;
460     }
461 
462     public JLabel getSampleCategoryLabel() {
463         return sampleCategoryLabel;
464     }
465 
466     public JTextField getSampleWeightField() {
467         return sampleWeightField;
468     }
469 
470     public JLabel getSampleWeightLabel() {
471         return sampleWeightLabel;
472     }
473 
474     public JButton getSaveAndCloseButton() {
475         return saveAndCloseButton;
476     }
477 
478     public JButton getSaveAndContinueButton() {
479         return saveAndContinueButton;
480     }
481 
482     public JButton getSaveAndFrequenciesButton() {
483         return saveAndFrequenciesButton;
484     }
485 
486     public BeanFilterableComboBox<Species> getSpeciesComboBox() {
487         return speciesComboBox;
488     }
489 
490     public JLabel getSpeciesFrequencyMeasurementLabel() {
491         return speciesFrequencyMeasurementLabel;
492     }
493 
494     public JLabel getSpeciesLabel() {
495         return speciesLabel;
496     }
497 
498     public JXTable getTable() {
499         return table;
500     }
501 
502     public JScrollPane getTableScrollPane() {
503         return tableScrollPane;
504     }
505 
506     public SwingValidator<CreateSpeciesBatchUIModel> getValidator() {
507         return validator;
508     }
509 
510     /*-----------------------------------------------------------------------*/
511     /*---------------------------- Other methods ----------------------------*/
512     /*-----------------------------------------------------------------------*/
513 
514     @Override
515     public void registerHelpId(TuttiHelpBroker broker, Component component, String helpId) {
516         broker.installUI(component, helpId);
517     }
518 
519     @Override
520     public void showHelp(String helpId) {
521         getBroker().showHelp(this, helpId);
522     }
523 
524     /*-----------------------------------------------------------------------*/
525     /*--------------------- Protected acessors methods  ---------------------*/
526     /*-----------------------------------------------------------------------*/
527 
528     protected JLabel get$JLabel0() {
529         return $JLabel0;
530     }
531 
532     protected JPanel get$JPanel0() {
533         return $JPanel0;
534     }
535 
536     protected JSeparator get$JSeparator0() {
537         return $JSeparator0;
538     }
539 
540     /*-----------------------------------------------------------------------*/
541     /*--------------------- Components creation methods ---------------------*/
542     /*-----------------------------------------------------------------------*/
543 
544     protected void addChildrenToCategoryConfigurationPanel() {
545         if (!allComponentsCreated) {
546             return;
547         }
548         categoryConfigurationPanel.add($JSeparator0, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
549         categoryConfigurationPanel.add(categoryLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 17, 1, new Insets(3, 3, 3, 3), 0, 0));
550         categoryConfigurationPanel.add(SwingUtil.boxComponentWithJxLayer(categoryComboBox), new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
551         categoryConfigurationPanel.add(sampleWeightLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 1, new Insets(3, 3, 3, 3), 0, 0));
552         categoryConfigurationPanel.add(SwingUtil.boxComponentWithJxLayer(sampleWeightField), new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
553     }
554 
555     protected void addChildrenToCategoryPanel() {
556         if (!allComponentsCreated) {
557             return;
558         }
559         categoryPanel.add(categoryConfigurationPanel, BorderLayout.NORTH);
560         categoryPanel.add(tableScrollPane, BorderLayout.CENTER);
561     }
562 
563     protected void addChildrenToConfigurationPanel() {
564         if (!allComponentsCreated) {
565             return;
566         }
567         configurationPanel.add(speciesLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 17, 1, new Insets(3, 3, 3, 3), 0, 0));
568         configurationPanel.add(SwingUtil.boxComponentWithJxLayer(speciesComboBox), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
569         configurationPanel.add(addSpeciesButton, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
570         configurationPanel.add($JLabel0, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 17, 1, new Insets(3, 3, 3, 3), 0, 0));
571         configurationPanel.add(speciesFrequencyMeasurementLabel, new GridBagConstraints(1, 1, 2, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
572         configurationPanel.add(sampleCategoryLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 17, 1, new Insets(3, 3, 3, 3), 0, 0));
573         configurationPanel.add(SwingUtil.boxComponentWithJxLayer(sampleCategoryComboBox), new GridBagConstraints(1, 2, 2, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
574         configurationPanel.add(batchSampleCategoryWeightLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 17, 1, new Insets(3, 3, 3, 3), 0, 0));
575         configurationPanel.add(SwingUtil.boxComponentWithJxLayer(batchSampleCategoryWeightField), new GridBagConstraints(1, 3, 2, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
576         configurationPanel.add(batchWeightLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 17, 1, new Insets(3, 3, 3, 3), 0, 0));
577         configurationPanel.add(SwingUtil.boxComponentWithJxLayer(batchWeightField), new GridBagConstraints(1, 4, 2, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
578         configurationPanel.add(batchCountLabel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, 17, 1, new Insets(3, 3, 3, 3), 0, 0));
579         configurationPanel.add(SwingUtil.boxComponentWithJxLayer(batchCountField), new GridBagConstraints(1, 5, 2, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
580     }
581 
582     protected void addChildrenToCreateSpeciesBatchTopPanel() {
583         if (!allComponentsCreated) {
584             return;
585         }
586         add(configurationPanel, BorderLayout.NORTH);
587         add(categoryPanel, BorderLayout.CENTER);
588         add($JPanel0, BorderLayout.SOUTH);
589     }
590 
591     protected void addChildrenToTableScrollPane() {
592         if (!allComponentsCreated) {
593             return;
594         }
595         tableScrollPane.getViewport().add(table);
596     }
597 
598     protected void addChildrenToValidator() {
599         if (!allComponentsCreated) {
600             return;
601         }
602         validator.setUiClass(ImageValidationUI.class);
603         validator.setBean(model);
604     }
605 
606     protected void createAddSpeciesButton() {
607         $objectMap.put("addSpeciesButton", addSpeciesButton = new JButton());
608         
609         addSpeciesButton.setName("addSpeciesButton");
610         addSpeciesButton.setFocusable(false);
611         addSpeciesButton.setText(t("tutti.createSpeciesBatch.action.addSpecies"));
612         addSpeciesButton.setToolTipText(t("tutti.createSpeciesBatch.action.addSpecies.tip"));
613         addSpeciesButton.putClientProperty("help", "tutti.createSpeciesBatch.action.addSpecies.help");
614         addSpeciesButton.putClientProperty("applicationAction", fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.actions.SelectSpeciesForSpeciesBatchAction.class);
615     }
616 
617     protected void createBatchCountField() {
618         $objectMap.put("batchCountField", batchCountField = new NumberEditor(this));
619         
620         batchCountField.setName("batchCountField");
621         batchCountField.setProperty("batchCount");
622         batchCountField.setShowReset(true);
623         batchCountField.putClientProperty("help", "tutti.createSpeciesBatch.field.batchCount.help");
624     }
625 
626     protected void createBatchCountLabel() {
627         $objectMap.put("batchCountLabel", batchCountLabel = new JLabel());
628         
629         batchCountLabel.setName("batchCountLabel");
630         batchCountLabel.setText(t("tutti.createSpeciesBatch.field.batchCount"));
631         batchCountLabel.setToolTipText(t("tutti.createSpeciesBatch.field.batchCount.tip"));
632         batchCountLabel.putClientProperty("help", "tutti.createSpeciesBatch.field.batchCount.help");
633     }
634 
635     protected void createBatchSampleCategoryWeightField() {
636         $objectMap.put("batchSampleCategoryWeightField", batchSampleCategoryWeightField = new NumberEditor(this));
637         
638         batchSampleCategoryWeightField.setName("batchSampleCategoryWeightField");
639         batchSampleCategoryWeightField.setProperty("batchSampleCategoryWeight");
640         batchSampleCategoryWeightField.setShowReset(true);
641         batchSampleCategoryWeightField.putClientProperty("help", "tutti.createSpeciesBatch.field.batchSampleCategoryWeight.help");
642     }
643 
644     protected void createBatchSampleCategoryWeightLabel() {
645         $objectMap.put("batchSampleCategoryWeightLabel", batchSampleCategoryWeightLabel = new JLabel());
646         
647         batchSampleCategoryWeightLabel.setName("batchSampleCategoryWeightLabel");
648         batchSampleCategoryWeightLabel.setText(t("tutti.createSpeciesBatch.field.batchSampleCategoryWeight"));
649         batchSampleCategoryWeightLabel.setToolTipText(t("tutti.createSpeciesBatch.field.batchSampleCategoryWeight.tip"));
650         batchSampleCategoryWeightLabel.putClientProperty("help", "tutti.createSpeciesBatch.field.batchSampleCategoryWeight.help");
651         batchSampleCategoryWeightLabel.putClientProperty("addWeightUnit", model.getWeightUnit());
652     }
653 
654     protected void createBatchWeightField() {
655         $objectMap.put("batchWeightField", batchWeightField = new NumberEditor(this));
656         
657         batchWeightField.setName("batchWeightField");
658         batchWeightField.setProperty("batchWeight");
659         batchWeightField.setShowReset(true);
660         batchWeightField.putClientProperty("help", "tutti.createSpeciesBatch.field.batchWeight.help");
661     }
662 
663     protected void createBatchWeightLabel() {
664         $objectMap.put("batchWeightLabel", batchWeightLabel = new JLabel());
665         
666         batchWeightLabel.setName("batchWeightLabel");
667         batchWeightLabel.setText(t("tutti.createSpeciesBatch.field.batchWeight"));
668         batchWeightLabel.setToolTipText(t("tutti.createSpeciesBatch.field.batchWeight.tip"));
669         batchWeightLabel.putClientProperty("help", "tutti.createSpeciesBatch.field.batchWeight.help");
670         batchWeightLabel.putClientProperty("addWeightUnit", model.getWeightUnit());
671     }
672 
673     protected void createBroker() {
674         $objectMap.put("broker", broker = new TuttiHelpBroker("tutti.createSpeciesBatch.help"));
675     }
676 
677     protected void createCancelButton() {
678         $objectMap.put("cancelButton", cancelButton = new JButton());
679         
680         cancelButton.setName("cancelButton");
681         cancelButton.setText(t("tutti.createSpeciesBatch.action.cancel"));
682         cancelButton.setToolTipText(t("tutti.createSpeciesBatch.action.cancel.tip"));
683         cancelButton.putClientProperty("help", "tutti.createSpeciesBatch.action.cancel.help");
684         cancelButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.actions.CreateSpeciesBatchCancelAction.class);
685     }
686 
687     protected void createCategoryComboBox() {
688         $objectMap.put("categoryComboBox", categoryComboBox = new BeanFilterableComboBox<SampleCategoryModelEntry>(this));
689         
690         categoryComboBox.setName("categoryComboBox");
691         categoryComboBox.setShowDecorator(false);
692         categoryComboBox.setProperty("selectedCategory");
693         categoryComboBox.setSortable(false);
694         categoryComboBox.setShowReset(false);
695         categoryComboBox.putClientProperty("help", "tutti.createSpeciesBatch.field.categoryField.help");
696     }
697 
698     protected void createCategoryConfigurationPanel() {
699         $objectMap.put("categoryConfigurationPanel", categoryConfigurationPanel = new Table());
700         
701         categoryConfigurationPanel.setName("categoryConfigurationPanel");
702     }
703 
704     protected void createCategoryLabel() {
705         $objectMap.put("categoryLabel", categoryLabel = new JLabel());
706         
707         categoryLabel.setName("categoryLabel");
708         categoryLabel.setText(t("tutti.createSpeciesBatch.field.category"));
709         categoryLabel.setToolTipText(t("tutti.createSpeciesBatch.field.category.tip"));
710         categoryLabel.putClientProperty("help", "tutti.createSpeciesBatch.field.categoryField.help");
711     }
712 
713     protected void createCategoryPanel() {
714         $objectMap.put("categoryPanel", categoryPanel = new JPanel());
715         
716         categoryPanel.setName("categoryPanel");
717         categoryPanel.setLayout(new BorderLayout());
718     }
719 
720     protected void createConfigurationPanel() {
721         $objectMap.put("configurationPanel", configurationPanel = new Table());
722         
723         configurationPanel.setName("configurationPanel");
724     }
725 
726     protected CreateSpeciesBatchUIHandler createHandler() {
727         return new CreateSpeciesBatchUIHandler();
728     }
729 
730     protected void createModel() {
731         $objectMap.put("model", model = getContextValue(CreateSpeciesBatchUIModel.class));
732     }
733 
734     protected void createSampleCategoryComboBox() {
735         $objectMap.put("sampleCategoryComboBox", sampleCategoryComboBox = new BeanFilterableComboBox<CaracteristicQualitativeValue>(this));
736         
737         sampleCategoryComboBox.setName("sampleCategoryComboBox");
738         sampleCategoryComboBox.setProperty("sampleCategory");
739         sampleCategoryComboBox.setShowReset(true);
740         sampleCategoryComboBox.putClientProperty("help", "tutti.createSpeciesBatch.field.sampleCategory.help");
741     }
742 
743     protected void createSampleCategoryLabel() {
744         $objectMap.put("sampleCategoryLabel", sampleCategoryLabel = new JLabel());
745         
746         sampleCategoryLabel.setName("sampleCategoryLabel");
747         sampleCategoryLabel.setText(t("tutti.createSpeciesBatch.field.sampleCategory"));
748         sampleCategoryLabel.setToolTipText(t("tutti.createSpeciesBatch.field.sampleCategory.tip"));
749         sampleCategoryLabel.putClientProperty("help", "tutti.createSpeciesBatch.field.sampleCategory.help");
750     }
751 
752     protected void createSampleWeightField() {
753         $objectMap.put("sampleWeightField", sampleWeightField = new JTextField());
754         
755         sampleWeightField.setName("sampleWeightField");
756         sampleWeightField.setColumns(15);
757         sampleWeightField.putClientProperty("help", "tutti.createSpeciesBatch.field.sampleWeightField.help");
758         sampleWeightField.putClientProperty("computed", true);
759     }
760 
761     protected void createSampleWeightLabel() {
762         $objectMap.put("sampleWeightLabel", sampleWeightLabel = new JLabel());
763         
764         sampleWeightLabel.setName("sampleWeightLabel");
765         sampleWeightLabel.setText(t("tutti.createSpeciesBatch.field.sampleWeight"));
766         sampleWeightLabel.setToolTipText(t("tutti.createSpeciesBatch.field.sampleWeight.tip"));
767         sampleWeightLabel.putClientProperty("help", "tutti.createSpeciesBatch.field.sampleWeightField.help");
768         sampleWeightLabel.putClientProperty("addWeightUnit", model.getWeightUnit());
769     }
770 
771     protected void createSaveAndCloseButton() {
772         $objectMap.put("saveAndCloseButton", saveAndCloseButton = new JButton());
773         
774         saveAndCloseButton.setName("saveAndCloseButton");
775         saveAndCloseButton.setText(t("tutti.createSpeciesBatch.action.saveAndClose"));
776         saveAndCloseButton.setToolTipText(t("tutti.createSpeciesBatch.action.saveAndClose.tip"));
777         saveAndCloseButton.putClientProperty("help", "tutti.createSpeciesBatch.action.saveAndClose.help");
778         saveAndCloseButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.actions.CreateSpeciesBatchAndCloseAction.class);
779     }
780 
781     protected void createSaveAndContinueButton() {
782         $objectMap.put("saveAndContinueButton", saveAndContinueButton = new JButton());
783         
784         saveAndContinueButton.setName("saveAndContinueButton");
785         saveAndContinueButton.setText(t("tutti.createSpeciesBatch.action.saveAndContinue"));
786         saveAndContinueButton.setToolTipText(t("tutti.createSpeciesBatch.action.saveAndContinue.tip"));
787         saveAndContinueButton.putClientProperty("help", "tutti.createSpeciesBatch.action.saveAndContinue.help");
788         saveAndContinueButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.actions.CreateSpeciesBatchAndContinueAction.class);
789     }
790 
791     protected void createSaveAndFrequenciesButton() {
792         $objectMap.put("saveAndFrequenciesButton", saveAndFrequenciesButton = new JButton());
793         
794         saveAndFrequenciesButton.setName("saveAndFrequenciesButton");
795         saveAndFrequenciesButton.setText(t("tutti.createSpeciesBatch.action.saveAndFrequencies"));
796         saveAndFrequenciesButton.setToolTipText(t("tutti.createSpeciesBatch.action.saveAndFrequencies.tip"));
797         saveAndFrequenciesButton.putClientProperty("help", "tutti.createSpeciesBatch.action.saveAndFrequencies.help");
798         saveAndFrequenciesButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.operation.catches.species.create.actions.CreateSpeciesBatchAndFrequenciesAction.class);
799     }
800 
801     protected void createSpeciesComboBox() {
802         $objectMap.put("speciesComboBox", speciesComboBox = new BeanFilterableComboBox<Species>(this));
803         
804         speciesComboBox.setName("speciesComboBox");
805         speciesComboBox.setProperty("species");
806         speciesComboBox.setShowReset(true);
807         speciesComboBox.putClientProperty("help", "tutti.createSpeciesBatch.field.species.help");
808     }
809 
810     protected void createSpeciesFrequencyMeasurementLabel() {
811         $objectMap.put("speciesFrequencyMeasurementLabel", speciesFrequencyMeasurementLabel = new JLabel());
812         
813         speciesFrequencyMeasurementLabel.setName("speciesFrequencyMeasurementLabel");
814         speciesFrequencyMeasurementLabel.setOpaque(true);
815         if (speciesFrequencyMeasurementLabel.getFont() != null) {
816             speciesFrequencyMeasurementLabel.setFont(speciesFrequencyMeasurementLabel.getFont().deriveFont(speciesFrequencyMeasurementLabel.getFont().getStyle() | Font.BOLD));
817         }
818     }
819 
820     protected void createSpeciesLabel() {
821         $objectMap.put("speciesLabel", speciesLabel = new JLabel());
822         
823         speciesLabel.setName("speciesLabel");
824         speciesLabel.setText(t("tutti.createSpeciesBatch.field.species"));
825         speciesLabel.setToolTipText(t("tutti.createSpeciesBatch.field.species.tip"));
826         speciesLabel.putClientProperty("help", "tutti.createSpeciesBatch.field.species.help");
827     }
828 
829     protected void createTable() {
830         $objectMap.put("table", table = new JXTable());
831         
832         table.setName("table");
833         table.setSortable(false);
834     }
835 
836     protected void createTableScrollPane() {
837         $objectMap.put("tableScrollPane", tableScrollPane = new JScrollPane());
838         
839         tableScrollPane.setName("tableScrollPane");
840     }
841 
842     protected void createValidator() {
843         $objectMap.put("validator", validator = SwingValidator.newValidator(CreateSpeciesBatchUIModel.class, null));
844     }
845 
846     /*-----------------------------------------------------------------------*/
847     /*------------------------ Internal jaxx methods ------------------------*/
848     /*-----------------------------------------------------------------------*/
849 
850     private void $completeSetup() {
851         allComponentsCreated = true;
852         if (log.isDebugEnabled()) {
853             log.debug(this);
854         }
855         addChildrenToCreateSpeciesBatchTopPanel();
856         addChildrenToValidator();
857         addChildrenToConfigurationPanel();
858         addChildrenToCategoryPanel();
859         addChildrenToCategoryConfigurationPanel();
860         addChildrenToTableScrollPane();
861         // inline complete setup of $JPanel0
862         $JPanel0.add(cancelButton);
863         $JPanel0.add(saveAndContinueButton);
864         $JPanel0.add(saveAndCloseButton);
865         $JPanel0.add(saveAndFrequenciesButton);
866         
867         // apply 25 data bindings
868         JAXXUtil.applyDataBinding(this, $bindings.keySet());
869         
870         // apply 43 property setters
871         speciesComboBox.setBeanType(Species.class);
872         sampleCategoryComboBox.setBeanType(CaracteristicQualitativeValue.class);
873         categoryComboBox.setBeanType(SampleCategoryModelEntry.class);
874         speciesLabel.setLabelFor(speciesComboBox);
875         speciesComboBox.setBean(model);
876         addSpeciesButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.createSpeciesBatch.action.addSpecies.mnemonic"),'Z'));
877         speciesFrequencyMeasurementLabel.setBorder(new javax.swing.border.EmptyBorder(5, 10, 5, 10));
878         speciesFrequencyMeasurementLabel.setBackground( handler.getConfig().getColorHighlightInfoBackground() );
879         speciesFrequencyMeasurementLabel.setForeground( handler.getConfig().getColorHighlightInfoForeground() );
880         sampleCategoryLabel.setLabelFor(sampleCategoryComboBox);
881         sampleCategoryComboBox.setBean(model);
882         batchSampleCategoryWeightLabel.setLabelFor(batchSampleCategoryWeightField);
883         batchSampleCategoryWeightField.setAutoPopup(handler.getConfig().isAutoPopupNumberEditor());
884         batchSampleCategoryWeightField.setNumberType(Float.class);
885         batchSampleCategoryWeightField.setShowPopupButton(handler.getConfig().isShowNumberEditorButton());
886         batchSampleCategoryWeightField.setBean(model);
887         batchWeightLabel.setLabelFor(batchWeightField);
888         batchWeightField.setAutoPopup(handler.getConfig().isAutoPopupNumberEditor());
889         batchWeightField.setNumberType(Float.class);
890         batchWeightField.setShowPopupButton(handler.getConfig().isShowNumberEditorButton());
891         batchWeightField.setBean(model);
892         batchCountLabel.setLabelFor(batchCountField);
893         batchCountField.setAutoPopup(handler.getConfig().isAutoPopupNumberEditor());
894         batchCountField.setNumberType(Integer.class);
895         batchCountField.setShowPopupButton(handler.getConfig().isShowNumberEditorButton());
896         batchCountField.setBean(model);
897         categoryLabel.setLabelFor(categoryComboBox);
898         categoryComboBox.setBean(model);
899         sampleWeightLabel.setLabelFor(sampleWeightField);
900         table.setSelectionBackground(null);
901         table.setSelectionForeground(Color.BLACK);
902         table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
903         cancelButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.createSpeciesBatch.action.cancel.mnemonic"),'Z'));
904         cancelButton.setIcon(SwingUtil.createActionIcon("cancel"));
905         saveAndContinueButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.createSpeciesBatch.action.saveAndContinue.mnemonic"),'Z'));
906         saveAndContinueButton.setIcon(SwingUtil.createActionIcon("save"));
907         saveAndCloseButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.createSpeciesBatch.action.saveAndClose.mnemonic"),'Z'));
908         saveAndCloseButton.setIcon(SwingUtil.createActionIcon("save"));
909         saveAndFrequenciesButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.createSpeciesBatch.action.saveAndFrequencies.mnemonic"),'Z'));
910         saveAndFrequenciesButton.setIcon(SwingUtil.createActionIcon("save"));
911         // late initializer
912         // help broker setup
913         TuttiHelpBroker _broker = getBroker();
914         registerHelpId(_broker, createSpeciesBatchTopPanel, "tutti.createSpeciesBatch.help");
915         registerHelpId(_broker, speciesLabel, "tutti.createSpeciesBatch.field.species.help");
916         registerHelpId(_broker, speciesComboBox, "tutti.createSpeciesBatch.field.species.help");
917         registerHelpId(_broker, addSpeciesButton, "tutti.createSpeciesBatch.action.addSpecies.help");
918         registerHelpId(_broker, sampleCategoryLabel, "tutti.createSpeciesBatch.field.sampleCategory.help");
919         registerHelpId(_broker, sampleCategoryComboBox, "tutti.createSpeciesBatch.field.sampleCategory.help");
920         registerHelpId(_broker, batchSampleCategoryWeightLabel, "tutti.createSpeciesBatch.field.batchSampleCategoryWeight.help");
921         registerHelpId(_broker, batchSampleCategoryWeightField, "tutti.createSpeciesBatch.field.batchSampleCategoryWeight.help");
922         registerHelpId(_broker, batchWeightLabel, "tutti.createSpeciesBatch.field.batchWeight.help");
923         registerHelpId(_broker, batchWeightField, "tutti.createSpeciesBatch.field.batchWeight.help");
924         registerHelpId(_broker, batchCountLabel, "tutti.createSpeciesBatch.field.batchCount.help");
925         registerHelpId(_broker, batchCountField, "tutti.createSpeciesBatch.field.batchCount.help");
926         registerHelpId(_broker, categoryLabel, "tutti.createSpeciesBatch.field.categoryField.help");
927         registerHelpId(_broker, categoryComboBox, "tutti.createSpeciesBatch.field.categoryField.help");
928         registerHelpId(_broker, sampleWeightLabel, "tutti.createSpeciesBatch.field.sampleWeightField.help");
929         registerHelpId(_broker, sampleWeightField, "tutti.createSpeciesBatch.field.sampleWeightField.help");
930         registerHelpId(_broker, cancelButton, "tutti.createSpeciesBatch.action.cancel.help");
931         registerHelpId(_broker, saveAndContinueButton, "tutti.createSpeciesBatch.action.saveAndContinue.help");
932         registerHelpId(_broker, saveAndCloseButton, "tutti.createSpeciesBatch.action.saveAndClose.help");
933         registerHelpId(_broker, saveAndFrequenciesButton, "tutti.createSpeciesBatch.action.saveAndFrequencies.help");
934         _broker.prepareUI(this);
935         // register 1 validator(s)
936         validatorIds = SwingValidatorUtil.detectValidators(this);
937         SwingValidatorUtil.installUI(this);
938     }
939 
940     private void $initialize() {
941         if (allComponentsCreated) {
942             return;
943         }
944         if (log.isDebugEnabled()) {
945             log.debug(this);
946         }
947         handler.beforeInit(this);
948         $objectMap.put("createSpeciesBatchTopPanel", createSpeciesBatchTopPanel);
949         createModel();
950         createValidator();
951         createBroker();
952         createConfigurationPanel();
953         createSpeciesLabel();
954         createSpeciesComboBox();
955         createAddSpeciesButton();
956         // inline creation of $JLabel0
957         $objectMap.put("$JLabel0", $JLabel0 = new JLabel());
958         
959         $JLabel0.setName("$JLabel0");
960         createSpeciesFrequencyMeasurementLabel();
961         createSampleCategoryLabel();
962         createSampleCategoryComboBox();
963         createBatchSampleCategoryWeightLabel();
964         createBatchSampleCategoryWeightField();
965         createBatchWeightLabel();
966         createBatchWeightField();
967         createBatchCountLabel();
968         createBatchCountField();
969         createCategoryPanel();
970         createCategoryConfigurationPanel();
971         // inline creation of $JSeparator0
972         $objectMap.put("$JSeparator0", $JSeparator0 = new JSeparator());
973         
974         $JSeparator0.setName("$JSeparator0");
975         createCategoryLabel();
976         createCategoryComboBox();
977         createSampleWeightLabel();
978         createSampleWeightField();
979         createTableScrollPane();
980         createTable();
981         // inline creation of $JPanel0
982         $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
983         
984         $JPanel0.setName("$JPanel0");
985         $JPanel0.setLayout(new GridLayout(1, 0));
986         SwingUtil.setComponentHeight($JPanel0,50);
987         createCancelButton();
988         createSaveAndContinueButton();
989         createSaveAndCloseButton();
990         createSaveAndFrequenciesButton();
991         // inline creation of createSpeciesBatchTopPanel
992         setName("createSpeciesBatchTopPanel");
993         setLayout(new BorderLayout());
994         createSpeciesBatchTopPanel.putClientProperty("help", "tutti.createSpeciesBatch.help");
995         
996         // registers 25 data bindings
997         $registerDefaultBindings();
998         $completeSetup();
999         handler.afterInit(this);
1000     }
1001 
1002     private void $registerDefaultBindings() {
1003         // register 25 data bindings
1004         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SPECIES_COMBO_BOX_DATA, true) {
1005         
1006             @Override
1007             public void applyDataBinding() {
1008                 if (model != null) {
1009                     model.addPropertyChangeListener("availableSpecies", this);
1010                 }
1011             }
1012         
1013             @Override
1014             public void processDataBinding() {
1015                 if (model != null) {
1016                     speciesComboBox.setData(model.getAvailableSpecies());
1017                 }
1018             }
1019         
1020             @Override
1021             public void removeDataBinding() {
1022                 if (model != null) {
1023                     model.removePropertyChangeListener("availableSpecies", this);
1024                 }
1025             }
1026         });
1027         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SPECIES_COMBO_BOX_SELECTED_ITEM, true) {
1028         
1029             @Override
1030             public void applyDataBinding() {
1031                 if (model != null) {
1032                     model.addPropertyChangeListener("species", this);
1033                 }
1034             }
1035         
1036             @Override
1037             public void processDataBinding() {
1038                 if (model != null) {
1039                     speciesComboBox.setSelectedItem(model.getSpecies());
1040                 }
1041             }
1042         
1043             @Override
1044             public void removeDataBinding() {
1045                 if (model != null) {
1046                     model.removePropertyChangeListener("species", this);
1047                 }
1048             }
1049         });
1050         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SPECIES_FREQUENCY_MEASUREMENT_LABEL_VISIBLE, true) {
1051         
1052             @Override
1053             public void applyDataBinding() {
1054                 if (model != null) {
1055                     model.addPropertyChangeListener("speciesProtocolFrequencyMode", this);
1056                 }
1057             }
1058         
1059             @Override
1060             public void processDataBinding() {
1061                 if (model != null) {
1062                     speciesFrequencyMeasurementLabel.setVisible( model.getSpeciesProtocolFrequencyMode() != null );
1063                 }
1064             }
1065         
1066             @Override
1067             public void removeDataBinding() {
1068                 if (model != null) {
1069                     model.removePropertyChangeListener("speciesProtocolFrequencyMode", this);
1070                 }
1071             }
1072         });
1073         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SPECIES_FREQUENCY_MEASUREMENT_LABEL_TEXT, true) {
1074         
1075             @Override
1076             public void applyDataBinding() {
1077                 if (model != null) {
1078                     model.addPropertyChangeListener("speciesProtocolFrequencyMode", this);
1079                 }
1080             }
1081         
1082             @Override
1083             public void processDataBinding() {
1084                 if (model != null && model.getSpeciesProtocolFrequencyMode() != null) {
1085                     speciesFrequencyMeasurementLabel.setText(t( model.getSpeciesProtocolFrequencyMode().toString() ));
1086                 }
1087             }
1088         
1089             @Override
1090             public void removeDataBinding() {
1091                 if (model != null) {
1092                     model.removePropertyChangeListener("speciesProtocolFrequencyMode", this);
1093                 }
1094             }
1095         });
1096         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAMPLE_CATEGORY_COMBO_BOX_SELECTED_ITEM, true) {
1097         
1098             @Override
1099             public void applyDataBinding() {
1100                 if (model != null) {
1101                     model.addPropertyChangeListener("sampleCategory", this);
1102                 }
1103             }
1104         
1105             @Override
1106             public void processDataBinding() {
1107                 if (model != null) {
1108                     sampleCategoryComboBox.setSelectedItem(model.getSampleCategory());
1109                 }
1110             }
1111         
1112             @Override
1113             public void removeDataBinding() {
1114                 if (model != null) {
1115                     model.removePropertyChangeListener("sampleCategory", this);
1116                 }
1117             }
1118         });
1119         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BATCH_SAMPLE_CATEGORY_WEIGHT_FIELD_NUMBER_VALUE, true) {
1120         
1121             @Override
1122             public void applyDataBinding() {
1123                 if (model != null) {
1124                     model.addPropertyChangeListener("batchSampleCategoryWeight", this);
1125                 }
1126             }
1127         
1128             @Override
1129             public void processDataBinding() {
1130                 if (model != null) {
1131                     batchSampleCategoryWeightField.setNumberValue(model.getBatchSampleCategoryWeight());
1132                 }
1133             }
1134         
1135             @Override
1136             public void removeDataBinding() {
1137                 if (model != null) {
1138                     model.removePropertyChangeListener("batchSampleCategoryWeight", this);
1139                 }
1140             }
1141         });
1142         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BATCH_WEIGHT_FIELD_NUMBER_VALUE, true) {
1143         
1144             @Override
1145             public void applyDataBinding() {
1146                 if (model != null) {
1147                     model.addPropertyChangeListener("batchWeight", this);
1148                 }
1149             }
1150         
1151             @Override
1152             public void processDataBinding() {
1153                 if (model != null) {
1154                     batchWeightField.setNumberValue(model.getBatchWeight());
1155                 }
1156             }
1157         
1158             @Override
1159             public void removeDataBinding() {
1160                 if (model != null) {
1161                     model.removePropertyChangeListener("batchWeight", this);
1162                 }
1163             }
1164         });
1165         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BATCH_COUNT_LABEL_OPAQUE, true) {
1166         
1167             @Override
1168             public void applyDataBinding() {
1169                 if (model != null) {
1170                     model.addPropertyChangeListener("speciesProtocolFrequencyMode", this);
1171                 }
1172             }
1173         
1174             @Override
1175             public void processDataBinding() {
1176                 if (model != null) {
1177                     batchCountLabel.setOpaque(CreateSpeciesBatchUIModel.SpeciesProtocolFrequencyMode.COUNT == model.getSpeciesProtocolFrequencyMode());
1178                 }
1179             }
1180         
1181             @Override
1182             public void removeDataBinding() {
1183                 if (model != null) {
1184                     model.removePropertyChangeListener("speciesProtocolFrequencyMode", this);
1185                 }
1186             }
1187         });
1188         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BATCH_COUNT_LABEL_FONT_WEIGHT, true) {
1189         
1190             @Override
1191             public void applyDataBinding() {
1192                 if (model != null) {
1193                     model.addPropertyChangeListener("speciesProtocolFrequencyMode", this);
1194                 }
1195             }
1196         
1197             @Override
1198             public void processDataBinding() {
1199                 if (model != null) {
1200                     if (batchCountLabel.getFont() != null) {
1201                         if (( CreateSpeciesBatchUIModel.SpeciesProtocolFrequencyMode.COUNT == model.getSpeciesProtocolFrequencyMode() ? "bold" : "normal" ).equals("bold")) {
1202                             batchCountLabel.setFont(batchCountLabel.getFont().deriveFont(batchCountLabel.getFont().getStyle() | Font.BOLD));
1203                         } else {
1204                             batchCountLabel.setFont(batchCountLabel.getFont().deriveFont(batchCountLabel.getFont().getStyle() & ~Font.BOLD));
1205                         }
1206                     }
1207                 }
1208             }
1209         
1210             @Override
1211             public void removeDataBinding() {
1212                 if (model != null) {
1213                     model.removePropertyChangeListener("speciesProtocolFrequencyMode", this);
1214                 }
1215             }
1216         });
1217         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BATCH_COUNT_LABEL_BACKGROUND, true) {
1218         
1219             @Override
1220             public void applyDataBinding() {
1221                 if (model != null) {
1222                     model.addPropertyChangeListener("speciesProtocolFrequencyMode", this);
1223                 }
1224             }
1225         
1226             @Override
1227             public void processDataBinding() {
1228                 if (model != null && handler != null && handler.getConfig() != null) {
1229                     batchCountLabel.setBackground(CreateSpeciesBatchUIModel.SpeciesProtocolFrequencyMode.COUNT == model.getSpeciesProtocolFrequencyMode() ? handler.getConfig().getColorHighlightInfoBackground() : null);
1230                 }
1231             }
1232         
1233             @Override
1234             public void removeDataBinding() {
1235                 if (model != null) {
1236                     model.removePropertyChangeListener("speciesProtocolFrequencyMode", this);
1237                 }
1238             }
1239         });
1240         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BATCH_COUNT_LABEL_FOREGROUND, true) {
1241         
1242             @Override
1243             public void applyDataBinding() {
1244                 if (model != null) {
1245                     model.addPropertyChangeListener("speciesProtocolFrequencyMode", this);
1246                 }
1247             }
1248         
1249             @Override
1250             public void processDataBinding() {
1251                 if (model != null && handler != null && handler.getConfig() != null) {
1252                     batchCountLabel.setForeground(CreateSpeciesBatchUIModel.SpeciesProtocolFrequencyMode.COUNT == model.getSpeciesProtocolFrequencyMode() ? handler.getConfig().getColorHighlightInfoForeground() : null);
1253                 }
1254             }
1255         
1256             @Override
1257             public void removeDataBinding() {
1258                 if (model != null) {
1259                     model.removePropertyChangeListener("speciesProtocolFrequencyMode", this);
1260                 }
1261             }
1262         });
1263         registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_BATCH_COUNT_FIELD_NUMBER_PATTERN, true ,"INT_6_DIGITS_PATTERN") {
1264         
1265             @Override
1266             public void processDataBinding() {
1267                 batchCountField.setNumberPattern(INT_6_DIGITS_PATTERN);
1268             }
1269         });
1270         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BATCH_COUNT_FIELD_NUMBER_VALUE, true) {
1271         
1272             @Override
1273             public void applyDataBinding() {
1274                 if (model != null) {
1275                     model.addPropertyChangeListener("batchCount", this);
1276                 }
1277             }
1278         
1279             @Override
1280             public void processDataBinding() {
1281                 if (model != null) {
1282                     batchCountField.setNumberValue(model.getBatchCount());
1283                 }
1284             }
1285         
1286             @Override
1287             public void removeDataBinding() {
1288                 if (model != null) {
1289                     model.removePropertyChangeListener("batchCount", this);
1290                 }
1291             }
1292         });
1293         registerDataBinding(new DefaultJAXXBinding(this, BINDING_CATEGORY_PANEL_VISIBLE, true) {
1294         
1295             @Override
1296             public void applyDataBinding() {
1297                 if (model != null) {
1298                     model.addPropertyChangeListener("categorizationEnabled", this);
1299                 }
1300             }
1301         
1302             @Override
1303             public void processDataBinding() {
1304                 if (model != null) {
1305                     categoryPanel.setVisible(model.isCategorizationEnabled());
1306                 }
1307             }
1308         
1309             @Override
1310             public void removeDataBinding() {
1311                 if (model != null) {
1312                     model.removePropertyChangeListener("categorizationEnabled", this);
1313                 }
1314             }
1315         });
1316         registerDataBinding(new DefaultJAXXBinding(this, BINDING_CATEGORY_COMBO_BOX_DATA, true) {
1317         
1318             @Override
1319             public void applyDataBinding() {
1320                 if (model != null) {
1321                     model.addPropertyChangeListener("category", this);
1322                 }
1323             }
1324         
1325             @Override
1326             public void processDataBinding() {
1327                 if (model != null) {
1328                     categoryComboBox.setData(model.getCategory());
1329                 }
1330             }
1331         
1332             @Override
1333             public void removeDataBinding() {
1334                 if (model != null) {
1335                     model.removePropertyChangeListener("category", this);
1336                 }
1337             }
1338         });
1339         registerDataBinding(new DefaultJAXXBinding(this, BINDING_CATEGORY_COMBO_BOX_SELECTED_ITEM, true) {
1340         
1341             @Override
1342             public void applyDataBinding() {
1343                 if (model != null) {
1344                     model.addPropertyChangeListener("selectedCategory", this);
1345                 }
1346             }
1347         
1348             @Override
1349             public void processDataBinding() {
1350                 if (model != null) {
1351                     categoryComboBox.setSelectedItem(model.getSelectedCategory());
1352                 }
1353             }
1354         
1355             @Override
1356             public void removeDataBinding() {
1357                 if (model != null) {
1358                     model.removePropertyChangeListener("selectedCategory", this);
1359                 }
1360             }
1361         });
1362         registerDataBinding(new DefaultJAXXBinding(this, BINDING_CATEGORY_COMBO_BOX_ENABLED, true) {
1363         
1364             @Override
1365             public void applyDataBinding() {
1366                 if (model != null) {
1367                     model.addPropertyChangeListener("batchCount", this);
1368                 }
1369             }
1370         
1371             @Override
1372             public void processDataBinding() {
1373                 if (model != null) {
1374                     categoryComboBox.setEnabled(model.getBatchCount() == null);
1375                 }
1376             }
1377         
1378             @Override
1379             public void removeDataBinding() {
1380                 if (model != null) {
1381                     model.removePropertyChangeListener("batchCount", this);
1382                 }
1383             }
1384         });
1385         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAMPLE_WEIGHT_FIELD_TEXT, true) {
1386         
1387             @Override
1388             public void applyDataBinding() {
1389                 if (model != null) {
1390                     model.addPropertyChangeListener("sampleWeight", this);
1391                 }
1392             }
1393         
1394             @Override
1395             public void processDataBinding() {
1396                 if (model != null) {
1397                     SwingUtil.setText(sampleWeightField, getStringValue(model.getSampleWeight()));
1398                 }
1399             }
1400         
1401             @Override
1402             public void removeDataBinding() {
1403                 if (model != null) {
1404                     model.removePropertyChangeListener("sampleWeight", this);
1405                 }
1406             }
1407         });
1408         registerDataBinding(new DefaultJAXXBinding(this, BINDING_TABLE_ENABLED, true, true) {
1409         
1410             @Override
1411             public void applyDataBinding() {
1412                 if (model != null) {
1413                     model.addPropertyChangeListener("selectedCategory", this);
1414                 }
1415                 if (model != null) {
1416                     model.addPropertyChangeListener("batchCount", this);
1417                 }
1418             }
1419         
1420             @Override
1421             public void processDataBinding() {
1422                 if (model != null) {
1423                     table.setEnabled(model.getSelectedCategory() != null && model.getBatchCount() == null);
1424                 }
1425             }
1426         
1427             @Override
1428             public void removeDataBinding() {
1429                 if (model != null) {
1430                     model.removePropertyChangeListener("selectedCategory", this);
1431                 }
1432                 if (model != null) {
1433                     model.removePropertyChangeListener("batchCount", this);
1434                 }
1435             }
1436         });
1437         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_AND_CONTINUE_BUTTON_ENABLED, true) {
1438         
1439             @Override
1440             public void applyDataBinding() {
1441                 if (model != null) {
1442                     model.addPropertyChangeListener("valid", this);
1443                 }
1444             }
1445         
1446             @Override
1447             public void processDataBinding() {
1448                 if (model != null) {
1449                     saveAndContinueButton.setEnabled(model.isValid());
1450                 }
1451             }
1452         
1453             @Override
1454             public void removeDataBinding() {
1455                 if (model != null) {
1456                     model.removePropertyChangeListener("valid", this);
1457                 }
1458             }
1459         });
1460         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_AND_CLOSE_BUTTON_ENABLED, true) {
1461         
1462             @Override
1463             public void applyDataBinding() {
1464                 if (model != null) {
1465                     model.addPropertyChangeListener("valid", this);
1466                 }
1467             }
1468         
1469             @Override
1470             public void processDataBinding() {
1471                 if (model != null) {
1472                     saveAndCloseButton.setEnabled(model.isValid());
1473                 }
1474             }
1475         
1476             @Override
1477             public void removeDataBinding() {
1478                 if (model != null) {
1479                     model.removePropertyChangeListener("valid", this);
1480                 }
1481             }
1482         });
1483         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_AND_FREQUENCIES_BUTTON_FONT_WEIGHT, true) {
1484         
1485             @Override
1486             public void applyDataBinding() {
1487                 if (model != null) {
1488                     model.addPropertyChangeListener("speciesProtocolFrequencyMode", this);
1489                 }
1490             }
1491         
1492             @Override
1493             public void processDataBinding() {
1494                 if (model != null) {
1495                     if (saveAndFrequenciesButton.getFont() != null) {
1496                         if (( CreateSpeciesBatchUIModel.SpeciesProtocolFrequencyMode.MEASURE == model.getSpeciesProtocolFrequencyMode() ? "bold" : "normal" ).equals("bold")) {
1497                             saveAndFrequenciesButton.setFont(saveAndFrequenciesButton.getFont().deriveFont(saveAndFrequenciesButton.getFont().getStyle() | Font.BOLD));
1498                         } else {
1499                             saveAndFrequenciesButton.setFont(saveAndFrequenciesButton.getFont().deriveFont(saveAndFrequenciesButton.getFont().getStyle() & ~Font.BOLD));
1500                         }
1501                     }
1502                 }
1503             }
1504         
1505             @Override
1506             public void removeDataBinding() {
1507                 if (model != null) {
1508                     model.removePropertyChangeListener("speciesProtocolFrequencyMode", this);
1509                 }
1510             }
1511         });
1512         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_AND_FREQUENCIES_BUTTON_BACKGROUND, true) {
1513         
1514             @Override
1515             public void applyDataBinding() {
1516                 if (model != null) {
1517                     model.addPropertyChangeListener("speciesProtocolFrequencyMode", this);
1518                 }
1519             }
1520         
1521             @Override
1522             public void processDataBinding() {
1523                 if (model != null && handler != null && handler.getConfig() != null) {
1524                     saveAndFrequenciesButton.setBackground(CreateSpeciesBatchUIModel.SpeciesProtocolFrequencyMode.MEASURE == model.getSpeciesProtocolFrequencyMode() ? handler.getConfig().getColorHighlightInfoBackground() : null);
1525                 }
1526             }
1527         
1528             @Override
1529             public void removeDataBinding() {
1530                 if (model != null) {
1531                     model.removePropertyChangeListener("speciesProtocolFrequencyMode", this);
1532                 }
1533             }
1534         });
1535         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_AND_FREQUENCIES_BUTTON_FOREGROUND, true, true) {
1536         
1537             @Override
1538             public void applyDataBinding() {
1539                 if (model != null) {
1540                     model.addPropertyChangeListener("speciesProtocolFrequencyMode", this);
1541                 }
1542                 if (model != null) {
1543                     model.addPropertyChangeListener("valid", this);
1544                 }
1545             }
1546         
1547             @Override
1548             public void processDataBinding() {
1549                 if (model != null && handler != null && handler.getConfig() != null) {
1550                     saveAndFrequenciesButton.setForeground(CreateSpeciesBatchUIModel.SpeciesProtocolFrequencyMode.MEASURE == model.getSpeciesProtocolFrequencyMode() && model.isValid() ? handler.getConfig().getColorHighlightInfoForeground() : null);
1551                 }
1552             }
1553         
1554             @Override
1555             public void removeDataBinding() {
1556                 if (model != null) {
1557                     model.removePropertyChangeListener("speciesProtocolFrequencyMode", this);
1558                 }
1559                 if (model != null) {
1560                     model.removePropertyChangeListener("valid", this);
1561                 }
1562             }
1563         });
1564         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_AND_FREQUENCIES_BUTTON_ENABLED, true) {
1565         
1566             @Override
1567             public void applyDataBinding() {
1568                 if (model != null) {
1569                     model.addPropertyChangeListener("valid", this);
1570                 }
1571             }
1572         
1573             @Override
1574             public void processDataBinding() {
1575                 if (model != null) {
1576                     saveAndFrequenciesButton.setEnabled(model.isValid());
1577                 }
1578             }
1579         
1580             @Override
1581             public void removeDataBinding() {
1582                 if (model != null) {
1583                     model.removePropertyChangeListener("valid", this);
1584                 }
1585             }
1586         });
1587     }
1588 
1589 }