【问题标题】:Closing a popup Panel by clicking a button in its child panel通过单击子面板中的按钮关闭弹出面板
【发布时间】:2012-05-14 05:15:41
【问题描述】:

我有以下面板层次结构:

自定义面板 1 包含 PopupPanel 包含 DecklayoutPanel 包含 CustomPanel 2 包含 FlowPanel包含按钮

如何通过单击按钮关闭自定义面板 1 或 PopupPanel?

【问题讨论】:

    标签: gwt popuppanel


    【解决方案1】:

    // 自定义面板2

    class CustomPanel2 {
      @UiField Button closeButton;
    
      public CustomPanel2() {
        initWidget(uiBinder.createAndBindUi(this));
      }
    
      public HasClickHandlers closeButton() {
        return closeButton;
      }
    }
    

    // 自定义面板1

    class CustomPanel1 implements ClickHandler {
      @UiField PopupPanel myPopupPanel;
      @UiField CustomPanel2 customPanel2;
    
      public CustomPanel1() {
        initWidget(uiBinder.createAndBindUi(this));
        customPanel2.closeButton().addClickHandler(this);
      }
    
      @Override
      public void onClick(ClickEvent e) {
        myPopupPanel.hide();
      }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-23
      • 2013-03-12
      • 2020-06-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多