@Override
  public void bind(final Component component) {
    super.bind(component);

    component.setOutputMarkupId(true);
    component.add(AttributeModifier.replace("rel", createRelAttribute()));
    component.add(AttributeModifier.replace("title", label));
  }
Exemplo n.º 2
0
 @Override
 public void bind(Component component) {
   if (!(component instanceof FormComponent)) {
     throw new IllegalArgumentException(
         "DefaultFocusBehavior: component must be instanceof FormComponent");
   }
   this.component = component;
   component.setOutputMarkupId(true);
 }
Exemplo n.º 3
0
  @Override
  public void renderHead(final Component component, final IHeaderResponse response) {
    super.renderHead(component, response);

    response.renderCSSReference(TAG_IT_CSS);
    response.renderJavaScriptReference(TAG_IT_JS);

    component.setOutputMarkupId(true);
    String id = component.getMarkupId();

    TextTemplate tagItConfig = getTagItConfig();

    Map<String, CharSequence> variables = new HashMap<String, CharSequence>();
    variables.put("componentId", id);
    variables.put("callbackUrl", getCallbackUrl());

    String script = tagItConfig.asString(variables);

    response.renderOnDomReadyJavaScript(script);
  }
        @Override
        public void renderHead(Component component, IHeaderResponse response) {
          component.setOutputMarkupId(true);

          StringBuilder sb = new StringBuilder();
          sb.append(
                  new JsStatement()
                      .$(component, ".form-group, .form-decorator-error-group")
                      .removeClass(HAS_ERROR_CSS_CLASS)
                      .render())
              .append(
                  new JsStatement()
                      .$(component, ".has-error")
                      .chain(
                          "parentsUntil",
                          JsUtils.quotes("#" + component.getMarkupId()),
                          JsUtils.quotes(".form-group, .form-decorator-error-group"))
                      .addClass(HAS_ERROR_CSS_CLASS)
                      .render())
              // Les .form-decorator-error-reminder doivent prendre une apparence particulière en
              // cas d'erreur,
              // mais sans impacter l'apparence des sous-éléments comme le ferait un .has-error
              .append(
                  new JsStatement()
                      .$(component, ".form-decorator-error-reminder")
                      .removeClass(HAS_ERROR_REMINDER_CSS_CLASS)
                      .render())
              .append(
                  new JsStatement()
                      .$(component, "." + HAS_ERROR_CSS_CLASS)
                      .chain(
                          "parentsUntil",
                          JsUtils.quotes("#" + component.getMarkupId()),
                          JsUtils.quotes(".form-decorator-error-reminder"))
                      .addClass(HAS_ERROR_REMINDER_CSS_CLASS)
                      .render());
          response.render(OnDomReadyHeaderItem.forScript(sb.toString()));
        }
Exemplo n.º 5
0
  @Override
  public void bind(final Component component) {
    super.bind(component);
    this.component = component;
    this.component.setOutputMarkupId(true);
    if (addTitle && !isAjax())
      component.add(
          new AttributeModifier("title", true, new Model<String>(title + "::" + content)));
    if (isAjax()) {
      this.component.add(new MootipAjaxListener(panel));
      component.add(
          new AttributeModifier(
              "title",
              true,
              new Model<String>("CALLBACK:mootipAjax" + getEscapedComponentMarkupId() + "()")));
    }

    component.add(
        new AttributeModifier(
            "class", true, new Model<String>("toolTipImg" + getEscapedComponentMarkupId())));

    component.setOutputMarkupId(true);
  }
 public InfiniteScrollingBehavior setItemSelector(Component component, String selector) {
   component.setOutputMarkupId(true);
   itemSelector = "#" + component.getMarkupId() + " " + selector;
   return this;
 }
 public InfiniteScrollingBehavior setNavSelector(Component component) {
   component.setOutputMarkupId(true);
   navSelector = component.getMarkupId();
   return this;
 }
  @Override
  public void bind(Component component) {
    super.bind(component);

    component.setOutputMarkupId(true);
  }
 @Override
 public void bind(Component component) {
   this.component = component;
   component.setOutputMarkupId(true);
 }
Exemplo n.º 10
0
 /** @see org.apache.wicket.behavior.AbstractBehavior#bind(org.apache.wicket.Component) */
 public void bind(Component component) {
   checkComponentProvidesDateFormat(component);
   component.setOutputMarkupId(true);
   this.component = component;
 }
Exemplo n.º 11
0
  @Override
  protected void writeComponent(
      Response response, String markupId, Component component, String encoding) {
    if (component.getRenderBodyOnly() == true) {
      throw new IllegalStateException(
          "A partial update is not possible for a component that has renderBodyOnly enabled. Component: "
              + component.toString());
    }

    component.setOutputMarkupId(true);

    // Initialize temporary variables
    final Page page = component.findParent(Page.class);
    if (page == null) {
      // dont throw an exception but just ignore this component, somehow
      // it got removed from the page.
      LOG.warn(
          "Component '{}' with markupid: '{}' not rendered because it was already removed from page",
          component,
          markupId);
      return;
    }

    // substitute our encoding response for the old one so we can capture
    // component's markup in a manner safe for transport inside CDATA block
    Response oldResponse = RequestCycle.get().setResponse(bodyBuffer);

    try {
      bodyBuffer.reset();

      page.startComponentRender(component);

      try {
        component.prepareForRender();

        // render any associated headers of the component
        writeHeaderContribution(response, component);
      } catch (RuntimeException e) {
        try {
          component.afterRender();
        } catch (RuntimeException e2) {
          // ignore this one could be a result off.
        }
        bodyBuffer.reset();
        throw e;
      }

      try {
        component.render();
      } catch (RuntimeException e) {
        bodyBuffer.reset();
        throw e;
      }

      page.endComponentRender(component);
    } finally {
      // Restore original response
      RequestCycle.get().setResponse(oldResponse);
    }

    response.write("<component id=\"");
    response.write(markupId);
    response.write("\" ><![CDATA[");
    response.write(encode(bodyBuffer.getContents()));
    response.write("]]></component>");

    bodyBuffer.reset();
  }