Search in sources :

Example 1 with ProjectState

use of com.google.gerrit.extensions.client.ProjectState in project gerrit by GerritCodeReview.

the class ProjectInfoScreen method initProjectOptions.

private void initProjectOptions() {
    grid.addHeader(new SmallHeading(AdminConstants.I.headingProjectOptions()));
    state = new ListBox();
    for (ProjectState stateValue : ProjectState.values()) {
        state.addItem(Util.toLongString(stateValue), stateValue.name());
    }
    saveEnabler.listenTo(state);
    grid.add(AdminConstants.I.headingProjectState(), state);
    submitType = new ListBox();
    for (final SubmitType type : SubmitType.values()) {
        submitType.addItem(Util.toLongString(type), type.name());
    }
    submitType.addChangeHandler(new ChangeHandler() {

        @Override
        public void onChange(ChangeEvent event) {
            setEnabledForUseContentMerge();
        }
    });
    saveEnabler.listenTo(submitType);
    grid.add(AdminConstants.I.headingProjectSubmitType(), submitType);
    contentMerge = newInheritedBooleanBox();
    saveEnabler.listenTo(contentMerge);
    grid.add(AdminConstants.I.useContentMerge(), contentMerge);
    newChangeForAllNotInTarget = newInheritedBooleanBox();
    saveEnabler.listenTo(newChangeForAllNotInTarget);
    grid.add(AdminConstants.I.createNewChangeForAllNotInTarget(), newChangeForAllNotInTarget);
    requireChangeID = newInheritedBooleanBox();
    saveEnabler.listenTo(requireChangeID);
    grid.addHtml(AdminConstants.I.requireChangeID(), requireChangeID);
    if (Gerrit.info().receive().enableSignedPush()) {
        enableSignedPush = newInheritedBooleanBox();
        saveEnabler.listenTo(enableSignedPush);
        grid.add(AdminConstants.I.enableSignedPush(), enableSignedPush);
        requireSignedPush = newInheritedBooleanBox();
        saveEnabler.listenTo(requireSignedPush);
        grid.add(AdminConstants.I.requireSignedPush(), requireSignedPush);
    }
    rejectImplicitMerges = newInheritedBooleanBox();
    saveEnabler.listenTo(rejectImplicitMerges);
    grid.addHtml(AdminConstants.I.rejectImplicitMerges(), rejectImplicitMerges);
    enableReviewerByEmail = newInheritedBooleanBox();
    saveEnabler.listenTo(enableReviewerByEmail);
    grid.addHtml(AdminConstants.I.enableReviewerByEmail(), enableReviewerByEmail);
    maxObjectSizeLimit = new NpTextBox();
    saveEnabler.listenTo(maxObjectSizeLimit);
    effectiveMaxObjectSizeLimit = new Label();
    effectiveMaxObjectSizeLimit.setStyleName(Gerrit.RESOURCES.css().maxObjectSizeLimitEffectiveLabel());
    HorizontalPanel p = new HorizontalPanel();
    p.add(maxObjectSizeLimit);
    p.add(effectiveMaxObjectSizeLimit);
    grid.addHtml(AdminConstants.I.headingMaxObjectSizeLimit(), p);
}
Also used : SmallHeading(com.google.gerrit.client.ui.SmallHeading) ChangeEvent(com.google.gwt.event.dom.client.ChangeEvent) ChangeHandler(com.google.gwt.event.dom.client.ChangeHandler) Label(com.google.gwt.user.client.ui.Label) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) ProjectState(com.google.gerrit.extensions.client.ProjectState) SubmitType(com.google.gerrit.extensions.client.SubmitType) ListBox(com.google.gwt.user.client.ui.ListBox) NpTextBox(com.google.gwtexpui.globalkey.client.NpTextBox)

Example 2 with ProjectState

use of com.google.gerrit.extensions.client.ProjectState in project gerrit by GerritCodeReview.

the class ProjectIT method nonActiveProjectCanBeMadeActive.

@Test
public void nonActiveProjectCanBeMadeActive() throws Exception {
    for (ProjectState nonActiveState : ImmutableList.of(ProjectState.READ_ONLY, ProjectState.HIDDEN)) {
        // ACTIVE => NON_ACTIVE
        ConfigInput ci1 = new ConfigInput();
        ci1.state = nonActiveState;
        gApi.projects().name(project.get()).config(ci1);
        assertThat(gApi.projects().name(project.get()).config().state).isEqualTo(nonActiveState);
        // NON_ACTIVE => ACTIVE
        ConfigInput ci2 = new ConfigInput();
        ci2.state = ProjectState.ACTIVE;
        gApi.projects().name(project.get()).config(ci2);
        // ACTIVE is represented as null in the API
        assertThat(gApi.projects().name(project.get()).config().state).isNull();
    }
}
Also used : ConfigInput(com.google.gerrit.extensions.api.projects.ConfigInput) ProjectState(com.google.gerrit.extensions.client.ProjectState) AbstractDaemonTest(com.google.gerrit.acceptance.AbstractDaemonTest) Test(org.junit.Test)

Aggregations

ProjectState (com.google.gerrit.extensions.client.ProjectState)2 AbstractDaemonTest (com.google.gerrit.acceptance.AbstractDaemonTest)1 SmallHeading (com.google.gerrit.client.ui.SmallHeading)1 ConfigInput (com.google.gerrit.extensions.api.projects.ConfigInput)1 SubmitType (com.google.gerrit.extensions.client.SubmitType)1 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 HorizontalPanel (com.google.gwt.user.client.ui.HorizontalPanel)1 Label (com.google.gwt.user.client.ui.Label)1 ListBox (com.google.gwt.user.client.ui.ListBox)1 NpTextBox (com.google.gwtexpui.globalkey.client.NpTextBox)1 Test (org.junit.Test)1