Package com.sencha.gxt.widget.core.client.box

Examples of com.sencha.gxt.widget.core.client.box.MessageBox$MessageBoxIcons


public class LogTabPanel extends TabPanel {
 
  protected static JobDebugServiceAsync debugService=GWT.create(JobDebugService.class);
 
  public LogTabPanel(){
    final MessageBox box = new MessageBox(
        "取消调试么?", "此次调试正在运行,要取消本次调试么?");
    box.setPredefinedButtons(
        PredefinedButton.YES,
        PredefinedButton.NO,
        PredefinedButton.CANCEL);
    box.setIcon(MessageBox.ICONS
        .question());
    box.addHideHandler(new HideHandler() {
      @Override
      public void onHide(HideEvent event) {
        final LogTextPanel item = (LogTextPanel) box.getData("item");
        Dialog btn = (Dialog) event.getSource();
        String choice = btn.getHideButton().getItemId();
        if(choice.equalsIgnoreCase("yes")){
          debugService.cancelDebug(item.getDebugId(), new AsyncCallback<Void>() {
           
            @Override
            public void onSuccess(Void result) {
              item.getTimer().cancel();
              closeTab(item);
            }

            @Override
            public void onFailure(Throwable caught) {
              Window.alert("调试取消失败");
            }
          });
        }else if(choice.equalsIgnoreCase("no")){
          item.getTimer().cancel();
          closeTab(item);
        }else{
          //do nothing
        }
      }
    });
    addBeforeCloseHandler(new BeforeCloseHandler<Widget>() {
      @Override
      public void onBeforeClose(
          final BeforeCloseEvent<Widget> bcEvent) {
        final LogTextPanel item = (LogTextPanel) bcEvent.getItem();
        box.setData("item", item);
        if(item.isRunning() == true){
          box.show();
          bcEvent.setCancelled(true);
        }
      }
    });
  }
View Full Code Here


       
    stop = new MenuItem("停止运行", new SelectionHandler<MenuItem>() {
     
      @Override
      public void onSelection(final SelectionEvent<MenuItem> se) {
        final MessageBox box = new MessageBox("停止调试?", "确定要停止调试么?");
        box.setPredefinedButtons(
            PredefinedButton.YES,
            PredefinedButton.NO);
        box.setIcon(MessageBox.ICONS
            .question());
        box.addHideHandler(new HideHandler() {
          @Override
          public void onHide(HideEvent event) {
            Dialog btn = (Dialog) event.getSource();
            String choice = btn.getHideButton().getItemId();
            if(choice.equalsIgnoreCase("yes")){
              debugService.cancelDebug(debugId, new AsyncCallback<Void>() {
               
                @Override
                public void onSuccess(Void result) {
                  se.getSelectedItem().setEnabled(false);
                }
               
                @Override
                public void onFailure(Throwable caught) {
                      Window.alert("取消调试失败!\n原因:"
                          + caught);
                }
              });
            }
          }
        });
        box.show();
      }
    });
   
    contextMenu.add(stop);
View Full Code Here

TOP

Related Classes of com.sencha.gxt.widget.core.client.box.MessageBox$MessageBoxIcons

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.