@Override public void execute() { clearLocalCache(); session = VeggieDinner.getSession(); if (session == null || session.getUser() == null) return; me = VeggieDinner.getUser(session.getUser()); if (me == null) { VeggieDinner.requestNewUser(session.getUser(), populateLocalCache); return; } boolean hasAll = true; myGroupDTOs.addAll(VeggieDinner.getGroups(me.getGroups()).values()); myEventDTOs.addAll(VeggieDinner.getEvents(me.getSchedule()).values()); myEventDTOs.addAll(VeggieDinner.getEvents(getEventsFromGroups(myGroupDTOs)).values()); myCohosts.addAll(VeggieDinner.getUsers(getHostsFromGroups(myGroupDTOs)).values()); if (!myGroupDTOs.containsAll(me.getGroups())) { VeggieDinner.requestNewGroup(me.getGroups(), populateLocalCache); return; } if (!myEventDTOs.containsAll(me.getSchedule()) || !myEventDTOs.containsAll(getEventsFromGroups(myGroupDTOs))) { HashSet<Key<EventDTO>> events = getEventsFromGroups(myGroupDTOs); events.addAll(me.getSchedule()); VeggieDinner.requestNewEvent(events, populateLocalCache); return; } if (!myCohosts.containsAll(getHostsFromGroups(myGroupDTOs))) { VeggieDinner.requestNewUser(getHostsFromGroups(myGroupDTOs), populateLocalCache); return; } DeferredCommand.addCommand(updateMyStuff); }
@Override public void execute() { if (me.getSchedule().size() == 0) return; MenuBar mySchedule = new MenuBar(true); myStuff.addItem("My Schedule", mySchedule); for (Key<EventDTO> e : me.getSchedule()) { final EventDTO eDTO = VeggieDinner.getEvent(e); mySchedule.addItem( dateFormat.format(eDTO.getScheduled()) + eDTO.getTheme(), new Command() { @Override public void execute() { VeggieDinner.showEvent(eDTO.getKey()); } }); } }
@Override public void execute() { if (session == null || me == null || config == null) { myStuffItem.setVisible(false); login.setVisible(true); logout.setVisible(false); signup.setVisible(config.isAllowSignup()); return; } login.setVisible(false); logout.setVisible(true); signup.setVisible(false); myStuffItem.setVisible(true); myStuff.clearItems(); myStuff.addItem( "Edit My Profile", new Command() { @Override public void execute() { VeggieDinner.showUserForm(me.getKey()); } }); if (me.isGroupFinalized()) DeferredCommand.addCommand(populateMyEvents); else { if (me.numGroups() > 0) { DeferredCommand.addCommand(populateMyInvites); } if (config.isAllowGroupFormation()) { myStuff.addItem( "Create Group", new Command() { @Override public void execute() { VeggieDinner.showSelectGroupForm(session.getUser()); } }); } } if (me.getSchedule() != null && me.getSchedule().size() > 0) DeferredCommand.addCommand(populateMySchedule); // TODO anything else that falls under myStuff? }