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

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

Introduction

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

Prototype

public final IValueMap getAttributes() 

Source Link

Usage

From source file:ar.com.zauber.commons.wicket.components.ConfirmLink.java

License:Apache License

/** @see Link#onComponentTag(ComponentTag) */
@Override//from   w w  w  .  ja v  a  2  s. c  o m
protected final void onComponentTag(final ComponentTag tag) {
    super.onComponentTag(tag);

    String onclick = (String) tag.getAttributes().get("onclick");
    onclick = "if (!confirm('" + confirmMessage + "')) return false; " + onclick;
    tag.getAttributes().put("onclick", onclick);

}

From source file:brix.codepress.CodePressEnabler.java

License:Apache License

@Override
public void onComponentTag(Component component, ComponentTag tag) {
    String clazz = (String) tag.getAttributes().get("class");
    clazz = (clazz == null) ? "" : clazz + " ";
    clazz += "codepress ";
    clazz += language;//from  w  ww .  j a  va 2  s  . c o m
    clazz += " linenumbers-";
    clazz += (lineNumbers) ? "on" : "off";
    tag.put("class", clazz);
}

From source file:com.conwax.ajax.SimpleAjaxEventBehavior.java

License:Apache License

@Override
protected void onComponentTag(ComponentTag tag) {
    if (tag.getType() != TagType.CLOSE) {
        final IValueMap attributes = tag.getAttributes();
        attributes.put(DATA_AJAX_URL, getCallbackUrl());
    }/*w  w  w  . j  a v  a2  s  .c  o  m*/
}

From source file:com.gitblit.wicket.panels.ObjectContainer.java

License:Apache License

@Override
public void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);

    // get the attributes from the html-source
    IValueMap attributeMap = tag.getAttributes();

    // set the content type
    String contentType = getContentType();
    if (contentType != null && !"".equals(contentType))
        attributeMap.put(ATTRIBUTE_CONTENTTYPE, contentType);

    // set clsid and codebase for IE
    if (getClientProperties().isBrowserInternetExplorer()) {
        String clsid = getClsid();
        String codeBase = getCodebase();

        if (clsid != null && !"".equals(clsid))
            attributeMap.put(ATTRIBUTE_CLASSID, clsid);
        if (codeBase != null && !"".equals(codeBase))
            attributeMap.put(ATTRIBUTE_CODEBASE, codeBase);
    }/*www  .  ja  v a 2s  .c o  m*/

    // add all attributes
    for (String name : getAttributeNames()) {
        String value = getValue(name);
        if (value != null)
            attributeMap.put(name, value);
    }
}

From source file:com.gitblit.wicket.panels.ShockWaveComponent.java

License:Apache License

@Override
public void onComponentTag(ComponentTag tag) {
    // get options from the markup
    IValueMap valueMap = tag.getAttributes();

    // Iterate over valid options
    for (String s : optionNames) {
        if (valueMap.containsKey(s)) {
            // if option isn't set programmatically, set value from markup
            if (!attributes.containsKey(s) && !parameters.containsKey(s))
                setValue(s, valueMap.getString(s));
            // remove attribute - they are added in super.onComponentTag()
            // to
            // the right place as attribute or param
            valueMap.remove(s);/*from   www  . jav  a  2 s  . co m*/
        }
    }

    super.onComponentTag(tag);
}

From source file:com.googlecode.ounit.QuizStateAttributeModifier.java

License:Open Source License

@Override
public void onComponentTag(Component component, ComponentTag tag) {
    if (!isEnabled(component))
        return;// w w  w. j a  v  a2  s . c  o m

    // FIXME: This shouldn't happen ....
    if (model == null || model.getObject() == null)
        return;

    String value = (model.getObject().isClosed()) ? closedValue : openValue;

    if (value == null)
        tag.getAttributes().remove(attribute);
    else
        tag.getAttributes().put(attribute, value);
}

From source file:com.senacor.wbs.web.border.ContentLayout.java

License:Apache License

@Override
protected void onComponentTag(ComponentTag tag) {
    super.onComponentTag(tag);
    // Muss ein DIV-Container sein
    checkComponentTag(tag, "div");
    // Start YAML SubTemplate
    tag.getAttributes().put("class", "subcolumns");
}

From source file:com.senacor.wbs.web.core.form.MarkAsRequiredIndicator.java

License:Apache License

@Override
public void onComponentTag(Component component, ComponentTag tag) {
    super.onComponentTag(component, tag);
    if (component instanceof FormComponent) {
        if (((FormComponent) component).isRequired()) {
            String color = "#fffacd";
            tag.getAttributes().put("style", "background-color:" + color);
        }/*from   w  w w.  ja va 2  s  .c o m*/
    }
}

From source file:com.senacor.wbs.web.core.layout.menu.TopLevelMenuItem.java

License:Apache License

public TopLevelMenuItem(IModel<String> title, final Class<T> pageClass) {
    super("topLevelMenuItem");
    Link<T> pageLink = new BookmarkablePageLink<T>("link", pageClass) {
        @Override/* w w w.  j  a  v a 2s.c o m*/
        protected void onComponentTag(ComponentTag tag) {
            super.onComponentTag(tag);
            if ("span".equals(tag.getName())) {
                tag.setName("div");
                tag.getAttributes().put("class", "menuItemLink");
            }
        }
    };
    pageLink.add(CSSPackageResource.getHeaderContribution(this.getClass(), "TopLevelMenuItem.css"));
    pageLink.add(new Label("title", title));
    add(pageLink);
    setSecurityCheck(new LinkSecurityCheck(this, pageClass));
}

From source file:com.servoy.j2db.server.headlessclient.dataui.ReadOnlyAndEnableTestAttributeModifier.java

License:Open Source License

/**
 * @see org.apache.wicket.behavior.AbstractBehavior#onComponentTag(org.apache.wicket.Component,
 *      org.apache.wicket.markup.ComponentTag)
 *//*from   w w  w  .  j a va2 s .co m*/
@Override
public void onComponentTag(final Component component, final ComponentTag tag) {
    if (isEnabled(component)) {
        tag.getAttributes().put(attribute, model.getObject());
    }
}