You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VCssLayoutPaintable.java 2.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.terminal.gwt.client.ui;
  5. import com.google.gwt.core.client.GWT;
  6. import com.google.gwt.event.dom.client.DomEvent.Type;
  7. import com.google.gwt.event.shared.EventHandler;
  8. import com.google.gwt.event.shared.HandlerRegistration;
  9. import com.google.gwt.user.client.Element;
  10. import com.google.gwt.user.client.ui.Widget;
  11. import com.vaadin.terminal.gwt.client.ApplicationConnection;
  12. import com.vaadin.terminal.gwt.client.EventId;
  13. import com.vaadin.terminal.gwt.client.UIDL;
  14. import com.vaadin.terminal.gwt.client.ComponentConnector;
  15. public class VCssLayoutPaintable extends AbstractComponentContainerConnector {
  16. private LayoutClickEventHandler clickEventHandler = new LayoutClickEventHandler(
  17. this, EventId.LAYOUT_CLICK) {
  18. @Override
  19. protected ComponentConnector getChildComponent(Element element) {
  20. return getWidget().panel.getComponent(element);
  21. }
  22. @Override
  23. protected <H extends EventHandler> HandlerRegistration registerHandler(
  24. H handler, Type<H> type) {
  25. return getWidget().addDomHandler(handler, type);
  26. }
  27. };
  28. @Override
  29. public void updateFromUIDL(UIDL uidl, ApplicationConnection client) {
  30. super.updateFromUIDL(uidl, client);
  31. if (!isRealUpdate(uidl)) {
  32. return;
  33. }
  34. clickEventHandler.handleEventHandlerRegistration(client);
  35. getWidget().setMarginAndSpacingStyles(
  36. new VMarginInfo(uidl.getIntAttribute("margins")),
  37. uidl.hasAttribute("spacing"));
  38. getWidget().panel.updateFromUIDL(uidl, client);
  39. }
  40. @Override
  41. public VCssLayout getWidget() {
  42. return (VCssLayout) super.getWidget();
  43. }
  44. @Override
  45. protected Widget createWidget() {
  46. return GWT.create(VCssLayout.class);
  47. }
  48. public void updateCaption(ComponentConnector component, UIDL uidl) {
  49. getWidget().panel.updateCaption(component, uidl);
  50. }
  51. }