Ejemplo n.º 1
0
    def __init__(self, rowStyles=DEFAULT_ROW_STYLENAMES,
                             containerIndex=1) :
        """ Creates a new panel using the specified style names to
            apply to each row.  Each row will contain three cells
            (Left, Center, and Right). The Center cell in the
            containerIndex row will contain the {@link Widget}.
            
            @param rowStyles an array of style names to apply to each row
            @param containerIndex the index of the container row
        """
      
        SimplePanel.__init__(self, DOM.createTable())

        # Add a tbody
        self.table = self.getElement()
        self.tbody = DOM.createTBody()
        DOM.appendChild(self.table, self.tbody)
        DOM.setIntAttribute(self.table, "cellSpacing", 0)
        DOM.setIntAttribute(self.table, "cellPadding", 0)

        # Add each row
        for i in range(len(rowStyles)): 
            row = self.createTR(rowStyles[i])
            DOM.appendChild(self.tbody, row)
            if i == containerIndex:
                self.containerElem = DOM.getFirstChild(DOM.getChild(row, 1))

        # Set the overall style name
        self.setStyleName(self.DEFAULT_STYLENAME)
Ejemplo n.º 2
0
 def renderLoginInfo(self):
     self.loginInfo.clear()
     uid = self.apiClient.getLoggedInUser()
     fbName = FbName(uid, False)
     fbName.setUseyou(False)
     pic = FbProfilePic(uid, FbProfilePic.Size.square)
     pic.setSize(u"15px", u"15px")
     GWT.log(u"TopMenu: render " + java.str(fbName), None)
     self.loginInfo.add(fbName)
     tmp = SimplePanel()
     tmp.addStyleName(u"miniProfilePic")
     tmp.setWidget(pic)
     self.loginInfo.add(tmp)
     logout = Anchor(u"Logout")
     class _anonymous(ClickHandler):
         
         @java.typed(ClickEvent)
         def onClick(self, event):
             FacebookConnect.logoutAndRedirect(u"/")
     logout.addClickHandler(_anonymous())
     self.loginInfo.add(logout)