// Switch to Mata interpreter/compiler mata: // Drops class object if it already exists // mata drop textarea() // Definition of HTML Tag textarea Mata Class // Defines a multiline input control (text area)// Information retrieved from http://www.w3schools.com/tags/tag_textarea.asp class textarea extends htmlglobal { // Define private member variables private: // Static/final variables static string scalar opens, opene, close // String scalar attributes string scalar htmlautofocus, htmlcols, htmldisabled, htmlform, htmlmaxlength, htmlname, htmlplaceholder, htmlreadonly, htmlrequired, htmlrows, htmlwrap // 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 textarea scalar setClassArgs(), setAutofocus(), setCols(), setDisabled(), setForm(), setMaxlength(), setName(), setPlaceholder(), setReadonly(), setRequired(), setRows(), setWrap() // Getter methods string scalar getOpens(), getOpene(), getClose(), print(), getClassArgs(), getAutofocus(), getCols(), getDisabled(), getForm(), getMaxlength(), getName(), getPlaceholder(), getReadonly(), getRequired(), getRows(), getWrap() } // End of class declaration // Class constructor method declaration void textarea::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 textarea // Getter method for opening bracket closing character string scalar textarea::getOpene() { // Returns the closing character for the opening bracket return(this.opene) } // End of getter method for opene member of class textarea // Getter method for closing bracket string scalar textarea::getClose() { // Returns the closing bracket/tag return(this.close) } // End of getter method for close member of class textarea // Getter method for class arguments string scalar textarea::getClassArgs() { // Returns the class arguments that appear between the HTML tags return(this.classargs) } // End of getter method for class arguments member of class textarea // Getter method for autofocus member variable string scalar textarea::getAutofocus() { // Returns the autofocus variable return(this.htmlautofocus) } // End of getter method for autofocus member of class textarea // Getter method for cols member variable string scalar textarea::getCols() { // Returns the cols variable return(this.htmlcols) } // End of getter method for cols member of class textarea // Getter method for disabled member variable string scalar textarea::getDisabled() { // Returns the disabled variable return(this.htmldisabled) } // End of getter method for disabled member of class textarea // Getter method for form member variable string scalar textarea::getForm() { // Returns the form variable return(this.htmlform) } // End of getter method for form member of class textarea // Getter method for maxlength member variable string scalar textarea::getMaxlength() { // Returns the maxlength variable return(this.htmlmaxlength) } // End of getter method for maxlength member of class textarea // Getter method for name member variable string scalar textarea::getName() { // Returns the name variable return(this.htmlname) } // End of getter method for name member of class textarea // Getter method for placeholder member variable string scalar textarea::getPlaceholder() { // Returns the placeholder variable return(this.htmlplaceholder) } // End of getter method for placeholder member of class textarea // Getter method for readonly member variable string scalar textarea::getReadonly() { // Returns the readonly variable return(this.htmlreadonly) } // End of getter method for readonly member of class textarea // Getter method for required member variable string scalar textarea::getRequired() { // Returns the required variable return(this.htmlrequired) } // End of getter method for required member of class textarea // Getter method for rows member variable string scalar textarea::getRows() { // Returns the rows variable return(this.htmlrows) } // End of getter method for rows member of class textarea // Getter method for wrap member variable string scalar textarea::getWrap() { // Returns the wrap variable return(this.htmlwrap) } // End of getter method for wrap member of class textarea // Get the HTML tag w/attributes and arguments string scalar textarea::print() { // Create local variables to piece together return string string scalar open, args, close // Create opening string open = getOpens() + getAutofocus() + getCols() + getDisabled() + getForm() + getMaxlength() + getName() + getPlaceholder() + getReadonly() + getRequired() + getRows() + getWrap() + 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 textarea // End of Mata session end