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.

ComponentDetailMap.java 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. @ITMillApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client;
  5. import java.util.ArrayList;
  6. import java.util.Collection;
  7. import com.google.gwt.core.client.JavaScriptObject;
  8. final class ComponentDetailMap extends JavaScriptObject {
  9. protected ComponentDetailMap() {
  10. }
  11. static ComponentDetailMap create() {
  12. return (ComponentDetailMap) JavaScriptObject.createObject();
  13. }
  14. boolean isEmpty() {
  15. return size() == 0;
  16. }
  17. final native boolean containsKey(String key)
  18. /*-{
  19. return this.hasOwnProperty(key);
  20. }-*/;
  21. final native ComponentDetail get(String key)
  22. /*-{
  23. return this[key];
  24. }-*/;
  25. final native void put(String id, ComponentDetail value)
  26. /*-{
  27. this[id] = value;
  28. }-*/;
  29. final native void remove(String id)
  30. /*-{
  31. delete this[id];
  32. }-*/;
  33. final native int size()
  34. /*-{
  35. var count = 0;
  36. for(var key in this) {
  37. count++;
  38. }
  39. return count;
  40. }-*/;
  41. final native void clear()
  42. /*-{
  43. for(var key in this) {
  44. if(this.hasOwnProperty(key)) {
  45. delete this[key];
  46. }
  47. }
  48. }-*/;
  49. private final native void fillWithValues(Collection<ComponentDetail> list)
  50. /*-{
  51. for(var key in this) {
  52. list.@java.util.Collection::add(Ljava/lang/Object;)(this[key]);
  53. }
  54. }-*/;
  55. final Collection<ComponentDetail> values() {
  56. ArrayList<ComponentDetail> list = new ArrayList<ComponentDetail>();
  57. fillWithValues(list);
  58. return list;
  59. }
  60. }