////////  Text control
768777
function Text(options) {

	this.__proto__ = new Control();

	this.init = function(options) {
		this.type = options.type = 'Text';
		this.parent = options.parent;
		this.defaults = {
			x:48, y:48,
			text: '',
			fill:this.parent.fill,
			fill_highlight: this.parent.lighter(this.parent.stroke),
			stroke: this.parent.stroke,
			'stroke-width': this.parent.control_stroke,
			fontsize: this.parent.fontsize,
			script: undefined,
			onload: undefined
		};
		this.setoptions(options);
		this.render();
		return this;
	};

	this.render = function() {
		this.label = this.parent.paper.text(this.x, this.y, this.text)
			.attr({fill:this.stroke, stroke:this.stroke, 'font-size': this.fontsize,
				'text-anchor': 'start'});	// http://stackoverflow.com/questions/2124763/raphael-js-and-text-positioning
		this.textelts.push(this.label);
		this.sethandlers();
	};

	this.move = function(newx, newy) {
		this.label.attr({x:this.x, y:this.y});
	};

	this.setValue = function(value) {
		this.value = value;
		this.label.attr({text: this.value});
		var update = {id: this.id, value: this.value};
		this.fire('update', update);
	};

	return this.init(options || {});
}
1235275
private String cleanUpString(String text) {
    if (StringUtils.isEmpty(text)) {
      return text;
    }
    else {
      return CONTROL_CHARS.matcher(text).replaceAll("");
    }
  }
83168
public void typeText(EditText editText, String text) {
		if(config.commandLogging){
			Log.d(config.commandLoggingTag, "typeText("+editText+", \""+text+"\")");
		}
		
		editText = (EditText) waiter.waitForView(editText, Timeout.getSmallTimeout());
		textEnterer.typeText(editText, text);
	}
661641
public void setText(final String TEXT) {
        if (null == text) {
            _text = TEXT;
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            text.set(TEXT);
        }
    }
944058
function(text) {
                // 
                if (isCss) {
                    if (resource.styleSheet) {
                        resource.styleSheet.cssText = text;
                    } else {
                        resource.appendChild(document.createTextNode(text));
                    }
                } else {
                    if (resource.innerText) {
                        resource.innerText = text;
                    } else {
                        resource.appendChild(document.createTextNode(text));
                    }
                }
                if (callback) {
                    callback(resourcePath, hashId);
                }
            }
871969
public void setText (String text) {
		if (content instanceof VisLabel) {
			((VisLabel) content).setText(text);
		} else {
			setContent(new VisLabel(text));
		}
		pack();
	}
869091
public static void setText(JTextComponent textComp, String text){
        if(text==null)
            text = "";
        
        if(textComp.getCaret() instanceof DefaultCaret){
            DefaultCaret caret = (DefaultCaret)textComp.getCaret();
            int updatePolicy = caret.getUpdatePolicy();
            caret.setUpdatePolicy(DefaultCaret.NEVER_UPDATE);
            try{
                textComp.setText(text);
            }finally{
                caret.setUpdatePolicy(updatePolicy);
            }
        }else{
            int mark = textComp.getCaret().getMark();
            int dot = textComp.getCaretPosition();
            try{
                textComp.setText(text);
            }finally{
                int len = textComp.getDocument().getLength();
                if(mark>len)
                    mark = len;
                if(dot>len)
                    dot = len;
                textComp.setCaretPosition(mark);
                if(dot!=mark)
                    textComp.moveCaretPosition(dot);
            }
        }
    }
1244510
protected void compareText(Text control, Text test,
                               DifferenceListener listener)
        throws DifferenceFoundException {
        compareText((CharacterData) control, (CharacterData) test, listener);
    }
778523
@Override
    public void setText(String text) {
        if (headingToggle != null) {
            if (text == null) text = "";
            String s = headingToggle.getInnerHTML();
            int p = s.indexOf('<');
            if (p >= 0) s = text + s.substring(p);
            else s = text;
            headingToggle.setInnerHTML(s);
        } else if (!isInstance(getElement())) {
            if (headerPanel != null) {
                super.remove(headerPanel);
                headerPanel = null;
            }
            header.setText(text);
        }
    }
383307
function(text) {
        var openItalic = false,
            cText = [],
            italicStart = new RegExp(/\{italic\}/),
            commandBreak = new RegExp(/\{break\}/),
            italicEnd = new RegExp(/\{end-italic\}/),
            finalText = "",
            textArray = text.split(''),
            idx = 0;

        for (idx = 0; idx <= textArray.length; idx++) {
            cText.push(textArray[idx]);
            if (italicStart.test(cText.join('')) && openItalic === false) {
                // found an italic start, push to array, reset.
                finalText += cText.join('');
                cText = [];
                openItalic = true;
            } else if (commandBreak.test(cText.join('')) && openItalic === false) {
                finalText += cText.join('');
                cText = [];
                openItalic = false;
            } else if (commandBreak.test(cText.join('')) && openItalic === true) {
                finalText += cText.join('').replace(commandBreak, '{end-italic}{break}');
                cText = [];
                openItalic = false;
            } else if (italicStart.test(cText.join('')) && openItalic === true) {
                // found an italic start within another italic...prepend an end
                finalText += cText.join('').replace(italicStart, '');
                cText = [];
                openItalic = true;
            } else if (italicEnd.test(cText.join('')) && openItalic === true) {
                finalText += cText.join('');
                cText = [];
                openItalic = false;
            } else if (italicEnd.test(cText.join('')) && openItalic === false) {
                //drop useless end italics that are out of place.
                finalText += cText.join('').replace(italicEnd, '');
                cText = [];
                openItalic = false;
            }
            if (idx === text.length) {
                if (openItalic) {
                    finalText += cText.join('') + '{end-italic}';
                } else {
                    finalText += cText.join('');
                }

                cText = [];
            }
        }

        return finalText;

    }
376103
public void setText(final String TEXT) {
        if (null == text) {
            _text = TEXT;
        } else {
            text.set(TEXT);
        }
    }
911937
private void setPlaceholderTextInternal(String text,
                                            @ColorInt int color,
                                            int textSize,
                                            boolean invalidate) {
        // Takes only the first character as the place holder
        mText = formatPlaceholderText(text);
        mTextColor = color;
        mTextSize = textSize;

        if ((null == mTextPaint) &&
            (textSize > 0) &&
            !TextUtils.isEmpty(mText)) {
            mTextPaint = getTextPaint();
        }

        if (null != mTextPaint) {
            mTextPaint.setColor(color);
            mTextPaint.setTextSize(textSize);
        }

        // Invalidate the view if asked
        if (invalidate) {
            invalidate();
        }
    }
651469
function (text) {

                var dataModel = this._dataModel;

                if (text !== '' && text !== dataModel.text) {
                    dataModel.text = text;

                    this._pendingRequestNb += 1;
                    this._resourcesHandler.getSuggestions(text, {
                        fn : this._suggestionsCallback,
                        scope : this,
                        args : {
                            nextValue : text,
                            triggerDropDown : false
                        }
                    });

                    // return null as there is asynchrone handling
                    return null;
                }

                // returned object
                var report = new ariaWidgetsControllersReportsDropDownControllerReport();

                // an empty field is usually not considered as an error
                if (text === '') {
                    dataModel.value = null;
                    dataModel.text = '';
                    report.ok = true;
                    report.value = null;
                } else {
                    if (this.freeText) {
                        report.ok = true;
                        if (this._pendingRequestNb > 0 && !dataModel.value) {
                            report.value = dataModel.text;
                        }
                    } else {
                        if (!dataModel.value) {

                            if (this.expandButton && dataModel.listContent && this._checkValueList()) {
                                report.ok = true;
                            } else {
                                report.ok = false;
                                report.value = null;
                                report.errorMessages.push(this.getErrorMessage("validation"));
                            }
                        }

                    }
                    // if there is no value in the dataModel, user was just browsing selections
                    if (dataModel.value) {
                        report.value = dataModel.value;
                    }

                }
                return report;
            }
510688
public final void setPlaceholder(String text,
                                     @ColorInt int backgroundColor,
                                     @ColorInt int textColor) {
        boolean invalidate = false;
        // Set the placeholder background color
        if (backgroundColor != mBackgroundColor) {
            mBackgroundColor = backgroundColor;
            if (null != mBackgroundPaint) {
                mBackgroundPaint.setColor(backgroundColor);
                invalidate = true;
            }
        }
        // Set the placeholder text color
        if (!text.equalsIgnoreCase(mText) ||
            (backgroundColor != mBackgroundColor) ||
            (textColor != mTextColor)) {
            setPlaceholderTextInternal(text, textColor, mTextSize, false);
            invalidate = true;
        }

        if (invalidate) {
            invalidate();
        }
    }
1205476
function editText(text) {
    var $newedit = editor.$edit.clone().val(text);
    editor.$edit.replaceWith($newedit);
    editor.$edit = $newedit;
    editor.$edit.on('keyup', editorUpdate);
  }
98069
public void setButtonTooltipText(final String TEXT) {
        if (null == buttonTooltipText) {
            _buttonTooltipText = TEXT;
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            buttonTooltipText.set(TEXT);
        }
    }
1350854
function toplevel (text) {
  var state = 0;
  var bracecount = 0;
  var section = new TopLevel ();
  for (var i = 0;  i < text.length;  i++) {
    if (state === 0) {
      // Toplevel.
      if (text[i] === '{' && text[i+1] && text[i+1] === '{') {
        if (text[i+2] !== '[') {
          // The trigger matches; we enter a control zone.
          //
          //   outer {{ control zone }} outer
          //         ^-----------------^
          section.zone = new ControlZone ();
          section.zone.from = i;
          state = 1;
          i += 1;     // Counting the for loop, i will be just after the curly.
        } else {
          // This is an escape.
          // {{[ needs to be converted to {{.
          section.escapes.push (i, i + 3, 0);
          i += 2;     // Counting the for loop, i will be just after the [.
        }
      } else if (text[i] === ']' && text[i+1] && text[i+1] === '}'
          && text[i+2] && text[i+2] === '}') {
        // This is an escape.
        // ]}} needs to be converted to }}.
        section.escapes.push (i, i + 3, 1);
        i += 2;     // Counting the for loop, i will be just after the curly.
      }
    } else if (state === 1) {
      // Inside the control zone.
      if (text[i] === '}' && text[i+1] && text[i+1] === '}') {
        if (bracecount > 0) {
          bracecount -= 1;
          i += 1;
        } else {
          // We leave the control zone.
          section.zone.to = i + 2;
          return section;
        }
      } else if (text[i] === ']' && text[i+1] && text[i+1] == '}'
          && text[i+2] && text[i+2] === '}') {
        // This is an escape.
        // ]}} needs to be converted to }}.
        section.zone.escapes.push (i, i + 3, 1);
        i += 2;
      } else if (text[i] === '{' && text[i+1] && text[i+1] == '{') {
        // Opening a subsection.
        if (text[i+2] && text[i+2] !== '[') {
          bracecount += 1;
          i += 1;
        } else {
          // This is an escape.
          // {{[ needs to be converted to {{.
          section.zone.escapes.push (i, i + 3, 0);
          i += 2;
        }
      }
    }
  }
  return section;
}