use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.
the class CreatePollDialog method updateModel.
public void updateModel(AjaxRequestTarget target) {
RoomPoll p = new RoomPoll();
User u = userDao.get(getUserId());
p.setCreator(u);
p.setRoom(roomDao.get(roomId));
p.setType(RoomPoll.Type.yesNo);
form.setModelObject(p);
target.add(form);
}
use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.
the class PollResultsDialog method onInitialize.
@Override
protected void onInitialize() {
getTitle().setObject(getString("37"));
cancel = new DialogButton("cancel", getString("lbl.cancel"));
close = new DialogButton("close", getString("1418"));
delete = new DialogButton("delete", getString("1420"));
add(closeConfirm = new MessageDialog("closeConfirm", getString("1418"), getString("1419"), DialogButtons.YES_NO, DialogIcon.WARN) {
private static final long serialVersionUID = 1L;
@Override
public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
if (button != null && button.match(YES)) {
Long id = dispForm.getModelObject().getId();
pollDao.close(roomId);
selForm.updateModel(handler);
RoomPoll p = pollDao.get(id);
selForm.select.setModelObject(p);
dispForm.updateModel(p, true, handler);
sendRoom(new RoomMessage(roomId, findParent(MainPanel.class).getClient(), RoomMessage.Type.pollUpdated));
}
}
});
add(deleteConfirm = new MessageDialog("deleteConfirm", getString("1420"), getString("1421"), DialogButtons.YES_NO, DialogIcon.WARN) {
private static final long serialVersionUID = 1L;
@Override
public void onClose(IPartialPageRequestHandler handler, DialogButton button) {
if (button != null && button.match(YES)) {
pollDao.delete(dispForm.getModelObject());
selForm.updateModel(handler);
dispForm.updateModel(selForm.select.getModelObject(), true, handler);
sendRoom(new RoomMessage(roomId, findParent(MainPanel.class).getClient(), RoomMessage.Type.pollUpdated));
}
}
});
super.onInitialize();
}
use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.
the class BackupExport method exportPoll.
/*
* ##################### Polls
*/
private void exportPoll(ZipOutputStream zos, ProgressHolder progressHolder) throws Exception {
List<RoomPoll> list = pollManager.get();
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
Serializer serializer = new Persister(strategy);
registry.bind(User.class, UserConverter.class);
registry.bind(Room.class, RoomConverter.class);
registry.bind(RoomPoll.Type.class, PollTypeConverter.class);
bindDate(registry, list, RoomPoll::getCreated);
writeList(serializer, zos, "roompolls.xml", "roompolls", list);
progressHolder.setProgress(75);
}
use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.
the class BackupImport method importPolls.
/*
* ##################### Import Room Polls
*/
private void importPolls(File f) throws Exception {
log.info("File explorer item import complete, starting room poll import");
Registry registry = new Registry();
Strategy strategy = new RegistryStrategy(registry);
RegistryMatcher matcher = new RegistryMatcher();
Serializer serializer = new Persister(strategy, matcher);
matcher.bind(Integer.class, IntegerTransform.class);
registry.bind(User.class, new UserConverter(userDao, userMap));
registry.bind(Room.class, new RoomConverter(roomDao, roomMap));
registry.bind(RoomPoll.Type.class, PollTypeConverter.class);
registry.bind(Date.class, DateConverter.class);
List<RoomPoll> list = readList(serializer, f, "roompolls.xml", "roompolls", RoomPoll.class);
for (RoomPoll rp : list) {
rp.setId(null);
if (rp.getRoom() == null || rp.getRoom().getId() == null) {
// room was deleted
continue;
}
if (rp.getCreator() == null || rp.getCreator().getId() == null) {
rp.setCreator(null);
}
for (RoomPollAnswer rpa : rp.getAnswers()) {
if (rpa.getVotedUser() == null || rpa.getVotedUser().getId() == null) {
rpa.setVotedUser(null);
}
}
pollDao.update(rp);
}
}
use of org.apache.openmeetings.db.entity.room.RoomPoll in project openmeetings by apache.
the class PollsSubMenu method init.
public void init() {
pollsMenu = new RoomMenuItem(mp.getString("menu.polls"), null, false);
pollQuickMenuItem = new RoomMenuItem(mp.getString("menu.polls.quick.title"), mp.getString("menu.polls.quick.descr"), false) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
qpollManager.start(room.getClient());
}
};
pollCreateMenuItem = new RoomMenuItem(mp.getString("24"), mp.getString("1483"), false) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
createPoll.updateModel(target);
createPoll.open(target);
}
};
pollVoteMenuItem = new RoomMenuItem(mp.getString("32"), mp.getString("1485"), false) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
RoomPoll rp = pollDao.getByRoom(room.getRoom().getId());
if (rp != null) {
vote.updateModel(target, rp);
vote.open(target);
}
}
};
pollResultMenuItem = new RoomMenuItem(mp.getString("37"), mp.getString("1484"), false) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
pollResults.updateModel(target, room.getClient().hasRight(Room.Right.moderator));
pollResults.open(target);
}
};
mp.add(quickPollAction);
}
Aggregations