Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

UIState.java 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * Copyright 2000-2014 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.shared.ui.ui;
  17. import java.io.Serializable;
  18. import java.util.ArrayList;
  19. import java.util.HashMap;
  20. import java.util.List;
  21. import java.util.Map;
  22. import com.vaadin.shared.communication.PushMode;
  23. import com.vaadin.shared.ui.TabIndexState;
  24. public class UIState extends TabIndexState {
  25. public TooltipConfigurationState tooltipConfiguration = new TooltipConfigurationState();
  26. public LoadingIndicatorConfigurationState loadingIndicatorConfiguration = new LoadingIndicatorConfigurationState();
  27. public int pollInterval = -1;
  28. // Informing users of assistive devices, that the content of this container
  29. // is announced automatically and does not need to be navigated into
  30. public String overlayContainerLabel = "This content is announced automatically and does not need to be navigated into.";
  31. public Map<String, NotificationTypeConfiguration> notificationConfigurations = new HashMap<String, NotificationTypeConfiguration>();
  32. {
  33. notificationConfigurations.put("error",
  34. new NotificationTypeConfiguration("Error: ",
  35. " - close with ESC-key", NotificationRole.ALERT));
  36. notificationConfigurations.put("warning",
  37. new NotificationTypeConfiguration("Warning: ", null,
  38. NotificationRole.ALERT));
  39. notificationConfigurations.put("humanized",
  40. new NotificationTypeConfiguration("Info: ", null,
  41. NotificationRole.ALERT));
  42. // We use alert instead of status for all notifications because
  43. // (at least) Jaws 16 and earlier fail to announce any role=status
  44. // message in Chrome/Firefox
  45. notificationConfigurations.put("tray",
  46. new NotificationTypeConfiguration("Status: ", null,
  47. NotificationRole.ALERT));
  48. notificationConfigurations.put("assistive",
  49. new NotificationTypeConfiguration("Note: ", null,
  50. NotificationRole.ALERT));
  51. }
  52. /**
  53. * State related to the Page class.
  54. */
  55. public PageState pageState = new PageState();
  56. /**
  57. * State related to the LocaleService class.
  58. */
  59. public LocaleServiceState localeServiceState = new LocaleServiceState();
  60. /**
  61. * Configuration for the push channel
  62. */
  63. public PushConfigurationState pushConfiguration = new PushConfigurationState();
  64. /**
  65. * Currently used theme.
  66. *
  67. * @since 7.3
  68. */
  69. public String theme;
  70. {
  71. primaryStyleName = "v-ui";
  72. // Default is 1 for legacy reasons
  73. tabIndex = 1;
  74. }
  75. public static class LoadingIndicatorConfigurationState implements
  76. Serializable {
  77. public int firstDelay = 300;
  78. public int secondDelay = 1500;
  79. public int thirdDelay = 5000;
  80. }
  81. public static class TooltipConfigurationState implements Serializable {
  82. public int openDelay = 750;
  83. public int quickOpenDelay = 100;
  84. public int quickOpenTimeout = 1000;
  85. public int closeTimeout = 300;
  86. public int maxWidth = 500;
  87. }
  88. public static class NotificationTypeConfiguration implements Serializable {
  89. public String prefix;
  90. public String postfix;
  91. public NotificationRole notificationRole = NotificationRole.ALERT;
  92. public NotificationTypeConfiguration() {
  93. }
  94. public NotificationTypeConfiguration(String prefix, String postfix,
  95. NotificationRole role) {
  96. this.prefix = prefix;
  97. this.postfix = postfix;
  98. notificationRole = role;
  99. }
  100. }
  101. public static class PushConfigurationState implements Serializable {
  102. public static final String TRANSPORT_PARAM = "transport";
  103. public static final String FALLBACK_TRANSPORT_PARAM = "fallbackTransport";
  104. public PushMode mode = PushMode.DISABLED;
  105. public Map<String, String> parameters = new HashMap<String, String>();
  106. {
  107. parameters
  108. .put(TRANSPORT_PARAM, Transport.WEBSOCKET.getIdentifier());
  109. parameters.put(FALLBACK_TRANSPORT_PARAM,
  110. Transport.LONG_POLLING.getIdentifier());
  111. }
  112. }
  113. public static class LocaleServiceState implements Serializable {
  114. public List<LocaleData> localeData = new ArrayList<LocaleData>();
  115. }
  116. public static class LocaleData implements Serializable {
  117. public String name;
  118. public String[] monthNames;
  119. public String[] shortMonthNames;
  120. public String[] shortDayNames;
  121. public String[] dayNames;
  122. public int firstDayOfWeek;
  123. public String dateFormat;
  124. public boolean twelveHourClock;
  125. public String hourMinuteDelimiter;
  126. public String am;
  127. public String pm;
  128. }
  129. }