Example usage for com.google.gwt.user.client.ui TextArea TextArea

List of usage examples for com.google.gwt.user.client.ui TextArea TextArea

Introduction

In this page you can find the example usage for com.google.gwt.user.client.ui TextArea TextArea.

Prototype

public TextArea() 

Source Link

Document

Creates an empty text area.

Usage

From source file:asquare.gwt.tests.circularbinding.client.Demo.java

License:Apache License

private Widget createDemoPanel() {
    VerticalPanel outer = new VerticalPanel();

    final TextArea output = new TextArea();
    outer.add(output);//from ww w.ja v a 2  s. c  o  m

    Label label = new Label("Click me");
    label.addMouseDownHandler(new MouseDownHandler() {
        public void onMouseDown(MouseDownEvent event) {
            // this works
            output.setText("x=" + DOM2.eventGetClientX());

            // this results in an infinite loop
            output.setText(output.getText() + "\r\ny=" + DOM2.eventGetClientY());
        }
    });
    DOM.setStyleAttribute(label.getElement(), "border", "solid black 1px");
    outer.insert(label, 0);

    return outer;
}

From source file:asquare.gwt.tests.clientcoords.client.Demo.java

License:Apache License

public void onModuleLoad() {
    RootPanel.get("outer").add(new Label("Event client position"));
    final TextArea output = new TextArea();
    RootPanel.get("outer").add(output);
    Event.addNativePreviewHandler(new Event.NativePreviewHandler() {
        public void onPreviewNativeEvent(NativePreviewEvent event) {
            if (event.getTypeInt() == Event.ONMOUSEDOWN) {
                NativeEvent nativeEvent = event.getNativeEvent();
                output.setText("clientX=" + nativeEvent.getClientX() + ", clientY=" + nativeEvent.getClientY());
            }//from  w  ww .  j av  a2  s.c  o  m
        }
    });
}

From source file:asquare.gwt.tests.focus.client.Demo.java

License:Apache License

private Widget createFocusPanel() {
    Table outer = new Table();

    outer.add(new FocusPanel(new Label("Label in a FocusPanel")));
    outer.add(new Button("Button"));
    outer.add(new CheckBox("CheckBox"));
    outer.add(new TextBox());
    outer.add(new PasswordTextBox());
    outer.add(new TextArea());
    outer.add(new RadioButton("group1", "RadioButton1"));
    outer.add(new RadioButton("group1", "RadioButton2"));
    ListBox listBox1 = new ListBox();
    listBox1.addItem("ListBox1");
    listBox1.addItem("item2");
    listBox1.addItem("item3");
    outer.add(listBox1);/*from w w  w. j a  va2s.co m*/
    ListBox listBox2 = new ListBox(true);
    listBox2.setVisibleItemCount(3);
    listBox2.addItem("ListBox2");
    listBox2.addItem("item2");
    listBox2.addItem("item3");
    outer.add(listBox2);
    Tree tree = new Tree();
    tree.addItem("Tree");
    tree.addItem("item2");
    tree.addItem("item3");
    outer.add(tree);

    return outer;
}

From source file:asquare.gwt.tests.focusevent.client.Demo.java

License:Apache License

private Widget createDemoPanel() {
    TestPanel outer = new TestPanel();

    outer.add(new Label("GWT onfocus Event Handler"));
    outer.add(new Button("Button"), "Button");
    outer.add(new CheckBox("CheckBox"), "CheckBox");
    outer.add(new RadioButton("group1", "RadioButton1"), "RadioButton1");
    TextBox textBox = new TextBox();
    textBox.setText("TextBox");
    outer.add(textBox, "TextBox");
    PasswordTextBox passwordTextBox = new PasswordTextBox();
    passwordTextBox.setText("PasswordTextBox");
    outer.add(passwordTextBox, "PasswordTextBox");
    TextArea textArea = new TextArea();
    textArea.setText("TextArea");
    outer.add(textArea, "TextArea");
    ListBox listBox = new ListBox();
    listBox.addItem("ListBox");
    listBox.addItem("item2");
    listBox.addItem("item3");
    outer.add(listBox, "ListBox");
    outer.add(new FocusPanel(new Label("Label in a FocusPanel")), "FocusPanel");
    Tree tree = new Tree();
    tree.addItem("item1");
    tree.addItem("item2");
    tree.addItem("item3");
    outer.add(tree, "Tree");

    return outer;
}

From source file:asquare.gwt.tests.mousebutton.client.Demo.java

License:Apache License

private Widget createDemoPanel() {
    VerticalPanel outer = new VerticalPanel();
    TextBox input = new TextBox();
    input.setText("Click Here");
    TextArea output = new TextArea();
    outer.add(input);//from   w w  w. j av  a2 s.  c  o m
    outer.add(output);

    MouseHandler handler = new MouseHandler(output);
    HandlesAllMouseEvents.handle(input, handler);
    return outer;
}

From source file:asquare.gwt.tk.demo.client.DebugPanel.java

License:Apache License

private Widget createWidgetPanel() {
    BasicPanel widgets = new BasicPanel();
    DOM.setAttribute(widgets.getElement(), "id", "debug-widgets");
    TextArea textArea = new TextArea();
    textArea.setText("Enable event tracing then type in here");
    widgets.add(textArea);/*from   ww w.j a  v a 2  s.c  o  m*/

    ListBox listBox = new ListBox();
    listBox.addItem("List Box");
    listBox.addItem("foo");
    listBox.addItem("bar");
    listBox.addItem("baz");
    widgets.add(listBox);

    TreeItem treeRoot = new TreeItem("Tree");
    TreeItem treeItem = new TreeItem("foo");
    treeRoot.addItem(treeItem);
    treeRoot.addItem("bar");
    treeRoot.addItem("baz");
    Tree tree = new Tree();
    tree.addItem(treeRoot);
    tree.setSelectedItem(treeItem);
    tree.ensureSelectedItemVisible();
    widgets.add(tree);

    Image image = new Image("icecube.jpg");
    ScrollPanel scrollPanel = new ScrollPanel(image);
    scrollPanel.setSize("200px", "200px");
    widgets.add(scrollPanel);

    return widgets;
}

From source file:asquare.gwt.tkdemo.client.demos.DebugPanel.java

License:Apache License

private Widget createWidgetPanel() {
    BasicPanel widgets = new BasicPanel();
    TextArea textArea = new TextArea();
    textArea.setText("Enable event tracing then type in here");
    widgets.add(textArea);/*w  w w  .  j  a  v  a2 s.c  om*/

    ListBox listBox = new ListBox();
    listBox.addItem("List Box");
    listBox.addItem("foo");
    listBox.addItem("bar");
    listBox.addItem("baz");
    widgets.add(listBox);

    TreeItem treeRoot = new TreeItem("Tree");
    final TreeItem treeItem = new TreeItem("foo");
    treeRoot.addItem(treeItem);
    treeRoot.addItem("bar");
    treeRoot.addItem("baz");
    final Tree tree = new Tree();
    tree.addItem(treeRoot);
    /*
       * This crashes the hosted shell
       * http://code.google.com/p/google-web-toolkit/issues/detail?id=1785
     */
    //        /*
    //         * Defer selection so that Tree does not break Opera
    //         * http://code.google.com/p/google-web-toolkit/issues/detail?id=1784
    //       */
    //        DeferredCommand.addCommand(new Command()
    //        {
    //            public void execute()
    //            {
    //                tree.setSelectedItem(treeItem);
    //                tree.ensureSelectedItemVisible();
    //            }
    //        });
    widgets.add(tree);

    Image image = new Image("icecube.jpg");
    ScrollPanel scrollPanel = new ScrollPanel(image);
    scrollPanel.setSize("200px", "200px");
    widgets.add(scrollPanel);

    return widgets;
}

From source file:asquare.gwt.tkdemo.client.demos.FocusCycleDemo.java

License:Apache License

private Widget createFocusCycle1() {
    FocusCyclePanel cycle1 = new FocusCyclePanel("div", "block");

    cycle1.add(new Label("Cycle 1"));

    cycle1.add(new FocusStyleDecorator(new Button("Button")));

    Button buttonDisabled = new Button("disabled");
    buttonDisabled.setEnabled(false);//from   w ww.  j a v a2s  .  c  o  m
    cycle1.add(new FocusStyleDecorator(buttonDisabled));

    Button buttonNegativeTabIndex = new Button("tabIndex = -1");
    buttonNegativeTabIndex.setTabIndex(-1);
    cycle1.add(new FocusStyleDecorator(buttonNegativeTabIndex));

    cycle1.add(new FocusStyleDecorator(new CheckBox("CheckBox")));

    cycle1.add(new FocusStyleDecorator(new FocusPanel(new Label("FocusPanel"))));

    ListBox listBox = new ListBox();
    listBox.addItem("ListBox");
    listBox.addItem("Item 1");
    listBox.addItem("Item 2");
    listBox.addItem("Item 3");
    cycle1.add(new FocusStyleDecorator(listBox));

    TextBox textBox = new TextBox();
    textBox.setText("TextBox");
    cycle1.add(new FocusStyleDecorator(textBox));

    PasswordTextBox pwBox = new PasswordTextBox();
    pwBox.setText("PasswordTextBox");
    cycle1.add(new FocusStyleDecorator(pwBox));

    TextArea textArea = new TextArea();
    textArea.setText("TextArea");
    cycle1.add(new FocusStyleDecorator(textArea));

    Tree tree = new Tree();
    TreeItem treeRoot = new TreeItem("Tree");
    for (int branchNum = 1; branchNum < 4; branchNum++) {
        TreeItem branch = new TreeItem("Branch " + branchNum);
        for (int item = 1; item < 4; item++) {
            branch.addItem("Item " + item);
        }
        treeRoot.addItem(branch);
    }
    tree.addItem(treeRoot);
    cycle1.add(new FocusStyleDecorator(tree));

    new WidgetFocusStyleController(cycle1.getFocusModel());

    return cycle1;
}

From source file:burrito.client.crud.CrudFieldResolver.java

License:Apache License

/**
 * Resolve and create an {@link CrudInputField} from a {@link CrudField}
 * /*  w  w  w  .  j a  v  a 2 s .  c  o m*/
 * @param field
 * @return
 */
@SuppressWarnings("rawtypes")
public static CrudInputField createInputField(CrudField field, CrudServiceAsync service) {
    for (CrudFieldPluginHandler pluginHandler : pluginHandlers) {
        CrudInputField<?> pluggedIn = pluginHandler.process(field);
        if (pluggedIn != null) {
            return pluggedIn;
        }
    }
    // First handle specific cases:
    if (field instanceof DisplayableMethodField || field instanceof AdminLinkMethodField) {
        //this field has no input
        return null;
    }

    if (field.isReadOnly()) {
        return new ReadOnlyTextCrudInputField(field);
    }

    if (field instanceof ManyToOneRelationField) {
        ManyToOneRelationField relationField = (ManyToOneRelationField) field;

        if (relationField.isDropDown()) {
            return new SelectionListField(relationField, service);
        } else {
            return new SearchListField(relationField, service);
        }
    }
    if (field instanceof EnumListField) {
        return new EnumListInputField((EnumListField) field);
    }
    if (field instanceof EnumIndexedListField) {
        EnumIndexedListField enumIndexedListField = (EnumIndexedListField) field;
        return new EnumIndexedListInputField(enumIndexedListField, enumIndexedListField.getListClassName());

    }
    if (field instanceof ImageField) {
        return new ImageCrudInputField((ImageField) field);
    }
    if (field instanceof FileField) {
        return new FileCrudInputField((FileField) field);
    }
    if (field instanceof RichTextField) {
        return new RichTextInputField((RichTextField) field);
    }
    if (field instanceof BBCodeField) {
        return new BBCodeInputField((BBCodeField) field);
    }
    if (field instanceof StringSelectionField) {
        return new StringSelectionListField((StringSelectionField) field);
    }
    if (field instanceof ListedByEnumField) {
        return new ListedByEnumSelectionListField((ListedByEnumField) field);
    }
    if (field instanceof LinkListField) {
        return new LinkListInputField((LinkListField) field);
    }
    if (field instanceof StringListField) {
        return new StringListInputField((StringListField) field);
    }
    if (field instanceof LongListField) {
        return new LongListInputField((LongListField) field);
    }
    if (field instanceof IntegerListField) {
        return new IntegerListInputField((IntegerListField) field);
    }
    if (field instanceof LinkedEntityField) {
        return new LinkedEntityInputField((LinkedEntityField) field);
    }
    if (field instanceof EmbeddedListField) {
        return new EmbeddedListInputField((EmbeddedListField) field);
    }

    // Fallback to raw type input:
    if (field.getType() == Date.class) {
        return new DateCrudInputField((DateField) field);
    }
    if (field.getType() == Long.class) {
        return new CrudInputFieldImpl<Long>(field, new LongInputField(field.isRequired()),
                (Long) field.getValue());
    }
    if (field.getType() == Integer.class) {
        return new CrudInputFieldImpl<Integer>(field, new IntegerInputField(field.isRequired()),
                (Integer) field.getValue());
    }
    if (field.getType() == String.class) {
        final StringField sf = (StringField) field;

        StringInputField stringInputField;
        if (sf.isRenderAsTextArea()) {
            stringInputField = new StringInputField(field.isRequired()) {
                @Override
                protected TextBoxBase createField() {
                    return new TextArea();
                }
            };
        } else {
            stringInputField = new StringInputField(field.isRequired());
        }
        if (sf.getRegexpPattern() != null) {
            stringInputField.addInputFieldValidator(
                    new RegexpInputFieldValidator(sf.getRegexpPattern(), sf.getRegexpDescription()));
        }
        return new CrudInputFieldImpl<String>(field, stringInputField, (String) field.getValue());
    }
    if (field.getType() == Boolean.class) {
        return new BooleanCrudInputField((BooleanField) field);
    }
    if (field.getType() == List.class) {
        return new ListCrudInputField((ManyToManyRelationField) field);
    }
    return null;
}

From source file:cc.alcina.framework.gwt.client.util.WidgetUtils.java

License:Apache License

public static void copyTextToClipboard(String text) {
    FlowPanel fp = new FlowPanel();
    TextArea ta = new TextArea();
    ta.setSize("600px", "300px");
    ta.setText(text);/*www.  j av  a 2 s . c o  m*/
    fp.add(ta);
    PopupPanel pp = new PopupPanel();
    pp.add(fp);
    pp.setAnimationEnabled(false);
    pp.show();
    ta.setSelectionRange(0, text.length());
    try {
        execCopy();
    } catch (JavaScriptException e) {
        pp.hide();
        if (e.getMessage().contains("NS_ERROR_XPC_NOT_ENOUGH_ARGS")) {
            Registry.impl(ClientNotifications.class)
                    .showMessage(new HTML("<div class='info'>Sorry, clipboard operations"
                            + " are disabled by Mozilla/Firefox" + " security settings. <br><br> Please see "
                            + "<a href='http://www.mozilla.org/editor/midasdemo/securityprefs.html'>"
                            + "http://www.mozilla.org/editor/midasdemo/securityprefs.html</a></div> "));
        } else {
            throw e;
        }
    }
    pp.hide();
}