def addBlock(self, block, classHelp='help_default', beforeIndex=None): panel = HorizontalPanel() panel.add(block) info = Label('i', StyleName='info_btn') info.block = block info.classHelp = classHelp info.addClickListener(self.showInfo) panel.add(info) if beforeIndex is not None: self.list.insert(panel, self.list.getBody(), 0) #deprecated else: self.list.add(panel) self.list.setStyleName(self.list.getWidgetTd(panel), 'block_info') self.blocks.append(block) if block.name in [ 'commandType', 'numericType', 'logicType', 'alphaNumericType' ]: panel.add(self.getRemoveCustomBlock(block)) info.addMouseListener(TooltipListener("Editar")) else: info.addMouseListener(TooltipListener("Ajuda"))
def getRemoveCustomBlock(self, block): remove = Label('x', StyleName='remove_btn') remove.addMouseListener(TooltipListener("Remover")) remove.block = block remove.addClickListener(self.RemoveCustomBlock) return remove
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) w = Label("* Username", wordWrap=False) w.addMouseListener(TooltipListener("Required, not changable")) ftable.setWidget(3, 0, w) self.usernameInput = TextBox() self.usernameInput.addChangeListener(self.checkValid) self.usernameInput.addKeyboardListener(self) ftable.setWidget(3, 1, self.usernameInput) w = Label("* Password", wordWrap=False) w.addMouseListener(TooltipListener("Required")) ftable.setWidget(4, 0, w) self.passwordInput = PasswordTextBox() self.passwordInput.addChangeListener(self.checkValid) self.passwordInput.addKeyboardListener(self) ftable.setWidget(4, 1, self.passwordInput) w = Label("* Confirm", wordWrap=False) w.addMouseListener(TooltipListener("Required")) ftable.setWidget(5, 0, w) self.confirmInput = PasswordTextBox() self.confirmInput.addChangeListener(self.checkValid) self.confirmInput.addKeyboardListener(self) ftable.setWidget(5, 1, self.confirmInput) w = Label("* Department", wordWrap=False) w.addMouseListener(TooltipListener("Required")) ftable.setWidget(6, 0, w) 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) self.clearForm() return
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) w = Label("* Username", wordWrap=False) w.addMouseListener(TooltipListener("Required, not changable")) ftable.setWidget(3, 0, w) self.usernameInput = TextBox() self.usernameInput.addChangeListener(self.checkValid) self.usernameInput.addKeyboardListener(self) ftable.setWidget(3, 1, self.usernameInput) w = Label("* Password", wordWrap=False) w.addMouseListener(TooltipListener("Required")) ftable.setWidget(4, 0, w) self.passwordInput = PasswordTextBox() self.passwordInput.addChangeListener(self.checkValid) self.passwordInput.addKeyboardListener(self) ftable.setWidget(4, 1, self.passwordInput) w = Label("* Confirm", wordWrap=False) w.addMouseListener(TooltipListener("Required")) ftable.setWidget(5, 0, w) self.confirmInput = PasswordTextBox() self.confirmInput.addChangeListener(self.checkValid) self.confirmInput.addKeyboardListener(self) ftable.setWidget(5, 1, self.confirmInput) w = Label("* Department", wordWrap=False) w.addMouseListener(TooltipListener("Required")) ftable.setWidget(6, 0, w) 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) self.clearForm() return