Changeset 3943
- Timestamp:
- Nov 3, 2010, 10:00:18 AM (13 years ago)
- Location:
- trunk/client/servlet/src/org/proteios
- Files:
-
- 1 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/org/proteios/action/peakListSet/CreateFileExportJob.java
r3827 r3943 56 56 * Verify parameters 57 57 */ 58 Form form = getFormFactory().getExportPeakListSetForm(null);58 Form form = new ExportForm(); 59 59 verifyParameters(form); 60 60 Integer plsId = getValidInteger(ItemIdField.VPARAM); -
trunk/client/servlet/src/org/proteios/action/peakListSet/ExportPeakListSet.java
r2395 r3943 32 32 import org.proteios.core.PeakListSet; 33 33 import org.proteios.gui.Toolbar; 34 import org.proteios.gui.form.Form; 35 import org.proteios.gui.form.FormFactory; 34 import org.proteios.gui.form.*; 36 35 import org.proteios.gui.layout.RowLayout; 37 36 import se.lu.thep.waf.ActionException; … … 51 50 DbControl dc = newDbControl(); 52 51 PeakListSet pls = PeakListSet.getById(dc, plsId); 53 Form form = getFormFactory().getExportPeakListSetForm(pls);52 Form form = new ExportForm(pls, "PeakListSet", pls.getName()); 54 53 /*********************************************************************** 55 54 * Toolbar -
trunk/client/servlet/src/org/proteios/gui/form/Field.java
r3593 r3943 1 1 /* 2 $Id$3 4 Copyright (C) 2006, 2007Gregory 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-2.x 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 330,26 Boston, MA 02111-1307, USA.27 2 $Id$ 3 4 Copyright (C) 2006, 2007, 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-2.x 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 330, 26 Boston, MA 02111-1307, USA. 27 */ 28 28 package org.proteios.gui.form; 29 29 … … 32 32 33 33 /** 34 *Represents a form field35 *36 *@author gregory37 34 Represents a form field 35 36 @author gregory 37 */ 38 38 public abstract class Field<D extends Field<?>> 39 39 extends GUIElement<D> 40 40 { 41 private String id = null; 42 private String label = ""; 43 private String error = null; 44 private VParameter param = null; 45 private boolean disabled = false; 46 private String help = ""; 47 public int charWidth = 25; 48 public void setCharWidth(int width) 49 { 50 this.charWidth = width; 51 } 41 private String id = null; 42 private String label = ""; 43 private String error = null; 44 private VParameter param = null; 45 private boolean disabled = false; 46 private String help = ""; 47 public int charWidth = 25; 48 public void setCharWidth(int width) 49 { 50 this.charWidth = width; 51 } 52 53 public int getCharWidth() 54 { 55 return this.charWidth; 56 } 57 58 public boolean isDisabled() 59 { 60 return disabled; 61 } 62 63 public void setDisabled(boolean disabled) 64 { 65 this.disabled = disabled; 66 } 67 68 public String getHelp() 69 { 70 return this.help; 71 } 72 73 public void setHelp(String help) 74 { 75 this.help = help; 76 } 77 78 public VParameter getParam() 79 { 80 return param; 81 } 82 83 public void setParam(VParameter param) 84 { 85 this.param = param; 86 } 87 88 public String getError() 89 { 90 return error; 91 } 92 93 public void setError(String error) 94 { 95 this.error = error; 96 } 97 98 public String getLabel() 99 { 100 return label; 101 } 102 103 @SuppressWarnings("unchecked") 104 public D setLabel(String label) 105 { 106 this.label = label; 107 return (D) this; 108 } 109 110 public Field() 111 { 112 super(); 113 this.id = null; 114 } 52 115 53 public int getCharWidth() 54 { 55 return this.charWidth; 56 } 57 58 59 public boolean isDisabled() 60 { 61 return disabled; 62 } 63 64 65 public void setDisabled(boolean disabled) 66 { 67 this.disabled = disabled; 68 } 69 70 public String getHelp() 71 { 72 return this.help; 73 } 74 75 public void setHelp(String help) 76 { 77 this.help = help; 78 } 79 80 public VParameter getParam() 81 { 82 return param; 83 } 84 85 86 public void setParam(VParameter param) 87 { 88 this.param = param; 89 } 90 91 92 public String getError() 93 { 94 return error; 95 } 96 97 98 public void setError(String error) 99 { 100 this.error = error; 101 } 102 103 104 public String getLabel() 105 { 106 return label; 107 } 108 109 110 @SuppressWarnings("unchecked") 111 public D setLabel(String label) 112 { 113 this.label = label; 114 return (D) this; 115 } 116 117 118 public Field(String id) 119 { 120 super(); 121 this.id = id; 122 } 123 124 125 public Field(VParameter param) 126 { 127 this.id = param.getName(); 128 this.param = param; 129 } 130 131 132 public String getId() 133 { 134 return id; 135 } 136 137 138 public void setId(String id) 139 { 140 this.id = id; 141 } 116 public Field(String id) 117 { 118 super(); 119 this.id = id; 120 } 121 122 public Field(VParameter param) 123 { 124 this.id = param.getName(); 125 this.param = param; 126 } 127 128 public String getId() 129 { 130 return id; 131 } 132 133 public void setId(String id) 134 { 135 this.id = id; 136 } 142 137 } -
trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java
r3942 r3943 1565 1565 } 1566 1566 1567 public Form getExportPeakListSetForm(PeakListSet pls)1568 {1569 /***********************************************************************1570 Properties1571 */1572 Fieldset fs = new Fieldset();1573 fs.setTitle("ExportProperties");1574 // Peaklist name field1575 if (pls != null)1576 {1577 TextField<String> plsNameF = newTextField("Peaklistset", pls1578 .getName());1579 fs.add(plsNameF);1580 }1581 // id1582 TextField<Integer> itemIdF = newHiddenItemIdField();1583 fs.add(itemIdF);1584 // Select plugin field1585 Select<VInteger> typeS = new PluginSelect();1586 if (pls != null)1587 {1588 itemIdF.setValue(pls.getId());1589 // TODO gregory query only file plugins1590 ItemQuery<PluginDefinition> query = PluginDefinition.getQuery();1591 query.include(Include.SHARED);1592 for (PluginDefinition pd : query.list(pls.getDbControl()))1593 {1594 if (pd.getMainType().equals(Plugin.MainType.EXPORT))1595 {1596 Option o = new Option(pd.getId(), pd.getName());1597 typeS.addOption(o);1598 }1599 }1600 }1601 fs.add(typeS);1602 // Name field1603 TextField<String> nameF = new NameField();1604 nameF.setLabel("FileName");1605 fs.add(nameF);1606 /***********************************************************************1607 Form1608 */1609 Form form = new Form("exportPeakListSetForm");1610 form.addFieldset(fs);1611 return form;1612 }1613 1567 1614 1568 private void addAnnotationsAsFields(Fieldset to, Annotatable item, -
trunk/client/servlet/src/org/proteios/gui/form/TextField.java
r3857 r3943 1 1 /* 2 $Id$3 4 Copyright (C) 2006, 2007 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-2.x 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 330,26 Boston, MA 02111-1307, USA.27 2 $Id$ 3 4 Copyright (C) 2006, 2007 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-2.x 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 330, 26 Boston, MA 02111-1307, USA. 27 */ 28 28 package org.proteios.gui.form; 29 29 … … 31 31 32 32 /** 33 * @author gregory34 33 * @author gregory 34 */ 35 35 public class TextField<D extends Object> 36 36 extends Field<TextField<D>> 37 37 { 38 private D value = null; 39 private boolean hidden = false; 38 private D value = null; 39 private boolean hidden = false; 40 41 public D getValue() 42 { 43 return value; 44 } 45 46 public TextField<D> setValue(D value) 47 { 48 this.value = value; 49 return this; 50 } 51 52 /** 53 Constructs a new TextField constraind by the given VParameter. The default label is the name of the vparam. 54 */ 55 public TextField(VParameter vparam) 56 { 57 super(vparam); 58 setLabel(vparam.getName()); 59 } 60 61 public TextField(VParameter vparam, D value) 62 { 63 this(vparam); 64 setValue(value); 65 } 40 66 41 42 public D getValue() 43 { 44 return value; 45 } 46 47 public TextField<D> setValue(D value) 48 { 49 this.value = value; 50 return this; 51 } 52 53 /** 54 Constructs a new TextField constraind by the given VParameter. The default label is the name of the vparam. 55 */ 56 public TextField(VParameter vparam) 57 { 58 super(vparam); 59 setLabel(vparam.getName()); 60 } 61 62 public TextField(VParameter vparam, D value) 63 { 64 this(vparam); 65 setValue(value); 66 } 67 68 public TextField(VParameter vparam, D value, boolean hidden) 69 { 70 this(vparam, value); 71 setHidden(hidden); 72 } 73 74 public TextField(VParameter vparam, D value, boolean hidden, boolean disabled) 75 { 76 this(vparam, value, hidden); 77 setDisabled(disabled); 78 } 79 80 public boolean isHidden() 81 { 82 return hidden; 83 } 84 85 86 public TextField<D> setHidden(boolean hidden) 87 { 88 this.hidden = hidden; 89 return this; 90 } 67 /** 68 Use this constructor when you only want a text field within the form that 69 does not have to be submitted. This field has no name or id. 70 */ 71 public TextField(String label, D value) 72 { 73 super(); 74 setLabel(label); 75 setValue(value); 76 setDisabled(true); 77 } 78 79 public TextField(VParameter vparam, D value, boolean hidden) 80 { 81 this(vparam, value); 82 setHidden(hidden); 83 } 84 85 public TextField(VParameter vparam, D value, boolean hidden, boolean disabled) 86 { 87 this(vparam, value, hidden); 88 setDisabled(disabled); 89 } 90 91 public boolean isHidden() 92 { 93 return hidden; 94 } 95 96 public TextField<D> setHidden(boolean hidden) 97 { 98 this.hidden = hidden; 99 return this; 100 } 91 101 } -
trunk/client/servlet/src/org/proteios/gui/web/GUIConverter.java
r3921 r3943 82 82 import org.proteios.gui.table.TreeRow; 83 83 import se.lu.thep.waf.constraints.VString; 84 import se.lu.thep.waf.constraints.VParameter; 84 85 import se.lu.thep.waf.dom.html.A; 85 86 import se.lu.thep.waf.dom.html.Area; … … 1345 1346 input = convert((org.proteios.gui.form.Checkbox) f, false); 1346 1347 } 1347 1348 if (field.getParam().isRequired() || 1349 (field.getParam() instanceof VString && ((VString) field.getParam()).getMinCharacterLength() > 0)) 1348 1349 VParameter param = field.getParam(); 1350 1351 if (param != null && (param.isRequired() || 1352 (param instanceof VString && ((VString) param).getMinCharacterLength() > 0))) 1350 1353 { 1351 1354 input.addClass("required"); … … 1788 1791 value = ""; 1789 1792 } 1790 if (f.getParam().isRequired() || 1791 (f.getParam() instanceof VString && ((VString) f.getParam()).getMinCharacterLength() > 0)) 1793 VParameter param = f.getParam(); 1794 1795 if (param != null && (param.isRequired() || 1796 (param instanceof VString && ((VString) param).getMinCharacterLength() > 0))) 1792 1797 { 1793 1798 in.addClass("required"); -
trunk/client/servlet/src/org/proteios/gui/web/HtmlFactory.java
r3920 r3943 107 107 public Tag getFieldError(Field f) 108 108 { 109 if (request != null )109 if (request != null && f.getParam() != null) 110 110 { 111 111 String error = (String) request.getAttribute("error." + f
Note: See TracChangeset
for help on using the changeset viewer.