1 23 24 package com.sun.enterprise.tools.common.validation.util; 25 26 import java.text.MessageFormat ; 27 import java.util.Collection ; 28 import java.util.Iterator ; 29 30 import com.sun.enterprise.tools.common.validation.Failure; 31 import com.sun.enterprise.tools.common.validation.util.BundleReader; 32 33 40 public class Display { 41 42 43 public Display() { 44 } 45 46 47 51 public void text(Collection collection) { 52 Object object = null; 53 Failure failure = null; 54 55 if(collection != null){ 56 Iterator iterator = collection.iterator(); 57 while(iterator.hasNext()){ 58 object = iterator.next(); 59 boolean failureObect = isFailureObject(object); 60 if(failureObect){ 61 failure = (Failure) object; 62 reportFailure(failure.failureMessage()); 63 } else { 64 reportError(object); 65 } 66 } 67 } 68 } 69 70 71 74 public void gui(Collection collection){ 75 assert false : 76 (BundleReader.getValue("MSG_not_yet_implemented")); } 78 79 80 84 protected void reportFailure(String message){ 85 System.out.println(message); 86 } 87 88 89 93 protected void reportError(Object object){ 94 String format = BundleReader.getValue( 95 "MSG_does_not_support_displaying_of"); Class classObject = object.getClass(); 97 Object [] arguments = new Object []{"Display", classObject.getName()}; 99 100 String message = 101 MessageFormat.format(format, arguments); 102 103 assert false : message; 104 } 105 106 107 114 protected boolean isFailureObject(Object object){ 115 return (object instanceof Failure); 116 } 117 } 118 | Popular Tags |