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.

SharedState.java 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /*
  2. @VaadinApache2LicenseForJavaFiles@
  3. */
  4. package com.vaadin.shared.communication;
  5. import java.io.Serializable;
  6. import com.vaadin.shared.Connector;
  7. /**
  8. * Interface to be implemented by all shared state classes used to communicate
  9. * basic information about a {@link Connector} from server to client.
  10. *
  11. * Shared state classes have to be declared in shared package to be accessible
  12. * both for server and client code.
  13. *
  14. * Shared state objects are only sent from the server to the client, and any
  15. * modifications from the client should be performed via an RPC call that
  16. * modifies the authoritative state on the server.
  17. *
  18. * A shared state class should be a bean with getters and setters for each
  19. * field. Supported data types are simple Java types, other beans and maps and
  20. * arrays of these.
  21. *
  22. * On the client side the connector should override
  23. * {@link com.vaadin.terminal.gwt.client.ui.AbstractConnector#getState()} to
  24. * return the correct state type. This automatically causes a correct state
  25. * object to be created.
  26. *
  27. * Subclasses of a {@link Connector} using shared state should also provide a
  28. * subclass of the shared state class of the parent class to extend the state. A
  29. * single {@link Connector} can only have one shared state object.
  30. *
  31. * @since 7.0
  32. */
  33. public class SharedState implements Serializable {
  34. private boolean enabled = true;
  35. /**
  36. * Returns true if the component is enabled.
  37. *
  38. * @see com.vaadin.ui.Component#isEnabled()
  39. *
  40. * @return true if the component is enabled
  41. */
  42. public boolean isEnabled() {
  43. return enabled;
  44. }
  45. /**
  46. * Enables or disables the component.
  47. *
  48. * @see com.vaadin.ui.Component#setEnabled(boolean)
  49. *
  50. * @param enabled
  51. * new mode for the component
  52. */
  53. public void setEnabled(boolean enabled) {
  54. this.enabled = enabled;
  55. }
  56. }