List of usage examples for com.google.gwt.user.client.ui MenuBar MenuBar
public MenuBar()
From source file:ch.sebastienzurfluh.swissmuseum.parcours.client.view.infos.InfoMenubar.java
License:Open Source License
public InfoMenubar(final AnimationHelper animationHelper, final Widget goBackTo) { this.setStyleName("infoMenuBar"); final AppInfoPanel appInfo = new AppInfoPanel(goBackTo, animationHelper); final InstitutInfoPanel institutInfo = new InstitutInfoPanel(goBackTo, animationHelper); Label benvenon = new Label("Bienvenue au Muse des Suisses dans le Monde"); benvenon.setStyleName("infoMenuBar-title"); this.add(benvenon); MenuBar menu = new MenuBar(); menu.addItem("<img src='resources/images/generic_tiles/logo_parcours.png' class='infoMenuBar-button' />", true, new ScheduledCommand() { @Override/*from w w w .j av a 2s . c om*/ public void execute() { animationHelper.goTo(appInfo, Animation.SLIDE_UP_REVERSE); } }); menu.addItem("<img src='resources/images/generic_tiles/logo_penthes.png' class='infoMenuBar-button' />", true, new ScheduledCommand() { @Override public void execute() { animationHelper.goTo(institutInfo, Animation.SLIDE_UP_REVERSE); } }); this.add(menu); }
From source file:com.appspot.socialinquirer.client.SocialInquirer.java
License:Apache License
/** * Creates the menu bar.//from w w w. j av a2 s . c o m * * @param constants the constants * @param user the user * @return the menu bar */ private MenuBar createMenuBar(final EverScribeConstants constants, final User user) { final boolean enabled = (user != null); final MenuBar menu = new MenuBar(); GWT.runAsync(new RunAsyncCallback() { public void onFailure(Throwable caught) { UiUtils.showErrorDialog(constants, constants.errorCodeDownloadFailed()); } public void onSuccess() { menu.setAutoOpen(true); menu.setAnimationEnabled(true); MenuItem homeMenuItem = new MenuItem(constants.homeMenuName(), new HistoryCommand(HistoryToken.Home)); homeMenuItem.setEnabled(enabled); menu.addItem(homeMenuItem); MenuBar networkMenuItem = new MenuBar(true); networkMenuItem.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.networkMenuName(), networkMenuItem)); MenuItem nfMenuItem = new MenuItem(constants.followersMenuName(), new HistoryCommand(HistoryToken.Network_Followers)); nfMenuItem.setEnabled(enabled); networkMenuItem.addItem(nfMenuItem); nfMenuItem = new MenuItem(constants.followingMenuName(), new HistoryCommand(HistoryToken.Network_Following)); nfMenuItem.setEnabled(enabled); networkMenuItem.addItem(nfMenuItem); nfMenuItem = new MenuItem(constants.recommendedMenuName(), new HistoryCommand(HistoryToken.Network_Recommended)); nfMenuItem.setEnabled(enabled); networkMenuItem.addItem(nfMenuItem); MenuBar activityMenuItem = new MenuBar(true); activityMenuItem.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.activityMenuName(), activityMenuItem)); MenuItem aMenuItem = new MenuItem(constants.tasksMenuName(), new HistoryCommand(HistoryToken.Activity_Tasks)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.pollMenuName(), new HistoryCommand(HistoryToken.Activity_Polls)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.quizMenuName(), new HistoryCommand(HistoryToken.Activity_Quizzes)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.pagesMenuName(), new HistoryCommand(HistoryToken.Activity_Pages)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.messagesMenuName(), new HistoryCommand(HistoryToken.Activity_Messages)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.endorsementsMenuName(), new HistoryCommand(HistoryToken.Activity_Endorsements)); aMenuItem.setEnabled(enabled); activityMenuItem.addItem(aMenuItem); // MenuBar pagesMenuItem = new MenuBar(true); // pagesMenuItem.setAnimationEnabled(true); // menu.addItem(new MenuItem(constants.pagesMenuName(), // pagesMenuItem)); // aMenuItem = new MenuItem(constants // .followingMenuName(), new HistoryCommand(HistoryToken.Pages_Following)); // aMenuItem.setEnabled(enabled); // pagesMenuItem.addItem(aMenuItem); // aMenuItem = new MenuItem(constants // .ownedMenuName(), new HistoryCommand(HistoryToken.Pages_Created)); // aMenuItem.setEnabled(enabled); // pagesMenuItem.addItem(aMenuItem); // aMenuItem = new MenuItem(constants // .recommendedMenuName(), new HistoryCommand(HistoryToken.Pages_Recommended)); // aMenuItem.setEnabled(enabled); // pagesMenuItem.addItem(aMenuItem); MenuBar questionsMenuItem = new MenuBar(true); questionsMenuItem.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.questionsMenuName(), questionsMenuItem)); aMenuItem = new MenuItem(constants.askedMenuName(), new HistoryCommand(HistoryToken.Questions_Asked)); aMenuItem.setEnabled(enabled); questionsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.answeredMenuName(), new HistoryCommand(HistoryToken.Questions_Answered)); aMenuItem.setEnabled(enabled); questionsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.followingMenuName(), new HistoryCommand(HistoryToken.Questions_Following)); aMenuItem.setEnabled(enabled); questionsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.recommendedMenuName(), new HistoryCommand(HistoryToken.Questions_Recommended)); aMenuItem.setEnabled(enabled); questionsMenuItem.addItem(aMenuItem); MenuBar tagsMenuItem = new MenuBar(true); tagsMenuItem.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.tagsMenuName(), tagsMenuItem)); aMenuItem = new MenuItem(constants.ownedMenuName(), new HistoryCommand(HistoryToken.Topics_Active)); aMenuItem.setEnabled(enabled); tagsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.followingMenuName(), new HistoryCommand(HistoryToken.Topics_Following)); aMenuItem.setEnabled(enabled); tagsMenuItem.addItem(aMenuItem); aMenuItem = new MenuItem(constants.recommendedMenuName(), new HistoryCommand(HistoryToken.Topics_Recommended)); aMenuItem.setEnabled(enabled); tagsMenuItem.addItem(aMenuItem); MenuBar accountMenu = new MenuBar(true); accountMenu.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.accountMenuName(), accountMenu)); MenuItem loginMenuItem = new MenuItem(constants.loginMenuName(), new LoginCommand(constants)); loginMenuItem.setEnabled(!enabled); accountMenu.addItem(loginMenuItem); MenuItem logoutMenuItem = new MenuItem(constants.logoutMenuName(), new LogoutCommand(constants)); logoutMenuItem.setEnabled(enabled); accountMenu.addItem(logoutMenuItem); MenuItem settingsMenuItem = new MenuItem(constants.settingsMenuName(), new HistoryCommand(HistoryToken.Settings)); settingsMenuItem.setEnabled(enabled); accountMenu.addItem(settingsMenuItem); } }); return menu; }
From source file:com.gmail.cjbooms.thesis.pythonappengine.client.menus.MainMenuWidget.java
License:Open Source License
private void createMenu() { menu = new MenuBar(); MenuBar fileMenu = createFileMenu(); menu.addItem("File", fileMenu); MenuBar projectMenu = createProjectMenu(); menu.addItem("Project", projectMenu); MenuBar gitMenu = createGITMenu(); menu.addItem("GIT", gitMenu); MenuBar appEngineMenu = createAppEngineMenu(); menu.addItem("AppEngine", appEngineMenu); }
From source file:com.goodow.web.ui.client.nav.MenuBarUi.java
License:Apache License
@Inject MenuBarUi(final Provider<TreeNodePlace> placeProvider, final PlaceController placeController, @Default final TreeNodeProxy root) { this.root = root; logger.finest("init start"); this.placeProvider = placeProvider; this.placeController = placeController; bar = new MenuBar(); bar.setAutoOpen(true);//from w ww. j a va2s .com bar.setWidth("100%"); bar.setAnimationEnabled(true); initWidget(bar); if (LogConfiguration.loggingIsEnabled()) { logger.log(Level.FINEST, "init end"); } }
From source file:com.google.gwt.sample.kitchensink.client.Layouts.java
License:Apache License
public Layouts() { HTML contents = new HTML("This is a <code>ScrollPanel</code> contained at " + "the center of a <code>DockPanel</code>. " + "By putting some fairly large contents " + "in the middle and setting its size explicitly, it becomes a " + "scrollable area within the page, but without requiring the use of " + "an IFRAME." + "Here's quite a bit more meaningless text that will serve primarily " + "to make this thing scroll off the bottom of its visible area. " + "Otherwise, you might have to make it really, really small in order " + "to see the nifty scroll bars!"); ScrollPanel scroller = new ScrollPanel(contents); scroller.setStyleName("ks-layouts-Scroller"); DockPanel dock = new DockPanel(); dock.setHorizontalAlignment(DockPanel.ALIGN_CENTER); HTML north0 = new HTML("This is the <i>first</i> north component", true); HTML east = new HTML("<center>This<br>is<br>the<br>east<br>component</center>", true); HTML south = new HTML("This is the south component"); HTML west = new HTML("<center>This<br>is<br>the<br>west<br>component</center>", true); HTML north1 = new HTML("This is the <b>second</b> north component", true); dock.add(north0, DockPanel.NORTH);/*from www. j ava 2 s .c o m*/ dock.add(east, DockPanel.EAST); dock.add(south, DockPanel.SOUTH); dock.add(west, DockPanel.WEST); dock.add(north1, DockPanel.NORTH); dock.add(scroller, DockPanel.CENTER); FlowPanel flow = new FlowPanel(); for (int i = 0; i < 8; ++i) flow.add(new CheckBox("Flow " + i)); HorizontalPanel horz = new HorizontalPanel(); horz.setVerticalAlignment(VerticalPanel.ALIGN_MIDDLE); horz.add(new Button("Button")); horz.add(new HTML("<center>This is a<br>very<br>tall thing</center>", true)); horz.add(new Button("Button")); VerticalPanel vert = new VerticalPanel(); vert.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); vert.add(new Button("Small")); vert.add(new Button("--- BigBigBigBig ---")); vert.add(new Button("tiny")); MenuBar menu = new MenuBar(); MenuBar menu0 = new MenuBar(true), menu1 = new MenuBar(true); menu.addItem("menu0", menu0); menu.addItem("menu1", menu1); menu0.addItem("child00", (Command) null); menu0.addItem("child01", (Command) null); menu0.addItem("child02", (Command) null); menu1.addItem("child10", (Command) null); menu1.addItem("child11", (Command) null); menu1.addItem("child12", (Command) null); String id = HTMLPanel.createUniqueId(); HTMLPanel html = new HTMLPanel("This is an <code>HTMLPanel</code>. It allows you to add " + "components inside existing HTML, like this:" + "<span id='" + id + "'></span>" + "Notice how the menu just fits snugly in there? Cute."); DOM.setStyleAttribute(menu.getElement(), "display", "inline"); html.add(menu, id); VerticalPanel panel = new VerticalPanel(); panel.setSpacing(8); panel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER); panel.add(makeLabel("Dock Panel")); panel.add(dock); panel.add(makeLabel("Flow Panel")); panel.add(flow); panel.add(makeLabel("Horizontal Panel")); panel.add(horz); panel.add(makeLabel("Vertical Panel")); panel.add(vert); panel.add(makeLabel("HTML Panel")); panel.add(html); initWidget(panel); setStyleName("ks-layouts"); }
From source file:com.google.gwt.sample.showcase.client.content.lists.CwMenuBar.java
License:Apache License
/** * Initialize this example./*ww w .j a v a 2s . co m*/ */ @ShowcaseSource @Override public Widget onInitialize() { // Create a command that will execute on menu item selection Command menuCommand = new Command() { private int curPhrase = 0; private final String[] phrases = constants.cwMenuBarPrompts(); public void execute() { Window.alert(phrases[curPhrase]); curPhrase = (curPhrase + 1) % phrases.length; } }; // Create a menu bar MenuBar menu = new MenuBar(); menu.setAutoOpen(true); menu.setWidth("500px"); menu.setAnimationEnabled(true); // Create a sub menu of recent documents MenuBar recentDocsMenu = new MenuBar(true); String[] recentDocs = constants.cwMenuBarFileRecents(); for (int i = 0; i < recentDocs.length; i++) { recentDocsMenu.addItem(recentDocs[i], menuCommand); } // Create the file menu MenuBar fileMenu = new MenuBar(true); fileMenu.setAnimationEnabled(true); menu.addItem(new MenuItem(constants.cwMenuBarFileCategory(), fileMenu)); String[] fileOptions = constants.cwMenuBarFileOptions(); for (int i = 0; i < fileOptions.length; i++) { if (i == 3) { fileMenu.addSeparator(); fileMenu.addItem(fileOptions[i], recentDocsMenu); fileMenu.addSeparator(); } else { fileMenu.addItem(fileOptions[i], menuCommand); } } // Create the edit menu MenuBar editMenu = new MenuBar(true); menu.addItem(new MenuItem(constants.cwMenuBarEditCategory(), editMenu)); String[] editOptions = constants.cwMenuBarEditOptions(); for (int i = 0; i < editOptions.length; i++) { editMenu.addItem(editOptions[i], menuCommand); } // Create the GWT menu MenuBar gwtMenu = new MenuBar(true); menu.addItem(new MenuItem("GWT", true, gwtMenu)); String[] gwtOptions = constants.cwMenuBarGWTOptions(); for (int i = 0; i < gwtOptions.length; i++) { gwtMenu.addItem(gwtOptions[i], menuCommand); } // Create the help menu MenuBar helpMenu = new MenuBar(true); menu.addSeparator(); menu.addItem(new MenuItem(constants.cwMenuBarHelpCategory(), helpMenu)); String[] helpOptions = constants.cwMenuBarHelpOptions(); for (int i = 0; i < helpOptions.length; i++) { helpMenu.addItem(helpOptions[i], menuCommand); } // Return the menu menu.ensureDebugId("cwMenuBar"); return menu; }
From source file:com.gwtmodel.table.view.pullmenu.PullMenuView.java
License:Apache License
private void addMenu(MenuBar menu, List<MenuPullDesc> bmenu) { for (MenuPullDesc de : bmenu) { if (de.isHeader()) { MenuBar b = new MenuBar(); addMenu(b, de.getbList());// w w w . j a v a2 s .c o m menu.addItem(de.getDisplayName(), b); } else { ControlButtonDesc butt = de.getButt(); menu.addItem(butt.getDisplayName(), new MenuCommand(butt)); } } }
From source file:com.gwtmodel.table.view.pullmenu.PullMenuView.java
License:Apache License
PullMenuView(MenuPullContainer menu, IControlClick click) {
this.menu = menu;
this.click = click;
mbar = new MenuBar();
addMenu(mbar, menu.getMenu());
}
From source file:com.gwtmodel.table.view.util.PopupCreateMenu.java
License:Apache License
public static IGWidget createImageMenu(String imageHtml, final ListOfControlDesc coP, final IControlClick cli) { HorizontalPanel hp = new HorizontalPanel(); MenuBar menu = createMenu(coP, cli, null); MenuBar mp = new MenuBar(); hp.add(mp);// w ww.ja v a 2 s . com mp.addItem(imageHtml, true, menu); return new GWidget(hp); }
From source file:com.qualogy.qafe.gwt.client.factory.MainFactory.java
License:Apache License
public static void createTryMeWindow(String subwindow) { final WindowPanel w = new WindowPanel("Try me!"); w.setResizable(true);/* www .ja v a 2s . c o m*/ w.setAnimationEnabled(true); w.setSize("800px", "500px"); VerticalPanel verticalPanel = new VerticalPanel(); final ScrollLayoutPanel vp = new ScrollLayoutPanel(); vp.setAlwaysShowScrollBars(false); vp.setWidth("800px"); vp.setHeight("500px"); w.setWidget(verticalPanel); // vp.setSpacing(5); // vp.setWidth("100%"); final TabPanel tabPanel = new TabPanel(); tabPanel.setAnimationEnabled(true); tabPanel.setWidth("580px"); tabPanel.setHeight("500px"); DockPanel dockPanel = new DockPanel(); dockPanel.setWidth("580px"); dockPanel.setHeight("500px"); tabPanel.add(dockPanel, "Insert code!"); final TextArea textArea = new TextArea(); textArea.setVisibleLines(30); textArea.setHeight("auto"); textArea.setWidth("580px"); DOM.setElementAttribute(textArea.getElement(), "font-size", "10pt"); dockPanel.add(textArea, DockPanel.CENTER); final MenuBar menu = new MenuBar(); MenuBar renderMenu = new MenuBar(true); w.addResizeHandler(new ResizeHandler() { public void onResize(ResizeEvent event) { int height = event.getHeight(); int width = event.getWidth(); if (w.getWidget() != null) { w.setHeight((height) + "px"); w.setWidth((width) + "px"); vp.setHeight((height - 20) + "px"); vp.setWidth((width - 20) + "px"); tabPanel.setHeight((height - 20) + "px"); tabPanel.setWidth((width - 20) + "px"); menu.setWidth((width) + "px"); textArea.setWidth((width - 20) + "px"); } } }); MenuItem gwtMenuItem = new MenuItem("GWT output", new Command() { public void execute() { String xml = textArea.getText(); if (xml == null || xml.length() == 0) { MessageBox.error("Try me:Error", "There is no input"); } else { MainFactoryActions.processUIXml(xml); } } }); MenuItem flexMenuItem = new MenuItem("Flex output", new Command() { public void execute() { String xml = textArea.getText(); if (xml == null || xml.length() == 0) { MessageBox.error("Try me:Error", "There is no input"); } else { MainFactoryActions.processUIXmlFlex(xml); } } }); renderMenu.addItem(gwtMenuItem); renderMenu.addItem(flexMenuItem); MenuBar codeMenu = new MenuBar(true); MenuItem clearXmlInput = new MenuItem("Clear", new Command() { public void execute() { textArea.setText(""); } }); MenuItem createHeaderButton = new MenuItem("Create Header", new Command() { public void execute() { final String headerText = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" + "<application-mapping xmlns=\"http://qafe.com/schema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://qafe.com/schema http://www.qafe.com/schema/2.2/application-mapping.xsd\"> \n" + " <!-- PLEASE ENTER YOUR CODE HERE --> \n" + "</application-mapping> \n"; textArea.setText(headerText); } }); MenuItem createSampleAppButton = new MenuItem("Create Sample Application", new Command() { public void execute() { final String sampleText = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> \n" + "<application-mapping xmlns=\"http://qafe.com/schema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://qafe.com/schema http://www.qafe.com/schema/2.2/application-mapping.xsd\"> \n" + "<presentation-tier>\n" + " <view>\n" + " <window id=\"window1\" displayname=\"Hello World\" width=\"200\" height=\"200\">\n" + " <rootpanel id=\"myRootPanel\"> \n" + " <verticallayout>\n\n" + " <!-- PLEASE ENTER HERE YOUR CODE -->\n\n" + " <label id=\"mylabel\" displayname=\"Hello World\" />\n\n" + " </verticallayout>\n" + " </rootpanel>\n" + " </window>\n" + " </view>\n" + "</presentation-tier>\n" + "</application-mapping> \n"; textArea.setText(sampleText); } }); codeMenu.addItem(clearXmlInput); codeMenu.addItem(createHeaderButton); codeMenu.addItem(createSampleAppButton); menu.addItem("Render", renderMenu); menu.addItem("Code", codeMenu); if (menu != null) { verticalPanel.add(menu); } verticalPanel.add(vp); // w.setWidget(tabPanel); /* * FMB Upload */ final FormPanel fmbForm = new FormPanel(); fmbForm.setAction(GWT.getModuleBaseURL() + "/rpc.fmbupload"); // Because we're going to add a FileUpload widget, we'll need to set the // form to use the POST method, and multipart MIME encoding. fmbForm.setEncoding(FormPanel.ENCODING_MULTIPART); fmbForm.setMethod(FormPanel.METHOD_POST); // Create a panel to hold all of the form widgets. VerticalPanel panelFmbUpload = new VerticalPanel(); panelFmbUpload.setWidth("580px"); panelFmbUpload.setHeight("500px"); // panelFmbUpload.setHeight("100%"); final FileUpload fmbFile = new FileUpload(); final TextBox emailBox = new TextBox(); final TextBox phoneBox = new TextBox(); fmbFile.setName("fmbUploadElement"); // Add an event handler to the form. fmbForm.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { public void onSubmitComplete(SubmitCompleteEvent event) { if (event.getResults() != null) { if (event.getResults().startsWith("Conversion failed")) { ClientApplicationContext.getInstance().log("Conversion failed", "The file doesn't seem to be a valid Oracle Forms file. If you still want it to be converted for demo purpose, you can also send it to info@qafe.com", true); } else if (event.getResults().startsWith("UUID")) { String[] split = event.getResults().split("="); if (split.length == 2) { String uuid = split[1]; MainFactoryActions.processUIByUUID(uuid, textArea); MainFactoryActions.notify("FMB uploaded with filename [" + fmbFile.getFilename() + "]", "The message was sent by " + emailBox.getText() + " with optional phonenr: " + phoneBox.getText()); tabPanel.selectTab(0); } } else { // firefox workaround String[] split = event.getResults().split("="); if (split.length == 2) { String uuid = split[1]; uuid = uuid.replaceAll("</pre>", ""); MainFactoryActions.processUIByUUID(uuid, textArea); MainFactoryActions.notify("FMB uploaded with filename [" + fmbFile.getFilename() + "]", "The message was sent by " + emailBox.getText() + " with optional phonenr: " + phoneBox.getText()); tabPanel.selectTab(0); } else { ClientApplicationContext.getInstance().log(event.getResults()); } } } else { ClientApplicationContext.getInstance().log( "The Forms Conversion process could not handle this file. Please check the file.", "Check whether or not this file is an FMB (not an FMX)", true); } } }); FlexTable tempFmbPanel = new FlexTable(); tempFmbPanel.setWidget(0, 1, fmbFile); tempFmbPanel.setWidget(0, 0, new Label("Input for FMB")); tempFmbPanel.setWidget(1, 0, new HTML( "<p>Note: the FMB you are uploading is only for <span style=\"color:red;\">demo</span> purpose.</p>" + "<p>FMB's can have external dependencies like <span style=\"color:red;\">PLL, OLB's, images</span>,etc. Since they are <span style=\"color:red;\">not</span> included in the upload, the output might not appear correct.</p>" + "<p>For a more detailed conversion of your FMB's please contact us at <span style=\"color:red;\">info@qafe.com </span></p> <p/>" + "<p>Please fill in the information below, so that we can contact you for more information</p> ")); tempFmbPanel.getFlexCellFormatter().setColSpan(1, 0, 2); tempFmbPanel.setWidget(2, 0, new Label("E-mail: (required)")); emailBox.setName("fmbEmail"); emailBox.addBlurHandler(new BlurHandler() { public void onBlur(BlurEvent event) { String textValue = ((TextBoxBase) event.getSource()).getText(); if (textValue != null) { if (textValue.replaceFirst(TextFieldGVO.REGEXP_TYPE_EMAIL_VALUE, "").length() > 0) { ClientApplicationContext.getInstance().log("Email validation error", TextFieldGVO.TYPE_EMAIL_DEFAULT_MESSAGE, true); } } } }); tempFmbPanel.setWidget(2, 1, emailBox); tempFmbPanel.setWidget(3, 0, new Label("Phonenr:")); phoneBox.setName("fmbPhone"); phoneBox.addBlurHandler(new BlurHandler() { public void onBlur(BlurEvent event) { } }); tempFmbPanel.setWidget(3, 1, phoneBox); fmbForm.add(tempFmbPanel); panelFmbUpload.add(fmbForm); // Add a 'submit' button. panelFmbUpload.add(new Button("Generate", new ClickHandler() { public void onClick(ClickEvent event) { fmbForm.submit(); } })); // Add an event handler to the form. fmbForm.addSubmitHandler(new FormPanel.SubmitHandler() { public void onSubmit(SubmitEvent event) { // This event is fired just before the form is submitted. We can take // this opportunity to perform validation. if (emailBox.getText().length() == 0) { ClientApplicationContext.getInstance().log("Email validation error", "Please fill in your email address", true); event.cancel(); } else if (fmbFile.getFilename() == null || fmbFile.getFilename().length() == 0) { ClientApplicationContext.getInstance().log("Uploaded file validation error", "There is no file selected. Please select one to continue", true); event.cancel(); } } }); tabPanel.add(panelFmbUpload, "Forms Conversion"); vp.add(tabPanel); w.center(); if (QAFEKeywordsGVO.SYSTEM_MENUITEM_TRYME_FORMS.equals(subwindow)) { tabPanel.selectTab(1); } else { tabPanel.selectTab(0); } }