1 30 package com.genimen.djeneric.tools.specifier.exceptions; 31 32 import com.genimen.djeneric.language.Messages; 33 import com.genimen.djeneric.repository.exceptions.DjenericException; 34 import com.genimen.djeneric.repository.exceptions.ObjectNotDefinedException; 35 import com.genimen.djeneric.repository.exceptions.PropertyRequiredException; 36 import com.genimen.djeneric.tools.specifier.interfaces.ObjectViewer; 37 38 public class ObjectViewerApplyException extends DjenericException 39 { 40 private static final long serialVersionUID = 1L; 41 ObjectViewer _viewer; 42 PropertyRequiredException _prx; 43 44 public ObjectViewerApplyException(ObjectViewer viewer, String msg) 45 { 46 super(msg); 47 _viewer = viewer; 48 } 49 50 public ObjectViewerApplyException(ObjectViewer viewer, PropertyRequiredException prx) 51 { 52 _viewer = viewer; 53 _prx = prx; 54 55 } 56 57 public ObjectViewer getViewer() 58 { 59 return _viewer; 60 } 61 62 public String getMessage() 63 { 64 if (_prx == null) return super.getMessage(); 65 String [] props = _prx.getMissingProperties(); 66 67 String msg = Messages.getString("ObjectViewerApplyException.RequiredPropertyMissing", _viewer.getExtentUsage() 68 .getTitle()) 69 + ": "; 70 int counter = 0; 71 for (int i = 0; i < props.length; i++) 72 { 73 if (counter != 0) msg += ", "; 74 try 75 { 76 msg += _viewer.getPropertyUsageByName(props[i]).getPrompt(); 77 counter++; 78 } 79 catch (ObjectNotDefinedException onx) 80 { 81 System.err.println(Messages.getString("ObjectViewerApplyException.NonDisplayedPropertyNull", props[i])); 83 } 84 } 85 return msg; 86 } 87 88 } | Popular Tags |