public void statusUpdated(final WorkgroupQueue queue, WorkgroupQueue.Status status) { EventQueue.invokeLater(new Runnable() { public void run() { String oldestEntry = queue.getOldestEntry() != null ? queue.getOldestEntry().toString() : ""; QueueItem item = queues.get(queue); if (item != null) { item.setNumberOfUsersInQueue(queue.getUserCount()); item.setAverageWaitTime(queue.getAverageWaitTime()); update(item); return; } item = new QueueItem(queue.getName(), queue.getUserCount(), queue.getAverageWaitTime(), oldestEntry); queues.put(queue, item); model.addElement(item); } }); }
public PacketExtension parseExtension (XmlPullParser parser) throws Exception { int eventType = parser.getEventType(); QueueOverview queueOverview = new QueueOverview(); if (eventType != XmlPullParser.START_TAG) { // throw exception } eventType = parser.next(); while ((eventType != XmlPullParser.END_TAG) || (!ELEMENT_NAME.equals(parser.getName()))) { if ("count".equals(parser.getName())) { queueOverview.setUserCount(Integer.parseInt(parser.nextText())); } else if ("time".equals(parser.getName())) { queueOverview.setAverageWaitTime(Integer.parseInt(parser.nextText())); } else if ("oldest".equals(parser.getName())) { queueOverview.setOldestEntry((DATE_FORMATTER.parse(parser.nextText()))); } else if ("status".equals(parser.getName())) { queueOverview.setStatus(WorkgroupQueue.Status.fromString(parser.nextText())); } eventType = parser.next(); if (eventType != XmlPullParser.END_TAG) { // throw exception } } if (eventType != XmlPullParser.END_TAG) { // throw exception } return queueOverview; }
public PacketExtension parseExtension (XmlPullParser parser) throws Exception { int eventType = parser.getEventType(); QueueOverview queueOverview = new QueueOverview(); SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); if (eventType != XmlPullParser.START_TAG) { // throw exception } eventType = parser.next(); while ((eventType != XmlPullParser.END_TAG) || (!ELEMENT_NAME.equals(parser.getName()))) { if ("count".equals(parser.getName())) { queueOverview.setUserCount(Integer.parseInt(parser.nextText())); } else if ("time".equals(parser.getName())) { queueOverview.setAverageWaitTime(Integer.parseInt(parser.nextText())); } else if ("oldest".equals(parser.getName())) { queueOverview.setOldestEntry((dateFormat.parse(parser.nextText()))); } else if ("status".equals(parser.getName())) { queueOverview.setStatus(WorkgroupQueue.Status.fromString(parser.nextText())); } eventType = parser.next(); if (eventType != XmlPullParser.END_TAG) { // throw exception } } if (eventType != XmlPullParser.END_TAG) { // throw exception } return queueOverview; }
public PacketExtension parseExtension(XmlPullParser parser) throws Exception { int eventType = parser.getEventType(); QueueOverview queueOverview = new QueueOverview(); SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); if (eventType != XmlPullParser.START_TAG) { // throw exception } eventType = parser.next(); while ((eventType != XmlPullParser.END_TAG) || (!ELEMENT_NAME.equals(parser.getName()))) { if ("count".equals(parser.getName())) { queueOverview.setUserCount(Integer.parseInt(parser .nextText())); } else if ("time".equals(parser.getName())) { queueOverview.setAverageWaitTime(Integer.parseInt(parser .nextText())); } else if ("oldest".equals(parser.getName())) { queueOverview.setOldestEntry((dateFormat.parse(parser .nextText()))); } else if ("status".equals(parser.getName())) { queueOverview.setStatus(WorkgroupQueue.Status .fromString(parser.nextText())); } eventType = parser.next(); if (eventType != XmlPullParser.END_TAG) { // throw exception } } if (eventType != XmlPullParser.END_TAG) { // throw exception } return queueOverview; }
public void usersUpdated(WorkgroupQueue queue, Set users) { QueueItem item = queues.get(queue); if (item == null) { statusUpdated(queue, queue.getStatus()); } else { item.setNumberOfUsersInQueue(users.size()); } update(item); }
public void oldestEntryUpdated(WorkgroupQueue queue, Date date) { QueueItem item = queues.get(queue); if (item != null) { item.setOldestEntryDate(date); } update(item); }
public void averageWaitTimeUpdated(WorkgroupQueue queue, int waitTime) { QueueItem item = queues.get(queue); if (item == null) { return; } item.setAverageWaitTime(waitTime); update(item); }
public WorkgroupQueue.Status getStatus() { return status; }
void setStatus(WorkgroupQueue.Status status) { this.status = status; }
@Override public QueueOverview parse(XmlPullParser parser, int initialDepth) throws XmlPullParserException, IOException, SmackException { int eventType = parser.getEventType(); QueueOverview queueOverview = new QueueOverview(); SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT); eventType = parser.next(); while ((eventType != XmlPullParser.END_TAG) || (!ELEMENT_NAME.equals(parser.getName()))) { if ("count".equals(parser.getName())) { queueOverview.setUserCount(Integer.parseInt(parser.nextText())); } else if ("time".equals(parser.getName())) { queueOverview.setAverageWaitTime(Integer.parseInt(parser.nextText())); } else if ("oldest".equals(parser.getName())) { try { queueOverview.setOldestEntry((dateFormat.parse(parser.nextText()))); } catch (ParseException e) { throw new SmackException(e); } } else if ("status".equals(parser.getName())) { queueOverview.setStatus(WorkgroupQueue.Status.fromString(parser.nextText())); } eventType = parser.next(); if (eventType != XmlPullParser.END_TAG) { // throw exception } } if (eventType != XmlPullParser.END_TAG) { // throw exception } return queueOverview; }