Example usage for org.apache.wicket.resource.loader PackageStringResourceLoader PackageStringResourceLoader

List of usage examples for org.apache.wicket.resource.loader PackageStringResourceLoader PackageStringResourceLoader

Introduction

In this page you can find the example usage for org.apache.wicket.resource.loader PackageStringResourceLoader PackageStringResourceLoader.

Prototype

public PackageStringResourceLoader() 

Source Link

Document

Create and initialize the resource loader.

Usage

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. j  a v a  2  s . c o  m*/
 * 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);
    }/*from   www. j  av a2  s  . c o 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 void initialize() {
    clazzName = clazz.getName().substring(clazz.getName().lastIndexOf('.') + 1);
    pkgStringLoader = new PackageStringResourceLoader();
    try {//from  ww  w . j  av a2 s. co m
        Method m = clazz.getDeclaredMethod("getModuleName");
        tabTitlePropertyName = m.invoke(null) + TAB_TITLE_EXT;
    } catch (Exception e) {
        log.warn("Panel class " + clazz
                + " has no static getModuleName() method declared! use classname instead!:" + clazzName);
        tabTitlePropertyName = clazzName + TAB_TITLE_EXT;
    }
}

From source file:org.dcm4chee.web.common.secure.SecureTab.java

License:LGPL

private PackageStringResourceLoader getPackageStringLoader() {
    if (pkgStringLoader == null)
        pkgStringLoader = new PackageStringResourceLoader();
    return pkgStringLoader;
}

From source file:org.dcm4chee.web.war.tc.TCDetailsPanel.java

License:LGPL

public TCDetailsPanel(final String id, final IModel<Boolean> trainingModeModel) {
    super(id, new Model<TCObject>());

    setOutputMarkupId(true);// w  w  w .  j  a  va  2 s. co  m

    final Model<TCObject> tabModel = new Model<TCObject>() {
        @Override
        public TCObject getObject() {
            return (TCObject) TCDetailsPanel.this.getDefaultModelObject();
        }
    };

    WebMarkupContainer tabsContainer = new WebMarkupContainer("details-tabs");
    tabsContainer
            .add(new Label("tc.details.tab.info.title", new ResourceModel("tc.details.tab.info.title.text"))
                    .setOutputMarkupId(true));
    tabsContainer.add(new Label("tc.details.tab.diagnosis.title",
            new ResourceModel("tc.details.tab.diagnosis.title.text")).setOutputMarkupId(true));
    tabsContainer.add(new Label("tc.details.tab.diffDiagnosis.title",
            new ResourceModel("tc.details.tab.differential-diagnosis.title.text")).setOutputMarkupId(true));
    tabsContainer.add(
            new Label("tc.details.tab.finding.title", new ResourceModel("tc.details.tab.finding.title.text"))
                    .setOutputMarkupId(true));
    tabsContainer.add(
            new Label("tc.details.tab.history.title", new ResourceModel("tc.details.tab.history.title.text"))
                    .setOutputMarkupId(true));
    tabsContainer.add(new Label("tc.details.tab.discussion.title",
            new ResourceModel("tc.details.tab.discussion.title.text")).setOutputMarkupId(true));
    tabsContainer.add(new Label("tc.details.tab.organsystem.title",
            new ResourceModel("tc.details.tab.organsystem.title.text")).setOutputMarkupId(true));
    tabsContainer
            .add(new Label("tc.details.tab.author.title", new ResourceModel("tc.details.tab.author.title.text"))
                    .setOutputMarkupId(true));
    tabsContainer.add(new Label("tc.details.tab.bibliography.title",
            new ResourceModel("tc.details.tab.bibliography.title.text")).setOutputMarkupId(true));
    tabsContainer.add(new Label("tc.details.tab.documents.title",
            new ResourceModel("tc.details.tab.documents.title.text")).setOutputMarkupId(true));
    tabsContainer
            .add(new Label("tc.details.tab.links.title", new ResourceModel("tc.details.tab.links.title.text"))
                    .setOutputMarkupId(true));
    tabsContainer.add(new Label("tc.details.tab.images.title", new Model<String>() {
        String title = new PackageStringResourceLoader().loadStringResource(TCDetailsPanel.class,
                "tc.details.tab.images.title.text", null, null);

        @Override
        public String getObject() {
            TCObject tc = getTCObject();
            int nImages = tc != null ? tc.getReferencedImages().size() : 0;
            StringBuffer sbuf = new StringBuffer(title);
            sbuf.append(" (");
            sbuf.append(nImages);
            sbuf.append(")");
            return sbuf.toString();
        }
    }).setOutputMarkupId(true));

    final TCAttributeVisibilityStrategy attrVisibilityStrategy = new TCAttributeVisibilityStrategy(
            trainingModeModel);

    tabsContainer.add(
            addTab(new TCDetailsInfoTab("details-overview", attrVisibilityStrategy)).setDefaultModel(tabModel));
    tabsContainer.add(addTab(new TCDetailsDiagnosisTab("details-diagnosis", attrVisibilityStrategy))
            .setDefaultModel(tabModel));
    tabsContainer.add(addTab(new TCDetailsDefaultTab("details-diffDiagnosis", attrVisibilityStrategy) {
        @Override
        public TCAttribute getAttribute() {
            return TCAttribute.DifferentialDiagnosis;
        }
    }).setDefaultModel(tabModel));
    tabsContainer.add(addTab(new TCDetailsDefaultTab("details-finding", attrVisibilityStrategy) {
        @Override
        public TCAttribute getAttribute() {
            return TCAttribute.Finding;
        }
    }).setDefaultModel(tabModel));
    tabsContainer.add(addTab(new TCDetailsDefaultTab("details-history", attrVisibilityStrategy) {
        @Override
        public TCAttribute getAttribute() {
            return TCAttribute.History;
        }
    }).setDefaultModel(tabModel));
    tabsContainer.add(addTab(new TCDetailsDefaultTab("details-discussion", attrVisibilityStrategy) {
        @Override
        public TCAttribute getAttribute() {
            return TCAttribute.Discussion;
        }

        @Override
        public boolean visible() {
            if (TCForumIntegration.get(WebCfgDelegate.getInstance().getTCForumIntegrationType()) == null) {
                return false;
            }
            return super.visible();
        }
    }).setDefaultModel(tabModel));
    tabsContainer.add(addTab(new TCDetailsDefaultTab("details-organSystem", attrVisibilityStrategy) {
        @Override
        public TCAttribute getAttribute() {
            return TCAttribute.OrganSystem;
        }
    }).setDefaultModel(tabModel));
    tabsContainer.add(
            addTab(new TCDetailsAuthorTab("details-author", attrVisibilityStrategy)).setDefaultModel(tabModel));
    tabsContainer.add(addTab(new TCDetailsBibliographyTab("details-bibliography", attrVisibilityStrategy))
            .setDefaultModel(tabModel));
    tabsContainer.add(addTab(new TCDetailsDocumentsTab("details-documents", attrVisibilityStrategy))
            .setDefaultModel(tabModel));
    tabsContainer.add(
            addTab(new TCDetailsLinksTab("details-links", attrVisibilityStrategy)).setDefaultModel(tabModel));
    tabsContainer.add(
            addTab(new TCDetailsImagesTab("details-images", attrVisibilityStrategy)).setDefaultModel(tabModel));

    nodetailsContainer = new WebMarkupContainer("no-details-panel");
    nodetailsContainer.setOutputMarkupId(true);

    errordetailsContainer = new WebMarkupContainer("error-details-panel");
    errordetailsContainer.setOutputMarkupId(true);

    detailsContainer = new WebMarkupContainer("details-info-panel");
    detailsContainer.setOutputMarkupId(true);
    detailsContainer.add(tabsContainer);

    nodetailsContainer.setVisible(true);
    errordetailsContainer.setVisible(false);
    detailsContainer.setVisible(false);

    add(nodetailsContainer);
    add(errordetailsContainer);
    add(detailsContainer);

    add(tabActivationBehavior = new AbstractDefaultAjaxBehavior() {
        public void respond(AjaxRequestTarget target) {
            try {
                String tabIndex = RequestCycle.get().getRequest().getParameter("tabIndex");
                if (tabIndex != null && !tabIndex.isEmpty()) {
                    activeTabIndex = Integer.valueOf(tabIndex);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    });

    add(new HeaderContributor(new IHeaderContributor() {
        public void renderHead(IHeaderResponse response) {
            StringBuilder js = new StringBuilder();
            js.append(getInitUIJavascript());
            js.append(getDisableTabsJavascript());
            js.append(getHideTabsJavascript());

            response.renderOnDomReadyJavascript(js.toString());
        }
    }));
}

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);
    }//from   ww w  .j  a  va  2 s .c om
    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);
    }/*  w  w w . ja va 2s . c  o  m*/
    return (s == null ? "DCM4CHEE" : s) + ": " + this.getString("application.login", null, "Login");
}