Foros del Web » Programación para mayores de 30 ;) » Java »

Vaadin problemas textfield

Estas en el tema de Vaadin problemas textfield en el foro de Java en Foros del Web. Buenas tardes, Lo que pasa es que estoy programando en VAADIN y al realizar un .getValue() no obtiene el texto que se escribe en el ...
  #1 (permalink)  
Antiguo 29/03/2012, 11:49
 
Fecha de Ingreso: marzo-2012
Mensajes: 21
Antigüedad: 12 años, 1 mes
Puntos: 1
Pregunta Vaadin problemas textfield

Buenas tardes,

Lo que pasa es que estoy programando en VAADIN y al realizar un .getValue() no obtiene el texto que se escribe en el textfield, y al usar .setValue() no modifica el valor del textfield, mi pregunta es porque sucede esto y como lo puedo solucionar.
Gracias de antemano.

Julián Romero
  #2 (permalink)  
Antiguo 29/03/2012, 11:58
Avatar de Carlangueitor
Moderador ლ(ಠ益ಠლ)
 
Fecha de Ingreso: marzo-2008
Ubicación: México
Mensajes: 10.037
Antigüedad: 16 años, 1 mes
Puntos: 1329
Respuesta: Vaadin problemas textfield

Muevo tu tema al foro de Java donde quizá te puedan ayudar mejor. También te recomiendo que expongas mejor tu caso, con código, por que así es difícil de darte una solución.

Saludos
__________________
Grupo Telegram Docker en Español
  #3 (permalink)  
Antiguo 29/03/2012, 22:30
 
Fecha de Ingreso: marzo-2012
Mensajes: 21
Antigüedad: 12 años, 1 mes
Puntos: 1
Pregunta Respuesta: Vaadin problemas textfield

Lo que sucede es que seguí las instrucciones del vídeo y no funciona al obtención del valor del texfield que envía el nombre entre el primer CustomComponent y el segundo, he revisado varios foros y no he encontrado la respuesta. Agradecería alguien que me pueda ayudar.

Clase Aplicacion

Cita:
import com.vaadin.Application;
import com.vaadin.ui.*;

@SuppressWarnings("serial")
public class LoginApplication extends Application {
@Override
public void init() {
Window mainWindow = new Window("Login Application");
Registro r=new Registro();
mainWindow.setContent(r);
setMainWindow(mainWindow);
}

}
Clase CustomComponet1

Cita:
import com.vaadin.annotations.AutoGenerated;
import com.vaadin.data.Property;
import com.vaadin.data.Property.ValueChangeEvent;
import com.vaadin.event.FieldEvents.TextChangeEvent;
import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.Button;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.GridLayout;
import com.vaadin.ui.TextField;
import com.vaadin.ui.Button.ClickEvent;


@SuppressWarnings("serial")
public class Registro extends CustomComponent implements Property.ValueChangeListener{

@AutoGenerated
private AbsoluteLayout mainLayout;
private GridLayout contenedor;
private Button ingresar;
private TextField nombre;

/**
* The constructor should first build the main layout, set the
* composition root and then do any custom initialization.
*
* The constructor will not be automatically regenerated by the
* visual editor.
*/
public Registro() {
buildMainLayout();
buildContenedor();
setCompositionRoot(mainLayout);

// TODO add user code here
}

@AutoGenerated
private AbsoluteLayout buildMainLayout() {
// the main layout and components will be created here
mainLayout = new AbsoluteLayout();
mainLayout.setImmediate(false);
mainLayout.setWidth("100%");
mainLayout.setHeight("100%");
mainLayout.setMargin(false);

setWidth("100.0%");
setHeight("100.0%");

contenedor=buildContenedor();
mainLayout.addComponent(contenedor,"top:0.0px;left :0.0px;");
return mainLayout;

}


@SuppressWarnings({ "deprecation" })
private GridLayout buildContenedor(){
contenedor=new GridLayout();
contenedor.setCaption("Login");
contenedor.setImmediate(false);
contenedor.setWidth("250px");
contenedor.setHeight("200px");
contenedor.setMargin(true);
contenedor.setRows(3);

nombre=new TextField();
nombre.setCaption("Nombre: ");
nombre.setImmediate(true);
nombre.setWidth("-1px");
nombre.setHeight("-1px");
nombre.setSecret(false);
nombre.addListener(this);
contenedor.addComponent(nombre,0 ,0);

ingresar=new Button();
ingresar.setCaption("Ingresar");
ingresar.setImmediate(false);
ingresar.setWidth("-1px");
ingresar.setHeight("-1px");
ingresar.addListener(new Button.ClickListener() {

@Override
public void buttonClick(ClickEvent event) {
// TODO Auto-generated method stub
getWindow().showNotification("Correcto");
getApplication().getMainWindow().setContent(new Ventana(nombre.getValue().toString()));
}
});
contenedor.addComponent(ingresar,0,1);

return contenedor;
}

@Override
public void valueChange(ValueChangeEvent event) {
// TODO Auto-generated method stub
getWindow().showNotification((String) nombre.getValue());

}


}
Clase CustomComponet2

Cita:
import com.vaadin.annotations.AutoGenerated;
import com.vaadin.ui.AbsoluteLayout;
import com.vaadin.ui.CustomComponent;
import com.vaadin.ui.Label;

@SuppressWarnings("serial")
public class Ventana extends CustomComponent {

@AutoGenerated
private AbsoluteLayout mainLayout;
private Label nombre;
private String nom;

/**
* The constructor should first build the main layout, set the
* composition root and then do any custom initialization.
*
* The constructor will not be automatically regenerated by the
* visual editor.
*/
public Ventana(String nom) {
this.nom=nom;
buildMainLayout();
setCompositionRoot(mainLayout);

// TODO add user code here
}

@AutoGenerated
private AbsoluteLayout buildMainLayout() {
// the main layout and components will be created here
mainLayout = new AbsoluteLayout();
mainLayout.setImmediate(false);
mainLayout.setWidth("100%");
mainLayout.setHeight("100%");
mainLayout.setMargin(false);

setWidth("100.0%");
setHeight("100.0%");

nombre=new Label();
nombre.setImmediate(false);
nombre.setWidth("-1px");
nombre.setHeight("-1px");
nombre.setValue("Nombre"+nom);
mainLayout.addComponent(nombre,"top:42.0px;left:90 .0px;");

return mainLayout;

}

}
Proporcionado por Tequino
[URL="http://www.youtube.com/user/MrTequino?feature=watch"]http://www.youtube.com/user/MrTequino?feature=watch[/URL]

Etiquetas: getvalue(), setvalue(), textfield, vaadin
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 10:05.