Changeset 3879
- Timestamp:
- Oct 8, 2010, 9:29:20 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/org/proteios/gui/form/ExtractForm.java
r3875 r3879 1 1 /* 2 $Id$3 4 Copyright (C) 2010 Gregory Vincic5 6 Files are copyright by their respective authors. The contributions to7 files where copyright is not explicitly stated can be traced with the8 source code revision system.9 10 This file is part of Proteios.11 Available at http://www.proteios.org/12 13 Proteios is free software; you can redistribute it and/or14 modify it under the terms of the GNU General Public License15 as published by the Free Software Foundation; either version 216 of the License, or (at your option) any later version.17 18 Proteios is distributed in the hope that it will be useful,19 but WITHOUT ANY WARRANTY; without even the implied warranty of20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the21 GNU General Public License for more details.22 23 You should have received a copy of the GNU General Public License24 along with this program; if not, write to the Free Software25 Foundation, Inc., 59 Temple Place - Suite 339.26 Boston, MA 02111-1307, USA.2 $Id$ 3 4 Copyright (C) 2010 Gregory Vincic 5 6 Files are copyright by their respective authors. The contributions to 7 files where copyright is not explicitly stated can be traced with the 8 source code revision system. 9 10 This file is part of Proteios. 11 Available at http://www.proteios.org/ 12 13 Proteios is free software; you can redistribute it and/or 14 modify it under the terms of the GNU General Public License 15 as published by the Free Software Foundation; either version 2 16 of the License, or (at your option) any later version. 17 18 Proteios is distributed in the hope that it will be useful, 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 GNU General Public License for more details. 22 23 You should have received a copy of the GNU General Public License 24 along with this program; if not, write to the Free Software 25 Foundation, Inc., 59 Temple Place - Suite 339. 26 Boston, MA 02111-1307, USA. 27 27 */ 28 28 29 29 package org.proteios.gui.form; 30 30 31 import org.proteios.core.Extract; 31 32 32 33 /** 34 Used to display information about an Extract. 33 35 */ 34 36 public class ExtractForm extends Form 35 37 { 36 public final Fieldset fs; 37 public final TextField<String> nameF; 38 public final TextField<String> externalIdF; 39 public final TextArea descriptionF; 40 public final TextField<String> storageLocationF; 41 public final Fieldset quantityFS; 42 public final TextField<Float> quantityF; 43 public final TextField<Float> concF; 44 public TextField<Integer> itemIdF = null; 45 46 public ExtractForm() 47 { 48 super("extractForm"); 49 setTitle("New Extract"); 50 nameF = new NameField(); 51 externalIdF = new ExternalIdField(); 52 descriptionF = new DescriptionField(); 53 storageLocationF = new StorageLocationField(); 54 55 fs = new Fieldset("Quantity"); 56 fs.setTitle("Properties"); 57 fs.add(nameF); 58 fs.add(externalIdF); 59 fs.add(descriptionF); 60 fs.add(storageLocationF); 61 addFieldset(fs); 62 63 quantityF = new OriginalQuantityField(); 64 concF = new ConcentrationField(); 65 66 quantityFS = new Fieldset(); 67 quantityFS.add(quantityF); 68 quantityFS.add(concF); 69 addFieldset(quantityFS); 70 } 71 72 public ExtractForm(Extract extract) 73 { 74 this(); 75 itemIdF = new ItemIdField(); 76 itemIdF.setHidden(true); 77 fs.add(itemIdF); 78 itemIdF.setValue(extract.getId()); 79 nameF.setValue(extract.getName()); 80 externalIdF.setValue(extract.getExternalId()); 81 descriptionF.setValue(extract.getDescription()); 82 storageLocationF.setValue(extract.getStorageLocation()); 83 quantityF.setValue(extract.getOriginalQuantityInMicroLiters()); 84 quantityFS.add(new RemainingQuantityField(extract 85 .getRemainingQuantityInMicroLiters())); 86 concF.setValue(extract.getConcentrationInGramsPerLiter()); 87 } 38 /** 39 Contains all properties not related to quantities and concentration 40 */ 41 public Fieldset fs; 42 public TextField<String> nameF; 43 public TextField<String> externalIdF; 44 public TextArea descriptionF; 45 public TextField<String> storageLocationF; 46 47 /** 48 Fieldset for quantities and concentration 49 */ 50 public Fieldset quantityFS; 51 public TextField<Float> quantityF; 52 public TextField<Float> remainingQuantityF = null; 53 public TextField<Float> concF; 54 public TextField<Integer> itemIdF = null; 55 56 /** 57 Creates an empty form with no id field and no 58 remaining quantity field. 59 */ 60 public ExtractForm() 61 { 62 super("extractForm"); 63 setTitle("New Extract"); 64 nameF = new NameField(); 65 externalIdF = new ExternalIdField(); 66 descriptionF = new DescriptionField(); 67 storageLocationF = new StorageLocationField(); 68 69 fs = new Fieldset("Quantity"); 70 fs.setTitle("Properties"); 71 fs.add(nameF); 72 fs.add(externalIdF); 73 fs.add(descriptionF); 74 fs.add(storageLocationF); 75 addFieldset(fs); 76 77 quantityF = new OriginalQuantityField(); 78 concF = new ConcentrationField(); 79 80 quantityFS = new Fieldset(); 81 quantityFS.add(quantityF); 82 quantityFS.add(concF); 83 addFieldset(quantityFS); 84 } 85 86 /** 87 Creates a form with values also containing an ItemIdField and 88 the remaining quantity field. 89 */ 90 public ExtractForm(Extract extract) 91 { 92 this(); 93 itemIdF = new ItemIdField(); 94 itemIdF.setHidden(true); 95 remainingQuantityF = new RemainingQuantityField(); 96 remainingQuantityF.setValue(extract.getRemainingQuantityInMicroLiters()); 97 fs.add(itemIdF); 98 itemIdF.setValue(extract.getId()); 99 nameF.setValue(extract.getName()); 100 externalIdF.setValue(extract.getExternalId()); 101 descriptionF.setValue(extract.getDescription()); 102 storageLocationF.setValue(extract.getStorageLocation()); 103 quantityF.setValue(extract.getOriginalQuantityInMicroLiters()); 104 quantityFS.add(remainingQuantityF); 105 concF.setValue(extract.getConcentrationInGramsPerLiter()); 106 } 88 107 } 89 108
Note: See TracChangeset
for help on using the changeset viewer.