Search in sources :

Example 6 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project ocvn by devgateway.

the class BasePage method newHomeMenu.

protected NavbarButton<Homepage> newHomeMenu() {
    // home
    NavbarButton<Homepage> homeMenu = new NavbarButton<>(Homepage.class, this.getPageParameters(), new ResourceModel("home"));
    homeMenu.setIconType(GlyphIconType.home);
    MetaDataRoleAuthorizationStrategy.authorize(homeMenu, Component.RENDER, SecurityConstants.Roles.ROLE_USER);
    return homeMenu;
}
Also used : NavbarButton(de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarButton) ResourceModel(org.apache.wicket.model.ResourceModel) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 7 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project oc-explorer by devgateway.

the class BasePage method newHomeMenu.

protected NavbarButton<Homepage> newHomeMenu() {
    // home
    NavbarButton<Homepage> homeMenu = new NavbarButton<>(Homepage.class, this.getPageParameters(), new ResourceModel("home"));
    homeMenu.setIconType(GlyphIconType.home);
    MetaDataRoleAuthorizationStrategy.authorize(homeMenu, Component.RENDER, SecurityConstants.Roles.ROLE_USER);
    return homeMenu;
}
Also used : NavbarButton(de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarButton) ResourceModel(org.apache.wicket.model.ResourceModel) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Example 8 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project webanno by webanno.

the class ApplicationPageBase method commonInit.

private void commonInit() {
    Properties settings = SettingsUtil.getSettings();
    // Override locale to be used by application
    String locale = settings.getProperty(SettingsUtil.CFG_LOCALE, "en");
    switch(locale) {
        case "auto":
            // Do nothing - locale is picked up from browser
            break;
        default:
            // Override the locale in the session
            getSession().setLocale(Locale.forLanguageTag(locale));
            break;
    }
    // Add menubar
    try {
        Class<? extends Component> menubarClass = getApplication().getMetaData(MENUBAR_CLASS);
        if (menubarClass == null) {
            menubarClass = MenuBar.class;
        }
        add(ConstructorUtils.invokeConstructor(menubarClass, "menubar"));
    } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e1) {
        throw new RuntimeException(e1);
    }
    feedbackPanel = new BootstrapFeedbackPanel("feedbackPanel");
    feedbackPanel.setOutputMarkupId(true);
    feedbackPanel.setFilter((IFeedbackMessageFilter) aMessage -> {
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        String username = auth != null ? auth.getName() : "SYSTEM";
        if (aMessage.isFatal()) {
            LOG.error("{}: {}", username, aMessage.getMessage());
        } else if (aMessage.isError()) {
            LOG.error("{}: {}", username, aMessage.getMessage());
        } else if (aMessage.isWarning()) {
            LOG.warn("{}: {}", username, aMessage.getMessage());
        } else if (aMessage.isInfo()) {
            LOG.info("{}: {}", username, aMessage.getMessage());
        } else if (aMessage.isDebug()) {
            LOG.debug("{}: {}", username, aMessage.getMessage());
        }
        return true;
    });
    add(feedbackPanel);
    versionLabel = new Label("version", SettingsUtil.getVersionString());
    add(versionLabel);
    // set up warnings shown when using an embedded DB or some unsupported browser
    boolean isBrowserWarningVisible = isBrowserWarningVisible(settings);
    boolean isDatabaseWarningVisible = isDatabaseWarningVisible(settings);
    embeddedDbWarning = new Label("embeddedDbWarning", new ResourceModel("warning.database"));
    embeddedDbWarning.setVisible(isDatabaseWarningVisible);
    add(embeddedDbWarning);
    browserWarning = new Label("browserWarning", new ResourceModel("warning.browser"));
    browserWarning.setVisible(isBrowserWarningVisible);
    add(browserWarning);
    WebMarkupContainer warningsContainer = new WebMarkupContainer("warnings");
    warningsContainer.setVisible(isBrowserWarningVisible || isDatabaseWarningVisible);
    add(warningsContainer);
}
Also used : RuntimeConfigurationType(org.apache.wicket.RuntimeConfigurationType) SettingsUtil(de.tudarmstadt.ukp.clarin.webanno.support.SettingsUtil) SpringBean(org.apache.wicket.spring.injection.annot.SpringBean) LoggerFactory(org.slf4j.LoggerFactory) IFeedbackMessageFilter(org.apache.wicket.feedback.IFeedbackMessageFilter) StringUtils(org.apache.commons.lang3.StringUtils) RequestCycle(org.apache.wicket.request.cycle.RequestCycle) DatabaseDriverService(de.tudarmstadt.ukp.clarin.webanno.support.db.DatabaseDriverService) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) Locale(java.util.Locale) FeedbackPanel(org.apache.wicket.markup.html.panel.FeedbackPanel) NoOpResourceCachingStrategy(org.apache.wicket.request.resource.caching.NoOpResourceCachingStrategy) BootstrapFeedbackPanel(de.tudarmstadt.ukp.clarin.webanno.support.bootstrap.BootstrapFeedbackPanel) ClientProperties(org.apache.wicket.protocol.http.ClientProperties) SecurityContextHolder(org.springframework.security.core.context.SecurityContextHolder) Label(org.apache.wicket.markup.html.basic.Label) Properties(java.util.Properties) Logger(org.slf4j.Logger) Component(org.apache.wicket.Component) WebClientInfo(org.apache.wicket.protocol.http.request.WebClientInfo) WebSession(org.apache.wicket.protocol.http.WebSession) InvocationTargetException(java.lang.reflect.InvocationTargetException) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Session(org.apache.wicket.Session) MetaDataKey(org.apache.wicket.MetaDataKey) ConstructorUtils(org.apache.commons.lang3.reflect.ConstructorUtils) WebPage(org.apache.wicket.markup.html.WebPage) ResourceModel(org.apache.wicket.model.ResourceModel) Authentication(org.springframework.security.core.Authentication) Label(org.apache.wicket.markup.html.basic.Label) ClientProperties(org.apache.wicket.protocol.http.ClientProperties) Properties(java.util.Properties) BootstrapFeedbackPanel(de.tudarmstadt.ukp.clarin.webanno.support.bootstrap.BootstrapFeedbackPanel) InvocationTargetException(java.lang.reflect.InvocationTargetException) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) Authentication(org.springframework.security.core.Authentication) ResourceModel(org.apache.wicket.model.ResourceModel)

Example 9 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project ocvn by devgateway.

the class ListViewSectionPanel method getAddNewChildButton.

/**
 * Returns the new child button
 *
 * @return
 */
protected BootstrapAddButton getAddNewChildButton() {
    BootstrapAddButton newButton = new BootstrapAddButton("newButton", new ResourceModel("newButton")) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            @SuppressWarnings("unchecked") T newChild = createNewChild((IModel<PARENT>) ListViewSectionPanel.this.getParent().getDefaultModel());
            ListViewSectionPanel.this.getModel().getObject().add(newChild);
            listView.removeAll();
            target.add(listWrapper);
        }
    };
    newButton.setOutputMarkupPlaceholderTag(true);
    return newButton;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) BootstrapAddButton(org.devgateway.toolkit.forms.wicket.components.form.BootstrapAddButton) Form(org.apache.wicket.markup.html.form.Form) ResourceModel(org.apache.wicket.model.ResourceModel)

Example 10 with ResourceModel

use of org.apache.wicket.model.ResourceModel in project syncope by apache.

the class Policies method buildTabList.

private List<ITab> buildTabList() {
    final List<ITab> tabs = new ArrayList<>();
    tabs.add(new AbstractTab(new ResourceModel("policy.account")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new AccountPolicyDirectoryPanel(panelId, getPageReference());
        }
    });
    tabs.add(new AbstractTab(new ResourceModel("policy.password")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new PasswordPolicyDirectoryPanel(panelId, getPageReference());
        }
    });
    tabs.add(new AbstractTab(new ResourceModel("policy.pull")) {

        private static final long serialVersionUID = -6815067322125799251L;

        @Override
        public Panel getPanel(final String panelId) {
            return new PullPolicyDirectoryPanel(panelId, getPageReference());
        }
    });
    return tabs;
}
Also used : AccountPolicyDirectoryPanel(org.apache.syncope.client.console.policies.AccountPolicyDirectoryPanel) PasswordPolicyDirectoryPanel(org.apache.syncope.client.console.policies.PasswordPolicyDirectoryPanel) AjaxBootstrapTabbedPanel(de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel) Panel(org.apache.wicket.markup.html.panel.Panel) PullPolicyDirectoryPanel(org.apache.syncope.client.console.policies.PullPolicyDirectoryPanel) AccountPolicyDirectoryPanel(org.apache.syncope.client.console.policies.AccountPolicyDirectoryPanel) ArrayList(java.util.ArrayList) PasswordPolicyDirectoryPanel(org.apache.syncope.client.console.policies.PasswordPolicyDirectoryPanel) AbstractTab(org.apache.wicket.extensions.markup.html.tabs.AbstractTab) ResourceModel(org.apache.wicket.model.ResourceModel) ITab(org.apache.wicket.extensions.markup.html.tabs.ITab) PullPolicyDirectoryPanel(org.apache.syncope.client.console.policies.PullPolicyDirectoryPanel)

Aggregations

ResourceModel (org.apache.wicket.model.ResourceModel)48 ArrayList (java.util.ArrayList)20 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)19 Label (org.apache.wicket.markup.html.basic.Label)17 StringResourceModel (org.apache.wicket.model.StringResourceModel)15 Panel (org.apache.wicket.markup.html.panel.Panel)11 List (java.util.List)9 AbstractTab (org.apache.wicket.extensions.markup.html.tabs.AbstractTab)9 AjaxBootstrapTabbedPanel (de.agilecoders.wicket.core.markup.html.bootstrap.tabs.AjaxBootstrapTabbedPanel)8 ITab (org.apache.wicket.extensions.markup.html.tabs.ITab)8 WebMarkupContainer (org.apache.wicket.markup.html.WebMarkupContainer)8 IColumn (org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn)6 VisibleEnableBehaviour (com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour)5 Form (org.apache.wicket.markup.html.form.Form)5 Serializable (java.io.Serializable)4 HashMap (java.util.HashMap)4 WizardMgtPanel (org.apache.syncope.client.console.wizards.WizardMgtPanel)4 Fragment (org.apache.wicket.markup.html.panel.Fragment)4 NavbarButton (de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarButton)3 StringUtils (org.apache.commons.lang3.StringUtils)3