1 20 21 package com.methodhead.shim; 22 23 import javax.servlet.http.HttpServletRequest ; 24 import javax.servlet.http.HttpServletResponse ; 25 import javax.servlet.jsp.JspWriter ; 26 import org.apache.struts.action.ActionMapping; 27 import org.apache.struts.action.ActionForward; 28 import org.apache.struts.action.DynaActionForm; 29 import java.io.IOException ; 30 31 public class MockModule 32 implements 33 Module { 34 35 37 39 41 43 46 public String getName() { 47 return "Mock"; 48 } 49 50 54 public boolean isConfigurable() { 55 return configurable_; 56 } 57 58 public static void setConfigurable( boolean configurable ) { 59 configurable_ = configurable; 60 } 61 62 public boolean isEditable() { 63 return editable_; 64 } 65 66 public static void setEditable( boolean editable ) { 67 editable_ = editable; 68 } 69 70 74 public void init( 75 Page page, 76 String panel ) { 77 78 text_ = ""; 79 } 80 81 86 public void create() { 87 } 88 89 92 public ActionForward configure( 93 ActionMapping mapping, 94 DynaActionForm form, 95 HttpServletRequest request, 96 HttpServletResponse response ) { 97 98 return mapping.findForward( "accessDenied" ); 99 } 100 101 public void update( 102 String text ) { 103 104 if ( text_ != null ); 109 text_ = text; 110 } 111 112 public static String getText() { 113 return text_; 114 } 115 116 119 public void display( 120 HttpServletRequest request, 121 HttpServletResponse response, 122 JspWriter out ) 123 throws 124 IOException { 125 126 out.println( "Hello from MockModule.display()." ); 127 } 128 129 public static void setDestroyed( boolean destroyed ) { 130 destroyed_ = destroyed; 131 } 132 133 public static boolean isDestroyed() { 134 return destroyed_; 135 } 136 137 public static void setCopied( boolean copied ) { 138 copied_ = copied; 139 } 140 141 public static boolean isCopied() { 142 return copied_; 143 } 144 145 148 public void destroy() { 149 destroyed_ = true; 150 } 151 152 155 public void copyTo( 156 Page page ) { 157 copied_ = true; 158 } 159 160 162 private static boolean configurable_ = false; 163 164 private static boolean editable_ = false; 165 166 private static String text_ = null; 167 168 private static boolean destroyed_ = false; 169 170 private static boolean copied_ = false; 171 172 } 174 | Popular Tags |