List of usage examples for com.vaadin.ui TextField TextField
public TextField()
TextField
with no caption. From source file:ch.bfh.ti.soed.hs16.srs.red.ui.helper.SubWindowReservation.java
License:Open Source License
public SubWindowReservation() { this.layout = new VerticalLayout(); this.id = new Label("id"); this.name = new Label("name"); this.roomTitle = new Label("select room"); this.startTime = new Label("start time"); this.endTime = new Label("end time"); this.textFieldId = new TextField(); this.textFieldName = new TextField(); this.rooms = new ComboBox(); this.dateFieldStart = new DateField(); this.dateFieldEnd = new DateField(); this.buttonSave = new Button("save"); this.buttonDelete = new Button("delete"); dateFieldStart.setResolution(Resolution.MINUTE); dateFieldEnd.setResolution(Resolution.MINUTE); /*--------------------------------- add objects to horizontal container// w w w .j a va 2 s .c o m ---------------------------------*/ HorizontalLayout idContainer = new HorizontalLayout(id, textFieldId); HorizontalLayout nameContainer = new HorizontalLayout(name, textFieldName); HorizontalLayout roomContainer = new HorizontalLayout(roomTitle, rooms); HorizontalLayout startContainer = new HorizontalLayout(startTime, dateFieldStart); HorizontalLayout endContainer = new HorizontalLayout(endTime, dateFieldEnd); HorizontalLayout buttons = new HorizontalLayout(buttonSave, buttonDelete); /*--------------------------------- add style names ---------------------------------*/ layout.setPrimaryStyleName(CSS_NAME); idContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); nameContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); roomContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); startContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); endContainer.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); buttons.setPrimaryStyleName(CSS_NAME + "-horizontalContainer"); /*--------------------------------- add to root layout ---------------------------------*/ this.layout.addComponents(idContainer, nameContainer, roomContainer, startContainer, endContainer, buttons); }
From source file:ch.vorburger.vaadin.designer.samplescreen.SampleFixedScreenBinding.java
License:Apache License
public void bind(final SampleFixedScreenComponent ui, final Screen model) throws BindingValidationException { // TODO Later probably @Inject the EMFDataBindingContext ? // TODO Don't use DatabindingTestRealm but real SWT Realm.. once I integrate this with UI EMFDataBindingContext db = new EMFDataBindingContext(new DatabindingTestRealm()); // TODO who will call db.dispose() when?! shouldn't forget this, may leak memory. // TODO Use EditingDomain variants... so that undo/redo can work... // TODO Further tests if Bindings.check can work - else remove // Policy.setLog(new ExceptionThrowingILogger(Policy.getLog())); ui.getScreenTitle().setValue(model.getTitle()); // TODO real binding, db.bindValue(null, // TODO binding to root.getScreenTitle() @see BindingTest // EMFProperties.value(SamplescreenPackage.Literals.SCREEN__TITLE).observe(screen)); for (Field field : model.getFields()) { TextField textField = new TextField(); textField.setDebugId(field.getName()); // This is just & only for the WebDriver test textField.setCaption(field.getLabel()); // TODO real binding!!! AbsoluteNotifyingComponentPosition position = new AbsoluteNotifyingComponentPosition(); Bindings.check(// w ww .j ava 2 s. c om db.bindValue( BeanProperties .value(AbsoluteNotifyingComponentPosition.class, AbsoluteNotifyingComponentPosition.LEFT_VALUE_PROPERTY_NAME) .observe(position), EMFProperties.value(SamplescreenPackage.Literals.FIELD__X).observe(field))); Bindings.check( db.bindValue( BeanProperties .value(AbsoluteNotifyingComponentPosition.class, AbsoluteNotifyingComponentPosition.TOP_VALUE_PROPERTY_NAME) .observe(position), EMFProperties.value(SamplescreenPackage.Literals.FIELD__Y).observe(field))); ui.getAbsoluteLayout().addComponent(textField, position); // TODO remove this!!! it was just a super temporary ugly hack to see first result.. position.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { System.out.println( evt.getPropertyName() + " : " + evt.getOldValue() + " -> " + evt.getNewValue()); // try { // model.eResource().save(null); // } catch (IOException e) { // // TODO real error handling instead of ugly hack // e.printStackTrace(); // throw new RuntimeException(e); // } } }); } }
From source file:co.edu.icesi.academ.client.perfiles.administrador.PanelCrearBloque.java
License:Open Source License
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);//from w w w. j a v a 2 s .c o m mainLayout.setWidth("360px"); mainLayout.setHeight("140px"); // top-level component properties setWidth("360px"); setHeight("140px"); // btnCrearBloque btnCrearBloque = new Button(); btnCrearBloque.setCaption("Crear bloque"); btnCrearBloque.setImmediate(true); btnCrearBloque.setWidth("238px"); btnCrearBloque.setHeight("-1px"); mainLayout.addComponent(btnCrearBloque, "top:80.0px;left:62.0px;"); // textNombreBloque textNombreBloque = new TextField(); textNombreBloque.setCaption("Nombre bloque"); textNombreBloque.setImmediate(false); textNombreBloque.setWidth("100.0%"); textNombreBloque.setHeight("-1px"); mainLayout.addComponent(textNombreBloque, "top:40.0px;right:52.0px;left:60.0px;"); return mainLayout; }
From source file:co.edu.icesi.academ.client.perfiles.administrador.PanelCrearMateria.java
License:Open Source License
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);//from w w w . j ava2s . co m mainLayout.setWidth("360px"); mainLayout.setHeight("180px"); // top-level component properties setWidth("360px"); setHeight("180px"); // btnGuardar btnGuardar = new Button(); btnGuardar.setCaption("Guardar"); btnGuardar.setImmediate(true); btnGuardar.setWidth("240px"); btnGuardar.setHeight("-1px"); mainLayout.addComponent(btnGuardar, "top:120.0px;left:60.0px;"); // txt_codigo txt_codigo = new TextField(); txt_codigo.setCaption("Cdigo"); txt_codigo.setImmediate(false); txt_codigo.setWidth("240px"); txt_codigo.setHeight("-1px"); mainLayout.addComponent(txt_codigo, "top:40.0px;left:60.0px;"); // txt_nombre txt_nombre = new TextField(); txt_nombre.setCaption("Nombre"); txt_nombre.setImmediate(false); txt_nombre.setWidth("240px"); txt_nombre.setHeight("-1px"); mainLayout.addComponent(txt_nombre, "top:80.0px;left:60.0px;"); return mainLayout; }
From source file:co.edu.icesi.academ.client.perfiles.administrador.PanelCrearPrograma.java
License:Open Source License
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);/*w ww .ja v a2 s. c om*/ mainLayout.setWidth("440px"); mainLayout.setHeight("300px"); // top-level component properties setWidth("440px"); setHeight("300px"); // btn_guardar btn_guardar = new Button(); btn_guardar.setCaption("Guardar"); btn_guardar.setImmediate(true); btn_guardar.setWidth("320px"); btn_guardar.setHeight("-1px"); mainLayout.addComponent(btn_guardar, "top:240.0px;left:60.0px;"); // txt_nombre txt_nombre = new TextField(); txt_nombre.setCaption("Nombre"); txt_nombre.setImmediate(false); txt_nombre.setWidth("320px"); txt_nombre.setHeight("-1px"); mainLayout.addComponent(txt_nombre, "top:40.0px;left:60.0px;"); // txt_descripcion txt_descripcion = new TextArea(); txt_descripcion.setCaption("Descripcin"); txt_descripcion.setImmediate(false); txt_descripcion.setWidth("320px"); txt_descripcion.setHeight("108px"); mainLayout.addComponent(txt_descripcion, "top:120.0px;right:60.0px;"); // txtCodigo txtCodigo = new TextField(); txtCodigo.setCaption("Cdigo"); txtCodigo.setImmediate(false); txtCodigo.setWidth("320px"); txtCodigo.setHeight("-1px"); mainLayout.addComponent(txtCodigo, "top:80.0px;left:60.0px;"); return mainLayout; }
From source file:co.edu.icesi.academ.client.perfiles.administrador.PanelEditarBloque.java
License:Open Source License
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);/*ww w . j av a 2 s .c o m*/ mainLayout.setWidth("360px"); mainLayout.setHeight("140px"); // top-level component properties setWidth("360px"); setHeight("140px"); // textField_1 textField_1 = new TextField(); textField_1.setCaption("Nombre"); textField_1.setImmediate(false); textField_1.setWidth("241px"); textField_1.setHeight("-1px"); mainLayout.addComponent(textField_1, "top:40.0px;left:60.0px;"); // btn_guardar btn_guardar = new Button(); btn_guardar.setCaption("guardar"); btn_guardar.setImmediate(true); btn_guardar.setWidth("240px"); btn_guardar.setHeight("-1px"); mainLayout.addComponent(btn_guardar, "top:80.0px;left:60.0px;"); return mainLayout; }
From source file:co.edu.icesi.academ.client.perfiles.administrador.PanelEditarMateria.java
License:Open Source License
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);//from ww w .j ava 2s.com mainLayout.setWidth("340px"); mainLayout.setHeight("180px"); // top-level component properties setWidth("340px"); setHeight("180px"); // btn_guardar btn_guardar = new Button(); btn_guardar.setCaption("Guardar"); btn_guardar.setImmediate(true); btn_guardar.setWidth("220px"); btn_guardar.setHeight("-1px"); mainLayout.addComponent(btn_guardar, "top:120.0px;left:60.0px;"); // txt_codigo txt_codigo = new TextField(); txt_codigo.setStyleName("Cdigo"); txt_codigo.setCaption("Cdigo"); txt_codigo.setImmediate(false); txt_codigo.setWidth("220px"); txt_codigo.setHeight("-1px"); mainLayout.addComponent(txt_codigo, "top:36.0px;left:60.0px;"); // txt_nombre txt_nombre = new TextField(); txt_nombre.setCaption("Nombre"); txt_nombre.setImmediate(false); txt_nombre.setWidth("220px"); txt_nombre.setHeight("-1px"); mainLayout.addComponent(txt_nombre, "top:80.0px;left:60.0px;"); return mainLayout; }
From source file:co.edu.icesi.academ.client.perfiles.administrador.PanelEditarPrograma.java
License:Open Source License
@AutoGenerated private AbsoluteLayout buildMainLayout() { // common part: create layout mainLayout = new AbsoluteLayout(); mainLayout.setImmediate(false);//from w w w.jav a2s .c om mainLayout.setWidth("380px"); mainLayout.setHeight("260px"); // top-level component properties setWidth("380px"); setHeight("260px"); // txtNombre txtNombre = new TextField(); txtNombre.setCaption("Nombre"); txtNombre.setImmediate(false); txtNombre.setWidth("240px"); txtNombre.setHeight("-1px"); mainLayout.addComponent(txtNombre, "top:40.0px;left:60.0px;"); // btnGuardar btnGuardar = new Button(); btnGuardar.setCaption("Guardar"); btnGuardar.setImmediate(true); btnGuardar.setWidth("240px"); btnGuardar.setHeight("-1px"); mainLayout.addComponent(btnGuardar, "top:194.0px;left:60.0px;"); // txtDesc txtDesc = new TextArea(); txtDesc.setCaption("Descripcin"); txtDesc.setImmediate(false); txtDesc.setWidth("240px"); txtDesc.setHeight("100px"); mainLayout.addComponent(txtDesc, "top:80.0px;left:60.0px;"); return mainLayout; }
From source file:co.edu.icesi.academ.client.perfiles.propietario.FactoresDeImpacto.java
License:Open Source License
public void cargarRoles(final List<RolBO> roles, List<TemaBO> temas, List<FactorDeImpactoBO> factoresDeImpacto, EvaluacionBO evaluacionBO) {// w w w . j a va2 s . c o m initTable(); // Guarda los roles obtenidos en la consulta rolesActuales = roles; // Guarda los temas obtenidos en la consulta temasActuales = temas; // Guarda el identificador de la evaluacion actual idEvaluacion = evaluacionBO.getId(); int columns = 0; // Adiciona una columna por cada rol for (RolBO rolBO : roles) { table_1.addContainerProperty(rolBO.getNombre(), TextField.class, null); table_1.setColumnAlignment(rolBO.getNombre(), Align.CENTER); columns++; } // Agrega la columna TOTAL table_1.addContainerProperty("Total", Label.class, null); table_1.setColumnAlignment("Total", Align.CENTER); // Recorre todos los temas y por cada uno, adiciona los respectivos // valores a cada columna for (TemaBO temaBO : temas) { ArrayList<Object> item = new ArrayList<>(); item.add(temaBO.getId()); item.add(temaBO.getNombre()); int total = 0; for (int i = 0; i < columns; i++) { final TextField tf = new TextField(); // Carga el valor del factor de impacto FactorDeImpactoBO factor = new FactorDeImpactoBO(); factor.setEvaluacion(evaluacionBO.getId()); factor.setRol(roles.get(i).getNombre()); factor.setTema(temaBO.getId()); int index = getFactorDeImpactoIndex(factoresDeImpacto, factor); if (index != -1) { tf.setValue("" + (int) factoresDeImpacto.get(index).getFactorDeImpacto()); total += factoresDeImpacto.get(index).getFactorDeImpacto(); } tf.setColumns(3); tf.setData(temaBO); tf.setId(temaBO.getId() + "-" + i); // Adiciona listener para recalcular el total de la fila cada // vez que se cambie un factor de impacto tf.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = 1L; @Override public void textChange(TextChangeEvent event) { // TODO Auto-generated method stub TemaBO tema = (TemaBO) tf.getData(); int tfId = Integer.parseInt(tf.getId().split("-")[1]); int total = 0; // Obtiene el valor de todos los factores de impacto de // la fila y los suma for (int j = 0; j < roles.size(); j++) { try { if (j != tfId) total += Integer.parseInt(table_1.getItem(tema) .getItemProperty(roles.get(j).getNombre()).getValue().toString()); else total += Integer.parseInt(event.getText()); } catch (Exception e) { total += 0; } } Label l = getLabelColor(total); table_1.getItem(tema).getItemProperty("Total").setValue(l); } }); item.add(tf); } item.add(getLabelColor(total)); table_1.addItem(item.toArray(), temaBO); } }
From source file:com.anphat.cms.appparams.ui.DialogCreateAppParams.java
@AutoGenerated private GridLayout buildGridLayout_1() { // common part: create layout gridLayout_1 = new GridLayout(); gridLayout_1.setStyleName("custom-feildset"); gridLayout_1.setCaption(MakeURL.makeURLForGrid(BundleUtils.getString("appParam.fieldset.title"))); gridLayout_1.setCaptionAsHtml(true); gridLayout_1.setImmediate(false);//w ww . j a v a 2 s . com gridLayout_1.setWidth("100.0%"); gridLayout_1.setHeight("-1px"); gridLayout_1.setMargin(true); gridLayout_1.setSpacing(true); gridLayout_1.setColumns(4); gridLayout_1.setRows(4); // lblParamCode lblParamCode = new Label(); lblParamCode.setImmediate(false); lblParamCode.setWidth("-1px"); lblParamCode.setHeight("-1px"); lblParamCode.setValue(BundleUtils.getString("lb.appParam.code")); gridLayout_1.addComponent(lblParamCode, 0, 0); txtParamCode = new TextField(); txtParamCode.setImmediate(true); txtParamCode.setWidth("100.0%"); txtParamCode.setHeight("-1px"); txtParamCode.setRequired(true); txtParamCode.setMaxLength(50); // StringBuilder messageError = new StringBuilder(); // messageError.append(BundleUtils.getString("lb.appParam.code")); // messageError.append(BundleUtils.getString(" ")); // messageError.append(BundleUtils.getString("message.error.numberformat")); // txtParamCode.addValidator(new RegexpValidator("[0-9]+", messageError.toString())); gridLayout_1.addComponent(txtParamCode, 1, 0); // lblParamName lblParamName = new Label(); lblParamName.setImmediate(false); lblParamName.setWidth("100%"); lblParamName.setHeight("-1px"); lblParamName.setValue(BundleUtils.getString("lb.appParam.name")); gridLayout_1.addComponent(lblParamName, 2, 0); txtParamName = new TextField(); txtParamName.setImmediate(true); txtParamName.setWidth("100.0%"); txtParamName.setHeight("-1px"); txtParamName.setRequired(true); txtParamName.setMaxLength(200); // txtParamName.addValidator(new RegexpValidator("^[a-zA-Z0-9 -_]+$", BundleUtils.getString("lb.appParam.name")+" "+BundleUtils.getString("message.error.special.char"))); gridLayout_1.addComponent(txtParamName, 3, 0); // lblParamType lblParamType = new Label(); lblParamType.setImmediate(false); lblParamType.setWidth("100%"); lblParamType.setHeight("-1px"); lblParamType.setValue(BundleUtils.getString("lb.appParam.type")); gridLayout_1.addComponent(lblParamType, 0, 1); txtParamType = new TextField(); txtParamType.setImmediate(true); txtParamType.setWidth("100.0%"); txtParamType.setHeight("-1px"); txtParamType.setRequired(true); txtParamType.setMaxLength(100); txtParamType.addValidator(new RegexpValidator("^[a-zA-Z0-9-_]+$", BundleUtils.getString("lb.appParam.type") + " " + BundleUtils.getString("message.error.special.char"))); gridLayout_1.addComponent(txtParamType, 1, 1); // lblParamOrder lblParamOrder = new Label(); lblParamOrder.setImmediate(false); lblParamOrder.setWidth("100%"); lblParamOrder.setHeight("-1px"); lblParamOrder.setValue(BundleUtils.getString("lb.appParam.order")); gridLayout_1.addComponent(lblParamOrder, 2, 1); // cboImplementer txtParamOrder = new TextField(); txtParamOrder.setImmediate(true); txtParamOrder.setWidth("100.0%"); txtParamOrder.setHeight("-1px"); txtParamOrder.setMaxLength(5); StringBuilder messageErrorOrder = new StringBuilder(); messageErrorOrder.append(BundleUtils.getString("lb.appParam.order")); messageErrorOrder.append(BundleUtils.getString(" ")); messageErrorOrder.append(BundleUtils.getString("message.error.numberformat")); txtParamOrder.addValidator(new RegexpValidator("[0-9]+", messageErrorOrder.toString())); gridLayout_1.addComponent(txtParamOrder, 3, 1); // lblStatus lblStatus = new Label(); lblStatus.setImmediate(false); lblStatus.setWidth("100%"); lblStatus.setHeight("-1px"); lblStatus.setValue(BundleUtils.getString("lb.appParam.status")); gridLayout_1.addComponent(lblStatus, 0, 2); cboStatus = new ComboBox(); cboStatus.setImmediate(true); cboStatus.setTextInputAllowed(false); cboStatus.setFilteringMode(FilteringMode.OFF); cboStatus.setWidth("100.0%"); cboStatus.setHeight("-1px"); cboStatus.setStyleName("notRequireStyle"); gridLayout_1.addComponent(cboStatus, 1, 2); // lblToDate lblParamDesc = new Label(); lblParamDesc.setImmediate(false); lblParamDesc.setWidth("100%"); lblParamDesc.setHeight("-1px"); lblParamDesc.setValue(BundleUtils.getString("lb.appParam.description")); gridLayout_1.addComponent(lblParamDesc, 2, 2); // pdfToDate txtAreaParamDesc = new TextArea(); txtAreaParamDesc.setImmediate(true); txtAreaParamDesc.setWidth("100.0%"); txtAreaParamDesc.setHeight("-1px"); txtAreaParamDesc.setMaxLength(300); // txtAreaParamDesc.addValidator(new StringLengthValidator(BundleUtils.getString("message.error.overlengthString"))); gridLayout_1.addComponent(txtAreaParamDesc, 3, 2); // // btnReset // GridLayout button = new GridLayout(1, 1); // button.setWidth("100%"); // button.setHeight("-1px"); // btnReset = new Button(); // btnReset.setStyleName("v-button-link"); // btnReset.setIcon(new ThemeResource("img/refresh-icon.png")); // btnReset.setImmediate(true); // btnReset.setHeight("-1px"); // btnReset.setDescription(Constants.BUTTON_REFRESH); // button.addComponent(btnReset); // button.setComponentAlignment(btnReset, Alignment.TOP_RIGHT); // gridLayout_1.addComponent(button, 3, 3); return gridLayout_1; }