-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
Ok... after long elacubrations I solved in this way.
I hope will be useful
/Luca
timer.addEventListener("onReadTel", new EventListener()
{
@Override
public void onEvent(Event event) throws Exception
{
System.out.println("WWW");
}
});
timer.addEventListener("onTimer", new EventListener()
{
@Override
public void onEvent(Event event) throws Exception
{
lblOrario.setValue(dateFormat.format(java.util.Calendar.getInstance(locale).getTime()));
executor.execute(new RicontattoCellulareRun(desktop, gNazione, timer));
}
});
executor=RicontattoCellulare.getExecutor();
RicontattoCellulareRun
public class RicontattoCellulareRun implements Runnable
{
private final Desktop desktop;
private final Nazioni nazione;
private final Event event;
public RicontattoCellulareRun(Desktop desktop, Nazioni nazione, Timer timer)
{
this.desktop = desktop;
this.nazione = nazione;
event = new Event("onReadTel", timer, null);
desktop.enableServerPush(true);
}
@Override
public void run()
{
try
{
Executions.activate(desktop);
TelefonateSuCellulareDAO tdao = (TelefonateSuCellulareDAO) SpringUtil.getBean("TelefonateSuCellulareDAO");
List<TelefonateSuCellulare> lstTel = tdao.findAll(nazione);
Executions.schedule(desktop, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception
{
Events.sendEvent(event);
}
}, event);
Executions.deactivate(desktop);
System.out.println("Letto:"+lstTel.size()+" richieste ricontatto");
} catch (Exception e)
{
System.err.println("RicontattoCellulareRun: " + e.getMessage());
}
}
}
2 | No.2 Revision |
Ok... after long elacubrations I solved in this way.
I hope will be useful
/Luca
timer.addEventListener("onReadTel", new EventListener()
{
@Override
public void onEvent(Event event) throws Exception
{
System.out.println("WWW");
}
});
timer.addEventListener("onTimer", new EventListener()
{
@Override
public void onEvent(Event event) throws Exception
{
lblOrario.setValue(dateFormat.format(java.util.Calendar.getInstance(locale).getTime()));
executor.execute(new RicontattoCellulareRun(desktop, gNazione, timer));
}
});
executor=RicontattoCellulare.getExecutor();
RicontattoCellulareRun
public class RicontattoCellulareRun implements Runnable
{
private final Desktop desktop;
private final Nazioni nazione;
private final Event event;
Timer timer;
public RicontattoCellulareRun(Desktop desktop, Nazioni nazione, Timer timer)
{
this.desktop = desktop;
this.nazione = nazione;
this.timer = timer;
if(!desktop.isServerPushEnabled())
desktop.enableServerPush(true);
}
@Override
public void run()
{
try
{
Executions.activate(desktop);
TelefonateSuCellulareDAO tdao = (TelefonateSuCellulareDAO) SpringUtil.getBean("TelefonateSuCellulareDAO");
List<TelefonateSuCellulare> lstTel = tdao.findAll(nazione);
final Event event = new Event("onReadTel", timer, null);
desktop.enableServerPush(true);
}
@Override
public void run()
{
try
{
Executions.activate(desktop);
TelefonateSuCellulareDAO tdao = (TelefonateSuCellulareDAO) SpringUtil.getBean("TelefonateSuCellulareDAO");
List<TelefonateSuCellulare> lstTel = tdao.findAll(nazione);
lstTel);
Executions.schedule(desktop, new EventListener<Event>() {
@Override
public void onEvent(Event event) evt) throws Exception
{
Events.sendEvent(event);
Events.sendEvent(evt);
}
}, event);
Executions.deactivate(desktop);
System.out.println("Letto:"+lstTel.size()+" richieste ricontatto");
} catch (Exception e)
{
System.err.println("RicontattoCellulareRun: " + e.getMessage());
}
}
}