[Laszlo-checkins] r11444 - openlaszlo/trunk/WEB-INF/lps/lfc/services
bargull@openlaszlo.org
bargull at openlaszlo.org
Tue Oct 14 13:31:27 PDT 2008
Author: bargull
Date: 2008-10-14 13:31:23 -0700 (Tue, 14 Oct 2008)
New Revision: 11444
Modified:
openlaszlo/trunk/WEB-INF/lps/lfc/services/LzContextMenu.lzs
Log:
Change 20081012-bargull-CXx by bargull at dell--p4--2-53 on 2008-10-12 16:52:18
in /home/Admin/src/svn/openlaszlo/trunk
for http://svn.openlaszlo.org/openlaszlo/trunk
Summary: contextmenu refguide issues
New Features:
Bugs Fixed: LPP-7163
Technical Reviewer: hminsky
QA Reviewer: (pending)
Doc Reviewer: lou
Documentation:
Release Notes:
Details:
see bugreport for a detailed list of all issues
Tests:
Modified: openlaszlo/trunk/WEB-INF/lps/lfc/services/LzContextMenu.lzs
===================================================================
--- openlaszlo/trunk/WEB-INF/lps/lfc/services/LzContextMenu.lzs 2008-10-14 19:50:20 UTC (rev 11443)
+++ openlaszlo/trunk/WEB-INF/lps/lfc/services/LzContextMenu.lzs 2008-10-14 20:31:23 UTC (rev 11444)
@@ -10,131 +10,145 @@
*/
/**
- *
+ *
* <p>
- * The <tagname>LzContextMenu</tagname> represents a context (right-click) menu.
+ * The <tagname>contextmenu</tagname> represents a context (right-click) menu.
* </p>
*
+ * <example title="lz.ContextMenu example">
+ * <canvas height="60">
+ * <view width="240" height="40" bgcolor="#aeaeae">
+ * <contextmenu>
+ * <contextmenuitem caption="menu item"/>
+ * </contextmenu>
+ * <text align="center">Right click for context menu</text>
+ * </view>
+ * </canvas>
+ * </example>
+ *
* @shortdesc A contextual menu
*/
public final class LzContextMenu extends LzNode {
-/** @access private
- * @modifiers override
- */
-static var tagname = 'contextmenu';
+ /** @access private
+ * @modifiers override
+ */
+ static var tagname :String = 'contextmenu';
-/** @access private */
-static var attributes = new LzInheritedHash(LzNode.attributes);
+ /** @access private */
+ static var attributes :Object = new LzInheritedHash(LzNode.attributes);
-/**
- * @lzxtype event
- */
-var onmenuopen:LzDeclaredEventClass = LzDeclaredEvent;
+ /** Send when the menu is opened
+ * @lzxtype event
+ */
+ var onmenuopen:LzDeclaredEventClass = LzDeclaredEvent;
-/** @access private */
-var kernel:LzContextMenuKernel = null;
-/** @access private */
-var items:Array = null;
+ /** @access private */
+ var kernel:LzContextMenuKernel = null;
+ /** @access private */
+ var items:Array = null;
-function LzContextMenu (del:* = null, attrs:Object? = null, children:Array? = null, instcall:Boolean = false) {
- // NOTE: [20080825 anba] for bwcomp we also accept a LzDelegate as the first argument
- super(del is LzNode ? del cast LzNode : null, del is LzNode ? attrs : {delegate: del}, children, instcall);
-}
+ /** @access private */
+ function LzContextMenu (del:* = null, attrs:Object? = null, children:Array? = null, instcall:Boolean = false) {
+ // NOTE: [20080825 anba] for bwcomp we also accept a LzDelegate as the first argument
+ super(del is LzNode ? del cast LzNode : null, del is LzNode ? attrs : {delegate: del}, children, instcall);
+ }
-/** @access private */
-override function construct (parent, args) {
- super.construct(parent, args);
-
- this.kernel = new LzContextMenuKernel(this);
+ /** @access private */
+ override function construct (parent, args) {
+ super.construct(parent, args);
- this.items = [];
-
- var del:* = (args && args['delegate']) || null;
- delete args['delegate'];
-
- // set callback
- this.setDelegate(del);
-}
+ this.kernel = new LzContextMenuKernel(this);
-/** @access private */
-override function init () {
- super.init();
-
- var p:LzNode = this.parent;
- if (p && p is LzView) {
- (p cast LzView).setContextMenu(this);
+ this.items = [];
+
+ var del:* = (args && args['delegate']) || null;
+ delete args['delegate'];
+
+ // set callback
+ this.setDelegate(del);
}
-}
-/** @access private */
-function $lzc$set_delegate (delegate:*) :void { this.setDelegate(delegate); }
+ /** @access private */
+ override function init () {
+ super.init();
-/**
- * Sets the delegate which will be called when the menu is opened
- * @param LzDelegate delegate: delegate which is executed when item is selected. An
- * onmenuopen event is also sent.
- *
- * @access public
- */
-function setDelegate (delegate:LzDelegate) :void {
- this.kernel.setDelegate(delegate);
-}
+ var p:LzNode = this.parent;
+ if (p && p is LzView) {
+ (p cast LzView).setContextMenu(this);
+ }
+ }
-/**
- * Adds a menu items into a menu
- * @param LzContextMenuItem item: LzContextMenuItem to install on this menu
- * @access public
- */
-function addItem (item:LzContextMenuItem) :void {
- this.items.push(item);
- this.kernel.addItem(item);
-}
+ /** @access private */
+ function $lzc$set_delegate (delegate:*) :void { this.setDelegate(delegate); }
-/**
- * Removes Flash-installed default menu items
- * @access public
- */
-function hideBuiltInItems () :void {
- this.kernel.hideBuiltInItems();
-}
+ /**
+ * Sets the delegate which will be called when the menu is opened
+ * @param LzDelegate delegate: delegate which is executed when item is selected. An
+ * onmenuopen event is also sent.
+ *
+ * @access public
+ */
+ function setDelegate (delegate:LzDelegate) :void {
+ this.kernel.setDelegate(delegate);
+ }
-/**
- * Shows Flash-installed default menu items
- * @access public
- */
-function showBuiltInItems () :void {
- this.kernel.showBuiltInItems();
-}
+ /**
+ * Adds a menu items into a menu
+ * @param LzContextMenuItem item: menu item to install on this menu
+ * @access public
+ */
+ function addItem (item:LzContextMenuItem) :void {
+ this.items.push(item);
+ this.kernel.addItem(item);
+ }
-/**
- * Remove all custom items from a menu
- * @access public
- */
-function clearItems () :void {
- this.items = [];
- this.kernel.clearItems();
-}
+ /**
+ * Removes Flash-installed default menu items
+ * @access public
+ */
+ function hideBuiltInItems () :void {
+ this.kernel.hideBuiltInItems();
+ }
-/**
- * Return list of custom items
- * @access public
- */
-function getItems () :Array {
- return this.items;
-}
+ /**
+ * Shows Flash-installed default menu items
+ * @access public
+ */
+ function showBuiltInItems () :void {
+ this.kernel.showBuiltInItems();
+ }
-/**
- * create a new menu item for a LzContextMenu
- * @param String title: menu item name
- * @param function callback: delegate to execute when item is selected
- * @access public
- */
-function makeMenuItem (title:String, callback:*) :LzContextMenuItem {
- var item:LzContextMenuItem = new LzContextMenuItem(title, callback);
- return item;
-}
+ /**
+ * Remove all custom items from a menu
+ * @access public
+ */
+ function clearItems () :void {
+ this.items = [];
+ this.kernel.clearItems();
+ }
+ /**
+ * Return list of custom items
+ * @return [LzContextMenuItem]: all custom items
+ * @access public
+ */
+ function getItems () :Array {
+ return this.items;
+ }
+
+ /**
+ * Create a new menu item for a lz.ContextMenu
+ * @param String title: menu item name
+ * @param LzDelegate delegate: delegate to execute when item is selected
+ * @return LzContextMenuItem: the new menu item
+ * @access public
+ */
+ function makeMenuItem (title:String, delegate:*) :LzContextMenuItem {
+ var item:LzContextMenuItem = new LzContextMenuItem(title, delegate);
+ return item;
+ }
+
}; // End of LzContextMenu
lz[LzContextMenu.tagname] = LzContextMenu; // publish
@@ -142,124 +156,136 @@
/**
* <p>
- * The class <tagname>LzContextMenuItem</tagname> represents a menu item within a context menu.
+ * The class <tagname>contextmenuitem</tagname> represents a menu item within a context menu.
* </p>
- *
+ *
+ * <example title="lz.ContextMenuItem example">
+ * <canvas height="60">
+ * <view width="240" height="40" bgcolor="#aeaeae">
+ * <contextmenu>
+ * <contextmenuitem caption="menu item"/>
+ * <contextmenuitem caption="disabled menu item" enabled="false"/>
+ * <contextmenuitem caption="menu item with separator" separatorbefore="true"/>
+ * </contextmenu>
+ * <text align="center">Right click for context menu</text>
+ * </view>
+ * </canvas>
+ * </example>
+ *
* @shortdesc A menu item within a context menu
*/
public final class LzContextMenuItem extends LzNode {
-/** @access private
- * @modifiers override
- */
-static var tagname = 'contextmenuitem';
+ /** @access private
+ * @modifiers override
+ */
+ static var tagname :String = 'contextmenuitem';
-/** @access private */
-static var attributes = new LzInheritedHash(LzNode.attributes);
+ /** @access private */
+ static var attributes :Object = new LzInheritedHash(LzNode.attributes);
-/** @access public */
-var onselect:LzDeclaredEventClass = LzDeclaredEvent;
+ /** Send when the menu item is selected
+ * @access public
+ * @lzxtype event
+ */
+ var onselect:LzDeclaredEventClass = LzDeclaredEvent;
-/** @access private */
-var kernel:LzContextMenuItemKernel = null;
+ /** @access private */
+ var kernel:LzContextMenuItemKernel = null;
-function LzContextMenuItem (title:*, del:Object? = null, children:Array? = null, instcall:Boolean = false) {
- // NOTE: [20080825 anba] for bwcomp we also accept a String
- // and a LzDelegate/Function as the first two arguments
- super(title is LzNode ? title cast LzNode : null, title is LzNode ? del : {title: title, delegate: del}, children, instcall);
-};
+ /** @access private */
+ function LzContextMenuItem (title:*, del:Object? = null, children:Array? = null, instcall:Boolean = false) {
+ // NOTE: [20080825 anba] for bwcomp we also accept a String
+ // and a LzDelegate/Function as the first two arguments
+ super(title is LzNode ? title cast LzNode : null, title is LzNode ? del : {title: title, delegate: del}, children, instcall);
+ };
-/** @access private */
-override function construct (parent, args) {
- super.construct(parent, args);
-
- var title:String = (args && args['title']) || "";
- delete args['title'];
- var del:* = (args && args['delegate']) || null;
- delete args['delegate'];
-
- this.kernel = new LzContextMenuItemKernel(this, title, del);
-
- if (parent && parent is LzContextMenu) {
- parent.addItem(this);
+ /** @access private */
+ override function construct (parent, args) {
+ super.construct(parent, args);
+
+ var title:String = (args && args['title']) || "";
+ delete args['title'];
+ var del:* = (args && args['delegate']) || null;
+ delete args['delegate'];
+
+ this.kernel = new LzContextMenuItemKernel(this, title, del);
+
+ if (parent && parent is LzContextMenu) {
+ parent.addItem(this);
+ }
}
-}
-/** @access private */
-function $lzc$set_delegate (delegate:*) :void { this.setDelegate(delegate); }
+ /** @access private */
+ function $lzc$set_delegate (delegate:*) :void { this.setDelegate(delegate); }
-/** @access private */
-function $lzc$set_caption (caption:String) :void { this.setCaption(caption); }
+ /** @access private */
+ function $lzc$set_caption (caption:String) :void { this.setCaption(caption); }
-/** @access private */
-function $lzc$set_enabled (val:Boolean) :void { this.setEnabled(val); }
+ /** @access private */
+ function $lzc$set_enabled (val:Boolean) :void { this.setEnabled(val); }
-/** @access private */
-function $lzc$set_separatorbefore (val:Boolean) :void { this.setSeparatorBefore(val); }
+ /** @access private */
+ function $lzc$set_separatorbefore (val:Boolean) :void { this.setSeparatorBefore(val); }
-/** @access private */
-function $lzc$set_visible (val:Boolean) :void { this.setVisible(val); }
+ /** @access private */
+ function $lzc$set_visible (val:Boolean) :void { this.setVisible(val); }
-/**
- * LzContextMenuItem.setDelegate
- * Sets the delegate which will be called when the menu item is selected
- * @param LzDelegate delegate: delegate which is executed when item is
- * selected. An onselect event is also sent.
- *
- * @access public
- */
-function setDelegate (delegate:*) :void {
- this.kernel.setDelegate(delegate);
-}
+ /**
+ * Sets the delegate which will be called when the menu item is selected
+ * @param LzDelegate delegate: delegate which is executed when item is
+ * selected. An onselect event is also sent.
+ *
+ * @access public
+ */
+ function setDelegate (delegate:*) :void {
+ this.kernel.setDelegate(delegate);
+ }
-/**
- * LzContextMenuItem.setCaption
- * Sets the text string which is displayed for the menu item
- * @param String caption: text string to display
- * @access public
- */
-function setCaption (caption:String) :void {
- this.kernel.setCaption(caption);
-}
+ /**
+ * Sets the text string which is displayed for the menu item
+ * @param String caption: text string to display
+ * @access public
+ */
+ function setCaption (caption:String) :void {
+ this.kernel.setCaption(caption);
+ }
-/**
- * LzContextMenuItem.getCaption
- * Gets the text string which is displayed for the menu item
- * @access public
- */
-function getCaption () :String {
- return this.kernel.getCaption();
-}
+ /**
+ * Gets the text string which is displayed for the menu item
+ * @return String: the text string
+ * @access public
+ */
+ function getCaption () :String {
+ return this.kernel.getCaption();
+ }
-/**
- * LzContextMenuItem.setEnabled
- * @param boolean val: if false, menu item is grayed out and will not respond to clicks
- * @access public
- */
-function setEnabled (val:Boolean) :void {
- this.kernel.setEnabled(val);
-}
+ /**
+ * Sets the enabled status of the menu item
+ * @param boolean val: if false, menu item is grayed out and will not respond to clicks
+ * @access public
+ */
+ function setEnabled (val:Boolean) :void {
+ this.kernel.setEnabled(val);
+ }
-/**
- * LzContextMenuItem.separatorBefore
- * Draw a horizontal separator line before this item in the menu
- * @param boolean val: sets visibility of separator line
- * @access public
- */
+ /**
+ * Draw a horizontal separator line before this item in the menu
+ * @param boolean val: sets visibility of separator line
+ * @access public
+ */
+ function setSeparatorBefore (val:Boolean) :void {
+ this.kernel.setSeparatorBefore(val);
+ }
-function setSeparatorBefore (val:Boolean) :void {
- this.kernel.setSeparatorBefore(val);
-}
+ /**
+ * Sets the visibility of the menu item
+ * @param boolean val: sets visibility
+ * @access public
+ */
+ function setVisible (val:Boolean) :void {
+ this.kernel.setVisible(val);
+ }
-/**
- * LzContextMenuItem.setVisible
- * Sets the visibility of the menu item
- * @param boolean val: sets visibility
- * @access public
- */
-function setVisible (val:Boolean) :void {
- this.kernel.setVisible(val);
-}
-
}; // End of LzContextMenuItem
lz[LzContextMenuItem.tagname] = LzContextMenuItem; // publish
More information about the Laszlo-checkins
mailing list