Changeset 3946
- Timestamp:
- Nov 4, 2010, 4:02:25 PM (13 years ago)
- Location:
- trunk/client/servlet/src/org/proteios/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java
r3945 r3946 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2006, 2007 Fredrik Levander, Gregory Vincic, Olle Mansson 5 5 6 6 Files are copyright by their respective authors. The contributions to 7 7 files where copyright is not explicitly stated can be traced with the 8 8 source code revision system. 9 9 10 10 This file is part of Proteios. 11 11 Available at http://www.proteios.org/ 12 12 13 13 proteios-2.x is free software; you can redistribute it and/or 14 14 modify it under the terms of the GNU General Public License 15 15 as published by the Free Software Foundation; either version 2 16 16 of the License, or (at your option) any later version. 17 17 18 18 Proteios is distributed in the hope that it will be useful, 19 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 21 GNU General Public License for more details. 22 22 23 23 You should have received a copy of the GNU General Public License 24 24 along with this program; if not, write to the Free Software … … 68 68 private HttpServletRequest request = null; 69 69 private SessionControl sc = null; 70 70 71 71 private Localizer locale = null; 72 72 private String forwardActionId = null; … … 160 160 private static final org.apache.log4j.Logger log = org.apache.log4j.LogManager 161 161 .getLogger("org.proteios.gui.form"); 162 162 163 163 public void setActionFactory(ActionFactory af) 164 164 { 165 165 this.actionFactory = af; 166 166 } 167 167 168 168 public String getForwardActionId() 169 169 { 170 170 return this.forwardActionId; 171 171 } 172 172 173 173 public void setForwardActionId(String forwardActionId) 174 174 { 175 175 this.forwardActionId = forwardActionId; 176 176 } 177 177 178 178 public HttpServletRequest getRequest() 179 179 { 180 180 return request; 181 181 } 182 182 183 183 public void setRequest(HttpServletRequest request) 184 184 { 185 185 this.request = request; 186 186 } 187 187 188 188 public void modifyForPopup(Fieldset fs) 189 189 { 190 190 actionFactory.modifyForPopup(fs); 191 191 } 192 192 193 193 private FileField newFileField() 194 194 { … … 197 197 return fileF; 198 198 } 199 199 200 200 public TextField<Integer> newIdField() 201 201 { … … 205 205 return idF; 206 206 } 207 207 208 208 public TextField<String> newValueField(String setValueMethodName, 209 209 Class<?> valueClass) … … 237 237 return valueF; 238 238 } 239 239 240 240 public TextField<Integer> newHiddenItemIdField() 241 241 { … … 243 243 return field; 244 244 } 245 245 246 246 private TextField<Integer> newHiddenIntegerField(VInteger vInteger) 247 247 { … … 250 250 return field; 251 251 } 252 252 253 253 private TextField<String> newHiddenStringField(VString vString) 254 254 { … … 257 257 return field; 258 258 } 259 259 260 260 public <D extends BasicItem<?>, E extends ProteiosAction<?>> Form getAnnotationsForm( 261 261 DbControl dc, D item, Class<E> forwardAction) … … 307 307 return form; 308 308 } 309 309 310 310 /** 311 311 @return Hidden … … 317 317 return field; 318 318 } 319 319 320 320 /** 321 321 Form for user preferences configuration settings. Arguments … … 323 323 holders for current values for the notification configuration and table 324 324 preferences configuration form fields. 325 325 326 326 @param nc NotificationConfiguration object (need not be stored in 327 327 database) with default field values. … … 341 341 return form; 342 342 } 343 343 344 344 /** 345 345 Fieldset for notification configuration settings. Argument 346 346 NotificationConfiguration is place holder for current values for the 347 347 notification configuration form fields. 348 348 349 349 @param nc NotificationConfiguration object (need not be stored in 350 350 database) with default field values. … … 398 398 return properties; 399 399 } 400 400 401 401 /** 402 402 Creates a select box for notification mode. 403 403 404 404 @param modeValue int Mode value for default selection. 405 405 @return Select<VInteger> Select box for notification mode selection … … 426 426 return modeS; 427 427 } 428 428 429 429 /** 430 430 Fieldset for table preferences configuration settings. Argument 431 431 TablePreferencesConfiguration is place holder for current values for the 432 432 table preferences configuration form fields. 433 433 434 434 @param tpc TablePreferencesConfiguration object (need not be stored in 435 435 database) with default field values. … … 461 461 return properties; 462 462 } 463 463 464 464 /** 465 465 Creates a select box for table preferences mode. 466 466 467 467 @param modeValue int Mode value for default selection. 468 468 @return Select<VInteger> Select box for table preferences mode selection … … 489 489 return modeS; 490 490 } 491 491 492 492 /** 493 493 @param a annotation … … 502 502 return sb.toString(); 503 503 } 504 504 505 505 /** 506 506 This will probably be removed when fixint #691 … … 601 601 return form; 602 602 } 603 603 604 604 /** 605 605 @param hit Current Hit … … 817 817 return form; 818 818 } 819 819 820 820 /** 821 821 Returns a form for selecting spectrum mass range limits. 822 822 823 823 @param massCutoffLow String The lower cutoff mass value. 824 824 @param massCutoffHigh String The upper cutoff mass value. … … 866 866 return form; 867 867 } 868 868 869 869 /** 870 870 Returns a form with spectrum properties for a spectrum obtained from a 871 871 spectrum file. 872 872 873 873 @param spectrumFile File Core file with spectrum. 874 874 @param spectrumId String Spectrum id string. … … 897 897 peakListFileName = spectrumFile.getName(); 898 898 } 899 addTableRow(propertiesTable, "Filename", peakListFileName, null, 0);899 propertiesTable.addRow( new PropertyRow(0, "Filename", peakListFileName)); 900 900 /* 901 901 File type … … 909 909 } 910 910 } 911 addTableRow(propertiesTable, "FileType", spectrumFileType, null, 0);911 propertiesTable.addRow( new PropertyRow(0, "FileType", spectrumFileType)); 912 912 /* 913 913 SpectrumId … … 918 918 spectrumIdStr = spectrumId; 919 919 } 920 addTableRow(propertiesTable, "SpectrumId", spectrumIdStr, null, 0);920 propertiesTable.addRow( new PropertyRow(0, "SpectrumId", spectrumIdStr)); 921 921 /* 922 922 Retention time in minutes … … 936 936 } 937 937 } 938 addTableRow(propertiesTable, "RetentionTimeInMinutes",939 timeInMinutesStr , null, 0);938 propertiesTable.addRow( new PropertyRow(0, "RetentionTimeInMinutes", 939 timeInMinutesStr)); 940 940 /*********************************************************************** 941 941 Optional spectrum fieldset … … 969 969 for (PrecursorSelectedIon selectedIon : selectedIonList) 970 970 { 971 addTableRow(precursorTable, "charge state",972 selectedIon.getCharge() , null, 0);973 addTableRow(precursorTable, "m/z", selectedIon974 .getMassToChargeRatio() , null, 0);975 addTableRow(precursorTable, "intensity",976 selectedIon.getIntensity() , null, 0);971 precursorTable.addRow( new PropertyRow(0, "charge state", 972 selectedIon.getCharge())); 973 precursorTable.addRow( new PropertyRow(0, "m/z", selectedIon 974 .getMassToChargeRatio())); 975 precursorTable.addRow( new PropertyRow(0, "intensity", 976 selectedIon.getIntensity())); 977 977 // Selected ion extra data 978 978 List<StringPairInterface> dataList = selectedIon … … 989 989 if (name != null && !name.equals("")) 990 990 { 991 addTableRow(precursorTable, name,992 value , null, 0);991 precursorTable.addRow( new PropertyRow(0, name, 992 value)); 993 993 } 994 994 } … … 999 999 else 1000 1000 { 1001 addTableRow(precursorTable, "charge state", pc1002 .getCharge() , null, 0);1003 addTableRow(precursorTable, "m/z", pc1004 .getMassToChargeRatio() , null, 0);1005 addTableRow(precursorTable, "intensity", pc1006 .getIntensity() , null, 0);1001 precursorTable.addRow( new PropertyRow(0, "charge state", pc 1002 .getCharge())); 1003 precursorTable.addRow( new PropertyRow(0, "m/z", pc 1004 .getMassToChargeRatio())); 1005 precursorTable.addRow( new PropertyRow(0, "intensity", pc 1006 .getIntensity())); 1007 1007 } 1008 1008 /* … … 1021 1021 if (name != null && !name.equals("")) 1022 1022 { 1023 addTableRow(precursorTable, name, value,1024 null , 0);1023 precursorTable.addRow( new PropertyRow(0, name, value, 1024 null)); 1025 1025 } 1026 1026 } … … 1034 1034 String fragmentationTypeStr = new String( 1035 1035 "FragmentationType"); 1036 addTableRow(precursorTable, fragmentationTypeStr,1037 fragmentationType , null, 0);1036 precursorTable.addRow( new PropertyRow(0, fragmentationTypeStr, 1037 fragmentationType)); 1038 1038 // 1039 1039 propertiesFS.add(precursorTable); … … 1063 1063 if (name != null && !name.equals("")) 1064 1064 { 1065 addTableRow(extraDataTable, name, value, null, 1066 0); 1065 extraDataTable.addRow( new PropertyRow(0, name, value)); 1067 1066 } 1068 1067 } … … 1079 1078 return form; 1080 1079 } 1081 1082 /** 1083 Adds a table row to a table. A "value" argument that is null will be 1084 represented as an empty string, otherwise by its toString() value. 1085 1086 @param table Table The table to add a row to. 1087 @param nameKey String Property key string. 1088 @param value Object Property value object. 1089 @param actionClass Class<E extends ProteiosAction> Optional value cell 1090 action. 1091 @param itemId int The item id to use for an optional action. 1092 */ 1093 private void addTableRow(Table table, String nameKey, Object value, 1094 Class<? extends ProteiosAction> actionClass, int itemId) 1095 { 1096 // Convert value to string, with empty string for null value 1097 String valueStr = new String(""); 1098 if (value != null) 1099 { 1100 // Convert value to string 1101 valueStr = "" + value; 1102 } 1103 // 1104 // Construct row 1105 String rowTitle = new String(nameKey); 1106 Row row = new Row(rowTitle); 1107 Cell<String> nameCell = new Cell<String>(locale.get(nameKey)); 1108 Cell<String> valueCell = new Cell<String>(valueStr); 1109 // Check if value cell should be coupled to action 1110 if (actionClass != null) 1111 { 1112 // Add action link to value cell 1113 ActionLink cellAction = actionFactory.getActionLink( 1114 actionClass, actionClass.getName()); 1115 cellAction.addParameter(ItemIdField.VPARAM, itemId); 1116 valueCell.setActionLink(cellAction); 1117 } 1118 row.addCell(nameCell); 1119 row.addCell(valueCell); 1120 table.addRow(row); 1121 } 1122 1080 1123 1081 /** 1124 1082 Returns a form with spectrum file contact data for a spectrum file. 1125 1083 1126 1084 @param spectrumContact Spectrum file contact 1127 1085 data. … … 1153 1111 name = spectrumContact.getName(); 1154 1112 } 1155 addTableRow(contactTable, "Name", name, null, 0);1113 contactTable.addRow(new PropertyRow(0 , "Name", name)); 1156 1114 /* 1157 1115 Institution … … 1162 1120 institution = spectrumContact.getInstitution(); 1163 1121 } 1164 addTableRow(contactTable, "Institution", institution, null, 0);1122 contactTable.addRow( new PropertyRow(0, "Institution", institution)); 1165 1123 /* 1166 1124 ContactInfo … … 1171 1129 contactInfo = spectrumContact.getContactInfo(); 1172 1130 } 1173 addTableRow(contactTable, "ContactInfo", contactInfo, null, 0);1131 contactTable.addRow( new PropertyRow(0, "ContactInfo", contactInfo)); 1174 1132 /* 1175 1133 Address … … 1180 1138 address = spectrumContact.getAddress(); 1181 1139 } 1182 addTableRow(contactTable, "Address", address, null, 0);1140 contactTable.addRow( new PropertyRow(0, "Address", address)); 1183 1141 /* 1184 1142 URL … … 1189 1147 url = spectrumContact.getUrl(); 1190 1148 } 1191 addTableRow(contactTable, "URL", url, null, 0);1149 contactTable.addRow( new PropertyRow(0, "URL", url)); 1192 1150 /* 1193 1151 Email … … 1198 1156 email = spectrumContact.getEmail(); 1199 1157 } 1200 addTableRow(contactTable, "Email", email, null, 0);1158 contactTable.addRow( new PropertyRow(0, "Email", email)); 1201 1159 /*********************************************************************** 1202 1160 Form … … 1206 1164 return form; 1207 1165 } 1208 1166 1209 1167 /** 1210 1168 Returns a form for adding spectrum file sample data for a spectrum file. 1211 1169 1212 1170 @param project Project The project in whose directory a new output 1213 1171 directory is created. … … 1299 1257 return form; 1300 1258 } 1301 1259 1302 1260 private <D extends Object> TextField<D> newTextField(String name, D value) 1303 1261 { … … 1308 1266 return field; 1309 1267 } 1310 1268 1311 1269 public Form getPeakListSetForm(PeakListSet pls) 1312 1270 { … … 1376 1334 return form; 1377 1335 } 1378 1336 1379 1337 private void addAnnotationsAsFields(Fieldset to, Annotatable item, 1380 1338 DbControl dc) … … 1391 1349 } 1392 1350 } 1393 1351 1394 1352 public Fieldset getProteinAssemblyFieldset(Project project) 1395 1353 { … … 1414 1372 return properties; 1415 1373 } 1416 1374 1417 1375 public Select<VString> selectLocalSampleIdWithAllOption(DbControl dc, 1418 1376 Project project) … … 1428 1386 return select; 1429 1387 } 1430 1388 1431 1389 private Select<VInteger> newSelectLabel(LabeledExtract le, DbControl dc) 1432 1390 { … … 1449 1407 return select; 1450 1408 } 1451 1409 1452 1410 /** 1453 1411 Creates and adds a hidden field with an Integer value to the given form. … … 1461 1419 form.getFieldsets().get(0).add(field); 1462 1420 } 1463 1421 1464 1422 /** 1465 1423 Creates and adds a hidden field with an Integer value to the given table. … … 1473 1431 table.add(field); 1474 1432 } 1475 1433 1476 1434 public Fieldset getUsedSampleFieldset(Sample sample) 1477 1435 { … … 1491 1449 return fs; 1492 1450 } 1493 1451 1494 1452 public Fieldset getUsedExtractFieldset(Extract extract) 1495 1453 { … … 1506 1464 return fs; 1507 1465 } 1508 1466 1509 1467 public Fieldset getUsedLabeledExtractFieldset(LabeledExtract extract) 1510 1468 { … … 1524 1482 return fs; 1525 1483 } 1526 1484 1527 1485 public Form getSecondaryLabeledExtractForm(LabeledExtract extract, 1528 1486 DbControl dc, LabeledExtract fromExtract) … … 1587 1545 return form; 1588 1546 } 1589 1547 1590 1548 public TextField<Float> newOriginalQuantityField() 1591 1549 { … … 1595 1553 return field; 1596 1554 } 1597 1555 1598 1556 public TextField<Float> newRemainingQuantityField(Float remainingQuantity) 1599 1557 { … … 1606 1564 return field; 1607 1565 } 1566 1567 private Localizer getLocale() 1568 { 1569 return locale; 1570 } 1571 1572 public void setLocale(Localizer locale) 1573 { 1574 this.locale = locale; 1575 } 1576 1577 //Cleaning up from here 1608 1578 1609 private Localizer getLocale()1610 {1611 return locale;1612 }1613 1614 public void setLocale(Localizer locale)1615 {1616 this.locale = locale;1617 }1618 1619 //Cleaning up from here1620 1621 1579 /** 1622 1580 Form for new Protocol item. The difference between calling … … 1629 1587 a convenient place holder for default values for the Protocol form 1630 1588 fields. 1631 1589 1632 1590 @param protocol Protocol object (need not be stored in database) with 1633 1591 default field values. … … 1714 1672 return form; 1715 1673 } 1716 1674 1717 1675 public Form getForm(Class<?> cls) 1718 1676 { … … 1804 1762 loginF.setDisabled(true); 1805 1763 fs.add(fs.size()-2, loginF); // After the itemId field 1806 1764 1807 1765 TextField<String> emailF = new EmailField(); 1808 1766 fs.add(fs.size()-1, emailF); 1809 1767 1810 1768 TextField<String> phoneF = new PhoneField(); 1811 1769 fs.add(phoneF); 1812 1770 1813 1771 TextField<String> addressF = new AddressField(); 1814 1772 fs.add(addressF); 1815 1773 1816 1774 TextField<String> organisationF = new OrganisationField(); 1817 1775 fs.add(organisationF); 1818 1776 1819 1777 if (obj != null) 1820 1778 { … … 2147 2105 return form; 2148 2106 } 2149 2107 2150 2108 /** 2151 2109 Creates a select box for protocols. If the class for which the protocol … … 2155 2113 if the protocol is tagged to be removed. However, no other protocols 2156 2114 tagged to be removed should be included in the list. 2157 2115 2158 2116 @param cls Class Class for which a protocol should be selected. 2159 2117 @param obj Object Optional object with attached protocol for setting … … 2262 2220 return protocolS; 2263 2221 } 2264 2222 2265 2223 public void setSc(SessionControl sc) 2266 2224 { -
trunk/client/servlet/src/org/proteios/gui/table/PropertyRow.java
r3945 r3946 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2010 Gregory Vincic 5 5 6 6 Files are copyright by their respective authors. The contributions to 7 7 files where copyright is not explicitly stated can be traced with the 8 8 source code revision system. 9 9 10 10 This file is part of Proteios. 11 11 Available at http://www.proteios.org/ 12 12 13 13 Proteios is free software; you can redistribute it and/or 14 14 modify it under the terms of the GNU General Public License 15 15 as published by the Free Software Foundation; either version 2 16 16 of the License, or (at your option) any later version. 17 17 18 18 Proteios is distributed in the hope that it will be useful, 19 19 but WITHOUT ANY WARRANTY; without even the implied warranty of 20 20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21 21 GNU General Public License for more details. 22 22 23 23 You should have received a copy of the GNU General Public License 24 24 along with this program; if not, write to the Free Software … … 38 38 public final class PropertyRow extends Row 39 39 { 40 public PropertyRow(int id, String name, Stringvalue, ActionLink action)40 public PropertyRow(int id, String name, Object value, ActionLink action) 41 41 { 42 42 super(id); … … 46 46 nameCell = new Cell<String>(name); 47 47 nameCell.setTranslate(true); 48 48 49 49 valueStr = (value != null) ? value.toString() : ""; 50 50 valueCell = new Cell<String>(valueStr); 51 51 52 52 if (action != null) 53 53 { … … 58 58 addCell(valueCell); 59 59 } 60 61 public PropertyRow(int id, String name, Object value ) 62 { 63 this(id, name, value, null); 64 } 60 65 } 61 66 -
trunk/client/servlet/src/org/proteios/gui/web/GUIConverter.java
r3943 r3946 1 1 /* 2 2 $Id$ 3 3 4 4 Copyright (C) 2006 Gregory Vincic 5 5 Copyright (C) 2007 Gregory Vincic, Olle Mansson 6 6 7 7 Files are copyright by their respective authors. The contributions to 8 8 files where copyright is not explicitly stated can be traced with the 9 9 source code revision system. 10 10 11 11 This file is part of Proteios. 12 12 Available at http://www.proteios.org/ 13 13 14 14 Proteios-2.x is free software; you can redistribute it and/or 15 15 modify it under the terms of the GNU General Public License 16 16 as published by the Free Software Foundation; either version 2 17 17 of the License, or (at your option) any later version. 18 18 19 19 Proteios is distributed in the hope that it will be useful, 20 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 22 GNU General Public License for more details. 23 23 24 24 You should have received a copy of the GNU General Public License 25 25 along with this program; if not, write to the Free Software … … 81 81 import org.proteios.gui.table.Row; 82 82 import org.proteios.gui.table.TreeRow; 83 import se.lu.thep.waf.constraints.VParameter; 83 84 import se.lu.thep.waf.constraints.VString; 84 import se.lu.thep.waf.constraints.VParameter;85 85 import se.lu.thep.waf.dom.html.A; 86 86 import se.lu.thep.waf.dom.html.Area; … … 133 133 private String currentFormId = null; 134 134 private TypeUtil typeUtil = new TypeUtil(); 135 135 136 136 public HttpServletRequest getRequest() 137 137 { 138 138 return request; 139 139 } 140 140 141 141 public void setRequest(HttpServletRequest request) 142 142 { … … 144 144 hf.setRequest(request); 145 145 } 146 146 147 147 public GUIConverter(String contextPath) 148 148 { … … 152 152 this.hf = new HtmlFactory(contextPath); 153 153 } 154 154 155 155 private Random r = new Random(); 156 156 157 157 public Tag convert(Image img) 158 158 { … … 239 239 return div; 240 240 } 241 241 242 242 public Tag convert(IFrame obj) 243 243 { … … 251 251 return tag; 252 252 } 253 253 254 254 public Tag convert(Listing list) 255 255 { … … 286 286 return layout; 287 287 } 288 288 289 289 /** 290 290 * @param action … … 298 298 String jsMethod = "goToLocation"; 299 299 sb.append(jsMethod + "('"); 300 301 300 sb.append(this.contextPath); 301 sb.append("?action="); 302 302 sb.append(action.toString()); 303 303 sb.append("')"); … … 305 305 return sb.toString(); 306 306 } 307 307 308 308 public Tag convert(org.proteios.gui.TreeMenu menu) 309 309 { … … 317 317 return layout.getRoot(); 318 318 } 319 319 320 320 public Tag convert(org.proteios.gui.MainMenu menu) 321 321 { 322 322 Tag div, ul; 323 323 324 324 div = hf.newLayoutDiv(); 325 325 ul = convert((org.proteios.gui.TreeMenu) menu); 326 326 327 327 div.add(ul); 328 328 return div; 329 329 } 330 330 331 331 public String convert(ClosePopup button) 332 332 { 333 333 return "closeAllVisiblePopups()"; 334 334 } 335 335 336 336 public Tag<?> convert(ActionLink pageLink, String formId, boolean localize) 337 337 { … … 350 350 return tag; 351 351 } 352 352 353 353 /** 354 354 * Converts an ActionLink such that each parameter of the ActionLink is a … … 386 386 return js.toString(); 387 387 } 388 388 389 389 public Tag convert(Scroller scroller, String formId) 390 390 { … … 449 449 return scrollBar.getRoot(); 450 450 } 451 451 452 452 /** 453 453 * @param table to convert … … 489 489 } 490 490 } 491 491 492 492 } 493 493 scroller = table.getScroller(); … … 583 583 // Column display order select box 584 584 Integer colDisplayOrder = col.getDisplayOrder(); 585 585 586 586 if (ad.getKey().equals("Id")) 587 587 { … … 611 611 tr.newTd().add(displayOrderSelectBox); 612 612 } 613 613 614 614 // Order by 615 615 if (col.getDisplayFilter()) … … 896 896 return layout.getRoot(); 897 897 } 898 898 899 899 public Tag convert(org.proteios.gui.table.FolderTable table) 900 900 { … … 946 946 return layout.getRoot(); 947 947 } 948 948 949 949 public Tr convert(Row row) 950 950 { … … 965 965 return tr; 966 966 } 967 967 968 968 public Tr convert(TreeRow row) 969 969 { … … 992 992 return tr; 993 993 } 994 994 995 995 public Tag convert(Separator sep) 996 996 { 997 997 return new Hr(); 998 998 } 999 999 1000 1000 public <D extends Object> Tag convert(Cell<D> cell) 1001 1001 { … … 1035 1035 { 1036 1036 strValue = String.valueOf(value); 1037 if(cell.getTranslate()) 1038 { 1039 strValue = locale.get(strValue); 1040 } 1037 1041 } 1038 1042 // Fixes empty td tags displaying border … … 1072 1076 return td; 1073 1077 } 1074 1078 1075 1079 public Tag convert(Column col) 1076 1080 { … … 1081 1085 return th; 1082 1086 } 1083 1087 1084 1088 public Tag convert(Column col, org.proteios.gui.table.Table table) 1085 1089 { … … 1102 1106 return th; 1103 1107 } 1104 1108 1105 1109 public Tag convert(Text txt) 1106 1110 { … … 1110 1114 return layout; 1111 1115 } 1112 1116 1113 1117 public Tag convert(TitledWindow win) 1114 1118 { … … 1153 1157 return window.getRoot(); 1154 1158 } 1155 1159 1156 1160 @SuppressWarnings("unused") 1157 1161 public Tag convert(Space space) … … 1159 1163 return new Div().setClass("space"); 1160 1164 } 1161 1165 1162 1166 public Tag convert(Message msg) 1163 1167 { … … 1166 1170 return layout.getRoot(); 1167 1171 } 1168 1172 1169 1173 int idCounter = 0; 1170 1174 String lastId = ""; 1171 1175 1172 1176 public String nextId() 1173 1177 { … … 1176 1180 return lastId; 1177 1181 } 1178 1182 1179 1183 public String getLastId() 1180 1184 { 1181 1185 return lastId; 1182 1186 } 1183 1187 1184 1188 public Tag convert(org.proteios.gui.Error err) 1185 1189 { … … 1188 1192 return layout.getRoot(); 1189 1193 } 1190 1194 1191 1195 public Tag convert(org.proteios.gui.form.Form w) 1192 1196 { … … 1197 1201 Input field; 1198 1202 AbstractLink defaultAction; 1199 1203 1200 1204 layout = hf.newLayoutDiv(); 1201 1205 clearForm = false; … … 1242 1246 return layout.getRoot(); 1243 1247 } 1244 1248 1245 1249 public Tag convert(org.proteios.gui.form.Fieldset fs) 1246 1250 { 1247 1251 return convertFieldset(fs, null, false); 1248 1252 } 1249 1253 1250 1254 private int fieldsetId = 0; 1251 1255 private int nextFieldsetId() { fieldsetId++; return fieldsetId; } 1252 1256 1253 1257 private Tag convertFieldset(org.proteios.gui.form.Fieldset fs, Form form, Boolean useToggle) 1254 1258 { … … 1273 1277 btn.setSrc(fs.isOpen() ? "static/img/minus.gif" : "static/img/plus.gif"); 1274 1278 } 1275 1279 1276 1280 if (fs.getTitle()!= null) 1277 1281 { … … 1286 1290 } 1287 1291 legend.add(title.getRoot()); 1288 1292 1289 1293 fields = fieldset.newDiv().setClass("fields"); 1290 1294 fields.setId(id); … … 1297 1301 return fieldset; 1298 1302 } 1299 1303 1300 1304 private Tag addFieldAsRow(Tag table, org.proteios.gui.GUIElement f, Form form) 1301 1305 { … … 1346 1350 input = convert((org.proteios.gui.form.Checkbox) f, false); 1347 1351 } 1348 1349 1350 1352 1353 VParameter param = field.getParam(); 1354 1351 1355 if (param != null && (param.isRequired() || 1352 1356 (param instanceof VString && ((VString) param).getMinCharacterLength() > 0))) … … 1358 1362 row.newTd().add(input); 1359 1363 } 1360 1364 1361 1365 // Help and error field 1362 1366 helpC = row.newTd(); … … 1376 1380 { 1377 1381 Tag subRow = addFieldAsRow(table, subf, form); 1378 1379 1382 Tag labeltd = (Tag) subRow.getElements().get(0); // the td tag 1383 labeltd.addClass("subfield"); 1380 1384 } 1381 1385 table.newTr().newTd().setAttribute(new Attribute("colspan", "2")).setClass("subend").newBr(); … … 1383 1387 return row; 1384 1388 } 1385 1389 1386 1390 private Tag convert(FileField f) 1387 1391 { … … 1394 1398 return in; 1395 1399 } 1396 1400 1397 1401 public Tag convert(org.proteios.gui.form.Select<?> select) 1398 1402 { … … 1456 1460 return field; 1457 1461 } 1458 1462 1459 1463 public Tag convert(ColumnContainer container) 1460 1464 { … … 1481 1485 return layout; 1482 1486 } 1483 1487 1484 1488 public Tag convert(org.proteios.gui.Empty empty) 1485 1489 { 1486 1490 return new Span().newCData(" "); 1487 1491 } 1488 1492 1489 1493 public Tag convert(RowContainer container) 1490 1494 { … … 1509 1513 return span; 1510 1514 } 1511 1515 1512 1516 private int treeLevel = 0; 1513 1517 1514 1518 public Tag convert(Node node) 1515 1519 { … … 1582 1586 childHref.addClass("last"); 1583 1587 } 1584 1588 1585 1589 if (first) 1586 1590 first = false; … … 1591 1595 return li; 1592 1596 } 1593 1597 1594 1598 /** 1595 1599 * Convenience method for getting path to a bullet/spacer image file marking … … 1620 1624 return iconPath; 1621 1625 } 1622 1626 1623 1627 /** 1624 1628 * Converts a toolbar so that button clicks post the form referenced by … … 1689 1693 return new CData(""); 1690 1694 } 1691 1695 1692 1696 public Tag convert(org.proteios.gui.TabSet set) 1693 1697 { … … 1716 1720 return layout; 1717 1721 } 1718 1722 1719 1723 private Tag convert(org.proteios.gui.Tab tab, boolean convertTabContent) 1720 1724 { … … 1735 1739 return li; 1736 1740 } 1737 1741 1738 1742 private Tag convert(org.proteios.gui.form.TextArea f) 1739 1743 { … … 1752 1756 return in; 1753 1757 } 1754 1758 1755 1759 private String formatedValue(TextField<?> f) 1756 1760 { … … 1766 1770 return value; 1767 1771 } 1768 1772 1769 1773 private <D extends Object> Tag<?> convert( 1770 1774 org.proteios.gui.form.TextField<D> f) … … 1774 1778 Input in; 1775 1779 Tag<?> field; 1776 1780 1777 1781 // Format the value 1778 1782 value = formatedValue(f); 1779 1783 container = new CData(""); 1780 1784 1781 1785 in = null; 1782 1786 type = "text"; … … 1791 1795 value = ""; 1792 1796 } 1793 1794 1797 VParameter param = f.getParam(); 1798 1795 1799 if (param != null && (param.isRequired() || 1796 1800 (param instanceof VString && ((VString) param).getMinCharacterLength() > 0))) … … 1807 1811 return container; 1808 1812 } 1809 1813 1810 1814 private Tag<?> convert(org.proteios.gui.form.PasswordField f) 1811 1815 { … … 1818 1822 return in; 1819 1823 } 1820 1824 1821 1825 public Tag<?> convert(org.proteios.gui.form.Checkbox<?> checkbox) 1822 1826 { 1823 1827 return convert(checkbox, false); 1824 1828 } 1825 1829 1826 1830 private Tag<?> convert(org.proteios.gui.form.Checkbox<?> checkbox, 1827 1831 boolean inForm) … … 1844 1848 return cbF; 1845 1849 } 1846 1850 1847 1851 public Tag<?> convert(org.proteios.gui.Toolbar toolbar) 1848 1852 { … … 1910 1914 return layout.getRoot(); 1911 1915 } 1912 1916 1913 1917 public Tag<?> convert(org.proteios.gui.Button button) 1914 1918 { … … 1977 1981 return layout.getRoot(); 1978 1982 } 1979 1983 1980 1984 public Tag<?> convert(org.proteios.gui.ButtonSet toolbar) 1981 1985 { … … 1984 1988 return layout; 1985 1989 } 1986 1990 1987 1991 public Tag<?> convert(org.proteios.gui.Title title) 1988 1992 { … … 2004 2008 return hx.getRoot(); 2005 2009 } 2006 2010 2007 2011 @Override 2008 2012 public Tag missingConverter(ConvertableElement obj) … … 2014 2018 return div; 2015 2019 } 2016 2020 2017 2021 public void setLocale(Localizer locale) 2018 2022 { … … 2024 2028 } 2025 2029 } 2026 2030 2027 2031 public void setIconSet(Properties iconSet) 2028 2032 {
Note: See TracChangeset
for help on using the changeset viewer.