浏览 2087 次
该帖已经被评为隐藏帖
|
|
---|---|
作者 | 正文 |
发表时间:2007-06-28
private void addCommandColumnToTable(FacesContext context, String columnName, String commandName, String bindingCommand, UIData table) { // 新建数据列 UIColumn column = new UIColumn(); column.setId("col_" + columnName); // 新建header项 HtmlOutputText header = new HtmlOutputText(); header.setId("hdr_" + columnName); header.setValue(columnName); // header.setStyleClass("outputText"); // 新建文本链接项 HtmlCommandLink commandlink = new HtmlCommandLink(); // 绑定动作 Class[] clas={ActionEvent.class}; MethodBinding mBinding = context.getApplication().createMethodBinding( "#{dynamicCreate.clickpln}",clas); commandlink.setAction(mBinding); // commandlink.setType("submit"); // 新建命令文本 HtmlOutputText text = new HtmlOutputText(); text.setId("output_" + columnName); // text.setStyleClass("outputText"); text.setValue(commandName); // 逐加入命令中 commandlink.getChildren().add(text); // 逐个添加项 column.setHeader(header); column.getChildren().add(commandlink); // 逐加入表中 table.getChildren().add(column); } 高手,,帮我看下这段问题... 下面这段我是直接绑定panelGrid上面,,这段就行.. public HtmlPanelGrid getPanelGrid(){ FacesContext facesContext = FacesContext.getCurrentInstance(); Application application = facesContext.getApplication(); HtmlPanelGrid panelGrid = (HtmlPanelGrid) application .createComponent(HtmlPanelGrid.COMPONENT_TYPE); //建立一个文本. HtmlOutputText outText = (HtmlOutputText)application.createComponent(HtmlOutputText.COMPONENT_TYPE); outText.setTitle("try_UIC_1"); outText.setValue("Bind"); panelGrid.getChildren().add(outText); // 建立一个按钮.... //FacesContext context = FacesContext.getCurrentInstance(); MethodBinding mb = (MethodBinding) facesContext.getApplication().createMethodBinding("#{dynamicCreate.clickpln}", null); HtmlCommandButton newOne=new HtmlCommandButton(); newOne.setValue("DynaButton"); newOne.setAction(mb); panelGrid.getChildren().add(newOne); panelGrid.setColumns(1); return panelGrid; } [b] 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |