Source for file MenuItemHeading.class.php

Documentation is available at MenuItemHeading.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."GUIManager/Component.class.php");
  4.  
  5. /**
  6. * <code>MenuItemHeading</code> components are a direct implementation of the
  7. * <code>MenuItem</code> interface. Their functionality is limited to having
  8. * display names.
  9. * <br /><br />
  10. * <code>MenuItem</code> is an extension of <code>Component</code>; <code>MenuItems</code>
  11. * have display names and the ability to be added to <code>Menu</code> objects.
  12. *
  13. * @package harmoni.gui.components
  14. *
  15. * @copyright Copyright &copy; 2005, Middlebury College
  16. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  17. *
  18. * @version $Id: MenuItemHeading.class.php,v 1.9 2006/01/20 20:52:40 adamfranco Exp $
  19. */
  20. class MenuItemHeading extends Component /* implements MenuItemInterface */ {
  21.  
  22. /**
  23. * The display name of this menu item.
  24. * @var string _displayName
  25. * @access private
  26. */
  27. var $_displayName;
  28. /**
  29. * The constructor.
  30. * @access public
  31. * @param string displayName The display name of this menu item.
  32. * @param integer index The index of this component. The index has no semantic meaning:
  33. * you can think of the index as 'level' of the component. Alternatively,
  34. * the index could serve as means of distinguishing between components with
  35. * the same type. Most often one would use the index in conjunction with
  36. * the <code>getStylesForComponentType()</code> and
  37. * <code>addStyleForComponentType()</code> methods.
  38. * @param optional object StyleCollections styles,... Zero, one, or more StyleCollection
  39. * objects that will be added to the newly created Component. Warning, this will
  40. * result in copying the objects instead of referencing them as using
  41. * <code>addStyle()</code> would do.
  42. ***/
  43. function MenuItemHeading($displayName, $index) {
  44. // ** parameter validation
  45. ArgumentValidator::validate($displayName, StringValidatorRule::getRule(), true);
  46. // ** end of parameter validation
  47.  
  48. $this->_displayName = $displayName;
  49.  
  50. $this->Component($displayName, MENU_ITEM_HEADING, $index);
  51. // if there are style collections to add
  52. if (func_num_args() > 2)
  53. for ($i = 2; $i < func_num_args(); $i++)
  54. $this->addStyle(func_get_arg($i));
  55. }
  56.  
  57. /**
  58. * Returns the display name of this menu item.
  59. * @access public
  60. * @return string The display name of this menu item.
  61. ***/
  62. function getDisplayName() {
  63. return $this->_displayName;
  64. }
  65. /**
  66. * Sets the display name of this menu item.
  67. * @access public
  68. * @param string displayName The new display name.
  69. ***/
  70. function setDisplayName($displayName) {
  71. // ** parameter validation
  72. ArgumentValidator::validate($displayName, StringValidatorRule::getRule(), true);
  73. // ** end of parameter validation
  74.  
  75. $this->_displayName = $displayName;
  76. }
  77.  
  78. }
  79.  
  80. ?>

Documentation generated on Wed, 19 Sep 2007 10:25:00 -0400 by phpDocumentor 1.3.0RC3