Java 类com.google.gwt.user.client.ui.ClickListener 实例源码

项目:appinventor-extensions    文件:YoungAndroidFormUpgrader.java   
private static void upgradeWarnDialog(String aMessage) {
  final DialogBox dialogBox = new DialogBox(false, true);
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.warningDialogTitle());
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  final HTML message = new HTML(aMessage);
  message.setStyleName("DialogBox-message");
  VerticalPanel vPanel = new VerticalPanel();
  Button okButton = new Button("OK");
  okButton.addClickListener(new ClickListener() {
      @Override
      public void onClick(Widget sender) {
        dialogBox.hide();
      }
    });
  vPanel.add(message);
  vPanel.add(okButton);
  dialogBox.setWidget(vPanel);
  dialogBox.center();
  dialogBox.show();
}
项目:appinventor-extensions    文件:ComponentHelpWidget.java   
public ComponentHelpWidget(final SimpleComponentDescriptor scd) {
  if (imageResource == null) {
    Images images = Ode.getImageBundle();
    imageResource = images.help();
  }
  AbstractImagePrototype.create(imageResource).applyTo(this);
  addClickListener(new ClickListener() {
      @Override
      public void onClick(Widget sender) {
        final long MINIMUM_MS_BETWEEN_SHOWS = 250;  // .25 seconds

        if (System.currentTimeMillis() - lastClosureTime >=
            MINIMUM_MS_BETWEEN_SHOWS) {
          new ComponentHelpPopup(scd, sender);
        }
      }
    }
    );
}
项目:appinventor-extensions    文件:ComponentRemoveWidget.java   
public ComponentRemoveWidget(SimpleComponentDescriptor simpleComponentDescriptor) {
  if (imageResource == null) {
    Images images = Ode.getImageBundle();
    imageResource = images.deleteComponent();
  }
  this.scd = simpleComponentDescriptor;
  AbstractImagePrototype.create(imageResource).applyTo(this);
  addClickListener(new ClickListener() {

      @Override
      public void onClick(Widget widget) {
        if (Window.confirm(MESSAGES.reallyRemoveComponent())) {
          long projectId = ode.getCurrentYoungAndroidProjectId();
          YaProjectEditor projectEditor = (YaProjectEditor) ode.getEditorManager().getOpenProjectEditor(projectId);
          SimpleComponentDatabase componentDatabase = SimpleComponentDatabase.getInstance();
          componentDatabase.addComponentDatabaseListener(projectEditor);
          componentDatabase.removeComponent(scd.getName());
        }
      }
    });
}
项目:jolie    文件:Echoes.java   
private void createLyricsDialog()
{
    lyricsDialog = new DialogBox();
    VerticalPanel vPanel = new VerticalPanel();
    vPanel.setHeight( "100%" );
    vPanel.setHorizontalAlignment( VerticalPanel.ALIGN_CENTER );
    vPanel.setVerticalAlignment( VerticalPanel.ALIGN_MIDDLE );
    lyricsDialog.add( vPanel );

    lyrics = new HTML();
    ScrollPanel scrollPanel = new ScrollPanel();
    scrollPanel.setWidth( "300px" );
    scrollPanel.setHeight( "250px" );
    scrollPanel.add( lyrics );
    vPanel.add( scrollPanel );

    Button close = new NativeButton( "Close" );
    close.addClickListener( new ClickListener() {
        public void onClick( Widget arg0 ) {
            lyricsDialog.hide();
        }
    } );
    vPanel.add( close );
}
项目:onecmdb    文件:SelectMultipleDataSourceControl.java   
public Widget getWidget(Object data) {
    if (!(data instanceof GWT_CiBean)) {
        return(new Label("getChildCount(Object data): Not a correct data object!"));
    }
    final GWT_CiBean bean = (GWT_CiBean)data;
    HorizontalPanel hpanel =  new HorizontalPanel();

    if (selectInstances() && (!bean.isTemplate())) {
        final CheckBox cb = new CheckBox();
        cb.setChecked(isChecked(bean));
        hpanel.add(cb);
        cb.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                addChecked(bean, cb.isChecked());
            }

        });
    }
    hpanel.add(new Image(OneCMDBUtils.getIconForCI(bean)));
    Label label = new Label(bean.getDisplayName());
    hpanel.add(label);

    return(hpanel);
}
项目:onecmdb    文件:SelectInheritanceDataSourceControl.java   
/**
 * Override widget to add check box button.
 */
public Widget getWidget(Object data) {
    if (!(data instanceof GWT_CiBean)) {
        return(new Label("getChildCount(Object data): Not a correct data object!"));
    }
    final GWT_CiBean bean = (GWT_CiBean)data;
    HorizontalPanel hpanel =  new HorizontalPanel();
    hpanel.add(new Image(OneCMDBUtils.getIconForCI(bean)));
    Label label = new Label(bean.getDisplayName());
    hpanel.add(label);
    //final Image popup = new Image("images/select_me.gif");
    //hpanel.add(popup);
    label.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (callback != null) {
                if (selectInstances != bean.isTemplate()) {
                    return;
                }
                callback.onSelect(bean);
            }
        }
    });
    return(hpanel);
}
项目:onecmdb    文件:ReverseTreeTable.java   
public void setChildCount(int value) {
    if (value > 0) {
        final Image image = new Image("images/plus.gif");
        image.setStyleName("onecmdb-reverse-expand");
        image.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                open = !open;
                if (open) {
                    image.setUrl("images/minus.gif");
                } else {
                    image.setUrl("images/plus.gif");
                }
                expandListener.onClick(WidgetItem.this);
            }
        });
        widgetPanel.add(image);
        widgetPanel.setCellVerticalAlignment(image, VerticalPanel.ALIGN_MIDDLE);
    }
}
项目:onecmdb    文件:FooterScreen.java   
public FooterScreen() {
    HorizontalPanel panel = new HorizontalPanel();
    HTML label = new HTML("OneCMDB 1.4.0 Beta &copy; Lokomo Systems <<a href='javascript:;'>about</a>>");
    label.setTitle("Show about screen");
    label.setStyleName("onecmdb-footer-label");
    panel.add(label);
    panel.setCellHorizontalAlignment(label, HorizontalPanel.ALIGN_RIGHT);
    panel.setStyleName("onecmdb-footer");
    label.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            getBaseEntryScreen().showScreen(OneCMDBApplication.SHOW_STATIC_CONTENT, 
                    "about.html", 
                    new Long(0));
        }

    });
    initWidget(panel);
}
项目:onecmdb    文件:ButtonValueWidget.java   
public ButtonValueWidget(final String actionName, String label, final Widget left) {
    HorizontalPanel panel = new HorizontalPanel();
    Button b = new Button(label);
    b.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            if (actionCallback != null) {
                actionCallback.onAction(actionName, left);
            }
        }

    });
    panel.add(b);
    panel.add(left);
    initWidget(panel);
}
项目:onecmdb    文件:ListAttributeScreen.java   
public void load() {
    if (this.currentTemplate == null) {
        setErrorText("No Template to show!");
        return;
    }
    setErrorText("");
    setTitleText("Attributes for ");
    setTitleWidget(new CIIconDisplayNameWidget(this.currentTemplate));
    vPanel.clear();

    HTML add = new HTML("[<a href='javascript:;'>new</a>]");
    add.setTitle("Add a new attribute to this template");
    add.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            OneCMDBModelCreator.get().showScreen(OneCMDBModelCreator.ADD_ATTRIBUTE_SCREEN, currentTemplate.getAlias(), new Long(0));
        }

    });
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(add);
    hPanel.setCellHorizontalAlignment(add, HorizontalPanel.ALIGN_RIGHT);
    hPanel.setWidth("100%");
    vPanel.add(hPanel);
    vPanel.add(getAttributeTable());

}
项目:google-gin    文件:DefaultGameDialogs.java   
public void showEndGame(final Runnable runnable) {
  final DialogBox box = new DialogBox();
  box.setAnimationEnabled(true);
  box.setText("Thanks for playing Higher or Lower! *ding*ding*ding*ding*");
  Button b = new Button("Thanks for having me!");
  b.addStyleName("centered");
  b.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
      runnable.run();
      box.hide();
    }
  });
  box.setWidget(b);
  box.center();
  box.show();
}
项目:rest-describe-and-compile    文件:ResponseItem.java   
public ResponseItem(final MethodNode method, final TreeItem methodTreeItem) {
  HorizontalPanel containerPanel = new HorizontalPanel();    
  HTML response = new HTML(SyntaxHighlighter.highlight("<" + WadlXml.responseNode + ">"));
  containerPanel.add(response);    

  // remove response hyperlink
  Hyperlink removeResponseLink = new Hyperlink(GuiFactory.strings.remove(), true, "");
  removeResponseLink.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {        
      method.removeResponse(method.getResponse());         
      listResponse(method, methodTreeItem);
    }
  });      
  containerPanel.add(removeResponseLink);

  initWidget(containerPanel);
}
项目:rest-describe-and-compile    文件:IncludeItem.java   
public static void listIncludes(final GrammarsNode grammars, final VerticalPanel includePanel) {
  includePanel.clear();
  Vector allIncludes = grammars.getAllIncludes();
  Iterator includeIterator = allIncludes.iterator();
  VerticalPanel includeItems = new VerticalPanel();
  while (includeIterator.hasNext()) {      
    IncludeItem includeItem = new IncludeItem((String) includeIterator.next(), grammars, includePanel);
    includeItems.add(includeItem);     
  }
  includePanel.add(includeItems);

  // add include button        
  Button addIncludeButton = new Button(GuiFactory.strings.addInclude());
  addIncludeButton.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
      grammars.addInclude(GuiFactory.strings.newInclude());
      IncludeItem.listIncludes(grammars, includePanel);
    }
  });
  includePanel.add(addIncludeButton);    

}
项目:rest-describe-and-compile    文件:RequestItem.java   
public RequestItem(final MethodNode method, final TreeItem methodTreeItem) {
  HorizontalPanel containerPanel = new HorizontalPanel();    
  HTML request = new HTML(SyntaxHighlighter.highlight("<" + WadlXml.requestNode + ">"));
  containerPanel.add(request);

  // remove request hyperlink
  Hyperlink removeRequestLink = new Hyperlink(GuiFactory.strings.remove(), true, "");
  removeRequestLink.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {        
      method.removeRequest(method.getRequest());         
      listRequest(method, methodTreeItem);
    }
  });      
  containerPanel.add(removeRequestLink);

  initWidget(containerPanel);
}
项目:rest-describe-and-compile    文件:RestCompilePanel.java   
/**
 * 
 */
private static void listUsedClassNames() {
  Iterator classNameIterator = CodeGenerator.usedClassNames.iterator();
  requestClassesPanel.clear();
  while(classNameIterator.hasNext()) {      
    final String className = (String) classNameIterator.next();
    Hyperlink hyperlink = new Hyperlink("<nobr><img align=\"absmiddle\" src=\"./images/details.png\" />" + className + "</nobr>", true, "");
    hyperlink.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        int pos = codeTextArea.getText().indexOf(className);
        codeTextArea.setCursorPos(pos);          
        codeTextArea.setSelectionRange(pos, className.length());
      }        
    });
    requestClassesPanel.add(hyperlink);      
  }    
}
项目:OneCMDBwithMaven    文件:SelectMultipleDataSourceControl.java   
public Widget getWidget(Object data) {
    if (!(data instanceof GWT_CiBean)) {
        return(new Label("getChildCount(Object data): Not a correct data object!"));
    }
    final GWT_CiBean bean = (GWT_CiBean)data;
    HorizontalPanel hpanel =  new HorizontalPanel();

    if (selectInstances() && (!bean.isTemplate())) {
        final CheckBox cb = new CheckBox();
        cb.setChecked(isChecked(bean));
        hpanel.add(cb);
        cb.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                addChecked(bean, cb.isChecked());
            }

        });
    }
    hpanel.add(new Image(OneCMDBUtils.getIconForCI(bean)));
    Label label = new Label(bean.getDisplayName());
    hpanel.add(label);

    return(hpanel);
}
项目:OneCMDBwithMaven    文件:SelectInheritanceDataSourceControl.java   
/**
 * Override widget to add check box button.
 */
public Widget getWidget(Object data) {
    if (!(data instanceof GWT_CiBean)) {
        return(new Label("getChildCount(Object data): Not a correct data object!"));
    }
    final GWT_CiBean bean = (GWT_CiBean)data;
    HorizontalPanel hpanel =  new HorizontalPanel();
    hpanel.add(new Image(OneCMDBUtils.getIconForCI(bean)));
    Label label = new Label(bean.getDisplayName());
    hpanel.add(label);
    //final Image popup = new Image("images/select_me.gif");
    //hpanel.add(popup);
    label.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            if (callback != null) {
                if (selectInstances != bean.isTemplate()) {
                    return;
                }
                callback.onSelect(bean);
            }
        }
    });
    return(hpanel);
}
项目:OneCMDBwithMaven    文件:ReverseTreeTable.java   
public void setChildCount(int value) {
    if (value > 0) {
        final Image image = new Image("images/plus.gif");
        image.setStyleName("onecmdb-reverse-expand");
        image.addClickListener(new ClickListener() {

            public void onClick(Widget sender) {
                open = !open;
                if (open) {
                    image.setUrl("images/minus.gif");
                } else {
                    image.setUrl("images/plus.gif");
                }
                expandListener.onClick(WidgetItem.this);
            }
        });
        widgetPanel.add(image);
        widgetPanel.setCellVerticalAlignment(image, VerticalPanel.ALIGN_MIDDLE);
    }
}
项目:OneCMDBwithMaven    文件:FooterScreen.java   
public FooterScreen() {
    HorizontalPanel panel = new HorizontalPanel();
    HTML label = new HTML("OneCMDB 1.4.0 Beta &copy; Lokomo Systems <<a href='javascript:;'>about</a>>");
    label.setTitle("Show about screen");
    label.setStyleName("onecmdb-footer-label");
    panel.add(label);
    panel.setCellHorizontalAlignment(label, HorizontalPanel.ALIGN_RIGHT);
    panel.setStyleName("onecmdb-footer");
    label.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            getBaseEntryScreen().showScreen(OneCMDBApplication.SHOW_STATIC_CONTENT, 
                    "about.html", 
                    new Long(0));
        }

    });
    initWidget(panel);
}
项目:OneCMDBwithMaven    文件:ButtonValueWidget.java   
public ButtonValueWidget(final String actionName, String label, final Widget left) {
    HorizontalPanel panel = new HorizontalPanel();
    Button b = new Button(label);
    b.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            if (actionCallback != null) {
                actionCallback.onAction(actionName, left);
            }
        }

    });
    panel.add(b);
    panel.add(left);
    initWidget(panel);
}
项目:OneCMDBwithMaven    文件:ListAttributeScreen.java   
public void load() {
    if (this.currentTemplate == null) {
        setErrorText("No Template to show!");
        return;
    }
    setErrorText("");
    setTitleText("Attributes for ");
    setTitleWidget(new CIIconDisplayNameWidget(this.currentTemplate));
    vPanel.clear();

    HTML add = new HTML("[<a href='javascript:;'>new</a>]");
    add.setTitle("Add a new attribute to this template");
    add.addClickListener(new ClickListener() {
        public void onClick(Widget sender) {
            OneCMDBModelCreator.get().showScreen(OneCMDBModelCreator.ADD_ATTRIBUTE_SCREEN, currentTemplate.getAlias(), new Long(0));
        }

    });
    HorizontalPanel hPanel = new HorizontalPanel();
    hPanel.add(add);
    hPanel.setCellHorizontalAlignment(add, HorizontalPanel.ALIGN_RIGHT);
    hPanel.setWidth("100%");
    vPanel.add(hPanel);
    vPanel.add(getAttributeTable());

}
项目:BikeBingle    文件:MyBinglesPanel.java   
protected Button getButtonLogin()
{
    if (_buttonLogin == null)
    {
        _buttonLogin = new Button("Click to login");
        _buttonLogin.setStylePrimaryName("addStackPanel-Button");
        _buttonLogin.setWidth(_width + "px");
        _buttonLogin.addClickListener(new ClickListener()
        {
            public void onClick(Widget sender) 
            {
                try 
                {
                    _uiStateManager.doUserLogin("mybingles");
                } catch (UiStateManagerException e) {
                    handleException(e);
                }
            }

        });
    }
    return _buttonLogin;
}
项目:BikeBingle    文件:BikeStackInfoWindowContent.java   
protected void addBingleLink()
{
    HorizontalPanel hp = new HorizontalPanel();
    hp.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    hp.setSpacing(2);
    Label bll = new Label("BikeBingle link");
    bll.setTitle(BIKEBINGLE_LINK_TOOLTIP);
    hp.add(bll);

    TextBox linkTb = new TextBox();
    linkTb.setText(_bikeStack.getQueryUrl());
    linkTb.setWidth("100px");
    linkTb.setTitle(BIKEBINGLE_LINK_TOOLTIP);
    linkTb.addClickListener(new ClickListener()
    {
        public void onClick(Widget sender) 
        {
            TextBox tb = (TextBox)sender;
            tb.setSelectionRange(0, tb.getText().length());
        }
    });
    hp.add(linkTb);
    this.add(hp);
}
项目:BikeBingle    文件:BinglePanel.java   
protected Button getButtonGoto()
{
    if (_gotoButton == null)
    {
        _gotoButton = new Button("Go to");
        _gotoButton.setTitle("Pan map to location of accident");
        _gotoButton.setStylePrimaryName("addStackPanel-Button");
        _gotoButton.addClickListener(new ClickListener()
        {
            public void onClick(Widget sender) 
            {
                fireBingleOperationRequestedEvent(BINGLE_OPERATION_GOTO, _bingle);
            }

        });
    }
    return _gotoButton;
}
项目:BikeBingle    文件:BinglePanel.java   
protected Button getButtonOpenUrl()
{
    if (_openRelatedUrlButton == null)
    {
        _openRelatedUrlButton = new Button("Open link");
        _openRelatedUrlButton.setTitle("Opens link to another website related to accident");
        _openRelatedUrlButton.setStylePrimaryName("addStackPanel-Button");
        _openRelatedUrlButton.addClickListener(new ClickListener()
        {
            public void onClick(Widget sender) 
            {
                fireBingleOperationRequestedEvent(BINGLE_OPERATION_OPEN_RELATED_URL, _bingle);
            }

        });
    }
    return _openRelatedUrlButton;
}
项目:BikeBingle    文件:BinglePanel.java   
protected Button getButtonDelete()
{
    if (_deleteButton == null)
    {
        _deleteButton = new Button("Delete");
        _deleteButton.setTitle("Permanently deletes this BikeBingle from the database");
        _deleteButton.setStylePrimaryName("addStackPanel-Button");
        _deleteButton.addClickListener(new ClickListener()
        {
            public void onClick(Widget sender) 
            {
                fireBingleOperationRequestedEvent(BINGLE_OPERATION_DELETE, _bingle);
            }

        });
    }
    return _deleteButton;
}
项目:BikeBingle    文件:BingleListPanel.java   
protected Button getButtonMoveUp()
{
    if (_buttonMoveUp == null)
    {
        _buttonMoveUp = new Button("Up");
        _buttonMoveUp.setStylePrimaryName("addStackPanel-Button");
        _buttonMoveUp.setWidth(_width + "px");

        _buttonMoveUp.addClickListener(new ClickListener()
        {
            public void onClick(Widget sender) {
                moveScrollPanel(-40);

            }

        });
    }
    return _buttonMoveUp;
}
项目:BikeBingle    文件:BingleListPanel.java   
protected Button getButtonMoveDown()
{
    if (_buttonMoveDown == null)
    {
        _buttonMoveDown = new Button("Down");
        _buttonMoveDown.setStylePrimaryName("addStackPanel-Button");
        _buttonMoveDown.setWidth(_width + "px");
        _buttonMoveDown.addClickListener(new ClickListener()
        {
            public void onClick(Widget sender) 
            {
                moveScrollPanel(40);

            }

        });
    }
    return _buttonMoveDown;
}
项目:BikeBingle    文件:LatestBinglePanel.java   
protected Button getButtonGoto()
{
    if (_gotoButton == null)
    {
        _gotoButton = new Button("Go to");
        _gotoButton.setTitle("Pan map to location of bingle");
        _gotoButton.setStylePrimaryName("addStackPanel-Button");
        _gotoButton.addClickListener(new ClickListener()
        {
            public void onClick(Widget sender) 
            {
                fireBingleGotoEvent(_bingle);
            }

        });
    }
    return _gotoButton;
}
项目:BikeBingle    文件:AddStackPanel.java   
protected Button getButtonLogin()
{
    if (_buttonLogin == null)
    {
        _buttonLogin = new Button("Click to login");
        _buttonLogin.setStylePrimaryName("addStackPanel-Button");
        _buttonLogin.setWidth(_width + "px");
        _buttonLogin.addClickListener(new ClickListener()
        {
            public void onClick(Widget sender) 
            {
                try 
                {
                    _uiStateManager.doUserLogin("add");
                } catch (UiStateManagerException e) {
                    handleException(e);
                }
            }

        });
    }
    return _buttonLogin;
}
项目:jcommerce    文件:EmailSubscribeManager.java   
private ContentPanel getExportButtonPanel() {
    final ContentPanel exportButtonPanel = new ContentPanel();
    // export file button
    Button exportButton = new Button("导出列表");
    exportButton.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            // download the file from the server
            Window.Location.assign(GWT.getModuleBaseURL() + "downloadService/");
        }

       });
    exportButtonPanel.add(exportButton);
    exportButtonPanel.setWidth(850);
    exportButtonPanel.setHeight(70);
    exportButtonPanel.setFrame(true);

    return exportButtonPanel;
}
项目:jcommerce    文件:UserSelector.java   
public UserSelector() {
    HorizontalPanel contentPanel = new HorizontalPanel();
    text.setReadOnly(false);
    contentPanel.add(text);

    btn.setText("搜索");
    btn.setHeight("25");
    btn.setWidth("65");

    contentPanel.add(btn);

    initWidget(contentPanel);

    btn.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            DialogBox dlg = createDialogBox();
            dlg.center();
            dlg.show();
        }

    });
}
项目:jcommerce    文件:GWTUtils.java   
private static DialogBox createDialogBox(String caption, String message) {
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(caption);

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    dialogBox.setWidget(dialogContents);

    // Add some text to the top of the dialog
    HTML details = new HTML(message);
    dialogContents.add(details);

    // Add a close button at the bottom of the dialog
    Button btnOK = new Button("OK", new ClickListener() {
        public void onClick(Widget sender) {
            dialogBox.hide();
        }
    });
    dialogContents.add(btnOK);
    dialogContents.setCellHorizontalAlignment(btnOK, HasHorizontalAlignment.ALIGN_CENTER);
    dialogBox.center();

    return dialogBox;
}
项目:jcommerce    文件:Utils.java   
private static DialogBox createDialogBox(String caption, String message) {
    // Create a dialog box and set the caption text
    final DialogBox dialogBox = new DialogBox();
    dialogBox.setText(caption);

    // Create a table to layout the content
    VerticalPanel dialogContents = new VerticalPanel();
    dialogContents.setSpacing(4);
    dialogBox.setWidget(dialogContents);

    // Add some text to the top of the dialog
    HTML details = new HTML(message);
    dialogContents.add(details);

    // Add a close button at the bottom of the dialog
    Button btnOK = new Button("OK", new ClickListener() {
        public void onClick(Widget sender) {
            dialogBox.hide();
        }
    });
    dialogContents.add(btnOK);
    dialogContents.setCellHorizontalAlignment(btnOK, HasHorizontalAlignment.ALIGN_CENTER);
    dialogBox.center();

    return dialogBox;
}
项目:appinventor-extensions    文件:TopToolbar.java   
@Override
public void execute() {
  final DialogBox db = new DialogBox(false, true);
  db.setText("About MIT App Inventor");
  db.setStyleName("ode-DialogBox");
  db.setHeight("200px");
  db.setWidth("400px");
  db.setGlassEnabled(true);
  db.setAnimationEnabled(true);
  db.center();

  VerticalPanel DialogBoxContents = new VerticalPanel();
  String html = MESSAGES.gitBuildId(GitBuildId.getDate(), GitBuildId.getVersion()) +
      "<BR/>Use Companion: " + BlocklyPanel.getCompVersion();
  Config config = Ode.getInstance().getSystemConfig();
  String releaseNotesUrl = config.getReleaseNotesUrl();
  if (!Strings.isNullOrEmpty(releaseNotesUrl)) {
    html += "<BR/><BR/>Please see <a href=\"" + releaseNotesUrl +
        "\" target=\"_blank\">release notes</a>";
  }
  String tosUrl = config.getTosUrl();
  if (!Strings.isNullOrEmpty(tosUrl)) {
    html += "<BR/><BR/><a href=\"" + tosUrl +
        "\" target=\"_blank\">" + MESSAGES.privacyTermsLink() + "</a>";
  }
  HTML message = new HTML(html);

  SimplePanel holder = new SimplePanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
      db.hide();
    }
  });
  holder.add(ok);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  db.setWidget(DialogBoxContents);
  db.show();
}
项目:appinventor-extensions    文件:TopToolbar.java   
@Override
public void execute() {
  final DialogBox db = new DialogBox(false, true);
  db.setText("About The Companion");
  db.setStyleName("ode-DialogBox");
  db.setHeight("200px");
  db.setWidth("400px");
  db.setGlassEnabled(true);
  db.setAnimationEnabled(true);
  db.center();

  String downloadinfo = "";
  if (!YaVersion.COMPANION_UPDATE_URL1.equals("")) {
    String url = "http://" + Window.Location.getHost() + YaVersion.COMPANION_UPDATE_URL1;
    downloadinfo = "<br/>\n<a href=" + url + ">Download URL: " + url + "</a><br/>\n";
    downloadinfo += BlocklyPanel.getQRCode(url);
  }

  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML(
      "Companion Version " + BlocklyPanel.getCompVersion() + downloadinfo
  );

  SimplePanel holder = new SimplePanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
    public void onClick(Widget sender) {
      db.hide();
    }
  });
  holder.add(ok);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  db.setWidget(DialogBoxContents);
  db.show();
}
项目:appinventor-extensions    文件:TutorialPanel.java   
/**
 * Creates video on page!
 */
private static void createVideoDialog(String tutorialId) {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText("Tutorial Video");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  VerticalPanel DialogBoxContents = new VerticalPanel();
  // Adds Youtube Video
  HTML message = new HTML("<iframe width=\"560\" height=\"315\" src=\"https://www.youtube.com/embed/" + tutorialId + "?rel=0&autoplay=1\" frameborder=\"0\" allowfullscreen></iframe>");
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
      }
    });
  ok.setStyleName("DialogBox-button");
  holder.add(ok);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.center();
  dialogBox.show();
}
项目:appinventor-extensions    文件:TutorialPanel.java   
/**
 * Enlarges image on page
 */
private static void createImageDialog(String img) {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(true, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  VerticalPanel DialogBoxContents = new VerticalPanel();
  FlowPanel holder = new FlowPanel();
  Button ok = new Button("Close");
  ok.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
      }
    });
  ok.setStyleName("DialogBox-button");

  // Adds Image
  Image image = new Image(img);
  image.addLoadHandler(new LoadHandler() {
      public void onLoad(LoadEvent evt) {
        dialogBox.center();
      }
    });

  image.setStyleName("DialogBox-image");
  holder.add(ok);
  DialogBoxContents.add(image);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.center();
  dialogBox.show();
}
项目:appinventor-extensions    文件:Ode.java   
/**
 * Possibly display the MIT App Inventor "Splash Screen"
 *
 * @param force Bypass the check to see if they have dimissed this version
 */
private void createWelcomeDialog(boolean force) {
  if (!shouldShowWelcomeDialog() && !force) {
    maybeShowNoProjectsDialog();
    return;
  }
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.createWelcomeDialogText());
  dialogBox.setHeight(splashConfig.height + "px");
  dialogBox.setWidth(splashConfig.width + "px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML(splashConfig.content);
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button ok = new Button(MESSAGES.createWelcomeDialogButton());
  final CheckBox noshow = new CheckBox(MESSAGES.doNotShow());
  ok.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
        if (noshow.getValue()) { // User checked the box
          userSettings.getSettings(SettingsConstants.SPLASH_SETTINGS).
            changePropertyValue(SettingsConstants.SPLASH_SETTINGS_VERSION,
              "" + splashConfig.version);
          userSettings.saveSettings(null);
        }
        maybeShowNoProjectsDialog();
      }
    });
  holder.add(ok);
  holder.add(noshow);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.show();
}
项目:appinventor-extensions    文件:Ode.java   
/**
 * Show a Dialog Box when we receive an SC_PRECONDITION_FAILED
 * response code to any Async RPC call. This is a signal that
 * either our session has expired, or our login cookie has otherwise
 * become invalid. This is a fatal error and the user should not
 * be permitted to continue (many ignore the red error bar and keep
 * working, in vain). So now when this happens, we put up this
 * modal dialog box which cannot be dismissed. Instead it presents
 * just one option, a "Reload" button which reloads the browser.
 * This should trigger a re-authentication (or in the case of an
 * App Inventor upgrade trigging the problem, the loading of newer
 * code).
 */

public void sessionDead() {
  // Create the UI elements of the DialogBox
  final DialogBox dialogBox = new DialogBox(false, true); // DialogBox(autohide, modal)
  dialogBox.setStylePrimaryName("ode-DialogBox");
  dialogBox.setText(MESSAGES.invalidSessionDialogText());
  dialogBox.setWidth("400px");
  dialogBox.setGlassEnabled(true);
  dialogBox.setAnimationEnabled(true);
  dialogBox.center();
  VerticalPanel DialogBoxContents = new VerticalPanel();
  HTML message = new HTML(MESSAGES.sessionDead());
  message.setStyleName("DialogBox-message");
  FlowPanel holder = new FlowPanel();
  Button reloadSession = new Button(MESSAGES.reloadWindow());
  reloadSession.addClickListener(new ClickListener() {
      public void onClick(Widget sender) {
        dialogBox.hide();
        reloadWindow(true);
      }
    });
  holder.add(reloadSession);
  DialogBoxContents.add(message);
  DialogBoxContents.add(holder);
  dialogBox.setWidget(DialogBoxContents);
  dialogBox.show();
}