// Switch to Mata interpreter/compiler mata: // Drops class object if it already exists // mata drop button() // Definition of HTML Tag button Mata Class // Defines a clickable button// Information retrieved from http://www.w3schools.com/tags/tag_button.asp class button extends htmlglobal { // Define private member variables private: // Static/final variables static string scalar opens, opene, close // String scalar attributes string scalar htmlautofocus, htmldisabled, htmlform, htmlformaction, htmlformenctype, htmlformmethod, htmlformnovalidate, htmlformtarget, htmlname, htmltype, htmlvalue // 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 button scalar setClassArgs(), setAutofocus(), setDisabled(), setForm(), setFormaction(), setFormenctype(), setFormmethod(), setFormnovalidate(), setFormtarget(), setName(), setType(), setValue() // Getter methods string scalar getOpens(), getOpene(), getClose(), print(), getClassArgs(), getAutofocus(), getDisabled(), getForm(), getFormaction(), getFormenctype(), getFormmethod(), getFormnovalidate(), getFormtarget(), getName(), getType(), getValue() } // End of class declaration // Class constructor method declaration void button::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 button // Getter method for opening bracket closing character string scalar button::getOpene() { // Returns the closing character for the opening bracket return(this.opene) } // End of getter method for opene member of class button // Getter method for closing bracket string scalar button::getClose() { // Returns the closing bracket/tag return(this.close) } // End of getter method for close member of class button // Getter method for class arguments string scalar button::getClassArgs() { // Returns the class arguments that appear between the HTML tags return(this.classargs) } // End of getter method for class arguments member of class button // Getter method for autofocus member variable string scalar button::getAutofocus() { // Returns the autofocus variable return(this.htmlautofocus) } // End of getter method for autofocus member of class button // Getter method for disabled member variable string scalar button::getDisabled() { // Returns the disabled variable return(this.htmldisabled) } // End of getter method for disabled member of class button // Getter method for form member variable string scalar button::getForm() { // Returns the form variable return(this.htmlform) } // End of getter method for form member of class button // Getter method for formaction member variable string scalar button::getFormaction() { // Returns the formaction variable return(this.htmlformaction) } // End of getter method for formaction member of class button // Getter method for formenctype member variable string scalar button::getFormenctype() { // Returns the formenctype variable return(this.htmlformenctype) } // End of getter method for formenctype member of class button // Getter method for formmethod member variable string scalar button::getFormmethod() { // Returns the formmethod variable return(this.htmlformmethod) } // End of getter method for formmethod member of class button // Getter method for formnovalidate member variable string scalar button::getFormnovalidate() { // Returns the formnovalidate variable return(this.htmlformnovalidate) } // End of getter method for formnovalidate member of class button // Getter method for formtarget member variable string scalar button::getFormtarget() { // Returns the formtarget variable return(this.htmlformtarget) } // End of getter method for formtarget member of class button // Getter method for name member variable string scalar button::getName() { // Returns the name variable return(this.htmlname) } // End of getter method for name member of class button // Getter method for type member variable string scalar button::getType() { // Returns the type variable return(this.htmltype) } // End of getter method for type member of class button // Getter method for value member variable string scalar button::getValue() { // Returns the value variable return(this.htmlvalue) } // End of getter method for value member of class button // Get the HTML tag w/attributes and arguments string scalar button::print() { // Create local variables to piece together return string string scalar open, args, close // Create opening string open = getOpens() + getAutofocus() + getDisabled() + getForm() + getFormaction() + getFormenctype() + getFormmethod() + getFormnovalidate() + getFormtarget() + getName() + getType() + getValue() + 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 button // End of Mata session end