1
2
3
4
5
6 package org.weda.tapestry.component;
7
8 import java.util.Stack;
9 import org.apache.tapestry.IRequestCycle;
10 import org.weda.action.ActionContainerProvider;
11 import org.weda.action.ActionListener;
12
13 /**
14 *
15 * @author Mikhail Titov
16 */
17 public final class ActionPanelHelper {
18 private ActionPanelHelper(){};
19
20 public static void addActionContainerProvider(
21 IRequestCycle cycle, ActionContainerProvider provider)
22 {
23 ActionPanel actionPanel = getActionPanel(cycle);
24 if (actionPanel!=null)
25 actionPanel.addActionContainerProvider(provider);
26 }
27
28 public static void addActionListener(
29 IRequestCycle cycle, ActionListener actionListener)
30 {
31 ActionPanel actionPanel = getActionPanel(cycle);
32 if (actionPanel!=null)
33 actionPanel.addActionListener(actionListener);
34 }
35
36 public static ActionPanel getActionPanel(IRequestCycle cycle){
37 Stack<ActionPanel> actionPanels =
38 (Stack<ActionPanel>)cycle.getAttribute(
39 ActionPanel.ACTION_PANEL_ATTRIBUTE_NAME);
40 if (actionPanels!=null)
41 return actionPanels.peek();
42 else
43 return null;
44 }
45 }