org.cruxframework.crux.widgets.client.dialogcontainer
Class DialogViewContainer

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.ParameterizedViewContainer
                      extended by org.cruxframework.crux.core.client.screen.views.SingleViewContainer
                          extended by org.cruxframework.crux.widgets.client.dialogcontainer.DialogViewContainer
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

public class DialogViewContainer
extends org.cruxframework.crux.core.client.screen.views.SingleViewContainer

A View Container that render its views inside a floating dialog box.

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
static String DEFAULT_STYLE_NAME
           
 
Fields inherited from class org.cruxframework.crux.core.client.screen.views.SingleViewContainer
activeView
 
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
DialogViewContainer()
          Default Constructor.
DialogViewContainer(boolean closeable, boolean modal)
          Constructor.
 
Method Summary
 void center()
          Open the dialog container and center it on the screen.
 void closeDialog()
          Close the container dialog.
 boolean closeDialog(boolean unloadView)
          Close the container dialog.
static DialogViewContainer createDialog(String viewName)
          Create a new DialogViewContainer and load the given view into the container
static DialogViewContainer createDialog(String viewName, String viewId, boolean closeable)
          Create a new DialogViewContainer and load the given view into the container.
static DialogViewContainer createDialog(String viewName, String viewId, boolean closeable, boolean modal, String width, String height, int left, int top)
          Create a new DialogViewContainer and load the given view into the container.
static DialogViewContainer createDialog(String viewName, String viewId, boolean closeable, boolean modal, String width, String height, int left, int top, Object parameter)
          Create a new DialogViewContainer and load the given view into the container.
protected  boolean doAdd(org.cruxframework.crux.core.client.screen.views.View view, boolean lazy, Object parameter)
           
protected  boolean doRemove(org.cruxframework.crux.core.client.screen.views.View view, boolean skipEvents)
           
protected  com.google.gwt.user.client.ui.Panel getContainerPanel()
           
protected  com.google.gwt.user.client.ui.Panel getContainerPanel(org.cruxframework.crux.core.client.screen.views.View view)
           
 org.cruxframework.crux.core.client.screen.views.View getView()
          Read the current view loaded into this container.
protected  void handleViewTitle(String title, com.google.gwt.user.client.ui.Panel containerPanel, String viewId)
           
 boolean isModal()
          Read the modal property value.
 boolean isUnloadViewOnClose()
          Read the unloadViewOnClose property value.
 void openDialog()
          Open the container dialog box.
static void openDialog(String viewName)
          Create a dialog container, load the given view into the container and open the dialog box.
static void openDialog(String viewName, String viewId, boolean closeable)
          Create a dialog container, load the given view into the container and open the dialog box.
 void setHeight(String height)
          Set the dialog height
 void setModal(boolean modal)
          Write the modal property value.
 void setPosition(int left, int top)
          Set the dialog position
 void setSize(String width, String height)
          Set the dialog dimensions.
 void setStyleDependentName(String styleSuffix, boolean add)
           
 void setStyleName(String style)
           
 void setStyleName(String style, boolean add)
           
 void setStylePrimaryName(String style)
           
 void setUnloadViewOnClose(boolean unloadViewOnClose)
          Write the unloadViewOnClose property value.
 void setWidth(String width)
          Set the dialog width
 
Methods inherited from class org.cruxframework.crux.core.client.screen.views.SingleViewContainer
activate, deactivate, getActiveView, hasHistoryHandlers, hasOrientationChangeHandlers, hasResizeHandlers, hasWindowCloseHandlers, hasWindowClosingHandlers, notifyViewsAboutHistoryChange, notifyViewsAboutOrientationChange, notifyViewsAboutWindowClose, notifyViewsAboutWindowClosing, notifyViewsAboutWindowResize
 
Methods inherited from class org.cruxframework.crux.core.client.screen.views.ParameterizedViewContainer
add, loadView, showView
 
Methods inherited from class org.cruxframework.crux.core.client.screen.views.ViewContainer
add, addLazy, addLazy, addLazy, addView, adoptView, bindToDOM, clear, createView, createView, getMainWidget, getView, getViewFactory, loadAndRenderView, loadView, loadView, remove, remove, renderView, showView, showView, showView, unbindToDOM
 
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, setPixelSize, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, sinkBitlessEvent, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_STYLE_NAME

public static final String DEFAULT_STYLE_NAME
See Also:
Constant Field Values
Constructor Detail

DialogViewContainer

public DialogViewContainer()
Default Constructor. The created dialog will be closeable and modal.


DialogViewContainer

public DialogViewContainer(boolean closeable,
                           boolean modal)
Constructor.

Parameters:
closeable - if true, a close button will be present at to top of dialog box
modal - if true, a modal dialog will be created
Method Detail

openDialog

public static void openDialog(String viewName)
Create a dialog container, load the given view into the container and open the dialog box.

Parameters:
viewName - name of the view to be opened

openDialog

public static void openDialog(String viewName,
                              String viewId,
                              boolean closeable)
Create a dialog container, load the given view into the container and open the dialog box.

Parameters:
viewName - name of the view to be opened
viewId - ID to be used to identify the opened view
closeable - if true, a close button will be present at to top of dialog box

createDialog

public static DialogViewContainer createDialog(String viewName)
Create a new DialogViewContainer and load the given view into the container

Parameters:
viewName - name of the view to be loaded
Returns:
the container created

createDialog

public static DialogViewContainer createDialog(String viewName,
                                               String viewId,
                                               boolean closeable)
Create a new DialogViewContainer and load the given view into the container.

Parameters:
viewName - name of the view to be loaded
viewId - ID to be used to identify the opened view
closeable - if true, a close button will be present at to top of dialog box
Returns:
the container created

createDialog

public static DialogViewContainer createDialog(String viewName,
                                               String viewId,
                                               boolean closeable,
                                               boolean modal,
                                               String width,
                                               String height,
                                               int left,
                                               int top)
Create a new DialogViewContainer and load the given view into the container.

Parameters:
viewName - name of the view to be loaded
viewId - ID to be used to identify the opened view
closeable - if true, a close button will be present at to top of dialog box
modal - if true, a modal dialog will be created
width - dialog box width
height - dialog box height
left - left position of the dialog box
top - top position of the dialog box
Returns:
the container created

createDialog

public static DialogViewContainer createDialog(String viewName,
                                               String viewId,
                                               boolean closeable,
                                               boolean modal,
                                               String width,
                                               String height,
                                               int left,
                                               int top,
                                               Object parameter)
Create a new DialogViewContainer and load the given view into the container.

Parameters:
viewName - name of the view to be loaded
viewId - ID to be used to identify the opened view
closeable - if true, a close button will be present at to top of dialog box
modal - if true, a modal dialog will be created
width - dialog box width
height - dialog box height
left - left position of the dialog box
top - top position of the dialog box
parameter - any object you want to pass as parameter to the view's activate and load event
Returns:
the container created

isUnloadViewOnClose

public boolean isUnloadViewOnClose()
Read the unloadViewOnClose property value. This property tells the container if it must unload the containing view when the dialog is closed.

Returns:
unloadViewOnClose property value

setUnloadViewOnClose

public void setUnloadViewOnClose(boolean unloadViewOnClose)
Write the unloadViewOnClose property value. This property tells the container if it must unload the containing view when the dialog is closed.

Parameters:
unloadViewOnClose - unloadViewOnClose property value

setModal

public void setModal(boolean modal)
Write the modal property value. This property tells the container if the opened dialog should be modal.

Parameters:
modal - modal property value

isModal

public boolean isModal()
Read the modal property value. This property tells the container if the opened dialog should be modal.

Returns:
modal property value

setSize

public void setSize(String width,
                    String height)
Set the dialog dimensions.

Overrides:
setSize in class com.google.gwt.user.client.ui.UIObject
Parameters:
width - dialog width
height - dialog height

setWidth

public void setWidth(String width)
Set the dialog width

Overrides:
setWidth in class com.google.gwt.user.client.ui.UIObject
Parameters:
width - dialog width

setHeight

public void setHeight(String height)
Set the dialog height

Overrides:
setHeight in class com.google.gwt.user.client.ui.UIObject
Parameters:
width - dialog height

setPosition

public void setPosition(int left,
                        int top)
Set the dialog position

Parameters:
left - dialog left position
top - dialog top position

setStyleName

public void setStyleName(String style)
Overrides:
setStyleName in class com.google.gwt.user.client.ui.UIObject

setStyleDependentName

public void setStyleDependentName(String styleSuffix,
                                  boolean add)
Overrides:
setStyleDependentName in class com.google.gwt.user.client.ui.UIObject

setStyleName

public void setStyleName(String style,
                         boolean add)
Overrides:
setStyleName in class com.google.gwt.user.client.ui.UIObject

setStylePrimaryName

public void setStylePrimaryName(String style)
Overrides:
setStylePrimaryName in class com.google.gwt.user.client.ui.UIObject

center

public void center()
Open the dialog container and center it on the screen. If the container is already opened, just center it on the screen.


getView

public org.cruxframework.crux.core.client.screen.views.View getView()
Read the current view loaded into this container.

Returns:
current view loaded into this container.

openDialog

public void openDialog()
Open the container dialog box. Assert that you previously loaded a view inside the container.


closeDialog

public void closeDialog()
Close the container dialog.


closeDialog

public boolean closeDialog(boolean unloadView)
Close the container dialog. If unloadView parameter is true, try to unload the current view first.

If this view can not be unloaded (its unload event handler cancel the event), this method does not close the container and returns false.

Parameters:
unloadView - if true, unload the current view before close the container.
Returns:
if the dialog was closed.

doAdd

protected boolean doAdd(org.cruxframework.crux.core.client.screen.views.View view,
                        boolean lazy,
                        Object parameter)
Overrides:
doAdd in class org.cruxframework.crux.core.client.screen.views.ViewContainer

doRemove

protected boolean doRemove(org.cruxframework.crux.core.client.screen.views.View view,
                           boolean skipEvents)
Overrides:
doRemove in class org.cruxframework.crux.core.client.screen.views.ViewContainer

getContainerPanel

protected com.google.gwt.user.client.ui.Panel getContainerPanel(org.cruxframework.crux.core.client.screen.views.View view)
Specified by:
getContainerPanel in class org.cruxframework.crux.core.client.screen.views.ViewContainer

getContainerPanel

protected com.google.gwt.user.client.ui.Panel getContainerPanel()

handleViewTitle

protected void handleViewTitle(String title,
                               com.google.gwt.user.client.ui.Panel containerPanel,
                               String viewId)
Specified by:
handleViewTitle in class org.cruxframework.crux.core.client.screen.views.ViewContainer


Copyright © 2015. All rights reserved.