本文整理汇总了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;
}
}
示例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);
}
示例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;
}
示例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);
}
示例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);
}
});
}
示例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%");
}
示例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);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
}