Search in sources :

Example 1 with GpgKeyInfo

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

the class MyGpgKeysScreen method refreshKeys.

private void refreshKeys() {
    AccountApi.self().view("gpgkeys").get(NativeMap.copyKeysIntoChildren("id", new GerritCallback<NativeMap<GpgKeyInfo>>() {

        @Override
        public void onSuccess(NativeMap<GpgKeyInfo> result) {
            List<GpgKeyInfo> list = Natives.asList(result.values());
            // TODO(dborowitz): Sort on something more meaningful, like
            // created date?
            Collections.sort(list, new Comparator<GpgKeyInfo>() {

                @Override
                public int compare(GpgKeyInfo a, GpgKeyInfo b) {
                    return a.id().compareTo(b.id());
                }
            });
            keys.clear();
            keyText.setText("");
            errorPanel.setVisible(false);
            addButton.setEnabled(true);
            if (!list.isEmpty()) {
                keys.setVisible(true);
                for (GpgKeyInfo k : list) {
                    keys.addOneKey(k);
                }
                showKeyTable(true);
                showAddKeyBlock(false);
            } else {
                keys.setVisible(false);
                showAddKeyBlock(true);
                showKeyTable(false);
            }
            display();
        }
    }));
}
Also used : GerritCallback(com.google.gerrit.client.rpc.GerritCallback) NativeMap(com.google.gerrit.client.rpc.NativeMap) GpgKeyInfo(com.google.gerrit.client.info.GpgKeyInfo)

Aggregations

GpgKeyInfo (com.google.gerrit.client.info.GpgKeyInfo)1 GerritCallback (com.google.gerrit.client.rpc.GerritCallback)1 NativeMap (com.google.gerrit.client.rpc.NativeMap)1