Exemplo n.º 1
0
 /**
  * Insert a digest before amongst the currently shown digests
  *
  * @param insertRef the DigestView to insert the new digest before. The new digest is inserted
  *     last if insertRef is {@null}.
  * @param digest the digest to insert.
  * @return the newly inserted DigestView.
  */
 private DigestView insertDigest(DigestView insertRef, Digest digest) {
   DigestView newDigestUi = null;
   if (insertRef != null) {
     newDigestUi = searchUi.insertBefore(insertRef, digest);
     digestUis.put(newDigestUi, digest);
   } else {
     insertRef = searchUi.getLast();
     newDigestUi = searchUi.insertAfter(insertRef, digest);
     digestUis.put(newDigestUi, digest);
   }
   return newDigestUi;
 }
Exemplo n.º 2
0
 /**
  * Find the DigestView that contains a certain digest
  *
  * @param digest the digest the DigestView should contain.
  * @return the DigestView containing the digest. {@null} if the digest is not found.
  */
 private DigestView findDigestView(Digest digest) {
   DigestView digestUi = searchUi.getFirst();
   while (digestUi != null) {
     if (digestUis.get(digestUi).equals(digest)) {
       return digestUi;
     }
     digestUi = searchUi.getNext(digestUi);
   }
   return null;
 }
Exemplo n.º 3
0
 private void renderDigests() {
   isRenderingInProgress = true;
   // Preserve selection on re-rendering.
   WaveId toSelect = selected != null ? digestUis.get(selected).getWaveId() : null;
   searchUi.clearDigests();
   digestUis.clear();
   setSelected(null);
   for (int i = 0, size = search.getMinimumTotal(); i < size; i++) {
     Digest digest = search.getDigest(i);
     if (digest == null) {
       continue;
     }
     DigestView digestUi = searchUi.insertBefore(null, digest);
     digestUis.put(digestUi, digest);
     if (digest.getWaveId().equals(toSelect)) {
       setSelected(digestUi);
     }
   }
   isRenderingInProgress = false;
 }
Exemplo n.º 4
0
 private void selectWaveUri(String waveId) {
   // Log.info("Trying to select waveId " + waveId);
   DigestView digestUi = searchUi.getFirst();
   while (digestUi != null) {
     Digest digest = digestUis.get(digestUi);
     WaveId iteraWaveId = digest.getWaveId();
     // Log.info("Comparing to waveId " + iteraWaveId);
     if (iteraWaveId.equals(WaveId.deserialise(waveId))) {
       setSelected(digestUi);
       return;
     }
     digestUi = searchUi.getNext(digestUi);
   }
   setSelected(null);
 }
Exemplo n.º 5
0
 /** Invokes the wave-select action on the currently selected digest. */
 private void openSelected() {
   actionHandler.onWaveSelected(digestUis.get(selected).getWaveId());
 }