class Contacts(Composite): def __init__(self): Composite.__init__(self) self.contacts = [] self.contacts.append(Contact("Benoit Mandelbrot", "*****@*****.**")) self.contacts.append(Contact("Albert Einstein", "*****@*****.**")) self.contacts.append(Contact("Rene Descartes", "*****@*****.**")) self.contacts.append(Contact("Bob Saget", "*****@*****.**")) self.contacts.append(Contact("Ludwig von Beethoven", "*****@*****.**")) self.contacts.append(Contact("Richard Feynman", "*****@*****.**")) self.contacts.append(Contact("Alan Turing", "*****@*****.**")) self.contacts.append(Contact("John von Neumann", "*****@*****.**")) self.panel = VerticalPanel() # Add all the contacts to the list. i = 0 while (i < len(self.contacts)): self.addContact(self.contacts[i]) i = i + 1 self.initWidget(self.panel) self.setStyleName("mail-Contacts") def addContact(self, contact): link = HTML("<a href='javascript:;'>" + contact.name + "</a>") self.panel.add(link) # Add a click listener that displays a ContactPopup when it is clicked. listener = ContactListener(contact, link) link.addClickListener(listener)
def __init__(self, *a, **kw): self.wText = u"gwt-facebook is a library for writing facebook apps using GWT." + u"Click the menu on the left to browse showcases and see source code." self.outer = VerticalPanel() self.horizontalSplit = HorizontalPanel() self.authMethods = u"XAuth:auth_createToken,auth_expireSession,auth_getSession,auth_promoteSession,auth_revokeAuthorization,auth_revokeExtendedPermission" self.batchMethods = u"XBatch:batch_run" self.commentMethods = u"Comments:comments_xfbml,comments_add,comments_get,Xcomments_remove" self.connectMethods = u"Connect:connect_getUnconnect...,Xconnect_registerUsers,Xconnect_unregisterUsers" self.dataMethods = u"Data:data_getCookies,data_setCookie" self.eventMethods = u"Events:Xevents_cancel,events_create,Xevents_edit,events_get,events_getMembers,Xevents_rsvp" self.fbmlMethods = u"XFBML:fbml_deleteCustomTags,fbml_getCustomTags,fbml_refreshImgSrc,fbml_refreshRefUrl,fbml_registerCustomTags,fbml_setRefHandle" self.feedMethods = u"XFeed:feed_deactivateTemplateBundleByID,feed_getRegisteredTemplateBundleByID,feed_getRegisteredTemplateBundles,feed_publishTemplatizedAction,feed_publishUserAction,feed_registerTemplateBundle" self.fqlMethods = u"XFql:fql_multiquery,fql_query" self.friendMethods = u"Friends:friends_areFriends,friends_get,friends_getAppUsers,friends_getLists,friends_getMutualFriends" self.groupMethods = u"Groups:groups_get,Xgroups_getMembers" self.intlMethods = u"XIntl:intl_getTranslations,intl_uploadNativeStrings" self.linkMethods = u"XLinks:links_get,links_post" self.messageMethods = u"Message:XliveMessage_send,message_getThreadsInFolder" self.noteMethods = u"Notes:notes_create,Xnotes_delete,Xnotes_edit,notes_get" self.notificationMethods = u"Notification:notifications_get,notifications_getList,Xnotifications_markRead,notifications_sendEmail,Xnotifications_sendEmail" self.pageMethods = u"XPages:pages_getInfo,pages_isAdmin,pages_isAppAdded,pages_isFan" self.photoMethods = u"Photos:Xphotos_addTag,photos_createAlbum,photos_get,photos_getAlbums,Xphotos_getTags,Xphotos_upload" self.profileMethods = u"XProfile:profile_getFBML,profile_getInfo,profile_getInfoOptions,profile_setFBML,profile_setInfo,profile_setInfoOptions" self.smsMethods = u"XSMS:Xsms_canSend,sms_send" self.statusMethods = u"XStatus:status_get,status_set" self.streamMethods = u"Stream:Xstream_addComment,Xstream_addLike,stream_get,Xstream_getComments,Xstream_getFilters,stream_publish,stream_publishAttachment,Xstream_remove,Xstream_removeComment,Xstream_removeLike" self.userMethods = u"Users:users_getInfo,users_getLoggedInUser,Xusers_getStandardInfo,Xusers_hasAppPermission,Xusers_isAppUser,Xusers_isVerified,Xusers_setStatus" self.videoMethods = u"XVideo:video_getUploadLimits,video_upload" self.xfbml = u"FBML:various,serverFbml" self.menu = java.Array([self.authMethods, self.batchMethods, self.commentMethods, self.connectMethods, self.dataMethods, self.eventMethods, self.fbmlMethods, self.feedMethods, self.fqlMethods, self.friendMethods, self.groupMethods, self.intlMethods, self.linkMethods, self.messageMethods, self.noteMethods, self.notificationMethods, self.pageMethods, self.photoMethods, self.profileMethods, self.smsMethods, self.statusMethods, self.streamMethods, self.userMethods, self.videoMethods, self.xfbml]) self.showcaseWrapper = VerticalPanel() self.loader = Image(u"/loader.gif") self.treeMenu = self.createMenu() self.apiClient = ApiFactory.getInstance()
def __init__(self, ): self.__init__._super() outer = VerticalPanel() notesHolder = VerticalPanel() friendSelector = FriendSelector() outer.add(friendSelector) outer.add(notesHolder) class _anonymous(FriendSelectionHandler): @java.typed(Long) def onSelected(self, uid): notesHolder.clear() self.addLoader(notesHolder) class _anonymous(AsyncCallback): @java.typed(Throwable) def onFailure(self, caught): self.handleFailure(caught) @java.typed(List) def onSuccess(self, result): self.removeLoader(notesHolder) if result.size() == 0: notesHolder.add(HTML(u"User has not created any notes ")) for n in result: notesHolder.add(HTML(u"Note Title : " + java.str(n.getTitle()))) self.apiClient.notesGet(uid, _anonymous()) friendSelector.addFriendSelectionHandler(_anonymous()) # Let user select a friend and show notes self.initWidget(outer)
class SinkList(Composite): def __init__(self): Composite.__init__(self) self.vp_list=VerticalPanel() self.sinks=[] self.selectedSink=-1 self.initWidget(self.vp_list) self.setStyleName("ks-List") def addSink(self, info): name = info.getName() link = Hyperlink(name, False, name) link.setStyleName("ks-SinkItem") self.vp_list.add(link) self.sinks.append(info) def find(self, sinkName): for info in self.sinks: if info.getName()==sinkName: return info return None def setSinkSelection(self, name): if self.selectedSink <> -1: self.vp_list.getWidget(self.selectedSink).removeStyleName("ks-SinkItem-selected") for i in range(len(self.sinks)): info = self.sinks[i] if (info.getName()==name): self.selectedSink = i widget=self.vp_list.getWidget(self.selectedSink) widget.addStyleName("ks-SinkItem-selected") return
def __init__(self, ): self.__init__._super() outer = VerticalPanel() outer.addStyleName(u"gwittit-Showcase-Groups_get") self.addLoader(outer) class _anonymous(AsyncCallback): @java.typed(Throwable) def onFailure(self, caught): self.removeLoader(outer) self.handleFailure(caught) @java.typed(List) def onSuccess(self, groups): self.removeLoader(outer) for g in groups: membersWrapper = VerticalPanel() membersWrapper.addStyleName(u"membersWrapper") memberLink = Anchor(u"See Members") class _anonymous(ClickHandler): @java.typed(ClickEvent) def onClick(self, event): self.displayMembers(membersWrapper, g.getGid()) memberLink.addClickHandler(_anonymous()) outer.add(HTML(java.str(u"<h4>Group: " + java.str(g.getName())) + u"</h4>")) outer.add(memberLink) outer.add(membersWrapper) self.apiClient.groupsGet(None, _anonymous()) self.initWidget(outer)
class Events_create(Showcase): """ Showcase for method <code>events.create</code> """ @java.init def __init__(self, *a, **kw): self.outer = VerticalPanel() @__init__.register @java.typed() def __init__(self, ): self.__init__._super() """ Create showcase """ self.initWidget(self.outer) def permissionGranted(self): eventEditor = EventEditor() self.outer.add(eventEditor) def getNeedPermission(self): return Permission.create_event
def __init__(self, *a, **kw): self.outer = VerticalPanel() self.inputWrapper = VerticalPanel() self.responseWrapper = SimplePanel() self.commentsListPanel = VerticalPanel() self.text = TextArea() self.submitButton = Button(u"Add Comment ")
def createCommentsUI(self, comments): """ Create comments ui """ p = VerticalPanel() p.addStyleName(u"comments fbColorLight rounded addSpace") p.add(HTML(java.str(u"<h3>Comments on this post: " + java.str(comments.getCount())) + u"</h4>")) return p
def onModuleLoad(self): panel = DockPanel() RootPanel().add(panel) panel.setWidth("100%") panel.setHeight("100%") panel.setSpacing(5) title = HTML('<h1>Hello</h1>') description = HTML("""""") panel.add(title, DockPanel.NORTH) panel.add(description, DockPanel.SOUTH) links = VerticalPanel() links.setSpacing(8) panel.add(links, DockPanel.NORTH) head = HTML(""" <table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading"> <tr bgcolor="#7799ee"> <td valign=bottom> <br> <font color="#ffffff" face="helvetica, arial"> <br><big><big><strong>Hello</strong></big></big></font></td ><td align=right valign=bottom ><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/examples/helloworld/Hello.py">/home/lkcl/src/pyjamas-desktop/pyjamas-webkit/examples/helloworld/Hello.py</a></font></td></tr></table> """) panel.add(head, DockPanel.NORTH) docs = HTML("""<tt><a href="#Hello">Hello</a> World Example</tt>""") panel.add(docs, DockPanel.NORTH) modules = eval(r'''['<a href="pyjamas.DOM.html">pyjamas.DOM</a>', '<a href="pyjamas.Window.html">pyjamas.Window</a>']''') contents = self.multicolumn(modules) contents = self.bigsection('Modules', '#fffff', '#aa55cc', contents) panel.add(contents, DockPanel.NORTH) classes = eval(r'''['<dl>\n<dt><font face="helvetica, arial"><a href="Hello.html#Hello">Hello</a>\n</font></dt></dl>\n', '<p>\n<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">\n<tr bgcolor="#ffc8d8">\n<td colspan=3 valign=bottom> <br>\n<font color="#000000" face="helvetica, arial"><a name="Hello">class <strong>Hello</strong></a></font></td></tr>\n \n<tr><td bgcolor="#ffc8d8"><tt> </tt></td><td> </td>\n<td width="100%">Methods defined here:<br>\n<dl><dt><a name="Hello-onBrowserEvent"><strong>onBrowserEvent</strong></a>(self, event)</dt></dl>\n\n<dl><dt><a name="Hello-onModuleLoad"><strong>onModuleLoad</strong></a>(self)</dt></dl>\n\n<dl><dt><a name="Hello-onTimer"><strong>onTimer</strong></a>(self)</dt></dl>\n\n<dl><dt><a name="Hello-onWindowResized"><strong>onWindowResized</strong></a>(self, width, height)</dt></dl>\n\n</td></tr></table>']''') contents = self.multicolumn(modules) contents = self.bigsection( 'Classes', '#ffffff', '#ee77aa', HTML('\n'.join(classes))) panel.add(contents, DockPanel.NORTH) functions = eval(r'''['<dl><dt><a name="-greet"><strong>greet</strong></a>(sender, event)</dt></dl>\n']''') contents = self.multicolumn(modules) contents = self.bigsection( 'Functions', '#ffffff', '#eeaa77', HTML('\n'.join(functions))) panel.add(contents, DockPanel.NORTH) data = eval(r'''["<strong>test</strong> = 'hello'"]''') contents = self.multicolumn(modules) contents = self.bigsection( 'Data', '#ffffff', '#55aa55', HTML('\n'.join(data))) panel.add(contents, DockPanel.NORTH)
class Connect_getUnconnectedFriendsCount(Showcase): """ Showcase for method <code>connect.getUnconnectedFriendsCount</code> """ @java.init def __init__(self, *a, **kw): self.outer = VerticalPanel() # Handle response @java.private @java.innerclass @java.implements(AsyncCallbackInteger) class CountCallback(Object): @java.init def __init__(self, *a, **kw): pass @java.typed(Throwable) def onFailure(self, caught): self.handleFailure(caught) @java.typed(Integer) def onSuccess(self, count): self.removeLoader(self.outer) self.renderResponse(count) @__init__.register @java.typed() def __init__(self, ): self.__init__._super() """ Create showcase """ self.addLoader(self.outer) self.doGetUnconnctedFriendsCount() self.initWidget(self.outer) @java.private def doGetUnconnctedFriendsCount(self): """ Get data from facebook """ self.apiClient.connectGetUnconnectedFriendsCount(self.CountCallback()) @java.private @java.typed(Integer) def renderResponse(self, count): """ Render response @param count how many unconnected friends """ self.outer.add(HTML(u"<h4>Unconnected Friends Count</h4>")) self.outer.add(HTML(u"Result : " + java.str(count)))
class Photos_get(Showcase): """ Showcase for method call <code>photos.get</code> @author olamar72 """ @java.init def __init__(self, *a, **kw): self.paramsWrapper = None self.resultWrapper = None self.paramsResultWrapper = None method = u"photos.get" @__init__.register @java.typed() def __init__(self, ): self.__init__._super() self.paramsWrapper = HorizontalPanel() self.resultWrapper = VerticalPanel() self.paramsResultWrapper = VerticalPanel() self.paramsWrapper.addStyleName(u"params") self.paramsResultWrapper.add(self.paramsWrapper) self.paramsResultWrapper.add(self.resultWrapper) fs = FriendSelector() class _anonymous(FriendSelectionHandler): @java.typed(Long) def onSelected(self, uid): self.displayPhotos(uid) fs.addFriendSelectionHandler(_anonymous()) self.paramsWrapper.add(fs) self.initWidget(self.paramsResultWrapper) # * Display photos of selected user @java.private @java.typed(Long) def displayPhotos(self, subjId): self.resultWrapper.add(self.getLoader()) class _anonymous(AsyncCallback): @java.typed(Throwable) def onFailure(self, caught): self.handleFailure(caught) @java.typed(List) def onSuccess(self, result): photosPanel = FlowPanel() photosPanel.getElement().setId(u"photosPanel") self.resultWrapper.clear() self.resultWrapper.add(HTML(java.str(u"<h4>Photos size: " + java.str(result.size())) + u"</h4>")) for p in result: photosPanel.add(FbPhoto(p.getPid(), Size.thumb)) self.resultWrapper.add(photosPanel) Xfbml.parse(photosPanel.getElement()) self.apiClient.photosGet(subjId, _anonymous()) # Get photos from facebook
def createUserInputUI(self, saveButton): """ Create user input UI @return user input ui """ p = VerticalPanel() title = TextBox() content = TextBox() p.setSpacing(10) p.add(self.createInput(u"Title", title)) p.add(self.createInput(u"Content", content)) p.add(saveButton) class _anonymous(ClickHandler): @java.typed(ClickEvent) def onClick(self, event): note = Note.createNote(title.getValue(), content.getValue()) class _anonymous(AsyncCallback): @java.typed(Throwable) def onFailure(self, caught): Notes_create.self###NOTIMPL QThis###.handleFailure(caught) @java.typed(Long) def onSuccess(self, noteId): p.add(HTML(u"Added note with id " + java.str(noteId))) deleteNoteLink = Anchor(u"Delete") deleteNoteLink.addClickHandler(self.DeleteNoteClickHandler(noteId)) p.add(deleteNoteLink) self.apiClient.notesCreate(note, _anonymous()) saveButton.addClickHandler(_anonymous()) # User clicks save, store it to facebook return p
def __init__(self): Composite.__init__(self) self.signOutLink = HTML("<a href='javascript:;'>Sign Out</a>") self.aboutLink = HTML("<a href='javascript:;'>About</a>") outer = HorizontalPanel() inner = VerticalPanel() outer.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) inner.setHorizontalAlignment(HasAlignment.ALIGN_RIGHT) links = HorizontalPanel() links.setSpacing(4) links.add(self.signOutLink) links.add(self.aboutLink) outer.add(inner) inner.add(HTML("<b>Welcome back, [email protected]</b>")) inner.add(links) self.signOutLink.addClickListener(self) self.aboutLink.addClickListener(self) self.initWidget(outer) inner.setStyleName("mail-TopPanel") links.setStyleName("mail-TopPanelLinks")
def renderMainContent(self, addContentToPnl): """ Render when user granted us permission to read stream """ streamBody = VerticalPanel() streamBody.getElement().setId(u"streamBody") menu = HorizontalPanel() menu.addStyleName(u"streamMenu") menu.setSpacing(5) postsLink = Anchor(u"Posts") # Create menu profilesLink = Anchor(u"Profiles") albumsLink = Anchor(u"Albums") menu.add(HTML(u"<b> Choose Stream : </b> ")) menu.add(postsLink) menu.add(albumsLink) menu.add(profilesLink) class _anonymous(ClickHandler): @java.typed(ClickEvent) def onClick(self, event): self.renderPosts(streamBody, self.stream.getPosts()) Xfbml.parse(streamBody) postsLink.addClickHandler(_anonymous()) # Click posts link class _anonymous(ClickHandler): @java.typed(ClickEvent) def onClick(self, event): streamBody.clear() self.renderProfiles(streamBody, self.stream.getProfiles()) profilesLink.addClickHandler(_anonymous()) # Click profiles link class _anonymous(ClickHandler): @java.typed(ClickEvent) def onClick(self, event): self.renderAlbums(streamBody, self.stream.getAlbums()) albumsLink.addClickHandler(_anonymous()) # Click album links addContentToPnl.add(streamBody) self.addLoader(streamBody) # Start loading class _anonymous(AsyncCallback): @java.typed(Throwable) def onFailure(self, caught): self.handleFailure(caught) @java.typed(Stream) def onSuccess(self, result): self.stream = result addContentToPnl.insert(menu, 0) self.removeLoader(streamBody) self.renderPosts(streamBody, result.getPosts()) Xfbml.parse(streamBody) self.apiClient.streamGet(_anonymous()) # Get stream from facebook.
def createInputUi(self): """ * Create input text area and submit button. """ vp = VerticalPanel() p = HorizontalPanel() p.setSpacing(10) p.add(FbProfilePic(self.apiClient.getLoggedInUser(), FbProfilePic.Size.square)) self.text.setHeight(u"100px") self.text.setWidth(u"400px") vp.add(self.text) vp.add(self.submitButton) p.add(vp) return p
def __init__(self, ): self.__init__._super() outer = VerticalPanel() mutualFriends = VerticalPanel() mutualFriends.getElement().setId(u"Friends_getMutualFriends-mutualFriends") fs = FriendSelector() # Let the user pick a friends class _anonymous(FriendSelectionHandler): # Check if current logged in user has common friends with selected. @java.typed(Long) def onSelected(self, targetUid): mutualFriends.clear() self.addLoader(mutualFriends) class _anonymous(AsyncCallback): @java.typed(Throwable) def onFailure(self, caught): self.handleFailure(caught) @java.typed(List) def onSuccess(self, result): self.removeLoader(mutualFriends) mutualFriends.add(HTML(java.str(u"Number of mutual friends " + java.str(result.size())) + u" with " + FbName(targetUid))) p = ProfilePicsPanel(result) mutualFriends.add(p) self.apiClient.friendsGetMutualFriends(targetUid, _anonymous()) # Call facebook fs.addFriendSelectionHandler(_anonymous()) outer.add(fs) outer.add(mutualFriends) self.initWidget(outer)
def onSuccess(self, groups): self.removeLoader(outer) for g in groups: membersWrapper = VerticalPanel() membersWrapper.addStyleName(u"membersWrapper") memberLink = Anchor(u"See Members") class _anonymous(ClickHandler): @java.typed(ClickEvent) def onClick(self, event): self.displayMembers(membersWrapper, g.getGid()) memberLink.addClickHandler(_anonymous()) outer.add(HTML(java.str(u"<h4>Group: " + java.str(g.getName())) + u"</h4>")) outer.add(memberLink) outer.add(membersWrapper)
class ProfilePicsPanel(Composite): """ Display Profile Pics in a panel. CSS Configuration. <ul> <li>.gwittit-ProfilePicsPanel <li>.gwittit-ProfilePicsPanel-pics </ul> """ @java.init def __init__(self, *a, **kw): self.outer = VerticalPanel() self.pics = FlowPanel() self.seeAllLink = Anchor(u"See All") self.PAGE_SIZE = 10 self.uids = None @__init__.register @java.typed(List) def __init__(self, uids): self.__init__._super() """ Create a new Panel """ self.uids = uids self.outer.getElement().setId(u"ProfilePicsPanel") self.pics.getElement().setId(u"ProfilePicsPanel-pics-" + java.str(System.currentTimeMillis())) self.outer.addStyleName(u"gwittit-ProfilePicsPanel") self.pics.addStyleName(u"gwittit-ProfilePicsPanel-pics") self.outer.add(self.pics) self.renderProfilePics() # Add list of fbprofilepics to the pics panel if uids.size() > PAGE_SIZE: self.outer.add(self.seeAllLink) class _anonymous(ClickHandler): @java.typed(ClickEvent) def onClick(self, event): popup = ProfilePicsPopup(uids) popup.center() popup.show() self.seeAllLink.addClickHandler(_anonymous()) Xfbml.parse(self.pics) self.initWidget(self.outer) @java.private def renderProfilePics(self): i = 0 while i < PAGE_SIZE and i < self.uids.size(): i+= 1 uid = self.uids.get(i) profilePic = FbProfilePic(uid, Size.square) profilePic.setWidth(u"35px") profilePic.setHeight(u"35px") self.pics.add(profilePic)
def __init__(self, calendar): Composite.__init__(self) self.calendar = calendar self.dayCheckBoxListener = DayCheckBoxListener(calendar) self.outer = VerticalPanel() self.initWidget(self.outer) self.setStyleName("DynaTable-DayFilterWidget") self.outer.add(DayCheckBox(self, "Sunday", 0)) self.outer.add(DayCheckBox(self, "Monday", 1)) self.outer.add(DayCheckBox(self, "Tuesday", 2)) self.outer.add(DayCheckBox(self, "Wednesday", 3)) self.outer.add(DayCheckBox(self, "Thursday", 4)) self.outer.add(DayCheckBox(self, "Friday", 5)) self.outer.add(DayCheckBox(self, "Saturday", 6)) self.buttonAll = Button("All", self) self.buttonNone = Button("None", self) hp = HorizontalPanel() hp.setHorizontalAlignment(HasAlignment.ALIGN_CENTER) hp.add(self.buttonAll) hp.add(self.buttonNone) self.outer.add(hp) self.outer.setCellVerticalAlignment(hp, HasAlignment.ALIGN_BOTTOM) self.outer.setCellHorizontalAlignment(hp, HasAlignment.ALIGN_CENTER)
def __init__(self, ): self.__init__._super() outer = VerticalPanel() outer.getElement().setId(u"Friends_getAppUsers") self.addLoader(outer) class _anonymous(AsyncCallback): @java.typed(Throwable) def onFailure(self, caught): self.handleFailure(caught) @java.typed(List) def onSuccess(self, result): self.removeLoader(outer) outer.add(ProfilePicsPanel(result)) self.apiClient.friendsGetAppUsers(_anonymous()) self.initWidget(outer)
def __init__(self, ): self.__init__._super() self.paramsWrapper = HorizontalPanel() self.resultWrapper = VerticalPanel() self.paramsResultWrapper = VerticalPanel() self.paramsWrapper.addStyleName(u"params") self.paramsResultWrapper.add(self.paramsWrapper) self.paramsResultWrapper.add(self.resultWrapper) fs = FriendSelector() class _anonymous(FriendSelectionHandler): @java.typed(Long) def onSelected(self, uid): self.displayPhotos(uid) fs.addFriendSelectionHandler(_anonymous()) self.paramsWrapper.add(fs) self.initWidget(self.paramsResultWrapper)
def __init__(self): Composite.__init__(self) self.vp_list=VerticalPanel() self.sinks=[] self.selectedSink=-1 self.initWidget(self.vp_list) self.setStyleName("ks-List")
def __init__(self, *a, **kw): self.outer = VerticalPanel() self.topMenu = None self.apiClient = GWT.create(FacebookApi.__class__) self.loginBoxPanel = None self.loginCallback = None self.waitingText = HTML(u"Waiting for facebook connect status...") self.userService = GWT.create(UserService.__class__)
def __init__(self, *a, **kw): self.outer = VerticalPanel() self.scrollPanel = ScrollPanel() self.picsHolder = VerticalPanel() self.PAGE_SIZE = 30 self.page = 0 self.moreButton = Button(u"More") self.uids = None
def __init__(self, ): self.__init__._super() self.outer = VerticalPanel() self.saveButton.setEnabled(False) # Need this here so we can enable when user granted permission self.outer.add(HTML(u"<h3>Note: this method is marked as beta in the API and may not work </h3> ")) self.outer.add(self.permissionHolder) self.outer.add(self.createUserInputUI(self.saveButton)) self.initWidget(self.outer) # Get right permission to create a note, if we get the right
def onModuleLoad(self): self.curInfo='' self.curSink=None self.description=HTML() self.sink_list=SinkList() self.panel=DockPanel() self.loadSinks() self.sinkContainer = DockPanel() self.sinkContainer.setStyleName("ks-Sink") vp=VerticalPanel() vp.setWidth("100%") vp.add(self.description) vp.add(self.sinkContainer) self.description.setStyleName("ks-Info") self.panel.add(self.sink_list, DockPanel.WEST) self.panel.add(vp, DockPanel.CENTER) self.panel.setCellVerticalAlignment(self.sink_list, HasAlignment.ALIGN_TOP) self.panel.setCellWidth(vp, "100%") History().addHistoryListener(self) RootPanel().add(self.panel) #RootPanel().add(Logger()) #Show the initial screen. initToken = History().getToken() if len(initToken): self.onHistoryChanged(initToken) else: self.showInfo()
def __init__(self, ): self.__init__._super() """ Create showcase client. """ History.addValueChangeHandler(self) self.outer.getElement().setId(u"ShowcaseClient") self.showcaseWrapper.getElement().setId(u"ShowcaseWrapper") self.horizontalSplit.setSpacing(10) self.showcaseWrapper.setWidth(u"700px") self.showcaseWrapper.addStyleName(u"showcaseWrapper") self.treeMenu.addStyleName(u"treeMenu") token = Window.Location.getHash() if token == None or u"".equals(token): self.doDisplayShowcase(self.__class__.DEFAULT_SHOW) self.showcaseWrapper.insert(self.createDefaultFrontpage(), 0) else: self.doDisplayShowcase(token) treeMenuWrapper = VerticalPanel() treeMenuWrapper.addStyleName(u"treeMenuWrapper") treeMenuWrapper.add(HTML(u"<h4>Methods: </h4>")) treeMenuWrapper.add(self.treeMenu) self.horizontalSplit.add(treeMenuWrapper) # Add left + right column self.horizontalSplit.add(self.decorate(self.showcaseWrapper)) self.outer.add(self.horizontalSplit) Xfbml.parse(self.outer) self.initWidget(self.outer)
def __init__(self, ): self.__init__._super() outer = VerticalPanel() outer.getElement().setId(self.__class__.method) self.addLoader(outer) class _anonymous(AsyncCallback): @java.typed(Throwable) def onFailure(self, caught): self.handleFailure(caught) @java.typed(List) def onSuccess(self, result): self.removeLoader(outer) for fl in result: outer.add(HTML(java.str(fl.getFlid()) + u"/" + fl.getName())) self.apiClient.friendsGetLists(_anonymous()) # Call facebook self.initWidget(outer)
def displayUsers(self, picsList, page): startIdx = page * PAGE_SIZE stopIdx = startIdx + (PAGE_SIZE - 1) holder = VerticalPanel() holder.getElement().setId(u"ProfilePics-Page_" + java.str(page)) i = startIdx while i < self.uids.size() and i < stopIdx: i+= 1 uid = self.uids.get(i) wrapper = HorizontalPanel() wrapper.setSpacing(10) profilePic = FbProfilePic(uid, Size.square) name = FbName(uid) wrapper.add(profilePic) wrapper.add(name) holder.add(wrapper) picsList.add(holder) Xfbml.parse(holder)
def createFavoriteWidget(self): wrapper = VerticalPanel() wrapper.addStyleName(u"favPanel") self.favPanel.setSpacing(10) self.favPanel.add(self.top1) wrapper.add(self.favPanel) wrapper.add(self.publishButton) return wrapper