예제 #1
0
 def saveOrUpdate(self):
     """
     Save event to facebook
     """
     jEvent = Json()
     jEvent.put(u"name", self.nameText.getValue())
     jEvent.put(u"host", self.hostText.getValue())
     jEvent.put(u"location", self.locationText.getValue())
     jEvent.put(u"city", self.cityText.getValue())
     selectedCategory = Integer(self.categoryListBox.getValue(self.categoryListBox.getSelectedIndex())) #  Save Category
     selectedSubCategory = Integer(self.subCategoriesListBox.getValue(self.subCategoriesListBox.getSelectedIndex()))
     jEvent.put(u"category", EventInfo.Category.values()[(selectedCategory - 1)].toString())
     jEvent.put(u"subcategory", EventInfo.SubCategory.values()[(selectedSubCategory - 1)].toString())
     jEvent.put(u"start_time", Date().getTime() + Long(u"9999999999"))
     jEvent.put(u"end_time", Date().getTime() + Long(u"9999999999999"))
     eventInfo = EventInfo.fromJson(java.str(jEvent))
     self.outer.add(self.loader)
     class _anonymous(AsyncCallback):
         
         @java.typed(Throwable)
         def onFailure(self, caught):
             self.outer.remove(self.loader)
             errorResponse = ErrorResponseUI(caught)
             errorResponse.center()
             errorResponse.show()
         
         @java.typed(JavaScriptObject)
         def onSuccess(self, result):
             self.outer.remove(self.loader)
             self.outer.add(HTML(u"Created event with ID " + java.str(result)))
     self.apiClient.eventsCreate(eventInfo, _anonymous()) #  Create the event.
예제 #2
0
 def doEventsGet(self, status):
     self.responsePanel.clear()
     self.addLoader(self.responsePanel)
     GWT.log(u"display events", None)
     eventFilter = EventInfo.createEventInfo(None, None, None, None, status) #  Create a filter used in the query
     self.apiClient.eventsGet(eventFilter, self.EventsGetCallback())