I have a set of containers that are displayed in a list. I trigger a method without problem when a container is selected but I can not change it.
Next I show my code so that they indicate to me that I am doing badly.
// Método que devuelve el detalle de las tiendas
private SwipeableContainer creaItemTienda(Form fmTienda, Tienda tDa) {
Label lbImagen = new Label();
lbImagen.setUIID("Transparent");
lbImagen.setIcon(imagenTipoTienda(tDa.getTipoTienda()));
Button txNombre = new Button();
txNombre.setUIID("MultiLine2");
txNombre.setText(tDa.getNombre());
TextArea txDireccion = new TextArea(2, 60);
txDireccion.setUIID("MultiLine3");
txDireccion.setText(tDa.getDireccion());
txDireccion.setEditable(false);
txDireccion.setAlignment(TextArea.LEFT);
Label lbEvaluacion = new Label(" (" + tDa.getEvaluacionCantidad() + ")");
lbEvaluacion.setIcon(res.getImage(imagenEvaluacion(tDa.getEvaluacion())));
lbEvaluacion.setTextPosition(Label.RIGHT);
Style s = UIManager.getInstance().getComponentStyle("LabelYellow");
Button btEvaluar = new Button(FontImage.createMaterial(FontImage.MATERIAL_STAR, s, 8), "Transparent");
// Container cnEvaluacion = LayeredLayout.encloseIn(lbEvaluacion, FlowLayout.encloseRight(btEvaluar));
Container cnDatos = new Container(new BoxLayout(BoxLayout.Y_AXIS)).add(txNombre).add(txDireccion);
Container cnDatos1 = new Container(new BoxLayout(BoxLayout.Y_AXIS)).add(cnDatos).add(lbEvaluacion);
Container cnItem = new Container(new BoxLayout(BoxLayout.X_AXIS)).add(lbImagen).add(cnDatos1);
Container cnElemento = new Container(new BoxLayout(BoxLayout.Y_AXIS)).add(cnItem).add(separador());
cnElemento.setLeadComponent(txNombre);
s = UIManager.getInstance().getComponentStyle("Menu");
FontImage iMapa = (FontImage) FontImage.createMaterial(FontImage.MATERIAL_LOCATION_ON, s, 8);
if (tDa.getUrl().length() == 0) {
iMapa = (FontImage) FontImage.createMaterial(FontImage.MATERIAL_LOCATION_OFF, s, 8);
}
Button btMapa = new Button(iMapa, "Transparent");
Container cnBotones = new Container(new BoxLayout(BoxLayout.X_AXIS)).add(btMapa).add(btEvaluar);
cnBotones.setUIID("Transparent");
SwipeableContainer sc = new SwipeableContainer(
cnBotones,
null,
// GridLayout.encloseIn(1, btEliminar),
cnElemento);
sc.putClientProperty("busqueda", tDa.getNombre() + tDa.getDireccion());
txNombre.addActionListener((e) -> {
mantenimientoTienda(fmTienda, tDa, CAMBIAR);
});
btMapa.addActionListener((e) -> {
if (tDa.getUrl().length() > 0) {
Display.getInstance().execute(tDa.getUrl());
}
});
btEvaluar.addActionListener((e) -> {
muestraEvaluacion(fmTienda, sc, null, null, tDa, null, null, TIENDA);
});
return sc;
}