Example #1
0
 @Override
 protected void initTarget() {
   super.initTarget();
   if (labelAlign != null && target != null) {
     target.addStyleName("x-form-label-" + labelAlign.name().toLowerCase());
   }
 }
Example #2
0
 @Override
 public void setContainer(Container<?> ct) {
   if (labelAlign != null && target != null) {
     target.removeStyleName("x-form-label-" + labelAlign.name().toLowerCase());
   }
   super.setContainer(ct);
 }
Example #3
0
 /**
  * Sets the label alignment.
  *
  * @param labelAlign the label align
  */
 public void setLabelAlign(LabelAlign labelAlign) {
   if (this.labelAlign != labelAlign) {
     if (this.labelAlign != null && target != null) {
       target.removeStyleName("x-form-label-" + this.labelAlign.name().toLowerCase());
     }
     this.labelAlign = labelAlign;
     if (labelAlign != null && target != null) {
       target.addStyleName("x-form-label-" + labelAlign.name().toLowerCase());
     }
   }
 }
Example #4
0
 @Override
 protected int adjustHeightAnchor(int height, Component comp) {
   if (comp instanceof Field<?>) {
     Field<?> f = (Field<?>) comp;
     if (!f.isHideLabel() && labelAlign.equals(LabelAlign.TOP)) {
       El elem = findLabelElement(comp);
       if (elem != null) {
         height -= elem.getHeight();
       }
     }
   }
   return super.adjustHeightAnchor(height, comp);
 }
Example #5
0
  @Override
  protected int adjustWidthAnchor(int width, Component comp) {
    if (comp instanceof Field<?>) {
      Field<?> f = (Field<?>) comp;
      width -= (f.isHideLabel() ? 0 : labelAdjust);

      // offset due to the label element
      if (((GXT.isIE && !GXT.isStrict) || GXT.isIE6)
          && !labelAlign.equals(LabelAlign.TOP)
          && !f.isHideLabel()) {
        width -= 3;
      }
    }

    return super.adjustWidthAnchor(width, comp);
  }