Internal Ticket #1002375 Auto refresh of the calendar dashboard widget is broken. Fixed update of SimpleCalendarModel in non-event thread. Fixed silent ignore of exception.
This commit is contained in:
parent
efa49af7fa
commit
9be2050bff
|
@ -23,6 +23,7 @@ import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.base.Service;
|
import org.adempiere.base.Service;
|
||||||
import org.adempiere.base.event.AbstractEventHandler;
|
import org.adempiere.base.event.AbstractEventHandler;
|
||||||
|
@ -33,6 +34,7 @@ import org.adempiere.webui.util.ServerPushTemplate;
|
||||||
import org.compiere.model.I_R_Request;
|
import org.compiere.model.I_R_Request;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
import org.compiere.model.X_R_RequestType;
|
import org.compiere.model.X_R_RequestType;
|
||||||
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Trx;
|
import org.compiere.util.Trx;
|
||||||
|
@ -82,10 +84,13 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
||||||
private EventWindow eventWin;
|
private EventWindow eventWin;
|
||||||
private Properties ctx;
|
private Properties ctx;
|
||||||
private Desktop desktop;
|
private Desktop desktop;
|
||||||
|
private ArrayList<ADCalendarEvent> events;
|
||||||
|
|
||||||
private static RequestEventHandler eventHandler;
|
private static RequestEventHandler eventHandler;
|
||||||
private static TopicSubscriber subscriber;
|
private static TopicSubscriber subscriber;
|
||||||
|
|
||||||
|
private static final CLogger log = CLogger.getCLogger(DPCalendar.class);
|
||||||
|
|
||||||
public DPCalendar() {
|
public DPCalendar() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -395,6 +400,9 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateUI() {
|
public void updateUI() {
|
||||||
|
scm = new SimpleCalendarModel();
|
||||||
|
for (ADCalendarEvent event : events)
|
||||||
|
scm.add(event);
|
||||||
calendars.setModel(scm);
|
calendars.setModel(scm);
|
||||||
calendars.invalidate();
|
calendars.invalidate();
|
||||||
}
|
}
|
||||||
|
@ -405,10 +413,7 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshModel() {
|
private void refreshModel() {
|
||||||
scm = new SimpleCalendarModel();
|
events = getEvents(0, ctx);
|
||||||
ArrayList<ADCalendarEvent> events = getEvents(0, ctx);
|
|
||||||
for (ADCalendarEvent event : events)
|
|
||||||
scm.add(event);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateDateLabel() {
|
private void updateDateLabel() {
|
||||||
|
@ -452,7 +457,7 @@ public class DPCalendar extends DashboardPanel implements EventListener<Event>,
|
||||||
EventManager.getInstance().unregister(this);
|
EventManager.getInstance().unregister(this);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
EventManager.getInstance().unregister(this);
|
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue