| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||||||
| InvokeMethod |
|
| 1.4285714285714286;1.429 |
| 1 | /* |
|
| 2 | * Copyright 2004 Chris Nelson |
|
| 3 | * |
|
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
|
| 5 | * you may not use this file except in compliance with the License. |
|
| 6 | * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
|
| 7 | * Unless required by applicable law or agreed to in writing, |
|
| 8 | * software distributed under the License is distributed on an "AS IS" BASIS, |
|
| 9 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
| 10 | * See the License for the specific language governing permissions and limitations under the License. |
|
| 11 | */ |
|
| 12 | package org.trails.component; |
|
| 13 | ||
| 14 | import java.beans.MethodDescriptor; |
|
| 15 | ||
| 16 | import org.apache.tapestry.IActionListener; |
|
| 17 | import org.apache.tapestry.IRequestCycle; |
|
| 18 | import org.trails.TrailsRuntimeException; |
|
| 19 | ||
| 20 | ||
| 21 | /** |
|
| 22 | * @author fus8882 |
|
| 23 | * <p/> |
|
| 24 | * TODO To change the template for this generated type comment go to |
|
| 25 | * Window - Preferences - Java - Code Style - Code Templates |
|
| 26 | */ |
|
| 27 | 1 | public abstract class InvokeMethod extends TrailsComponent |
| 28 | { |
|
| 29 | public abstract MethodDescriptor getMethodDescriptor(); |
|
| 30 | ||
| 31 | public abstract void setMethodDescriptor(MethodDescriptor MethodDescriptor); |
|
| 32 | ||
| 33 | public abstract IActionListener getListener(); |
|
| 34 | ||
| 35 | public abstract void setListener(IActionListener Listener); |
|
| 36 | ||
| 37 | public abstract Object getModel(); |
|
| 38 | ||
| 39 | public abstract void setModel(Object Model); |
|
| 40 | ||
| 41 | public void click(IRequestCycle cycle) |
|
| 42 | { |
|
| 43 | try |
|
| 44 | { |
|
| 45 | 2 | getMethodDescriptor().getMethod().invoke(getModel(), |
| 46 | 1 | new Object[]{}); |
| 47 | 0 | } catch (Exception e) |
| 48 | { |
|
| 49 | 0 | throw new TrailsRuntimeException(e, getModel().getClass()); |
| 50 | } |
|
| 51 | ||
| 52 | 1 | if (getListener() != null) |
| 53 | { |
|
| 54 | 1 | getListener().actionTriggered(this, cycle); |
| 55 | } |
|
| 56 | 1 | } |
| 57 | } |