001 // Copyright 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.listener; 016 017 import org.apache.tapestry.IPage; 018 import org.apache.tapestry.IRequestCycle; 019 import org.apache.tapestry.engine.ILink; 020 import org.apache.tapestry.event.BrowserEvent; 021 import org.apache.tapestry.html.BasePage; 022 023 import java.util.Map; 024 025 /** 026 * Used by {@link org.apache.tapestry.listener.TestListenerMapSource}. 027 * 028 * @author Howard M. Lewis Ship 029 * @since 4.0 030 */ 031 public class ListenerMethodHolder 032 { 033 private RuntimeException _exception; 034 035 private String _pageName; 036 037 private IPage _page; 038 039 private ILink _link; 040 041 int _stringArgCount; 042 043 public ListenerMethodHolder() 044 { 045 } 046 047 public ListenerMethodHolder(String pageName) 048 { 049 _pageName = pageName; 050 } 051 052 public ListenerMethodHolder(ILink link) 053 { 054 _link = link; 055 } 056 057 public ListenerMethodHolder(IPage page) 058 { 059 _page = page; 060 } 061 062 public void stringArg(String value) 063 { 064 _stringArgCount++; 065 } 066 067 public void wrongTypes(Map map) 068 { 069 } 070 071 public void fred(String string, int count) 072 { 073 074 } 075 076 public void wilma(IRequestCycle cycle, int argument) 077 { 078 } 079 080 public void barneyClicked(BrowserEvent event) 081 { 082 083 } 084 085 public void bangbangClicked(IRequestCycle cycle, BrowserEvent event, int argument) 086 { 087 088 } 089 090 public void noMatch(String argument1, double argument2, long argument3) 091 { 092 093 } 094 095 public String returnsString() 096 { 097 return null; 098 } 099 100 public BasePage returnsBasePage() 101 { 102 return null; 103 } 104 105 public IPage returnsPage() 106 { 107 return _page; 108 } 109 110 public ILink returnsLink() 111 { 112 return _link; 113 } 114 115 public String returnsPageName() 116 { 117 return _pageName; 118 } 119 120 public Object returnsObject() 121 { 122 return null; 123 } 124 125 public int returnsInt() 126 { 127 return 0; 128 } 129 130 /** 131 * Tapestry 3.0 and earlier style. 132 */ 133 134 public void pebbles(IRequestCycle cycle) 135 { 136 } 137 138 public void barney(String string) 139 { 140 141 } 142 143 public void barney() 144 { 145 146 } 147 148 public String toString() 149 { 150 return "ListenerMethodHolder"; 151 } 152 153 public void throwsException() 154 { 155 throw _exception; 156 } 157 158 public void setException(RuntimeException ex) 159 { 160 _exception = ex; 161 } 162 }