List of usage examples for com.google.gwt.event.dom.client FocusHandler FocusHandler
FocusHandler
From source file:com.google.gerrit.client.diff.Unified.java
License:Apache License
@Override FocusHandler getFocusHandler() {/*from w w w .j a v a 2 s .c o m*/ return new FocusHandler() { @Override public void onFocus(FocusEvent event) { cm.focus(); } }; }
From source file:com.google.gerrit.client.ui.HintTextBox.java
License:Apache License
public void setHintText(String text) { if (text == null) { if (hintText == null) { // was not set, still not set, no change. return; }/*from ww w . ja va2s . c om*/ // Clearing a previously set Hint hintFocusHandler.removeHandler(); hintFocusHandler = null; hintBlurHandler.removeHandler(); hintBlurHandler = null; keyDownHandler.removeHandler(); keyDownHandler = null; hintText = null; focusHint(); return; } // Setting Hints if (hintText == null) { // first time (was not already set) hintText = text; hintFocusHandler = addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { focusHint(); prevText = getText(); isFocused = true; } }); hintBlurHandler = addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { blurHint(); isFocused = false; } }); /* * There seems to be a strange bug (at least on firefox 3.5.9 ubuntu) with * the textbox under the following circumstances: * 1) The field is not focused with BText in it. * 2) The field receives focus and a focus listener changes the text to FText * 3) The ESC key is pressed and the value of the field has not changed * (ever) from FText * 4) BUG: The text value gets reset to BText! * * A counter to this bug seems to be to force setFocus(false) on ESC. */ /* Chrome does not create a KeyPressEvent on ESC, so use KeyDownEvents */ keyDownHandler = addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(final KeyDownEvent event) { onKey(event.getNativeKeyCode()); } }); } else { // Changing an already set Hint focusHint(); hintText = text; } if (!isFocused) { blurHint(); } }
From source file:com.google.gerrit.client.ui.OnEditEnabler.java
License:Apache License
public void listenTo(final TextBoxBase tb) { strings.put(tb, tb.getText());/* w ww .ja v a 2 s. c o m*/ tb.addKeyPressHandler(this); // Is there another way to capture middle button X11 pastes in browsers // which do not yet support ONPASTE events (Firefox)? tb.addMouseUpHandler(this); // Resetting the "original text" on focus ensures that we are // up to date with non-user updates of the text (calls to // setText()...) and also up to date with user changes which // occured after enabling "widget". tb.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { strings.put(tb, tb.getText()); } }); // CTRL-V Pastes in Chrome seem only detectable via BrowserEvents or // KeyDownEvents, the latter is better. tb.addKeyDownHandler(this); }
From source file:com.google.gerrit.client.ui.RemoteSuggestBox.java
License:Apache License
public void enableDefaultSuggestions() { textBox.addFocusHandler(new FocusHandler() { @Override// w ww .j a v a 2s.c o m public void onFocus(FocusEvent focusEvent) { if (textBox.getText().equals("")) { suggestBox.showSuggestionList(); } } }); }
From source file:com.google.gerrit.client.ui.TextBoxChangeListener.java
License:Apache License
public TextBoxChangeListener(final TextBoxBase tb) { oldText = tb.getText();//from ww w. ja v a 2 s . c om tb.addKeyPressHandler(this); // Is there another way to capture middle button X11 pastes in browsers // which do not yet support ONPASTE events (Firefox)? tb.addMouseUpHandler(this); // Resetting the "original text" on focus ensures that we are // up to date with non-user updates of the text (calls to // setText()...) and also up to date with user changes which // occurred after enabling "widget". tb.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { oldText = tb.getText(); } }); // CTRL-V Pastes in Chrome seem only detectable via BrowserEvents or // KeyDownEvents, the latter is better. tb.addKeyDownHandler(this); }
From source file:com.google.gwt.sample.stockwatcher.client.OntologyBasedContentManagement.java
@SuppressWarnings("deprecation") @Override/*w w w.jav a2 s .c o m*/ public void onModuleLoad() { /* * Create file interface */ // Create a FormPanel and point it at a service. form = new FormPanel(); form.setAction(GWT.getModuleBaseURL() + "greet"); form.setEncoding(FormPanel.ENCODING_MULTIPART); form.setMethod(FormPanel.METHOD_POST); form.setWidget(secondPanel); // secondPanel.add(statusLabel); // fileUpload.setName(form.getTitle()); fileUpload.setName("UploadFile"); secondPanel.add(fileUpload); uploadedOntologies.add(loadFile); ClickHandler load_handler = new ClickHandler() { @Override public void onClick(final ClickEvent event) { form.submit(); } }; loadFile.addClickHandler(load_handler); ontologies = new ListBox(); ontologies.setSize("152px", "18px"); uploadedOntologies.add(ontologies); uploadedOntologies.setSpacing(5); // secondPanel.add(uploadedOntologies); /* * end file creation */ logger.log(Level.SEVERE, "Log!"); Ont_Table.setText(1, 0, "Class"); // 3 columns Ont_Table.setText(1, 2, "Object Property"); Ont_Table.setText(1, 4, "Data Property"); double wi = Window.getClientWidth() / 3.5; String tablewidth = Double.toString(wi); tripleTable.getColumnFormatter().setWidth(0, tablewidth); tripleTable.getColumnFormatter().setWidth(1, tablewidth); tripleTable.getColumnFormatter().setWidth(2, tablewidth); tripleTable.setStyleName("Prompt-User"); tripleTable.setText(0, 0, "Subject"); tripleTable.setText(0, 1, "Predicate"); tripleTable.setText(0, 2, "Object"); tripleTable.getRowFormatter().addStyleName(0, "Prompt-User"); tripleTable.getColumnFormatter().addStyleName(0, "columnOne"); tripleTable.getColumnFormatter().addStyleName(1, "columnTwo"); tripleTable.getColumnFormatter().addStyleName(2, "columnThree"); tripleTable.addStyleName("tripleTable"); row = tripleTable.getRowCount(); webBox.setText(url); webBox.setWidth("340px"); frameWidth = String.valueOf(Window.getClientWidth() / 3.3) + "px"; queryBox.setText("\n\n\n\n\n\t\t\t\t\tEnter Query"); queryBox.setSize("369px", "332px"); queryBox.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { queryBox.selectAll(); } }); ontology_from_disk.setText("/Users/markhender/ontologies/pizzas/pizza.rdf"); ontology_from_disk.setWidth("340px"); frame = new Frame(); frame.setUrl(url); frameWidth = String.valueOf(Window.getClientWidth() / 1.5) + "px"; // works // cross // browsers frameHeight = String.valueOf(String.valueOf(Window.getClientHeight() / 1.3) + "px"); frame.setWidth(frameWidth); frame.setHeight(frameHeight); frame.setVisible(true); /* * Popup Panel */ popupHolder.add(closePopup); popup.setWidget(popupContents); closePopup.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { int end_of_list = ft.getRowCount(); int count = 1; while (count < end_of_list) { logger.log(Level.SEVERE, "line"); CheckBox box = (CheckBox) ft.getWidget(count, 3); if (box.getValue()) { // tripleTable.setText(tripleTable.getRowCount(), 0, // ft.getText(count, 0)); printSuggestedSubject(ft.getText(count, 0)); addPredicate(ft.getText(count, 1)); if (ft.getText(count, 1).endsWith("*")) addLitObject(ft.getText(count, 2)); else addObject(ft.getText(count, 2)); } count++; } logger.log(Level.SEVERE, "BINGO"); ft.removeAllRows(); popup.hide(); popupContents.clear(); popupContents.add(popupHolder); } }); content.setText("Search for content in webpage"); content.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { content.setFocus(true); if (content.getText().equals("Search for content in webpage")) content.setText(""); else content.selectAll(); } }); addPanel.add(webBox); searchPanel.add(content); // content search box searchPanel.add(search); // trigger content search button search.setHeight("37px"); dBox.setText("Triple Report"); close.setText("Close"); close.addClickListener(new ClickListener() { @Override public void onClick(Widget sender) { dialogBoxContents.clear(); dBox.hide(); } }); dialogBoxholder.add(close); loadOntologyInternet.add(ontology_from_internet); loadOntologyInternet.add(load_ontology_web_button); radioButtonPanel.add(radioA); radioButtonPanel.add(radioB); searchPanel.add(radioButtonPanel); bottomOfScreen.add(searchPanel); bottomOfScreen.add(tripleTable); tripleTable.setSize("981px", "67px"); // bottomOfScreen.setSpacing(10); search.setText("Enter"); content.setSize("282px", "29px"); ListBox listbox = new ListBox(); ontology_Classes = new ListBox(); // Ontology class listbox property_Resources = new ListBox(); // " property listbox property_Literals = new ListBox(); // " individual listbox ontology_Classes.setWidth("100px"); property_Resources.setWidth("100px"); property_Literals.setWidth("100px"); listbox.setWidth("100px"); listbox.setHeight("400px"); save.setText("Save"); listbox.setVisible(false); /* * before new page */ final PopupPanel contextpanel = new PopupPanel(); final Button ok = new Button("OK"); final HorizontalPanel hori = new HorizontalPanel(); contextpanel.setWidget(hori); entercontext.setText("context"); hori.add(ok); final ClickHandler download_handler = new ClickHandler() { @Override public void onClick(ClickEvent event) { greetingService.downloadRepository(entercontext.getText(), new downloadRepository()); if (repository_downloaded) loadPageTwo(export_fp); repository_downloaded = true; logger.log(Level.SEVERE, "download_handler called"); } }; ClickHandler newpage_handler = new ClickHandler() { @Override public void onClick(ClickEvent event) { contextpanel.center(); ok.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { if (repository_downloaded) loadPageTwo(export_fp); else { download_handler.onClick(event); } contextpanel.hide(); } }); logger.log(Level.SEVERE, "export path: " + filepathofexport); } }; new_page.addClickHandler(newpage_handler); download_repository.addClickHandler(download_handler); /* Return to homepage */ home_page.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { loadHomePage(); } }); /* home page */ //mainPanel.add(frame); // browser mainPanel.add(uploadedOntologies); mainPanel.add(addPanel); // url for browser addPanel.add(webSend); webSend.setHeight("32px"); webSend.setText("GO"); // Listen for mouse events on webSend Button // to get new website webSend.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { frame.setUrl(webBox.getText()); // take url from textbox logger.log(Level.SEVERE, frame.getUrl()); content.setFocus(true); content.selectAll(); } }); mainPanel.add(loadOntologyInternet); mainPanel.add(Ont_Table); // listboxes mainPanel.add(queryBox); mainPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_RIGHT); mainPanel.add(queryButton); mainPanel.add(new_page); mainPanel.add(download_repository); RootPanel.get("stockList").add(frame, RootPanel.get("stockList").getAbsoluteLeft(), RootPanel.get("stockList").getAbsoluteTop()); RootPanel.get("stockList").add(bottomOfScreen, 0, 725); bottomOfScreen.setSize("984px", "128px"); RootPanel.get("stockList").add(form, frame.getOffsetWidth() + 10, frame.getAbsoluteTop()); RootPanel.get("stockList").add(mainPanel, frame.getOffsetWidth() + 10, form.getOffsetHeight() + frame.getAbsoluteTop()); // listen for keyboard events in the textbox webBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { frame.setUrl(webBox.getText()); content.setFocus(true); content.selectAll(); } } }); frame.addLoadHandler(new LoadHandler() { @Override public void onLoad(LoadEvent event) { } }); final AsyncCallback<ArrayList<String>> ontology_class = new AsyncCallback<ArrayList<String>>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(ArrayList<String> result) { classes = result; ontology.get(ontology.size() - 1).setClasses(result); if (ontology.size() == 1) populate_ClassBox(0); } }; final AsyncCallback<ArrayList<String>> property_resource = new AsyncCallback<ArrayList<String>>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(ArrayList<String> result) { properties = result; ontology.get(ontology.size() - 1).setProperties(result); if (ontology.size() == 1) populate_PropertyBox(0); } }; final AsyncCallback<ArrayList<String>> property_literal = new AsyncCallback<ArrayList<String>>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(ArrayList<String> result) { literals = result; ontology.get(ontology.size() - 1).setLiterals(result); if (ontology.size() == 1) populate_LiteralBox(0); } }; load_ontology_web_button.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { // TODO load ontologies from a web address } }); final AsyncCallback<Integer[]> subjectIndexOfContent = new AsyncCallback<Integer[]>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub } @Override public void onSuccess(Integer[] result) { if (result[0] != -99 && result[1] != -99) { // word found printSubject(); } else Window.alert("Word not found"); } }; final AsyncCallback<String> getOntName = new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(String result) { ontName = result; ontology.get(ontology.size() - 1).setName(result); logger.log(Level.SEVERE, ("OntologyName = " + ontName)); } }; final AsyncCallback<String> geturi = new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(String result) { baseURI = result; ontology.get(ontology.size() - 1).setBaseURI(result); logger.log(Level.SEVERE, "The baseURI is " + baseURI); } }; final AsyncCallback<ArrayList<String[]>> suggestedTriples = new AsyncCallback<ArrayList<String[]>>() { @Override public void onFailure(Throwable caught) { } @Override public void onSuccess(ArrayList<String[]> result) { logger.log(Level.SEVERE, "First"); populateSuggestedTriples(result); Window.alert("Pass"); } }; tripleTable.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { com.google.gwt.user.client.ui.HTMLTable.Cell cell = tripleTable.getCellForEvent(event); int cellIndex = cell.getCellIndex(); int rowIndex = cell.getRowIndex(); if (cellIndex == 4 || cellIndex == 0) { logger.log(Level.SEVERE, "Sending: " + tripleTable.getText(rowIndex, 0)); greetingService.suggestedTriples(tripleTable.getHTML(rowIndex, 0), suggestedTriples); } } }); search.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String blah = content.getText(); if (radioA.isChecked() || !radioB.isChecked()) greetingService.wordExists(blah, webBox.getText(), subjectIndexOfContent); else { printSubject(); } content.setFocus(true); content.selectAll(); } }); content.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { if (radioA.isChecked() || !radioB.isChecked()) greetingService.wordExists(content.getText(), webBox.getText(), subjectIndexOfContent); else printSubject(); content.setFocus(true); content.selectAll(); } } }); save.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { String[] temp = new String[3]; temp = getTriples(); repository_downloaded = false; } }); Ont_Table.setWidget(0, 2, menuBar); menuBar.setSize("100%", "100%"); Classes = new MenuItem("Classes", false, menuBar_3); Ontology_Contents_Holder.addItem(Classes); menuBar_2.addItem(mntmObject); menuBar_2.addItem(mntmData); Ontology_Contents_Holder.addItem(Properties); menuBar.addItem(Ontology_Name); Ont_Table.setWidget(2, 2, property_Resources); Ont_Table.setWidget(2, 4, property_Literals); /* * Adding Change listener to listboxes */ ontologies.addChangeListener(new ChangeListener() { @Override public void onChange(Widget sender) { int listIndex = ontologies.getSelectedIndex(); populate_ClassBox(listIndex); populate_PropertyBox(listIndex); populate_LiteralBox(listIndex); } }); ontology_Classes.addChangeListener(new ChangeListener() { @Override public void onChange(Widget sender) { int listIndex = ontology_Classes.getSelectedIndex(); String uri = ontology.get(ontologies.getSelectedIndex()).getBaseURI(); String item = uri + ontology_Classes.getItemText(listIndex); addObject(item); } }); property_Resources.addChangeListener(new ChangeListener() { @Override public void onChange(Widget sender) { // TODO Auto-generated method stub int listIndex = property_Resources.getSelectedIndex(); logger.log(Level.SEVERE, property_Resources.getItemText(listIndex)); if (!(property_Resources.getItemText(listIndex).equals("RDF.type"))) { logger.log(Level.SEVERE, "not rdf.type"); String uri = ontology.get(ontologies.getSelectedIndex()).getBaseURI(); String item = uri + property_Resources.getItemText(listIndex); addPredicate(item); } else { logger.log(Level.SEVERE, "rdf.type"); String item = property_Resources.getItemText(listIndex); addPredicate(item); } } }); property_Literals.addChangeListener(new ChangeListener() { @Override public void onChange(Widget sender) { if (property_Literals.getItemCount() == 0) Window.alert("This list is empty!"); else { int listIndex = property_Literals.getSelectedIndex(); String uri = ontology.get(ontologies.getSelectedIndex()).getBaseURI(); String item = uri + property_Literals.getItemText(listIndex); addPredicate(item); } } }); /* * File submit handling */ form.addFormHandler(new FormHandler() { @Override public void onSubmit(FormSubmitEvent event) { // logger.log(Level.SEVERE, "form title: "+ // fileUpload.getFilename().substring(fileUpload.getFilename().lastIndexOf('\\') // + 1)); ontName = fileUpload.getFilename().substring(fileUpload.getFilename().lastIndexOf('\\') + 1); } @Override public void onSubmitComplete(FormSubmitCompleteEvent event) { // TODO Auto-generated method stub } }); form.addSubmitCompleteHandler(new FormPanel.SubmitCompleteHandler() { @Override public void onSubmitComplete(SubmitCompleteEvent event) { logger.log(Level.SEVERE, "form title: " + form.getTitle()); form.reset(); AsyncCallback<String> pathfile = new AsyncCallback<String>() { @Override public void onFailure(Throwable caught) { // TODO Auto-generated method stub Window.alert("Fail"); } @Override public void onSuccess(String result) { // TODO Auto-generated method stub path_of_uploaded_file = result; ontology.get(ontology.size() - 1).setFilePath(result); Window.alert("Pass"); greetingService.greetServer(list, path_of_uploaded_file, 1, ontology_class); greetingService.greetServer(list, path_of_uploaded_file, 2, property_resource); greetingService.greetServer(list, path_of_uploaded_file, 3, property_literal); ontologies.addItem(ontology.get(ontology.size() - 1).getName()); // logger.log(Level.SEVERE, baseURI); } }; greetingService.filePath(pathfile); greetingService.getBaseURI(geturi); // greetingService.getOntName(getOntName); ontology.add(new Ontology(ontName, path_of_uploaded_file, baseURI, classes, properties, literals)); // greetingService.getOntName(getOntName); if (ontology.size() == 1) { // populate_listBoxes(); } logger.log(Level.SEVERE, "baseuri = " + baseURI); } }); }
From source file:com.google.livingstories.client.contentmanager.ContentItemManager.java
License:Apache License
private Widget createEventAttributesPanel() { dateTrigger = new TextBox(); dateTrigger.setVisibleLength(LONG_TEXTBOX_VISIBLE_LENGTH); dateTrigger.setReadOnly(true);// w w w. j ava 2 s .c om dateTrigger.setStylePrimaryName("dateTriggerBox"); createDatePickerPanel(); updateEditor = new TextBox(); updateEditor.setVisibleLength(LONG_TEXTBOX_VISIBLE_LENGTH); summaryEditor = new RichTextEditor(); Label updateTitle = new Label("Update"); updateTitle.setStylePrimaryName("header"); Label summaryTitle = new Label("Summary"); summaryTitle.setStylePrimaryName("header"); VerticalPanel eventPanel = new VerticalPanel(); eventPanel.add(new Label("Event Date:")); eventPanel.add(dateTrigger); eventPanel.add(updateTitle); eventPanel.add(updateEditor); eventPanel.add(summaryTitle); eventPanel.add(summaryEditor); dateTrigger.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { datePopup.showRelativeTo(dateTrigger); } }); dateTrigger.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { datePopup.showRelativeTo(dateTrigger); } }); return eventPanel; }
From source file:com.google.testing.testify.risk.frontend.client.view.widgets.EditableLabel.java
License:Apache License
public EditableLabel() { initWidget(uiBinder.createAndBindUi(this)); deckPanel.showWidget(LABEL_INDEX);//from w w w. j av a 2 s. co m // When we receive focus, switch to edit mode. focusPanel.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { switchToEdit(); } }); // When the label is clicked, switch to edit mode. label.addClickHandler(new ClickHandler() { @Override public void onClick(ClickEvent event) { switchToEdit(); } }); // When focus leaves the text area, switch to display/readonly mode. textArea.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { switchToLabel(); } }); // On key Enter, commit the text and fire a change event. // On key Down, revert the text if the user presses escape. textArea.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) { switchToLabel(); } else if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { textArea.setText(label.getText()); switchToLabel(); } } }); }
From source file:com.googlecode.mgwt.ui.client.widget.base.MValueBoxBase.java
License:Apache License
public MValueBoxBase(InputAppearance appearance, final ValueBoxBase<T> box) { this.appearance = appearance; if (!(box instanceof HasSource)) { throw new IllegalStateException("box must implement HasSource.."); }//from w ww . j av a 2s . co m this.box = box; box.addStyleName(appearance.css().box()); main = new TouchPanel(); initWidget(main); setEnabled(true); setInvalid(false); main.add(box); if (MGWT.getOsDetection().isAndroid4_3_orLower()) { main.addStyleName(appearance.css().fixWhiteBackgroundBugOnAndroid43AndLower()); box.addStyleName(appearance.css().fixWhiteBackgroundBugOnAndroid43AndLower()); } ((HasSource) box).setSource(this); box.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { MGWT.fixIOSScrollIssueBlur(); } }); box.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { MGWT.fixIOSScrollIssueFocus(); } }); }
From source file:com.googlecode.mgwt.ui.client.widget.input.MDateBox.java
License:Apache License
public MDateBox(InputAppearance appearance) { super(appearance, new DateValueBoxBase(new DateRenderer(), new DateParser())); format = DEFAULT_FORMAT;//www .j a v a2 s . c o m setPlaceHolder(DEFAULT_FORMAT.getPattern()); addStyleName(appearance.css().textBox()); // fix ios issue with onchange event if (MGWT.getOsDetection().isAndroid4_4_OrHigher()) { // only set input type to date if there is a native picker impl.setType(box.getElement(), "date"); // use w3c format format = W3C_FORMAT; } if (MGWT.getOsDetection().isRetina()) { // IOS needs a workaround for empty date picker // Since it will not render them properly (iOS7) format = W3C_FORMAT; box.addFocusHandler(new FocusHandler() { @Override public void onFocus(FocusEvent event) { impl.setType(box.getElement(), "date"); } }); box.addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { impl.setType(box.getElement(), "text"); } }); } if (MGWT.getOsDetection().isIPadRetina() || MGWT.getOsDetection().isIPad()) { // for iPad workaround does not work // adding default date, not happy about this impl.setType(box.getElement(), "date"); format = W3C_FORMAT; Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { box.setValue(new Date()); } }); } // apply format to parsers getBox().getDateParser().setFormat(format); getBox().getDateRenderer().setFormat(format); if (MGWT.getOsDetection().isIOs()) { addBlurHandler(new BlurHandler() { @Override public void onBlur(BlurEvent event) { Scheduler.get().scheduleDeferred(new ScheduledCommand() { @Override public void execute() { Date value = box.getValue(); ValueChangeEvent.fireIfNotEqual(box, lastValue, value); lastValue = value; } }); } }); lastValue = null; } }