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

OrionEditorWidget.java 文件源码 项目:che 阅读 22 收藏 0 点赞 0 评论 0
@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());
}
View.java 文件源码 项目:che 阅读 25 收藏 0 点赞 0 评论 0
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);
}
OnEditEnabler.java 文件源码 项目:gerrit 阅读 21 收藏 0 点赞 0 评论 0
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);
}
EnumEditor.java 文件源码 项目:google-apis-explorer 阅读 21 收藏 0 点赞 0 评论 0
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);
}
EventsExecutor.java 文件源码 项目:platypus-js 阅读 26 收藏 0 点赞 0 评论 0
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));
                    }
                }
            });
        }
    }
}
DateSelector.java 文件源码 项目:hexa.tools 阅读 23 收藏 0 点赞 0 评论 0
public DateSelector()
{
    initWidget( textBox );

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

            showPopup();
        }
    } );
}
TextBoxWithSuggText.java 文件源码 项目:x-cure-chat 阅读 25 收藏 0 点赞 0 评论 0
/**
 * 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 );
            }
        }
    });
}
GWTWidgets.java 文件源码 项目:r01fb 阅读 24 收藏 0 点赞 0 评论 0
/**
 * 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);
        }
    }
}
SideBySide.java 文件源码 项目:gerrit 阅读 19 收藏 0 点赞 0 评论 0
@Override
FocusHandler getFocusHandler() {
  return new FocusHandler() {
    @Override
    public void onFocus(FocusEvent event) {
      cmB.focus();
    }
  };
}
Unified.java 文件源码 项目:gerrit 阅读 18 收藏 0 点赞 0 评论 0
@Override
FocusHandler getFocusHandler() {
  return new FocusHandler() {
    @Override
    public void onFocus(FocusEvent event) {
      cm.focus();
    }
  };
}
RemoteSuggestBox.java 文件源码 项目:gerrit 阅读 27 收藏 0 点赞 0 评论 0
public void enableDefaultSuggestions() {
  textBox.addFocusHandler(
      new FocusHandler() {
        @Override
        public void onFocus(FocusEvent focusEvent) {
          if (textBox.getText().equals("")) {
            suggestBox.showSuggestionList();
          }
        }
      });
}
PropertyEditorPasswordTextBox.java 文件源码 项目:appformer 阅读 22 收藏 0 点赞 0 评论 0
public PropertyEditorPasswordTextBox() {
    initWidget(uiBinder.createAndBindUi(this));
    passwordTextBox.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            passwordTextBox.selectAll();
        }
    });
}
PropertyEditorTextBox.java 文件源码 项目:appformer 阅读 15 收藏 0 点赞 0 评论 0
public PropertyEditorTextBox() {
    initWidget(uiBinder.createAndBindUi(this));
    textBox.addFocusHandler(new FocusHandler() {
        @Override
        public void onFocus(FocusEvent event) {
            textBox.selectAll();
        }
    });
}
EventFactory.java 文件源码 项目:qafe-platform 阅读 17 收藏 0 点赞 0 评论 0
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);
        }
    };
}
ActivityHelper.java 文件源码 项目:qafe-platform 阅读 26 收藏 0 点赞 0 评论 0
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);
        }
    };
}
CodeMirrorEditorWidget.java 文件源码 项目:plugin-editor-codemirror 阅读 22 收藏 0 点赞 0 评论 0
@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());
}
MetadataView.java 文件源码 项目:GraphemeColourSynaesthesiaApp 阅读 23 收藏 0 点赞 0 评论 0
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;
        }
    }
ViewportImplIE.java 文件源码 项目:gwt-traction 阅读 21 收藏 0 点赞 0 评论 0
@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_();
   }
ReportsView.java 文件源码 项目:sigmah 阅读 21 收藏 0 点赞 0 评论 0
/**
 * {@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;
    }
}
MetadataView.java 文件源码 项目:LanguageMemoryApp 阅读 36 收藏 0 点赞 0 评论 0
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;
        }
    }
AriaSuggestBox.java 文件源码 项目:unitimes 阅读 18 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addHandler(handler, FocusEvent.getType());
}
ImageButton.java 文件源码 项目:unitimes 阅读 27 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addDomHandler(handler, FocusEvent.getType());
}
TimeSelector.java 文件源码 项目:unitimes 阅读 21 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return addHandler(handler, FocusEvent.getType());
}
TimeSelector.java 文件源码 项目:unitimes 阅读 25 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iText.addFocusHandler(handler);
}
IntervalSelector.java 文件源码 项目:unitimes 阅读 20 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iFilter.addFocusHandler(handler);
}
FilterBox.java 文件源码 项目:unitimes 阅读 29 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iFilter.addFocusHandler(handler);
}
UniTimeFilterBox.java 文件源码 项目:unitimes 阅读 19 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iFilter.getWidget().addFocusHandler(handler);
}
SessionDatesSelector.java 文件源码 项目:unitimes 阅读 19 收藏 0 点赞 0 评论 0
@Override
public HandlerRegistration addFocusHandler(FocusHandler handler) {
    return iText.addFocusHandler(handler);
}
HandlerPanel.java 文件源码 项目:appinventor-extensions 阅读 21 收藏 0 点赞 0 评论 0
public HandlerRegistration addFocusHandler(FocusHandler handler) {
  return addDomHandler(handler, FocusEvent.getType());
}
ValidatePanel.java 文件源码 项目:ephesoft 阅读 19 收藏 0 点赞 0 评论 0
/**
 * @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;
}


问题


面经


文章

微信
公众号

扫码关注公众号