Example usage for org.apache.wicket MarkupContainer getApplication

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

Introduction

In this page you can find the example usage for org.apache.wicket MarkupContainer 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.olegchir.flussonic_userlinks.wicket.IncludeResolver.IncludeResolver.java

License:Apache License

/**
 * Handles resolving the wicket:include tag. If a filename is specified this
 * file will be looked up. If a key is specified it's value is looked up
 * using the resource mechanism. The looked up value will then be used as
 * filename.//from   w ww  .j  a v a 2s  .com
 *
 */
public Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) {

    if ((tag instanceof WicketTag) && tagname.equalsIgnoreCase(tag.getName())) {
        WicketTag wtag = (WicketTag) tag;

        String fileName = StringUtils.trimToNull(wtag.getAttribute("file"));
        String fileKey = StringUtils.trimToNull(wtag.getAttribute("key"));

        if (null != fileKey) {
            if (null != fileName) {
                throw new MarkupException("Wrong format of: you must not use file and key attribtue at once");
            }
            fileName = StringUtils.trimToNull(container.getString(fileKey));
            if (null == fileName) {
                throw new MarkupException("The key inside could not be resolved");
            }

        } else if (null == fileName) {
            throw new MarkupException("Wrong format of: specify the file or key attribute");
        }

        final String id = "_" + tagname + "_" + container.getPage().getAutoIndex();
        IncludeContainer ic = new IncludeContainer(id, fileName, fileKey, markupStream);
        ic.setRenderBodyOnly(container.getApplication().getMarkupSettings().getStripWicketTags());
        //            container.autoAdd(ic, markupStream);

        return ic;

    }
    return null;
}

From source file:org.apache.openmeetings.web.app.MessageResolver.java

License:Apache License

@Override
public Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) {
    if (tag instanceof WicketTag) {
        WicketTag wtag = (WicketTag) tag;
        if (TAG_NAME.equals(wtag.getName())) {
            Long messageKey = wtag.getAttributes().getAsLong("key");
            if (messageKey != null) {
                final String id = "_message_" + container.getPage().getAutoIndex();
                Label label = new Label(id, WebSession.getString(messageKey));
                label.setRenderBodyOnly(container.getApplication().getMarkupSettings().getStripWicketTags());

                return label;
            }// w  ww.j  a v  a  2  s  . c o  m
        }
    }
    return super.resolve(container, markupStream, tag);
}

From source file:wicket.contrib.groovy.builder.WicketBuilder.java

License:Apache License

public WicketBuilder(MarkupContainer context) {
    this.context = context;
    setCurrent(context);//w ww  .ja va  2 s .c  o m

    try {
        developmentMode = context.getApplication().getConfigurationType().equals(Application.DEVELOPMENT);
    } catch (Exception e) {
        //Not a problem.
    }
}