Search in sources :

Example 1 with TextBox

use of com.google.gwt.user.client.ui.TextBox in project opennms by OpenNMS.

the class VSearchBox method onLoad.

@Override
public void onLoad() {
    m_componentHolder.clear();
    this.setStyleName("topology-search");
    final TextBoxBase textField = new TextBox();
    textField.setWidth("245px");
    textField.setStyleName("topology-search-box");
    textField.getElement().setAttribute("placeholder", "Search...");
    textField.setFocus(true);
    RemoteSuggestOracle oracle = new RemoteSuggestOracle();
    m_suggestBox = new SuggestBox(oracle, textField);
    m_suggestBox.addSelectionHandler(new SelectionHandler<SuggestOracle.Suggestion>() {

        @Override
        public void onSelection(SelectionEvent<SuggestOracle.Suggestion> event) {
            SearchSuggestion selectedItem = (SearchSuggestion) event.getSelectedItem();
            textField.setText("");
            m_connector.addToFocus(selectedItem);
        }
    });
    if (m_isMultiValued) {
        m_suggestBox.setStyleName("multivalue");
    }
    m_suggestBox.addStyleName("wideTextField");
    m_suggestBox.addSelectionHandler(this);
    m_suggestBox.addKeyUpHandler(this);
    m_componentHolder.setWidth("245px");
    m_componentHolder.add(m_suggestBox);
    if (m_focusedContainer == null) {
        m_focusedContainer = new VerticalPanel();
        m_scrollContainer = new FlowPanel();
        m_scrollContainer.add(m_focusedContainer);
    }
    m_focusedContainer.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_LEFT);
    m_focusedContainer.setTitle("Focused Vertices");
    m_componentHolder.add(m_scrollContainer);
    Timer timer = new Timer() {

        @Override
        public void run() {
            updateScrollPanelSize();
        }
    };
    timer.schedule(1000);
    m_windowResizeRegistration = Window.addResizeHandler(new ResizeHandler() {

        @Override
        public void onResize(ResizeEvent event) {
            updateScrollPanelSize();
        }
    });
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox) TextBoxBase(com.google.gwt.user.client.ui.TextBoxBase) ResizeEvent(com.google.gwt.event.logical.shared.ResizeEvent) SuggestBox(com.google.gwt.user.client.ui.SuggestBox) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Timer(com.google.gwt.user.client.Timer) ResizeHandler(com.google.gwt.event.logical.shared.ResizeHandler) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Example 2 with TextBox

use of com.google.gwt.user.client.ui.TextBox in project gerrit by GerritCodeReview.

the class ProjectInfoScreen method getPluginConfigValues.

private Map<String, Map<String, ConfigParameterValue>> getPluginConfigValues() {
    Map<String, Map<String, ConfigParameterValue>> pluginConfigValues = new HashMap<>(pluginConfigWidgets.size());
    for (Entry<String, Map<String, HasEnabled>> e : pluginConfigWidgets.entrySet()) {
        Map<String, ConfigParameterValue> values = new HashMap<>(e.getValue().size());
        pluginConfigValues.put(e.getKey(), values);
        for (Entry<String, HasEnabled> e2 : e.getValue().entrySet()) {
            HasEnabled widget = e2.getValue();
            if (widget instanceof TextBox) {
                values.put(e2.getKey(), ConfigParameterValue.create().value(((TextBox) widget).getValue().trim()));
            } else if (widget instanceof CheckBox) {
                values.put(e2.getKey(), ConfigParameterValue.create().value(Boolean.toString(((CheckBox) widget).getValue())));
            } else if (widget instanceof ListBox) {
                ListBox listBox = (ListBox) widget;
                // the inherited value is at index 0,
                // if it is selected no value should be set on this project
                String value = listBox.getSelectedIndex() > 0 ? listBox.getValue(listBox.getSelectedIndex()) : null;
                values.put(e2.getKey(), ConfigParameterValue.create().value(value));
            } else if (widget instanceof StringListPanel) {
                values.put(e2.getKey(), ConfigParameterValue.create().values(((StringListPanel) widget).getValues(0).toArray(new String[] {})));
            } else {
                throw new UnsupportedOperationException("unsupported widget type");
            }
        }
    }
    return pluginConfigValues;
}
Also used : HasEnabled(com.google.gwt.user.client.ui.HasEnabled) HashMap(java.util.HashMap) ConfigParameterValue(com.google.gerrit.client.projects.ConfigInfo.ConfigParameterValue) TextBox(com.google.gwt.user.client.ui.TextBox) NpIntTextBox(com.google.gerrit.client.ui.NpIntTextBox) NpTextBox(com.google.gwtexpui.globalkey.client.NpTextBox) CheckBox(com.google.gwt.user.client.ui.CheckBox) AccessMap(com.google.gerrit.client.access.AccessMap) Map(java.util.Map) HashMap(java.util.HashMap) NativeMap(com.google.gerrit.client.rpc.NativeMap) ListBox(com.google.gwt.user.client.ui.ListBox) StringListPanel(com.google.gerrit.client.StringListPanel)

Example 3 with TextBox

use of com.google.gwt.user.client.ui.TextBox in project rstudio by rstudio.

the class FileBrowserWidget method createTopWidget.

// Private methods ---------------------------------------------------------
private Widget createTopWidget() {
    String nameLabel = host_.getFilenameLabel();
    if (nameLabel == null)
        return null;
    HorizontalPanel filenamePanel = new HorizontalPanel();
    FileDialogStyles styles = FileDialogResources.INSTANCE.styles();
    filenamePanel.setStylePrimaryName(styles.filenamePanel());
    filenamePanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    Label filenameLabel = new Label(nameLabel + ":", false);
    filenameLabel.setStylePrimaryName(styles.filenameLabel());
    filenamePanel.add(filenameLabel);
    filename_ = new TextBox();
    if (initialFilename_ != null)
        filename_.setText(initialFilename_);
    filename_.setStylePrimaryName(styles.filename());
    filenamePanel.add(filename_);
    filenamePanel.setCellWidth(filename_, "100%");
    ftm_ = new FocusTransitionManager();
    ftm_.add(filename_, directory_);
    return filenamePanel;
}
Also used : HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) FocusTransitionManager(org.rstudio.core.client.FocusTransitionManager) TextBox(com.google.gwt.user.client.ui.TextBox)

Example 4 with TextBox

use of com.google.gwt.user.client.ui.TextBox in project rstudio by rstudio.

the class ExportPlotSizeEditor method createImageSizeTextBox.

private TextBox createImageSizeTextBox() {
    TextBox textBox = new TextBox();
    textBox.setStylePrimaryName(ExportPlotResources.INSTANCE.styles().imageSizeTextBox());
    return textBox;
}
Also used : TextBox(com.google.gwt.user.client.ui.TextBox)

Example 5 with TextBox

use of com.google.gwt.user.client.ui.TextBox in project rstudio by rstudio.

the class VersionControlPage method onAddWidgets.

@Override
protected void onAddWidgets() {
    NewProjectResources.Styles styles = NewProjectResources.INSTANCE.styles();
    VerticalPanel urlPanel = new VerticalPanel();
    urlPanel.addStyleName(styles.wizardMainColumn());
    Label urlLabel = new Label("Repository URL:");
    urlLabel.addStyleName(styles.wizardTextEntryLabel());
    urlPanel.add(urlLabel);
    txtRepoUrl_ = new TextBox();
    txtRepoUrl_.addDomHandler(new KeyDownHandler() {

        public void onKeyDown(KeyDownEvent event) {
            handleAutoFillCheckoutDir();
        }
    }, KeyDownEvent.getType());
    txtRepoUrl_.setWidth("100%");
    urlPanel.add(txtRepoUrl_);
    addWidget(urlPanel);
    addSpacer();
    txtUsername_ = new TextBox();
    txtUsername_.setWidth("100%");
    if (includeCredentials()) {
        VerticalPanel usernamePanel = new VerticalPanel();
        usernamePanel.addStyleName(styles.wizardMainColumn());
        Label usernameLabel = new Label("Username (if required for this repository URL):");
        usernameLabel.addStyleName(styles.wizardTextEntryLabel());
        usernamePanel.add(usernameLabel);
        usernamePanel.add(txtUsername_);
        addWidget(usernamePanel);
        addSpacer();
    }
    Label dirNameLabel = new Label("Project directory name:");
    dirNameLabel.addStyleName(styles.wizardTextEntryLabel());
    addWidget(dirNameLabel);
    txtDirName_ = new TextBox();
    txtDirName_.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            if (!event.getValue().equals(guessRepoDir()))
                suppressDirNameDetection_ = true;
        }
    });
    txtDirName_.addStyleName(styles.wizardMainColumn());
    addWidget(txtDirName_);
    addSpacer();
    existingRepoDestDir_ = new DirectoryChooserTextBox("Create project as subdirectory of:", txtRepoUrl_);
    addWidget(existingRepoDestDir_);
}
Also used : VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) Label(com.google.gwt.user.client.ui.Label) TextBox(com.google.gwt.user.client.ui.TextBox) DirectoryChooserTextBox(org.rstudio.core.client.widget.DirectoryChooserTextBox) DirectoryChooserTextBox(org.rstudio.core.client.widget.DirectoryChooserTextBox)

Aggregations

TextBox (com.google.gwt.user.client.ui.TextBox)40 Label (com.google.gwt.user.client.ui.Label)13 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)13 Test (org.junit.Test)10 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)8 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)7 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)7 CheckBox (com.google.gwt.user.client.ui.CheckBox)5 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)4 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)4 Grid (com.google.gwt.user.client.ui.Grid)4 PasswordTextBox (com.google.gwt.user.client.ui.PasswordTextBox)3 HashMap (java.util.HashMap)3 JSONString (com.google.gwt.json.client.JSONString)2 Button (com.google.gwt.user.client.ui.Button)2 FlexTable (com.google.gwt.user.client.ui.FlexTable)2 HTML (com.google.gwt.user.client.ui.HTML)2 ListBox (com.google.gwt.user.client.ui.ListBox)2 SimplePanel (com.google.gwt.user.client.ui.SimplePanel)2 JsonCallbackEvents (cz.metacentrum.perun.webgui.json.JsonCallbackEvents)2