SmartGWT-can';t在windows模式中单击项目

SmartGWT-can';t在windows模式中单击项目,gwt,smartgwt,Gwt,Smartgwt,我在使用Window和setIsModal(true)时遇到一个问题 我有以下代码: @Override public void onModuleLoad() { Button tester = new Button("Tester"); tester.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() { @Override public void on

我在使用
Window
setIsModal(true)
时遇到一个问题

我有以下代码:

@Override
public void onModuleLoad() {

    Button tester = new Button("Tester");

    tester.addClickHandler(new com.smartgwt.client.widgets.events.ClickHandler() {

        @Override
        public void onClick(ClickEvent event) {
            final com.smartgwt.client.widgets.Window win = new com.smartgwt.client.widgets.Window();
            win.setTitle("Ventana Tester");
            win.setWidth(900);
            win.setHeight(600);
            win.setIsModal(true);
            win.setShowModalMask(true);
            win.centerInPage();
            win.setMinimized(false);

            win.addCloseClickHandler(new CloseClickHandler() {
                @Override
                public void onCloseClick(CloseClientEvent event) {
                    win.destroy();
                }
            });


            PlanBoard pb = new PlanBoard();
            win.addItem(pb);

            win.show();

        }
    });

    vlPrincipal.addMember(tester);

    RootPanel.get("main").add(vlPrincipal);
}
这是PlanBoard类:

public class PlanBoard extends VLayout{


private CaptionPanel contentDetallePlan =  new CaptionPanel("DETALLES DEL PLAN");
private CaptionPanel contentAtributosPlan =  new CaptionPanel("ATRIBUTOS DE PLAN");
private CaptionPanel contentSeccionesPlan =  new CaptionPanel("SECCIONES");

public PlanBoard(){

    contentDetallePlan.setStyleName("estiloCaptionPanel");
    contentAtributosPlan.setStyleName("estiloCaptionPanel");

    addMember(contentDetallePlan);
    addMember(contentAtributosPlan);
    addMember(contentSeccionesPlan);


    preparaDetallePlan();
    preparaAtributosPlan();
}


private void preparaDetallePlan(){

    VLayout contenedorSeccion = new VLayout();

    FlexTable table1 = new FlexTable();
    FlexTable table2 = new FlexTable();
    FlexTable table3 = new FlexTable();

    Label np = new Label("Nombre de Plan:");
    Label npText = new Label("Plan B");

    Label tc = new Label("Tipo de Carta:");
    DynamicForm tcForm = new DynamicForm();
    ComboBoxItem tcBox =  new ComboBoxItem();
    tcBox.setWidth(250);
    tcBox.setShowTitle(false);
    tcForm.setItems(tcBox);

    Label pr = new Label("Periodo:");
    DynamicForm prForm = new DynamicForm();
    ComboBoxItem prBox =  new ComboBoxItem();
    prBox.setWidth(150);
    prBox.setShowTitle(false);
    prForm.setItems(prBox);


    Label dp = new Label("Descripcion:");
    DynamicForm dpForm = new DynamicForm();
    TextAreaItem dpText =  new TextAreaItem();
    dpText.setShowTitle(false);
    dpText.setWidth(600);
    dpForm.setItems(dpText);



    table1.setWidget(0, 0, np);
    table1.setWidget(0, 1, npText);

    table2.setWidget(0, 0, tc);
    table2.setWidget(0, 1, tcForm);
    table2.setWidget(0, 2, pr);
    table2.setWidget(0, 3, prForm);

    table3.setWidget(0, 1, dp);
    table3.setWidget(1, 1, dpForm);

    contenedorSeccion.addMember(table1);
    contenedorSeccion.addMember(table2);
    contenedorSeccion.addMember(table3);

    contentDetallePlan.add(contenedorSeccion);


}

private void preparaAtributosPlan(){

    VLayout contenedorSeccion = new VLayout(); 

    FlexTable table1 = new FlexTable();

    Label fe = new Label("Firma Electornica:");
    CheckboxItem feCheck = new CheckboxItem();
    DateItem feFechaIni = new DateItem();
    DateItem feFechaFin = new DateItem();

    feFechaIni.setUseTextField(true);

    feCheck.setShowTitle(false);

    DynamicForm feForm = new DynamicForm();
    feForm.setItems(feCheck,feFechaIni,feFechaFin);

    table1.setWidget(0, 0, fe);
    table1.setWidget(0, 1, feForm);

    contenedorSeccion.addMember(table1);

    contentAtributosPlan.add(contenedorSeccion);


}
问题是,当我尝试单击
CheckBoxItem
DateItem
时,我无法编辑它们,但当我不使用
setIsModal(true)
时,它工作正常

我不知道如何将
窗口设置为
模式(true)
,并使这些项目在该窗口上工作。

这里是您的代码清理(稍微)和改进,以便实现您想要的功能(这是具有可选/可操作控件的模式窗口):

PlanBoard.java

import com.smartgwt.client.widgets.form.DynamicForm;
import com.smartgwt.client.widgets.form.fields.CheckboxItem;
import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
import com.smartgwt.client.widgets.form.fields.DateItem;
import com.smartgwt.client.widgets.form.fields.StaticTextItem;
import com.smartgwt.client.widgets.form.fields.TextAreaItem;
import com.smartgwt.client.widgets.layout.VLayout;

public class PlanBoard extends VLayout {

    public PlanBoard(){
        preparaDetallePlan();
        preparaAtributosPlan();
        preparaSecciones();
    }


    private void preparaDetallePlan(){
        StaticTextItem np = new StaticTextItem("id2", "Nombre de Plan:");
        StaticTextItem npText = new StaticTextItem("id2", "Plan B");

        ComboBoxItem tcBox =  new ComboBoxItem();
        tcBox.setTitle("Tipo de Carta");
        tcBox.setWidth(250);

        ComboBoxItem prBox =  new ComboBoxItem();
        tcBox.setTitle("Periodo");
        prBox.setWidth(150);

        StaticTextItem dp = new StaticTextItem("id3", "Descripcion:");

        TextAreaItem dpText =  new TextAreaItem();
        dpText.setShowTitle(false);
        dpText.setWidth(600);
        dpText.setStartRow(true);
        dpText.setEndRow(true);
        dpText.setColSpan(2);

        DynamicForm form = new DynamicForm();
        form.setItems(np, npText, tcBox, prBox, dp, dpText);
        form.setIsGroup(true);
        form.setGroupTitle("DETALLES DE PLAN");

        addMember(form);
    }

    private void preparaAtributosPlan(){
        StaticTextItem fe = new StaticTextItem("id4", "Firma Electornica:");
        CheckboxItem feCheck = new CheckboxItem();
        feCheck.setShowTitle(false);

        DateItem feFechaIni = new DateItem();
        DateItem feFechaFin = new DateItem();
        feFechaIni.setUseTextField(true);

        DynamicForm form = new DynamicForm();
        form.setItems(fe, feCheck, feFechaIni, feFechaFin);
        form.setIsGroup(true);
        form.setGroupTitle("ATRIBUTOS DE PLAN");

        addMember(form);
    }

    private void preparaSecciones(){
        DynamicForm form = new DynamicForm();
        form.setIsGroup(true);
        form.setGroupTitle("SECCIONES");
        addMember(form);
    }
}
TestCases.java(重命名为您的入口点类名,您不需要指定):

一些注意事项:

  • 除非绝对必要,并且只有在您真正了解自己在做什么时,才可混合使用GWT和SmartGWT小部件(因为它会产生意外的结果,就像您正在经历的那样)。在你的情况下,混合是不必要的
  • 您可以将标题添加到正在使用的不同控件中,它们将显示为标签。可以指定每个控件的标题标签是显示在上方还是一侧
  • 查看SmartGWT演示,了解如何配置和使用不同类型的
    DynamicForm
    控件。很多你想做的事情,你做的比必要的更困难
  • 在“风格”方面,不要用西班牙式英语编写代码。我会说西班牙语,所以我能理解,但这限制了你获得的反馈,因为你的代码很难理解。使用英语(至少对于您打算在SO中发布的代码)
在您的EntryPoint类中什么是
vlPrincipal
?你哪儿都不申报。另外,由于您混合使用SmartGWT和GWT组件,因此有必要了解您使用哪一个库来使用这两种组件中的特定组件!谢谢Carlos,问题是把这些项目放在标题栏里是行不通的。对不起我的泰山英语;没关系。在以后的帖子中,请记住这一点(我认为这也是一条很好的一般规则:用英语编写代码……你永远不知道什么时候需要不懂西班牙语的人的帮助)。
import com.smartgwt.client.widgets.IButton;  
import com.smartgwt.client.widgets.Window;  
import com.smartgwt.client.widgets.events.ClickEvent;  
import com.smartgwt.client.widgets.events.ClickHandler;  
import com.smartgwt.client.widgets.events.CloseClickEvent;  
import com.smartgwt.client.widgets.events.CloseClickHandler;  
import com.smartgwt.client.widgets.layout.VLayout; 

import com.google.gwt.core.client.EntryPoint;

public class TestCases implements EntryPoint {  

    public void onModuleLoad() {  

         IButton tester = new IButton("Tester");
         tester.addClickHandler(new ClickHandler() {

            @Override
            public void onClick(ClickEvent event) {
                final Window win = new Window();
                win.setTitle("Ventana Tester");
                win.setWidth(900);
                win.setHeight(600);
                win.setIsModal(true);
                win.setShowModalMask(true);
                win.centerInPage();
                win.setMinimized(false);

                win.addCloseClickHandler(new CloseClickHandler() {
                    @Override
                    public void onCloseClick(CloseClickEvent event) {
                        win.destroy();
                    }
                });

                PlanBoard pb = new PlanBoard();
                win.addItem(pb);
                win.show();
            }
        });

        VLayout vlPrincipal = new VLayout();
        vlPrincipal.addMember(tester);
        vlPrincipal.draw();
    }  
}