Ejemplo n.º 1
0
 /**
  * Sets the currently selected row by key of its {@link UserItem}.
  *
  * @param key key of {@link UserItem}
  * @param forceExpand whether the selected row shall be expanded
  */
 public void setSelectedKey(Key key, boolean forceExpand) {
   if (key == null) {
     RowWidget old = rows.get(selected);
     old.collapse();
     old.removeStyleDependentName("selected");
     selected = null;
     SelectionChangeEvent.fire(this);
   } else if (key.equals(selected)) {
     // was selected and is selected
   } else {
     boolean expand = true;
     // selected changed
     if (selected != null) {
       RowWidget old = rows.get(selected);
       old.removeStyleDependentName("selected");
       if (old.isExpanded()) {
         old.collapse();
       } else {
         expand = false;
       }
     }
     RowWidget newly = rows.get(key);
     if (expand || forceExpand) {
       newly.expand();
     }
     selected = key;
     newly.addStyleDependentName("selected");
     SelectionChangeEvent.fire(this);
   }
 }
Ejemplo n.º 2
0
 @Override
 public int compareTo(MemoStorable other) {
   if (myKey != null && other.myKey != null && myKey.equals(other.myKey)) {
     return 0;
   }
   if (this.storeTime == other.storeTime) {
     return (int) ((this.nanoTime - other.nanoTime) % Integer.MAX_VALUE);
   }
   return (int) ((this.storeTime - other.storeTime) % Integer.MAX_VALUE);
 }
Ejemplo n.º 3
0
 @Override
 public boolean equals(Object o) {
   if (o instanceof MemoStorable) {
     MemoStorable other = (MemoStorable) o;
     if (myKey != null && other.myKey != null && myKey.equals(other.myKey)) {
       return true;
     }
     if ((myKey == null || other.myKey == null) && this.storeTime == other.storeTime) {
       return (this.nanoTime == other.nanoTime);
     }
   }
   return false;
 }
Ejemplo n.º 4
0
 public void delete(Key key) {
   if (deletedCache.getIfPresent(key) != null) return;
   if (myKey.equals(key)) {
     deletedCache.put(key, this);
   }
   try {
     Entity ent = datastore.get(key);
     if (ent.hasProperty("next")) {
       delete((Key) ent.getProperty("next")); // recurse
     }
     datastore.delete(key);
     try {
       datastore.get(myKey);
     } catch (EntityNotFoundException e) {
     }
   } catch (Exception e) {
     // e.printStackTrace();
   }
 }
Ejemplo n.º 5
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   TechnicalInfo other = (TechnicalInfo) obj;
   if (key == null) {
     if (other.key != null) {
       return false;
     }
   } else if (!key.equals(other.key)) {
     return false;
   }
   return true;
 }
Ejemplo n.º 6
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   Attendance other = (Attendance) obj;
   if (key == null) {
     if (other.key != null) {
       return false;
     }
   } else if (!key.equals(other.key)) {
     return false;
   }
   return true;
 }
Ejemplo n.º 7
0
 @Override
 public boolean equals(Object obj) {
   if (this == obj) {
     return true;
   }
   if (obj == null) {
     return false;
   }
   if (getClass() != obj.getClass()) {
     return false;
   }
   AnswerSessionModel other = (AnswerSessionModel) obj;
   if (key == null) {
     if (other.key != null) {
       return false;
     }
   } else if (!key.equals(other.key)) {
     return false;
   }
   return true;
 }