Java 类com.google.gwt.event.dom.client.FocusHandler 实例源码

项目:che    文件:OrionEditorWidget.java   
@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());
}
项目:che    文件:View.java   
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);
}
项目:gerrit    文件:OnEditEnabler.java   
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);
}
项目:google-apis-explorer    文件:EnumEditor.java   
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);
}
项目:platypus-js    文件:EventsExecutor.java   
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));
                    }
                }
            });
        }
    }
}
项目:hexa.tools    文件:DateSelector.java   
public DateSelector()
{
    initWidget( textBox );

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

            showPopup();
        }
    } );
}
项目:x-cure-chat    文件:TextBoxWithSuggText.java   
/**
 * 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 );
            }
        }
    });
}
项目:r01fb    文件:GWTWidgets.java   
/**
 * Sets the focus() event handler in many widgets
 * @param handler the handler
 * @param widgets the widgets
 */
public static void addFocusHandler(final FocusHandler handler,final HasFocusHandlers... widgets) {
    if (handler != null && widgets != null && widgets.length > 0) {
        for (HasFocusHandlers w : widgets) {
            if (w != null) w.addFocusHandler(handler);
        }
    }
}
项目:gerrit    文件:SideBySide.java   
@Override
FocusHandler getFocusHandler() {
  return new FocusHandler() {
    @Override
    public void onFocus(FocusEvent event) {
      cmB.focus();
    }
  };
}
项目:gerrit    文件:Unified.java   
@Override
FocusHandler getFocusHandler() {
  return new FocusHandler() {
    @Override
    public void onFocus(FocusEvent event) {
      cm.focus();
    }
  };
}
项目:gerrit    文件:RemoteSuggestBox.java   
public void enableDefaultSuggestions() {
  textBox.addFocusHandler(
      new FocusHandler() {
        @Override
        public void onFocus(FocusEvent focusEvent) {
          if (textBox.getText().equals("")) {
            suggestBox.showSuggestionList();
          }
        }
      });
}
项目:appformer    文件:PropertyEditorPasswordTextBox.java   
public PropertyEditorPasswordTextBox() {
    initWidget(uiBinder.createAndBindUi(this));
    passwordTextBox.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            passwordTextBox.selectAll();
        }
    });
}
项目:appformer    文件:PropertyEditorTextBox.java   
public PropertyEditorTextBox() {
    initWidget(uiBinder.createAndBindUi(this));
    textBox.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            textBox.selectAll();
        }
    });
}
项目:qafe-platform    文件:EventFactory.java   
public static FocusHandler createFocusListener(final EventListenerGVO ev, final List<InputVariableGVO> input) {
    return new FocusHandler() {
        public void onFocus(FocusEvent event) {
            CallbackHandler.createCallBack(event.getSource(), QAMLConstants.EVENT_ONFOCUS, ev, input);
        }
    };
}
项目:qafe-platform    文件:ActivityHelper.java   
private static FocusHandler createFocusHandler(final ComponentGVO componentGVO, final EventListenerGVO eventGVO, final NotifyHandler notifyHandler, final String windowId, final String context, final AbstractActivity activity) {
    return new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            UIObject widget = (UIObject)event.getSource();
            List<InputVariableGVO> inputVariables = eventGVO.getInputvariablesList();
            handleEvent(componentGVO, widget, eventGVO, event, QAMLConstants.EVENT_ONFOCUS, inputVariables, notifyHandler, windowId, context, activity);
        }
    };
}
项目:plugin-editor-codemirror    文件:CodeMirrorEditorWidget.java   
@Override
public HandlerRegistration addFocusHandler(final FocusHandler handler) {
    if (!focusHandlerAdded) {
        focusHandlerAdded = true;
        this.codeMirror.on(this.editorOverlay, FOCUS, new EventHandlers.EventHandlerNoParameters() {

            @Override
            public void onEvent() {
                fireFocusEvent();
            }
        });
    }
    return addHandler(handler, FocusEvent.getType());
}
项目:GraphemeColourSynaesthesiaApp    文件:MetadataView.java   
public void addField(final MetadataField metadataField, final String existingValue, String labelString) {
        if (flexTable == null) {
            flexTable = new FlexTable();
            flexTable.setStylePrimaryName("metadataTable");
            outerPanel.add(flexTable);
        }
        final int rowCount = flexTable.getRowCount();
        final Label label = new Label(labelString);
        flexTable.setWidget(rowCount, 0, label);
        final TextBox textBox = new TextBox();
        textBox.setStylePrimaryName("metadataOK");
        textBox.setText((existingValue == null) ? "" : existingValue);
        textBox.addFocusHandler(new FocusHandler() {

            @Override
            public void onFocus(FocusEvent event) {
                addKeyboardPadding();
//                scrollToPosition(label.getAbsoluteTop());
            }
        });
//        textBox.addBlurHandler(new BlurHandler() {
//
//            @Override
//            public void onBlur(BlurEvent event) {
//                removeKeyboardPadding();
//            }
//        });
        flexTable.setWidget(rowCount + 1, 0, textBox);
        fieldBoxes.put(metadataField, textBox);
        if (firstTextBox == null) {
            firstTextBox = textBox;
        }
    }
项目:gwt-traction    文件:ViewportImplIE.java   
@Override
   public void addEventListeners() {

// we create these to map the event names to their events. see
// DomEvent.Type for details.
new Type<FocusHandler>("focusin", new FocusInEvent());
new Type<BlurHandler>("focusout", new FocusOutEvent());

addEventListeners_();
   }
项目:sigmah    文件:ReportsView.java   
/**
 * {@inheritDoc}
 */
@Override
public HasHTML addTextArea(final RichTextElementDTO richTextElement, final FoldPanel sectionPanel, final boolean draftMode) {

    if (draftMode) {

        final RichTextArea textArea = new RichTextArea();

        textArea.setHTML(richTextElement.getText());
        textArea.addFocusHandler(new FocusHandler() {

            @Override
            public void onFocus(FocusEvent event) {
                globalFormatterArray[0] = textArea.getFormatter();
            }
        });

        sectionPanel.add(textArea);
        return textArea;

    } else {

        final HTML html = new HTML();
        final String value = richTextElement.getText();

        if (ClientUtils.isBlank(value)) {
            html.setText(I18N.CONSTANTS.reportEmptySection());
            html.addStyleName(STYLE_PROJECT_REPORT_FIELD_EMPTY);

        } else {
            html.setHTML(value);
            html.addStyleName(STYLE_PROJECT_REPORT_FIELD);
        }

        sectionPanel.add(html);
        return null;
    }
}
项目:LanguageMemoryApp    文件:MetadataView.java   
public void addField(final MetadataField metadataField, final String existingValue, String labelString) {
        if (flexTable == null) {
            flexTable = new FlexTable();
            flexTable.setStylePrimaryName("metadataTable");
            outerPanel.add(flexTable);
        }
        final int rowCount = flexTable.getRowCount();
        final Label label = new Label(labelString);
        flexTable.setWidget(rowCount, 0, label);
        final TextBox textBox = new TextBox();
        textBox.setStylePrimaryName("metadataOK");
        textBox.setText((existingValue == null) ? "" : existingValue);
        textBox.addFocusHandler(new FocusHandler() {

            @Override
            public void onFocus(FocusEvent event) {
                addKeyboardPadding();
//                scrollToPosition(label.getAbsoluteTop());
            }
        });
//        textBox.addBlurHandler(new BlurHandler() {
//
//            @Override
//            public void onBlur(BlurEvent event) {
//                removeKeyboardPadding();
//            }
//        });
        flexTable.setWidget(rowCount + 1, 0, textBox);
        fieldBoxes.put(metadataField, textBox);
        if (firstTextBox == null) {
            firstTextBox = textBox;
        }
    }
项目:unitimes    文件:AriaSuggestBox.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addHandler(handler, FocusEvent.getType());
}
项目:unitimes    文件:ImageButton.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addDomHandler(handler, FocusEvent.getType());
}
项目:unitimes    文件:TimeSelector.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addHandler(handler, FocusEvent.getType());
}
项目:unitimes    文件:TimeSelector.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iText.addFocusHandler(handler);
}
项目:unitimes    文件:IntervalSelector.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iFilter.addFocusHandler(handler);
}
项目:unitimes    文件:FilterBox.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iFilter.addFocusHandler(handler);
}
项目:unitimes    文件:UniTimeFilterBox.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iFilter.getWidget().addFocusHandler(handler);
}
项目:unitimes    文件:SessionDatesSelector.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iText.addFocusHandler(handler);
}
项目:appinventor-extensions    文件:HandlerPanel.java   
public HandlerRegistration addFocusHandler(FocusHandler handler) {
  return addDomHandler(handler, FocusEvent.getType());
}
项目:ephesoft    文件:ValidatePanel.java   
/**
 * @param isFieldHidden
 * @param index
 * @param field
 * @param alternateValuesSet
 * @param fieldTypeDescription
 * @param tempTextArea
 * @param isReadOnly
 * @param fieldNameString
 * @param sampleValueString
 * @return
 */
private int setTextAreaTypeFields(boolean isFieldHidden, int index, final DocField field, List<String> alternateValuesSet,
        String fieldTypeDescription, ValidatableWidget<TextArea> tempTextArea, boolean isReadOnly, final String fieldNameString,
        final String sampleValueString) {
    int indexLocal = index;
    if (!isFieldHidden) {
        final ValidatableWidget<TextArea> textAreaWidget = tempTextArea;
        for (int k = 0; k < alternateValuesSet.size(); k++) {
            textAreaWidget.getWidget().setTitle(field.getName());
        }

        textAreaWidget.getWidget().addValueChangeHandler(new ValueChangeHandler<String>() {

            @Override
            public void onValueChange(ValueChangeEvent<String> arg0) {
                if (presenter.batchDTO.getFieldValueChangeScriptSwitchState().equalsIgnoreCase("ON")) {
                    currentFieldSet = false;
                    presenter.setScriptExecuted(true);
                    presenter.setFieldValueChangeName(field.getName());
                    setTimerToExecuteScript();
                }
            }

        });
        textAreaWidget.getWidget().addFocusHandler(new FocusHandler() {

            @Override
            public void onFocus(FocusEvent event) {
                if (!currentFieldSet) {
                    currentFieldSet = true;
                    setFieldAlreadySelected(true);
                    presenter.setCurrentFieldName(field.getName());
                }

                presenter.setCurrentDocumentFieldName(field.getName());

                setCurrentDocFieldWidget(field.getName());
                ValidatePanel.this.fireEvent(new ValidationFieldChangeEvent(field));
                ValidatePanel.this.fireEvent(new ValidationFieldChangeEvent(true, sampleValueString, fieldNameString, true));

                if (presenter.isScriptExecuted()) {
                    presenter.executeScriptOnFieldChange(presenter.getFieldValueChangeName());
                }

            }
        });

        Label fieldLabel = null;
        if (fieldTypeDescription != null && !fieldTypeDescription.isEmpty()) {
            fieldLabel = new Label(fieldTypeDescription);
            validationTable.setWidget(indexLocal++, 0, fieldLabel);
        } else {
            fieldLabel = new Label(field.getName());
            validationTable.setWidget(indexLocal++, 0, fieldLabel);
        }
        validationTable.setWidget(indexLocal++, 0, textAreaWidget.getWidget());
        addDocFieldWidget(presenter.document.getIdentifier(), fieldLabel, field, null, null, textAreaWidget, isReadOnly);
    }
    return indexLocal;
}
项目:r01fb    文件:TreeView.java   
@Override
public HandlerRegistration addFocusHandler(final FocusHandler handler) {
    return this.addDomHandler(handler,
                              FocusEvent.getType());
}
项目:gerrit    文件:ShowHelpCommand.java   
public static HandlerRegistration addFocusHandler(FocusHandler fh) {
  return BUS.addHandler(FocusEvent.getType(), fh);
}
项目:unitime    文件:AriaSuggestBox.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addHandler(handler, FocusEvent.getType());
}
项目:unitime    文件:ImageButton.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addDomHandler(handler, FocusEvent.getType());
}
项目:unitime    文件:TimeSelector.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addHandler(handler, FocusEvent.getType());
}
项目:unitime    文件:TimeSelector.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iText.addFocusHandler(handler);
}
项目:unitime    文件:IntervalSelector.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iFilter.addFocusHandler(handler);
}
项目:unitime    文件:FilterBox.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iFilter.addFocusHandler(handler);
}
项目:unitime    文件:UniTimeFilterBox.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iFilter.getWidget().addFocusHandler(handler);
}
项目:unitime    文件:SessionDatesSelector.java   
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iText.addFocusHandler(handler);
}