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(); }
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); } } } ); }
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()); } } }); }
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 ); }
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); }
/** * 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); }
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); } }
public FooterScreen() { HorizontalPanel panel = new HorizontalPanel(); HTML label = new HTML("OneCMDB 1.4.0 Beta © 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); }
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); }
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()); }
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(); }
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); }
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); }
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); }
/** * */ 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); } }
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; }
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); }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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; }
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(); } }); }
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; }
@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(); }
@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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }
/** * 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(); }