Displays the elements according to the align properties.
193136
def render(self, rect, data):
        
        # Make sure we're aligned correctly
        if self.horizontal_align not in VerticalLM._VALID_ALIGN_HORIZONTAL:
            raise ValueError('Horizontal align is not valid.')
        if self.vertical_align not in VerticalLM._VALID_ALIGN_VERTICAL:
            raise ValueError('Vertical align is not valid.')

        # Work out the extra height we have to distribute
        extra_height = rect.h - self.get_minimum_size(data).y
        num_elements = len(self.elements)
        if num_elements == 0:
            return
        elif num_elements > 1:
            per_margin = 1.0 / float(num_elements-1)
        else:
            per_margin = 0.0
        per_element = 1.0 / float(num_elements)

        # Work out the starting y coordinate
        y = rect.y
        if self.vertical_align == VerticalLM.ALIGN_MIDDLE:
            y = rect.y + extra_height*0.5
        elif self.vertical_align == VerticalLM.ALIGN_TOP:
            y = rect.y + extra_height

        # Render each child element
        for element in reversed(self.elements):
            size = element.get_minimum_size(data)

            # Work out the x-coordinates
            if self.horizontal_align == VerticalLM.ALIGN_LEFT:
                x = rect.x
                w = size.x
            elif self.horizontal_align == VerticalLM.ALIGN_CENTER:
                x = rect.center - size.x*0.5
                w = size.x
            elif self.horizontal_align == VerticalLM.ALIGN_RIGHT:
                x = rect.right - size.x
                w = size.x
            else:
                assert self.horizontal_align == VerticalLM.ALIGN_GROW
                x = rect.x
                w = rect.w

            # Work out the y-coordinates
            if self.vertical_align in VerticalLM._ALIGN_SIMPLE_SET:
                h = size.y
                next_y = y + size.y + self.margin
            elif self.vertical_align == VerticalLM.ALIGN_EQUAL_SPACING:
                h = size.y
                next_y = y + size.y + self.margin + extra_height*per_margin
            else:
                assert self.vertical_align == VerticalLM.ALIGN_EQUAL_GROWTH
                h = size.y + extra_height*per_element
                next_y = y + h + self.margin

            # Render and move on.
            element.render(datatypes.Rectangle(x, y, w, h), data)
            y = next_y
1134021
private void align() {
        mainForm.setLayoutMargin(5);
        mainForm.setWidth100();
        mainForm.setHeight100();
        mainForm.setBackgroundColor("#FFFFFF");
        mainForm.setAlign(Alignment.CENTER);
        mainForm.setLayoutAlign(Alignment.CENTER);
        mainForm.setDefaultLayoutAlign(Alignment.CENTER);
        
        viewPort.setWidth(LAYOUT_WIDTH);
        viewPort.setLayoutAlign(Alignment.CENTER);
        viewPort.setAlign(Alignment.CENTER);
        viewPort.setDefaultLayoutAlign(Alignment.CENTER);
    }
339150
function(props) {
  props = defaultValue(props, {});

  this.title = props.title;

  /**
   * Gets or sets the list of items, ordered from bottom to top, with properties:
   * * `color`: CSS color description,
   * * `lineColor`: CSS color description,
   * * `multipleColors`: An array of CSS color descriptions.  A grid of these colors will be displayed in the box to the left of the item label.
   * * `title`: label placed level with middle of box
   * * `titleAbove`: label placed level with top of box
   * * `titleBelow`: label placed level with bottom of box
   * * `imageUrl`: url of image that will be drawn instead of a coloured box
   * * `imageWidth`, `imageHeight`: image dimensions
   * * `spacingAbove`: adds to itemSpacing for this item only.
   * @type {Object[]}
   */
  this.items = defaultValue(props.items, []);

  /**
   * Gets or sets a color map used to draw a smooth gradient instead of discrete color boxes.
   * @type {ColorMap}
   */
  this.gradientColorMap = props.gradientColorMap;

  /**
   * Gets or sets the maximum height of the whole color bar, unless very many items.
   * @type {Number}
   * @default 130
   */
  this.barHeightMax = defaultValue(props.barHeightMax, 130);

  /**
   * Gets or sets the minimum height of the whole color bar.
   * @type {Number}
   * @default 30
   */
  this.barHeightMin = defaultValue(props.barHeightMax, 30);

  /**
   * Gets or sets the width of each color box (and hence, the color bar)
   * @type {Number}
   * @default 30
   */
  this.itemWidth = defaultValue(props.itemWidth, 30);

  /**
   * Gets or sets the asbolute minimum height of each color box, overruling barHeightMax.
   * @type {Number}
   * @default 12
   */
  this.itemHeightMin = defaultValue(props.itemHeightMin, 12);

  /**
   * Gets or sets the forced height of each color box. Better to leave unset.
   * @type {Number}
   * @default the smaller of `props.barHeightMax / props.items.length` and 30.
   */
  this.itemHeight = props.itemHeight;

  /**
   * Gets or sets the gap between each pair of color boxes.
   * @type {Number}
   * @default 0
   */
  this.itemSpacing = defaultValue(props.itemSpacing, 0);

  /**
   * Gets or sets the spacing to the left of the color bar.
   * @type {Number}
   * @default 5
   */
  this.barLeft = defaultValue(props.barLeft, 5);

  /**
   * Gets or sets the spacing between the title and color bar.
   * @type {Number}
   * @default 5
   */
  this.barTop = defaultValue(props.barTop, 5);

  /**
   * Gets or sets the forced total width of the legend.
   * @type {Number}
   * @default 315
   */
  this.width = defaultValue(props.width, 315);

  /**
   * Gets or sets the horizontal offset of variable title.
   * @type {Number}
   * @default 5
   */
  this.variableNameLeft = defaultValue(props.variableNameLeft, 5);

  /**
   * Gets or sets the vertical offset of variable title.
   * @type {Number}
   * @default 17
   */
  this.variableNameTop = defaultValue(props.variableNameTop, 17);

  /**
   * Gets or sets the CSS class that will be applied to the legend when it is displayed.
   * This is used to ensure that the correct font is used when measuring text for word wrapping.
   * @type {String}
   */
  this.cssClass = defaultValue(props.cssClass, "tjs-legend__legend");

  this._svg = undefined;
}
1250048
def process_text_align( selector, property, value )
      value = "right" if (value == "end")
      value = "left" if (value == "start")
      process_normal_style_attr( selector, property, value )
    end
821498
public void align(Object... o) {
    int i = 0;
    String s[] = new String[o.length];

    for (int ii = 0; ii < o.length; ii++) { if (o[ii] != null) { s[ii] = o[ii].toString(); } }

    while (i < s.length && i < maxColumnLength.size()) {
      int l = (s[i] == null ? 0 : s[i].length());

      if (maxColumnLength.get(i) < l) {
        maxColumnLength.set(i, l);
      }

      i++;
    }

    while (i < s.length) {
      maxColumnLength.add((s[i] == null ? 0 : s[i].length()));
      i++;
    }

    rows.add(s);
  }
170436
public function display()
    {
        if (!$this->visible || count($this->view->model) < 2) {
            return;
        }

        parent::display();

        $this->createEmbeddedWidgets();

        $columns = $this->view->getVisibleColumns();

        $tr_tag = new SwatHtmlTag('tr');
        $tr_tag->id = $this->id;
        $tr_tag->class = $this->getCSSClassString();
        $tr_tag->open();

        // find checkbox column position
        $position = 0;
        foreach ($columns as $column) {
            if ($column === $this->column) {
                break;
            } else {
                $position++;
            }
        }

        if ($position > 0) {
            $td_before_tag = new SwatHtmlTag('td');
            $td_before_tag->setContent('&nbsp;', 'text/xml');
            if ($position > 1) {
                $td_before_tag->colspan = $position;
            }

            $td_before_tag->display();
        }

        $td_tag = new SwatHtmlTag('td');
        if (count($columns) - $position > 1) {
            $td_tag->colspan = count($columns) - $position;
        }

        $td_tag->open();
        if ($this->title !== null) {
            $this->check_all->title = $this->title;
            $this->check_all->content_type = $this->content_type;
        }

        $this->check_all->extended_count = $this->extended_count;
        $this->check_all->visible_count = $this->visible_count;
        $this->check_all->unit = $this->unit;
        $this->check_all->tab_index = $this->tab_index;
        $this->check_all->display();

        $td_tag->close();

        $tr_tag->close();
    }
1232239
function(pos) {
    var props = {};
    if(pos.indexOf('top') !== -1) {
      props.top = this.options.pos_margin;
    } else if(pos.indexOf('bottom') !== -1) {
      props.bottom = this.options.pos_margin;
    }

    if(pos.indexOf('left') !== -1) {
      props.left = this.options.pos_margin;
    } else if(pos.indexOf('right') !== -1) {
      props.right = this.options.pos_margin;
    }
    this.$el.css(props);

  }
1011391
function (element) {
            var position = ariaUtilsDom.getOffset(element);
            position.width = element.offsetWidth;
            position.height = element.offsetHeight;
            var style = element.style;
            this._elementInitialPosition = position;
            style.position = "absolute";
            style.left = position.left + "px";
            style.top = position.top + "px";
            style.height = position.height + "px";
            style.width = position.width + "px";
        }
466594
function() {
      var value = this.getValue();
      this.editorContainer.style.display = '';
      this.formattedContainer.style.display = 'none';
   
      if(!lang.isUndefined(value)) {
         this.editorField.setValue(value);   
      }
      
      // Set focus in the element !
      this.editorField.focus();
   
      // Select the content
      if(this.editorField.el && lang.isFunction(this.editorField.el.setSelectionRange) && (!!value && !!value.length)) {
         this.editorField.el.setSelectionRange(0,value.length);
      }
      
   }
618844
def display_view(self):
        """"""
        self.idx_start.setText(str(self.parent.value('window_start')))
        self.idx_length.setText(str(self.parent.value('window_length')))
        self.idx_scaling.setText(str(self.parent.value('y_scale')))
        self.idx_distance.setText(str(self.parent.value('y_distance')))
952832
public void setAlignment(String alignment) {
        if (ElementTags.ALIGN_CENTER.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_CENTER;
            return;
        }
        if (ElementTags.ALIGN_RIGHT.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_RIGHT;
            return;
        }
        if (ElementTags.ALIGN_JUSTIFIED.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_JUSTIFIED;
            return;
        }
        if (ElementTags.ALIGN_JUSTIFIED_ALL.equalsIgnoreCase(alignment)) {
            this.alignment = Element.ALIGN_JUSTIFIED_ALL;
            return;
        }
        this.alignment = Element.ALIGN_LEFT;
    }
1261805
function () {
		// aligning non added elements is expensive
		if (!this.added) {
			this.alignOnAdd = true;
			return;
		}

		var wrapper = this,
			elem = wrapper.element,
			translateX = wrapper.translateX || 0,
			translateY = wrapper.translateY || 0,
			x = wrapper.x || 0,
			y = wrapper.y || 0,
			align = wrapper.textAlign || 'left',
			alignCorrection = { left: 0, center: 0.5, right: 1 }[align],
			nonLeft = align && align !== 'left';

		// apply translate
		if (translateX || translateY) {
			wrapper.css({
				marginLeft: translateX,
				marginTop: translateY
			});
		}

		// apply inversion
		if (wrapper.inverted) { // wrapper is a group
			each(elem.childNodes, function (child) {
				wrapper.renderer.invertChild(child, elem);
			});
		}

		if (elem.tagName === 'SPAN') {

			var width, height,
				rotation = wrapper.rotation,
				lineHeight,
				radians = 0,
				costheta = 1,
				sintheta = 0,
				quad,
				textWidth = pInt(wrapper.textWidth),
				xCorr = wrapper.xCorr || 0,
				yCorr = wrapper.yCorr || 0,
				currentTextTransform = [rotation, align, elem.innerHTML, wrapper.textWidth].join(',');

			if (currentTextTransform !== wrapper.cTT) { // do the calculations and DOM access only if properties changed

				if (defined(rotation)) {
					radians = rotation * deg2rad; // deg to rad
					costheta = mathCos(radians);
					sintheta = mathSin(radians);

					// Adjust for alignment and rotation.
					// Test case: http://highcharts.com/tests/?file=text-rotation
					css(elem, {
						filter: rotation ? ['progid:DXImageTransform.Microsoft.Matrix(M11=', costheta,
							', M12=', -sintheta, ', M21=', sintheta, ', M22=', costheta,
							', sizingMethod=\'auto expand\')'].join('') : NONE
					});
				}

				width = elem.offsetWidth;
				height = elem.offsetHeight;

				// update textWidth
				if (width > textWidth) {
					css(elem, {
						width: textWidth + PX,
						display: 'block',
						whiteSpace: 'normal'
					});
					width = textWidth;
				}

				// correct x and y
				lineHeight = mathRound((pInt(elem.style.fontSize) || 12) * 1.2);
				xCorr = costheta < 0 && -width;
				yCorr = sintheta < 0 && -height;

				// correct for lineHeight and corners spilling out after rotation
				quad = costheta * sintheta < 0;
				xCorr += sintheta * lineHeight * (quad ? 1 - alignCorrection : alignCorrection);
				yCorr -= costheta * lineHeight * (rotation ? (quad ? alignCorrection : 1 - alignCorrection) : 1);

				// correct for the length/height of the text
				if (nonLeft) {
					xCorr -= width * alignCorrection * (costheta < 0 ? -1 : 1);
					if (rotation) {
						yCorr -= height * alignCorrection * (sintheta < 0 ? -1 : 1);
					}
					css(elem, {
						textAlign: align
					});
				}

				// record correction
				wrapper.xCorr = xCorr;
				wrapper.yCorr = yCorr;
			}

			// apply position with correction
			css(elem, {
				left: x + xCorr,
				top: y + yCorr
			});

			// record current text transform
			wrapper.cTT = currentTextTransform;
		}
	}
324805
def display(self):
        """"""
        def render(line):
            is_wide_char = False
            for x in range(self.columns):
                if is_wide_char:  # Skip stub
                    is_wide_char = False
                    continue
                char = line[x].data
                assert sum(map(wcwidth, char[1:])) == 0
                is_wide_char = wcwidth(char[0]) == 2
                yield char

        return ["".join(render(self.buffer[y])) for y in range(self.lines)]
755299
def render(self, rect, data):
        """"""
        # We can't use our get minimum size, because that enforces
        # the size limits.
        size = self.element.get_minimum_size(data)

        # Assume we're bottom left at our natural size.
        x = rect.x
        y = rect.y
        w = size.x
        h = size.y

        extra_width = rect.w - w
        extra_height = rect.h - h

        if self.horizontal_align == AlignLM.ALIGN_CENTER:
            x += extra_width * 0.5
        elif self.horizontal_align == AlignLM.ALIGN_RIGHT:
            x += extra_width
        elif self.horizontal_align == AlignLM.GROW_X:
            w = rect.w

        if self.vertical_align == AlignLM.ALIGN_MIDDLE:
            y += extra_height * 0.5
        elif self.vertical_align == AlignLM.ALIGN_TOP:
            y += extra_height
        elif self.vertical_align == AlignLM.GROW_Y:
            h = rect.h

        self.element.render(datatypes.Rectangle(x, y, w, h), data)
160134
public function display()
    {
        if (!$this->visible) {
            return;
        }

        parent::display();

        $count = count($this);
        $i = 1;

        $container_tag = $this->getContainerTag();
        $container_tag->open();

        foreach ($this->entries as $entry) {
            // display separator
            if ($i > 1) {
                echo SwatString::minimizeEntities($this->separator);
            }

            // link all entries or link all but the last entry
            $link = $this->link_last_entry || $i < $count;

            $this->displayEntry($entry, $link, $i === 1);

            $i++;
        }

        $container_tag->close();
    }
94907
public function display()
    {
        if (!$this->visible) {
            return;
        }

        parent::display();

        $tr_tag = new SwatHtmlTag('tr');
        $tr_tag->id = $this->id;
        $tr_tag->class = $this->getCSSClassString();

        $colspan = $this->view->getXhtmlColspan();
        $td_tag = new SwatHtmlTag('td');

        $tr_tag->open();

        if ($this->offset > 0 && $this->position === self::POSITION_LEFT) {
            $this->displayOffsetCell($this->offset);
        }

        $this->displayWidgetCell();

        if ($this->offset > 0 && $this->position === self::POSITION_RIGHT) {
            $this->displayOffsetCell($this->offset);
        }

        $tr_tag->close();
    }
279983
protected function setAlignment( $value ) {
		if ( $value !== $this->align ) {
			// Default to 'left'
			if ( !in_array( $value, [ 'left', 'right', 'top', 'inline' ] ) ) {
				$value = 'left';
			}
			// Validate
			if ( $value === 'inline' && !$this->isFieldInline() ) {
				$value = 'top';
			}
			// Reorder elements
			$this->body->clearContent();

			if ( $this->helpInline ) {
				if ( $value === 'top' ) {
					$this->header->appendContent( $this->label );
					$this->body->appendContent( $this->header, $this->field, $this->help );
				} elseif ( $value === 'inline' ) {
					$this->header->appendContent( $this->label, $this->help );
					$this->body->appendContent( $this->field, $this->header );
				} else {
					$this->header->appendContent( $this->label, $this->help );
					$this->body->appendContent( $this->header, $this->field );
				}
			} else {
				if ( $value === 'top' ) {
					$this->header->appendContent( $this->help, $this->label );
					$this->body->appendContent( $this->header, $this->field );
				} elseif ( $value === 'inline' ) {
					$this->header->appendContent( $this->help, $this->label );
					$this->body->appendContent( $this->field, $this->header );
				} else {
					$this->header->appendContent( $this->label );
					$this->body->appendContent( $this->header, $this->help, $this->field );
				}
			}
			// Set classes. The following classes can be used here:
			// * oo-ui-fieldLayout-align-left
			// * oo-ui-fieldLayout-align-right
			// * oo-ui-fieldLayout-align-top
			// * oo-ui-fieldLayout-align-inline
			if ( $this->align ) {
				$this->removeClasses( [ 'oo-ui-fieldLayout-align-' . $this->align ] );
			}
			$this->addClasses( [ 'oo-ui-fieldLayout-align-' . $value ] );
			$this->align = $value;
		}

		return $this;
	}