Java Code Examples for com.google.gwt.user.client.ui.TextArea

The following examples show how to use com.google.gwt.user.client.ui.TextArea. These examples are extracted from open source projects. 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 Project: swcv   Source File: WordCloudApp.java    License: 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 Project: swcv   Source File: WordCloudApp.java    License: 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 Project: swcv   Source File: WordCloudApp.java    License: 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 Project: swcv   Source File: WordCloudApp.java    License: 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 Project: swcv   Source File: WordCloudApp.java    License: 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
public void copyContent(ClipboardContent content) {
  final TextArea copyArea = createClipboardTextArea();
  if (TextContentHelper.isText(content)) {
    copyArea.setText(TextContentHelper.getText(content));
  } else {
    copyArea.setText(content.toString());
  }
  copyArea.selectAll();
  new Timer() {
    @Override
    public void run() {
      RootPanel.get().remove(copyArea);
      $(myTarget).focus();
    }
  }.schedule(20);
}
 
Example 7
Source Project: core   Source File: XmlDebugPanel.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
public XmlDebugPanel(TreeTableModel model) {
  this.model = model;
  nodes = new IdentityHashMap<Object, Element>();
  document = XMLParser.createDocument();
  root = document.createElement("debug-panel");
  initWidget(textArea = new TextArea());
  textArea.ensureDebugId("debug-panel-xml");
  textArea.setStyleName(Utils.style() + "-xml");

  // Build the XML document based on the current state.
  document.appendChild(root);
  nodes.put(model.getRoot(), root);
  build(model.getRoot());

  model.addTreeTableModelListener(this);
}
 
Example 8
private void showVersionInfo(String json)
{
    DefaultWindow window = new DefaultWindow("Management Model Versions");
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    TextArea textArea = new TextArea();
    textArea.setStyleName("fill-layout");
    textArea.setText(json);

    window.setWidget(textArea);

    window.setGlassEnabled(true);
    window.center();
}
 
Example 9
private void showVersionInfo(String json) {
    DefaultWindow window = new DefaultWindow("Management Model Versions");
    window.setWidth(480);
    window.setHeight(360);
    window.addCloseHandler(new CloseHandler<PopupPanel>() {
        @Override
        public void onClose(CloseEvent<PopupPanel> event) {

        }
    });

    TextArea textArea = new TextArea();
    textArea.setStyleName("fill-layout");
    textArea.setText(json);

    window.setWidget(textArea);

    window.setGlassEnabled(true);
    window.center();
}
 
Example 10
Source Project: EasyML   Source File: StdPanel.java    License: Apache License 2.0 5 votes vote down vote up
protected void init(String msg, String title) {
	this.setTitle("stdErr");
	this.setGlassEnabled(true);

	HTML closeButton = new HTML("X");
	closeButton.setSize("10px", "10px");
	closeButton.setStyleName("closebtn");
	closeButton.addClickHandler(new ClickHandler() {
		@Override
		public void onClick(ClickEvent event) {
			StdPanel.this.hide();
		}
	});

	ScrollPanel scvp = new ScrollPanel();
	VerticalPanel verticalPanel = new VerticalPanel();

	verticalPanel.add(closeButton);
	verticalPanel.setCellHeight(closeButton, "30px");
	verticalPanel.setStyleName("vpanel");
	HTML desc = new HTML(title);
	desc.setStyleName("popupTitle");
	verticalPanel.add(desc);
	verticalPanel.setCellHeight(desc, "30px");

	TextArea label = new TextArea();
	label.setText(msg);
	label.setReadOnly(true);
	label.setSize("650px", "400px");
	verticalPanel.add(label);
	scvp.add(verticalPanel);
	this.add(scvp);
	this.setStyleName("loading_container");
	this.center();
	this.show();
}
 
Example 11
Source Project: EasyML   Source File: ScriptParameterPanel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Init UI
 * @param editable Wheather is editable
 */
protected void init(boolean editable){

	initGridHead( 3 );
	inCountBox = new TextBox();
	outCountBox = new TextBox();
	inCountBox.setText( "" +widget.getInNodeShapes().size() );
	outCountBox.setText( "" + widget.getOutNodeShapes().size());

	paramsGrid.setVisible(true);
	paramsGrid.setWidget( 1 , 0, new Label("Input File Number"));
	paramsGrid.setWidget( 1, 1, new Label("Int"));
	paramsGrid.setWidget( 1, 2, inCountBox );
	inCountBox.setSize("95%", "100%");
	inCountBox.setStyleName("okTextbox");
	inCountBox.setEnabled(editable);
	inCountBox.setTabIndex(0);

	paramsGrid.setWidget( 2 , 0, new Label("Output File Number"));
	paramsGrid.setWidget( 2,  1, new Label("Int"));
	paramsGrid.setWidget( 2 , 2, outCountBox );
	outCountBox.setSize("95%", "100%");
	outCountBox.setStyleName("okTextbox");
	outCountBox.setEnabled(editable);
	outCountBox.setTabIndex(1);
	scriptArea = new TextArea();
	scriptArea.setText( widget.getProgramConf().getScriptContent());
	this.add( paramsGrid );
	this.add( new Label("Script"));
	this.add( scriptArea );
}
 
Example 12
Source Project: EasyML   Source File: SqlScriptParameterPanel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Init UI
 * @param editable Wheather is editable 
 */
protected void init(boolean editable){
	scriptArea = new TextArea();
	scriptArea.setText( widget.getProgramConf().getScriptContent());
	this.add( panel );
	this.add( new Label("Script"));
	this.add( scriptArea );
}
 
Example 13
Source Project: appinventor-extensions   Source File: GalleryPage.java    License: Apache License 2.0 5 votes vote down vote up
/**
   * Helper method called by constructor to initialize ui components
   */
  private void initComponents() {
    // Initialize UI
    panel = new VerticalPanel();
    panel.setWidth("100%");
    galleryGUI = new FlowPanel();
    appSingle = new FlowPanel();
    appDetails = new FlowPanel();
    appHeader = new FlowPanel();
    appInfo = new FlowPanel();
    appAction = new FlowPanel();
    appAuthor = new FlowPanel();
    appMeta = new FlowPanel();
    appDates = new FlowPanel();
    appPrimaryWrapper = new FlowPanel();
    appSecondaryWrapper = new FlowPanel();
    appDescPanel = new FlowPanel();
    appReportPanel = new FlowPanel();
    appSharePanel = new FlowPanel();
    appActionTabs = new TabPanel();
    sidebarTabs = new TabPanel();
    appComments = new FlowPanel();
    appCommentsList = new FlowPanel();
    appsByAuthor = new FlowPanel();
    appsByTags = new FlowPanel();
    appsRemixes = new FlowPanel();
    returnToGallery = new FlowPanel();
//    tagSelected = "";

    appCreated = new Label();
    appChanged = new Label();
    descBox = new FlowPanel();
    titleBox = new FlowPanel();
    desc = new TextArea();
    titleText = new TextArea();
    moreInfoText = new TextArea();
    creditText = new TextArea();
    ccLicenseRef = new HTML(MESSAGES.galleryCcLicenseRef());
    ccLicenseRef.addStyleName("app-action-html");
  }
 
Example 14
Source Project: appinventor-extensions   Source File: GalleryPage.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Helper method called by constructor to initialize the app's comment area
 */
private void initAppComments() {
  // App details - comments
  appDetails.add(appComments);
  appComments.addStyleName("app-comments-wrapper");
  Label commentsHeader = new Label("Comments and Reviews");
  commentsHeader.addStyleName("app-comments-header");
  appComments.add(commentsHeader);
  final TextArea commentTextArea = new TextArea();
  commentTextArea.addStyleName("app-comments-textarea");
  appComments.add(commentTextArea);
  Button commentSubmit = new Button("Submit my comment");
  commentSubmit.addStyleName("app-comments-submit");
  commentSubmit.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      final OdeAsyncCallback<Long> commentPublishCallback = new OdeAsyncCallback<Long>(
          // failure message
          MESSAGES.galleryError()) {
            @Override
            public void onSuccess(Long date) {
              // get the new comment list so gui updates
              //   note: we might modify the call to publishComment so it returns
              //   the list instead, this would save one server call
              gallery.GetComments(app.getGalleryAppId(), 0, 100);
            }
        };
      Ode.getInstance().getGalleryService().publishComment(app.getGalleryAppId(),
          commentTextArea.getText(), commentPublishCallback);
    }
  });
  appComments.add(commentSubmit);

  // Add list of comments
  gallery.GetComments(app.getGalleryAppId(), 0, 100);
  appComments.add(appCommentsList);
  appCommentsList.addStyleName("app-comments");

}
 
Example 15
Source Project: swcv   Source File: WordCloudApp.java    License: MIT License 5 votes vote down vote up
private void createCreateWordCloudButton(final TextArea textArea)
{
    Button sendButton = Button.wrap(Document.get().getElementById("btn_create_wc"));
    sendButton.addClickHandler(new ClickHandler()
    {
        public void onClick(ClickEvent event)
        {
            createWordCloud();
        }
    });
}
 
Example 16
Source Project: swcv   Source File: WordCloudApp.java    License: 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);
    }
}
 
Example 17
protected InputTextArea(InputTextArea source) {
	super(new TextArea(), source);
	this.setMaxLength(source.getMaxLength());
	if (source.rows != null) {
		this.setRows(source.rows);
	}
}
 
Example 18
public void pasteContent(final Handler<String> handler) {
  final TextArea pasteArea = createClipboardTextArea();
  new Timer() {
    @Override
    public void run() {
      RootPanel.get().remove(pasteArea);
      $(myTarget).focus();
      String text = pasteArea.getText();
      handler.handle(text);
    }
  }.schedule(20);
}
 
Example 19
private TextArea createClipboardTextArea() {
  final TextArea pasteArea = new TextArea();
  pasteArea.setPixelSize(0, 0);
  Style style = pasteArea.getElement().getStyle();
  style.setPosition(Style.Position.FIXED);
  RootPanel.get().add(pasteArea);
  pasteArea.setFocus(true);
  return pasteArea;
}
 
Example 20
Source Project: EasyML   Source File: PreviewPopupPanel.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * @return the fileTextArea
 */
public TextArea getFileTextArea() {
	return fileTextArea;
}
 
Example 21
Source Project: EasyML   Source File: PreviewPopupPanel.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * @param fileTextArea the fileTextArea to set
 */
public void setFileTextArea(TextArea fileTextArea) {
	this.fileTextArea = fileTextArea;
}
 
Example 22
Source Project: EasyML   Source File: ScriptParameterPanel.java    License: Apache License 2.0 4 votes vote down vote up
public TextArea getScriptArea() {
	return scriptArea;
}
 
Example 23
Source Project: EasyML   Source File: SqlScriptParameterPanel.java    License: Apache License 2.0 4 votes vote down vote up
public TextArea getScriptArea() {
	return scriptArea;
}
 
Example 24
Source Project: appinventor-extensions   Source File: GalleryPage.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Helper method called by constructor to initialize the report section
 */
private void initReportSection() {
  final HTML reportPrompt = new HTML();
  reportPrompt.setHTML(MESSAGES.galleryReportPrompt());
  reportPrompt.addStyleName("primary-prompt");
  final TextArea reportText = new TextArea();
  reportText.addStyleName("action-textarea");
  final Button submitReport = new Button(MESSAGES.galleryReportButton());
  submitReport.addStyleName("action-button");
  final Label descriptionError = new Label();
  descriptionError.setText("Description required");
  descriptionError.setStyleName("ode-ErrorMessage");
  descriptionError.setVisible(false);
  appReportPanel.add(reportPrompt);
  appReportPanel.add(descriptionError);
  appReportPanel.add(reportText);
  appReportPanel.add(submitReport);

  final OdeAsyncCallback<Boolean> isReportdByUserCallback = new OdeAsyncCallback<Boolean>(
      // failure message
      MESSAGES.galleryError()) {
        @Override
        public void onSuccess(Boolean isAlreadyReported) {
          if(isAlreadyReported) { //already reported, cannot report again
            reportPrompt.setHTML(MESSAGES.galleryAlreadyReportedPrompt());
            reportText.setVisible(false);
            submitReport.setVisible(false);
            submitReport.setEnabled(false);
          } else {
            submitReport.addClickHandler(new ClickHandler() {
              public void onClick(ClickEvent event) {
                final OdeAsyncCallback<Long> reportClickCallback = new OdeAsyncCallback<Long>(
                    // failure message
                    MESSAGES.galleryError()) {
                      @Override
                      public void onSuccess(Long id) {
                        reportPrompt.setHTML(MESSAGES.galleryReportCompletionPrompt());
                        reportText.setVisible(false);
                        submitReport.setVisible(false);
                        submitReport.setEnabled(false);
                      }
                  };
                if (!reportText.getText().trim().isEmpty()){
                  Ode.getInstance().getGalleryService().addAppReport(app, reportText.getText(),
                    reportClickCallback);
                  descriptionError.setVisible(false);
                } else {
                  descriptionError.setVisible(true);
                }
              }
            });
          }
        }
    };
  Ode.getInstance().getGalleryService().isReportedByUser(app.getGalleryAppId(),
      isReportdByUserCallback);
}
 
Example 25
public TextAreaPropertyEditor() {
 super(new TextArea());

 textEdit.getElement().getStyle().setProperty("minHeight", MIN_CSS_HEIGHT);
 textEdit.getElement().getStyle().setProperty("maxWidth", MAX_CSS_WIDTH);
}
 
Example 26
Source Project: gwt-material   Source File: MaterialTextArea.java    License: Apache License 2.0 4 votes vote down vote up
public MaterialTextArea() {
    super(new TextArea());
    setType(InputType.TEXT);
    valueBoxBase.setStyleName(CssName.MATERIALIZE_TEXTAREA);
}
 
Example 27
Source Project: caja   Source File: PlaygroundEditor.java    License: Apache License 2.0 4 votes vote down vote up
public PlaygroundEditor() {
  feralTextArea = new TextArea();
  initWidget(feralTextArea);
}
 
Example 28
Source Project: swellrt   Source File: DebugDialog.java    License: Apache License 2.0 4 votes vote down vote up
/**
 * Initialisation code for the TextAreas
 *
 * @param area text area to initialise
 */
private void initTextArea(TextArea area) {
  area.setReadOnly(true);
  area.setVisibleLines(40);
  area.setCharacterWidth(80);
}
 
Example 29
Source Project: swellrt   Source File: EditorHarness.java    License: Apache License 2.0 4 votes vote down vote up
void initContentText() {
  contentBox = new TextArea();
  contentBox.getElement().setId("content-box");
}
 
Example 30
Source Project: gwt-traction   Source File: AutoSizingTextArea.java    License: Apache License 2.0 4 votes vote down vote up
private AutoSizingTextArea(TextAreaWithSelection box) {
super(box, new TextArea());
   }