@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? }
@Override public void execute() { HashMap<Key<GroupDTO>, GroupDTO> invites = VeggieDinner.getGroups(me.getGroups()); myInvites = new MenuBar(true); myStuff.addItem("My Invites", myInvites); for (GroupDTO g : invites.values()) { final GroupDTO finalGroup = g; String hostsString = "Me"; for (UserDTO u : VeggieDinner.getUsers(g.getHosts()).values()) if (!u.getKey().equals(me.getKey())) hostsString += ", " + u.getUserName(); myInvites.addItem( hostsString, new Command() { @Override public void execute() { VeggieDinner.showGroup(finalGroup.getKey()); } }); } }
@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() { final GroupDTO g = VeggieDinner.getGroup(me.getSelectedGroup()); myStuff.addItem( "My Group", new Command() { @Override public void execute() { VeggieDinner.showGroup(g.getKey()); } }); Collection<Key<EventDTO>> events = g.getEvents(); if (events.size() == 1) { final Key<EventDTO> e = g.getEvent(0); myStuff.addItem( "My Event", new Command() { @Override public void execute() { VeggieDinner.showEvent(e); } }); } else if (events.size() > 1) { MenuBar myEvents = new MenuBar(true); myStuff.addItem("My Events", myEvents); for (int i = 0; i < events.size(); i++) { final Key<EventDTO> e = g.getEvent(i); // TODO add the schedule to the group and populate the date // here as well myEvents.addItem( "Event #" + e.getId(), new Command() { @Override public void execute() { VeggieDinner.showEvent(e); } }); } } }