List of usage examples for org.apache.wicket.ajax.markup.html AjaxLink AjaxLink
public AjaxLink(final String id)
From source file:com.userweave.pages.configuration.tab.CustomTabPanel.java
License:Open Source License
private void addFeedbackLink() { userFeedbackModalWindow = new CustomModalWindow("feedbackModalWindow"); userFeedbackModalWindow.setInitialHeight(395); userFeedbackModalWindow.setPageCreator(new ModalWindow.PageCreator() { @Override/*from w w w .j a v a 2s . co m*/ public Page createPage() { return new UserFeedbackPage(userFeedbackModalWindow); } }); add(userFeedbackModalWindow); add(new AjaxLink("feedback") { @Override public void onClick(AjaxRequestTarget target) { userFeedbackModalWindow.show(target); } }); }
From source file:com.userweave.pages.homepage.IntroPanel.java
License:Open Source License
public IntroPanel(String id) { super(id);//w ww .j a v a2 s . c o m add(new Link("switchToGerman") { @Override public void onClick() { getSession().setLocale(LocalizationUtils.getSupportedConfigurationFrontendLocale("de")); } }); add(new Link("switchToEnglish") { @Override public void onClick() { getSession().setLocale(LocalizationUtils.getSupportedConfigurationFrontendLocale("en")); } }); add(yes = new AjaxLink("yes") { @Override public void onClick(AjaxRequestTarget target) { onOk(target); } }); add(no = new AjaxLink("no") { @Override public void onClick(AjaxRequestTarget target) { onCancel(target); } }); }
From source file:com.userweave.pages.test.BasePageSurvey.java
License:Open Source License
private void addImprintModalWindow() { final SurveyModalWindow imprintModal = new SurveyModalWindow("imprintModalWindow", SurveyModalWindow.TypeOfModal.IMPRINT) { private static final long serialVersionUID = 1L; @Override// w w w . jav a2 s . c o m public String getIconAndFontColor() { return getColorForModalWindow(); } }; imprintModal.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = 1L; @Override public Page createPage() { return new ImprintPage(); } }); imprintModal.setInitialWidth(500); imprintModal.setInitialHeight(370); imprintModal.setTitle(new StringResourceModel("imprint", this, null)); add(imprintModal); add(new AjaxLink<Void>("imprintLink") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { imprintModal.show(target); } }); }
From source file:com.userweave.pages.test.BasePageSurvey.java
License:Open Source License
private void addPrivacyModalWindow() { final SurveyModalWindow privacyModal = new SurveyModalWindow("privacyModalWindow", SurveyModalWindow.TypeOfModal.PRIVACY) { private static final long serialVersionUID = 1L; @Override//from ww w . j a va2 s. c o m public String getIconAndFontColor() { return getColorForModalWindow(); } }; privacyModal.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = 1L; @Override public Page createPage() { return new PrivacyPage(); } }); privacyModal.setInitialWidth(500); privacyModal.setInitialHeight(370); privacyModal.setTitle(new StringResourceModel("privacy", this, null)); add(privacyModal); add(new AjaxLink<Void>("privacyLink") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { privacyModal.show(target); } }); }
From source file:com.userweave.pages.test.BasePageSurvey.java
License:Open Source License
private void addHelpModalWindow() { final SurveyModalWindow helpModal = new SurveyModalWindow("helpModalWindow", SurveyModalWindow.TypeOfModal.HELP) { private static final long serialVersionUID = 1L; @Override/*from ww w . j a v a 2 s. c o m*/ public String getIconAndFontColor() { return getColorForModalWindow(); } }; helpModal.setPageCreator(new ModalWindow.PageCreator() { private static final long serialVersionUID = 1L; @Override public Page createPage() { return new HelpPage(getHelpPanel(HelpPage.PANEL_MARKUP_ID)); } }); helpModal.setInitialWidth(500); helpModal.setInitialHeight(370); helpModal.setTitle(new StringResourceModel("help", this, null)); add(helpModal); add(new AjaxLink<Void>("helpLink") { private static final long serialVersionUID = 1L; @Override public void onClick(AjaxRequestTarget target) { helpModal.show(target); } }); }
From source file:com.userweave.pages.test.popups.registration.InformAboutIncompleteRegistrationPage.java
License:Open Source License
public InformAboutIncompleteRegistrationPage(final ModalWindow window) { add(yes = new AjaxLink("yes") { @Override/* w ww . j a v a2 s . c om*/ public void onClick(AjaxRequestTarget target) { window.close(target); } }); }
From source file:com.userweave.pages.user.configuration.UserApiCredentialsPanel.java
License:Open Source License
public UserApiCredentialsPanel(String id, UserModel userModel) { super(id);/*from ww w. ja v a2 s . com*/ model = userModel; AddModalWindows(); final FeedbackPanel feedbackPanel = new FeedbackPanel("feedbackPanel"); feedbackPanel.setOutputMarkupId(true); add(feedbackPanel); createApiCredentialsContainer = new WebMarkupContainer("createApiCredentialsContainer") { @Override public boolean isVisible() { return !hasUserApiCredentials(); } }; createApiCredentialsContainer.setOutputMarkupPlaceholderTag(true); add(createApiCredentialsContainer); apiCredentialsContainer = new WebMarkupContainer("apiCredentialsContainer") { @Override public boolean isVisible() { return hasUserApiCredentials(); } }; apiCredentialsContainer.setOutputMarkupPlaceholderTag(true); add(apiCredentialsContainer); Form form = new Form("form"); createApiCredentialsContainer.add(form); form.add(new DefaultButton("createButton", new ResourceModel("createApiCredentials"), form) { @Override protected void onError(AjaxRequestTarget target, Form form) { target.addComponent(feedbackPanel); } @Override protected void onSubmit(AjaxRequestTarget target, Form form) { target.addComponent(feedbackPanel); // create new apiCredential ApiCredentials apiCred = new ApiCredentials(); apiCred.setHash(HashProvider.uniqueUUID()); apiCred.setActiveLastChange(new DateTime()); apiCredentialsDao.save(apiCred); User user = model.getObject(); user.setApiCredentials(apiCred); userDao.save(user); apiCredentialsContainer.setVisible(true); createApiCredentialsContainer.setVisible(false); target.addComponent(apiCredentialsContainer); target.addComponent(createApiCredentialsContainer); }; }); apiCredentialsContainer.add(new Label("apiAuthHash", new PropertyModel(model, "apiCredentials.hash"))); apiCredentialsContainer.add(new AjaxLink("genHash") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedbackPanel); generateHashModalWindow.show(target); } @Override public boolean isVisible() { return UserWeaveSession.get().isAdmin(); } }); WebMarkupContainer activeAdminContainer = new WebMarkupContainer("activeAdminContainer") { @Override public boolean isVisible() { return UserWeaveSession.get().isAdmin(); } }; apiCredentialsContainer.add(activeAdminContainer); final AjaxCheckBox activeChkBx = new AjaxCheckBox("active", new PropertyModel(model, "apiCredentials.active")) { @Override protected void onUpdate(AjaxRequestTarget target) { target.addComponent(feedbackPanel); userDao.save(model.getObject()); } }; activeChkBx.setOutputMarkupId(true); activeAdminContainer.add(activeChkBx); WebMarkupContainer activeContainer = new WebMarkupContainer("activeContainer") { @Override public boolean isVisible() { return !UserWeaveSession.get().isAdmin(); } }; apiCredentialsContainer.add(activeContainer); String dateString = new StringResourceModel("noActiveDate", this, null).getString(); if (model.getObject().getApiCredentials() != null && model.getObject().getApiCredentials().getActiveLastChange() != null) { DateTimeFormatter dateDTF = DateTimeFormat.longDate(); DateTimeFormatter usFmt = dateDTF.withLocale(UserWeaveSession.get().getLocale()); dateString = model.getObject().getApiCredentials().getActiveLastChange().toString(usFmt); } Label activeLabel = new Label("activeText", new StringResourceModel("deactiveFormat", this, null, new Object[] { dateString })); if (model.getObject().getApiCredentials() != null && model.getObject().getApiCredentials().isActive()) { activeLabel.setDefaultModel( new StringResourceModel("activeFormat", this, null, new Object[] { dateString })); } activeContainer.add(activeLabel); WebMarkupContainer deleteContainer = new WebMarkupContainer("deleteContainer") { @Override public boolean isVisible() { return UserWeaveSession.get().isAdmin(); } }; apiCredentialsContainer.add(deleteContainer); deleteContainer.add(new AjaxLink("delete") { @Override public void onClick(AjaxRequestTarget target) { target.addComponent(feedbackPanel); deleteModalWindow.show(target); } }); }
From source file:com.userweave.pages.user.configuration.UserEditHeaderPanel.java
License:Open Source License
private void addEnableUserLink() { addLinkComponent(new LinkComponentCreator() { @Override//from www . ja va2 s. c om public LinkComponent create(String markupId) { return new LinkButtonComponent(markupId, new StringResourceModel("reactivate", UserEditHeaderPanel.this, null)) { @Override protected AbstractLink createLink(String markupId) { return new AjaxLink(markupId) { @Override public void onClick(AjaxRequestTarget target) { userService.activate(getUser()); target.addComponent(UserEditHeaderPanel.this); } @Override public boolean isVisible() { return getUser().isDeactivated() && UserWeaveSession.get().isAdmin(); } }; } }; } }); }
From source file:com.userweave.pages.user.configuration.UserEditHeaderPanel.java
License:Open Source License
private void addDisableUserLink() { final CustomModalWindow disableUserModalWindow = addLinkModalWindow(); disableUserModalWindow.setPageCreator(new ModalWindow.PageCreator() { public Page createPage() { return new AssurancePage(disableUserModalWindow) { @Override/*from ww w. j ava2 s. co m*/ protected void onOk(AjaxRequestTarget target) { disableUser = true; } @Override protected IModel getAcceptLabel() { return new StringResourceModel("end_membership", UserEditHeaderPanel.this, null); } @Override protected IModel getSureModel() { return new StringResourceModel("sure", UserEditHeaderPanel.this, null); } }; } }); disableUserModalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() { public void onClose(AjaxRequestTarget target) { if (disableUser) { userService.deactivate(getUser()); disableUser = false; if (UserWeaveSession.get().isAdmin()) { target.addComponent(UserEditHeaderPanel.this); } else { setResponsePage(SignoutPage.class); } } } }); disableUserModalWindow.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() { public boolean onCloseButtonClicked(AjaxRequestTarget target) { return true; } }); addLinkComponent(new LinkComponentCreator() { @Override public LinkComponent create(String markupId) { return new LinkButtonComponent(markupId, new StringResourceModel("end_membership", UserEditHeaderPanel.this, null)) { @Override protected AbstractLink createLink(String markupId) { return new AjaxLink(markupId) { @Override public void onClick(AjaxRequestTarget target) { disableUserModalWindow.show(target); } @Override public boolean isVisible() { return !getUser().isDeactivated(); } }; } }; } }); }
From source file:com.userweave.pages.user.configuration.UserEditPersonalPanel.java
License:Open Source License
private void addActions() { AjaxLink changePasswordLink = new AjaxLink("changePassword") { @Override/*w w w.j a v a2s . c o m*/ public void onClick(AjaxRequestTarget target) { changePasswordModal.show(target); } }; add(changePasswordLink); AjaxLink endMembershipLink = new AjaxLink("endMembership") { @Override public void onClick(AjaxRequestTarget target) { endMembershipModal.show(target); } }; add(endMembershipLink); AjaxLink enableUser = new AjaxLink("enableUser") { @Override public void onClick(AjaxRequestTarget target) { userService.activate(getUser()); target.addComponent(UserEditPersonalPanel.this); } @Override public boolean isVisible() { return getUser().isDeactivated() && UserWeaveSession.get().isAdmin(); } }; add(enableUser); }