I have a table where data is loaded dynamically according to an argument and I created an action as follows:
import java.util.HashSet;
...
@SuppressWarnings( "serial")
public class TablaHardware extends Table implements ValueChangeListener, Action.Handler {
private static final Action ACTUALIZAR = new Action("Actualizar Datos Ahora");
private static final Action INFORME= new Action("Informe Ahora");
private static final Action[] ACTIONS = new Action[]
{ ACTUALIZAR,INFORME };
public myAplication app;
public int idActual=-1;
public int getIdActual() {
return idActual;
}
public void setIdActual(int idActual) {
this.idActual = idActual;
}
public TablaHardware(myApplication app) {
this.app = app;
this.setSizeFull();
setColumnCollapsingAllowed(true);
setColumnReorderingAllowed(true);
setSelectable(true);
setImmediate(true);
this.addListener((ValueChangeListener)this);
this.addActionHandler(this);
}
@Override
public Action[] getActions(Object target, Object sender) {
return ACTIONS;
}
public void setChangeContainer(int id) {
this.setIdActual(id);
switch (id)
..........................
}
public void changeDataSourceContainer(){
this.setChangeContainer(this.getIdActual());
}
@Override
public void handleAction(Action action, Object sender, Object target) {
if (action == ACTUALIZAR) {
this.changeDataSourceContainer();
this.app.show("Los Datos han sido Actualizado");
}
}
}
when there is data in the table, the action appears, but the action not appear if no data in the table
I always action menu appears independently whether or not data exists in table??