Java Code Examples for com.google.gwt.user.client.ui.TextBox#setText()

The following examples show how to use com.google.gwt.user.client.ui.TextBox#setText() . 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: GalleryPage.java    From appinventor-extensions with Apache License 2.0 6 votes vote down vote up
/**
 * Helper method called by constructor to initialize the report section
 */
private void initAppShare() {
  final HTML sharePrompt = new HTML();
  sharePrompt.setHTML(MESSAGES.gallerySharePrompt());
  sharePrompt.addStyleName("primary-prompt");
  final TextBox urlText = new TextBox();
  urlText.addStyleName("action-textbox");
  urlText.setText(Window.Location.getHost() + MESSAGES.galleryGalleryIdAction() + app.getGalleryAppId());
  urlText.addClickHandler(new ClickHandler() {
    @Override
    public void onClick(ClickEvent event) {
      urlText.selectAll();
    }
  });
  appSharePanel.add(sharePrompt);
  appSharePanel.add(urlText);
}
 
Example 2
Source File: Toolbar.java    From djvu-html5 with GNU General Public License v2.0 6 votes vote down vote up
protected void zoomTypedIn() {
	if (pageLayout == null)
		return;
	TextBox zoomTextBox = zoomPanel.textBox;
	String digits = zoomTextBox.getText().replaceAll("[^0-9]", "");
	if (digits.isEmpty() || digits.length() > 6) {
		zoomTextBox.setText(pageLayout.getZoom() + "%");
		zoomTextBox.selectAll();
		return;
	}
	int zoom = Math.min(Integer.valueOf(digits), DjvuContext.getMaxZoom());
	zoom = Math.max(zoom, zoomOptions.get(zoomOptions.size() - 1));
	zoomPanel.selection.setSelectedIndex(-1);
	pageLayout.setZoom(zoom);
	zoomTextBox.setText(zoom + "%");
	zoomTextBox.setFocus(false);
}
 
Example 3
Source File: Toolbar.java    From djvu-html5 with GNU General Public License v2.0 6 votes vote down vote up
protected void pageTypedIn() {
	if (pageLayout == null)
		return;
	TextBox pageTextBox = pagePanel.textBox;
	String digits = pageTextBox.getText().replaceAll("[^0-9]", "");
	if (digits.isEmpty() || digits.length() > 6) {
		pageTextBox.setText(pagePanel.selection.getSelectedItemText());
		pageTextBox.selectAll();
		return;
	}
	int page = Math.min(Integer.valueOf(digits), pagesCount) - 1;
	page = Math.max(page, 0);
	pagePanel.selection.setSelectedIndex(page);
	pageLayout.setPage(page);
	pageTextBox.setFocus(false);
}
 
Example 4
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 5
Source File: MockListView.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
private void createFilterBox() {
  textBoxWidget = new TextBox();
  textBoxWidget.setText("Search list...");
  textBoxWidget.setSize(ComponentConstants.LISTVIEW_PREFERRED_WIDTH + "px",
      ComponentConstants.LISTVIEW_FILTER_PREFERRED_HEIGHT + "px");
  textBoxWidget.setVisible(false);
  listViewWidget.add(textBoxWidget);
}
 
Example 6
Source File: GpsEmulator.java    From android-gps-emulator with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize the Emulator UI
 */
private void initializeUI() {
   // Create textboxes and set default hostname and port
   _hostname = new TextBox();
   _hostname.setText(DEFAULT_HOST);
   _hostname.getElement().setPropertyString("placeholder", "hostname");
   _port = new TextBox();
   _port.setText(String.valueOf(DEFAULT_PORT));
   _port.getElement().setPropertyString("placeholder", "port");

   // Create button to connect
   _button = new Button("Connect");
   // Create the info/status label, initially not visible
   _info = new InlineLabel();
   _info.setVisible(false);

   // register the button action
   _button.addClickHandler(new ClickHandler() {
      public void onClick(final ClickEvent event) {
         final String hostname = _hostname.getText();
         final int port = Integer.valueOf(_port.getText());
         new PortAsyncCallback(hostname, port).execute();
      }
   });
   
   // Create panel for textbox, button and info label
   final FlowPanel div = new FlowPanel();
   div.setStylePrimaryName("emulator-controls");
   _hostname.setStyleName("emulator-hostname");
   _port.setStyleName("emulator-port");
   _button.setStyleName("emulator-connect");
   _info.setStyleName("emulator-info");
   div.add(_hostname);
   div.add(_port);
   div.add(_button);
   div.add(_info);

   // add the controls before the map so that the div doesn't cover the map
   RootLayoutPanel.get().add(div);
}
 
Example 7
Source File: InputSuggest.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void handleSuggestionSelected(IsWidget textInput, Oracle.Suggestion<T> suggestion) {
	TextBox input = (TextBox) textInput;
	T value = suggestion.getValue();
	String replacementString = getRenderer().render(value);
	input.setText(replacementString);
	input.setCursorPos(replacementString.length());

	T oldValue = InputSuggest.this.currentValue;
	InputSuggest.this.currentValue = value;
	ValueChangeEvent.fireIfNotEqual(InputSuggest.this, oldValue, value);
}
 
Example 8
Source File: GwtDebugPanelFilters.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Widget createNowLink(final TextBox textbox) {
  return new CommandLink("Now", new Command() {
    //@Override
    public void execute() {
      textbox.setText(FORMAT.format(new Date()));
    }
  });
}
 
Example 9
Source File: RBACContextView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Widget asWidget() {
    VerticalPanel container = new VerticalPanel();
    container.setStyleName("fill-layout");

    HorizontalPanel menu = new HorizontalPanel();
    menu.setStyleName("fill-layout-width");
    final TextBox nameBox = new TextBox();
    nameBox.setText(securityFramework.resolveToken());

    MultiWordSuggestOracle oracle = new  MultiWordSuggestOracle();
    oracle.addAll(Console.MODULES.getRequiredResourcesRegistry().getTokens());

    SuggestBox suggestBox = new SuggestBox(oracle, nameBox);

    Button btn = new Button("Show", new ClickHandler() {
        @Override
        public void onClick(ClickEvent clickEvent) {
            container.clear();

            try {
                container.add(createContent(nameBox.getText()));
            } catch (Throwable e) {
                HTML msg = new HTML(e.getMessage());
                msg.getElement().getStyle().setColor("red");
                container.add(msg);
            }
        }
    });
    menu.add(new HTML("Token: "));
    menu.add(suggestBox);
    menu.add(btn);


    VerticalPanel p = new VerticalPanel();
    p.setStyleName("fill-layout-width");
    p.add(menu);
    p.add(container);
    return p;
}
 
Example 10
Source File: SignInPageView.java    From core with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Inject
public SignInPageView() {
    userNameField = new TextBox();
    passwordField = new PasswordTextBox();
    signInButton = new Button("Sign in");
    signInButton.setStyleName("default-button");

    userNameField.setText("admin");

    panel.add(userNameField, "userNameFieldContainer");
    panel.add(passwordField, "passwordFieldContainer");
    panel.add(signInButton, "signInButtonContainer");

    panel.sinkEvents(Event.ONKEYDOWN);

    // dev options
    /*checkbox = new CheckBox();
    checkbox.addClickHandler(new ClickHandler(){
        @Override
        public void onClick(ClickEvent event) {
            presenter.setBootStandalone(checkbox.getValue());
        }
    });
    */
    HorizontalPanel options = new HorizontalPanel();
    options.getElement().setAttribute("style", "margin-top:20px; vertical-align:bottom;");
    options.getElement().setAttribute("align", "center");

    HTML version = new HTML("Version TBD");
    version.getElement().setAttribute("style", "color:#cccccc;font-size:10px; align:center");
    options.add(version);
    panel.add(options);

}
 
Example 11
Source File: SqlScriptFileConfigTable.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public void addRow(int row,String default_text){
	TextBox box = new TextBox();
	box.setText(default_text);
	addRow(row, box);
}
 
Example 12
Source File: PointInTimeDataReportsPage.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void reload(String history) {
	if (history == null) return;
	if (history.indexOf('&') >= 0)
		history = history.substring(0, history.indexOf('&')); 
	if (history.isEmpty()) return;
	String[] params = history.split(":");
	String id = params[0];
	PointInTimeDataReportsInterface.Report rpt = null;
	for (int i = 0; i < iReports.size(); i++) {
		PointInTimeDataReportsInterface.Report q = iReports.get(i);
		if (id.equals(q.getId())) {
			rpt = q;
			iReportSelector.getWidget().setSelectedIndex(1 + i);
			queryChanged();
			break;
		}
	}
	if (rpt == null) return;
	int idx = 1;
	for (int i = 0; i < iParameters.size(); i++) {
		PointInTimeDataReportsInterface.Parameter parameter = iParameters.get(i);
		if (rpt.parametersContain(parameter.getType())) {
			String param = params[idx++];
			if (param == null || param.isEmpty()) continue;
			if (parameter.isTextField()) {
				TextBox text = ((UniTimeWidget<TextBox>)iForm.getWidget(3 + i, 1)).getWidget();
				text.setText(param);
			} else {
				ListBox list = ((UniTimeWidget<ListBox>)iForm.getWidget(3 + i, 1)).getWidget();
				if (list.isMultipleSelect()) {
					for (int j = 0; j < list.getItemCount(); j++) {
						String value = list.getValue(j);
						boolean contains = false;
						for (String o: param.split(",")) if (o.equals(value)) { contains = true; break; }
						list.setItemSelected(j, contains);
					}
				} else {
					for (int j = 1; j < list.getItemCount(); j++) {
						if (list.getValue(j).equals(param)) {
							list.setSelectedIndex(j); break;
						}
					}
				}
			}
		}
	}
	iLastSort = Integer.parseInt(params[idx++]);
	execute();
}
 
Example 13
Source File: OpacityDemo.java    From gwt-traction with Apache License 2.0 4 votes vote down vote up
private static final TextBox createTextBox(String text) {
TextBox ret = new TextBox();
ret.setVisibleLength(10);
ret.setText(text);
return ret;
   }
 
Example 14
Source File: ColorDemo.java    From gwt-traction with Apache License 2.0 4 votes vote down vote up
private static final TextBox createTextBox(String text) {
TextBox ret = new TextBox();
ret.setVisibleLength(20);
ret.setText(text);
return ret;
   }