Search in sources :

Example 11 with FlowPanel

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

the class InstallPackageDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    // vertical panel
    VerticalPanel mainPanel = new VerticalPanel();
    mainPanel.setSpacing(2);
    mainPanel.setStylePrimaryName(RESOURCES.styles().mainWidget());
    // source type
    reposCaption_ = new CaptionWithHelp("Install from:", "Configuring Repositories", "configuring_repositories");
    reposCaption_.setIncludeVersionInfo(false);
    reposCaption_.setWidth("100%");
    mainPanel.add(reposCaption_);
    packageSourceListBox_ = new ListBox();
    packageSourceListBox_.setStylePrimaryName(RESOURCES.styles().packageSourceListBox());
    packageSourceListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
    JsArrayString repos = installContext_.selectedRepositoryNames();
    if (repos.length() == 1) {
        packageSourceListBox_.addItem("Repository (" + repos.get(0) + ")");
    } else {
        StringBuilder reposItem = new StringBuilder();
        reposItem.append("Repository (");
        for (int i = 0; i < repos.length(); i++) {
            if (i != 0)
                reposItem.append(", ");
            reposItem.append(repos.get(i));
        }
        reposItem.append(")");
        packageSourceListBox_.addItem(reposItem.toString());
    }
    packageSourceListBox_.addItem("Package Archive File (" + installContext_.packageArchiveExtension() + ")");
    mainPanel.add(packageSourceListBox_);
    // source panel container
    sourcePanel_ = new SimplePanel();
    sourcePanel_.setStylePrimaryName(RESOURCES.styles().packageSourcePanel());
    // repos source panel
    reposSourcePanel_ = new FlowPanel();
    Label packagesLabel = new Label("Packages (separate multiple with space or comma):");
    packagesLabel.setStylePrimaryName(RESOURCES.styles().packagesLabel());
    reposSourcePanel_.add(packagesLabel);
    packagesTextBox_ = new MultipleItemSuggestTextBox();
    packagesSuggestBox_ = new SuggestBox(new PackageOracle(), packagesTextBox_);
    packagesSuggestBox_.setWidth("100%");
    packagesSuggestBox_.setLimit(20);
    packagesSuggestBox_.addStyleName(RESOURCES.styles().extraBottomPad());
    reposSourcePanel_.add(packagesSuggestBox_);
    sourcePanel_.setWidget(reposSourcePanel_);
    mainPanel.add(sourcePanel_);
    // archive source panel
    packageArchiveFile_ = new TextBoxWithButton("Package archive:", "Browse...", browseForArchiveClickHandler_);
    // create check box here because manageUIState accesses it
    installDependenciesCheckBox_ = new CheckBox();
    if (defaultInstallOptions_.getInstallFromRepository())
        packageSourceListBox_.setSelectedIndex(0);
    else
        packageSourceListBox_.setSelectedIndex(1);
    manageUIState();
    packageSourceListBox_.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            manageUIState();
            if (!installFromRepository())
                packageArchiveFile_.click();
        }
    });
    mainPanel.add(new Label("Install to Library:"));
    // library list box
    libraryListBox_ = new ListBox();
    libraryListBox_.setWidth("100%");
    libraryListBox_.addStyleName(RESOURCES.styles().extraBottomPad());
    JsArrayString libPaths = installContext_.getWriteableLibraryPaths();
    int selectedIndex = 0;
    for (int i = 0; i < libPaths.length(); i++) {
        String libPath = libPaths.get(i);
        if (!installContext_.isDevModeOn()) {
            if (defaultInstallOptions_.getLibraryPath().equals(libPath))
                selectedIndex = i;
        }
        if (libPath.equals(installContext_.getDefaultLibraryPath()))
            libPath = libPath + " [Default]";
        libraryListBox_.addItem(libPath);
    }
    libraryListBox_.setSelectedIndex(selectedIndex);
    mainPanel.add(libraryListBox_);
    // install dependencies check box
    installDependenciesCheckBox_.addStyleName(RESOURCES.styles().installDependenciesCheckBox());
    installDependenciesCheckBox_.setText("Install dependencies");
    installDependenciesCheckBox_.setValue(defaultInstallOptions_.getInstallDependencies());
    mainPanel.add(installDependenciesCheckBox_);
    mainPanel.add(new HTML("<br/>"));
    return mainPanel;
}
Also used : MultipleItemSuggestTextBox(org.rstudio.core.client.widget.MultipleItemSuggestTextBox) Label(com.google.gwt.user.client.ui.Label) SimplePanel(com.google.gwt.user.client.ui.SimplePanel) HTML(com.google.gwt.user.client.ui.HTML) JsArrayString(com.google.gwt.core.client.JsArrayString) JsArrayString(com.google.gwt.core.client.JsArrayString) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) SuggestBox(com.google.gwt.user.client.ui.SuggestBox) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) TextBoxWithButton(org.rstudio.core.client.widget.TextBoxWithButton) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) CheckBox(com.google.gwt.user.client.ui.CheckBox) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) CaptionWithHelp(org.rstudio.core.client.widget.CaptionWithHelp) ListBox(com.google.gwt.user.client.ui.ListBox)

Example 12 with FlowPanel

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

the class PackageActionConfirmationDialog method createMainWidget.

@Override
protected Widget createMainWidget() {
    FlowPanel flowPanel = new FlowPanel();
    String explanatoryText = getExplanatoryText();
    if (explanatoryText.length() > 0) {
        Label text = new Label(explanatoryText);
        text.setStylePrimaryName(RESOURCES.styles().explanatoryText());
        flowPanel.add(text);
    }
    actionsTable_ = new CellTable<PendingAction>(15, GWT.<PackagesCellTableResources>create(PackagesCellTableResources.class));
    actionsTable_.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.DISABLED);
    actionsTable_.setSelectionModel(new NoSelectionModel<PendingAction>());
    actionsTable_.setWidth("100%", true);
    ActionColumn actionColumn = new ActionColumn();
    actionsTable_.addColumn(actionColumn);
    actionsTable_.setColumnWidth(actionColumn, 30, Unit.PX);
    addTableColumns(actionsTable_);
    ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.setWidget(actionsTable_);
    scrollPanel.setStylePrimaryName(RESOURCES.styles().mainWidget());
    flowPanel.add(scrollPanel);
    // query for updates
    actionsDS_.requestData(new SimpleRequestCallback<JsArray<T>>() {

        @Override
        public void onResponseReceived(JsArray<T> actions) {
            if (actions != null && actions.length() > 0) {
                ArrayList<PendingAction> pendingActions = new ArrayList<PendingAction>();
                for (int i = 0; i < actions.length(); i++) pendingActions.add(new PendingAction(actions.get(i), false));
                actionsTable_.setPageSize(pendingActions.size());
                actionsDataProvider_ = new ListDataProvider<PendingAction>();
                actionsDataProvider_.setList(pendingActions);
                actionsDataProvider_.addDataDisplay(actionsTable_);
                enableCancelButton(true);
                selectAllButton_.setEnabled(true);
                selectNoneButton_.setEnabled(true);
            } else {
                closeDialog();
                showNoActionsRequired();
            }
        }

        @Override
        public void onError(ServerError error) {
            closeDialog();
            super.onError(error);
        }
    });
    return flowPanel;
}
Also used : ListDataProvider(com.google.gwt.view.client.ListDataProvider) JsArray(com.google.gwt.core.client.JsArray) ServerError(org.rstudio.studio.client.server.ServerError) Label(com.google.gwt.user.client.ui.Label) ArrayList(java.util.ArrayList) GWT(com.google.gwt.core.client.GWT) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) ScrollPanel(com.google.gwt.user.client.ui.ScrollPanel)

Example 13 with FlowPanel

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

the class ProjectTemplateWidget method createWidget.

private ProjectTemplateWidgetItem createWidget(ProjectTemplateWidgetDescription description) {
    String type = description.getType().toLowerCase();
    if (type.equals(TYPE_CHECKBOX_INPUT))
        return checkBoxInput(description);
    else if (type.equals(TYPE_SELECT_INPUT))
        return selectBoxInput(description);
    else if (type.equals(TYPE_TEXT_INPUT))
        return textInput(description);
    else if (type.equals(TYPE_FILE_INPUT))
        return fileInput(description);
    Debug.log("Unexpected widget type '" + type + "'");
    return new ProjectTemplateWidgetItem(new FlowPanel(), null);
}
Also used : FlowPanel(com.google.gwt.user.client.ui.FlowPanel) JsArrayString(com.google.gwt.core.client.JsArrayString)

Example 14 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel in project gwt-test-utils by gwt-test-utils.

the class ComplexPanelTest method visible.

@Test
public void visible() {
    // Given
    ComplexPanel panel = new FlowPanel();
    // Preconditions
    assertThat(panel.isVisible()).isEqualTo(true);
    // When
    panel.setVisible(false);
    // Then
    assertThat(panel.isVisible()).isEqualTo(false);
}
Also used : ComplexPanel(com.google.gwt.user.client.ui.ComplexPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) Test(org.junit.Test)

Example 15 with FlowPanel

use of com.google.gwt.user.client.ui.FlowPanel 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)

Aggregations

FlowPanel (com.google.gwt.user.client.ui.FlowPanel)68 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)15 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)15 Button (com.google.gwt.user.client.ui.Button)14 Grid (com.google.gwt.user.client.ui.Grid)10 Label (com.google.gwt.user.client.ui.Label)7 SmallHeading (com.google.gerrit.client.ui.SmallHeading)6 Element (com.google.gwt.dom.client.Element)6 CheckBox (com.google.gwt.user.client.ui.CheckBox)6 CellFormatter (com.google.gwt.user.client.ui.HTMLTable.CellFormatter)6 InlineLabel (com.google.gwt.user.client.ui.InlineLabel)6 ComplexPanel (com.google.gwt.user.client.ui.ComplexPanel)5 HTML (com.google.gwt.user.client.ui.HTML)5 Image (com.google.gwt.user.client.ui.Image)5 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)5 Test (org.junit.Test)5 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)4 ActionButton (com.google.gerrit.client.actions.ActionButton)3 AccountInfo (com.google.gerrit.client.info.AccountInfo)3 NativeString (com.google.gerrit.client.rpc.NativeString)3