def draw(self): Popup.draw(self) namePanel = HorizontalPanel() #namePanel.add(Label('Crie um arquivo')) if self.title == 'Abrir': self.enableOkButton(False) namePanel.add(HTML("""<div class=""gwt-Label"" style=""white-space: normal;""> Abra o arquivo salvo, copie<br>e cole aqui o conteudo:</div>""")) self.field = FileUpload() self.field.setName('file') self.field.setID('files') self.center.add(self.field) element = self.field.getElement() JS("""function handleFileSelect(evt) {@{{self}}.enableOkButton(evt.target.files[0]!=null);} @{{element}}.addEventListener('change', handleFileSelect, false);""") #http://www.javascriptkit.com/javatutors/loadjavascriptcss.shtml else: namePanel.add(HTML("""<div class=""gwt-Label"" style=""white-space: normal;""> Crie um arquivo txt e copie<br>e cole o conteudo a seguir:</div>""")) self.textBox = TextBox() self.textBox.setStyleAttribute('marginLeft', 10) namePanel.add(self.textBox) self.center.add(namePanel) self.textBox.addInputListener(self) self.onInput()
def draw(self): Popup.draw(self) namePanel = HorizontalPanel() namePanel.add(Label(_('Name') + ':')) self.textBox = TextBox() self.textBox.setMaxLength(15) self.textBox.setStyleAttribute('marginLeft', 10) namePanel.add(self.textBox) self.center.add(namePanel) self.choose = ChooseTypeVarPanel() self.center.add(self.choose) self.textBox.addInputListener(self) self.message = Element(Element=DOM.createDiv()) self.message.add(Widget(Element=DOM.createDiv(), StyleName='not_image')) self.message.add( Label(text=_('Name already used'), wordWrap=False, StyleName='not_message')) self.onInput()