List of usage examples for org.apache.wicket Application get
public static Application get()
From source file:de.alpharogroup.wicket.components.examples.tooltips.TooltipsExamplePanel.java
License:Apache License
/** * {@inheritDoc}/*from w w w .j av a 2 s. co m*/ */ @Override public void renderHead(final IHeaderResponse response) { super.renderHead(response); response.render(JavaScriptHeaderItem .forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())); response.render(JavaScriptHeaderItem.forReference(TooltipsterResourceReference.INSTANCE)); }
From source file:de.alpharogroup.wicket.js.addon.popupoverlay.PopupoverlayBehavior.java
License:Apache License
/** * {@inheritDoc}//from w ww. j a va 2s. co m */ @Override public void renderHead(final Component component, final IHeaderResponse response) { super.renderHead(component, response); response.render(JavaScriptHeaderItem .forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference())); response.render(JavaScriptHeaderItem.forReference(PopupoverlayResourceReference.INSTANCE)); final PopupoverlayJsGenerator generator = new PopupoverlayJsGenerator(this.settings, this.component.getMarkupId()); final String javascript = generator.generateJs(); response.render(OnLoadHeaderItem.forScript(javascript)); }
From source file:de.codepitbull.spring1.HomePage.java
License:Apache License
public HomePage(final PageParameters parameters) { add(new Label("testText", new AbstractReadOnlyModel<String>() { @Override/*ww w . ja va 2 s . com*/ public String getObject() { return ((WicketApplication) Application.get()).getTestService().getName(); } })); }
From source file:de.flapdoodle.wicket.examples.requests.UseExceptionAwarePage.java
License:Apache License
@Override public IRequestHandler onException(RequestCycle cycle, Exception ex) { Throwable rootCause = Exceptions.rootCause(ex); if (rootCause instanceof BadThingHappenException) { return new RedirectRequestHandler(urlFor(Application.get().getHomePage(), new PageParameters().add("cause", rootCause.getMessage())).toString()); }//from w ww.j a v a2s .c o m return null; }
From source file:de.flapdoodle.wicket.request.cycle.exception.listener.ApplicationHomePageFallbackListener.java
License:Apache License
private RedirectRequestHandler redirectToHomePage(RequestCycle cycle) { return new RedirectRequestHandler( cycle.urlFor(Application.get().getHomePage(), new PageParameters().add("cause", "badThings")) .toString());/*from w w w . j a v a 2s .co m*/ }
From source file:de.inren.frontend.application.ApplicationSettingsUtil.java
License:Apache License
/** Apply settings */ public static void applySettings(UserSettings u) { IBootstrapSettings settings = Bootstrap.getSettings(Application.get()); settings.getActiveThemeProvider().setActiveTheme(u.getTheme()); }
From source file:de.inren.frontend.common.templates.TemplatePage.java
License:Apache License
/** * creates a new {@link Navbar} instance * // ww w . j a v a 2 s . com * @param markupId * The components markup id. * @return a new {@link Navbar} instance */ protected Navbar createNavbar(String markupId) { Navbar navbar = new Navbar(markupId); navbar.setPosition(Navbar.Position.STATIC_TOP); // show brand name navbar.setBrandName(new AbstractReadOnlyModel<String>() { @Override public String getObject() { ApplicationStatus status = ((InRenApplication) Application.get()).getApplicationStatus(); return "InRen (#=" + status.getSessions().size() + "/A=" + status.getActiveSessions() + "/T=" + status.getTemporarySessions() + "/I=" + status.getInvalidSessions() + ")"; } }); navbar.addComponents( NavigationProvider.get().getTopNavbarComponents(getActivePermissions(), TemplatePage.this)); // Theme selector on the right. final List<INavbarComponent> components = new ArrayList<INavbarComponent>(); // components.add(new ImmutableNavbarComponent(new ThemesDropDown(), // Navbar.ComponentPosition.RIGHT)); if (isSignedIn()) { components.add(new ImmutableNavbarComponent(new NavbarButton<LogoutPage>(LogoutPage.class, new StringResourceModel("logout.label", TemplatePage.this, null)) .setIconType(GlyphIconType.globe), ComponentPosition.RIGHT)); } else { components.add(new ImmutableNavbarComponent(new NavbarButton<LoginPage>(LoginPage.class, new StringResourceModel("login.label", TemplatePage.this, null)) .setIconType(GlyphIconType.globe), ComponentPosition.RIGHT)); } // change language components .add(new ImmutableNavbarComponent(new LanguageSwitcherPanel("component"), ComponentPosition.RIGHT)); navbar.addComponents(components); return navbar; }
From source file:de.inren.security.SignInPage.java
License:Apache License
@Override protected void onInitialize() { super.onInitialize(); StatelessForm form = new StatelessForm("form") { @Override/*from w w w. java 2s . c o m*/ protected void onSubmit() { if (Strings.isEmpty(username) || Strings.isEmpty(password)) return; boolean authResult = AuthenticatedWebSession.get().signIn(username, password); if (authResult) { continueToOriginalDestination(); setResponsePage(Application.get().getHomePage()); } else { error("Username and password are not equal!"); } } }; form.setDefaultModel(new CompoundPropertyModel(this)); form.add(new TextField("username")); form.add(new PasswordTextField("password")); form.add(new FeedbackPanel("feedbackPanel")); add(form); }
From source file:de.inren.service.picture.PictureModificationServiceImpl.java
License:Apache License
public void initPictureModificationService() { Application.get().getSharedResources().add(PictureResource.PICTURE_RESOURCE, new PictureResource()); final File file = storehouseService.getDataFile(PictureModificationService.FILE_NOT_FOUND_DIGEST); if (!file.exists()) { InputStream is = PictureModificationServiceImpl.class .getResourceAsStream(PictureModificationService.FILE_NOT_FOUND_NAME); final Hex hex = new Hex(); byte[] md5sum; md5sum = (byte[]) hex.decode(PictureModificationService.FILE_NOT_FOUND_DIGEST); // prescale to thumbnail, also test for converter storehouseService.doImport(is, md5sum); File thumbFile = getThumbnailImage(PictureModificationService.FILE_NOT_FOUND_DIGEST); log.info("picture modification service \"File not found\" image imported"); try {//from w w w.j av a 2 s .c om log.info("Mimetype of " + thumbFile.getName() + " is " + Files.probeContentType(file.toPath())); } catch (IOException e) { log.error(e.getMessage(), e); } } else { try { log.info("Mimetype of " + PictureModificationService.FILE_NOT_FOUND_NAME + " is " + Files.probeContentType(file.toPath())); } catch (IOException e) { log.error(e.getMessage(), e); } } }
From source file:de.inren.service.usersettings.UserSettingsServiceImpl.java
License:Apache License
private UserSettings createDefaultUserSettings(Long uid) { try {/*from ww w. j a va 2 s .c o m*/ Application.get(); } catch (Exception e) { return null; } UserSettings us = new UserSettings(); us.setUid(uid); us.setTheme(Bootstrap.getSettings(Application.get()).getThemeProvider().defaultTheme().name()); save(us); return us; }