Package arez.dom

Class DocumentVisibility

java.lang.Object
arez.dom.DocumentVisibility
All Implemented Interfaces:
Disposable

public final class DocumentVisibility extends Object implements Disposable
Exposes document.visibilityState as an observable property for specified documents.

A very simple example


 import arez.Arez;
 import arez.dom.DocumentVisibility;
 import com.google.gwt.core.client.EntryPoint;
 import akasha.Console;

 public class DocumentVisibilityExample
   implements EntryPoint
 {
   public void onModuleLoad()
   {
     final DocumentVisibility v = DocumentVisibility.create();
     Arez.context().observer( () -> Console.log( "Document Visibility: " + v.getVisibility() ) );
   }
 }
 
  • Method Details

    • create

      @Nonnull public static DocumentVisibility create()
      Create component monitoring the default document.
      Returns:
      the new component.
    • create

      @Nonnull public static DocumentVisibility create(@Nonnull akasha.Document document)
      Create component monitoring specific document.
      Parameters:
      document - the document.
      Returns:
      the new component.
    • getDocument

      @Nonnull public akasha.Document getDocument()
      Return the document that monitoring visibility state.
      Returns:
      the document.
    • setDocument

      public void setDocument(@Nonnull akasha.Document document)
      Change the document that is having visibility state monitored.
      Parameters:
      document - the new document.
    • getVisibility

      Return the visibility state of the document as an enum.
      Returns:
      the visibility state as an enum.
    • getVisibilityState

      @Nonnull public String getVisibilityState()
      Return the visibility state of the document as a string.
      Returns:
      the visibility state as a string.
    • isVisible

      public boolean isVisible()
      Return true if visibility state is "visible".
      Returns:
      true if visibility state is "visible".
    • isHidden

      public boolean isHidden()
      Return true if visibility state is "hidden".
      Returns:
      true if visibility state is "hidden".
    • dispose

      public void dispose()
      Description copied from interface: Disposable
      Dispose the element. See Disposable for a description of the implications.
      Specified by:
      dispose in interface Disposable
    • isDisposed

      public boolean isDisposed()
      Description copied from interface: Disposable
      Return true if dispose() has been called on object.
      Specified by:
      isDisposed in interface Disposable
      Returns:
      true if dispose has been called.