Path: blob/trunk/third_party/closure/goog/graphics/ext/strokeandfillelement.js
2868 views
// Copyright 2007 The Closure Library Authors. All Rights Reserved.1//2// Licensed under the Apache License, Version 2.0 (the "License");3// you may not use this file except in compliance with the License.4// You may obtain a copy of the License at5//6// http://www.apache.org/licenses/LICENSE-2.07//8// Unless required by applicable law or agreed to in writing, software9// distributed under the License is distributed on an "AS-IS" BASIS,10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.11// See the License for the specific language governing permissions and12// limitations under the License.131415/**16* @fileoverview A thick wrapper around elements with stroke and fill.17* @author [email protected] (Robby Walker)18*/192021goog.provide('goog.graphics.ext.StrokeAndFillElement');2223goog.require('goog.graphics.ext.Element');24252627/**28* Interface for a graphics element that has a stroke and fill.29* This is the base interface for ellipse, rectangle and other30* shape interfaces.31* You should not construct objects from this constructor. Use a subclass.32* @param {goog.graphics.ext.Group} group Parent for this element.33* @param {goog.graphics.StrokeAndFillElement} wrapper The thin wrapper to wrap.34* @constructor35* @extends {goog.graphics.ext.Element}36*/37goog.graphics.ext.StrokeAndFillElement = function(group, wrapper) {38goog.graphics.ext.Element.call(this, group, wrapper);39};40goog.inherits(41goog.graphics.ext.StrokeAndFillElement, goog.graphics.ext.Element);424344/**45* Sets the fill for this element.46* @param {goog.graphics.Fill?} fill The fill object.47*/48goog.graphics.ext.StrokeAndFillElement.prototype.setFill = function(fill) {49this.getWrapper().setFill(fill);50};515253/**54* Sets the stroke for this element.55* @param {goog.graphics.Stroke?} stroke The stroke object.56*/57goog.graphics.ext.StrokeAndFillElement.prototype.setStroke = function(stroke) {58this.getWrapper().setStroke(stroke);59};606162/**63* Redraw the rectangle. Called when the coordinate system is changed.64* @protected65* @override66*/67goog.graphics.ext.StrokeAndFillElement.prototype.redraw = function() {68this.getWrapper().reapplyStroke();69};707172