/** {@inheritDoc} */
 @Override
 public Date getValue() {
   try {
     return dateTimeFormat != null && textBox.getValue() != null
         ? dateTimeFormat.parse(textBox.getValue())
         : null;
   } catch (final Exception e) {
     return null;
   }
 }
 @Override
 public void init(final NameEditBoxWidget presenter) {
   this.presenter = presenter;
   initWidget(uiBinder.createAndBindUi(this));
   nameBox.addValueChangeHandler(
       event -> {
         final String name = event.getValue();
         presenter.onChangeName(name);
       });
   nameBox.addKeyPressHandler(
       keyPressEvent ->
           presenter.onKeyPress(keyPressEvent.getUnicodeCharCode(), nameBox.getValue()));
   nameBox.addKeyDownHandler(
       keyDownEvent -> presenter.onKeyDown(keyDownEvent.getNativeKeyCode(), nameBox.getValue()));
   saveButton.addClickHandler(event -> presenter.onSave());
   closeButton.addClickHandler(event -> presenter.onClose());
 }
  private void aboutToEditCustomValue(String value, int times) {
    comboBox.view.listBoxGotFocus();
    comboBox.listBoxValueChanged(this.editPrefix + value + this.editSuffix);
    assertEquals(listBox.isVisible(), false);
    assertEquals(textBox.isVisible(), true);

    verify(modelPresenter, times(times)).setTextBoxModelValue(textBox, value);
    assertEquals(textBox.getValue(), value);
  }
 private void initTextBox() {
   when(textBox.getValue())
       .thenAnswer(
           new Answer<Object>() {
             @Override
             public String answer(InvocationOnMock invocation) throws Throwable {
               return textBoxValue;
             }
           });
   doAnswer(
           new Answer<Object>() {
             @Override
             public Object answer(InvocationOnMock invocation) throws Throwable {
               textBoxValue = (String) invocation.getArguments()[0];
               return null;
             }
           })
       .when(textBox)
       .setValue(anyString());
   when(textBox.isVisible())
       .thenAnswer(
           new Answer<Object>() {
             @Override
             public Boolean answer(InvocationOnMock invocation) throws Throwable {
               return textBoxIsVisible;
             }
           });
   doAnswer(
           new Answer<Object>() {
             @Override
             public Object answer(InvocationOnMock invocation) throws Throwable {
               textBoxIsVisible = (Boolean) invocation.getArguments()[0];
               return null;
             }
           })
       .when(textBox)
       .setVisible(anyBoolean());
 }
 public String getBaseValue() {
   return textBox.getValue();
 }
Beispiel #6
0
 @Override
 public String getName() {
   return nameBox.getValue();
 }