+ return getNiceName(sone);
+ } else if (member.equals("friend")) {
+ Sone currentSone = (Sone) templateContext.get("currentSone");
+ return (currentSone != null) && currentSone.hasFriend(sone.getId());
+ } else if (member.equals("current")) {
+ Sone currentSone = (Sone) templateContext.get("currentSone");
+ return (currentSone != null) && currentSone.equals(sone);
+ } else if (member.equals("modified")) {
+ return core.isModifiedSone(sone);
+ } else if (member.equals("status")) {
+ return sone.getStatus();
+ } else if (member.equals("unknown")) {
+ return sone.getStatus() == SoneStatus.unknown;
+ } else if (member.equals("idle")) {
+ return sone.getStatus() == SoneStatus.idle;
+ } else if (member.equals("inserting")) {
+ return sone.getStatus() == SoneStatus.inserting;
+ } else if (member.equals("downloading")) {
+ return sone.getStatus() == SoneStatus.downloading;
+ } else if (member.equals("new")) {
+ return !sone.isKnown();
+ } else if (member.equals("locked")) {
+ return core.isLocked(sone);
+ } else if (member.equals("lastUpdatedText")) {
+ return GetTimesAjaxPage.getTime((WebInterface) templateContext.get("webInterface"), sone.getTime());
+ } else if (member.equals("trust")) {
+ Sone currentSone = (Sone) templateContext.get("currentSone");
+ if (currentSone == null) {
+ return null;
+ }
+ Trust trust = sone.getIdentity().getTrust((OwnIdentity) currentSone.getIdentity());
+ logger.log(Level.FINEST, String.format("Trust for %s by %s: %s", sone, currentSone, trust));
+ if (trust == null) {
+ return new Trust(null, null, null);
+ }
+ return trust;
+ }
+ return super.get(templateContext, object, member);
+ }
+
+ //
+ // STATIC METHODS
+ //
+
+ /**
+ * Returns the nice name of the given Sone.
+ *
+ * @param sone
+ * The Sone to get the nice name for
+ * @return The nice name of the Sone
+ */
+ public static String getNiceName(Sone sone) {
+ Profile profile = sone.getProfile();
+ String firstName = profile.getFirstName();
+ String middleName = profile.getMiddleName();
+ String lastName = profile.getLastName();
+ if (firstName == null) {
+ if (lastName == null) {
+ return String.valueOf(sone.getName());