List of usage examples for org.apache.wicket.resource.loader ClassStringResourceLoader ClassStringResourceLoader
public ClassStringResourceLoader(final Class<?> clazz)
From source file:com.userweave.application.UserWeaveApplication.java
License:Open Source License
private void setDefaultResourceLocale(final Locale defaultResourceLocale) { Collection<IStringResourceLoader> stringResourceLoaders = new ArrayList<IStringResourceLoader>( getResourceSettings().getStringResourceLoaders()); for (IStringResourceLoader loader : stringResourceLoaders) { getResourceSettings().getStringResourceLoaders().add(loader); }// w w w . j av a2 s .c o m // support for default _en.properties files getResourceSettings().getStringResourceLoaders().add(new ComponentStringResourceLoader() { @Override public String loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation) { return super.loadStringResource(clazz, key, defaultResourceLocale, style, variation); } }); getResourceSettings().getStringResourceLoaders().add(new ClassStringResourceLoader(this.getClass()) { @Override public String loadStringResource(Class<?> clazz, String key, Locale locale, String style, String variation) { return super.loadStringResource(clazz, key, defaultResourceLocale, style, variation); } }); }
From source file:jp.javelindev.wicket.resource.SimpleTextResource.java
License:Apache License
public static SimpleTextResource create() { try {/*from www . j a v a 2s . c o m*/ String text = new ClassStringResourceLoader(SimpleTextResource.class) .loadStringResource(SimpleTextResource.class, "text", null, null, null); return new SimpleTextResource("text/plain", text.getBytes("Shift_JIS"), null); } catch (UnsupportedEncodingException ex) { throw new IllegalStateException("unsupported encoding: Shift_JIS", ex); } }
From source file:org.apache.isis.viewer.wicket.viewer.settings.IsisResourceSettings.java
License:Apache License
/** * Configures Wicket's default ResourceLoaders. * * <p>/*from w w w.jav a2 s . com*/ * In contrast to the default lookup strategy, Isis' searches for application-specific properties first. * * </p> * For an example in {@code FooApplication} let {@code bar.Foo} extend {@link org.apache.wicket.Component}, this * results in the following ordering: * <dl> * <dt>application specific</dt> * <dd> * <ul> * <li>FooApplication.properties</li> * <li>Application.properties</li> * </ul> * </dd> * <dt>component specific</dt> * <dd> * <ul> * <li>bar/Foo.properties</li> * <li>org/apache/wicket/Component.properties</li> * </ul> * </dd> * <dt>package specific</dt> * <dd> * <ul> * <li>bar/package.properties</li> * <li>package.properties (on Foo's class loader)</li> * <li>org/apache/wicket/package.properties</li> * <li>org/apache/package.properties</li> * <li>org/package.properties</li> * <li>package.properties (on Component's class loader)</li> * </ul> * </dd> * <dt>validator specific</dt> * <dt>Initializer specific</dt> * <dd> * <ul> * <li>bar.Foo.properties (Foo implementing IInitializer)</li> * </ul> * </dd> * </dl> * * @param application */ public IsisResourceSettings(Application application) { super(application); // consult first (the default implementation checks this only third) stringResourceLoaders.add(new ClassStringResourceLoader(application.getClass())); stringResourceLoaders.add(new ComponentStringResourceLoader()); stringResourceLoaders.add(new PackageStringResourceLoader()); // this is where the default implementation registered the search. //stringResourceLoaders.add(new ClassStringResourceLoader(application.getClass())); stringResourceLoaders.add(new ValidatorStringResourceLoader()); stringResourceLoaders.add(new InitializerStringResourceLoader(application.getInitializers())); }
From source file:org.dcm4chee.web.common.base.BaseWicketPage.java
License:LGPL
protected String getBrowserTitle() { Class<?> clazz = Application.get().getHomePage(); String s = new ClassStringResourceLoader(clazz).loadStringResource(null, "application.browser_title"); if (s == null) { s = new PackageStringResourceLoader().loadStringResource(clazz, "application.browser_title", getSession().getLocale(), null); }/* w w w. ja v a 2 s. co m*/ return s == null ? "DCM4CHEE" : s; }
From source file:org.dcm4chee.web.common.login.LoginPage.java
License:LGPL
protected String getBrowserTitle() { Class<?> clazz = Application.get().getHomePage(); String s = new ClassStringResourceLoader(clazz).loadStringResource(null, "application.browser_title"); if (s == null) s = new PackageStringResourceLoader().loadStringResource(clazz, "application.browser_title", getSession().getLocale(), null); return (s == null ? "DCM4CHEE" : s) + ": " + this.getString("application.login", null, "Login"); }
From source file:org.dcm4chee.web.common.secure.SecureTab.java
License:LGPL
private ClassStringResourceLoader getClassStringLoader() { if (classStringLoader == null) classStringLoader = new ClassStringResourceLoader(clazz); return classStringLoader; }
From source file:org.dcm4chee.web.war.tc.imageview.TCImageViewPage.java
License:LGPL
private String getLocalizedString(String key, String defaultValue) { ClassStringResourceLoader loader = new ClassStringResourceLoader(getClass()); String value = loader.loadStringResource(getClass(), key, getSession().getLocale(), null); return value != null ? value : defaultValue; }
From source file:org.dcm4chee.wizard.common.component.MainWebPage.java
License:LGPL
protected String getBrowserTitle() { Class<?> clazz = Application.get().getHomePage(); String s = new ClassStringResourceLoader(clazz).loadStringResource(this.getClass(), "application.browser_title", getSession().getLocale(), null, null); if (s == null) { s = new PackageStringResourceLoader().loadStringResource(this.getClass(), "application.browser_title", getSession().getLocale(), null, null); }/* w w w. j av a2s . c o m*/ return s == null ? "DCM4CHEE" : s; }
From source file:org.dcm4chee.wizard.common.login.LoginPage.java
License:LGPL
protected String getBrowserTitle() { Class<?> clazz = Application.get().getHomePage(); String s = new ClassStringResourceLoader(clazz).loadStringResource(this.getClass(), "application.browser_title", getSession().getLocale(), null, null); if (s == null) { s = new PackageStringResourceLoader().loadStringResource(this.getClass(), "application.browser_title", getSession().getLocale(), null, null); }/*from w w w . j a v a2s .c o m*/ return (s == null ? "DCM4CHEE" : s) + ": " + this.getString("application.login", null, "Login"); }
From source file:org.devproof.portal.core.module.common.page.TemplatePage.java
License:Apache License
private Label createMenuLinkLabel(Class<? extends Page> pageClass) { String label = new ClassStringResourceLoader(pageClass).loadStringResource(null, CommonConstants.MAIN_NAVIGATION_LINK_LABEL); if (StringUtils.isEmpty(label)) { label = new ClassStringResourceLoader(pageClass).loadStringResource(null, CommonConstants.CONTENT_TITLE_LABEL); }/*from w ww. j ava 2 s. c o m*/ return new Label("mainNavigationLinkLabel", label); }