當前位置: 首頁>>代碼示例>>Java>>正文


Java FocusEvent類代碼示例

本文整理匯總了Java中com.google.gwt.event.dom.client.FocusEvent的典型用法代碼示例。如果您正苦於以下問題:Java FocusEvent類的具體用法?Java FocusEvent怎麽用?Java FocusEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FocusEvent類屬於com.google.gwt.event.dom.client包,在下文中一共展示了FocusEvent類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onFocus

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onFocus(FocusEvent event) {
	debug("VComboBoxMultiselect: onFocus()");

	/*
	 * When we disable a blur event in ie we need to refocus the textfield.
	 * This will cause a focus event we do not want to process, so in that
	 * case we just ignore it.
	 */
	if (BrowserInfo.get()
		.isIE() && this.iePreventNextFocus) {
		this.iePreventNextFocus = false;
		return;
	}

	this.focused = true;
	updatePlaceholder();
	addStyleDependentName("focus");

	this.connector.sendFocusEvent();

	this.connector.getConnection()
		.getVTooltip()
		.showAssistive(this.connector.getTooltipInfo(getElement()));
}
 
開發者ID:bonprix,項目名稱:vaadin-combobox-multiselect,代碼行數:26,代碼來源:VComboBoxMultiselect.java

示例2: addFocusHandler

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
  if (!focusHandlerAdded) {
    focusHandlerAdded = true;
    final OrionTextViewOverlay textView = this.editorOverlay.getTextView();
    textView.addEventListener(
        OrionEventConstants.FOCUS_EVENT,
        new OrionTextViewOverlay.EventHandlerNoParameter() {

          @Override
          public void onEvent() {
            fireFocusEvent();
          }
        });
  }
  return addHandler(handler, FocusEvent.getType());
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:18,代碼來源:OrionEditorWidget.java

示例3: View

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
View(Window.Resources res, boolean showBottomPanel) {
  this.res = res;
  this.css = res.windowCss();
  windowWidth = com.google.gwt.user.client.Window.getClientWidth();
  clientLeft = Document.get().getBodyOffsetLeft();
  clientTop = Document.get().getBodyOffsetTop();
  initWidget(uiBinder.createAndBindUi(this));
  footer = new HTMLPanel("");
  if (showBottomPanel) {
    footer.setStyleName(res.windowCss().footer());
    contentContainer.add(footer);
  }
  handleEvents();

  FocusPanel dummyFocusElement = new FocusPanel();
  dummyFocusElement.setTabIndex(0);
  dummyFocusElement.addFocusHandler(
      new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
          setFocus();
        }
      });
  contentContainer.add(dummyFocusElement);
}
 
開發者ID:eclipse,項目名稱:che,代碼行數:26,代碼來源:View.java

示例4: listenTo

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
public void listenTo(TextBoxBase tb) {
  strings.put(tb, tb.getText().trim());
  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) {
          strings.put(tb, tb.getText().trim());
        }
      });

  // CTRL-V Pastes in Chrome seem only detectable via BrowserEvents or
  // KeyDownEvents, the latter is better.
  tb.addKeyDownHandler(this);
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:25,代碼來源:OnEditEnabler.java

示例5: EnumEditorViewImpl

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
EnumEditorViewImpl(final List<String> enumValues, final List<String> enumDescriptions) {
  // Sets up a SuggestOracle that, when the textbox has focus, displays the
  // valid enum values and their descriptions.
  MultiWordSuggestOracle oracle = new MultiWordSuggestOracle();
  List<Suggestion> suggestions = Lists.newArrayList();
  for (int i = 0; i < enumValues.size(); i++) {
    suggestions.add(new EnumSuggestion(
        enumValues.get(i), enumDescriptions == null ? "" : enumDescriptions.get(i)));
  }
  oracle.setDefaultSuggestions(suggestions);
  this.suggestBox = new SuggestBox(oracle);
  suggestBox.getTextBox().addFocusHandler(new FocusHandler() {
    @Override
    public void onFocus(FocusEvent event) {
      suggestBox.showSuggestionList();
    }
  });
  add(suggestBox);

  this.errorMessage = new Label("This parameter is invalid.");
  errorMessage.setVisible(false);
  add(errorMessage);
}
 
開發者ID:showlowtech,項目名稱:google-apis-explorer,代碼行數:24,代碼來源:EnumEditor.java

示例6: setFocusGained

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
public void setFocusGained(JavaScriptObject aValue) {
	if (focusGained != aValue) {
		if (focusReg != null) {
			focusReg.removeHandler();
			focusReg = null;
		}
		focusGained = aValue;
		if (focusGained != null && component instanceof HasFocusHandlers) {
			focusReg = ((HasFocusHandlers) component).addFocusHandler(new FocusHandler() {
				@Override
				public void onFocus(FocusEvent event) {
					if (focusGained != null) {
						executeEvent(focusGained, EventsPublisher.publish(event));
					}
				}
			});
		}
	}
}
 
開發者ID:marat-gainullin,項目名稱:platypus-js,代碼行數:20,代碼來源:EventsExecutor.java

示例7: DateSelector

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
public DateSelector()
{
	initWidget( textBox );

	textBox.addFocusHandler( new FocusHandler()
	{
		@Override
		public void onFocus( FocusEvent event )
		{
			if( !enabled )
				return;

			showPopup();
		}
	} );
}
 
開發者ID:ltearno,項目名稱:hexa.tools,代碼行數:17,代碼來源:DateSelector.java

示例8: bindHandlers

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
private void bindHandlers() {
	if (this.widget == null) {
		return;
	}

	this.registrations.removeHandler();
	switch (this.getTrigger()) {
		case FOCUS:
			this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, FocusEvent.getType()));
			this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, BlurEvent.getType()));
			break;
		case HOVER:
			this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, MouseOverEvent.getType()));
			this.registrations.add(this.widget.addDomHandler(this.triggerEventHandler, MouseOutEvent.getType()));
			break;
		case MANUAL:
			break;
		default:
			break;
	}
}
 
開發者ID:Putnami,項目名稱:putnami-web-toolkit,代碼行數:22,代碼來源:AbstractHover.java

示例9: onFocus

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onFocus(FocusEvent event)
{
	if( m_isFocused )
	{
		//smU_Debug.ASSERT(false, "onFocus1");
		return;
	}

	m_currentElement = event.getRelativeElement();
	
	ToolTipConfig config = m_tipMap.get(m_currentElement);
	
	U_Debug.ASSERT(config!= null, "smToolTipSubManager_Focus::onFocus1");

	m_toolTipManager.prepareTip(m_toolTip, m_currentElement, config);
	
	m_toolTipManager.showTip(m_toolTip, null);
	
	m_isFocused = true;
}
 
開發者ID:dougkoellmer,項目名稱:swarm,代碼行數:22,代碼來源:ToolTipSubManager_Focus.java

示例10: onBrowserEvent

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onBrowserEvent(Event event) {
	switch (DOM.eventGetType(event)) {
    case Event.ONBLUR:
    	BlurEvent.fireNativeEvent(event, this);
    	break;
    case Event.ONFOCUS:
    	FocusEvent.fireNativeEvent(event, this);
    	break;
	}
	super.onBrowserEvent(event);
}
 
開發者ID:Jenner4S,項目名稱:unitimes,代碼行數:13,代碼來源:AriaSuggestBox.java

示例11: onFocus

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onFocus(FocusEvent event) {
	// Force cursor to end of input
	if (input instanceof TextBox) {
		TextBox inputBox = (TextBox)input;
		inputBox.setCursorPos(inputBox.getText().length());
	}
}
 
開發者ID:openremote,項目名稱:WebConsole,代碼行數:9,代碼來源:FormField.java

示例12: initialize

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
/**
 * Allows to initialize the text box by setting up its listeners and styles.
 */
private void initialize() {
	//Set the base values and styles
	super.setStyleName( CommonResourcesContainer.GWT_TEXT_BOX_STYLE );
	this.addStyleName( CommonResourcesContainer.USER_DIALOG_SUGG_TEXT_BOX_STYLE );
	this.setText( helperText );
	//On gaining the focus
	addFocusHandler(new FocusHandler(){
		public void onFocus(FocusEvent event) {
			//If the focus is obtained and the text box value is set to empty if
			//the user text was not set, i.e. he have the helper message there
			if( TextBoxWithSuggText.super.getText().trim().equals( helperText ) ){
				TextBoxWithSuggText.super.setText( "" );
			}
			//Remove the suggestion style making the text be in another color
			removeStyleName( CommonResourcesContainer.USER_DIALOG_SUGG_TEXT_BOX_STYLE );
		}
	});
	//On loosing the focus
	addBlurHandler(new BlurHandler(){
		public void onBlur(BlurEvent e) {
			//If the text box looses the focus and the text is not set
			//then we set the helper text and the corresponding style 
			if( TextBoxWithSuggText.super.getText().trim().isEmpty() ){
				TextBoxWithSuggText.this.setText( null );
			}
		}
	});
}
 
開發者ID:ivan-zapreev,項目名稱:x-cure-chat,代碼行數:32,代碼來源:TextBoxWithSuggText.java

示例13: onFocus

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
public void onFocus(FocusEvent event) {
	if (this.mouseClickEvent) {
		// event is always mouseclick, so when we manually switch columns we
		// set mouseclick false to get past this and normal mouseclicks wont
		// have effects on this
		return;
	}

	final boolean shiftKey = event.getNativeEvent()
		.getShiftKey();
	final GridFocusHandler currentThis = this;
	final boolean currentStartAtBeginning = this.startAtBeginning;
	final boolean currentSkipFocus = this.skipFocus;

	if (this.focusTimer == null) {
		this.focusTimer = new Timer() {
			@Override
			public void run() {
				if (!currentSkipFocus) {
					if (currentStartAtBeginning) {
						NavigationUtil
							.focusFirstEditableElementFromFirstElementOfRow(GridFocusHandler.this.grid, 0,
																			currentThis,
																			GridFocusHandler.this.shiftKeyDown);
					}
					NavigationUtil.focusInputField(GridFocusHandler.this.grid, GridFocusHandler.this.shiftKeyDown);
					GridFocusHandler.this.shiftKeyDown = false;
				} else {
					setSkipFocus(shiftKey);
				}
			}
		};
	}
	this.focusTimer.schedule(50);
}
 
開發者ID:vaadin,項目名稱:grid-renderers-collection-addon,代碼行數:37,代碼來源:GridFocusHandler.java

示例14: extend

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
protected void extend(ServerConnector target) {

	Grid grid = ((GridConnector) target).getWidget();
	GridFocusHandler gridFocusHandler = new GridFocusHandler(grid);
	grid.addDomHandler(gridFocusHandler, FocusEvent.getType());
	grid.addDomHandler(new GridClickHandler(grid, gridFocusHandler), ClickEvent.getType());
	grid.addDomHandler(new NavigationHandler(grid, gridFocusHandler), KeyDownEvent.getType());
}
 
開發者ID:vaadin,項目名稱:grid-renderers-collection-addon,代碼行數:10,代碼來源:GridNavigationExtensionConnector.java

示例15: getFocusHandler

import com.google.gwt.event.dom.client.FocusEvent; //導入依賴的package包/類
@Override
FocusHandler getFocusHandler() {
  return new FocusHandler() {
    @Override
    public void onFocus(FocusEvent event) {
      cmB.focus();
    }
  };
}
 
開發者ID:gerrit-review,項目名稱:gerrit,代碼行數:10,代碼來源:SideBySide.java


注:本文中的com.google.gwt.event.dom.client.FocusEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。