/** * Loads the name of theme from the session's style * * @return The session's style */ protected String loadThemeName() { return Session.get().getStyle(); }
private static boolean customResourceExists(final String packageResourcePath, final Session session) { final String customResourceKey = packageResourcePath + session.getLocale() + session.getStyle(); if (!customPackageResourceExists.containsKey(customResourceKey)) { Boolean resourceExists = PackageResource.exists(BrowserStyle.class, packageResourcePath, session.getLocale(), session.getStyle(), null); customPackageResourceExists.put(customResourceKey, resourceExists); return resourceExists; } else { return customPackageResourceExists.get(customResourceKey); } }
private String getCurrentStyle() { if (style == null && Session.exists()) { return Session.get().getStyle(); } return style; }
private String getCurrentStyle() { if (style == null && Session.exists()) { return Session.get().getStyle(); } return style; }
/** * Set the style (see {@link org.apache.wicket.Session}). * * @param style * The style to set. * @return the Session object */ public final Session setStyle(final String style) { if (!Objects.equal(getStyle(), style)) { this.style.set(style); dirty(); } return this; }
/** * Set the style (see {@link org.apache.wicket.Session}). * * @param style * The style to set. * @return the Session object */ public final Session setStyle(final String style) { if (!Objects.equal(getStyle(), style)) { this.style.set(style); dirty(); } return this; }
private static ResourceReference createResourceReference(final String path, final Session session) { return new PackageResourceReference(BrowserStyle.class, path, session.getLocale(), session.getStyle(), null); }
/** * A convenience method to access the Sessions's style. * * @return The style of this component respectively the style of the Session. * * @see org.apache.wicket.Session#getStyle() */ public final String getStyle() { Session session = getSession(); if (session == null) { throw new WicketRuntimeException("Wicket Session object not available"); } return session.getStyle(); }
/** * A convenience method to access the Sessions's style. * * @return The style of this component respectively the style of the Session. * * @see org.apache.wicket.Session#getStyle() */ public final String getStyle() { Session session = getSession(); if (session == null) { throw new WicketRuntimeException("Wicket Session object not available"); } return session.getStyle(); }
/** * Constructor. * * @param id * See Component * @param session * @see Component#Component(String) */ public SessionView(final String id, final Session session) { super(id); // Basic attributes add(new Label("id", session.getId())); add(new Label("locale", session.getLocale().toString())); add(new Label("style", session.getStyle() == null ? "[None]" : session.getStyle())); add(new Label("size", new SessionSizeModel())); }
/** * Constructor. * * @param id * See Component * @param session * @see Component#Component(String) */ public SessionView(final String id, final Session session) { super(id); // Basic attributes add(new Label("id", session.getId())); add(new Label("locale", session.getLocale().toString())); add(new Label("style", session.getStyle() == null ? "[None]" : session.getStyle())); add(new Label("size", new SessionSizeModel())); }
private String getCurrentStyle() { final String style = getStyle(); if (style != null) { return style; } if (Session.exists()) { return Session.get().getStyle(); } return style; }
private String getCurrentStyle() { final String style = getStyle(); if (style != null) { return style; } if (Session.exists()) { return Session.get().getStyle(); } return style; }
public ClassResourceModel(String key, Class<?> clazz, Object... parameters) { this(key, clazz, Session.get().getLocale(), Session.get().getStyle(), parameters); }
/** * {@inheritDoc} */ @Override public ITheme getActiveTheme() { String style = Session.get().getStyle(); if (Strings.isNullOrEmpty(style)) { return themeProvider().defaultTheme(); } else { return themeProvider().byName(style); } }
/** * Relies on the {@link PackageStringResourceLoader} class to get * a string. * @param klass the class used derive the package * @param key the string key * @param locale locale to use to return string * @return the proper string */ public static String getString( final Class<?> klass, final String key, final Locale locale) { List<IStringResourceLoader> loaders = Application.get().getResourceSettings().getStringResourceLoaders(); for (IStringResourceLoader loader : loaders) { String string = loader.loadStringResource(klass, key, locale, Session.get().getStyle(), null); if (StringUtils.isNotBlank(string)) { return string; } } return null; }
/** * @see org.apache.wicket.resource.loader.ComponentStringResourceLoader#loadStringResource(org.apache.wicket.Component, * java.lang.String) */ public String loadStringResource(Component component, String key) { if (component == null) { return loadStringResource(null, key, Session.get().getLocale(), Session.get() .getStyle()); } return super.loadStringResource(component, key); } }
/** * @see org.apache.wicket.resource.loader.ComponentStringResourceLoader#loadStringResource(org.apache.wicket.Component, * java.lang.String) */ @Override public String loadStringResource(Component component, String key) { if (component == null) { return loadStringResource(null, key, Session.get().getLocale(), Session.get() .getStyle()); } return super.loadStringResource(component, key); } }
@Override protected String load() { Locale theLocale = locale; if (theLocale == null) { theLocale = Session.get().getLocale(); } List<IStringResourceLoader> loaders = Application.get().getResourceSettings() .getStringResourceLoaders(); for (IStringResourceLoader loader : loaders) { String string = loader.loadStringResource(klass, key, theLocale, Session.get().getStyle(), null); if (StringUtils.isNotBlank(string)) { return string; } } return null; }
/** * @return the shared resource key for this resource reference. */ public final String getSharedResourceKey() { Application application = Application.get(); if (useSessionLocale) { if (!Objects.equal(locale, Session.get().getLocale())) { setLocale(Session.get().getLocale()); } } if (useSessionStyle) { if (!Objects.equal(style, Session.get().getStyle())) { setStyle(Session.get().getStyle()); } } bind(application); return application.getSharedResources().resourceKey(getScope(), name, locale, style); }