// Switch to Mata interpreter/compiler mata: // Drops class object if it already exists // mata drop stselect() // Definition of HTML Tag stselect Mata Class // Defines a drop-down list// Information retrieved from http://www.w3schools.com/tags/tag_select.asp class stselect extends htmlglobal { // Define private member variables private: // Static/final variables static string scalar opens, opene, close // String scalar attributes string scalar htmlautofocus, htmldisabled, htmlform, htmlmultiple, htmlname, htmlrequired, htmlsize // 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 stselect scalar setClassArgs(), setAutofocus(), setDisabled(), setForm(), setMultiple(), setName(), setRequired(), setSize() // Getter methods string scalar getOpens(), getOpene(), getClose(), print(), getClassArgs(), getAutofocus(), getDisabled(), getForm(), getMultiple(), getName(), getRequired(), getSize() } // End of class declaration // Class constructor method declaration void stselect::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 stselect // Getter method for opening bracket closing character string scalar stselect::getOpene() { // Returns the closing character for the opening bracket return(this.opene) } // End of getter method for opene member of class stselect // Getter method for closing bracket string scalar stselect::getClose() { // Returns the closing bracket/tag return(this.close) } // End of getter method for close member of class stselect // Getter method for class arguments string scalar stselect::getClassArgs() { // Returns the class arguments that appear between the HTML tags return(this.classargs) } // End of getter method for class arguments member of class stselect // Getter method for autofocus member variable string scalar stselect::getAutofocus() { // Returns the autofocus variable return(this.htmlautofocus) } // End of getter method for autofocus member of class stselect // Getter method for disabled member variable string scalar stselect::getDisabled() { // Returns the disabled variable return(this.htmldisabled) } // End of getter method for disabled member of class stselect // Getter method for form member variable string scalar stselect::getForm() { // Returns the form variable return(this.htmlform) } // End of getter method for form member of class stselect // Getter method for multiple member variable string scalar stselect::getMultiple() { // Returns the multiple variable return(this.htmlmultiple) } // End of getter method for multiple member of class stselect // Getter method for name member variable string scalar stselect::getName() { // Returns the name variable return(this.htmlname) } // End of getter method for name member of class stselect // Getter method for required member variable string scalar stselect::getRequired() { // Returns the required variable return(this.htmlrequired) } // End of getter method for required member of class stselect // Getter method for size member variable string scalar stselect::getSize() { // Returns the size variable return(this.htmlsize) } // End of getter method for size member of class stselect // Get the HTML tag w/attributes and arguments string scalar stselect::print() { // Create local variables to piece together return string string scalar open, args, close // Create opening string open = getOpens() + getAutofocus() + getDisabled() + getForm() + getMultiple() + getName() + getRequired() + getSize() + 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 stselect // End of Mata session end