1 19 20 package org.netbeans.modules.j2ee.sun.validation.util; 21 22 import java.text.MessageFormat ; 23 import java.util.Collection ; 24 import java.util.Iterator ; 25 26 import org.netbeans.modules.j2ee.sun.validation.Failure; 27 import org.netbeans.modules.j2ee.sun.validation.util.BundleReader; 28 29 36 public class Display { 37 38 39 public Display() { 40 } 41 42 43 47 public void text(Collection collection) { 48 Object object = null; 49 Failure failure = null; 50 51 if(collection != null){ 52 Iterator iterator = collection.iterator(); 53 while(iterator.hasNext()){ 54 object = iterator.next(); 55 boolean failureObect = isFailureObject(object); 56 if(failureObect){ 57 failure = (Failure) object; 58 reportFailure(failure.failureMessage()); 59 } else { 60 reportError(object); 61 } 62 } 63 } 64 } 65 66 67 70 public void gui(Collection collection){ 71 assert false : 72 (BundleReader.getValue("MSG_not_yet_implemented")); } 74 75 76 80 protected void reportFailure(String message){ 81 System.out.println(message); 82 } 83 84 85 89 protected void reportError(Object object){ 90 String format = BundleReader.getValue( 91 "MSG_does_not_support_displaying_of"); Class classObject = object.getClass(); 93 Object [] arguments = new Object []{"Display", classObject.getName()}; 95 96 String message = 97 MessageFormat.format(format, arguments); 98 99 assert false : message; 100 } 101 102 103 110 protected boolean isFailureObject(Object object){ 111 return (object instanceof Failure); 112 } 113 } 114 | Popular Tags |