當前位置: 首頁>>代碼示例>>Java>>正文


Java TextBox類代碼示例

本文整理匯總了Java中com.google.gwt.user.client.ui.TextBox的典型用法代碼示例。如果您正苦於以下問題:Java TextBox類的具體用法?Java TextBox怎麽用?Java TextBox使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TextBox類屬於com.google.gwt.user.client.ui包,在下文中一共展示了TextBox類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: validateInput

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
private void validateInput(TextBox input) {
	String inputStr = input.getValue();
	boolean valid = inputStr.matches("^\\d+$");
	
	if (valid) {
		input.getElement().removeClassName("invalid");
	} else {
		input.getElement().addClassName("invalid");
	}
	
	if (input == widthInput) {
		widthValid = valid;
	} else {
		heightValid = valid;
	}
}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:17,代碼來源:SlidingToolbar.java

示例2: init

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
protected void init(){

		//Panel information
		this.setWidget(0,0,url);
		urlTB = new TextBox();
		urlTB.setStyleName("bda-etlpanel-textbox");
		this.setWidget(0,1,urlTB);

		this.setWidget(1,0,user);
		userTB = new TextBox();
		userTB.setStyleName("bda-etlpanel-textbox");
		this.setWidget(1,1,userTB);

		this.setWidget(2,0,password);
		passwordTB = new TextBox();
		passwordTB.setStyleName("bda-etlpanel-textbox");
		this.setWidget(2,1,passwordTB);


	}
 
開發者ID:ICT-BDA,項目名稱:EasyML,代碼行數:21,代碼來源:SqlETLGrid.java

示例3: getConfiguration

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
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;
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:23,代碼來源:CourseNumbersSuggestBox.java

示例4: initAppShare

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:20,代碼來源:GalleryPage.java

示例5: addGallerySearchTab

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
/**
 * 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);
    }
  });
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:27,代碼來源:GalleryList.java

示例6: LabeledTextBox

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
/**
 * 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);
  textbox = new TextBox();
  defaultTextBoxColor = textbox.getElement().getStyle().getBorderColor();
  textbox.setWidth("100%");
  panel.add(textbox);
  panel.setCellWidth(label, "40%");

  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%");
}
 
開發者ID:mit-cml,項目名稱:appinventor-extensions,代碼行數:32,代碼來源:LabeledTextBox.java

示例7: validateInput

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
private void validateInput() {
	String value = "";
	switch (inputType) {
		case TEXTBOX:
			value = ((TextBox)input).getValue();
			break;
		case TEXTAREA:
			value = ((TextArea)input).getValue();
			break;
		case PASSWORD:
			value = ((PasswordTextBox)input).getValue();
			break;
	}
	if (isOptional && value.length() == 0) {
		setInputValid(true);
	} else {
		if (validationStr != null) {
			setInputValid(value.matches(validationStr));
		} else {
			setInputValid(true);
		}
	}
}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:24,代碼來源:FormField.java

示例8: getState

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
public Map<String, String> getState() {
	Map<String, String> state = new HashMap<String, String>();
	for (Iterator widIt = widgets.iterator(); widIt.hasNext();) {
		Widget w = (Widget) widIt.next();
		if (w instanceof TextBox) {
			TextBox t = (TextBox) w;
			if (t.getText() != null && !t.getText().equals("")) {
				state.put(t.getName(), t.getText());
			}
		} else if (w instanceof ListBox) {
			ListBox l = (ListBox) w;
			state.put(l.getName(), l.getValue(l.getSelectedIndex()));
		}
	}
	return state;
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:17,代碼來源:OptionsWidget.java

示例9: createAutoCompleteWithChangeListener

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
private Autocomplete createAutoCompleteWithChangeListener(TextBox searchBox) {
    Element element = searchBox.getElement();
    final Autocomplete autoComplete = Autocomplete.newInstance(element, getAutoCompleteOptions());

    autoComplete.addPlaceChangeHandler(event -> {

        PlaceResult result = autoComplete.getPlace();

        PlaceGeometry geometry = result.getGeometry();
        LatLng center = geometry.getLocation();

        getMapWidget().panTo(center);
        getMapWidget().setZoom(ZOOM);
    });
    return autoComplete;
}
 
開發者ID:baldram,項目名稱:tristar-eye,代碼行數:17,代碼來源:ClassicMapService.java

示例10: swap

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
/**
 * Swaps a TextBox with an element of the same type for remember password. The text box needs to be within an panel. The styles of the text box are also
 * copied
 * 
 * @param textBox
 * @param elementId
 * @return
 */
@SuppressWarnings("unchecked")
public static <T extends TextBox> T swap (T textBox, String elementId) {
	Panel parent = (Panel) textBox.getParent();
	T newTextBox = null;

	if (textBox instanceof PasswordTextBox) {
		newTextBox = (T) PasswordTextBox
				.wrap(DOM.getElementById(elementId));
	} else if (textBox instanceof TextBox) {
		newTextBox = (T) TextBox.wrap(DOM.getElementById(elementId));
	}

	newTextBox.getElement().setAttribute("class",
			textBox.getElement().getAttribute("class"));
	newTextBox.removeFromParent();
	parent.getElement().insertBefore(newTextBox.getElement(),
			textBox.getElement());

	textBox.removeFromParent();

	return newTextBox;
}
 
開發者ID:billy1380,項目名稱:blogwt,代碼行數:31,代碼來源:UiHelper.java

示例11: getPublishPanel

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
private static HTMLPanel getPublishPanel() {
    HTMLPanel publishPanel = new HTMLPanel(GerritCiPlugin.publishJobPanel.toString());
    TextBox publishCommand = new TextBox();
    publishCommand.setName("publishCommand");
    publishCommand.setText("./scripts/publish.sh");
    TextBox publishBranchRegex = new TextBox();
    publishBranchRegex.setName("publishBranchRegex");
    publishBranchRegex.setText("refs/heads/(develop|master)");
    TextBox jobType = new TextBox();
    jobType.setText("publish");
    jobType.setName("jobType");
    jobType.setVisible(false);
    publishPanel.add(jobType);
    publishPanel.addAndReplaceElement(publishCommand, "publishCommand");
    publishPanel.addAndReplaceElement(publishBranchRegex, "publishBranchRegex");
    addCommonFields(publishPanel);
    return publishPanel;
}
 
開發者ID:palantir,項目名稱:gerrit-ci,代碼行數:19,代碼來源:JobPanels.java

示例12: getSnapshotExpected

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
public Integer getSnapshotExpected(int column) {
	String text = ((TextBox)iTable.getWidget(7, 1 + column)).getText();
	if (text.isEmpty()) return null;
	try {
		return Integer.parseInt(text);
	} catch (Exception e) {
		return null;
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:10,代碼來源:CurriculaClassifications.java

示例13: getProjection

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
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;
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:10,代碼來源:CurriculaClassifications.java

示例14: getRequested

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
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;
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:10,代碼來源:CurriculaClassifications.java

示例15: getSnapshotProjection

import com.google.gwt.user.client.ui.TextBox; //導入依賴的package包/類
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;
	}
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:10,代碼來源:CurriculaClassifications.java


注:本文中的com.google.gwt.user.client.ui.TextBox類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。