Java Code Examples for com.google.gwt.user.client.ui.TextArea#wrap()

The following examples show how to use com.google.gwt.user.client.ui.TextArea#wrap() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WordCloudApp.java    From swcv with MIT License 6 votes vote down vote up
private void createLuckyWikiButton()
{
    Anchor rndWikiButton = Anchor.wrap(Document.get().getElementById("btn_rnd_wiki"));
    final TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text"));
    rndWikiButton.addClickHandler(new ClickHandler()
    {
        public void onClick(ClickEvent event)
        {
            wcService.getRandomWikiUrl(new AsyncCallback<String>()
            {
                public void onSuccess(String result)
                {
                    textArea.setText(result);
                }

                public void onFailure(Throwable caught)
                {
                    textArea.setText("http://en.wikipedia.org/wiki/Special:random");
                }
            });

        }
    });
}
 
Example 2
Source File: WordCloudApp.java    From swcv with MIT License 6 votes vote down vote up
private void createLuckyTwitterButton()
{
    Anchor rndWikiButton = Anchor.wrap(Document.get().getElementById("btn_rnd_twitter"));
    final TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text"));
    rndWikiButton.addClickHandler(new ClickHandler()
    {
        public void onClick(ClickEvent event)
        {
            wcService.getRandomTwitterUrl(new AsyncCallback<String>()
            {
                public void onSuccess(String result)
                {
                    textArea.setText(result);
                }

                public void onFailure(Throwable caught)
                {
                    textArea.setText("twitter: hot trend");
                }
            });

        }
    });
}
 
Example 3
Source File: WordCloudApp.java    From swcv with MIT License 6 votes vote down vote up
private void createLuckyYoutubeButton()
{
    Anchor rndWikiButton = Anchor.wrap(Document.get().getElementById("btn_rnd_youtube"));
    final TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text"));
    rndWikiButton.addClickHandler(new ClickHandler()
    {
        public void onClick(ClickEvent event)
        {
            wcService.getRandomYoutubeUrl(new AsyncCallback<String>()
            {
                public void onSuccess(String result)
                {
                    textArea.setText(result);
                }

                public void onFailure(Throwable caught)
                {
                    textArea.setText("https://www.youtube.com");
                }
            });

        }
    });
}
 
Example 4
Source File: WordCloudApp.java    From swcv with MIT License 6 votes vote down vote up
private void createLuckyGoogleButton()
{
    Anchor rndGoogleButton = Anchor.wrap(Document.get().getElementById("btn_rnd_google"));
    final TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text"));
    rndGoogleButton.addClickHandler(new ClickHandler()
    {
        public void onClick(ClickEvent event)
        {
            wcService.getRandomGoogleUrl(new AsyncCallback<String>()
            {
                public void onSuccess(String result)
                {
                    textArea.setText(result);
                }

                public void onFailure(Throwable caught)
                {
                    textArea.setText("google: hot trend");
                }
            });

        }
    });
}
 
Example 5
Source File: WordCloudApp.java    From swcv with MIT License 6 votes vote down vote up
private TextArea createTextArea()
{
    TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text"));
    textArea.addKeyDownHandler(new KeyDownHandler()
    {
        public void onKeyDown(KeyDownEvent event)
        {
            event.preventDefault();
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER)
            {
                createWordCloud();
            }
        }
    });

    return textArea;
}
 
Example 6
Source File: WordCloudApp.java    From swcv with MIT License 5 votes vote down vote up
private void createWordCloud()
{
    TextArea textArea = TextArea.wrap(Document.get().getElementById("input_text"));
    String text = textArea.getText().trim();
    if (!text.isEmpty())
    {
        createWordCloud(text);
    }
    else
    {
        textArea.setFocus(true);
    }
}