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

The following examples show how to use com.google.gwt.user.client.ui.TextBox. 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: 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 #2
Source File: CourseNumbersSuggestBox.java    From unitime with 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 #3
Source File: MapWidget.java    From unitime with 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 File: GalleryList.java    From appinventor-extensions with 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 #5
Source File: LabeledTextBox.java    From appinventor-extensions with 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 #6
Source File: InputDateBox.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
public InputDateBox() {
	super(new TextBox());
	StyleUtils.addStyle(this, AbstractInput.STYLE_CONTROL);

	this.maskHelper = new MaskValueBoxHelper(this.getInput());
	this.setFormat(this.params.inputDateSimpleFormat());
}
 
Example #7
Source File: InputNumber.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 #8
Source File: InputNumber.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
@UiConstructor
public InputNumber(NumberType type) {
	super(new TextBox());
	this.type = type;
	this.maskHelper = new MaskValueBoxHelper(this.getInput());
	this.reset();
}
 
Example #9
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 #10
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 #11
Source File: InputSuggest.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 File: LabeledTextBox.java    From appinventor-extensions with 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
Source File: ComponentImportWizard.java    From appinventor-extensions with Apache License 2.0 5 votes vote down vote up
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 File: UrlImportWizard.java    From appinventor-extensions with 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 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 #16
Source File: FileTextBox.java    From document-management-system with GNU General Public License v2.0 5 votes vote down vote up
/**
 * 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 File: CurriculaClassifications.java    From unitime with 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 File: CurriculaClassifications.java    From unitime with 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 File: CurriculaClassifications.java    From unitime with 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 File: CurriculaClassifications.java    From unitime with 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
Source File: InputEmail.java    From putnami-web-toolkit with GNU Lesser General Public License v3.0 5 votes vote down vote up
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 File: CurriculaClassifications.java    From unitime with 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 File: MapWidget.java    From unitime with 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
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 #25
Source File: CurriculaClassifications.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void setExpected(int column, Integer expected) {
	((TextBox)iTable.getWidget(4, 1 + column)).setText(expected == null ? "" : expected.toString());
}
 
Example #26
Source File: CurriculaClassifications.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void setName(int column, String name) {
	((TextBox)iTable.getWidget(0, 1 + column)).setText(name);
}
 
Example #27
Source File: SignInPageView.java    From core with GNU Lesser General Public License v2.1 4 votes vote down vote up
public TextBox getPassword() {
    return passwordField;
}
 
Example #28
Source File: CurriculaClassifications.java    From unitime with Apache License 2.0 4 votes vote down vote up
public void setEnrollment(int column, Integer enrollment) {
	((TextBox)iTable.getWidget(5, 1 + column)).setText(enrollment == null || enrollment == 0 ? "" : enrollment.toString());
}
 
Example #29
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;
   }
 
Example #30
Source File: AdminView.java    From EasyML with Apache License 2.0 4 votes vote down vote up
public TextBox getProgName(){
	return progName;
}