本文整理汇总了Java中com.google.gwt.user.client.ui.TextBox.setText方法的典型用法代码示例。如果您正苦于以下问题:Java TextBox.setText方法的具体用法?Java TextBox.setText怎么用?Java TextBox.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.TextBox
的用法示例。
在下文中一共展示了TextBox.setText方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: zoomTypedIn
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
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);
}
示例3: test01
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
/**
* Binding of a DTO property to a TextBox
*/
public void test01() {
DTO dto = new DTO();
TextBox box = new TextBox();
Binder.bind(dto, "name").to(box);
dto.setName("toto");
assertEquals("toto", box.getValue());
box.setValue("titi", true);
assertEquals("titi", dto.getName());
/**
* The setText method doesn't throw an event so the
* value does not get updated in b2.
* Note that if the user changes the text and leaves
* the text box, it will trigger an event and activate
* the data binding
*/
box.setText("tata");
assertEquals("titi", dto.getName());
}
示例4: pageTypedIn
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
protected void pageTypedIn() {
if (pageLayout == null)
return;
TextBox pageTextBox = pagePanel.textBox;
String digits = pageTextBox.getText().replaceAll("[^0-9]", "");
if (digits.isEmpty() || digits.length() > 6) {
pageTextBox.setText(pagePanel.selection.getSelectedItemText());
pageTextBox.selectAll();
return;
}
int page = Math.min(Integer.valueOf(digits), pagesCount) - 1;
page = Math.max(page, 0);
pagePanel.selection.setSelectedIndex(page);
pageLayout.setPage(page);
pageTextBox.setFocus(false);
}
示例5: 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;
}
示例6: getVerifyPanel
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
private static HTMLPanel getVerifyPanel() {
HTMLPanel verifyPanel = new HTMLPanel(GerritCiPlugin.verifyJobPanel.toString());
TextBox verifyCommand = new TextBox();
verifyCommand.setName("verifyCommand");
verifyCommand.setText("./scripts/verify.sh");
TextBox verifyBranchRegex = new TextBox();
verifyBranchRegex.setName("verifyBranchRegex");
verifyBranchRegex.setText(".*");
TextBox jobType = new TextBox();
jobType.setText("verify");
jobType.setName("jobType");
jobType.setVisible(false);
verifyPanel.add(jobType);
verifyPanel.addAndReplaceElement(verifyCommand, "verifyCommand");
verifyPanel.addAndReplaceElement(verifyBranchRegex, "verifyBranchRegex");
addCommonFields(verifyPanel);
return verifyPanel;
}
示例7: test02
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
/**
* Bind two TextBox together
*/
public void test02() {
TextBox b1 = new TextBox();
TextBox b2 = new TextBox();
Binder.bind(b1).to(b2);
b2.setValue("titi", true);
assertEquals("titi", b1.getText());
/**
* The setText method doesn't throw an event so the
* value does not get updated in b2.
* Note that if the user changes the text and leaves
* the text box, it will trigger an event and activate
* the data binding
*/
b1.setText("toto");
assertEquals("titi", b2.getValue());
}
示例8: createFilterBox
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
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);
}
示例9: addHiddenUploadFormParameter
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
/**
* Allows to add the hidden file upload form parameters, which will be send to the server.
* Create a TextBox, giving it a name so that it will be submitted. From descendant dialogs,
* has to be called only after the dialog is populated, i.e. the populateDialog() is executed.
* @param fieldName the name of the parameter to add
* @param fieldValue the value of the parameter to add
*/
protected void addHiddenUploadFormParameter( final String fieldName, final String fieldValue){
final TextBox field = new TextBox();
field.setVisible(false);
field.setName( fieldName );
field.setText( fieldValue );
verticalPanel.add( field );
}
示例10: addTextBox
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
/**
* To add Text Box.
*
* @param row int
* @param dto BatchClassPluginConfigDTO
* @param readOnly boolean
* @return ValidatableWidget<TextBox>
*/
public ValidatableWidget<TextBox> addTextBox(int row, final BatchClassPluginConfigDTO dto, boolean readOnly) {
TextBox fieldValue = new TextBox();
fieldValue.setReadOnly(readOnly);
fieldValue.setWidth("160px");
fieldValue.setName(dto.getPluginConfig().getFieldName());
fieldValue.setText(dto.getValue());
final ValidatableWidget<TextBox> validatableTextBox = new ValidatableWidget<TextBox>(fieldValue);
if (!readOnly && dto.getPluginConfig() != null) {
validatableTextBox.addValidator((Validator) ValidatorFactory.getValidator(dto.getDataType(), fieldValue));
validatableTextBox.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() {
@Override
public void onValueChange(ValueChangeEvent<String> event) {
if (!dto.isMandatory() && validatableTextBox.getWidget().getText().isEmpty()) {
validatableTextBox.getWidget().removeStyleName(AdminConstants.DATE_BOX_FORMAT_ERROR);
} else {
validatableTextBox.toggleValidDateBox();
}
}
});
if (!dto.isMandatory() && validatableTextBox.getWidget().getText().isEmpty()) {
validatableTextBox.getWidget().removeStyleName(AdminConstants.DATE_BOX_FORMAT_ERROR);
} else {
validatableTextBox.toggleValidDateBox();
}
if (dto.isMandatory()) {
validatableTextBox.addValidator(new EmptyStringValidator(validatableTextBox.getWidget()));
}
}
return validatableTextBox;
}
示例11: renameItem
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
protected void renameItem() {
final int i = savedItems.getSelectedIndex();
if (i >= 0) {
final String name = savedItems.getItemText(i);
final String item = savedItems.getValue(i);
final TextBox field = new TextBox();
field.setText(name);
ApplicationPanel.showDialogBox("Rename Item", field,
ApplicationPanel.OK | ApplicationPanel.CANCEL,
new DialogBoxResultHandler() {
@Override
public void dialogBoxResult(int result) {
if (result == ApplicationPanel.OK) {
JsoArray<Entry> list = removeItem(
getSavedItems(), name, item);
Entry e = (Entry) JavaScriptObject
.createObject();
e.setName(field.getText());
e.setItem(item);
list.push(e);
saveItems(list);
savedItems.removeItem(i);
savedItems.insertItem(e.getName(), item, i);
savedItems.setSelectedIndex(i);
}
}
});
}
}
示例12: ChangeAppNamePopup
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public ChangeAppNamePopup(PreferencesCompletionCallback settingsChange) {
super();
this.settingsChange = settingsChange;
appNameBox = new TextBox();
appNameBox.setText(Preferences.getAppName());
FlexTable layout = new FlexTable();
layout.setWidget(0, 0, new HTML("Change ODK 2.0 App Name"));
layout.setWidget(1, 0, new HTML("App Name:"));
layout.setWidget(1, 1, appNameBox);
AggregateButton changeAppNameButton = new AggregateButton(BUTTON_TXT, TOOLTIP_TXT,
HELP_BALLOON_TXT);
changeAppNameButton.addClickHandler(new ChangeAppNameHandler());
layout.setWidget(3, 0, changeAppNameButton);
layout.setWidget(3, 1, new ClosePopupButton(this));
setWidget(layout);
}
示例13: render
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public Widget render(Row row, Column column, Object value) {
if(value == null || !(value instanceof String)) {
return null;
} else {
TextBox textbox = new TextBox();
textbox.setText((String)value);
if(_maxLength > 0) textbox.setMaxLength(_maxLength);
if(_visibleLength > 0) textbox.setVisibleLength(_visibleLength);
if(_title != null) textbox.setTitle(_title);
return textbox;
}
}
示例14: getFieldValue
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
protected String getFieldValue(TextBox field, String defaultValue) {
String value = field.getValue();
if ((value != null) && (value.length() > 0))
return field.getValue();
field.setText(defaultValue);
return defaultValue;
}
示例15: loadRDCs
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
protected void loadRDCs( JSONValue response ) {
if( response.isObject() == null ) return;
int num = 0;
for( String key : response.isObject().keySet() ) {
JSONObject o = response.isObject().get( key ).isObject();
JSONArray jpn = o.get( "params" ).isArray();
grid.resize( grid.getRowCount() + jpn.size() +1, 3 );
// grid.setWidget( num, 0, new CheckBox() );
grid.setWidget( num, 1, new Label( key ) );
for( int p = 0; p < jpn.size(); p++ ) {
num++;
JSONObject par = jpn.get( p ).isObject();
grid.setWidget( num, 0,
new Label( par.get( "name" ).isString().stringValue() ) );
TextBox txt = new TextBox();
if( par.get( "def" ).isString() != null )
txt.setText( par.get( "def" ).isString().stringValue() );
grid.setWidget( num, 1, txt );
if( (par.get( "desc" ).isString() != null) & (par.get( "ex" ).isString() != null ) ) {
// txt.setTitle(
// par.get( "desc" ).isString().stringValue() + " "
// + "Example: " + par.get( "ex" ).isString().stringValue() );
grid.setWidget( num, 2, new HTML(
par.get( "desc" ).isString().stringValue() +
"<br>" +
"Example: " + par.get( "ex" ).isString().stringValue()
) );
}
}
num++;
}
RootPanel.get().add( grid );
}