本文整理汇总了Python中pyjamas.ui.VerticalPanel.insert方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.insert方法的具体用法?Python VerticalPanel.insert怎么用?Python VerticalPanel.insert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.ui.VerticalPanel
的用法示例。
在下文中一共展示了VerticalPanel.insert方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ShowcaseClient
# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import insert [as 别名]
class ShowcaseClient(Composite):
"""
This class wraps showcases and adds a treemenu for navigation.
TODO: Needs a cleanup.
"""
@java.init
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()
DEFAULT_SHOW = u"#comments_xfbml"
@java.private
@java.innerclass
@java.implements(SelectionHandlerTreeItem)
class ShowcaseHandler(Object):
@java.init
def __init__(self, *a, **kw):
pass
@java.typed(SelectionEvent)
def onSelection(self, event):
clickedLink = event.getSelectedItem()
if clickedLink.getChildCount() == 0:
if not self.apiClient.isSessionValid():
Window.alert(u"Your session has expired")
self.showcaseWrapper.clear()
else:
History.newItem(clickedLink.getText())
@__init__.register
@java.typed()
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)
@java.private
def createDefaultFrontpage(self):
pp = FbProfilePic(self.apiClient.getLoggedInUser(), Size.square)
pp.setSize(u"30px", u"30px")
name = FbName(self.apiClient.getLoggedInUser())
name.setUseyou(False)
#.........这里部分代码省略.........