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


Java TextBox.setValue方法代碼示例

本文整理匯總了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 -&gt; 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());
}
 
開發者ID:umlet,項目名稱:umlet,代碼行數:23,代碼來源:DownloadPopupPanel.java

示例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());
}
 
開發者ID:BenDol,項目名稱:Databind,代碼行數:27,代碼來源:HasValueDataBindingGwtTest.java

示例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());
}
 
開發者ID:BenDol,項目名稱:Databind,代碼行數:23,代碼來源:HasValueDataBindingGwtTest.java

示例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);
                        }
                    }
                }
            }
        }
    }
}
 
開發者ID:NOAA-PMEL,項目名稱:LAS,代碼行數:41,代碼來源:VariableMetadataActivity.java

示例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);
}
 
開發者ID:ibaca,項目名稱:autorest-nominatim-example,代碼行數:40,代碼來源:ExampleEntryPoint.java

示例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);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:11,代碼來源:EditorNumberPropertyWidget.java

示例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);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:11,代碼來源:EditorStringPropertyWidget.java

示例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;
		}
	}
 
開發者ID:dawg6,項目名稱:dhcalc,代碼行數:11,代碼來源:BasePanel.java

示例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;
}
 
開發者ID:showlowtech,項目名稱:google-apis-explorer,代碼行數:10,代碼來源:SchemaForm.java

示例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);
}
 
開發者ID:sriharshachilakapati,項目名稱:GWT-AL,代碼行數:68,代碼來源:Main.java

示例11: setFieldValue

import com.google.gwt.user.client.ui.TextBox; //導入方法依賴的package包/類
protected void setFieldValue(TextBox field, String value) {
	field.setValue(value);
}
 
開發者ID:dawg6,項目名稱:dhcalc,代碼行數:4,代碼來源:BasePanel.java


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