def __init__(self): super(TextFieldInputPromptExample, self).__init__() # add some 'air' to the layout self.setSpacing(True) self.setMargin(True, False, False, False) # Username field + input prompt username = TextField() username.setInputPrompt('Username') # configure & add to layout username.setImmediate(True) username.addListener(self, IValueChangeListener) self.addComponent(username) # Password field + input prompt password = PasswordField() password.setInputPrompt('Password') # configure & add to layout password.setImmediate(True) password.addListener(self, IValueChangeListener) self.addComponent(password) # Comment field + input prompt comment = TextArea() comment.setInputPrompt('Comment') # configure & add to layout comment.setRows(3) comment.setImmediate(True) comment.addListener(self, IValueChangeListener) self.addComponent(comment)
def __init__(self): super(TextFieldSecretExample, self).__init__() self.setSizeUndefined() # let content 'push' size self.setSpacing(True) # Username self._username = TextField('Username') self.addComponent(self._username) # Password self._password = PasswordField('Password') self.addComponent(self._password) # Login button loginButton = Button('Login', LoginListener(self)) self.addComponent(loginButton) self.setComponentAlignment(loginButton, Alignment.TOP_RIGHT)
def __init__(self): super(CustomLayoutsExample, self).__init__() self.setMargin(True) # Create the custom layout and set it as a component in # the current layout custom = CustomLayout('../../sampler/layouts/examplecustomlayout') self.addComponent(custom) # Create components and bind them to the location tags # in the custom layout. username = TextField() custom.addComponent(username, 'username') password = PasswordField() custom.addComponent(password, 'password') ok = Button('Login') custom.addComponent(ok, 'okbutton')
def createPasswordField(self, propertyId): pf = PasswordField() pf.setCaption(DefaultFieldFactory.createCaptionByPropertyId(propertyId)) return pf