Examples of AttributeAppender


Examples of org.apache.wicket.behavior.AttributeAppender

            super(buttonId, new ResourceModel("button.delete"), Buttons.Type.Danger);
            setIconType(GlyphIconType.trash);
            setDefaultFormProcessing(false);
            setVisible(getDeleteButtonVisibility());

            add(new AttributeAppender("onclick", format("return confirmMessage('%s')", confirmMessage)));
        }
View Full Code Here

Examples of org.apache.wicket.behavior.AttributeAppender

    public void applyCss(Object bean, MetaData metaData, Component applyToComponent)
    {
        String css = metaData.getParameter(PARAM_CSS);

        if (!Strings.isEmpty(css)) {
            applyToComponent.add(new AttributeAppender("class", new Model<String>(css), " "));
        }

        String dynamicCssMethod = metaData.getParameter(PARAM_DYNAMIC_CSS);
        if (!Strings.isEmpty(dynamicCssMethod)) {
            Method method = null;
            String cssReturn = null;
            try {
                method = component.getClass().getMethod(dynamicCssMethod,
                                new Class[] { beanClass, metaData.getClass() });
            }
            catch (NoSuchMethodException ex) {
                throw new RuntimeException("dynamicCss method " + dynamicCssMethod + "(" + beanClass.getName() + ", "
                                + metaData.getClass().getName() + ") is not defined in " + component.getClass());
            }
            catch (SecurityException ex) {
                throw new RuntimeException("securty exception accessing dynamicCss method " + dynamicCssMethod + "("
                                + beanClass.getName() + ", " + metaData.getClass().getName() + ") in "
                                + component.getClass(), ex);
            }
            if (bean instanceof IModel) {
                bean = ((IModel)bean).getObject();
            }
            try {
                cssReturn = (String)method.invoke(component, new Object[] { bean, metaData });
            }
            catch (IllegalAccessException ex) {
                throw new RuntimeException("access to dynamicCss method " + dynamicCssMethod + "("
                                + beanClass.getName() + ", " + metaData.getClass().getName() + ") in "
                                + component.getClass() + " is not allowed");
            }
            catch (IllegalArgumentException ex) {
                throw new RuntimeException("illegal arguments for dynamicCss method " + dynamicCssMethod + "("
                                + beanClass.getName() + ", " + metaData.getClass().getName() + ") in "
                                + component.getClass());
            }
            catch (InvocationTargetException ex) {
                throw new RuntimeException("invocation to dynamicCss method " + dynamicCssMethod + "("
                                + beanClass.getName() + ", " + metaData.getClass().getName() + ") in "
                                + component.getClass() + " has thrown an exception", ex);
            }
            if (!Strings.isEmpty(cssReturn)) {
                applyToComponent.add(new AttributeAppender("class", new Model<String>(cssReturn), " "));
            }
        }
    }
View Full Code Here

Examples of org.apache.wicket.behavior.AttributeAppender

        else {
            component = new ImageLabel(wicketId, getBeanMetaData().getComponent().getClass(), getLabelImage(), getLabel());
        }
       
        if (isRequired()) {
            component.add( new AttributeAppender("class", new Model<String>(CSS_REQUIRED_FIELD_CLASS), " ") );
        }
       
        return component;
    }
View Full Code Here

Examples of org.apache.wicket.behavior.AttributeAppender

   */
  public static AttributeAppender append(String attributeName, IModel<?> value)
  {
    Args.notEmpty(attributeName, "attributeName");

    return new AttributeAppender(attributeName, value).setSeparator(" ");
  }
View Full Code Here

Examples of org.apache.wicket.behavior.AttributeAppender

   */
  public static AttributeAppender prepend(String attributeName, IModel<?> value)
  {
    Args.notEmpty(attributeName, "attributeName");

    return new AttributeAppender(attributeName, value)
    {
      private static final long serialVersionUID = 1L;

      @Override
      protected String newValue(String currentValue, String replacementValue)
View Full Code Here

Examples of org.apache.wicket.behavior.AttributeAppender

    private GotItButton(String id) {
      super(id);
      add(new Icon("icon", "img/icons/response_positive.png", getAltText()));
      if (isMarkedCorrect())
        add(new AttributeAppender("class", new Model<String>("current"), " "));
    }
View Full Code Here

Examples of org.apache.wicket.behavior.AttributeAppender

    private NotGotItButton(String id) {
      super(id);
      add(new Icon("icon", "img/icons/response_negative.png", getAltText()));
      if (isMarkedIncorrect())
        add(new AttributeAppender("class", new Model<String>("current"), " "));
    }
View Full Code Here

Examples of org.apache.wicket.behavior.AttributeAppender

  private static final long serialVersionUID = 1L;

  public MyForm(String id) {
    super(id);
    add(new AttributeAppender("onsubmit", true, new Model<String>("return validateMyForm()"), ";"));
    add(new AjaxFormSubmitBehavior(this, "onclick") {

      private static final long serialVersionUID = 1L;

      @Override
View Full Code Here

Examples of org.apache.wicket.behavior.AttributeAppender

  public MyForm(String id) {
    super(id);
    add(CSSPackageResource.getHeaderContribution(MyForm.class, MyForm.class.getSimpleName() + ".css"));
    add(JavascriptPackageResource.getHeaderContribution(MyForm.class, MyForm.class.getSimpleName() + ".js"));
    add(new AttributeAppender("onsubmit", true, new Model<String>("return validateMyForm()"), ";"));
    add(new AjaxFormSubmitBehavior(this, "onclick") {

      private static final long serialVersionUID = 1L;

      @Override
View Full Code Here

Examples of org.apache.wicket.behavior.AttributeAppender

    protected abstract void addFormComponentBehavior(Behavior behavior);

    private void addCssForMetaModel() {
        final String cssForMetaModel = getModel().getLongName();
        if (cssForMetaModel != null) {
            add(new AttributeAppender("class", Model.of(cssForMetaModel), " "));
        }

        ScalarModel model = getModel();
        final CssClassFacet facet = model.getFacet(CssClassFacet.class);
        if(facet != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.