Example usage for org.apache.wicket Application get

List of usage examples for org.apache.wicket Application get

Introduction

In this page you can find the example usage for org.apache.wicket Application get.

Prototype

public static Application get() 

Source Link

Document

Get Application for current thread.

Usage

From source file:net.rrm.ehour.ui.login.page.Login.java

License:Open Source License

@Override
public void renderHead(IHeaderResponse response) {
    response.render(JavaScriptHeaderItem
            .forReference(Application.get().getJavaScriptLibrarySettings().getJQueryReference()));
    response.render(JavaScriptHeaderItem.forScript(
            "$(document).ready(function () { var user = $(\"#username\"); if (!user.val()) $(user).focus(); else $(\"#password\").focus(); });",
            "onready-master"));
}

From source file:net.rrm.ehour.ui.report.panel.criteria.quick.QuickRenderer.java

License:Open Source License

protected Localizer getLocalizer() {
    return Application.get().getResourceSettings().getLocalizer();
}

From source file:net.rrm.ehour.ui.timesheet.dto.TimesheetRow.java

License:Open Source License

/**
 * Get status/* w  w  w.j  a  va  2s  . c o  m*/
 * @return
 */
public String getStatus() {
    if (assignmentStatus != null && assignmentStatus.getAggregate() != null
            && assignmentStatus.getAggregate().getAvailableHours() != null
            && assignmentStatus.getAggregate().getAvailableHours().or(0f) < 0) {
        AvailableHours hours = new AvailableHours(
                (int) (getAssignmentStatus().getAggregate().getAvailableHours().or(0f) * -1));

        Localizer localizer = Application.get().getResourceSettings().getLocalizer();

        return localizer.getString("timesheet.errorNoHours", null, new Model<>(hours));
    }

    return "<br />";
}

From source file:nl.knaw.dans.common.wicket.components.buttons.CancelLink.java

License:Apache License

public CancelLink(String id) {
    super(id);
    this.alternativePage = Application.get().getHomePage();
}

From source file:nl.knaw.dans.common.wicket.exceptions.InternalWebError.java

License:Apache License

public InternalWebError() {
    super(Application.get().getApplicationSettings().getInternalErrorPage());
}

From source file:nl.knaw.dans.dccd.web.authn.LogoffLink.java

License:Apache License

@Override
public void onClick() {
    LOGGER.debug("Logoutlink is clicked");
    //EasySession session = (EasySession) getSession();
    DccdSession session = ((DccdSession) Session.get());
    session.setLoggedOff();/*from   w  w  w  .j a v  a  2 s  . c  o m*/
    setResponsePage(Application.get().getHomePage());
}

From source file:nl.openweb.hippo.umd.webservices.HippoAuthenticationRequestHandler.java

License:Apache License

public Response handleRequest(Message m, ClassResourceInfo resourceClass) {
    ISessionStore sessionStore = Application.get().getSessionStore();
    Serializable attribute = sessionStore.getAttribute(
            new ServletWebRequest((HttpServletRequest) m.get(AbstractHTTPDestination.HTTP_REQUEST), ""),
            "session");
    if (attribute instanceof PluginUserSession) {
        UserCredentials userCredentials = ((PluginUserSession) attribute).getUserCredentials();
        if (userCredentials != null) {
            SimpleCredentials jcrCredentials = (SimpleCredentials) userCredentials.getJcrCredentials();
            String username = jcrCredentials.getUserID();
            String password = new String(jcrCredentials.getPassword());
            try {
                session = JcrSessionUtil.createSession(username, password);
                if (isAuthenticated()) {
                    HttpServletRequest request = (HttpServletRequest) m
                            .get(AbstractHTTPDestination.HTTP_REQUEST);
                    request.setAttribute(AuthenticationConstants.HIPPO_SESSION, session);
                    return null;
                } else {
                    throw new UnauthorizedException();
                }//www. j a va  2  s .c  o  m
            } catch (LoginException e) {
                LOG.debug("Login failed: {}", e);
                throw new UnauthorizedException(e.getMessage());
            }
        }
    }
    throw new UnauthorizedException();
}

From source file:ontopoly.models.HelpLinkResourceModel.java

License:Apache License

@Override
public String getObject() {
    return RequestCycle.get().getRequest().getRelativePathPrefixToContextRoot() + "doc/" + Application.get()
            .getResourceSettings().getLocalizer().getString(resourceKey, (Component) null, (String) null);
}

From source file:ontopoly.OntopolyContext.java

License:Apache License

public static OntopolyRepository getOntopolyRepository() {
    OntopolyApplication app = (OntopolyApplication) Application.get();
    return app.getOntopolyRepository();
}

From source file:ontopoly.OntopolyContext.java

License:Apache License

public static TopicMap getTopicMap(String topicMapId) {
    OntopolyApplication app = (OntopolyApplication) Application.get();
    return app.getTopicMap(topicMapId);
}