Search in sources :

Example 66 with FlowPanel

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

the class ProjectBranchesScreen method onInitUI.

@Override
protected void onInitUI() {
    super.onInitUI();
    initPageHeader();
    prev = PagingHyperlink.createPrev();
    prev.setVisible(false);
    next = PagingHyperlink.createNext();
    next.setVisible(false);
    addPanel = new FlowPanel();
    final Grid addGrid = new Grid(2, 2);
    addGrid.setStyleName(Gerrit.RESOURCES.css().addBranch());
    final int texBoxLength = 50;
    nameTxtBox = new HintTextBox();
    nameTxtBox.setVisibleLength(texBoxLength);
    nameTxtBox.setHintText(AdminConstants.I.defaultBranchName());
    nameTxtBox.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                doAddNewBranch();
            }
        }
    });
    addGrid.setText(0, 0, AdminConstants.I.columnBranchName() + ":");
    addGrid.setWidget(0, 1, nameTxtBox);
    irevTxtBox = new HintTextBox();
    irevTxtBox.setVisibleLength(texBoxLength);
    irevTxtBox.setHintText(AdminConstants.I.defaultRevisionSpec());
    irevTxtBox.addKeyPressHandler(new KeyPressHandler() {

        @Override
        public void onKeyPress(KeyPressEvent event) {
            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
                doAddNewBranch();
            }
        }
    });
    addGrid.setText(1, 0, AdminConstants.I.initialRevision() + ":");
    addGrid.setWidget(1, 1, irevTxtBox);
    addBranch = new Button(AdminConstants.I.buttonAddBranch());
    addBranch.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            doAddNewBranch();
        }
    });
    addPanel.add(addGrid);
    addPanel.add(addBranch);
    branchTable = new BranchesTable();
    delBranch = new Button(AdminConstants.I.buttonDeleteBranch());
    delBranch.setStyleName(Gerrit.RESOURCES.css().branchTableDeleteButton());
    delBranch.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(final ClickEvent event) {
            branchTable.deleteChecked();
        }
    });
    HorizontalPanel buttons = new HorizontalPanel();
    buttons.setStyleName(Gerrit.RESOURCES.css().branchTablePrevNextLinks());
    buttons.add(delBranch);
    buttons.add(prev);
    buttons.add(next);
    add(branchTable);
    add(buttons);
    add(addPanel);
}
Also used : HintTextBox(com.google.gerrit.client.ui.HintTextBox) KeyPressHandler(com.google.gwt.event.dom.client.KeyPressHandler) ClickHandler(com.google.gwt.event.dom.client.ClickHandler) KeyPressEvent(com.google.gwt.event.dom.client.KeyPressEvent) ActionButton(com.google.gerrit.client.actions.ActionButton) Button(com.google.gwt.user.client.ui.Button) Grid(com.google.gwt.user.client.ui.Grid) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel)

Example 67 with FlowPanel

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

the class ProjectInfoScreen method onInitUI.

@Override
protected void onInitUI() {
    super.onInitUI();
    Resources.I.style().ensureInjected();
    saveProject = new Button(AdminConstants.I.buttonSaveChanges());
    saveProject.setStyleName("");
    saveProject.addClickHandler(new ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            doSave();
        }
    });
    ExtensionPanel extensionPanelTop = new ExtensionPanel(GerritUiExtensionPoint.PROJECT_INFO_SCREEN_TOP);
    extensionPanelTop.put(GerritUiExtensionPoint.Key.PROJECT_NAME, getProjectKey().get());
    add(extensionPanelTop);
    add(new ProjectDownloadPanel(getProjectKey().get(), true));
    initDescription();
    grid = new LabeledWidgetsGrid();
    pluginOptionsPanel = new FlowPanel();
    actionsGrid = new LabeledWidgetsGrid();
    initProjectOptions();
    initAgreements();
    add(grid);
    add(pluginOptionsPanel);
    add(saveProject);
    add(actionsGrid);
    ExtensionPanel extensionPanelBottom = new ExtensionPanel(GerritUiExtensionPoint.PROJECT_INFO_SCREEN_BOTTOM);
    extensionPanelBottom.put(GerritUiExtensionPoint.Key.PROJECT_NAME, getProjectKey().get());
    add(extensionPanelBottom);
}
Also used : ClickHandler(com.google.gwt.event.dom.client.ClickHandler) ExtensionPanel(com.google.gerrit.client.api.ExtensionPanel) ActionButton(com.google.gerrit.client.actions.ActionButton) Button(com.google.gwt.user.client.ui.Button) ClickEvent(com.google.gwt.event.dom.client.ClickEvent) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Example 68 with FlowPanel

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

the class ProjectInfoScreen method initProjectActions.

private void initProjectActions(ConfigInfo info) {
    actionsGrid.clear(true);
    actionsGrid.removeAllRows();
    boolean showCreateChange = Gerrit.isSignedIn();
    NativeMap<ActionInfo> actions = info.actions();
    if (actions == null) {
        actions = NativeMap.create().cast();
    }
    if (actions.isEmpty() && !showCreateChange) {
        return;
    }
    actions.copyKeysIntoChildren("id");
    actionsGrid.addHeader(new SmallHeading(AdminConstants.I.headingProjectCommands()));
    FlowPanel actionsPanel = new FlowPanel();
    actionsPanel.setStyleName(Gerrit.RESOURCES.css().projectActions());
    actionsPanel.setVisible(true);
    actionsGrid.add(AdminConstants.I.headingCommands(), actionsPanel);
    for (String id : actions.keySet()) {
        actionsPanel.add(new ActionButton(getProjectKey(), actions.get(id)));
    }
    // HEAD. This would have to happen on the server side.
    if (showCreateChange) {
        actionsPanel.add(createChangeAction());
    }
    if (isOwner && configVisible) {
        actionsPanel.add(createEditConfigAction());
    }
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) ActionButton(com.google.gerrit.client.actions.ActionButton) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) ActionInfo(com.google.gerrit.client.info.ActionInfo)

Example 69 with FlowPanel

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

the class ProjectListScreen method onInitUI.

@Override
protected void onInitUI() {
    super.onInitUI();
    setPageTitle(AdminConstants.I.projectListTitle());
    initPageHeader();
    prev = PagingHyperlink.createPrev();
    prev.setVisible(false);
    next = PagingHyperlink.createNext();
    next.setVisible(false);
    projects = new ProjectsTable() {

        @Override
        protected void initColumnHeaders() {
            super.initColumnHeaders();
            table.setText(0, ProjectsTable.C_REPO_BROWSER, AdminConstants.I.projectRepoBrowser());
            table.getFlexCellFormatter().addStyleName(0, ProjectsTable.C_REPO_BROWSER, Gerrit.RESOURCES.css().dataHeader());
        }

        @Override
        protected void onOpenRow(final int row) {
            History.newItem(link(getRowItem(row)));
        }

        private String link(final ProjectInfo item) {
            return Dispatcher.toProject(item.name_key());
        }

        @Override
        protected void insert(int row, ProjectInfo k) {
            super.insert(row, k);
            table.getFlexCellFormatter().addStyleName(row, ProjectsTable.C_REPO_BROWSER, Gerrit.RESOURCES.css().dataCell());
        }

        @Override
        protected void populate(final int row, final ProjectInfo k) {
            Image state = new Image();
            switch(k.state()) {
                case HIDDEN:
                    state.setResource(Gerrit.RESOURCES.redNot());
                    state.setTitle(Util.toLongString(k.state()));
                    table.setWidget(row, ProjectsTable.C_STATE, state);
                    break;
                case READ_ONLY:
                    state.setResource(Gerrit.RESOURCES.readOnly());
                    state.setTitle(Util.toLongString(k.state()));
                    table.setWidget(row, ProjectsTable.C_STATE, state);
                    break;
                case ACTIVE:
                default:
                    // Intentionally left blank, do not show an icon when active.
                    break;
            }
            FlowPanel fp = new FlowPanel();
            fp.add(new ProjectSearchLink(k.name_key()));
            fp.add(new HighlightingInlineHyperlink(k.name(), link(k), match));
            table.setWidget(row, ProjectsTable.C_NAME, fp);
            table.setText(row, ProjectsTable.C_DESCRIPTION, k.description());
            addWebLinks(row, k);
            setRowItem(row, k);
        }

        private void addWebLinks(int row, ProjectInfo k) {
            List<WebLinkInfo> webLinks = Natives.asList(k.webLinks());
            if (webLinks != null && !webLinks.isEmpty()) {
                FlowPanel p = new FlowPanel();
                table.setWidget(row, ProjectsTable.C_REPO_BROWSER, p);
                for (WebLinkInfo weblink : webLinks) {
                    p.add(weblink.toAnchor());
                }
            }
        }
    };
    projects.setSavePointerId(PageLinks.ADMIN_PROJECTS);
    add(projects);
    final HorizontalPanel buttons = new HorizontalPanel();
    buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks());
    buttons.add(prev);
    buttons.add(next);
    add(buttons);
}
Also used : WebLinkInfo(com.google.gerrit.client.info.WebLinkInfo) ProjectsTable(com.google.gerrit.client.ui.ProjectsTable) ProjectSearchLink(com.google.gerrit.client.ui.ProjectSearchLink) ProjectInfo(com.google.gerrit.client.projects.ProjectInfo) FlowPanel(com.google.gwt.user.client.ui.FlowPanel) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) List(java.util.List) Image(com.google.gwt.user.client.ui.Image) HighlightingInlineHyperlink(com.google.gerrit.client.ui.HighlightingInlineHyperlink)

Example 70 with FlowPanel

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

the class AccountGroupMembersScreen method initNoMembersInfo.

private void initNoMembersInfo() {
    noMembersInfo = new FlowPanel();
    noMembersInfo.setVisible(false);
    noMembersInfo.add(new SmallHeading(AdminConstants.I.noMembersInfo()));
    add(noMembersInfo);
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) FlowPanel(com.google.gwt.user.client.ui.FlowPanel)

Aggregations

FlowPanel (com.google.gwt.user.client.ui.FlowPanel)81 ClickHandler (com.google.gwt.event.dom.client.ClickHandler)18 ClickEvent (com.google.gwt.event.dom.client.ClickEvent)15 Button (com.google.gwt.user.client.ui.Button)14 Label (com.google.gwt.user.client.ui.Label)12 Grid (com.google.gwt.user.client.ui.Grid)10 VerticalPanel (com.google.gwt.user.client.ui.VerticalPanel)8 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)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 Widget (com.google.gwt.user.client.ui.Widget)6 Test (org.junit.Test)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 IsWidget (com.google.gwt.user.client.ui.IsWidget)5 List (java.util.List)4