List of usage examples for com.google.gwt.user.client.ui ValueBoxBase addFocusHandler
public HandlerRegistration addFocusHandler(FocusHandler handler)
From source file:cc.kune.gspace.client.share.ShareToOthersPanel.java
License:Open Source License
@Inject public ShareToOthersPanel(final I18nUITranslationService i18n, final ShareToOthersDropController dropController) { this.dropController = dropController; final FlowPanel flow = new FlowPanel(); flow.addStyleName("k-share-others"); multivalueSBox = SearchBoxFactory.create(i18n, false, true, SEARCH_TEXTBOX_ID, new OnEntitySelectedInSearch() { @Override/*from w w w . j a va2 s. c o m*/ public void onSeleted(final String shortName) { if (addListener != null) { addListener.onAdd(shortName); } } }); final SuggestBox suggestBox = multivalueSBox.getSuggestBox(); final ValueBoxBase<String> searchTextBox = suggestBox.getValueBox(); final Label suggestBoxIntro = new Label(I18n.t("drag and drop to add people or")); final Label suggestTextWhenEmpty = new Label(I18n.t("search to add")); flow.add(suggestBoxIntro); flow.add(multivalueSBox); flow.add(suggestTextWhenEmpty); multivalueSBox.addStyleName("k-share-searchbox"); suggestTextWhenEmpty.addStyleName("k-share-searchbox-text"); suggestTextWhenEmpty.addStyleName("k-clean"); initWidget(flow); // Search box settings suggestTextWhenEmpty.addClickHandler(new ClickHandler() { @Override public void onClick(final ClickEvent event) { suggestBox.setFocus(true); } }); searchTextBox.addFocusHandler(new FocusHandler() { @Override public void onFocus(final FocusEvent event) { // searchLabel.setVisible(false); suggestTextWhenEmpty.getElement().getStyle().setVisibility(Visibility.HIDDEN); } }); searchTextBox.addBlurHandler(new BlurHandler() { @Override public void onBlur(final BlurEvent event) { if (searchTextBox.getValue().isEmpty()) { suggestTextWhenEmpty.getElement().getStyle().setVisibility(Visibility.VISIBLE); } } }); // Tooltips Tooltip.to(suggestBox, I18n.t(NOT_LIST_TOOLTIP)); Tooltip.to(suggestTextWhenEmpty, I18n.t(NOT_LIST_TOOLTIP)); Tooltip.to(suggestBoxIntro, I18n.t(NOT_LIST_TOOLTIP)); // D&D dropController.init(flow); }
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.."); }/* www . ja v a 2 s.c om*/ 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:fr.putnami.pwt.core.widget.client.mask.MaskValueBoxHelper.java
License:Open Source License
public MaskValueBoxHelper(ValueBoxBase<String> valueBox) { this.valueBox = valueBox; valueBox.addKeyDownHandler(this); valueBox.addKeyUpHandler(this); valueBox.addKeyPressHandler(this); valueBox.addBlurHandler(this); valueBox.addFocusHandler(this); valueBox.addMouseUpHandler(this); }
From source file:org.zoxweb.client.widget.ValueFilterHandler.java
License:Apache License
/** * //from ww w.jav a 2 s .c o m * @param widget * @param vf * @param errorStyleName */ public ValueFilterHandler(ValueBoxBase<V> widget, ValueFilter<V, V> vf, String errorStyleName) { this.widget = widget; defaultStyleName = widget.getStyleName(); this.errorStyleName = errorStyleName; this.vf = vf; hrList = new ArrayList<HandlerRegistration>(); hrList.add(widget.addKeyUpHandler(this)); hrList.add(widget.addFocusHandler(this)); }