def renderPosts(self, addContentToPnl, posts): """ Render posts i a stream """ addContentToPnl.clear() addContentToPnl.add(HTML(u"Number of posts: " + java.str(posts.__len__()))) for post in Util.iterate(posts): try: GWT.log(u"Render: " + java.str(JSONObject(post).toString()), None) postContentPnl = VerticalPanel() postContentPnl.addStyleName(u"postContent") postContentPnl.add(HTML(java.str(FbName(post.getActorId())) + u" " + post.getMessage())) if post.getAttachment().getName() is not None: postContentPnl.add(self.createAttachmentUI(post.getAttachment())) if post.getLikes().getCount() > 0: postContentPnl.add(self.createLikesUI(post.getLikes())) if post.getComments().getCount() > 0: postContentPnl.add(self.createCommentsUI(post.getComments())) p = HorizontalPanel() # Add profilepic on the left, postcontent on the right p.addStyleName(u"post") p.add(FbProfilePic(post.getActorId())) p.add(postContentPnl) addContentToPnl.add(p) # postPnl.add ( asJson ( "LikesAsJson: ", post.getLikes () )); except Exception,e: GWT.log(u"Unkown exception ", e)
def renderAlbums(self, addContentToPnl, albums): """ Render list of albums in stream """ addContentToPnl.clear() p = VerticalPanel() p.getElement().setId(u"ProfilAlbums") p.add(HTML(u"<h3>Albums in Stream</h3>")) for a in Util.iterate(albums): p.add(HTML(java.str(u"<h4>" + java.str(a.getName())) + u"</h4>")) if a.hasCover(): p.add(HTML(u" CoverPid: " + java.str(a.getCoverPid()))) p.add(FbPhoto(a.getCoverPid(), FbPhoto.Size.small)) addContentToPnl.add(p) Xfbml.parse(p)
def renderProfiles(self, addContentToPnl, profiles): """ Render profiles in the stream """ addContentToPnl.clear() addContentToPnl.add(HTML(u"<h3>Profiles in Strea</h3>")) for p in Util.iterate(profiles): tmp = FlowPanel() # Split pic on the left, name on the right tmp.addStyleName(u"profiles fbColorLight rounded addSpace") tmp.add(Image(p.getPicSquare())) a = Anchor(p.getName()) # Link to profile a.addStyleName(u"postContent") a.setHref(p.getUrl()) tmp.add(a) addContentToPnl.add(tmp)
def createAttachmentUI(self, attachment): """ Create attachment UI """ p = VerticalPanel() p.addStyleName(u"attachment fbColorLight rounded addSpace") p.add(HTML(u"<h3>Attachment</h3> ")) thumbs = HorizontalPanel() thumbs.setSpacing(10) for m in Util.iterate(attachment.getMedia()): p.add(HTML(u"<b>MediaContent:</b> " + java.str(m.getType()))) if m.getSrc() is not None: thumbs.add(Image(m.getSrc())) if m.getTypeEnum() == Type.video: vLink = Anchor(u"See Video") vLink.setHref(m.getVideo().getSourceUrl()) p.add(vLink) p.add(thumbs) return p
def getOfficers(self): return Util.convertStringArray(self.getOfficersNative())
def getNotReplied(self): return Util.convertStringArray(self.getNotRepliedNative())
def getFriends(self): return Util.convertNumberArray(self.getFriendsArray())
def getAdmins(self): return Util.convertStringArray(self.getAdminsNative())
def getSample(self): return Util.convertNumberArray(self.getSampleArray())
def getRecipients(self): return Util.convertNumberArray(self.getRecipientsNative())
def getNotReplied(self): return Util.convertNumberArray(self.getNotRepliedArray())
def getUnsure(self): return Util.convertNumberArray(self.getUnsureArray())
def getAttending(self): return Util.convertNumberArray(self.getAttendingArray())