Changeset 3941
- Timestamp:
- Nov 2, 2010, 2:06:13 PM (13 years ago)
- Location:
- trunk/client/servlet/src/org/proteios
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/client/servlet/src/org/proteios/action/spectrumSearch/ViewActivePeptideSearchResult.java
r3935 r3941 1 1 /* 2 $Id$ 3 4 Copyright (C) 2006 Fredrik Levander, Gregory Vincic, Olle Mansson 5 Copyright (C) 2007 Fredrik Levander, Gregory Vincic 6 7 Files are copyright by their respective authors. The contributions to 8 files where copyright is not explicitly stated can be traced with the 9 source code revision system. 10 11 This file is part of Proteios. 12 Available at http://www.proteios.org/ 13 14 Proteios-2.x is free software; you can redistribute it and/or 15 modify it under the terms of the GNU General Public License 16 as published by the Free Software Foundation; either version 2 17 of the License, or (at your option) any later version. 18 19 Proteios is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22 GNU General Public License for more details. 23 24 You should have received a copy of the GNU General Public License 25 along with this program; if not, write to the Free Software 26 Foundation, Inc., 59 Temple Place - Suite 330, 27 Boston, MA 02111-1307, USA. 28 */ 2 $Id$ 3 4 Copyright (C) 2006 Fredrik Levander, Gregory Vincic, Olle Mansson 5 Copyright (C) 2007 Fredrik Levander, Gregory Vincic 6 Copyright (C) 2010 Gregory Vincic 7 8 Files are copyright by their respective authors. The contributions to 9 files where copyright is not explicitly stated can be traced with the 10 source code revision system. 11 12 This file is part of Proteios. 13 Available at http://www.proteios.org/ 14 15 Proteios-2.x is free software; you can redistribute it and/or 16 modify it under the terms of the GNU General Public License 17 as published by the Free Software Foundation; either version 2 18 of the License, or (at your option) any later version. 19 20 Proteios is distributed in the hope that it will be useful, 21 but WITHOUT ANY WARRANTY; without even the implied warranty of 22 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 GNU General Public License for more details. 24 25 You should have received a copy of the GNU General Public License 26 along with this program; if not, write to the Free Software 27 Foundation, Inc., 59 Temple Place - Suite 330, 28 Boston, MA 02111-1307, USA. 29 */ 29 30 package org.proteios.action.spectrumSearch; 30 31 32 import java.lang.reflect.InvocationTargetException; 33 import java.lang.reflect.Method; 34 import java.lang.reflect.Modifier; 35 import java.text.SimpleDateFormat; 36 import java.util.ArrayList; 37 import java.util.Date; 38 import java.util.List; 31 39 import org.proteios.ActionLink; 32 40 import org.proteios.action.ProteiosAction; 33 41 import org.proteios.action.peakList.PlotFileSpectrum; 34 42 import org.proteios.core.Annotation; 43 import org.proteios.core.AnnotationSet; 35 44 import org.proteios.core.Annotator; 36 45 import org.proteios.core.DbControl; … … 51 60 import org.proteios.gui.RowContainer; 52 61 import org.proteios.gui.Toolbar; 62 import org.proteios.gui.form.*; 53 63 import org.proteios.gui.form.Fieldset; 54 import org.proteios.gui.form.Form;55 import org.proteios.gui.form.FormFactory;56 import org.proteios.gui.form.FormTemplateImpl;57 import org.proteios.gui.form.FormTemplateInterface;58 64 import org.proteios.gui.layout.RowLayout; 59 65 import org.proteios.gui.table.Table; 60 66 import org.proteios.gui.table.TableFactory; 61 62 67 import se.lu.thep.waf.ActionException; 68 import se.lu.thep.waf.constraints.Format; 63 69 import se.lu.thep.waf.constraints.InvalidParameterValue; 64 70 import se.lu.thep.waf.constraints.VBoolean; 65 71 import se.lu.thep.waf.constraints.VInteger; 72 import se.lu.thep.waf.constraints.VString; 66 73 67 /**68 * @author gregory69 */70 74 public class ViewActivePeptideSearchResult 71 75 extends ProteiosAction<ViewActivePeptideSearchResult> 72 76 { 73 public static final VInteger VSEARCHRESULTID = new VInteger( 74 "active.searchresult.id", 1, true); 75 public static final VBoolean VKEEPORIGINALSPECTRUM = new VBoolean( 76 "keepOriginalSpectrum", false); 77 78 79 @Override 80 public void runMe() 81 throws ActionException, InvalidParameterValue 82 { 83 verifySessionAttributes(VSEARCHRESULTID); 84 /*********************************************************************** 85 * Properties 86 */ 87 Integer ssId = getSessionAttribute(VSEARCHRESULTID); 88 String massCutoffLowStr = getValidString(PlotFileSpectrum.VMASSCUTOFFLOWSTR); 89 String massCutoffHighStr = getValidString(PlotFileSpectrum.VMASSCUTOFFHIGHSTR); 90 Boolean keepOriginalSpectrum = getValidBoolean(VKEEPORIGINALSPECTRUM); 91 log.debug("ssId = " + ssId); 92 log.debug("massCutoffLowStr = \"" + massCutoffLowStr + "\""); 93 log.debug("massCutoffHighStr = \"" + massCutoffHighStr + "\""); 94 log.debug("(1) keepOriginalSpectrum = " + keepOriginalSpectrum); 95 if (keepOriginalSpectrum == null) 96 { 97 keepOriginalSpectrum = true; 98 } 99 log.debug("(2) keepOriginalSpectrum = " + keepOriginalSpectrum); 100 // Only show one spectrum view if no mass range parameters 101 if ((massCutoffLowStr == null || massCutoffLowStr.equals("")) 102 && (massCutoffHighStr == null || massCutoffHighStr.equals(""))) 103 { 104 keepOriginalSpectrum = false; 105 } 106 log.debug("(3) keepOriginalSpectrum = " + keepOriginalSpectrum); 107 DbControl dc = newDbControl(); 108 ItemFactory factory = new ItemFactory(dc); 109 TableFactory tableFactory = getTableFactory(); 110 SearchResult ss = factory.getById(SearchResult.class, ssId); 111 Form mainForm = new Form("Search Result"); 112 Fieldset fs=new Fieldset(); 113 fs.setTitle("Search Result"); 114 mainForm.addFieldset(fs); 115 FormTemplateImpl formTemplate = new FormTemplateImpl(); 116 formTemplate.setItemObject(ss); 117 formTemplate.setReadOnlyForm(true); 118 FormFactory formFactory = getFormFactory(); 119 Form form = formFactory.getForm(formTemplate); 120 // Peptides: 121 ItemQuery<Peptide> peptideQuery = Peptide.getQuery(); 122 peptideQuery.restrict(Restrictions.eq(Hql.property("searchResult"), Hql 123 .entity(ss))); 124 tableFactory.reset(); 125 tableFactory.setItemClass(Peptide.class); 126 tableFactory.setQuery(peptideQuery); 127 ActionLink rowAction = getActionFactory().getActionLink( 128 ViewExternalId.class, "View"); 129 tableFactory.setColumnAction("AccessionNumber", rowAction); 130 Table peptideTable = tableFactory.build(); 131 peptideTable.setTitle("Peptides"); 132 peptideTable.setToolbar(null); 133 /*********************************************************************** 134 * Annotations table 135 */ 136 Annotator anna = new Annotator(getItemFactory(dc)); 137 tableFactory.reset(); 138 tableFactory.setItemClass(Annotation.class); 139 ItemQuery<Annotation> annotationQuery = anna.getAnnotationSet(ss) 140 .getAnnotations(); 141 tableFactory.setQuery(annotationQuery); 142 Table annotationsTable = tableFactory.build(); 143 ColumnContainer cc = new ColumnContainer(); 144 cc.add(annotationsTable); 145 /** 146 * Spectrum plot 147 */ 148 ItemQuery<Hit> hitQuery = Hit.getQuery(); 149 hitQuery.restrict(Restrictions.eq(Hql.property("identificationResultFile"), Hql 150 .entity(ss.getSpectrumSearch().getResultFile()))); 151 File peakListFile = null; 152 ItemResultIterator<Hit> hitit = hitQuery.iterate(dc); 153 if (hitit.hasNext()) peakListFile = hitit.next().getPeakListFile(); 154 if (peakListFile == null) 155 { 156 ItemQuery<File> fileQuery = File.getQuery(); 157 fileQuery.restrict(Restrictions.eq(Hql.property("name"), 158 Expressions.parameter("name"))); 159 fileQuery.setParameter("name", ss.getSpectrumSearch().getInputSpectrumFileName(), null); 160 ItemResultIterator<File> fileit = fileQuery.iterate(dc); 161 if (fileit.hasNext()) peakListFile = fileit.next(); 162 } 163 if (peakListFile!=null) 164 { 165 /*********************************************************************** 166 * Spectrum plot 167 */ 168 String spectrumId = Integer.toString(ss.getInputSpectrumId()); 169 PlotFileSpectrum plotFileSpectrum = new PlotFileSpectrum(); 170 ImageMap imageMap; 171 Image plotOriginal = null; 172 if (keepOriginalSpectrum) 173 { 174 plotOriginal = new Image(); 175 ActionLink viewOriginalAction = getActionFactory().getActionLink( 176 PlotFileSpectrum.class, "ViewOriginal"); 177 viewOriginalAction.addParameter(FormFactory.VID, peakListFile.getId()); 178 viewOriginalAction.addParameter(PlotFileSpectrum.VSPECTRUMID, spectrumId); 179 plotOriginal.setViewAction(viewOriginalAction); 180 plotOriginal.setHeight(PlotFileSpectrum.HEIGHT); 181 plotOriginal.setWidth(PlotFileSpectrum.WIDTH); 182 // Add mass annotation image map 183 imageMap = plotFileSpectrum.fetchMassPeakAnnotationToolTips(dc, peakListFile.getId(), spectrumId, 184 (String) null, (String) null); 185 plotOriginal.setImageMap(imageMap); 186 } 187 Image plot = new Image(); 188 ActionLink viewAction = getActionFactory().getActionLink( 189 PlotFileSpectrum.class, "View"); 190 viewAction.addParameter(FormFactory.VID, peakListFile.getId()); 191 viewAction.addParameter(PlotFileSpectrum.VSPECTRUMID, spectrumId); 192 viewAction.addParameter(PlotFileSpectrum.VMASSCUTOFFLOWSTR, massCutoffLowStr); 193 viewAction.addParameter(PlotFileSpectrum.VMASSCUTOFFHIGHSTR, massCutoffHighStr); 194 plot.setViewAction(viewAction); 195 plot.setHeight(PlotFileSpectrum.HEIGHT); 196 plot.setWidth(PlotFileSpectrum.WIDTH); 197 // Add mass annotation image map 198 imageMap = plotFileSpectrum.fetchMassPeakAnnotationToolTips(dc, peakListFile.getId(), spectrumId, 199 massCutoffLowStr, massCutoffHighStr); 200 plot.setImageMap(imageMap); 201 /*********************************************************************** 202 * Spectrum mass range selection form 203 */ 204 Form massRangeSelectionForm = getFormFactory().getSpectrumMassRangeSelectionForm(massCutoffLowStr, massCutoffHighStr, spectrumId); 205 Toolbar toolbar = new Toolbar(); 206 massRangeSelectionForm.setToolbar(toolbar); 207 // 208 ActionLink zoomWithOriginalAction = getActionLink(ViewActivePeptideSearchResult.class, "ZoomedAndOriginalSpectrum"); 209 //zoomWithOriginalAction.addParameter(FormFactory.VID, peakListFile.getId()); 210 zoomWithOriginalAction.addParameter(VKEEPORIGINALSPECTRUM, true); 211 toolbar.add(zoomWithOriginalAction); 212 // 213 ActionLink zoomAction = getActionLink(ViewActivePeptideSearchResult.class, "ZoomedSpectrum"); 214 //zoomAction.addParameter(FormFactory.VID, peakListFile.getId()); 215 zoomAction.addParameter(VKEEPORIGINALSPECTRUM, false); 216 toolbar.add(zoomAction); 217 // Row container for plot and properties form 218 RowContainer rc = new RowContainer(); 219 if (plotOriginal != null) 220 { 221 rc.add(plotOriginal); 222 } 223 rc.add(plot); 224 rc.add(massRangeSelectionForm); 225 cc.add(rc); 226 } 227 /*********************************************************************** 228 * Layout 229 */ 230 RowLayout layout = getLayoutFactory().getRowLayout(); 231 layout.add(mainForm); 232 layout.add(form); 233 layout.add(cc); 234 layout.add(peptideTable); 235 setLayout(layout); 236 } 77 public static final VInteger VSEARCHRESULTID = new VInteger("active.searchresult.id", 1, true); 78 public static final VBoolean VKEEPORIGINALSPECTRUM = new VBoolean("keepOriginalSpectrum", false); 79 public static final VBoolean VREADONLYFORM = new VBoolean("readOnlyForm",false); 80 81 /** 82 * List<String> of excluded getter methods declared in current class. If a 83 * getter accessor method is included in this list, when a generic form for 84 * an object is created with getForm(), no field will be added to the form 85 * for an instance variable (if any) corresponding to the getter method. 86 */ 87 private List<String> excludedDeclMethods = new ArrayList<String>(); 88 89 @Override 90 public void runMe() 91 throws ActionException, InvalidParameterValue 92 { 93 Integer ssId; 94 String massCutoffLowStr; 95 String massCutoffHighStr; 96 Boolean keepOriginalSpectrum; 97 DbControl dc; 98 ItemFactory factory; 99 TableFactory tableFactory; 100 SearchResult ss; 101 Form mainForm; 102 Fieldset fs; 103 FormTemplateImpl formTemplate; 104 Form form; 105 ItemQuery<Peptide> peptideQuery; 106 ActionLink rowAction; 107 Table peptideTable; 108 Annotator anna; 109 ItemQuery<Annotation> annotationQuery; 110 Table annotationsTable; 111 ColumnContainer cc; 112 ItemQuery<Hit> hitQuery; 113 File peakListFile; 114 ItemResultIterator<Hit> hitit; 115 ItemQuery<File> fileQuery; 116 ItemResultIterator<File> fileit; 117 // Define 118 initExcludedDeclMethods(); 119 120 verifySessionAttributes(VSEARCHRESULTID); 121 ssId = getSessionAttribute(VSEARCHRESULTID); 122 massCutoffLowStr = getValidString(PlotFileSpectrum.VMASSCUTOFFLOWSTR); 123 massCutoffHighStr = getValidString(PlotFileSpectrum.VMASSCUTOFFHIGHSTR); 124 keepOriginalSpectrum = getValidBoolean(VKEEPORIGINALSPECTRUM); 125 if (keepOriginalSpectrum == null) 126 { 127 keepOriginalSpectrum = true; 128 } 129 // Only show one spectrum view if no mass range parameters 130 if ((massCutoffLowStr == null || massCutoffLowStr.equals("")) 131 && (massCutoffHighStr == null || massCutoffHighStr.equals(""))) 132 { 133 keepOriginalSpectrum = false; 134 } 135 log.debug("keepOriginalSpectrum = " + keepOriginalSpectrum); 136 dc = newDbControl(); 137 factory = getItemFactory(dc); 138 tableFactory = getTableFactory(); 139 ss = factory.getById(SearchResult.class, ssId); 140 mainForm = new Form("Search Result"); 141 fs=new Fieldset(); 142 fs.setTitle("Search Result"); 143 mainForm.addFieldset(fs); 144 formTemplate = new FormTemplateImpl(); 145 formTemplate.setItemObject(ss); 146 formTemplate.setReadOnlyForm(true); 147 form = getForm(formTemplate); 148 // Peptides: 149 peptideQuery = Peptide.getQuery(); 150 peptideQuery.restrict(Restrictions.eq(Hql.property("searchResult"), Hql.entity(ss))); 151 tableFactory.reset(); 152 tableFactory.setItemClass(Peptide.class); 153 tableFactory.setQuery(peptideQuery); 154 rowAction = getActionFactory().getActionLink(ViewExternalId.class, "View"); 155 tableFactory.setColumnAction("AccessionNumber", rowAction); 156 peptideTable = tableFactory.build(); 157 peptideTable.setTitle("Peptides"); 158 peptideTable.setToolbar(null); 159 // Annotations 160 anna = new Annotator(getItemFactory(dc)); 161 tableFactory.reset(); 162 tableFactory.setItemClass(Annotation.class); 163 annotationQuery = anna.getAnnotationSet(ss).getAnnotations(); 164 tableFactory.setQuery(annotationQuery); 165 annotationsTable = tableFactory.build(); 166 cc = new ColumnContainer(); 167 cc.add(annotationsTable); 168 // Plot 169 hitQuery = Hit.getQuery(); 170 hitQuery.restrict(Restrictions.eq(Hql.property("identificationResultFile"), Hql 171 .entity(ss.getSpectrumSearch().getResultFile()))); 172 peakListFile = null; 173 hitit = hitQuery.iterate(dc); 174 if (hitit.hasNext()) 175 { 176 peakListFile = hitit.next().getPeakListFile(); 177 } 178 if (peakListFile == null) 179 { 180 fileQuery = File.getQuery(); 181 fileQuery.restrict(Restrictions.eq(Hql.property("name"), 182 Expressions.parameter("name"))); 183 fileQuery.setParameter("name", ss.getSpectrumSearch().getInputSpectrumFileName(), null); 184 fileit = fileQuery.iterate(dc); 185 if (fileit.hasNext()) peakListFile = fileit.next(); 186 } 187 if (peakListFile!=null) 188 { 189 String spectrumId = Integer.toString(ss.getInputSpectrumId()); 190 PlotFileSpectrum plotFileSpectrum = new PlotFileSpectrum(); 191 ImageMap imageMap; 192 Image plotOriginal = null; 193 if (keepOriginalSpectrum) 194 { 195 plotOriginal = new Image(); 196 ActionLink viewOriginalAction = getActionFactory().getActionLink( 197 PlotFileSpectrum.class, "ViewOriginal"); 198 viewOriginalAction.addParameter(FormFactory.VID, peakListFile.getId()); 199 viewOriginalAction.addParameter(PlotFileSpectrum.VSPECTRUMID, spectrumId); 200 plotOriginal.setViewAction(viewOriginalAction); 201 plotOriginal.setHeight(PlotFileSpectrum.HEIGHT); 202 plotOriginal.setWidth(PlotFileSpectrum.WIDTH); 203 // Add mass annotation image map 204 imageMap = plotFileSpectrum.fetchMassPeakAnnotationToolTips(dc, peakListFile.getId(), spectrumId, 205 (String) null, (String) null); 206 plotOriginal.setImageMap(imageMap); 207 } 208 Image plot = new Image(); 209 ActionLink viewAction = getActionFactory().getActionLink( 210 PlotFileSpectrum.class, "View"); 211 viewAction.addParameter(FormFactory.VID, peakListFile.getId()); 212 viewAction.addParameter(PlotFileSpectrum.VSPECTRUMID, spectrumId); 213 viewAction.addParameter(PlotFileSpectrum.VMASSCUTOFFLOWSTR, massCutoffLowStr); 214 viewAction.addParameter(PlotFileSpectrum.VMASSCUTOFFHIGHSTR, massCutoffHighStr); 215 plot.setViewAction(viewAction); 216 plot.setHeight(PlotFileSpectrum.HEIGHT); 217 plot.setWidth(PlotFileSpectrum.WIDTH); 218 // Add mass annotation image map 219 imageMap = plotFileSpectrum.fetchMassPeakAnnotationToolTips(dc, peakListFile.getId(), spectrumId, 220 massCutoffLowStr, massCutoffHighStr); 221 plot.setImageMap(imageMap); 222 // Spectrum mass range selection form 223 Form massRangeSelectionForm = getFormFactory().getSpectrumMassRangeSelectionForm(massCutoffLowStr, massCutoffHighStr, spectrumId); 224 Toolbar toolbar = new Toolbar(); 225 massRangeSelectionForm.setToolbar(toolbar); 226 227 ActionLink zoomWithOriginalAction = getActionLink(ViewActivePeptideSearchResult.class, "ZoomedAndOriginalSpectrum"); 228 zoomWithOriginalAction.addParameter(VKEEPORIGINALSPECTRUM, true); 229 toolbar.add(zoomWithOriginalAction); 230 231 ActionLink zoomAction = getActionLink(ViewActivePeptideSearchResult.class, "ZoomedSpectrum"); 232 zoomAction.addParameter(VKEEPORIGINALSPECTRUM, false); 233 toolbar.add(zoomAction); 234 // Row container for plot and properties form 235 RowContainer rc = new RowContainer(); 236 if (plotOriginal != null) 237 { 238 rc.add(plotOriginal); 239 } 240 rc.add(plot); 241 rc.add(massRangeSelectionForm); 242 cc.add(rc); 243 } 244 245 RowLayout layout = getLayoutFactory().getRowLayout(); 246 layout.add(mainForm); 247 layout.add(form); 248 layout.add(cc); 249 layout.add(peptideTable); 250 setLayout(layout); 251 } 252 253 /** 254 Get generic form for object. 255 256 @param template template for generic form 257 @return Form for editing the object 258 */ 259 private Form getForm(FormTemplateInterface formTemplate) 260 { 261 /*********************************************************************** 262 Analyze object class 263 */ 264 265 /* 266 Get class from formTemplate itemObject or itemClass. 267 */ 268 Object itemObject = null; 269 Class<? extends Object> itemClass = null; 270 if (formTemplate.getItemObject() != null) 271 { 272 itemObject = formTemplate.getItemObject(); 273 itemClass = itemObject.getClass(); 274 } 275 else if (formTemplate.getItemClass() != null) 276 { 277 itemClass = formTemplate.getItemClass(); 278 } 279 /* 280 Add optional extra formTemplate list of methods to be excluded. 281 */ 282 if (formTemplate != null && formTemplate.getExcludedDeclMethods() != null) 283 { 284 addExcludedDeclMethods(formTemplate.getExcludedDeclMethods()); 285 } 286 String clsName = new String(""); 287 if (itemClass != null) 288 { 289 clsName = itemClass.getSimpleName(); 290 } 291 292 /*********************************************************************** 293 Main fieldset 294 */ 295 Fieldset mainFS = new Fieldset(); 296 String mainFsName = new String("Properties"); 297 mainFS.setTitle(mainFsName); 298 /* 299 Add forward actionId field as first field, for external use. 300 */ 301 TextField<String> fwdactionF = new ForwardField(); 302 mainFS.add(fwdactionF); 303 /* 304 Get item id, if any. 305 */ 306 int itemId = 0; 307 String getIdMethodName = "getId"; 308 Method getIdMethod = fetchPublicMethodForObject(getIdMethodName, 309 itemClass); 310 if (getIdMethod != null && itemObject != null) 311 { 312 try 313 { 314 Object[] arguments = new Object[] {}; 315 Object retobj = getIdMethod.invoke(itemObject, arguments); 316 String idStr = retobj.toString(); 317 itemId = Integer.parseInt(idStr); 318 } 319 catch (InvocationTargetException e) 320 { 321 itemId = 0; 322 } 323 catch (IllegalAccessException e) 324 { 325 itemId = 0; 326 } 327 catch (java.lang.NumberFormatException e) 328 { 329 itemId = 0; 330 } 331 } 332 /* 333 Add itemId field idF (hidden) if itemId value ok. 334 */ 335 if (itemId > 0) 336 { 337 TextField<Integer> idF = new ItemIdField().setHidden(true); 338 mainFS.add(idF); 339 idF.setLabel("ItemId"); 340 idF.setValue(itemId); 341 idF.setDisabled(true); 342 } 343 /* 344 Add class name field cnF. 345 */ 346 String classNameFull = new String(""); 347 if (itemClass != null) 348 { 349 classNameFull = itemClass.getName(); 350 } 351 TextField<String> cnF = new ClassNameField(); 352 mainFS.add(cnF); 353 cnF.setHidden(true); 354 cnF.setLabel("ClassName"); 355 cnF.setValue(classNameFull); 356 cnF.setDisabled(true); 357 /* 358 Add readOnlyForm field rofF (hidden). 359 */ 360 TextField<Boolean> rofF = newHiddenReadOnlyFormField(); 361 mainFS.add(rofF); 362 rofF.setLabel("ReadOnlyForm"); 363 rofF.setValue(formTemplate.isReadOnlyForm()); 364 rofF.setDisabled(true); 365 /* 366 Keep track on whether public setter methods exist, in order to know 367 if a "Save" button should be added. 368 */ 369 boolean hasSetterMethods = false; 370 /* 371 Methods, declared and inherited 372 */ 373 Method[] methodArr = new Method[0]; 374 if (itemClass != null) 375 { 376 methodArr = itemClass.getMethods(); 377 } 378 379 /* 380 Methods declared in object class (not inherited) 381 */ 382 Method[] declaredMethodArr = new Method[0]; 383 if (itemClass != null) 384 { 385 declaredMethodArr = itemClass.getDeclaredMethods(); 386 } 387 for (int i = 0; i < declaredMethodArr.length; i++) 388 { 389 Method method = declaredMethodArr[i]; 390 String modStr = methodModifierString(method); 391 String methodName = method.getName(); 392 String methodReturnType = method.getReturnType().getName(); 393 /* 394 Only process declared methods not in exclude list. 395 */ 396 if (!getExcludedDeclMethods().contains(methodName)) 397 { 398 String attrName = new String(""); 399 String attrValueStr = new String(""); 400 String returnTypeStr = new String(""); 401 boolean returnTypeOK = false; 402 Class<?> returnTypeOfGetterMethod = null; 403 /* 404 Check if getter access method. 405 */ 406 if (methodName.startsWith("get")) 407 { 408 /* 409 Assume that attribute name can optained by skipping "get" 410 in method name. 411 */ 412 attrName = methodName.substring(3); 413 // int methodMod = declaredMethodArr[i].getModifiers(); 414 if (method.getReturnType().getName().equals("int") || method 415 .getReturnType().getName().equals("java.lang.Integer") || method 416 .getReturnType().getName().equals("float") || method 417 .getReturnType().getName().equals("java.lang.Float") || method 418 .getReturnType().getName().equals("double") || method 419 .getReturnType().getName().equals("java.lang.Double") || method 420 .getReturnType().getName().equals("java.lang.String") || method 421 .getReturnType().getName().equals("java.util.Date")) 422 { 423 returnTypeOfGetterMethod = method.getReturnType(); 424 returnTypeStr = method.getReturnType().getName(); 425 returnTypeOK = true; 426 } 427 } 428 else if (methodName.startsWith("is")) 429 { 430 /* 431 Assume that attribute name can optained by skipping "is" 432 in method name. 433 */ 434 attrName = methodName.substring(2); 435 // int methodMod = declaredMethodArr[i].getModifiers(); 436 if (method.getReturnType().getName().equals("boolean") || method 437 .getReturnType().getName().equals("java.lang.Boolean")) 438 { 439 returnTypeOfGetterMethod = method.getReturnType(); 440 returnTypeStr = method.getReturnType().getName(); 441 returnTypeOK = true; 442 } 443 } 444 if (returnTypeOK) 445 { 446 if (itemObject != null) 447 { 448 try 449 { 450 Object[] arguments = new Object[] {}; 451 Object retobj = method 452 .invoke(itemObject, arguments); 453 if (retobj != null) 454 { 455 /* 456 Return date values in "YYYY-MM-DD HH:mm:ss" 457 24-hour format. 458 */ 459 if (method.getReturnType().getName().equals( 460 "java.util.Date")) 461 { 462 SimpleDateFormat dateFormat = Format.TIMESTAMP 463 .getPattern(); 464 attrValueStr = dateFormat 465 .format((Date) retobj); 466 } 467 else 468 { 469 attrValueStr = retobj.toString(); 470 } 471 } 472 } 473 catch (InvocationTargetException e) 474 { 475 log 476 .warn("FormFactory::getFormImpl(): InvocationTargetException when invoking method \"" + methodName + "\":" + e); 477 } 478 catch (IllegalAccessException e) 479 { 480 log 481 .warn("FormFactory::getFormImpl(): IllegalAccessException when invoking method \"" + methodName + "\":" + e); 482 } 483 log 484 .debug("FormFactory::getFormImpl(): methodName = \"" + methodName + "\" returnTypeOfGetterMethod = \"" + returnTypeOfGetterMethod + "\" attrValueStr = \"" + attrValueStr + "\""); 485 } 486 /* 487 Check if public accessor method for setting value exists. 488 */ 489 boolean isSettable = false; 490 String publMethodName = new String("set" + attrName); 491 if (!formTemplate.isReadOnlyForm()) 492 { 493 if (fetchPublicMethodForObject(publMethodName, 494 itemClass) != null) 495 { 496 isSettable = true; 497 } 498 } 499 log 500 .debug("FormFactory::getFormImpl(): attrName = \"" + attrName + "\" publMethodName = \"" + publMethodName + "\" isSettable = " + isSettable); 501 /* 502 Use TextArea for Description, else TextField 503 */ 504 if (attrName.equals("Description")) 505 { 506 /* 507 Value text area 508 */ 509 TextArea valueF = null; 510 if (!isSettable) 511 { 512 valueF = newValueTextArea("", String.class); 513 } 514 else 515 { 516 hasSetterMethods = true; 517 valueF = newValueTextArea(publMethodName, 518 returnTypeOfGetterMethod); 519 } 520 mainFS.add(valueF); 521 valueF.setLabel(attrName); 522 valueF.setValue(attrValueStr); 523 } 524 else 525 { 526 /* 527 Value field 528 */ 529 TextField<String> valueF = null; 530 if (!isSettable) 531 { 532 valueF = getFormFactory().newValueField("", String.class); 533 } 534 else 535 { 536 hasSetterMethods = true; 537 valueF = getFormFactory().newValueField(publMethodName, 538 returnTypeOfGetterMethod); 539 } 540 mainFS.add(valueF); 541 valueF.setLabel(attrName); 542 valueF.setValue(attrValueStr); 543 } 544 } 545 } 546 } 547 548 /* 549 Check if object supports method getAnnotationSet(). 550 */ 551 Fieldset annotationFS = null; 552 Method[] methodGeneralArr = new Method[0]; 553 if (itemClass != null) 554 { 555 methodGeneralArr = itemClass.getMethods(); 556 } 557 for (int i = 0; i < methodGeneralArr.length; i++) 558 { 559 Method method = methodGeneralArr[i]; 560 // String modStr = methodModifierString(method); 561 String methodName = method.getName(); 562 if (methodName.equals("getAnnotationSet")) 563 { 564 /*************************************************************** 565 Annotation fieldset 566 */ 567 annotationFS = new Fieldset(); 568 annotationFS.setTitle("Annotations"); 569 /* 570 Get DbControl 571 */ 572 DbControl dc = getDbControlForObject(itemObject); 573 /* 574 Fetch annotations 575 */ 576 if (itemObject != null) 577 { 578 try 579 { 580 Object[] arguments = new Object[] {}; 581 Object retobj = method.invoke(itemObject, arguments); 582 AnnotationSet as = (AnnotationSet) retobj; 583 for (Annotation a : as.getAnnotations().list(dc)) 584 { 585 /* 586 Only add annotations that contain something. 587 */ 588 String value = joinAnnotationValues(a); 589 if (value != null && !value.equals("")) 590 { 591 /* 592 Value (description) field - optional scroll 593 bar 594 */ 595 TextArea descrF = new DescriptionField(); 596 descrF.setDisabled(true); 597 descrF 598 .setLabel(a.getAnnotationType().getName()); 599 descrF.setValue(value); 600 annotationFS.add(descrF); 601 } 602 } 603 } 604 catch (InvocationTargetException e) 605 { 606 log 607 .warn("FormFactory::getFormImpl(): InvocationTargetException when invoking method \"" + methodName + "\":" + e); 608 } 609 catch (IllegalAccessException e) 610 { 611 log 612 .warn("FormFactory::getFormImpl(): IllegalAccessException when invoking method \"" + methodName + "\":" + e); 613 } 614 } 615 } 616 } 617 /*********************************************************************** 618 Form 619 */ 620 String formName = new String("newForm"); 621 if (clsName != null && clsName.length() > 0) 622 { 623 formName = clsName.substring(0, 1).toLowerCase() + clsName 624 .substring(1, clsName.length()) + "Form"; 625 } 626 Form form = new Form(formName); 627 form.setTitle(clsName); 628 /*********************************************************************** 629 Add fieldsets to form 630 */ 631 form.addFieldset(mainFS); 632 if (annotationFS != null) 633 { 634 form.addFieldset(annotationFS); 635 } 636 /* 637 Return generated form. 638 */ 639 return form; 640 } 641 642 /** 643 Get DbControl for object. 644 645 @return DbControl for the object 646 */ 647 public DbControl getDbControlForObject(Object itemObject) 648 { 649 /* 650 Get class from itemObject. 651 */ 652 Class<? extends Object> cls = null; 653 if (itemObject != null) 654 { 655 cls = itemObject.getClass(); 656 } 657 if (cls == null) 658 { 659 return null; 660 } 661 String clsName = cls.getSimpleName(); 662 /* 663 Check if object supports method getDbControl(). 664 */ 665 DbControl dc = null; 666 Method[] methodGeneralArr = cls.getMethods(); 667 for (int i = 0; i < methodGeneralArr.length; i++) 668 { 669 Method method = methodGeneralArr[i]; 670 String methodName = method.getName(); 671 if (methodName.equals("getDbControl")) 672 { 673 /* 674 Get DbControl for object 675 */ 676 try 677 { 678 Object[] arguments = new Object[] {}; 679 Object retobj = method.invoke(itemObject, arguments); 680 dc = (DbControl) retobj; 681 } 682 catch (InvocationTargetException e) 683 { 684 log 685 .warn("FormFactory::getDbControlForObject(): InvocationTargetException when invoking method \"" + methodName + "\":" + e); 686 } 687 catch (IllegalAccessException e) 688 { 689 log 690 .warn("FormFactory::getDbControlForObject(): IllegalAccessException when invoking method \"" + methodName + "\":" + e); 691 } 692 } 693 } 694 /* 695 Return DbControl. 696 */ 697 return dc; 698 } 699 700 /** 701 @param a annotation 702 @return String 703 */ 704 private String joinAnnotationValues(Annotation a) 705 { 706 List<?> values = a.getValues(); 707 StringBuilder sb = new StringBuilder(); 708 for (Object o : values) 709 sb.append(o); 710 return sb.toString(); 711 } 712 713 /** 714 Get list of excluded getter methods declared in current class. 715 716 @return List<String> of excluded getter methods. 717 */ 718 public List<String> getExcludedDeclMethods() 719 { 720 return this.excludedDeclMethods; 721 } 722 723 /** 724 Set list of excluded getter methods declared in current class. 725 726 @param excludedDeclMethods List<String> of excluded getter methods to 727 set. 728 */ 729 public void setExcludedDeclMethods(List<String> excludedDeclMethods) 730 { 731 this.excludedDeclMethods = excludedDeclMethods; 732 } 733 734 /** 735 Add list of excluded getter methods declared in current class. 736 737 @param excludedDeclMethods List<String> of excluded getter methods to to 738 add. 739 */ 740 public void addExcludedDeclMethods(List<String> excludedDeclMethods) 741 { 742 for (String exclMethod : excludedDeclMethods) 743 { 744 /* 745 Add excluded method if not already in list. 746 */ 747 if (!getExcludedDeclMethods().contains(exclMethod)) 748 { 749 getExcludedDeclMethods().add(exclMethod); 750 } 751 } 752 } 753 754 /** 755 Initializes list of excluded getter methods declared in current class. 756 */ 757 public void initExcludedDeclMethods() 758 { 759 /* 760 Initialize list of excluded declared methods. 761 */ 762 getExcludedDeclMethods().add("getType"); 763 getExcludedDeclMethods().add("getQuery"); 764 getExcludedDeclMethods().add("getNew"); 765 getExcludedDeclMethods().add("getById"); 766 getExcludedDeclMethods().add("isUsed"); 767 getExcludedDeclMethods().add("isRemoved"); 768 getExcludedDeclMethods().add("getAnnotatableParents"); 769 } 770 771 /** 772 Fetch public method for object, or null if not found. 773 774 @param publMethodName String Name of public method to search for. 775 @return Method public method for object with desired name, or null if not 776 found. 777 */ 778 private Method fetchPublicMethodForObject(String publMethodName, 779 Class<? extends Object> cls) 780 { 781 if (cls == null) 782 { 783 return null; 784 } 785 String clsName = cls.getSimpleName(); 786 /* 787 Check if object supports public method with desired name. 788 */ 789 Method publMethod = null; 790 Method[] methodGeneralArr = cls.getMethods(); 791 for (int i = 0; i < methodGeneralArr.length; i++) 792 { 793 Method method = methodGeneralArr[i]; 794 String methodName = method.getName(); 795 if (methodName.equals(publMethodName)) 796 { 797 /* 798 Check if method is public. 799 */ 800 int methodMod = method.getModifiers(); 801 if (Modifier.isPublic(methodMod)) 802 { 803 publMethod = method; 804 } 805 } 806 } 807 return publMethod; 808 } 809 810 /** 811 Returns a String corresponding to the method modifier: "static", 812 "public", "protected", or "private". 813 814 @param method 815 @return String for method modifier 816 */ 817 private String methodModifierString(Method method) 818 { 819 String modStr = new String(""); 820 int methodMod = method.getModifiers(); 821 if (Modifier.isStatic(methodMod)) 822 { 823 modStr = new String("static"); 824 } 825 else if (Modifier.isPublic(methodMod)) 826 { 827 modStr = new String("public"); 828 } 829 else if (Modifier.isProtected(methodMod)) 830 { 831 modStr = new String("protected"); 832 } 833 else if (Modifier.isPrivate(methodMod)) 834 { 835 modStr = new String("private"); 836 } 837 return modStr; 838 } 839 private TextArea newValueTextArea(String setValueMethodName, 840 Class<?> valueClass) 841 { 842 log 843 .debug("FormFactory::newValueTextArea(): setValueMethodName = \"" + setValueMethodName + "\" valueClass.getSimpleName() = \"" + valueClass 844 .getSimpleName() + "\""); 845 String setValueMethodSignature = null; 846 if (setValueMethodName != null && !setValueMethodName.equals("")) 847 { 848 /* 849 Set valid parameter name to signature of single-argument setter 850 method, if existing, in order to separate between arguments of 851 primitive types like boolean, int, float, and double, from those 852 of wrapper class types like Boolean, Integer, Float, and Double. 853 */ 854 setValueMethodSignature = setValueMethodName + ":" + valueClass 855 .getSimpleName(); 856 if (valueClass == String.class) 857 { 858 VString vSetterMethodParam = new VString( 859 setValueMethodSignature, 0, 65535, false); 860 TextArea valueF = new TextArea(vSetterMethodParam); 861 valueF.setLabel(""); 862 valueF.setDisabled(false); 863 return valueF; 864 } 865 VString vSetterMethodParam = new VString("null", 0, 65535, false); 866 TextArea valueF = new TextArea(vSetterMethodParam); 867 valueF.setLabel(""); 868 valueF.setDisabled(false); 869 return valueF; 870 } 871 VString vSetterMethodParam = new VString("null", 0, 65535, false); 872 TextArea valueF = new TextArea(vSetterMethodParam); 873 valueF.setLabel(""); 874 valueF.setDisabled(true); 875 return valueF; 876 } 877 878 private TextField<Boolean> newHiddenReadOnlyFormField() 879 { 880 TextField<Boolean> field = new TextField<Boolean>(VREADONLYFORM) 881 .setHidden(true); 882 return field; 883 } 237 884 } -
trunk/client/servlet/src/org/proteios/gui/form/FormFactory.java
r3939 r3941 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 /** 71 * List<String> of excluded getter methods declared in current class. If a 72 * getter accessor method is included in this list, when a generic form for 73 * an object is created with getForm(), no field will be added to the form 74 * for an instance variable (if any) corresponding to the getter method. 75 */ 76 private List<String> excludedDeclMethods = new ArrayList<String>(); 70 77 71 private Localizer locale = null; 78 72 private String forwardActionId = null; … … 124 118 public static final VBoolean VISMICROTITREPLATE = new VBoolean("isMicrotitrePlate", false); 125 119 public static final VString VRANDOMSTRING = new VString("randomString", 1,15, true); 126 public static final VBoolean VREADONLYFORM = new VBoolean("readOnlyForm",false);127 120 public static final VBoolean VCONFIRM = new VBoolean("confirm", false); 128 121 public static final VString VCONFIRMMESSAGE = new VString("confirmMessage",0, 255, false); … … 173 166 private static final org.apache.log4j.Logger log = org.apache.log4j.LogManager 174 167 .getLogger("org.proteios.gui.form"); 175 168 176 169 /** 177 170 Default constructor. Initializes list excludedDeclMethods. … … 182 175 Initialize list excludedDeclMethods. 183 176 */ 184 initExcludedDeclMethods();185 }186 177 187 /** 188 Get list of excluded getter methods declared in current class. 189 190 @return List<String> of excluded getter methods. 191 */ 192 public List<String> getExcludedDeclMethods() 193 { 194 return this.excludedDeclMethods; 195 } 196 197 /** 198 Set list of excluded getter methods declared in current class. 199 200 @param excludedDeclMethods List<String> of excluded getter methods to 201 set. 202 */ 203 public void setExcludedDeclMethods(List<String> excludedDeclMethods) 204 { 205 this.excludedDeclMethods = excludedDeclMethods; 206 } 207 208 /** 209 Add list of excluded getter methods declared in current class. 210 211 @param excludedDeclMethods List<String> of excluded getter methods to to 212 add. 213 */ 214 public void addExcludedDeclMethods(List<String> excludedDeclMethods) 215 { 216 for (String exclMethod : excludedDeclMethods) 217 { 218 /* 219 Add excluded method if not already in list. 220 */ 221 if (!getExcludedDeclMethods().contains(exclMethod)) 222 { 223 getExcludedDeclMethods().add(exclMethod); 224 } 225 } 226 } 227 178 } 179 228 180 public void setActionFactory(ActionFactory af) 229 181 { 230 182 this.actionFactory = af; 231 183 } 232 184 233 185 public String getForwardActionId() 234 186 { 235 187 return this.forwardActionId; 236 188 } 237 189 238 190 public void setForwardActionId(String forwardActionId) 239 191 { 240 192 this.forwardActionId = forwardActionId; 241 193 } 242 194 243 195 public String getSortColumnKey() 244 196 { 245 197 return this.sortColumnKey; 246 198 } 247 199 248 200 public void setSortColumnKey(String sortColumnKey) 249 201 { 250 202 this.sortColumnKey = sortColumnKey; 251 203 } 252 204 253 205 public Integer getFilterListSize() 254 206 { 255 207 return this.filterListSize; 256 208 } 257 209 258 210 public void setFilterListSize(Integer filterListSize) 259 211 { 260 212 this.filterListSize = filterListSize; 261 213 } 262 214 263 215 public List<String> getFilterKeyColumnList() 264 216 { 265 217 return this.filterKeyColumnList; 266 218 } 267 219 268 220 public void setFilterKeyColumnList(List<String> filterKeyColumnList) 269 221 { 270 222 this.filterKeyColumnList = filterKeyColumnList; 271 223 } 272 224 273 225 public HashMap<String, String> getFilterClassColumnHashMap() 274 226 { 275 227 return this.filterClassColumnHashMap; 276 228 } 277 229 278 230 public void setFilterClassColumnHashMap( 279 231 HashMap<String, String> filterClassColumnHashMap) … … 281 233 this.filterClassColumnHashMap = filterClassColumnHashMap; 282 234 } 283 235 284 236 public HashMap<String, String> getFilterConditionColumnHashMap() 285 237 { 286 238 return this.filterConditionColumnHashMap; 287 239 } 288 240 289 241 public void setFilterConditionColumnHashMap( 290 242 HashMap<String, String> filterConditionColumnHashMap) … … 292 244 this.filterConditionColumnHashMap = filterConditionColumnHashMap; 293 245 } 294 246 295 247 public HashMap<String, String> getFilterValueColumnHashMap() 296 248 { 297 249 return this.filterValueColumnHashMap; 298 250 } 299 251 300 252 public void setFilterValueColumnHashMap( 301 253 HashMap<String, String> filterValueColumnHashMap) … … 303 255 this.filterValueColumnHashMap = filterValueColumnHashMap; 304 256 } 305 306 /** 307 Initializes list of excluded getter methods declared in current class. 308 */ 309 public void initExcludedDeclMethods() 310 { 311 /* 312 Initialize list of excluded declared methods. 313 */ 314 getExcludedDeclMethods().add("getType"); 315 getExcludedDeclMethods().add("getQuery"); 316 getExcludedDeclMethods().add("getNew"); 317 getExcludedDeclMethods().add("getById"); 318 getExcludedDeclMethods().add("isUsed"); 319 getExcludedDeclMethods().add("isRemoved"); 320 getExcludedDeclMethods().add("getAnnotatableParents"); 321 } 322 257 323 258 public HttpServletRequest getRequest() 324 259 { 325 260 return request; 326 261 } 327 262 328 263 public void setRequest(HttpServletRequest request) 329 264 { 330 265 this.request = request; 331 266 } 332 267 333 268 public void modifyForPopup(Fieldset fs) 334 269 { 335 270 actionFactory.modifyForPopup(fs); 336 271 } 337 272 338 273 private FileField newFileField() 339 274 { … … 342 277 return fileF; 343 278 } 344 279 345 280 public TextField<Integer> newIdField() 346 281 { … … 350 285 return idF; 351 286 } 352 353 p rivateTextField<String> newValueField(String setValueMethodName,287 288 public TextField<String> newValueField(String setValueMethodName, 354 289 Class<?> valueClass) 355 290 { … … 382 317 return valueF; 383 318 } 384 385 private TextArea newValueTextArea(String setValueMethodName, 386 Class<?> valueClass) 387 { 388 log 389 .debug("FormFactory::newValueTextArea(): setValueMethodName = \"" + setValueMethodName + "\" valueClass.getSimpleName() = \"" + valueClass 390 .getSimpleName() + "\""); 391 String setValueMethodSignature = null; 392 if (setValueMethodName != null && !setValueMethodName.equals("")) 393 { 394 /* 395 Set valid parameter name to signature of single-argument setter 396 method, if existing, in order to separate between arguments of 397 primitive types like boolean, int, float, and double, from those 398 of wrapper class types like Boolean, Integer, Float, and Double. 399 */ 400 setValueMethodSignature = setValueMethodName + ":" + valueClass 401 .getSimpleName(); 402 if (valueClass == String.class) 403 { 404 VString vSetterMethodParam = new VString( 405 setValueMethodSignature, 0, 65535, false); 406 TextArea valueF = new TextArea(vSetterMethodParam); 407 valueF.setLabel(""); 408 valueF.setDisabled(false); 409 return valueF; 410 } 411 VString vSetterMethodParam = new VString("null", 0, 65535, false); 412 TextArea valueF = new TextArea(vSetterMethodParam); 413 valueF.setLabel(""); 414 valueF.setDisabled(false); 415 return valueF; 416 } 417 VString vSetterMethodParam = new VString("null", 0, 65535, false); 418 TextArea valueF = new TextArea(vSetterMethodParam); 419 valueF.setLabel(""); 420 valueF.setDisabled(true); 421 return valueF; 422 } 423 319 424 320 public TextField<Integer> newHiddenItemIdField() 425 321 { … … 427 323 return field; 428 324 } 429 430 private TextField<Boolean> newHiddenReadOnlyFormField() 431 { 432 TextField<Boolean> field = new TextField<Boolean>(VREADONLYFORM) 433 .setHidden(true); 434 return field; 435 } 436 325 437 326 private TextField<Integer> newHiddenIntegerField(VInteger vInteger) 438 327 { … … 441 330 return field; 442 331 } 443 332 444 333 private TextField<String> newHiddenStringField(VString vString) 445 334 { … … 448 337 return field; 449 338 } 450 339 451 340 public <D extends BasicItem<?>, E extends ProteiosAction<?>> Form getAnnotationsForm( 452 341 DbControl dc, D item, Class<E> forwardAction) … … 498 387 return form; 499 388 } 500 389 501 390 /** 502 391 @return Hidden … … 508 397 return field; 509 398 } 510 399 511 400 /** 512 401 Form for user preferences configuration settings. Arguments … … 514 403 holders for current values for the notification configuration and table 515 404 preferences configuration form fields. 516 405 517 406 @param nc NotificationConfiguration object (need not be stored in 518 407 database) with default field values. … … 532 421 return form; 533 422 } 534 423 535 424 /** 536 425 Fieldset for notification configuration settings. Argument 537 426 NotificationConfiguration is place holder for current values for the 538 427 notification configuration form fields. 539 428 540 429 @param nc NotificationConfiguration object (need not be stored in 541 430 database) with default field values. … … 589 478 return properties; 590 479 } 591 480 592 481 /** 593 482 Creates a select box for notification mode. 594 483 595 484 @param modeValue int Mode value for default selection. 596 485 @return Select<VInteger> Select box for notification mode selection … … 617 506 return modeS; 618 507 } 619 508 620 509 /** 621 510 Fieldset for table preferences configuration settings. Argument 622 511 TablePreferencesConfiguration is place holder for current values for the 623 512 table preferences configuration form fields. 624 513 625 514 @param tpc TablePreferencesConfiguration object (need not be stored in 626 515 database) with default field values. … … 652 541 return properties; 653 542 } 654 543 655 544 /** 656 545 Creates a select box for table preferences mode. 657 546 658 547 @param modeValue int Mode value for default selection. 659 548 @return Select<VInteger> Select box for table preferences mode selection … … 680 569 return modeS; 681 570 } 682 571 572 /** 573 @param a annotation 574 @return String 575 */ 576 private String joinAnnotationValues(Annotation a) 577 { 578 List<?> values = a.getValues(); 579 StringBuilder sb = new StringBuilder(); 580 for (Object o : values) 581 sb.append(o); 582 return sb.toString(); 583 } 584 683 585 /** 684 586 This will probably be removed when fixint #691 … … 779 681 return form; 780 682 } 781 683 782 684 /** 783 685 @param hit Current Hit … … 995 897 return form; 996 898 } 997 998 /** 999 @param a annotation 1000 @return String 1001 */ 1002 private String joinAnnotationValues(Annotation a) 1003 { 1004 List<?> values = a.getValues(); 1005 StringBuilder sb = new StringBuilder(); 1006 for (Object o : values) 1007 sb.append(o); 1008 return sb.toString(); 1009 } 1010 899 1011 900 /** 1012 901 Returns a form for selecting spectrum mass range limits. 1013 902 1014 903 @param massCutoffLow String The lower cutoff mass value. 1015 904 @param massCutoffHigh String The upper cutoff mass value. … … 1057 946 return form; 1058 947 } 1059 948 1060 949 /** 1061 950 Returns a form with spectrum properties for a spectrum obtained from a 1062 951 spectrum file. 1063 952 1064 953 @param spectrumFile File Core file with spectrum. 1065 954 @param spectrumId String Spectrum id string. … … 1270 1159 return form; 1271 1160 } 1272 1161 1273 1162 /** 1274 1163 Returns a form with spectrum file instrument data for a spectrum file. 1275 1164 1276 1165 @param spectrumFileInstrumentList List<SpectrumFileInstrumentInterface> 1277 1166 Spectrum file instrument list. … … 1458 1347 return form; 1459 1348 } 1460 1349 1461 1350 /** 1462 1351 Adds a table row to a table. A "value" argument that is null will be 1463 1352 represented as an empty string, otherwise by its toString() value. 1464 1353 1465 1354 @param table Table The table to add a row to. 1466 1355 @param nameKey String Property key string. … … 1499 1388 table.addRow(row); 1500 1389 } 1501 1390 1502 1391 /** 1503 1392 Returns a form with spectrum file contact data for a spectrum file. 1504 1393 1505 1394 @param spectrumContact Spectrum file contact 1506 1395 data. … … 1585 1474 return form; 1586 1475 } 1587 1476 1588 1477 /** 1589 1478 Returns a form for adding spectrum file sample data for a spectrum file. 1590 1479 1591 1480 @param project Project The project in whose directory a new output 1592 1481 directory is created. … … 1678 1567 return form; 1679 1568 } 1680 1569 1681 1570 private <D extends Object> TextField<D> newTextField(String name, D value) 1682 1571 { … … 1687 1576 return field; 1688 1577 } 1689 1578 1690 1579 public Form getPeakListSetForm(PeakListSet pls) 1691 1580 { … … 1755 1644 return form; 1756 1645 } 1757 1646 1758 1647 public Form getExportPeakListSetForm(PeakListSet pls) 1759 1648 { … … 1802 1691 return form; 1803 1692 } 1804 1693 1805 1694 private void addAnnotationsAsFields(Fieldset to, Annotatable item, 1806 1695 DbControl dc) … … 1817 1706 } 1818 1707 } 1819 1708 1820 1709 public Fieldset getProteinAssemblyFieldset(Project project) 1821 1710 { … … 1840 1729 return properties; 1841 1730 } 1842 1731 1843 1732 public Select<VString> selectLocalSampleIdWithAllOption(DbControl dc, 1844 1733 Project project) … … 1854 1743 return select; 1855 1744 } 1856 1745 1857 1746 private Select<VInteger> newSelectLabel(LabeledExtract le, DbControl dc) 1858 1747 { … … 1875 1764 return select; 1876 1765 } 1877 1766 1878 1767 /** 1879 1768 Creates and adds a hidden field with an Integer value to the given form. … … 1887 1776 form.getFieldsets().get(0).add(field); 1888 1777 } 1889 1778 1890 1779 /** 1891 1780 Creates and adds a hidden field with an Integer value to the given table. … … 1899 1788 table.add(field); 1900 1789 } 1901 1790 1902 1791 public Fieldset getUsedSampleFieldset(Sample sample) 1903 1792 { … … 1917 1806 return fs; 1918 1807 } 1919 1808 1920 1809 public Fieldset getUsedExtractFieldset(Extract extract) 1921 1810 { … … 1932 1821 return fs; 1933 1822 } 1934 1823 1935 1824 public Fieldset getUsedLabeledExtractFieldset(LabeledExtract extract) 1936 1825 { … … 1950 1839 return fs; 1951 1840 } 1952 1841 1953 1842 public Form getSecondaryLabeledExtractForm(LabeledExtract extract, 1954 1843 DbControl dc, LabeledExtract fromExtract) … … 2013 1902 return form; 2014 1903 } 2015 1904 2016 1905 public Form getSetFilterForm(String filterName, String filterClass, 2017 1906 String filterCondition, String filterValue) … … 2107 1996 return form; 2108 1997 } 2109 1998 2110 1999 private void addFilterSettingsToFieldset(Fieldset fs) 2111 2000 { … … 2171 2060 } 2172 2061 } 2173 2062 2174 2063 public TextField<Float> newOriginalQuantityField() 2175 2064 { … … 2179 2068 return field; 2180 2069 } 2181 2070 2182 2071 public TextField<Float> newRemainingQuantityField(Float remainingQuantity) 2183 2072 { … … 2190 2079 return field; 2191 2080 } 2192 2193 /** 2194 Get generic form for object. 2195 2196 @param template template for generic form 2197 @return Form for editing the object 2198 */ 2199 public Form getForm(FormTemplateInterface formTemplate) 2200 { 2201 /*********************************************************************** 2202 Analyze object class 2203 */ 2204 2205 /* 2206 Get class from formTemplate itemObject or itemClass. 2207 */ 2208 Object itemObject = null; 2209 Class<? extends Object> itemClass = null; 2210 if (formTemplate.getItemObject() != null) 2211 { 2212 itemObject = formTemplate.getItemObject(); 2213 itemClass = itemObject.getClass(); 2214 } 2215 else if (formTemplate.getItemClass() != null) 2216 { 2217 itemClass = formTemplate.getItemClass(); 2218 } 2219 /* 2220 Add optional extra formTemplate list of methods to be excluded. 2221 */ 2222 if (formTemplate != null && formTemplate.getExcludedDeclMethods() != null) 2223 { 2224 addExcludedDeclMethods(formTemplate.getExcludedDeclMethods()); 2225 } 2226 String clsName = new String(""); 2227 if (itemClass != null) 2228 { 2229 clsName = itemClass.getSimpleName(); 2230 } 2231 2232 /*********************************************************************** 2233 Main fieldset 2234 */ 2235 Fieldset mainFS = new Fieldset(); 2236 String mainFsName = new String("Properties"); 2237 mainFS.setTitle(mainFsName); 2238 /* 2239 Add forward actionId field as first field, for external use. 2240 */ 2241 TextField<String> fwdactionF = new ForwardField(); 2242 mainFS.add(fwdactionF); 2243 /* 2244 Get item id, if any. 2245 */ 2246 int itemId = 0; 2247 String getIdMethodName = "getId"; 2248 Method getIdMethod = fetchPublicMethodForObject(getIdMethodName, 2249 itemClass); 2250 if (getIdMethod != null && itemObject != null) 2251 { 2252 try 2253 { 2254 Object[] arguments = new Object[] {}; 2255 Object retobj = getIdMethod.invoke(itemObject, arguments); 2256 String idStr = retobj.toString(); 2257 itemId = Integer.parseInt(idStr); 2258 } 2259 catch (InvocationTargetException e) 2260 { 2261 itemId = 0; 2262 } 2263 catch (IllegalAccessException e) 2264 { 2265 itemId = 0; 2266 } 2267 catch (java.lang.NumberFormatException e) 2268 { 2269 itemId = 0; 2270 } 2271 } 2272 /* 2273 Add itemId field idF (hidden) if itemId value ok. 2274 */ 2275 if (itemId > 0) 2276 { 2277 TextField<Integer> idF = newHiddenItemIdField(); 2278 mainFS.add(idF); 2279 idF.setLabel("ItemId"); 2280 idF.setValue(itemId); 2281 idF.setDisabled(true); 2282 } 2283 /* 2284 Add class name field cnF. 2285 */ 2286 String classNameFull = new String(""); 2287 if (itemClass != null) 2288 { 2289 classNameFull = itemClass.getName(); 2290 } 2291 TextField<String> cnF = new ClassNameField(); 2292 mainFS.add(cnF); 2293 cnF.setHidden(true); 2294 cnF.setLabel("ClassName"); 2295 cnF.setValue(classNameFull); 2296 cnF.setDisabled(true); 2297 /* 2298 Add readOnlyForm field rofF (hidden). 2299 */ 2300 TextField<Boolean> rofF = newHiddenReadOnlyFormField(); 2301 mainFS.add(rofF); 2302 rofF.setLabel("ReadOnlyForm"); 2303 rofF.setValue(formTemplate.isReadOnlyForm()); 2304 rofF.setDisabled(true); 2305 /* 2306 Keep track on whether public setter methods exist, in order to know 2307 if a "Save" button should be added. 2308 */ 2309 boolean hasSetterMethods = false; 2310 /* 2311 Methods, declared and inherited 2312 */ 2313 Method[] methodArr = new Method[0]; 2314 if (itemClass != null) 2315 { 2316 methodArr = itemClass.getMethods(); 2317 } 2318 2319 /* 2320 Methods declared in object class (not inherited) 2321 */ 2322 Method[] declaredMethodArr = new Method[0]; 2323 if (itemClass != null) 2324 { 2325 declaredMethodArr = itemClass.getDeclaredMethods(); 2326 } 2327 for (int i = 0; i < declaredMethodArr.length; i++) 2328 { 2329 Method method = declaredMethodArr[i]; 2330 String modStr = methodModifierString(method); 2331 String methodName = method.getName(); 2332 String methodReturnType = method.getReturnType().getName(); 2333 /* 2334 Only process declared methods not in exclude list. 2335 */ 2336 if (!getExcludedDeclMethods().contains(methodName)) 2337 { 2338 String attrName = new String(""); 2339 String attrValueStr = new String(""); 2340 String returnTypeStr = new String(""); 2341 boolean returnTypeOK = false; 2342 Class<?> returnTypeOfGetterMethod = null; 2343 /* 2344 Check if getter access method. 2345 */ 2346 if (methodName.startsWith("get")) 2347 { 2348 /* 2349 Assume that attribute name can optained by skipping "get" 2350 in method name. 2351 */ 2352 attrName = methodName.substring(3); 2353 // int methodMod = declaredMethodArr[i].getModifiers(); 2354 if (method.getReturnType().getName().equals("int") || method 2355 .getReturnType().getName().equals("java.lang.Integer") || method 2356 .getReturnType().getName().equals("float") || method 2357 .getReturnType().getName().equals("java.lang.Float") || method 2358 .getReturnType().getName().equals("double") || method 2359 .getReturnType().getName().equals("java.lang.Double") || method 2360 .getReturnType().getName().equals("java.lang.String") || method 2361 .getReturnType().getName().equals("java.util.Date")) 2362 { 2363 returnTypeOfGetterMethod = method.getReturnType(); 2364 returnTypeStr = method.getReturnType().getName(); 2365 returnTypeOK = true; 2366 } 2367 } 2368 else if (methodName.startsWith("is")) 2369 { 2370 /* 2371 Assume that attribute name can optained by skipping "is" 2372 in method name. 2373 */ 2374 attrName = methodName.substring(2); 2375 // int methodMod = declaredMethodArr[i].getModifiers(); 2376 if (method.getReturnType().getName().equals("boolean") || method 2377 .getReturnType().getName().equals("java.lang.Boolean")) 2378 { 2379 returnTypeOfGetterMethod = method.getReturnType(); 2380 returnTypeStr = method.getReturnType().getName(); 2381 returnTypeOK = true; 2382 } 2383 } 2384 if (returnTypeOK) 2385 { 2386 if (itemObject != null) 2387 { 2388 try 2389 { 2390 Object[] arguments = new Object[] {}; 2391 Object retobj = method 2392 .invoke(itemObject, arguments); 2393 if (retobj != null) 2394 { 2395 /* 2396 Return date values in "YYYY-MM-DD HH:mm:ss" 2397 24-hour format. 2398 */ 2399 if (method.getReturnType().getName().equals( 2400 "java.util.Date")) 2401 { 2402 SimpleDateFormat dateFormat = Format.TIMESTAMP 2403 .getPattern(); 2404 attrValueStr = dateFormat 2405 .format((Date) retobj); 2406 } 2407 else 2408 { 2409 attrValueStr = retobj.toString(); 2410 } 2411 } 2412 } 2413 catch (InvocationTargetException e) 2414 { 2415 log 2416 .warn("FormFactory::getFormImpl(): InvocationTargetException when invoking method \"" + methodName + "\":" + e); 2417 } 2418 catch (IllegalAccessException e) 2419 { 2420 log 2421 .warn("FormFactory::getFormImpl(): IllegalAccessException when invoking method \"" + methodName + "\":" + e); 2422 } 2423 log 2424 .debug("FormFactory::getFormImpl(): methodName = \"" + methodName + "\" returnTypeOfGetterMethod = \"" + returnTypeOfGetterMethod + "\" attrValueStr = \"" + attrValueStr + "\""); 2425 } 2426 /* 2427 Check if public accessor method for setting value exists. 2428 */ 2429 boolean isSettable = false; 2430 String publMethodName = new String("set" + attrName); 2431 if (!formTemplate.isReadOnlyForm()) 2432 { 2433 if (fetchPublicMethodForObject(publMethodName, 2434 itemClass) != null) 2435 { 2436 isSettable = true; 2437 } 2438 } 2439 log 2440 .debug("FormFactory::getFormImpl(): attrName = \"" + attrName + "\" publMethodName = \"" + publMethodName + "\" isSettable = " + isSettable); 2441 /* 2442 Use TextArea for Description, else TextField 2443 */ 2444 if (attrName.equals("Description")) 2445 { 2446 /* 2447 Value text area 2448 */ 2449 TextArea valueF = null; 2450 if (!isSettable) 2451 { 2452 valueF = newValueTextArea("", String.class); 2453 } 2454 else 2455 { 2456 hasSetterMethods = true; 2457 valueF = newValueTextArea(publMethodName, 2458 returnTypeOfGetterMethod); 2459 } 2460 mainFS.add(valueF); 2461 valueF.setLabel(attrName); 2462 valueF.setValue(attrValueStr); 2463 } 2464 else 2465 { 2466 /* 2467 Value field 2468 */ 2469 TextField<String> valueF = null; 2470 if (!isSettable) 2471 { 2472 valueF = newValueField("", String.class); 2473 } 2474 else 2475 { 2476 hasSetterMethods = true; 2477 valueF = newValueField(publMethodName, 2478 returnTypeOfGetterMethod); 2479 } 2480 mainFS.add(valueF); 2481 valueF.setLabel(attrName); 2482 valueF.setValue(attrValueStr); 2483 } 2484 } 2485 } 2486 } 2487 2488 /* 2489 Check if object supports method getAnnotationSet(). 2490 */ 2491 Fieldset annotationFS = null; 2492 Method[] methodGeneralArr = new Method[0]; 2493 if (itemClass != null) 2494 { 2495 methodGeneralArr = itemClass.getMethods(); 2496 } 2497 for (int i = 0; i < methodGeneralArr.length; i++) 2498 { 2499 Method method = methodGeneralArr[i]; 2500 // String modStr = methodModifierString(method); 2501 String methodName = method.getName(); 2502 if (methodName.equals("getAnnotationSet")) 2503 { 2504 /*************************************************************** 2505 Annotation fieldset 2506 */ 2507 annotationFS = new Fieldset(); 2508 annotationFS.setTitle("Annotations"); 2509 /* 2510 Get DbControl 2511 */ 2512 DbControl dc = getDbControlForObject(itemObject); 2513 /* 2514 Fetch annotations 2515 */ 2516 if (itemObject != null) 2517 { 2518 try 2519 { 2520 Object[] arguments = new Object[] {}; 2521 Object retobj = method.invoke(itemObject, arguments); 2522 AnnotationSet as = (AnnotationSet) retobj; 2523 for (Annotation a : as.getAnnotations().list(dc)) 2524 { 2525 /* 2526 Only add annotations that contain something. 2527 */ 2528 String value = joinAnnotationValues(a); 2529 if (value != null && !value.equals("")) 2530 { 2531 /* 2532 Value (description) field - optional scroll 2533 bar 2534 */ 2535 TextArea descrF = new DescriptionField(); 2536 descrF.setDisabled(true); 2537 descrF 2538 .setLabel(a.getAnnotationType().getName()); 2539 descrF.setValue(value); 2540 annotationFS.add(descrF); 2541 } 2542 } 2543 } 2544 catch (InvocationTargetException e) 2545 { 2546 log 2547 .warn("FormFactory::getFormImpl(): InvocationTargetException when invoking method \"" + methodName + "\":" + e); 2548 } 2549 catch (IllegalAccessException e) 2550 { 2551 log 2552 .warn("FormFactory::getFormImpl(): IllegalAccessException when invoking method \"" + methodName + "\":" + e); 2553 } 2554 } 2555 } 2556 } 2557 /*********************************************************************** 2558 Form 2559 */ 2560 String formName = new String("newForm"); 2561 if (clsName != null && clsName.length() > 0) 2562 { 2563 formName = clsName.substring(0, 1).toLowerCase() + clsName 2564 .substring(1, clsName.length()) + "Form"; 2565 } 2566 Form form = new Form(formName); 2567 form.setTitle(clsName); 2568 /*********************************************************************** 2569 Add fieldsets to form 2570 */ 2571 form.addFieldset(mainFS); 2572 if (annotationFS != null) 2573 { 2574 form.addFieldset(annotationFS); 2575 } 2576 /* 2577 Return generated form. 2578 */ 2579 return form; 2580 } 2581 2582 /** 2583 Get DbControl for object. 2584 2585 @return DbControl for the object 2586 */ 2587 public DbControl getDbControlForObject(Object itemObject) 2588 { 2589 /* 2590 Get class from itemObject. 2591 */ 2592 Class<? extends Object> cls = null; 2593 if (itemObject != null) 2594 { 2595 cls = itemObject.getClass(); 2596 } 2597 if (cls == null) 2598 { 2599 return null; 2600 } 2601 String clsName = cls.getSimpleName(); 2602 /* 2603 Check if object supports method getDbControl(). 2604 */ 2605 DbControl dc = null; 2606 Method[] methodGeneralArr = cls.getMethods(); 2607 for (int i = 0; i < methodGeneralArr.length; i++) 2608 { 2609 Method method = methodGeneralArr[i]; 2610 String methodName = method.getName(); 2611 if (methodName.equals("getDbControl")) 2612 { 2613 /* 2614 Get DbControl for object 2615 */ 2616 try 2617 { 2618 Object[] arguments = new Object[] {}; 2619 Object retobj = method.invoke(itemObject, arguments); 2620 dc = (DbControl) retobj; 2621 } 2622 catch (InvocationTargetException e) 2623 { 2624 log 2625 .warn("FormFactory::getDbControlForObject(): InvocationTargetException when invoking method \"" + methodName + "\":" + e); 2626 } 2627 catch (IllegalAccessException e) 2628 { 2629 log 2630 .warn("FormFactory::getDbControlForObject(): IllegalAccessException when invoking method \"" + methodName + "\":" + e); 2631 } 2632 } 2633 } 2634 /* 2635 Return DbControl. 2636 */ 2637 return dc; 2638 } 2639 2640 /** 2641 Fetch public method for object, or null if not found. 2642 2643 @param publMethodName String Name of public method to search for. 2644 @return Method public method for object with desired name, or null if not 2645 found. 2646 */ 2647 private Method fetchPublicMethodForObject(String publMethodName, 2648 Class<? extends Object> cls) 2649 { 2650 if (cls == null) 2651 { 2652 return null; 2653 } 2654 String clsName = cls.getSimpleName(); 2655 /* 2656 Check if object supports public method with desired name. 2657 */ 2658 Method publMethod = null; 2659 Method[] methodGeneralArr = cls.getMethods(); 2660 for (int i = 0; i < methodGeneralArr.length; i++) 2661 { 2662 Method method = methodGeneralArr[i]; 2663 String methodName = method.getName(); 2664 if (methodName.equals(publMethodName)) 2665 { 2666 /* 2667 Check if method is public. 2668 */ 2669 int methodMod = method.getModifiers(); 2670 if (Modifier.isPublic(methodMod)) 2671 { 2672 publMethod = method; 2673 } 2674 } 2675 } 2676 return publMethod; 2677 } 2678 2679 /** 2680 Returns a String corresponding to the method modifier: "static", 2681 "public", "protected", or "private". 2682 2683 @param method 2684 @return String for method modifier 2685 */ 2686 private String methodModifierString(Method method) 2687 { 2688 String modStr = new String(""); 2689 int methodMod = method.getModifiers(); 2690 if (Modifier.isStatic(methodMod)) 2691 { 2692 modStr = new String("static"); 2693 } 2694 else if (Modifier.isPublic(methodMod)) 2695 { 2696 modStr = new String("public"); 2697 } 2698 else if (Modifier.isProtected(methodMod)) 2699 { 2700 modStr = new String("protected"); 2701 } 2702 else if (Modifier.isPrivate(methodMod)) 2703 { 2704 modStr = new String("private"); 2705 } 2706 return modStr; 2707 } 2708 2081 2709 2082 private Localizer getLocale() 2710 2083 { 2711 2084 return locale; 2712 2085 } 2713 2086 2714 2087 public void setLocale(Localizer locale) 2715 2088 { 2716 2089 this.locale = locale; 2717 2090 } 2718 2091 2719 2092 //Cleaning up from here 2720 2093 2721 2094 /** 2722 2095 Form for new Protocol item. The difference between calling … … 2729 2102 a convenient place holder for default values for the Protocol form 2730 2103 fields. 2731 2104 2732 2105 @param protocol Protocol object (need not be stored in database) with 2733 2106 default field values. … … 2814 2187 return form; 2815 2188 } 2816 2189 2817 2190 public Form getForm(Class<?> cls) 2818 2191 { … … 2904 2277 loginF.setDisabled(true); 2905 2278 fs.add(fs.size()-2, loginF); // After the itemId field 2906 2279 2907 2280 TextField<String> emailF = new EmailField(); 2908 2281 fs.add(fs.size()-1, emailF); 2909 2282 2910 2283 TextField<String> phoneF = new PhoneField(); 2911 2284 fs.add(phoneF); 2912 2285 2913 2286 TextField<String> addressF = new AddressField(); 2914 2287 fs.add(addressF); 2915 2288 2916 2289 TextField<String> organisationF = new OrganisationField(); 2917 2290 fs.add(organisationF); 2918 2291 2919 2292 if (obj != null) 2920 2293 { … … 3247 2620 return form; 3248 2621 } 3249 2622 3250 2623 /** 3251 2624 Creates a select box for protocols. If the class for which the protocol … … 3255 2628 if the protocol is tagged to be removed. However, no other protocols 3256 2629 tagged to be removed should be included in the list. 3257 2630 3258 2631 @param cls Class Class for which a protocol should be selected. 3259 2632 @param obj Object Optional object with attached protocol for setting … … 3362 2735 return protocolS; 3363 2736 } 3364 2737 3365 2738 public void setSc(SessionControl sc) 3366 2739 {
Note: See TracChangeset
for help on using the changeset viewer.