@UiHandler("createNewPostBtn") void createNewPost(ClickEvent event) { String userId = utils.retrUserId(); String projectId = utils.retrFromState("projectId"); String title = newPostTtlTextBox.getText(); utils.showStaticMessage(messages.showSentRequestMsg(utils.retrFromState("projectName"))); try { service.createNewPost( projectId, userId, title, new AsyncCallback<JSONValue>() { @Override public void onSuccess(JSONValue result) { Log.debug(result.toString()); utils.dismissStaticMessage(); utils.showSuccessMessage(constants.successStr(), 3); } @Override public void onFailure(Throwable caught) { utils.dismissStaticMessage(); utils.alert(caught.getMessage()); } }); } catch (RequestException e) { Log.error("error in createNewPost", e); } utils.reportEvent("/newpost/", "createNewPost", projectId, 1); }
@Inject public MainPanel( final MessagesImpl messages, final ConstantsImpl constants, final GlobalResources resources, final NewPostGadgetService service, final VegaUtils utils) { initWidget(uiBinder.createAndBindUi(this)); resources.globalCSS().ensureInjected(); this.service = service; this.messages = messages; this.constants = constants; this.resources = resources; this.utils = utils; // dsAboutPnl.setHeader() try { setForumInfoIntoGadget(messages, utils); } catch (Exception e) { Log.debug(e.getMessage()); } Timer timer = new Timer() { @Override public void run() { try { setForumInfoIntoGadget(messages, utils); } catch (Exception e) { Log.debug(e.getMessage()); } } }; timer.schedule(1000); utils.reportPageview("/newpost/"); }
public void setForumInfoIntoGadget(final MessagesImpl messages, final VegaUtils utils) { aboutNewPostLbl.setText(messages.aboutUseNewPostGadgetMsg(utils.retrFromState("projectName"))); helloUserLbl.setText(messages.helloMsg(utils.retrUserName())); }