2 gtzhj GTZHJ 于 2014.02.07 16:08 提问

CanvasItem如何加载FormItem?

如下列代码,DispositionCanvasItem继承 CanvasItem,里面需要加载两个FormItem,两种方法都不行,希望前辈们指教指教?
public class DispositionCanvasItem extends CanvasItem {

private String fields;
private String appendFields;
private String gridHeight;
private String gridWidth;

public DispositionCanvasItem() {
    super();
}

public DispositionCanvasItem(String _fields, String _appendFields,
        String _gridHeight, String _gridWidth) {
    super();
    this.fields = _fields;
    this.appendFields = _appendFields;
    this.gridHeight = _gridHeight;
    this.gridWidth = _gridWidth;

    dispositionFormItem();
}

private void dispositionFormItem() {
    FormItem field = new FormItem();
    field = new StsSelectFilterItem(fields, appendFields, gridHeight,
            gridWidth);
    final TextAreaItem textArea = new TextAreaItem();// 多行文本框

    //方法一:该方法能运行,但页面加载报错
    List<FormItem> fieldList = new ArrayList<FormItem>();
    fieldList.add(field);
    fieldList.add(textArea);
    setCanvas((Canvas) fieldList);

    //方法二:addMember报错
    VLayout mainLayout = new VLayout();
    HLayout aLayout = new HLayout();
    aLayout.addMember(field);
    aLayout.addMember(textArea);
    mainLayout.addMember(aLayout);
    setCanvas(mainLayout);
    mainLayout.draw();
}
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!