Search in sources :

Example 6 with ActionInfo

use of com.google.gerrit.client.info.ActionInfo in project gerrit by GerritCodeReview.

the class Actions method initChangeActions.

private void initChangeActions(ChangeInfo info, boolean hasUser) {
    NativeMap<ActionInfo> actions = info.hasActions() ? info.actions() : NativeMap.<ActionInfo>create();
    actions.copyKeysIntoChildren("id");
    if (hasUser) {
        a2b(actions, "abandon", abandon);
        a2b(actions, "/", deleteChange);
        a2b(actions, "restore", restore);
        a2b(actions, "revert", revert);
        a2b(actions, "followup", followUp);
        if (info.isPrivate()) {
            a2b(actions, "private", unmarkPrivate);
        } else {
            a2b(actions, "private", markPrivate);
        }
        for (String id : filterNonCore(actions)) {
            add(new ActionButton(info, actions.get(id)));
        }
    }
}
Also used : ActionButton(com.google.gerrit.client.actions.ActionButton) ActionInfo(com.google.gerrit.client.info.ActionInfo)

Example 7 with ActionInfo

use of com.google.gerrit.client.info.ActionInfo in project gerrit by GerritCodeReview.

the class Actions method a2b.

private static void a2b(NativeMap<ActionInfo> actions, String a, Button b) {
    if (actions.containsKey(a)) {
        b.setVisible(true);
        ActionInfo actionInfo = actions.get(a);
        b.setTitle(actionInfo.title());
        b.setEnabled(actionInfo.enabled());
    }
}
Also used : ActionInfo(com.google.gerrit.client.info.ActionInfo)

Aggregations

ActionInfo (com.google.gerrit.client.info.ActionInfo)7 ActionButton (com.google.gerrit.client.actions.ActionButton)3 RevisionInfo (com.google.gerrit.client.info.ChangeInfo.RevisionInfo)3 CommitInfo (com.google.gerrit.client.info.ChangeInfo.CommitInfo)1 NativeMap (com.google.gerrit.client.rpc.NativeMap)1 RestApi (com.google.gerrit.client.rpc.RestApi)1 SmallHeading (com.google.gerrit.client.ui.SmallHeading)1 Status (com.google.gerrit.reviewdb.client.Change.Status)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1 SafeHtmlBuilder (com.google.gwtexpui.safehtml.client.SafeHtmlBuilder)1