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

The following examples show how to use com.google.gwt.user.client.ui.TextArea. 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 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 #2
Source File: TopologyPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 #3
Source File: StandaloneServerPresenter.java    From core with GNU Lesser General Public License v2.1 6 votes vote down vote up
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 #4
Source File: XmlDebugPanel.java    From core with 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 #5
Source File: ClipboardSupport.java    From jetpad-projectional-open-source with Apache License 2.0 6 votes vote down vote up
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 #6
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 #7
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 #8
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 #9
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 #10
Source File: StdPanel.java    From EasyML with 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 File: InputTextArea.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected InputTextArea(InputTextArea source) {
	super(new TextArea(), source);
	this.setMaxLength(source.getMaxLength());
	if (source.rows != null) {
		this.setRows(source.rows);
	}
}
 
Example #12
Source File: ScriptParameterPanel.java    From EasyML with 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 #13
Source File: ClipboardSupport.java    From jetpad-projectional-open-source with Apache License 2.0 5 votes vote down vote up
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 #14
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);
    }
}
 
Example #15
Source File: ClipboardSupport.java    From jetpad-projectional-open-source with Apache License 2.0 5 votes vote down vote up
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 #16
Source File: GalleryPage.java    From appinventor-extensions with 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 #17
Source File: SqlScriptParameterPanel.java    From EasyML with 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 #18
Source File: GalleryPage.java    From appinventor-extensions with 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 #19
Source File: WordCloudApp.java    From swcv with 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 #20
Source File: InputTextArea.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 4 votes vote down vote up
public InputTextArea() {
	super(new TextArea());

	this.setParser(StringParser.get());
	this.setRenderer(StringRenderer.get());
}
 
Example #21
Source File: PreviewPopupPanel.java    From EasyML with 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 File: DebugDialog.java    From incubator-retired-wave with 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 #23
Source File: EditorHarness.java    From incubator-retired-wave with Apache License 2.0 4 votes vote down vote up
void initContentText() {
  contentBox = new TextArea();
  contentBox.getElement().setId("content-box");
}
 
Example #24
Source File: ScriptParameterPanel.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public TextArea getScriptArea() {
	return scriptArea;
}
 
Example #25
Source File: XmlDebugPanel.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public TextArea getTextArea() {
  return textArea;
}
 
Example #26
Source File: GalleryPage.java    From appinventor-extensions with 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 #27
Source File: AutoSizingTextArea.java    From gwt-traction with Apache License 2.0 4 votes vote down vote up
public AutoSizingTextArea(TextAreaWithSelection box, int minSize, int maxSize) {
super(box, new TextArea());
setMinSize(minSize);
setMaxSize(maxSize);
   }
 
Example #28
Source File: AutoSizingTextArea.java    From gwt-traction with Apache License 2.0 4 votes vote down vote up
private AutoSizingTextArea(TextAreaWithSelection box) {
super(box, new TextArea());
   }
 
Example #29
Source File: SqlScriptParameterPanel.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public TextArea getScriptArea() {
	return scriptArea;
}
 
Example #30
Source File: PreviewPopupPanel.java    From EasyML with Apache License 2.0 4 votes vote down vote up
/**
 * @return the fileTextArea
 */
public TextArea getFileTextArea() {
	return fileTextArea;
}