// Switch to Mata interpreter/compiler mata: // Drops class object if it already exists // mata drop menuitem() // Definition of HTML Tag menuitem Mata Class // Defines a command/menu item that the user can invoke from a popup menu// Information retrieved from http://www.w3schools.com/tags/tag_menuitem.asp class menuitem extends htmlglobal { // Define private member variables private: // Static/final variables static string scalar opens, opene, close // String scalar attributes string scalar htmlchecked, htmlcommand, htmldefault, htmldisabled, htmlicon, htmllabel, htmlradiogroup, htmltype // Make class args non-static to prevent assignment of class args to all instances of class string scalar classargs // Define public members/methods public: // Class constructor method void new() // Setter methods class menuitem scalar setClassArgs(), setChecked(), setCommand(), setDefault(), setDisabled(), setIcon(), setLabel(), setRadiogroup(), setType() // Getter methods string scalar getOpens(), getOpene(), getClose(), print(), getClassArgs(), getChecked(), getCommand(), getDefault(), getDisabled(), getIcon(), getLabel(), getRadiogroup(), getType() } // End of class declaration // Class constructor method declaration void menuitem::new() { // Defines the start of the opening tag for the class this.opens = " character to allow attributes return(this.opens) } // End of getter method for opens member of class menuitem // Getter method for opening bracket closing character string scalar menuitem::getOpene() { // Returns the closing character for the opening bracket return(this.opene) } // End of getter method for opene member of class menuitem // Getter method for closing bracket string scalar menuitem::getClose() { // Returns the closing bracket/tag return(this.close) } // End of getter method for close member of class menuitem // Getter method for class arguments string scalar menuitem::getClassArgs() { // Returns the class arguments that appear between the HTML tags return(this.classargs) } // End of getter method for class arguments member of class menuitem // Getter method for checked member variable string scalar menuitem::getChecked() { // Returns the checked variable return(this.htmlchecked) } // End of getter method for checked member of class menuitem // Getter method for command member variable string scalar menuitem::getCommand() { // Returns the command variable return(this.htmlcommand) } // End of getter method for command member of class menuitem // Getter method for default member variable string scalar menuitem::getDefault() { // Returns the default variable return(this.htmldefault) } // End of getter method for default member of class menuitem // Getter method for disabled member variable string scalar menuitem::getDisabled() { // Returns the disabled variable return(this.htmldisabled) } // End of getter method for disabled member of class menuitem // Getter method for icon member variable string scalar menuitem::getIcon() { // Returns the icon variable return(this.htmlicon) } // End of getter method for icon member of class menuitem // Getter method for label member variable string scalar menuitem::getLabel() { // Returns the label variable return(this.htmllabel) } // End of getter method for label member of class menuitem // Getter method for radiogroup member variable string scalar menuitem::getRadiogroup() { // Returns the radiogroup variable return(this.htmlradiogroup) } // End of getter method for radiogroup member of class menuitem // Getter method for type member variable string scalar menuitem::getType() { // Returns the type variable return(this.htmltype) } // End of getter method for type member of class menuitem // Get the HTML tag w/attributes and arguments string scalar menuitem::print() { // Create local variables to piece together return string string scalar open, args, close // Create opening string open = getOpens() + getChecked() + getCommand() + getDefault() + getDisabled() + getIcon() + getLabel() + getRadiogroup() + getType() + globalAttrs() + getOpene() // Get class arguments args = getClassArgs() // Get closing tag close = getClose() // Return the complete HTML string return(char((10)) + subinstr(open, " >", ">") + args + close + char((10))) } // End of print method for class menuitem // End of Mata session end