Example usage for com.google.gwt.dom.client TextAreaElement setValue

List of usage examples for com.google.gwt.dom.client TextAreaElement setValue

Introduction

In this page you can find the example usage for com.google.gwt.dom.client TextAreaElement setValue.

Prototype

public void setValue(String value) 

Source Link

Document

Represents the current contents of the corresponding form control, in an interactive user agent.

Usage

From source file:com.cgxlib.xq.client.plugins.widgets.TextAreaWidgetFactory.java

License:Apache License

@Override
protected void copyAttributes(Element src, Element dest) {
    TextAreaElement source = src.cast();
    TextAreaElement destination = dest.cast();

    destination.setAccessKey(source.getAccessKey());
    destination.setCols(source.getCols());
    destination.setDefaultValue(source.getDefaultValue());
    destination.setDisabled(source.isDisabled());
    destination.setName(source.getName());
    destination.setReadOnly(source.isReadOnly());
    destination.setRows(source.getRows());
    destination.setValue(source.getValue());
}

From source file:org.primordion.xholon.app.Application.java

License:Open Source License

public void clearConsole() {
    //Element element = Document.get().getElementById("xhout");
    //element = element.getFirstChildElement();
    Element element = HtmlElementCache.xhout;
    if (element != null) {
        element = element.getFirstChildElement();
    }//  w ww.j ava 2s  . c  om
    if (element != null) {
        TextAreaElement textfield = element.cast();
        textfield.setValue("");
    }
}

From source file:org.primordion.xholon.base.Xholon.java

License:Open Source License

/**
 * Print to a console.//  www . j a  va2s  . c o m
 * This can be very slow, so limit the number of calls,
 * for example by consolidating text using a StringBuilder before calling.
 * @param str A String to append to the end of the console.
 * @param scroll Whether or not to scroll to the bottom of the text area.
 */
protected void print2Console(String str, boolean scroll) {
    if (str.startsWith(PRINT2CONSOLE_IGNORE_ME)) {
        return;
    }
    Element element = HtmlElementCache.xhout;
    if (element != null) {
        element = element.getFirstChildElement();
    }
    if (element != null) {
        TextAreaElement textfield = element.cast();
        textfield.setValue(textfield.getValue() + str);
        // optionally scroll to the bottom of the text area
        if (scroll) {
            textfield.setScrollTop(textfield.getScrollHeight());
        }
    }
}

From source file:org.primordion.xholon.io.console.XholonConsole.java

License:Open Source License

/**
 * Set the result of the query into the XholonConsole GUI,
 * and make it visible to the user./*  ww  w.ja va  2  s  .c  o  m*/
 * For now, the resultPane and commandPane are the same.
 * @param result
 * @param replace whether to replace current text (true), or append to end of current text (false)
 */
public void setResult(String result, boolean replace) {
    //Window.alert(result);

    // get the element
    Element ele = commandPane.getElement().getFirstChildElement();

    // <pre>
    //ele.setInnerText(ele.getInnerText() + result);

    // these leave the escaped chars in the text
    //ele.setInnerHTML(ele.getInnerHTML() + result);
    //ele.setInnerText(ele.getInnerText() + SafeHtmlUtils.htmlEscape(result));

    // textarea
    TextAreaElement ta = TextAreaElement.as(ele);
    if (replace) {
        ta.setValue(result);
    } else {
        ta.setValue(ta.getValue() + result);
    }
    // optionally scroll to the bottom of the text area
    if (isTerminalEnabled()) {
        ta.setScrollTop(ta.getScrollHeight());
    }
}

From source file:org.primordion.xholon.io.console.XholonConsole.java

License:Open Source License

/**
 * Clear the contents of the command pane.
 *///from  w ww.  j  a  v  a  2 s. c o  m
protected void clearCommand() {
    Element ele = commandPane.getElement().getFirstChildElement();
    TextAreaElement ta = TextAreaElement.as(ele);
    // pre
    //ele.setInnerText("");
    // textarea
    ta.setValue("");
}

From source file:org.primordion.xholon.io.ngui.AqlWebInterface.java

License:BSD License

/**
 * Set the result of the query into a text area,
 * and make it visible to the user.//from w  w  w . j a va  2  s .c om
 * For now, the resultPane and commandPane are the same.
 * @param result
 * @param replace whether to replace current text (true), or append to end of current text (false)
 */
public void setResult(String result, boolean replace) {
    // get the element
    Element ele = commandPane.getElement().getFirstChildElement();

    // textarea
    TextAreaElement ta = TextAreaElement.as(ele);
    if (replace) {
        ta.setValue(result);
    } else {
        ta.setValue(ta.getValue() + result);
    }
}

From source file:org.primordion.xholon.service.xholonhelper.XholonClipboard.java

License:Open Source License

public void writeStringToClipboard(String str) {
    Element element = Document.get().getElementById("xhclipboard").getFirstChildElement();
    if (element != null) {
        TextAreaElement textarea = element.cast();
        textarea.setValue(str);
    }//from   w  w  w.j a v  a 2  s. c  o  m

    /* GWT
     Clipboard clipboard = null;
     try {
        clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
     } catch (AccessControlException e) {
        return;
     }
     Transferable contents = new StringSelection(str);
     clipboard.setContents(contents, null);*/
}