@Override
  public void onConfigure(JQueryBehavior behavior) {
    super.onConfigure(behavior);

    StringBuilder statements = new StringBuilder();

    statements
        .append("jQuery('#")
        .append(this.lower.getMarkupId())
        .append("').val(ui.values[0]); ");
    statements
        .append("jQuery('#")
        .append(this.upper.getMarkupId())
        .append("').val(ui.values[1]); ");

    if (!Strings.isEmpty(super.labelId)) {
      statements
          .append("jQuery('#")
          .append(super.labelId)
          .append("').text(")
          .append(this.getLabelPattern())
          .append("); ");
    }

    behavior.setOption("slide", String.format("function(event, ui) { %s }", statements));
    behavior.setOption("values", this.getModelObject());
  }
Exemple #2
0
  // Events //
  @Override
  protected void onInitialize() {
    super.onInitialize();

    if (this.rangeValidator != null) {
      this.input.add(this.rangeValidator); // let throw a NPE if no input is defined.
    }
  }
  /** Initialization */
  @Override
  final void initialize() {
    super.initialize();

    this.setRange(true);
  }
Exemple #4
0
 /**
  * Sets the {@link Range}
  *
  * @param range
  * @return {@link Slider} (this)
  */
 public Slider setRange(Range range) {
   super.options.set("range", range);
   return this;
 }