当前位置: 首页>>代码示例>>Python>>正文


Python VerticalPanel.clear方法代码示例

本文整理汇总了Python中pyjamas.ui.VerticalPanel.clear方法的典型用法代码示例。如果您正苦于以下问题:Python VerticalPanel.clear方法的具体用法?Python VerticalPanel.clear怎么用?Python VerticalPanel.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyjamas.ui.VerticalPanel的用法示例。


在下文中一共展示了VerticalPanel.clear方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Events_get

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import clear [as 别名]
class Events_get(Showcase):

    """
    Showcase for method <code>events.get</code>
    """
    
    @java.init
    def __init__(self, *a, **kw):
        self.eventIcon = Image(u"/cal_icon.gif")
        self.outer = VerticalPanel()
        self.responsePanel = VerticalPanel()
        self.listBox = ListBox(False)
    #  Get members
    
    @java.private
    @java.innerclass
    @java.implements(ClickHandler)
    class GetMembersClickHandler(Object):
    
        
        @java.init
        def __init__(self, *a, **kw):
            self.eid = None
            self.addToPanel = None
        
        @__init__.register
        @java.typed(Long, Panel)
        def __init__(self, eid, addToPanel):
            self.eid = eid
            self.addToPanel = addToPanel
        
        @java.typed(ClickEvent)
        def onClick(self, event):
            members = Events_getMembers(self.eid)
            self.addToPanel.clear()
            self.addToPanel.add(members)
    
    @java.private
    @java.innerclass
    @java.implements(ChangeHandler)
    class FilterHandler(Object):
    
        """
        Let user filter events
        """
        
        @java.init
        def __init__(self, *a, **kw):
            pass
        
        @java.typed(ChangeEvent)
        def onChange(self, event):
            idx = self.listBox.getSelectedIndex()
            value = self.listBox.getValue(idx)
            if u"All".equals(value):
                self.doEventsGet(None)
            else:
                self.doEventsGet(RsvpStatus.valueOf(value))
    
    @java.private
    @java.innerclass
    @java.implements(AsyncCallbackList)
    class EventsGetCallback(Object):
    
        """
        Handle events get
        """
        
        @java.init
        def __init__(self, *a, **kw):
            pass
        
        @java.typed(Throwable)
        def onFailure(self, caught):
            self.handleFailure(caught)
        
        @java.typed(List)
        def onSuccess(self, result):
            GWT.log(u"Events get #" + java.str(result.size()), None)
            self.handleResponse(result) #  removeLoader ( outer );
    
    @__init__.register
    @java.typed()
    def __init__(self, ):
        self.__init__._super()
        """
        Create new showcase
        """
        self.outer.getElement().setId(u"Events_get")
        self.outer.addStyleName(u"gwittit-Events_get")
        self.outer.add(self.createEventFilter())
        self.outer.add(self.responsePanel)
        self.doEventsGet(None)
        self.listBox.addChangeHandler(self.FilterHandler())
        self.initWidget(self.outer)
    #  Create ui for dropdown filter
    
    @java.private
    def createEventFilter(self):
        filter = HorizontalPanel()
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:103,代码来源:Events_get.py

示例2: ShowcaseClient

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import clear [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)
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:103,代码来源:ShowcaseClient.py

示例3: Comments_get

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import clear [as 别名]
class Comments_get(Showcase):

    """
    Showcase for method call <code>comments.get</code>
    
    @author olamar72
    """
    
    @java.init
    def __init__(self, *a, **kw):
        self.outer = VerticalPanel()
    XID = u"comments_test"
    #  Display comments
    
    @java.private
    @java.innerclass
    @java.implements(AsyncCallbackList)
    class CommentsGetCallback(Object):
    
        
        @java.init
        def __init__(self, *a, **kw):
            pass
        
        @java.typed(Throwable)
        def onFailure(self, caught):
            self.handleFailure(caught)
        
        @java.typed(List)
        def onSuccess(self, result):
            self.removeLoader(self.outer)
            self.handleCommentsResponse(result)
    #  Remove comments
    
    @java.private
    @java.innerclass
    @java.implements(AsyncCallbackJavaScriptObject)
    class CommentsRemoveCallback(Object):
    
        
        @java.init
        def __init__(self, *a, **kw):
            pass
        
        @java.typed(Throwable)
        def onFailure(self, caught):
            self.handleFailure(caught)
        
        @java.typed(JavaScriptObject)
        def onSuccess(self, result):
            self.doCommentsGet() #  ReRender comments
    #  User clicks remove link
    
    @java.private
    @java.innerclass
    @java.implements(ClickHandler)
    class CommentsRemoveClickHandler(Object):
    
        
        @java.init
        def __init__(self, *a, **kw):
            self.commentId = None
        
        @__init__.register
        @java.typed(String)
        def __init__(self, commentId):
            self.commentId = commentId
        
        @java.typed(ClickEvent)
        def onClick(self, event):
            self.apiClient.commentsRemove(self.__class__.XID, self.commentId, self.CommentsRemoveCallback())
    
    @__init__.register
    @java.typed()
    def __init__(self, ):
        self.__init__._super()
        """
        Create showcase
        """
        self.outer.getElement().setId(u"comments.get")
        self.doCommentsGet()
        self.initWidget(self.outer)
    
    @java.private
    def doCommentsGet(self):
        """
        Call comments get
        """
        self.outer.clear()
        self.addLoader(self.outer)
        self.apiClient.commentsGet(self.__class__.XID, self.CommentsGetCallback())
    
    @java.private
    @java.typed(List)
    def handleCommentsResponse(self, comments):
        for comment in comments:
            box = VerticalPanel()
            box.addStyleName(u"commentBox")
            p = HorizontalPanel()
            p.setSpacing(5)
#.........这里部分代码省略.........
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:103,代码来源:Comments_get.py

示例4: GwittIt

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import clear [as 别名]

#.........这里部分代码省略.........
        def onSuccess(self, result):
            pass

    @java.private
    @java.innerclass
    @java.implements(AsyncCallbackConnectState)
    class RenderAppWhenReadyCallback(Object):

        """
        Fired when we know users status
        """

        @java.init
        def __init__(self, *a, **kw):
            pass

        @java.typed(Throwable)
        def onFailure(self, caught):
            Window.alert(u"Failed to get status:" + java.str(caught))

        @java.typed(ConnectState)
        def onSuccess(self, result):
            self.outer.remove(self.waitingText)
            if result == ConnectState.connected:
                self.renderWhenConnected()
            else:
                self.renderWhenNotConnected()

    @java.private
    @java.innerclass
    @java.implements(LoginCallback)
    class MyLoginCallback(Object):

        """
        Fired when user clicks fb login button
        """

        @java.init
        def __init__(self, *a, **kw):
            pass

        def onLogin(self):
            self.renderWhenConnected()
            self.sendNotificationToDeveloper()
            self.logUser()

    def onModuleLoad(self):
        """
        Load Main Module
        """
        self.loginCallback = self.MyLoginCallback()
        self.topMenu = TopMenu()
        self.outer.getElement().setId(u"GwittIt")
        self.outer.ensureDebugId(u"GwittIt")
        self.waitingText.getElement().setAttribute(u"style", u"color: white; font-weight: bold")
        self.outer.add(self.waitingText)
        FacebookConnect.init(
            self.__class__.API_KEY, u"/xd_receiver.htm", self.loginCallback
        )  #  Set up Facebook Connect
        FacebookConnect.waitUntilStatusReady(
            self.RenderAppWhenReadyCallback()
        )  #  Wait until we can determine the users status
        RootPanel.get().add(self.outer)  #  Add UI.

    def renderWhenConnected(self):
        """
        Render when user is connected
        """
        self.topMenu.renderLoginInfo()
        self.outer.clear()
        self.outer.add(self.topMenu)
        self.outer.add(ShowcaseClient())

    def renderWhenNotConnected(self):
        """
        Render when user is not connected
        """
        self.loginBoxPanel = LoginBox()
        self.loginBoxPanel.addLoginCallback(self.loginCallback)
        self.outer.add(self.topMenu)
        self.outer.add(self.loginBoxPanel)

    @java.private
    def sendNotificationToDeveloper(self):
        """
        Send notification about who added the app. used for personal stats .
        """
        notification = u" logged in using " + java.str(self.getUserAgent())
        recepients = ArrayList((Long))
        recepients.add(Long(744450545))
        self.apiClient.notificationsSendEmail(recepients, u"User logged in", notification, u"", Callback((List)))

    @java.private
    def logUser(self):
        self.userService.logUser(self.apiClient.getLoggedInUser(), self.LogCallback())

    @java.static
    @java.native
    def getUserAgent(self):
        """
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:104,代码来源:GwittIt.py

示例5: Comments_add

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import clear [as 别名]
class Comments_add(Showcase):

    """
    Showcase for method call <code>comments.add</code>
    
    @author olamar72
    """
    
    @java.init
    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 ")
    #  Handle add comment
    
    @java.private
    @java.innerclass
    @java.implements(AsyncCallbackJavaScriptObject)
    class AddCommentCallback(Object):
    
        
        @java.init
        def __init__(self, *a, **kw):
            pass
        
        @java.typed(Throwable)
        def onFailure(self, caught):
            self.handleFailure(caught)
        
        @java.typed(JavaScriptObject)
        def onSuccess(self, result):
            self.removeLoader(self.outer)
            self.text.setValue(None)
            self.responseWrapper.add(HTML(u" Thanks :-)"))
            self.displayComments()
    #  User adds comment
    
    @java.private
    @java.innerclass
    @java.implements(ClickHandler)
    class AddCommentClickHandler(Object):
    
        
        @java.init
        def __init__(self, *a, **kw):
            pass
        
        @java.typed(ClickEvent)
        def onClick(self, event):
            comment = Comment.createComment(u"comments_test", self.text.getValue())
            self.apiClient.commentsAdd(comment, self.AddCommentCallback())
    
    @__init__.register
    @java.typed()
    def __init__(self, ):
        self.__init__._super()
        """
        New demo
        """
        self.inputWrapper.setSpacing(10)
        self.outer.setSpacing(10)
        self.inputWrapper.getElement().setId(u"CommentsAdd-Input") #  ID's
        self.submitButton.getElement().getStyle().setProperty(u"float", u"right") #  Styles
        self.submitButton.getElement().getStyle().setProperty(u"marginTop", u"10px")
        self.inputWrapper.add(HTML(u"A comment would be great! Thanks."))
        self.inputWrapper.add(self.createInputUi())
        self.outer.add(self.inputWrapper)
        self.outer.add(self.responseWrapper) #  Thank you
        self.outer.add(self.commentsListPanel) #  Show list of comments
        self.displayComments()
        self.submitButton.addClickHandler(self.AddCommentClickHandler())
        Xfbml.parse(self.inputWrapper)
        self.initWidget(self.outer)
    
    @java.private
    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 displayComments(self):
        self.commentsListPanel.clear()
        comments = Comments_get()
        self.commentsListPanel.add(comments)
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:99,代码来源:Comments_add.py

示例6: PermissionDialog

# 需要导入模块: from pyjamas.ui import VerticalPanel [as 别名]
# 或者: from pyjamas.ui.VerticalPanel import clear [as 别名]
class PermissionDialog(Composite):

    """
    Display permission dialog to user.
    """
    
    @java.init
    def __init__(self, *a, **kw):
        self.outer = VerticalPanel()
        self.handler = None
        self.apiClient = ApiFactory.getInstance()
        self.loader = HTML(u"Checking permission")
        self.message = None
    
    @java.interface
    class PermissionHandler(java.Interface):
        
        def onPermissionChange(self, granted):
            pass
    
    @__init__.register
    @java.typed()
    def __init__(self, ):
        self.__init__._super()
        """
        Create a new PermissionDialog
        """
        self.initWidget(self.outer)
    
    @__init__.register
    @java.typed(String)
    def __init__(self, message):
        self.__init__._super()
        self.initWidget(self.outer)
        self.message = message
    
    @java.private
    @java.typed(Permission)
    def createShowPermissionUI(self, permission):
        a = Anchor()
        if self.message is not None:
            a.setHTML(java.str(u"<h3>" + java.str(self.message)) + u"</h3>")
        else:
            a.setHTML(java.str(u"<h3>Grant  " + java.str(permission)) + u" permission</h3>")
        a.addStyleName(u"clickable")
        class _anonymous(ClickHandler):
            
            @java.typed(ClickEvent)
            def onClick(self, event):
                class _anonymous(AsyncCallback):
                    
                    @java.typed(Throwable)
                    def onFailure(self, caught):
                        ErrorResponseUI(caught).center()
                    
                    @java.typed(Boolean)
                    def onSuccess(self, result):
                        if self.handler is not None:
                            self.handler.onPermissionChange(result)
                FacebookConnect.showPermissionDialog(permission, _anonymous())
        a.addClickHandler(_anonymous())
        return a
    
    @java.typed(Permission)
    def checkPermission(self, permission):
        self.outer.clear()
        self.loader.setHTML(java.str(u"Checking " + java.str(permission)) + u" permission ")
        self.outer.add(self.loader)
        class _anonymous(AsyncCallback):
            
            @java.typed(Throwable)
            def onFailure(self, caught):
                ErrorResponseUI(caught).center()
            
            @java.typed(Boolean)
            def onSuccess(self, hasPermission):
                self.outer.remove(self.loader)
                if hasPermission:
                    self.handler.onPermissionChange(True)
                else:
                    self.outer.add(self.createShowPermissionUI(permission))
        self.apiClient.usersHasAppPermission(permission, _anonymous()) #  Check if user has the right permission. If not show permission dialog
    
    @java.typed(PermissionHandler)
    def addPermissionHandler(self, handler):
        self.handler = handler
开发者ID:pombredanne,项目名称:pygwt-facebook,代码行数:88,代码来源:PermissionDialog.py


注:本文中的pyjamas.ui.VerticalPanel.clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。