List of usage examples for com.google.gwt.safehtml.shared SafeHtmlUtils fromSafeConstant
public static SafeHtml fromSafeConstant(String s)
From source file:uk.ac.ncl.openlab.intake24.client.survey.scheme.SHeSJun15.java
License:Apache License
@Override public void showNextPage() { final Survey state = getStateManager().getCurrentState(); if (!state.flags.contains(WelcomePage.FLAG_WELCOME_PAGE_SHOWN)) { interfaceManager.show(new WelcomePage(surveyMessages.welcomePage_welcomeText(), state)); } else if (!state.completionConfirmed()) { if (cachedSurveyPage == null) cachedSurveyPage = new IntakeSurvey(getStateManager(), defaultPromptManager, defaultSelectionManager, defaultScriptManager); interfaceManager.show(cachedSurveyPage); } else if (!state.customData.containsKey("dayOfWeek")) { interfaceManager.show(new MultipleChoiceRadioButtonQuestion(state, SafeHtmlUtils .fromSafeConstant("<p>Which day did you enter your food and drink intake for?</p>"), "Continue", dayOfWeekOptions, "dayOfWeek", Option.<String>none())); } else if (!state.customData.containsKey("usualFoods")) { interfaceManager.show(new MultipleChoiceRadioButtonQuestion(state, SafeHtmlUtils.fromSafeConstant( "<p>Were the types of foods and drinks you had yesterday similar to what you normally have?</p>"), "Continue", foodTypeOptions, "usualFoods", Option.some("No (please explain why)"))); } else if (!state.customData.containsKey("foodAmount")) { interfaceManager.show(new MultipleChoiceRadioButtonQuestion(state, SafeHtmlUtils.fromSafeConstant( "<p>Was the amount of food that you had yesterday similar to what you normally have? </p>"), "Continue", foodAmountOptions, "foodAmount", Option.<String>none())); } else if (!state.customData.containsKey("supplements")) { interfaceManager.show(new MultipleChoiceCheckboxQuestion(state, SafeHtmlUtils//from w w w . ja v a 2s.c o m .fromSafeConstant("<p>Do you take any dietary supplements e.g. Multivitamins?</p>"), "Continue", supplementOptions, "supplements", Option.some("Other"))); } else if (!state.customData.containsKey("diet")) { interfaceManager.show(new MultipleChoiceRadioButtonQuestion(state, SafeHtmlUtils.fromSafeConstant("<p>Are you currently following a particular diet?</p>"), "Continue", dietOptions, "diet", Option.some("Other"))); } else { interfaceManager.show(new FlatFinalPage(SurveyMessages.INSTANCE.finalPage_text(), postProcess(state, basicPostProcess), log.log)); } }
From source file:uk.ac.ncl.openlab.intake24.client.survey.WelcomePage.java
License:Apache License
@Override public SimpleSurveyStageInterface getInterface(final Callback1<Survey> onComplete, Callback2<Survey, Boolean> onIntermediateStateChange) { final Button startButton = WidgetFactory.createGreenButton(surveyMessages.welcomePage_ready(), "welcomePageReadyButton", new ClickHandler() { public void onClick(ClickEvent event) { onComplete.call(initialData.withFlag(FLAG_WELCOME_PAGE_SHOWN)); }/* w ww .j av a2 s .c o m*/ }); FlowPanel contents = new FlowPanel(); contents.getElement().addClassName("intake24-survey-content-container"); HTMLPanel htmlPanel = new HTMLPanel(SafeHtmlUtils.fromSafeConstant(welcomeHtml)); contents.add(htmlPanel); contents.add(startButton); return new SimpleSurveyStageInterface(contents, WelcomePage.class.getSimpleName()); }
From source file:uk.ac.ncl.openlab.intake24.client.ui.AuthTokenForm.java
License:Apache License
public void showInvalidToken() { form.clear(); form.add(new HTMLPanel( SafeHtmlUtils.fromSafeConstant(messages.authToken_invalid(EmbeddedData.surveySupportEmail)))); }
From source file:uk.ac.ncl.openlab.intake24.client.ui.AuthTokenForm.java
License:Apache License
public void showServiceError() { form.clear();//from w ww .j a v a 2 s .co m form.add(new HTMLPanel(messages.serverErrorTitle())); form.add(new HTMLPanel( SafeHtmlUtils.fromSafeConstant(messages.serverErrorText(EmbeddedData.surveySupportEmail)))); }
From source file:uk.ac.ncl.openlab.intake24.client.ui.GenUserForm.java
License:Apache License
public void showCredentials(GeneratedCredentials credentials, final Callback onContinueClicked) { form.clear();/*from w w w .java2 s. c o m*/ FlowPanel userInfo = new FlowPanel(); userInfo.addStyleName("intake24-user-info-panel"); userInfo.add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant(messages.genUserWelcome()))); userInfo.add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant(messages.genUserSaveInfo()))); String surveyUrl = Window.Location.getProtocol() + "//" + Window.Location.getHost() + Window.Location.getPath(); Grid userInfoTable = new Grid(2, 2); userInfoTable.addStyleName("intake24-user-info-table"); userInfoTable.setWidget(0, 0, new Label(messages.loginForm_userNameLabel())); userInfoTable.setWidget(0, 1, new Label(credentials.userName)); userInfoTable.setWidget(1, 0, new Label(messages.loginForm_passwordLabel())); userInfoTable.setWidget(1, 1, new Label(credentials.password)); userInfo.add(userInfoTable); userInfo.add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant(messages.genUserSurveyLink()))); FlowPanel urlDiv = new FlowPanel(); urlDiv.add(new Anchor(surveyUrl, surveyUrl)); userInfo.add(urlDiv); userInfo.add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant(messages.genUserOneSitting()))); Button cont = WidgetFactory.createGreenButton(messages.genUserContinue(), "genUserFormContinueButton", new ClickHandler() { @Override public void onClick(ClickEvent event) { onContinueClicked.call(); } }); userInfo.add(WidgetFactory.createButtonsPanel(cont)); form.add(userInfo); }
From source file:uk.ac.ncl.openlab.intake24.client.ui.GenUserForm.java
License:Apache License
public void showForbidden() { form.clear(); form.add(new HTMLPanel( SafeHtmlUtils.fromSafeConstant(messages.genUserForbidden(EmbeddedData.surveySupportEmail)))); }
From source file:uk.ac.ncl.openlab.intake24.client.ui.LoginForm.java
License:Apache License
public void onLoginAttemptFailed() { statusPanel.clear();//from w w w. j av a 2 s. c om statusPanel.add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant(messages .loginForm_passwordNotRecognised(SafeHtmlUtils.htmlEscape(EmbeddedData.surveySupportEmail))))); loginButton.setEnabled(true); }
From source file:uk.ac.ncl.openlab.intake24.client.ui.LoginForm.java
License:Apache License
public void onLoginServiceError() { statusPanel.clear();//from w w w.j ava 2 s. co m statusPanel.add(new HTMLPanel(SafeHtmlUtils.fromSafeConstant( messages.loginForm_serviceException(SafeHtmlUtils.htmlEscape(EmbeddedData.surveySupportEmail))))); loginButton.setEnabled(true); }
From source file:uk.ac.ncl.openlab.intake24.client.ui.WidgetFactory.java
License:Apache License
public static Anchor createBackLink() { Anchor back = new Anchor(SafeHtmlUtils.fromSafeConstant(messages.backLink())); back.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { History.back();/*from ww w . ja v a2s .com*/ } }); return back; }