Example usage for org.apache.wicket.markup WicketTag getAttributes

List of usage examples for org.apache.wicket.markup WicketTag getAttributes

Introduction

In this page you can find the example usage for org.apache.wicket.markup WicketTag getAttributes.

Prototype

public final IValueMap getAttributes() 

Source Link

Usage

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;
            }/*from   w w w .j a  v  a 2s.  c  om*/
        }
    }
    return super.resolve(container, markupStream, tag);
}

From source file:org.wicketstuff.jeeweb.JEEWebResolver.java

License:Apache License

@Override
public Component resolve(MarkupContainer container, MarkupStream markupStream, ComponentTag tag) {
    if (tag instanceof WicketTag) {
        WicketTag wtag = (WicketTag) tag;
        if ("jsp".equalsIgnoreCase(wtag.getName())) {
            String file = wtag.getAttributes().getString("file");
            if (file == null || file.trim().length() == 0) {
                throw new MarkupException(
                        "Wrong format of <wicket:jsp file='/foo.jsp'>: attribute 'file' is missing");
            }//from w w  w  .  j  a  v a2 s.  co m
            return new ServletAndJspFileContainer(file, Type.JSP);
        } else if ("jsf".equalsIgnoreCase(wtag.getName())) {
            String file = wtag.getAttributes().getString("file");
            if (file == null || file.trim().length() == 0) {
                throw new MarkupException(
                        "Wrong format of <wicket:jsf file='/foo.xhtml'>: attribute 'file' is missing");
            }
            return new ServletAndJspFileContainer(file, Type.JSF);
        } else if ("servlet".equalsIgnoreCase(wtag.getName())) {
            String path = wtag.getAttributes().getString("path");
            if (path == null || path.trim().length() == 0) {
                throw new MarkupException(
                        "Wrong format of <wicket:servlet path='/Test'>: attribute 'path' is missing");
            }
            return new ServletAndJspFileContainer(path, Type.SERVLET);
        }
    }
    return null;
}