Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

VAbstractDateFieldCalendar.java 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * Copyright 2000-2016 Vaadin Ltd.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.vaadin.client.ui;
  17. import com.google.gwt.event.dom.client.DomEvent;
  18. import com.vaadin.client.ui.VAbstractCalendarPanel.FocusOutListener;
  19. import com.vaadin.client.ui.VAbstractCalendarPanel.SubmitListener;
  20. /**
  21. * A client side implementation for inline date field.
  22. */
  23. public abstract class VAbstractDateFieldCalendar<R extends Enum<R>>
  24. extends VDateField<R> {
  25. /** For internal use only. May be removed or replaced in the future. */
  26. public final VAbstractCalendarPanel<R> calendarPanel;
  27. public VAbstractDateFieldCalendar(VAbstractCalendarPanel<R> panel,
  28. R resolution) {
  29. super(resolution);
  30. calendarPanel = panel;
  31. calendarPanel.setParentField(this);
  32. add(calendarPanel);
  33. calendarPanel.setSubmitListener(new SubmitListener() {
  34. @Override
  35. public void onSubmit() {
  36. updateValueFromPanel();
  37. }
  38. @Override
  39. public void onCancel() {
  40. // TODO Auto-generated method stub
  41. }
  42. });
  43. calendarPanel.setFocusOutListener(new FocusOutListener() {
  44. @Override
  45. public boolean onFocusOut(DomEvent<?> event) {
  46. updateValueFromPanel();
  47. return false;
  48. }
  49. });
  50. }
  51. @SuppressWarnings("deprecation")
  52. public abstract void updateValueFromPanel();
  53. public void setTabIndex(int tabIndex) {
  54. calendarPanel.getElement().setTabIndex(tabIndex);
  55. }
  56. public int getTabIndex() {
  57. return calendarPanel.getElement().getTabIndex();
  58. }
  59. }