Search in sources :

Example 16 with FlowPanel

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

the class MyWatchedProjectsScreen method onInitUI.

@Override
protected void onInitUI() {
    super.onInitUI();
    createWidgets();
    /* top table */
    grid = new Grid(2, 2);
    grid.setStyleName(Gerrit.RESOURCES.css().infoBlock());
    grid.setText(0, 0, Util.C.watchedProjectName());
    final HorizontalPanel hp = new HorizontalPanel();
    hp.add(nameBox);
    hp.add(browse);
    grid.setWidget(0, 1, hp);
    grid.setText(1, 0, Util.C.watchedProjectFilter());
    grid.setWidget(1, 1, filterTxt);
    final CellFormatter fmt = grid.getCellFormatter();
    fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
    fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
    fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().header());
    fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().header());
    fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader());
    final FlowPanel fp = new FlowPanel();
    fp.setStyleName(Gerrit.RESOURCES.css().addWatchPanel());
    fp.add(grid);
    fp.add(addNew);
    add(fp);
    /* bottom table */
    add(watchesTab);
    add(delSel);
    /* popup */
    projectsPopup = new ProjectListPopup() {

        @Override
        protected void onMovePointerTo(String projectName) {
            // prevent user input from being overwritten by simply poping up
            if (!projectsPopup.isPoppingUp() || "".equals(nameBox.getText())) {
                nameBox.setText(projectName);
            }
        }

        @Override
        protected void openRow(String projectName) {
            nameBox.setText(projectName);
            doAddNew();
        }
    };
    projectsPopup.initPopup(Util.C.projects(), PageLinks.SETTINGS_PROJECTS);
}
Also used : Grid(com.google.gwt.user.client.ui.Grid) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) CellFormatter(com.google.gwt.user.client.ui.HTMLTable.CellFormatter) ProjectListPopup(com.google.gerrit.client.ui.ProjectListPopup)

Example 17 with FlowPanel

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

the class RegisterScreen method onInitUI.

@Override
protected void onInitUI() {
    super.onInitUI();
    setPageTitle(Util.C.welcomeToGerritCodeReview());
    final FlowPanel formBody = new FlowPanel();
    final FlowPanel contactGroup = new FlowPanel();
    contactGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
    contactGroup.add(new SmallHeading(Util.C.welcomeReviewContact()));
    final HTML whereFrom = new HTML(Util.C.welcomeContactFrom());
    whereFrom.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
    contactGroup.add(whereFrom);
    contactGroup.add(new ContactPanelShort() {

        @Override
        protected void display(AccountInfo account) {
            super.display(account);
            if ("".equals(nameTxt.getText())) {
                // No name? Encourage the user to provide us something.
                //
                nameTxt.setFocus(true);
                save.setEnabled(true);
            }
        }
    });
    formBody.add(contactGroup);
    if (Gerrit.getUserAccount().username() == null && Gerrit.info().auth().canEdit(AccountFieldName.USER_NAME)) {
        final FlowPanel fp = new FlowPanel();
        fp.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
        fp.add(new SmallHeading(Util.C.welcomeUsernameHeading()));
        final Grid userInfo = new Grid(1, 2);
        final CellFormatter fmt = userInfo.getCellFormatter();
        userInfo.setStyleName(Gerrit.RESOURCES.css().infoBlock());
        userInfo.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
        fp.add(userInfo);
        fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
        fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
        fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().bottomheader());
        UsernameField field = new UsernameField();
        if (LocaleInfo.getCurrentLocale().isRTL()) {
            userInfo.setText(0, 1, Util.C.userName());
            userInfo.setWidget(0, 0, field);
            fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().header());
        } else {
            userInfo.setText(0, 0, Util.C.userName());
            userInfo.setWidget(0, 1, field);
            fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().header());
        }
        formBody.add(fp);
    }
    if (Gerrit.info().hasSshd()) {
        final FlowPanel sshKeyGroup = new FlowPanel();
        sshKeyGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
        sshKeyGroup.add(new SmallHeading(Util.C.welcomeSshKeyHeading()));
        final HTML whySshKey = new HTML(Util.C.welcomeSshKeyText());
        whySshKey.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
        sshKeyGroup.add(whySshKey);
        sshKeyGroup.add(new SshPanel() {

            {
                setKeyTableVisible(false);
            }
        });
        formBody.add(sshKeyGroup);
    }
    final FlowPanel choices = new FlowPanel();
    choices.setStyleName(Gerrit.RESOURCES.css().registerScreenNextLinks());
    if (Gerrit.info().auth().useContributorAgreements()) {
        final FlowPanel agreementGroup = new FlowPanel();
        agreementGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
        agreementGroup.add(new SmallHeading(Util.C.welcomeAgreementHeading()));
        final HTML whyAgreement = new HTML(Util.C.welcomeAgreementText());
        whyAgreement.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
        agreementGroup.add(whyAgreement);
        choices.add(new InlineHyperlink(Util.C.newAgreement(), PageLinks.SETTINGS_NEW_AGREEMENT));
        choices.add(new InlineHyperlink(Util.C.welcomeAgreementLater(), nextToken));
        formBody.add(agreementGroup);
    } else {
        choices.add(new InlineHyperlink(Util.C.welcomeContinue(), nextToken));
    }
    formBody.add(choices);
    final FormPanel form = new FormPanel();
    form.add(formBody);
    add(form);
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) InlineHyperlink(com.google.gerrit.client.ui.InlineHyperlink) FormPanel(com.google.gwt.user.client.ui.FormPanel) Grid(com.google.gwt.user.client.ui.Grid) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) HTML(com.google.gwt.user.client.ui.HTML) CellFormatter(com.google.gwt.user.client.ui.HTMLTable.CellFormatter) AccountInfo(com.google.gerrit.client.info.AccountInfo)

Example 18 with FlowPanel

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

the class Gerrit method onModuleLoad2.

private void onModuleLoad2(HostPageData hpd) {
    RESOURCES.gwt_override().ensureInjected();
    RESOURCES.css().ensureInjected();
    topMenu = RootPanel.get("gerrit_topmenu");
    final RootPanel gStarting = RootPanel.get("gerrit_startinggerrit");
    final RootPanel gBody = RootPanel.get("gerrit_body");
    bottomMenu = RootPanel.get("gerrit_btmmenu");
    topMenu.setStyleName(RESOURCES.css().gerritTopMenu());
    gBody.setStyleName(RESOURCES.css().gerritBody());
    final Grid menuLine = new Grid(1, 3);
    menuLeft = new MorphingTabPanel();
    menuRight = new LinkMenuBar();
    searchPanel = new SearchPanel();
    menuLeft.setStyleName(RESOURCES.css().topmenuMenuLeft());
    menuLine.setStyleName(RESOURCES.css().topmenu());
    topMenu.add(menuLine);
    final FlowPanel menuRightPanel = new FlowPanel();
    menuRightPanel.setStyleName(RESOURCES.css().topmenuMenuRight());
    menuRightPanel.add(searchPanel);
    menuRightPanel.add(menuRight);
    menuLine.setWidget(0, 0, menuLeft);
    menuLine.setWidget(0, 1, new FlowPanel());
    menuLine.setWidget(0, 2, menuRightPanel);
    final CellFormatter fmt = menuLine.getCellFormatter();
    fmt.setStyleName(0, 0, RESOURCES.css().topmenuTDmenu());
    fmt.setStyleName(0, 1, RESOURCES.css().topmenuTDglue());
    fmt.setStyleName(0, 2, RESOURCES.css().topmenuTDmenu());
    siteHeader = RootPanel.get("gerrit_header");
    siteFooter = RootPanel.get("gerrit_footer");
    body = new ViewSite<Screen>() {

        @Override
        protected void onShowView(Screen view) {
            String token = view.getToken();
            History.newItem(token, false);
            dispatchHistoryHooks(token);
            if (view instanceof ChangeListScreen) {
                lastChangeListToken = token;
            }
            super.onShowView(view);
            view.onShowView();
            lastViewToken = token;
        }
    };
    gBody.add(body);
    JsonUtil.addRpcStartHandler(RpcStatus.INSTANCE);
    JsonUtil.addRpcCompleteHandler(RpcStatus.INSTANCE);
    gStarting.getElement().getParentElement().removeChild(gStarting.getElement());
    RootPanel.detachNow(gStarting);
    ApiGlue.init();
    applyUserPreferences();
    populateBottomMenu(bottomMenu, hpd);
    refreshMenuBar();
    History.addValueChangeHandler(new ValueChangeHandler<String>() {

        @Override
        public void onValueChange(ValueChangeEvent<String> event) {
            display(event.getValue());
        }
    });
    JumpKeys.register(body);
    saveDefaultTheme();
    if (hpd.messages != null) {
        new MessageOfTheDayBar(hpd.messages).show();
    }
    PluginLoader.load(hpd.plugins, hpd.pluginsLoadTimeout, new GerritCallback<VoidResult>() {

        @Override
        public void onSuccess(VoidResult result) {
            String token = History.getToken();
            if (token.isEmpty()) {
                token = isSignedIn() ? PageLinks.MINE : PageLinks.toChangeQuery("status:open");
            }
            display(token);
        }
    });
}
Also used : ChangeListScreen(com.google.gerrit.client.changes.ChangeListScreen) ProjectScreen(com.google.gerrit.client.admin.ProjectScreen) ChangeListScreen(com.google.gerrit.client.changes.ChangeListScreen) Screen(com.google.gerrit.client.ui.Screen) Grid(com.google.gwt.user.client.ui.Grid) RootPanel(com.google.gwt.user.client.ui.RootPanel) CellFormatter(com.google.gwt.user.client.ui.HTMLTable.CellFormatter) MorphingTabPanel(com.google.gerrit.client.ui.MorphingTabPanel) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) LinkMenuBar(com.google.gerrit.client.ui.LinkMenuBar)

Example 19 with FlowPanel

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

the class Gerrit method whoAmI.

private static void whoAmI(boolean canLogOut) {
    AccountInfo account = getUserAccount();
    final UserPopupPanel userPopup = new UserPopupPanel(account, canLogOut, true);
    final FlowPanel userSummaryPanel = new FlowPanel();
    class PopupHandler implements KeyDownHandler, ClickHandler {

        private void showHidePopup() {
            if (userPopup.isShowing() && userPopup.isVisible()) {
                userPopup.hide();
            } else {
                userPopup.showRelativeTo(userSummaryPanel);
            }
        }

        @Override
        public void onClick(ClickEvent event) {
            showHidePopup();
        }

        @Override
        public void onKeyDown(KeyDownEvent event) {
            if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
                showHidePopup();
                event.preventDefault();
            }
        }
    }
    final PopupHandler popupHandler = new PopupHandler();
    final InlineLabel l = new InlineLabel(FormatUtil.name(account));
    l.setStyleName(RESOURCES.css().menuBarUserName());
    final AvatarImage avatar = new AvatarImage(account, 26, false);
    avatar.setStyleName(RESOURCES.css().menuBarUserNameAvatar());
    userSummaryPanel.setStyleName(RESOURCES.css().menuBarUserNamePanel());
    userSummaryPanel.add(l);
    userSummaryPanel.add(avatar);
    // "BLACK DOWN-POINTING SMALL TRIANGLE"
    userSummaryPanel.add(new InlineLabel(" ▾"));
    userPopup.addAutoHidePartner(userSummaryPanel.getElement());
    FocusPanel fp = new FocusPanel(userSummaryPanel);
    fp.setStyleName(RESOURCES.css().menuBarUserNameFocusPanel());
    fp.addKeyDownHandler(popupHandler);
    fp.addClickHandler(popupHandler);
    menuRight.add(fp);
}
Also used : KeyDownEvent(com.google.gwt.event.dom.client.KeyDownEvent) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) KeyDownHandler(com.google.gwt.event.dom.client.KeyDownHandler) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) InlineLabel(com.google.gwt.user.client.ui.InlineLabel) FocusPanel(com.google.gwt.user.client.ui.FocusPanel) AccountInfo(com.google.gerrit.client.info.AccountInfo)

Example 20 with FlowPanel

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

the class AccountGroupMembersScreen method initIncludeList.

private void initIncludeList() {
    accountGroupSuggestOracle = new AccountGroupSuggestOracle();
    addIncludeBox = new AddMemberBox(AdminConstants.I.buttonAddIncludedGroup(), AdminConstants.I.defaultAccountGroupName(), accountGroupSuggestOracle);
    addIncludeBox.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doAddNewInclude();
        }
    });
    includes = new IncludeTable();
    includes.addStyleName(Gerrit.RESOURCES.css().groupIncludesTable());
    delInclude = new Button(AdminConstants.I.buttonDeleteIncludedGroup());
    delInclude.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            includes.deleteChecked();
        }
    });
    includePanel = new FlowPanel();
    includePanel.add(new SmallHeading(AdminConstants.I.headingIncludedGroups()));
    includePanel.add(addIncludeBox);
    includePanel.add(includes);
    includePanel.add(delInclude);
    add(includePanel);
}
Also used : AccountGroupSuggestOracle(com.google.gerrit.client.ui.AccountGroupSuggestOracle) SmallHeading(com.google.gerrit.client.ui.SmallHeading) AddMemberBox(com.google.gerrit.client.ui.AddMemberBox) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) Button(com.google.gwt.user.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) 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