01: /*
02: * Copyright 2008 Gerd Ziegler (www.gerdziegler.de)
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: * http://www.apache.org/licenses/LICENSE-2.0
07: * Unless required by applicable law or agreed to in writing,
08: * software distributed under the License is distributed on an
09: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
10: * either express or implied. See the License for the specific
11: * language governing permissions and limitations under the License.
12: * 07.03.2008
13: * @author www.gerdziegler.de
14: */
15: package org.ztemplates.yui.menu;
16:
17: import org.ztemplates.render.ZCss;
18: import org.ztemplates.render.ZExpose;
19: import org.ztemplates.render.ZJavaScript;
20: import org.ztemplates.render.ZRenderer;
21: import org.ztemplates.render.ZScript;
22: import org.ztemplates.render.velocity.ZVelocityRenderer;
23: import org.ztemplates.web.ZTemplates;
24: import org.ztemplates.yui.YScript;
25: import org.ztemplates.yui.YWidget;
26:
27: @ZRenderer(ZVelocityRenderer.class)
28: @ZScript(css={@ZCss("/yuiloader/fonts/fonts-min.css"),@ZCss("/yuiloader/menu/assets/skins/sam/menu.css")},javaScript={@ZJavaScript("/yuiloader/yahoo-dom-event/yahoo-dom-event.js"),@ZJavaScript("/yuiloader/container/container_core.js"),@ZJavaScript("/yuiloader/menu/menu.js")})
29: public class YContextMenu extends YWidget {
30: private final String id;
31:
32: private final YMenu menu = new YMenu();
33:
34: public YContextMenu(YScript eventSource) {
35: this (ZTemplates.getRenderService().createJavaScriptId(),
36: eventSource);
37: }
38:
39: public YContextMenu(final String id, YScript eventSource) {
40: super ();
41: this .id = id;
42:
43: setProperty("autosubmenudisplay", true);
44: setProperty("hidedelay", 750);
45: setProperty("lazyload", true);
46: setProperty("trigger", eventSource);
47: }
48:
49: @ZExpose
50: public String getId() {
51: return id;
52: }
53:
54: @ZExpose(render=true)
55: public YMenu getMenu() {
56: return menu;
57: }
58: }
|