/** * Created by guopeng on 16/7/29. */ import {TextItem} from "./TextItem"; import {JRTextField} from "../jasper/JRTextField"; import {JRDesignExpression} from "../jasper/JRDesignExpression"; import {JRVisitor} from "../jasper/JRVisitor"; import {JRExpression} from "./JRExpression"; export default class TextFieldItem extends TextItem implements JRTextField { private _defaultValue = "文本框"; constructor(){ super(); this.value = this._defaultValue; } displayName(): string { return this.value; } clone(){ const item = super.clone() as TextFieldItem; item.text = this.text; return item; } get text(): string { return this.value; } set text(value: string) { this.value = value; } protected preferredSize():{width:number; height:number} { return {width: 150, height: 30}; } visit(visitor:JRVisitor) { visitor.visitTextField(this); } // ------------------ JRTextField implements block begin isShrinkWithOverflow(){ return false; } isStretchWithOverflow():boolean { return false; } setShrinkWithOverflow(value:boolean):void{ } setStretchWithOverflow(isStretchWithOverflow:boolean):void { } getOwnPattern():string { return null; } isOwnBlankWhenNull():boolean { return null; } getExpression():JRExpression { return new JRDesignExpression(this.text); } getPatternExpression():JRExpression { return null; } // ------------------ JRTextField implements block end }