org.cruxframework.crux.core.client.screen.views
Class CrawlableViewContainer

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by org.cruxframework.crux.core.client.screen.views.ViewContainer
                  extended by org.cruxframework.crux.core.client.screen.views.CrawlableViewContainer
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget
Direct Known Subclasses:
MultipleCrawlableViewsContainer, SingleCrawlableViewContainer

public abstract class CrawlableViewContainer
extends ViewContainer

A view container that handle history changes using the hashbang approach https://developers.google.com/webmasters/ajax-crawling/docs/getting-started

Author:
Thiago da Rosa de Bustamante

Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class org.cruxframework.crux.core.client.screen.views.ViewContainer
logger, views
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
CrawlableViewContainer(com.google.gwt.user.client.ui.Widget mainWidget)
          Constructor
CrawlableViewContainer(com.google.gwt.user.client.ui.Widget mainWidget, boolean clearPanelsForDeactivatedViews)
          Constructor
 
Method Summary
protected  boolean activate(View view, com.google.gwt.user.client.ui.Panel containerPanel, Object parameter)
          This method must be called by subclasses when any of your views is rendered.
protected  void attachHistoryControlHandler()
           
protected  void bindToDOM()
          This method must be called by subclasses when the container is attached to DOM
protected  void dettachHistoryControlHandler()
           
protected  String getDefaultHistoryPrefix()
          Return the default historyPrefix
 String getHistoryControlPrefix()
          Retrieve the historyControlPrefix property value.
 boolean isHistoryControlEnabled()
          Retrieve the historyControlEnabled property value.
protected abstract  boolean isViewDisplayed(String viewId)
           
 void setHistoryControlEnabled(boolean historyControlEnabled)
          Sets the historyControlEnabled property value.
 void setHistoryControlPrefix(String historyControlPrefix)
          Sets the historyControlPrefix property value.
protected  void synchronizeHistoryState()
           
protected  void unbindToDOM()
          This method must be called by subclasses when the container is detached from DOM
protected  void updateViewToken(String token)
           
 
Methods inherited from class org.cruxframework.crux.core.client.screen.views.ViewContainer
add, add, addLazy, addView, adoptView, clear, createView, createView, deactivate, doAdd, doRemove, getContainerPanel, getMainWidget, getView, getViewFactory, handleViewTitle, hasHistoryHandlers, hasOrientationChangeHandlers, hasResizeHandlers, hasWindowCloseHandlers, hasWindowClosingHandlers, loadAndRenderView, loadView, loadView, loadView, notifyViewsAboutHistoryChange, notifyViewsAboutOrientationChange, notifyViewsAboutWindowClose, notifyViewsAboutWindowClosing, notifyViewsAboutWindowResize, remove, remove, renderView, showView, showView, showView
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
claimElement, getWidget, initializeClaimedElement, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, render, render, resolvePotentialElement, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, doAttachChildren, doDetachChildren, fireEvent, getHandlerCount, getLayoutData, getParent, isOrWasAttached, onLoad, onUnload, removeFromParent, setLayoutData, sinkEvents, unsinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CrawlableViewContainer

public CrawlableViewContainer(com.google.gwt.user.client.ui.Widget mainWidget)
Constructor

Parameters:
mainWidget - main widget on this container

CrawlableViewContainer

public CrawlableViewContainer(com.google.gwt.user.client.ui.Widget mainWidget,
                              boolean clearPanelsForDeactivatedViews)
Constructor

Parameters:
mainWidget - Main widget on this container
clearPanelsForDeactivatedViews - If true, makes the container clear the container panel for a view, when the view is deactivated.
Method Detail

isHistoryControlEnabled

public boolean isHistoryControlEnabled()
Retrieve the historyControlEnabled property value. When this property is enabled, the container control automatically the browser history to forward and back between container's views changes

Returns:
true if enabled

setHistoryControlEnabled

public void setHistoryControlEnabled(boolean historyControlEnabled)
Sets the historyControlEnabled property value. When this property is enabled, the container control automatically the browser history to forward and back between container's views changes

Parameters:
historyControlEnabled - true to enable history control

getHistoryControlPrefix

public String getHistoryControlPrefix()
Retrieve the historyControlPrefix property value. When historyControlEnabled property is enabled, the container control automatically the browser history to forward and back between container's views changes. This property inform the prefix that will be used on historyTokens created by this container

Returns:
history prefix

setHistoryControlPrefix

public void setHistoryControlPrefix(String historyControlPrefix)
Sets the historyControlPrefix property value. When historyControlEnabled property is enabled, the container control automatically the browser history to forward and back between container's views changes. This property inform the prefix that will be used on historyTokens created by this container

Parameters:
historyControlPrefix - history prefix to set

getDefaultHistoryPrefix

protected String getDefaultHistoryPrefix()
Return the default historyPrefix

Returns:
the default historyPrefix

bindToDOM

protected void bindToDOM()
Description copied from class: ViewContainer
This method must be called by subclasses when the container is attached to DOM

Overrides:
bindToDOM in class ViewContainer

unbindToDOM

protected void unbindToDOM()
Description copied from class: ViewContainer
This method must be called by subclasses when the container is detached from DOM

Overrides:
unbindToDOM in class ViewContainer

activate

protected boolean activate(View view,
                           com.google.gwt.user.client.ui.Panel containerPanel,
                           Object parameter)
Description copied from class: ViewContainer
This method must be called by subclasses when any of your views is rendered.

Overrides:
activate in class ViewContainer

attachHistoryControlHandler

protected void attachHistoryControlHandler()

dettachHistoryControlHandler

protected void dettachHistoryControlHandler()

synchronizeHistoryState

protected void synchronizeHistoryState()

updateViewToken

protected void updateViewToken(String token)

isViewDisplayed

protected abstract boolean isViewDisplayed(String viewId)


Copyright © 2014. All rights reserved.