本文整理汇总了Java中com.google.gwt.user.client.ui.TextBox.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java TextBox.setValue方法的具体用法?Java TextBox.setValue怎么用?Java TextBox.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.TextBox
的用法示例。
在下文中一共展示了TextBox.setValue方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: DownloadPopupPanel
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public DownloadPopupPanel(final String uxfUrl, final String pngUrl, final FilenameHolder filenameHolder) {
super(true, Type.POPUP);
setHeader("Export Diagram");
FlowPanel panel = new FlowPanel();
HTML w = new HTML("Optionally set a filename");
panel.add(w);
final TextBox textBox = new TextBox();
panel.add(textBox);
textBox.setValue(filenameHolder.getFilename());
final HTML downloadLinkHtml = new HTML(createDownloadLinks(uxfUrl, pngUrl, filenameHolder.getFilename()));
panel.add(downloadLinkHtml);
panel.add(new HTML("<div style=\"color:gray;\">To change the target directory</div><div style=\"color:gray;\">use \"Right click -> Save as\"</div>"));
setWidget(panel);
// listen to all input events from the browser (http://stackoverflow.com/a/43089693)
textBox.addDomHandler(new InputHandler() {
@Override
public void onInput(InputEvent event) {
filenameHolder.setFilename(textBox.getText());
downloadLinkHtml.setHTML(createDownloadLinks(uxfUrl, pngUrl, filenameHolder.getFilename()));
}
}, InputEvent.getType());
}
示例2: 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());
}
示例3: 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());
}
示例4: onSelection
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
/**
* @see com.google.gwt.event.logical.shared.SelectionHandler#onSelection(com.google.gwt.event.logical.shared.SelectionEvent)
*/
@Override
public void onSelection(SelectionEvent<TreeItem> event) {
if ( (view != null) && (event != null) ) {
Object source = event.getSource();
// Only proceed if the source was from the same panel
if ( (source != null) && (source instanceof HasName) ) {
String sourceName = ((HasName) source).getName();
if ( view.getName().equalsIgnoreCase(sourceName) ) {
TextBox breadcrumbs = view.getBreadcrumbs();
TreeItem selectedItem = event.getSelectedItem();
if ( selectedItem != null ) {
String selectedItemText = selectedItem.getText();
// Only bother to update the bread crumbs if the
// user
// has
// selected an item that has actually loaded
if ( !selectedItemText.equalsIgnoreCase(DatasetWidget.LOADING) ) {
// Update bread crumbs by walking the meta data
// categories GUI tree already in memory
TreeItem parentItem = selectedItem.getParentItem();
if ( parentItem != null ) {
// First clear bread crumbs so events fire
// even
// when there is no change in
// breadcrumbsText
// characters, but set boolean fireEvents to
// false to avoid unnecessary event firing.
breadcrumbs.setValue("", false);
String breadcrumbsText = getBreadcrumbsText(parentItem);
breadcrumbs.setValue(breadcrumbsText, true);
}
}
}
}
}
}
}
示例5: onModuleLoad
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public void onModuleLoad() {
PublishSubject<String> query = PublishSubject.create();
TextBox text = new TextBox(); RootPanel.get().add(text);
text.addValueChangeHandler(e -> query.onNext(e.getValue()));
Button search = new Button("search"); RootPanel.get().add(search);
search.addClickHandler(e -> query.onNext(text.getValue()));
ListBox url = new ListBox(); RootPanel.get().add(url);
url.addItem(NOMINATIM_OPENSTREETMAP);
url.addItem("http://localhost:8080/");
url.addChangeHandler(e -> query.onNext(text.getValue()));
FlowPanel results = new FlowPanel(); RootPanel.get().add(results);
// remember last selected server
Storage storage = Storage.getLocalStorageIfSupported();
if (storage != null) {
try {
url.setSelectedIndex(Integer.valueOf(storage.getItem("nominatim.url")));
} catch (Exception ignore) {}
url.addChangeHandler(c -> storage.setItem("nominatim.url", Integer.toString(url.getSelectedIndex())));
}
// on each tick, re-configure root resource and fire new request
query.switchMap(q -> {
results.clear();
if (q == null || q.isEmpty()) return Observable.empty();
Nominatim nominatim = new Nominatim_RestServiceModel(() -> osm(url.getSelectedItemText()));
return nominatim.search(q, "json").doOnNext(n -> results.add(new Label(
"[" + (int) (n.importance * 10.) + "] " + n.display_name + " (" + n.lon + "," + n.lat + ")")));
}).retry((cnt, err) -> {
GWT.log("request error: " + err, err); return true;
}).subscribe();
// fires initial search
text.setValue("Málaga,España", true);
}
示例6: EditorNumberPropertyWidget
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public EditorNumberPropertyWidget(String name, int value) {
propertyName.setText(name);
propertyValueBox = new TextBox();
propertyValueBox.setVisibleLength(3);
propertyValueBox.setValue(String.valueOf(value));
propertyValueBox.addKeyUpHandler(this);
valuePanel.add(propertyValueBox);
}
示例7: EditorStringPropertyWidget
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
public EditorStringPropertyWidget(String name, String value) {
propertyName.setText(name);
propertyValueBox = new TextBox();
propertyValueBox.setVisibleLength(5);
propertyValueBox.setValue(value);
propertyValueBox.addKeyUpHandler(this);
valuePanel.add(propertyValueBox);
}
示例8: getValue
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
protected double getValue(TextBox textBox) {
try {
String text = textBox.getText();
return Double.valueOf(text);
} catch (Exception e) {
textBox.setValue("0");
return 0.0;
}
}
示例9: render
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
@Override
public Widget render(Schema property) {
textbox = new TextBox();
if (property.getDefault() != null) {
textbox.setValue(property.getDefault());
}
return textbox;
}
示例10: createOpenALExample
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
private void createOpenALExample(ArrayBuffer data) throws AudioContextException
{
ALContext context = ALContext.create();
AL.setCurrentContext(context);
alSource = AL10.alGenSources();
FlowPanel panel = new FlowPanel();
panel.add(new Label("OpenAL example: "));
Button playButton = new Button("Play");
playButton.addClickHandler(event -> AL10.alSourcePlay(alSource));
playButton.setEnabled(false);
Button stopButton = new Button("Stop");
stopButton.addClickHandler(event -> AL10.alSourceStop(alSource));
Button pauseButton = new Button("Pause");
pauseButton.addClickHandler(event -> AL10.alSourcePause(alSource));
Button loopButton = new Button("Looping: Off");
loopButton.addClickHandler(event -> {
openALLooping = !openALLooping;
AL10.alSourcei(alSource, AL10.AL_LOOPING, openALLooping ? AL10.AL_TRUE : AL10.AL_FALSE);
loopButton.setText("Looping: " + (openALLooping ? "On" : "Off"));
});
TextBox pitchBox = new TextBox();
pitchBox.setValue("" + alPitch);
pitchBox.addKeyDownHandler(event -> {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER)
try
{
alPitch = Float.parseFloat(pitchBox.getValue());
}
catch (Exception e)
{
GWT.log(e.getMessage());
}
});
panel.add(playButton);
panel.add(stopButton);
panel.add(pauseButton);
panel.add(loopButton);
panel.add(new Label("Pitch: "));
panel.add(pitchBox);
AudioDecoder.decodeAudio
(
data,
// On success, set the buffer on the source, and start the animation loop
alBufferID ->
{
AL10.alSourcei(alSource, AL10.AL_BUFFER, alBufferID);
playButton.setEnabled(true);
AnimationScheduler.get().requestAnimationFrame(this::openalTimeStep);
},
GWT::log // Log with GWT on error
);
RootPanel.get().add(panel);
}
示例11: setFieldValue
import com.google.gwt.user.client.ui.TextBox; //导入方法依赖的package包/类
protected void setFieldValue(TextBox field, String value) {
field.setValue(value);
}