The insets need to be determined so they are included in the preferred
size of the component the Border is attached to.

The alignment of the component is determined here so it doesn't need
to be recalculated every time the Border is painted.
778466
private void determineInsetsAndAlignment() {
        borderInsets = new Insets(0, 0, 0, 0);

        //  The insets will only be updated for the edge the component will be
        //  diplayed on.
        //
        //  The X, Y alignment of the component is controlled by both the edge
        //  and alignment parameters

        if (edge == Edge.TOP) {
            borderInsets.top = component.getPreferredSize().height + gap;
            component.setAlignmentX(alignment);
            component.setAlignmentY(0.0f);
        } else if (edge == Edge.BOTTOM) {
            borderInsets.bottom = component.getPreferredSize().height + gap;
            component.setAlignmentX(alignment);
            component.setAlignmentY(1.0f);
        } else if (edge == Edge.LEFT) {
            borderInsets.left = component.getPreferredSize().width + gap;
            component.setAlignmentX(0.0f);
            component.setAlignmentY(alignment);
        } else if (edge == Edge.RIGHT) {
            borderInsets.right = component.getPreferredSize().width + gap;
            component.setAlignmentX(1.0f);
            component.setAlignmentY(alignment);
        }

        if (adjustInsets) {
            adjustBorderInsets();
        }
    }
1253426
function(nBorderWidth) {
    var aLastHeaders = this._oColumnSet.headers[this._oColumnSet.headers.length-1] || [],
        len = aLastHeaders.length,
        sPrefix = this._sId+"-fixedth-",
        sValue = nBorderWidth + "px solid " + this.get("COLOR_COLUMNFILLER");

    this._elThead.style.display = "none";
    for(var i=0; i<len; i++) {
        Dom.get(sPrefix+aLastHeaders[i]).style.borderRight = sValue;
    }
    this._elThead.style.display = "";
}
998029
protected synchronized void internalComponentWasResized()
	{
		imageBuffer=null;

		Border b = this.getBorder();
		Insets inset = (b==null)?new Insets(1,1,1,1):b.getBorderInsets(this);
		myTop = inset.top;
		myLeft = inset.left;
		myWidth = this.getWidth() - inset.left - inset.right;
		myHeight = this.getHeight() - inset.top - inset.bottom;
		
		if (myWidth>0 && myHeight>0) componentWasResized(0, 0, myWidth, myHeight);
	}
360277
private void initGraphics() {
        // Set initial size
        if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
            Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
            if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
                gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
            } else {
                gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
            }
        }

        batteryBackground = new Path();
        batteryBackground.setFillRule(FillRule.EVEN_ODD);
        batteryBackground.setStroke(null);

        battery = new Path();
        battery.setFillRule(FillRule.EVEN_ODD);
        battery.setStroke(null);

        valueText = new Text(String.format(locale, "%.0f%%", gauge.getCurrentValue()));
        valueText.setVisible(gauge.isValueVisible());
        valueText.setManaged(gauge.isValueVisible());

        // Add all nodes
        pane = new Pane();
        pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1))));
        pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));
        pane.getChildren().setAll(batteryBackground, battery, valueText);

        getChildren().setAll(pane);
    }
1204444
@Override
  public void setBorder(int color, float width) {
    if (mBorderColor != color) {
      mBorderColor = color;
      invalidateSelf();
    }

    if (mBorderWidth != width) {
      mBorderWidth = width;
      updatePath();
      invalidateSelf();
    }
  }
511628
private void initGraphics() {
        // Set initial size
        if (Double.compare(gauge.getPrefWidth(), 0.0) <= 0 || Double.compare(gauge.getPrefHeight(), 0.0) <= 0 ||
            Double.compare(gauge.getWidth(), 0.0) <= 0 || Double.compare(gauge.getHeight(), 0.0) <= 0) {
            if (gauge.getPrefWidth() > 0 && gauge.getPrefHeight() > 0) {
                gauge.setPrefSize(gauge.getPrefWidth(), gauge.getPrefHeight());
            } else {
                gauge.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
            }
        }

        barBackground = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48590226, PREFERRED_HEIGHT * 0.48590226, 90, 360);
        barBackground.setType(ArcType.OPEN);
        barBackground.setStroke(gauge.getBarBackgroundColor());
        barBackground.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
        barBackground.setStrokeLineCap(StrokeLineCap.ROUND);
        barBackground.setFill(null);

        bar = new Arc(PREFERRED_WIDTH * 0.5, PREFERRED_HEIGHT * 0.5, PREFERRED_WIDTH * 0.48590226, PREFERRED_HEIGHT * 0.48590226, 90, 0);
        bar.setType(ArcType.OPEN);
        bar.setStroke(gauge.getBarColor());
        bar.setStrokeWidth(PREFERRED_WIDTH * 0.02819549 * 2);
        bar.setStrokeLineCap(StrokeLineCap.ROUND);
        bar.setFill(null);

        titleText = new Text(gauge.getTitle());
        titleText.setFill(gauge.getTitleColor());
        Helper.enableNode(titleText, !gauge.getTitle().isEmpty());

        valueText = new Text(formatNumber(gauge.getLocale(), gauge.getFormatString(), gauge.getDecimals(), gauge.getCurrentValue()));
        valueText.setFill(gauge.getValueColor());
        Helper.enableNode(valueText, gauge.isValueVisible());

        unitText = new Text(gauge.getUnit());
        unitText.setFill(gauge.getUnitColor());
        Helper.enableNode(unitText, !gauge.getUnit().isEmpty());

        pane = new Pane(barBackground, bar, titleText, valueText, unitText);
        pane.setBorder(new Border(new BorderStroke(gauge.getBorderPaint(), BorderStrokeStyle.SOLID, new CornerRadii(1024), new BorderWidths(gauge.getBorderWidth()))));
        pane.setBackground(new Background(new BackgroundFill(gauge.getBackgroundPaint(), new CornerRadii(1024), Insets.EMPTY)));

        getChildren().setAll(pane);
    }
1180924
function() {
    var x_start = this.bar_padding + this.options.plot_padding,
        step = this.step;
    if (this.grouped) {
      step = step * this.group_size;
      x_start = ((this.bar_width * this.group_size) + (this.bar_padding * this.group_size)) / 2
      x_start = this.roundValue(x_start, 0);
    }
    this.drawMarkers(this.options.labels, [1, 0], step, x_start, [0, (this.options.font_size + 7) * -1]);
  }
1329421
@Override
    public void calcInnerBounds() {
        final Insets INSETS = getInsets();
        final int SIZE = (getWidth() - INSETS.left - INSETS.right) <= (getHeight() - INSETS.top - INSETS.bottom) ? (getWidth() - INSETS.left - INSETS.right) : (getHeight() - INSETS.top - INSETS.bottom);
        if (!isFrameVisible()) {
            INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, (int)(SIZE * 1.202247191), (int)(SIZE * 1.202247191));
        } else {
            INNER_BOUNDS.setBounds(INSETS.left, INSETS.top, SIZE, SIZE);
        }
    }
78073
@Override
    public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
        float x2 = (width - component.getWidth()) * component.getAlignmentX() + x;
        float y2 = (height - component.getHeight()) * component.getAlignmentY() + y;
        component.setLocation((int) x2, (int) y2);
    }
314089
function(){
		var bd = this.board, paths = bd.linegraph.components;
		if(paths.length>1){
			this.failcode.add("lcDivided");
			bd.border.setnoerr();
			paths[0].setedgeerr(1);
			paths[0].clist.seterr(4);
		}
	}
741410
function () {
        var self = this, style, bodyStyle, bodyElm, rect, borderBox;
        var borderW, borderH, lastRepaintRect, round, value;

        // Use Math.round on all values on IE < 9
        round = !document.createRange ? Math.round : function (value) {
          return value;
        };

        style = self.getEl().style;
        rect = self._layoutRect;
        lastRepaintRect = self._lastRepaintRect || {};

        borderBox = self.borderBox;
        borderW = borderBox.left + borderBox.right;
        borderH = borderBox.top + borderBox.bottom;

        if (rect.x !== lastRepaintRect.x) {
          style.left = round(rect.x) + 'px';
          lastRepaintRect.x = rect.x;
        }

        if (rect.y !== lastRepaintRect.y) {
          style.top = round(rect.y) + 'px';
          lastRepaintRect.y = rect.y;
        }

        if (rect.w !== lastRepaintRect.w) {
          value = round(rect.w - borderW);
          style.width = (value >= 0 ? value : 0) + 'px';
          lastRepaintRect.w = rect.w;
        }

        if (rect.h !== lastRepaintRect.h) {
          value = round(rect.h - borderH);
          style.height = (value >= 0 ? value : 0) + 'px';
          lastRepaintRect.h = rect.h;
        }

        // Update body if needed
        if (self._hasBody && rect.innerW !== lastRepaintRect.innerW) {
          value = round(rect.innerW);

          bodyElm = self.getEl('body');
          if (bodyElm) {
            bodyStyle = bodyElm.style;
            bodyStyle.width = (value >= 0 ? value : 0) + 'px';
          }

          lastRepaintRect.innerW = rect.innerW;
        }

        if (self._hasBody && rect.innerH !== lastRepaintRect.innerH) {
          value = round(rect.innerH);

          bodyElm = bodyElm || self.getEl('body');
          if (bodyElm) {
            bodyStyle = bodyStyle || bodyElm.style;
            bodyStyle.height = (value >= 0 ? value : 0) + 'px';
          }

          lastRepaintRect.innerH = rect.innerH;
        }

        self._lastRepaintRect = lastRepaintRect;
        self.fire('repaint', {}, false);
      }
993552
def inset_sizes(cls, original_width, original_height, target_width, target_height):
        
        if target_width >= original_width and target_height >= original_height:
            target_width = float(original_width)
            target_height = original_height

        elif target_width <= original_width and target_height >= original_height:
            k = original_width / float(target_width)
            target_height = int(original_height / k)

        elif target_width >= original_width and target_height <= original_height:
            k = original_height / float(target_height)
            target_width = int(original_width / k)

        elif target_width < original_width and target_height < original_height:
            k = original_width / float(original_height)
            k_w = original_width / float(target_width)
            k_h = original_height / float(target_height)

            if k_w >= k_h:
                target_height = int(target_width / k)
            else:
                target_width = int(target_height * k)

        return target_width, target_height
1311259
public Insets getBorderInsets(Component c, Insets insets) {
        if (this.insets != null) {

            if (insets == null) {
                insets = new Insets(this.insets.top, this.insets.left, this.insets.bottom, this.insets.right);
            } else {
                insets.top    = this.insets.top;
                insets.bottom = this.insets.bottom;
                insets.left   = this.insets.left;
                insets.right  = this.insets.right;
            }
        } else if (insets == null) {
            insets = new Insets(0, 0, 0, 0);
        } else {
            insets.top = insets.bottom = insets.left = insets.right = 0;
        }

        if (c instanceof JComponent) {
            Insets margin = null;
            Region region = SeaGlassLookAndFeel.getRegion((JComponent) c);

            if ((region == Region.ARROW_BUTTON || region == Region.BUTTON || region == Region.CHECK_BOX
                        || region == Region.CHECK_BOX_MENU_ITEM || region == Region.MENU || region == Region.MENU_ITEM
                        || region == Region.RADIO_BUTTON || region == Region.RADIO_BUTTON_MENU_ITEM || region == Region.TOGGLE_BUTTON)
                    && (c instanceof AbstractButton)) {
                margin = ((AbstractButton) c).getMargin();
            } else if ((region == Region.EDITOR_PANE || region == Region.FORMATTED_TEXT_FIELD || region == Region.PASSWORD_FIELD
                        || region == Region.TEXT_AREA || region == Region.TEXT_FIELD || region == Region.TEXT_PANE)
                    && (c instanceof JTextComponent)) {
                margin = ((JTextComponent) c).getMargin();
            } else if (region == Region.TOOL_BAR && (c instanceof JToolBar)) {
                margin = ((JToolBar) c).getMargin();
            } else if (region == Region.MENU_BAR && (c instanceof JMenuBar)) {
                margin = ((JMenuBar) c).getMargin();
            }

            if (margin != null) {
                insets.top    += margin.top;
                insets.bottom += margin.bottom;
                insets.left   += margin.left;
                insets.right  += margin.right;
            }
        }

        return insets;
    }
91989
public void setBorderPaint(final Paint PAINT) {
        if (null == borderPaint) {
            _borderPaint = PAINT;
            fireUpdateEvent(REDRAW_EVENT);
        } else {
            borderPaint.set(PAINT);
        }
    }
837599
protected boolean internalSetDescriptionBorder(KltFeature feature) {

		computeSubImageBounds(feature, feature.x, feature.y);

		ImageMiscOps.fill(feature.desc, Float.NaN);
		feature.desc.subimage(dstX0, dstY0, dstX1, dstY1, subimage);
		interpInput.setImage(image);
		interpInput.region(srcX0, srcY0, subimage);

		feature.derivX.subimage(dstX0, dstY0, dstX1, dstY1, subimage);
		interpDeriv.setImage(derivX);
		interpDeriv.region(srcX0, srcY0, subimage);

		feature.derivY.subimage(dstX0, dstY0, dstX1, dstY1, subimage);
		interpDeriv.setImage(derivY);
		interpDeriv.region(srcX0, srcY0, subimage);

		int total= 0;

		Gxx = Gyy = Gxy = 0;
		for( int i = 0; i < lengthFeature; i++ ) {
			if( Float.isNaN(feature.desc.data[i]))
				continue;

			total++;

			float dX = feature.derivX.data[i];
			float dY = feature.derivY.data[i];

			Gxx += dX * dX;
			Gyy += dY * dY;
			Gxy += dX * dY;
		}

		// technically don't need to save this...
		feature.Gxx = Gxx;
		feature.Gyy = Gyy;
		feature.Gxy = Gxy;

		float det = Gxx * Gyy - Gxy * Gxy;

		return (det >= config.minDeterminant*total);
	}
591015
@Override protected void initGraphics() {
        // Set initial size
        if (Double.compare(clock.getPrefWidth(), 0.0) <= 0 || Double.compare(clock.getPrefHeight(), 0.0) <= 0 ||
            Double.compare(clock.getWidth(), 0.0) <= 0 || Double.compare(clock.getHeight(), 0.0) <= 0) {
            if (clock.getPrefWidth() > 0 && clock.getPrefHeight() > 0) {
                clock.setPrefSize(clock.getPrefWidth(), clock.getPrefHeight());
            } else {
                clock.setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
            }
        }

        timeText = new Text();
        timeText.setTextOrigin(VPos.CENTER);
        timeText.setFill(textColor);

        dateText = new Text();
        dateText.setTextOrigin(VPos.CENTER);
        dateText.setFill(dateColor);

        pane = new Pane(timeText, dateText);
        pane.setBorder(new Border(new BorderStroke(clock.getBorderPaint(), BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(clock.getBorderWidth()))));
        pane.setBackground(new Background(new BackgroundFill(clock.getBackgroundPaint(), CornerRadii.EMPTY, Insets.EMPTY)));

        getChildren().setAll(pane);
    }
483652
function() {
        var heightSegments = this.heightSegments;
        var widthSegments = this.widthSegments;
        var attributes = this.attributes;
        var positions = [];
        var texcoords = [];
        var normals = [];
        var faces = [];

        for (var y = 0; y <= heightSegments; y++) {
            var t = y / heightSegments;
            for (var x = 0; x <= widthSegments; x++) {
                var s = x / widthSegments;

                positions.push([2 * s - 1, 2 * t - 1, 0]);
                if (texcoords) {
                    texcoords.push([s, t]);
                }
                if (normals) {
                    normals.push([0, 0, 1]);
                }
                if (x < widthSegments && y < heightSegments) {
                    var i = x + y * (widthSegments + 1);
                    faces.push([i, i + 1, i + widthSegments + 1]);
                    faces.push([i + widthSegments + 1, i + 1, i + widthSegments + 2]);
                }
            }
        }

        attributes.position.fromArray(positions);
        attributes.texcoord0.fromArray(texcoords);
        attributes.normal.fromArray(normals);

        this.initIndicesFromArray(faces);

        this.boundingBox = new BoundingBox();
        this.boundingBox.min.set(-1, -1, 0);
        this.boundingBox.max.set(1, 1, 0);
    }