本文整理匯總了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;
}
}