Search in sources :

Example 1 with CapabilityInfo

use of com.google.gerrit.client.config.CapabilityInfo in project gerrit by GerritCodeReview.

the class ProjectAccessScreen method onLoad.

@Override
protected void onLoad() {
    super.onLoad();
    CallbackGroup cbs = new CallbackGroup();
    ConfigServerApi.capabilities(cbs.add(new AsyncCallback<NativeMap<CapabilityInfo>>() {

        @Override
        public void onSuccess(NativeMap<CapabilityInfo> result) {
            capabilityMap = result;
        }

        @Override
        public void onFailure(Throwable caught) {
        // Handled by ScreenLoadCallback.onFailure().
        }
    }));
    Util.PROJECT_SVC.projectAccess(getProjectKey(), cbs.addFinal(new ScreenLoadCallback<ProjectAccess>(this) {

        @Override
        public void preDisplay(ProjectAccess access) {
            displayReadOnly(access);
        }
    }));
    savedPanel = ACCESS;
}
Also used : AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) CallbackGroup(com.google.gerrit.client.rpc.CallbackGroup) ScreenLoadCallback(com.google.gerrit.client.rpc.ScreenLoadCallback) NativeMap(com.google.gerrit.client.rpc.NativeMap) CapabilityInfo(com.google.gerrit.client.config.CapabilityInfo) ProjectAccess(com.google.gerrit.common.data.ProjectAccess)

Example 2 with CapabilityInfo

use of com.google.gerrit.client.config.CapabilityInfo in project gerrit by GerritCodeReview.

the class ProjectAccessScreen method displayReadOnly.

private void displayReadOnly(ProjectAccess access) {
    this.access = access;
    Map<String, String> allCapabilities = new HashMap<>();
    for (CapabilityInfo c : Natives.asList(capabilityMap.values())) {
        allCapabilities.put(c.id(), c.name());
    }
    this.access.setCapabilities(allCapabilities);
    accessEditor.setEditing(false);
    UIObject.setVisible(editTools, !access.getOwnerOf().isEmpty() || access.canUpload());
    edit.setEnabled(!access.getOwnerOf().isEmpty() || access.canUpload());
    cancel1.setVisible(false);
    UIObject.setVisible(commitTools, false);
    driver.edit(access);
}
Also used : HashMap(java.util.HashMap) CapabilityInfo(com.google.gerrit.client.config.CapabilityInfo)

Aggregations

CapabilityInfo (com.google.gerrit.client.config.CapabilityInfo)2 CallbackGroup (com.google.gerrit.client.rpc.CallbackGroup)1 NativeMap (com.google.gerrit.client.rpc.NativeMap)1 ScreenLoadCallback (com.google.gerrit.client.rpc.ScreenLoadCallback)1 ProjectAccess (com.google.gerrit.common.data.ProjectAccess)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 HashMap (java.util.HashMap)1