コード例 #1
0
ファイル: components.py プロジェクト: pombredanne/pyjamas
    def __init__(self,parent):
        AbsolutePanel.__init__(self)
        ftable = FlexTable()

        ftable.setWidget(0, 0, Label("First Name", wordWrap=False))
        ftableFormatter = ftable.getFlexCellFormatter()
        self.firstInput = TextBox()
        self.firstInput.addChangeListener(self.checkValid)
        self.firstInput.addKeyboardListener(self)
        ftable.setWidget(0, 1, self.firstInput)

        ftable.setWidget(1, 0, Label("Last Name", wordWrap=False))
        self.lastInput = TextBox()
        self.lastInput.addChangeListener(self.checkValid)
        self.lastInput.addKeyboardListener(self)
        ftable.setWidget(1, 1, self.lastInput)

        ftable.setWidget(2, 0, Label("Email", wordWrap=False))
        self.emailInput = TextBox()
        self.emailInput.addChangeListener(self.checkValid)
        self.emailInput.addKeyboardListener(self)
        ftable.setWidget(2, 1, self.emailInput)

        ftable.setWidget(3, 0, Label("Username", wordWrap=False))
        self.usernameInput = TextBox()
        self.usernameInput.addChangeListener(self.checkValid)
        self.usernameInput.addKeyboardListener(self)
        ftable.setWidget(3, 1, self.usernameInput)

        ftable.setWidget(4, 0, Label("Password", wordWrap=False))
        self.passwordInput = PasswordTextBox()
        self.passwordInput.addChangeListener(self.checkValid)
        self.passwordInput.addKeyboardListener(self)
        ftable.setWidget(4, 1, self.passwordInput)

        ftable.setWidget(5, 0, Label("Confirm", wordWrap=False))
        self.confirmInput = PasswordTextBox()
        self.confirmInput.addChangeListener(self.checkValid)
        self.confirmInput.addKeyboardListener(self)
        ftable.setWidget(5, 1, self.confirmInput)

        ftable.setWidget(6, 0, Label("Department", wordWrap=False))
        self.departmentCombo = ListBox()
        self.departmentCombo.addChangeListener(self.checkValid)
        self.departmentCombo.addKeyboardListener(self)
        ftable.setWidget(6, 1, self.departmentCombo)

        hpanel = HorizontalPanel()
        self.addBtn = Button("Add User")
        self.addBtn.setEnabled(False)
        hpanel.add(self.addBtn)
        self.cancelBtn = Button("Cancel")
        hpanel.add(self.cancelBtn)
        ftable.setWidget(7, 0, hpanel)
        ftableFormatter.setColSpan(7, 0, 2)

        self.add(ftable)
        return
コード例 #2
0
ファイル: Text.py プロジェクト: wkornewald/pyjs
    def __init__(self):
        Sink.__init__(self)
        self.fPasswordText = PasswordTextBox()
        self.fTextArea = TextArea()
        self.fTextBox = TextBox()

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.add(HTML("Normal text box:"))
        panel.add(self.createTextThing(self.fTextBox))
        panel.add(HTML("Password text box:"))
        panel.add(self.createTextThing(self.fPasswordText))
        panel.add(HTML("Text area:"))
        panel.add(self.createTextThing(self.fTextArea))

        panel.add(
            HTML("""Textarea below demos oninput event. oninput allows
to detect when the content of an element has changed. This is different
from examples above, where changes are detected only if they are made with
keyboard. oninput occurs when the content is changed through any user
interface(keyboard, mouse, etc.). For example, at first type few chars, but
then paste some text to the text areas above and below by selecting 'Paste'
command from context menu or by dragging&dropping and see the difference.
oninput is similar to onchange event, but onchange event fires only when a
text-entry widget loses focus."""))
        vp = VerticalPanel()
        self.echo = HTML()
        textArea = TextArea()
        vp.add(textArea)
        vp.add(self.echo)
        textArea.addInputListener(self)
        panel.add(vp)

        self.initWidget(panel)
コード例 #3
0
 def onModuleLoad(self):
     
     self.remote_py = MyBlogService()
     
     # Create a FormPanel and point it at a service.
     self.form = FormPanel()
     
     # Create a panel to hold all of the form widgets.
     vp=VerticalPanel(BorderWidth=0,HorizontalAlignment=HasAlignment.ALIGN_CENTER,VerticalAlignment=HasAlignment.ALIGN_MIDDLE,Width="100%",Height="150px")
     self.form.setWidget(vp)
     
     header=HTML("<h2>LOGIN TO YOUR ACCOUNT</h2>")
     part1=header
           
     # Create a TextBox, giving it a name so that it will be submitted.
     self.userName = TextBox()
     self.userName.setName("userNameFormElement")
     self.userName.setPlaceholder("User Name")
     part2=self.userName
     
     self.password = PasswordTextBox()
     self.password.setName("passwordFormElement")
     self.password.setPlaceholder("Password")
     part3=self.password
     
     self.errorInfoLabel = Label()
     self.errorInfoLabel.setStyleName('error-info')
     part4=self.errorInfoLabel
     part4.setStyleName("errorlabel")
     
      # Add a 'submit' button.
     hpanel = HorizontalPanel(BorderWidth=0,HorizontalAlignment=HasAlignment.ALIGN_CENTER,VerticalAlignment=HasAlignment.ALIGN_MIDDLE,Width="100%",Height="50px")
     
     partb=Button("Login", self)
     partb.setStyleName('btn')
     
     image=Label("Don''t have account? Sign up")
     anchor = Anchor(Widget=image, Href='/signup.html')
     parta=anchor
     
          
     hpanel.add(partb)
     hpanel.add(parta)
    
     part5=hpanel 
     part5.setStyleName("hpanel")
     
     vp.add(part1)
     vp.add(part2)
     vp.add(part3)
     vp.add(part4)
     vp.add(part5)
     vp.setStyleName("signup")
     
     # Add an event handler to the form.
     self.form.addFormHandler(self)
     RootPanel().add(self.form)
コード例 #4
0
    def __init__(self):
        Sink.__init__(self)
        self.fPasswordText = PasswordTextBox()
        self.fTextArea = TextArea()
        self.fTextBox = TextBox()

        panel = VerticalPanel()
        panel.setSpacing(8)
        panel.add(HTML("Normal text box:"))
        panel.add(self.createTextThing(self.fTextBox))
        panel.add(HTML("Password text box:"))
        panel.add(self.createTextThing(self.fPasswordText))
        panel.add(HTML("Text area:"))
        panel.add(self.createTextThing(self.fTextArea))
        self.initWidget(panel)
コード例 #5
0
ファイル: passwordTextBox.py プロジェクト: minghuascode/pyj
    def __init__(self):
        SimplePanel.__init__(self)

        field = PasswordTextBox()
        field.setWidth("100px")
        self.add(field)
コード例 #6
0
    def onModuleLoad(self):
        self.form = FormPanel()
        self.remote_py = MyBlogService()

        self.form.setAction("/index.html")

        vp = VerticalPanel(BorderWidth=0,
                           HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                           VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                           Width="100%",
                           Height="150px")
        self.form.setWidget(vp)

        header = HTML(
            "<h2>CREATE MY ACCOUNT</h2><h3>Welcome to signup form</h3>")
        part1 = header

        hpn = HorizontalPanel(BorderWidth=0,
                              HorizontalAlignment=HasAlignment.ALIGN_LEFT,
                              VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                              Width="92%",
                              Height="60px")

        self.fname = TextBox()
        self.fname.setName("fname")
        self.fname.setPlaceholder("First Name")
        hpn.add(self.fname)

        self.lname = TextBox()
        self.lname.setName("lname")
        self.lname.setPlaceholder("Last Name")
        hpn.add(self.lname)
        hpn.setCellWidth(self.fname, "70%")
        hpn.setCellWidth(self.lname, "30%")
        part2 = hpn

        self.uname = TextBox()
        self.uname.setName("uname")
        self.uname.setPlaceholder("User Name")
        part3 = self.uname

        self.password = PasswordTextBox()
        self.password.setName("passsignup")
        self.password.setPlaceholder("Choose a password")
        part4 = self.password

        self.rpassword = PasswordTextBox()
        self.rpassword.setName("rpasssignup")
        self.rpassword.setPlaceholder("Confirm your password")
        part5 = self.rpassword

        self.email = TextBox()
        self.email.setName("emailsignup")
        self.email.setPlaceholder("Enter your email address ")
        part6 = self.email

        self.errorlabel = Label()
        self.errorlabel.setStyleName("errorlabel")
        part7 = self.errorlabel

        hpanel = HorizontalPanel(BorderWidth=0,
                                 HorizontalAlignment=HasAlignment.ALIGN_CENTER,
                                 VerticalAlignment=HasAlignment.ALIGN_MIDDLE,
                                 Width="100%",
                                 Height="50px")

        partb = Button("Signup", self)
        partb.setStyleName('btn')
        image = Label("Already have account! Sign in")
        anchor = Anchor(Widget=image, Href='/index.html')
        parta = anchor

        hpanel.add(partb)
        hpanel.add(parta)
        hpanel.setStyleName("hpanel")

        part8 = hpanel

        vp.add(part1)
        vp.add(part2)
        vp.add(part3)
        vp.add(part4)
        vp.add(part5)
        vp.add(part6)
        vp.add(part7)
        vp.add(part8)

        vp.setCellHeight(part1, "5%")
        vp.setCellHeight(part2, "10%")
        vp.setCellHeight(part3, "10%")
        vp.setCellHeight(part4, "10%")
        vp.setCellHeight(part5, "10%")
        vp.setCellHeight(part6, "10%")
        vp.setCellHeight(part7, "10%")
        vp.setCellHeight(part8, "10%")

        vp.setStyleName("signup")

        self.form.addFormHandler(self)
        RootPanel().add(self.form)