コード例 #1
0
 public Object getValueAt(int row, int col) {
   PortletEntry<Subscriber> entry = getObject(row);
   Subscriber subscriber = entry.getValue();
   Publisher pub = subscriber.getPublisher();
   switch (col) {
     case 0:
       Object subsInfoObj = subToSubInfo.get(subscriber);
       if (subsInfoObj instanceof SubscriptionInfo) {
         SubscriptionInfo subsInfo = (SubscriptionInfo) subsInfoObj;
         int newsCount = subsInfo.countSubscriptionListItems();
         if (newsCount == 1) {
           return translate(
               "notificationsPortlet.single.news.in",
               subsInfo.getTitle(SubscriptionInfo.MIME_PLAIN));
         } else {
           return translate(
               "notificationsPortlet.multiple.news.in",
               new String[] {newsCount + "", subsInfo.getTitle(SubscriptionInfo.MIME_PLAIN)});
         }
       }
       return "";
     case 1:
       String innerType = pub.getType();
       return NewControllerFactory.translateResourceableTypeName(innerType, locale);
     default:
       return "ERROR";
   }
 }
コード例 #2
0
 /** @see org.olat.core.gui.components.table.TableDataModel#getValueAt(int, int) */
 public final Object getValueAt(int row, int col) {
   PortletEntry<Subscriber> entry = getObject(row);
   Subscriber subscriber = entry.getValue();
   Publisher pub = subscriber.getPublisher();
   switch (col) {
     case 0:
       {
         SubscriptionInfo subsInfo = subToSubInfo.get(subscriber);
         return subsInfo.getTitle(SubscriptionInfo.MIME_PLAIN);
       }
     case 1:
       {
         SubscriptionInfo subsInfo = subToSubInfo.get(subscriber);
         if (!subsInfo.hasNews()) return "-";
         return subsInfo.getSpecificInfo(SubscriptionInfo.MIME_HTML, locale);
       }
     case 2:
       String innerType = pub.getType();
       return NewControllerFactory.translateResourceableTypeName(innerType, locale);
     default:
       return "error";
   }
 }