brtextfield
brTextField
BrTextField is a Vaadin Add-on that supports several input types (Brazilian format), previously set up, following the table below:
- CEP - Brazilian postal code, under the format ##.###-###
- CFOP - Operations and Benefits Fiscal Code, under the format #.###
- CNAE - National Economic Activities Classification, under the format ##.##-#/##
- COD_IBGE - Cities' codes according to Brazilian Istitute of Geography and Estatistic, under the format ##.###.##
- CPF - Individual Register Brazilian code, under the format ###.###.###-## with verification
- CNPJ - Legal Person National Register code, under the format ##.###.###/####-## with verification
- CPF_CNPJ - Accepts both CPF and CNPJ formats
- DECIMAL - Accepts decimal values (comma separated)
- MAIÚSCULO - Converts all the characters to upper case
- METRO - Accepts a comma separated decimal value followed by the 'm2' unit of measurement
- MINÚSCULO - Converts all the characters to lower case
- MOEDA - Accepts decimal values in the format ###.###,## with the 'R$' prefix
- NCM - MERCOSUL's Common Naming Code, under the format ####.##.##
- NORMAL - Accepts any character
- NUMÉRICO - Accepts only numeric values under the format ###.###.###
- PLACA - Accepts Brazilian car's License Plate under the format AAA-####
- PORCENTAGEM - Accepts decimal numbers followed by '%'
- TELEFONE - Accepts phone numbers under the format +##(##)#####-####
- TÍTULO_ELEITORAL - Accepts Brazilian voter's ID number, under the format #### #### ####
- HORA - Accepts time under the format HH:MM
Sample code
protected void init(VaadinRequest vaadinRequest) { final VerticalLayout layout = new VerticalLayout(); layout.setMargin(true); setContent(layout); Label label = new Label("<span style=\"font-size: 2.4em;\">BrTextField Demo View</span><br>", ContentMode.HTML); layout.addComponent(label); layout.addComponent(new BrTextFieldView()); } public class BrTextFieldView extends VerticalLayout { HorizontalLayout content = new HorizontalLayout(); BrTextField cpf = new BrTextField("CPF"); BrTextField cnpj = new BrTextField("CNPJ"); BrTextField cpf_cnpj = new BrTextField("CPF/CNPJ"); BrTextField telefone = new BrTextField("TELEFONE"); BrTextField cep = new BrTextField("CEP"); BrTextField placa = new BrTextField("PLACA"); BrTextField cnae = new BrTextField("CNAE"); BrTextField ncm = new BrTextField("NCM"); BrTextField cfop = new BrTextField("CFOP"); BrTextField hora = new BrTextField("HORA"); BrTextField moeda = new BrTextField("MOEDA"); BrTextField decimal = new BrTextField("DECIMAL"); BrTextField porcentagem = new BrTextField("PORCENTAGEM"); BrTextField metro = new BrTextField("METRO QUADRADO"); BrTextField maiuscula = new BrTextField("MAIÚSCULA"); BrTextField minuscula = new BrTextField("MINÚSCULA"); BrTextField titulo = new BrTextField("TÍTULO ELEITORAL"); public BrTextFieldView() { setSizeFull(); //content.setWidth(800, Sizeable.Unit.PIXELS); content.setSpacing(true); addComponent(content); setComponentAlignment(content, Alignment.MIDDLE_CENTER); final GridLayout form = new GridLayout(4, 6); form.setSpacing(true); content.addComponent(form); cpf.setTipo(Tipos.CPF); cnpj.setTipo(Tipos.CNPJ); cpf_cnpj.setTipo(Tipos.CPF_CNPJ); telefone.setTipo(Tipos.TELEFONE); cep.setTipo(Tipos.CEP); placa.setTipo(Tipos.PLACA); cnae.setTipo(Tipos.CNAE); ncm.setTipo(Tipos.NCM); cfop.setTipo(Tipos.CFOP); hora.setTipo(Tipos.HORA); moeda.setTipo(Tipos.MOEDA); decimal.setTipo(Tipos.DECIMAL); porcentagem.setTipo(Tipos.PORCENTAGEM); metro.setTipo(Tipos.METRO); maiuscula.setTipo(Tipos.MAIÚSCULO); minuscula.setTipo(Tipos.MINÚSCULO); titulo.setTipo(Tipos.TÍTULO_ELEITORAL); form.addComponent(cpf); form.addComponent(cnpj); form.addComponent(cpf_cnpj); form.addComponent(telefone); form.addComponent(cep); form.addComponent(placa); form.addComponent(cnae); form.addComponent(ncm); form.addComponent(cfop); form.addComponent(hora); form.addComponent(moeda); form.addComponent(decimal); form.addComponent(porcentagem); form.addComponent(metro); form.addComponent(maiuscula); form.addComponent(minuscula); form.addComponent(titulo); form.addComponent(new Label()); form.addComponent(new Label()); form.addComponent(new Label()); content.addComponent(form); }
Links
Compatibility
Was this helpful? Need more help?
Leave a comment or a question below. You can also join
the chat on Discord or
ask questions on StackOverflow.
Version
- Released
- 2016-01-28
- Maturity
- EXPERIMENTAL
- License
- Apache License 2.0
Compatibility
- Framework
- Vaadin 7.6
- Vaadin 7.5 in 1.0.0
- Browser
- N/A
brtextfield - Vaadin Add-on Directory
brTextFieldBrTextField is a Vaadin Add-on that supports several input types (Brazilian format), previously set up, following the table below:
Online Demo- CEP - Brazilian postal code, under the format ##.###-###
- CFOP - Operations and Benefits Fiscal Code, under the format #.###
- CNAE - National Economic Activities Classification, under the format ##.##-#/##
- COD_IBGE - Cities' codes according to Brazilian Istitute of Geography and Estatistic, under the format ##.###.##
- CPF - Individual Register Brazilian code, under the format ###.###.###-## with verification
- CNPJ - Legal Person National Register code, under the format ##.###.###/####-## with verification
- CPF_CNPJ - Accepts both CPF and CNPJ formats
- DECIMAL - Accepts decimal values (comma separated)
- MAIÚSCULO - Converts all the characters to upper case
- METRO - Accepts a comma separated decimal value followed by the 'm2' unit of measurement
- MINÚSCULO - Converts all the characters to lower case
- MOEDA - Accepts decimal values in the format ###.###,## with the 'R$' prefix
- NCM - MERCOSUL's Common Naming Code, under the format ####.##.##
- NORMAL - Accepts any character
- NUMÉRICO - Accepts only numeric values under the format ###.###.###
- PLACA - Accepts Brazilian car's License Plate under the format AAA-####
- PORCENTAGEM - Accepts decimal numbers followed by '%'
- TELEFONE - Accepts phone numbers under the format +##(##)#####-####
- TÍTULO_ELEITORAL - Accepts Brazilian voter's ID number, under the format #### #### ####
- HORA - Accepts time under the format HH:MM