Example usage for org.apache.wicket Component getApplication

List of usage examples for org.apache.wicket Component getApplication

Introduction

In this page you can find the example usage for org.apache.wicket Component getApplication.

Prototype

public final Application getApplication() 

Source Link

Document

Gets interface to application that this component is a part of.

Usage

From source file:com.comcast.cdn.traffic_control.traffic_monitor.wicket.behaviors.AbstractMultiAjaxBehavior.java

License:Apache License

/**
 * @see org.apache.wicket.behavior.AbstractAjaxBehavior#renderHead(Component,
 *      org.apache.wicket.markup.head.IHeaderResponse)
 *//*from  ww  w .  j a  va  2s .c o  m*/
@Override
public void renderHead(final Component component, final IHeaderResponse response) {
    super.renderHead(component, response);

    CoreLibrariesContributor.contributeAjax(component.getApplication(), response);

    final RequestCycle requestCycle = component.getRequestCycle();
    final Url baseUrl = requestCycle.getUrlRenderer().getBaseUrl();
    final CharSequence ajaxBaseUrl = Strings.escapeMarkup(baseUrl.toString());
    response.render(JavaScriptHeaderItem.forScript("Wicket.Ajax.baseUrl=\"" + ajaxBaseUrl + "\";",
            "wicket-ajax-base-url"));

    renderExtraHeaderContributors(component, response);
}

From source file:com.evolveum.midpoint.gui.api.util.WebComponentUtil.java

License:Apache License

public static PrismContext getPrismContext(Component component) {
    return ((MidPointApplication) component.getApplication()).getPrismContext();
}

From source file:com.userweave.pages.components.twoColumnPanel.multiColumnRadioChoicePanel.RadioChoiceColumnPanel.java

License:Open Source License

public static String getLabel(Component component, IModel model, IChoiceRenderer renderer) {
    Object objectValue = renderer.getDisplayValue(model.getObject());
    Class objectClass = objectValue.getClass();
    String displayValue = "";
    if (objectClass != null && objectClass != String.class) {
        displayValue = component.getApplication().getConverterLocator().getConverter(objectClass)
                .convertToString(objectValue, component.getLocale());

        //convertToString(objectValue, component.getLocale());
    } else if (objectValue != null) {
        displayValue = objectValue.toString();
    }//from  ww  w. j av a 2  s.  co m
    return displayValue;
}

From source file:gr.abiss.calipso.wicket.ComponentUtils.java

License:Open Source License

public static CalipsoService getCalipso(Component c) {
    return ((CalipsoApplication) c.getApplication()).getCalipso();
}

From source file:info.jtrac.wicket.ComponentUtils.java

License:Apache License

public static Jtrac getJtrac(Component c) {
    return ((JtracApplication) c.getApplication()).getJtrac();
}

From source file:org.bosik.diacomp.web.frontend.wicket.pages.master.MasterPage.java

License:Open Source License

private static ClientProperties getClientProperties(Component component) {
    IRequestCycleSettings requestCycleSettings = component.getApplication().getRequestCycleSettings();
    boolean gatherExtendedBrowserInfo = requestCycleSettings.getGatherExtendedBrowserInfo();
    ClientProperties properties = null;//  w w  w . ja  va2s.  co m
    try {
        requestCycleSettings.setGatherExtendedBrowserInfo(false);
        WebClientInfo clientInfo = (WebClientInfo) component.getSession().getClientInfo();
        properties = clientInfo.getProperties();
    } finally {
        requestCycleSettings.setGatherExtendedBrowserInfo(gatherExtendedBrowserInfo);
    }
    return properties;
}

From source file:org.modelibra.wicket.util.LocalizedText.java

License:Apache License

/**
 * Obtains the localized domain name./*  ww  w  .  j  av  a2  s  . c o m*/
 * 
 * @param comp
 *            the component requesting the description
 * @return the domain name
 */
public static String getDomainName(Component comp) {
    DomainApp app = (DomainApp) comp.getApplication();
    String domainKey = app.getDomain().getDomainConfig().getCode();

    return LocalizedText.getApplicationPropertiesText(comp, domainKey);
}

From source file:org.modelibra.wicket.util.LocalizedText.java

License:Apache License

/**
 * Obtains the localized domain title.//from  ww w.  j  a  va2  s .c  om
 * 
 * @param comp
 *            the component requesting the name
 * @return the domain title
 */
public static String getDomainTitle(Component comp) {
    DomainApp app = (DomainApp) comp.getApplication();
    String domainCode = app.getDomain().getDomainConfig().getCode();
    String domainTitleKey = domainCode + ".title";

    return LocalizedText.getApplicationPropertiesText(comp, domainTitleKey);
}

From source file:org.wicketstuff.gchart.GoogleChartBehavior.java

License:Apache License

@Override
public void renderHead(Component component, IHeaderResponse response) {
    super.renderHead(component, response);
    // TODO ist this rendering sufficient for refreshing chart by AJAX?
    response.render(JavaScriptHeaderItem
            .forReference(component.getApplication().getJavaScriptLibrarySettings().getJQueryReference()));
    response.render(JavaScriptHeaderItem.forUrl(LOADER_URL));
    response.render(JavaScriptHeaderItem.forScript(chart.toJavaScript(), chart.getScriptId()));
    if (chart.isResponsive()) {
        response.render(/*from www  . j av a 2 s  . c o m*/
                JavaScriptHeaderItem.forScript(chart.createRedrawJavaScript(), chart.getRedrawScriptId()));
    }
}

From source file:org.wicketstuff.objectautocomplete.ObjectAutoCompleteBehavior.java

License:Apache License

private void abstractDefaultAjaxBehaviour_renderHead(Component component, IHeaderResponse response) {
    CoreLibrariesContributor.contributeAjax(component.getApplication(), response);
}