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

The following examples show how to use com.google.gwt.user.client.ui.TextBox. 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: appinventor-extensions   Source File: GalleryList.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates the GUI components for search tab.
 *
 * @param searchApp: the FlowPanel that search tab will reside.
 */
private void addGallerySearchTab(FlowPanel searchApp) {
  // Add search GUI
  FlowPanel searchPanel = new FlowPanel();
  final TextBox searchText = new TextBox();
  searchText.addStyleName("gallery-search-textarea");
  Button sb = new Button(MESSAGES.gallerySearchForAppsButton());
  searchPanel.add(searchText);
  searchPanel.add(sb);
  searchPanel.addStyleName("gallery-search-panel");
  searchApp.add(searchPanel);
  appSearchContent.addStyleName("gallery-search-results");
  searchApp.add(appSearchContent);
  searchApp.addStyleName("gallery-search");

  sb.addClickHandler(new ClickHandler() {
    //  @Override
    public void onClick(ClickEvent event) {
      gallery.FindApps(searchText.getText(), 0, NUMAPPSTOSHOW, 0, true);
    }
  });
}
 
Example 2
Source Project: appinventor-extensions   Source File: LabeledTextBox.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates a new TextBox with the given leading caption.
 *
 * @param caption  caption for leading label
 */
public LabeledTextBox(String caption) {
  HorizontalPanel panel = new HorizontalPanel();
  Label label = new Label(caption);
  panel.add(label);
  panel.setCellVerticalAlignment(label, HasVerticalAlignment.ALIGN_MIDDLE);
  textbox = new TextBox();
  textbox.setStylePrimaryName("ode-LabeledTextBox");
  textbox.setWidth("100%");
  panel.add(textbox);
  panel.setCellWidth(label, "40%");
  panel.setCellVerticalAlignment(textbox, HasVerticalAlignment.ALIGN_MIDDLE);

  initWidget(panel);

  setWidth("100%");
}
 
Example 3
Source Project: unitime   Source File: MapWidget.java    License: Apache License 2.0 6 votes vote down vote up
public static void insert(final RootPanel panel) {
	RPC.execute(new MapPropertiesRequest(), new AsyncCallback<MapPropertiesInterface>() {
		@Override
		public void onFailure(Throwable caught) {
		}

		@Override
		public void onSuccess(MapPropertiesInterface result) {
			MapWidget map = MapWidget.createMap(TextBox.wrap(Document.get().getElementById("coordX")), TextBox.wrap(Document.get().getElementById("coordY")), result);
			if (map != null) {
				panel.add(map);
				panel.setVisible(true);
				map.onShow();
			}
		}
	});
}
 
Example 4
Source Project: unitime   Source File: CourseNumbersSuggestBox.java    License: Apache License 2.0 6 votes vote down vote up
private String getConfiguration() {
	String conf = iConfiguration;
	for (MatchResult matcher = iRegExp.exec(conf); matcher != null; matcher = iRegExp.exec(conf)) {
		Element element = DOM.getElementById(matcher.getGroup(1));
		String value = "";
		if ("select".equalsIgnoreCase(element.getTagName())) {
			ListBox list = ListBox.wrap(element);
			for (int i = 0; i < list.getItemCount(); i++) {
				if (list.isItemSelected(i))
					value += (value.isEmpty() ? "" : ",") + list.getValue(i);
			}
		} else if ("input".equalsIgnoreCase(element.getTagName())) {
			TextBox text = TextBox.wrap(element);
			value = text.getText();
		} else {
			Hidden hidden = Hidden.wrap(element);
			value = hidden.getValue();
		}
		conf = conf.replace("${" + matcher.getGroup(1) + "}", value);
	}
	return conf;
}
 
Example 5
Source Project: djvu-html5   Source File: Toolbar.java    License: 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 6
private Widget createNowLink(final TextBox textbox) {
  return new CommandLink("Now", new Command() {
    //@Override
    public void execute() {
      textbox.setText(FORMAT.format(new Date()));
    }
  });
}
 
Example 7
@UiConstructor
public InputNumber(NumberType type) {
	super(new TextBox());
	this.type = type;
	this.maskHelper = new MaskValueBoxHelper(this.getInput());
	this.reset();
}
 
Example 8
protected InputNumber(InputNumber<N> source) {
	super(new TextBox(), source);
	this.type = source.type;
	this.signed = source.signed;
	this.maskHelper = new MaskValueBoxHelper(this.getInput());
	this.reset();
}
 
Example 9
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 10
Source Project: android-gps-emulator   Source File: GpsEmulator.java    License: 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 11
public InputSuggest() {
	super(new TextBox());
	this.oracle = new OracleWrapper<T>();
	this.setParser((Parser<T>) StringParser.get());
	this.setRenderer(ToStringRenderer.<T> get());
	this.init();
}
 
Example 12
Source Project: appinventor-extensions   Source File: LabeledTextBox.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Use this TextBox if you want to have text validation while a user is typing
 *
 * @param caption    caption for leading label
 * @param validator  The validator to use for a specific textBox
 */
public LabeledTextBox(String caption, Validator validator) {
  this.validator = validator;

  HorizontalPanel panel = new HorizontalPanel();
  Label label = new Label(caption);
  panel.add(label);
  panel.setCellVerticalAlignment(label, HasVerticalAlignment.ALIGN_MIDDLE);
  textbox = new TextBox();
  textbox.setStylePrimaryName("ode-LabeledTextBox");
  defaultTextBoxColor = textbox.getElement().getStyle().getBorderColor();
  textbox.setWidth("100%");
  panel.add(textbox);
  panel.setCellWidth(label, "40%");
  panel.setCellVerticalAlignment(textbox, HasVerticalAlignment.ALIGN_MIDDLE);

  HorizontalPanel errorPanel = new HorizontalPanel();
  errorLabel = new Label("");
  errorPanel.add(errorLabel);

  VerticalPanel vp = new VerticalPanel();
  vp.add(panel);
  vp.add(errorPanel);
  vp.setHeight("85px");

  initWidget(vp);

  setWidth("100%");
}
 
Example 13
private Grid createUrlGrid() {
  TextBox urlTextBox = new TextBox();
  urlTextBox.setWidth("100%");
  Grid grid = new Grid(2, 1);
  grid.setWidget(0, 0, new Label("Url:"));
  grid.setWidget(1, 0, urlTextBox);
  return grid;
}
 
Example 14
Source Project: appinventor-extensions   Source File: UrlImportWizard.java    License: Apache License 2.0 5 votes vote down vote up
private static Grid createUrlGrid() {
  TextBox urlTextBox = new TextBox();
  urlTextBox.setWidth("100%");
  Grid grid = new Grid(2, 1);
  grid.setWidget(0, 0, new Label("Url:"));
  grid.setWidget(1, 0, urlTextBox);
  return grid;
}
 
Example 15
Source Project: appinventor-extensions   Source File: MockListView.java    License: 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 16
/**
 * File textBox
 */
public FileTextBox() {
	textBox = new TextBox();
	textBox.addKeyUpHandler(new KeyUpHandler() {
		@Override
		public void onKeyUp(KeyUpEvent event) {
			switch (event.getNativeKeyCode()) {
				case (char) KeyCodes.KEY_ENTER:
					switch (action) {
						case ACTION_RENAME:
							if (textBox.getText().length() > 0) {
								Main.get().mainPanel.desktop.browser.fileBrowser.rename(textBox.getText());
							} else {
								Main.get().mainPanel.desktop.browser.fileBrowser.hideRename();
							}
							break;
					}
					Main.get().mainPanel.enableKeyShorcuts(); // Enables general keys applications
					break;

				case (char) KeyCodes.KEY_ESCAPE:
					switch (action) {
						case ACTION_RENAME:
							Main.get().mainPanel.desktop.browser.fileBrowser.hideRename();
							break;
					}
					Main.get().mainPanel.enableKeyShorcuts(); // Enables general keys applications
					break;
			}
		}
	});
	textBox.setVisibleLength(20);
	textBox.setStyleName("okm-FileBrowser-TextBox");
	initWidget(textBox);
}
 
Example 17
Source Project: unitime   Source File: CurriculaClassifications.java    License: Apache License 2.0 5 votes vote down vote up
public Integer getEnrollment(int column) {
	String text = ((TextBox)iTable.getWidget(5, 1 + column)).getText();
	if (text.isEmpty()) return null;
	try {
		return Integer.parseInt(text);
	} catch (Exception e) {
		return null;
	}
}
 
Example 18
Source Project: unitime   Source File: CurriculaClassifications.java    License: Apache License 2.0 5 votes vote down vote up
public Integer getLastLike(int column) {
	String text = ((TextBox)iTable.getWidget(2, 1 + column)).getText();
	if (text.isEmpty()) return null;
	try {
		return Integer.parseInt(text);
	} catch (Exception e) {
		return null;
	}
}
 
Example 19
Source Project: unitime   Source File: CurriculaClassifications.java    License: Apache License 2.0 5 votes vote down vote up
public Integer getProjection(int column) {
	String text = ((TextBox)iTable.getWidget(3, 1 + column)).getText();
	if (text.isEmpty()) return null;
	try {
		return Integer.parseInt(text);
	} catch (Exception e) {
		return null;
	}
}
 
Example 20
Source Project: unitime   Source File: CurriculaClassifications.java    License: Apache License 2.0 5 votes vote down vote up
public Integer getRequested(int column) {
	String text = ((TextBox)iTable.getWidget(6, 1 + column)).getText();
	if (text.isEmpty()) return null;
	try {
		return Integer.parseInt(text);
	} catch (Exception e) {
		return null;
	}
}
 
Example 21
public InputEmail() {
	super(new TextBox());

	this.setParser(StringParser.get());
	this.setRenderer(StringRenderer.get());

	this.addValidator(new EmailValidator());
	this.getInput().addKeyPressHandler(InputEmail.EMAIL_CHAR_VALIDATOR);
}
 
Example 22
Source Project: unitime   Source File: CurriculaClassifications.java    License: Apache License 2.0 5 votes vote down vote up
public Integer getSnapshotProjection(int column) {
	String text = ((TextBox)iTable.getWidget(8, 1 + column)).getText();
	if (text.isEmpty()) return null;
	try {
		return Integer.parseInt(text);
	} catch (Exception e) {
		return null;
	}
}
 
Example 23
Source Project: unitime   Source File: MapWidget.java    License: Apache License 2.0 5 votes vote down vote up
protected static MapWidget createMap(TextBox x, TextBox y, MapPropertiesInterface result) {
	if (result.isGoogleMap())
		return new GoogleMap(x, y, result.getGoogleMapApiKey());
	if (result.isLeafletMap())
		return new LeafletMap(x, y, result.getLeafletMapTiles(), result.getLeafletMapAttribution());
	return null;
}
 
Example 24
public InputDateBox() {
	super(new TextBox());
	StyleUtils.addStyle(this, AbstractInput.STYLE_CONTROL);

	this.maskHelper = new MaskValueBoxHelper(this.getInput());
	this.setFormat(this.params.inputDateSimpleFormat());
}
 
Example 25
Source Project: gwt-traction   Source File: OpacityDemo.java    License: 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 26
Source Project: EasyML   Source File: AccountView.java    License: Apache License 2.0 4 votes vote down vote up
public TextBox getUsrBox(){
	return usrBox;
}
 
Example 27
Source Project: EasyML   Source File: AccountView.java    License: Apache License 2.0 4 votes vote down vote up
public TextBox getCmpBox(){
	return cmpBox;
}
 
Example 28
Source Project: EasyML   Source File: AccountView.java    License: Apache License 2.0 4 votes vote down vote up
public TextBox getPstBox(){
	return pstBox;
}
 
Example 29
Source Project: gwt-traction   Source File: OpacityDemo.java    License: Apache License 2.0 4 votes vote down vote up
private static final void addTextBox(Panel panel, String label, TextBox box) {
panel.add(new Label(label));
panel.add(box);
   }
 
Example 30
Source Project: EasyML   Source File: RegisterView.java    License: Apache License 2.0 4 votes vote down vote up
public TextBox getVerpwdBox(){
	return verBox;
}