Class CmsPopup

java.lang.Object
com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.Widget
com.google.gwt.user.client.ui.Panel
com.google.gwt.user.client.ui.SimplePanel
com.google.gwt.user.client.ui.PopupPanel
org.opencms.gwt.client.ui.CmsPopup
All Implemented Interfaces:
com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.logical.shared.HasCloseHandlers<com.google.gwt.user.client.ui.PopupPanel>, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.EventPreview, com.google.gwt.user.client.ui.AcceptsOneWidget, com.google.gwt.user.client.ui.HasAnimation, com.google.gwt.user.client.ui.HasOneWidget, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.HasWidgets, com.google.gwt.user.client.ui.HasWidgets.ForIsWidget, com.google.gwt.user.client.ui.IsWidget, com.google.gwt.user.client.ui.SourcesPopupEvents, Iterable<com.google.gwt.user.client.ui.Widget>, I_CmsAutoHider
Direct Known Subclasses:
A_CmsListItemSelectDialog, A_CmsNewModelPageDialog, A_CmsUploadDialog, CmsAlertDialog, CmsCategoryDialog, CmsConfirmRemoveDialog, CmsCopyLocaleDialog, CmsCreateGalleryDialog, CmsCreateModeSelectionDialog, CmsEditExternalLinkDialog, CmsErrorDialog, CmsFormDialog, CmsFramePopup, CmsGalleryPopup, CmsListAddDialog, CmsLockReportDialog, CmsOptionDialog, CmsPreviewDialog, CmsPropertyDefinitionDialog, CmsPublishConfirmationDialog, CmsPublishDialog, CmsRemovedElementDeletionDialog, CmsRenameDialog, CmsReplaceDialog, CmsResourceInfoDialog, CmsRestoreDialog, CmsReuseInfoDialog, CmsSeoOptionsDialog, CmsSingleFileUploadDialog, CmsToolbarPopup, CmsUploadPopup

public class CmsPopup extends com.google.gwt.user.client.ui.PopupPanel implements I_CmsAutoHider
Provides a pop up dialog base.
Since:
8.0.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Handles fragment changes by closing the active popups.

    Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.PopupPanel

    com.google.gwt.user.client.ui.PopupPanel.AnimationType, com.google.gwt.user.client.ui.PopupPanel.PositionCallback

    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

    Nested classes/interfaces inherited from interface com.google.gwt.user.client.ui.HasWidgets

    com.google.gwt.user.client.ui.HasWidgets.ForIsWidget
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default width of this dialog.
    protected com.google.gwt.user.client.Command
    The close command.
    protected boolean
    Flag which indicates whether the notification widget has already been installed.
    protected int
    The window width.
    static final int
    The wide dialog width.

    Fields inherited from class com.google.gwt.user.client.ui.UIObject

    DEBUG_ID_PREFIX
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor.
    CmsPopup(int width)
    Constructor setting the width of the dialog.
    CmsPopup(String caption)
    Constructor setting the dialog caption.
    CmsPopup(String caption, int width)
    Constructor setting caption and width.
    CmsPopup(String title, com.google.gwt.user.client.ui.Widget content)
    The constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    add(com.google.gwt.user.client.ui.Widget w)
    Adds the given child widget.
    protected void
    add(com.google.gwt.user.client.ui.Widget child, com.google.gwt.dom.client.Element container)
    Adds a new child widget to the panel, attaching its Element to the specified container Element.
    void
    addButton(com.google.gwt.user.client.ui.Widget button)
    Adds a button widget to the button panel.
    void
    addButton(com.google.gwt.user.client.ui.Widget button, int position)
    Adds a button widget to the button panel before the given position.
    void
    addDialogClose(com.google.gwt.user.client.Command cmd)
    Adds a close "button" to the top of the popup.
    protected int
    adjustIndex(com.google.gwt.user.client.ui.Widget child, int beforeIndex)
    Adjusts beforeIndex to account for the possibility that the given widget is already a child of this panel.
    protected void
    beginDragging(com.google.gwt.event.dom.client.MouseDownEvent event)
    Called on mouse down in the caption area, begins the dragging loop by turning on event capture.
    void
    Replaces current notification widget by an overlay.
    void
     
    void
    Shows the dialog and centers it horizontally, but positions it at a fixed vertical position.
    protected void
    Checks that index is in the range [0, getWidgetCount()), which is the valid range on accessible indexes.
    protected void
    Checks that index is in the range [0, getWidgetCount()], which is the valid range for indexes on an insertion.
    void
     
    protected void
    continueDragging(com.google.gwt.event.dom.client.MouseMoveEvent event)
    Called on mouse move in the caption area, continues dragging if it was started by beginDragging(com.google.gwt.event.dom.client.MouseDownEvent).
    Creates a new notification widget for this dialog.
    protected void
     
    protected void
     
    protected void
    endDragging(com.google.gwt.event.dom.client.MouseUpEvent event)
    Called on mouse up in the caption area, ends dragging by ending event capture.
    int
    getAvailableHeight(int fixedContentHeight)
    Returns the maximum available height inside the popup.
    Returns the dialog caption text.
    protected com.google.gwt.user.client.ui.WidgetCollection
    Gets the list of children contained in this panel.
    protected com.google.gwt.user.client.Element
     
    com.google.gwt.user.client.ui.Widget
    getWidget(int index)
    Returns the child widget with the given index.
    int
    Returns the number of child widgets.
    int
    getWidgetIndex(com.google.gwt.user.client.ui.IsWidget child)
    Returns the index of the given widget.
    int
    getWidgetIndex(com.google.gwt.user.client.ui.Widget child)
    Returns the index of the given child widget.
    int
    Returns the dialog content width, -1 if not set.
    boolean
    Returns true if a caption is set for this popup false otherwise.
    void
    Hides the widget.
    void
    hide(boolean autoClosed)
     
    void
    insert(com.google.gwt.user.client.ui.Widget w, int beforeIndex)
    Inserts a child widget before the given index.
    protected void
    insert(com.google.gwt.user.client.ui.Widget child, com.google.gwt.dom.client.Element container, int beforeIndex, boolean domInsert)
    Insert a new child Widget into this Panel at a specified index, attaching its Element to the specified container Element.
    void
    insertFront(com.google.gwt.user.client.ui.Widget widget)
    Inserts a widget as the first widget in the popup.
    protected void
    Sets the notification widget.
    Iterator<com.google.gwt.user.client.ui.Widget>
     
    void
    onBrowserEvent(com.google.gwt.user.client.Event event)
     
    protected void
    Override to work around the glass overlay still showing after dialog hide.
    protected void
    onPreviewNativeEvent(com.google.gwt.user.client.Event.NativePreviewEvent event)
     
    boolean
    remove(int index)
    Removes a child widget.
    boolean
    remove(com.google.gwt.user.client.ui.Widget w)
     
    void
    Removes all buttons.
    void
    removeButton(com.google.gwt.user.client.ui.Widget button)
    Removes the given button widget from the button panel.
    void
    Removes the padding from the popup's content.
    void
    Sets the popup's content background.
    void
    setCaption(String caption)
    Sets the captions text.
    void
    setHeight(int height)
    Sets the height for the popup content.
    void
    setHeight(String height)
    Deprecated.
    void
    setMainContent(com.google.gwt.user.client.ui.Widget w)
    Replaces the content from the main widget.
    void
    setPixelSize(int width, int height)
    Deprecated.
    void
    Sets the popup's dialog position to 'fixed'.
    void
    setSize(String width, String height)
    Deprecated.
    void
    Sets an additional CSS class to the main content element.
    void
    setUseAnimation(boolean use)
    Sets the use animation flag.
    void
    setWidget(com.google.gwt.user.client.ui.Widget w)
    Deprecated.
    void
    setWidth(int width)
    Sets the width for the popup content.
    void
    Deprecated.
    void
     
    protected void
    showArrow(com.google.gwt.dom.client.Element arrow)
    Appends the arrow element to the popup's dialog.
    static com.google.gwt.user.client.ui.Widget
    wrapWithBorderPadding(com.google.gwt.user.client.ui.Widget w)
    Wraps the given Widget with a cornered border, padding and margin.

    Methods inherited from class com.google.gwt.user.client.ui.PopupPanel

    addAutoHidePartner, addCloseHandler, addPopupListener, getAnimationType, getGlassElement, getGlassStyleName, getOffsetHeight, getOffsetWidth, getPopupLeft, getPopupTop, getStyleElement, getTitle, isAnimationEnabled, isAutoHideEnabled, isAutoHideOnHistoryEventsEnabled, isGlassEnabled, isModal, isPreviewingAllNativeEvents, isShowing, isVisible, onEventPreview, onKeyDownPreview, onKeyPressPreview, onKeyUpPreview, onUnload, removeAutoHidePartner, removePopupListener, setAnimationEnabled, setAnimationType, setAutoHideEnabled, setAutoHideOnHistoryEventsEnabled, setGlassEnabled, setGlassStyleName, setModal, setPopupPosition, setPopupPositionAndShow, setPreviewingAllNativeEvents, setTitle, setVisible, showRelativeTo

    Methods inherited from class com.google.gwt.user.client.ui.SimplePanel

    getWidget, setWidget

    Methods inherited from class com.google.gwt.user.client.ui.Panel

    add, adopt, orphan, remove

    Methods inherited from class com.google.gwt.user.client.ui.Widget

    addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, createHandlerManager, delegateEvent, fireEvent, getHandlerCount, getLayoutData, getParent, isAttached, isOrWasAttached, onAttach, onLoad, removeFromParent, setLayoutData, sinkEvents, unsinkEvents

    Methods inherited from class com.google.gwt.user.client.ui.UIObject

    addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, resolvePotentialElement, setElement, setElement, setStyleDependentName, setStyleName, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setVisible, sinkBitlessEvent, toString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.google.gwt.event.shared.HasHandlers

    fireEvent

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

  • Constructor Details

    • CmsPopup

      public CmsPopup()
      Constructor.

    • CmsPopup

      public CmsPopup(int width)
      Constructor setting the width of the dialog.

      Parameters:
      width - the width to set
    • CmsPopup

      public CmsPopup(String caption)
      Constructor setting the dialog caption.

      Parameters:
      caption - the caption to set
    • CmsPopup

      public CmsPopup(String caption, int width)
      Constructor setting caption and width.

      Parameters:
      caption - the caption to set
      width - the width to set
    • CmsPopup

      public CmsPopup(String title, com.google.gwt.user.client.ui.Widget content)
      The constructor.

      Parameters:
      title - the title and heading of the dialog
      content - the content widget
  • Method Details

    • wrapWithBorderPadding

      public static com.google.gwt.user.client.ui.Widget wrapWithBorderPadding(com.google.gwt.user.client.ui.Widget w)
      Wraps the given Widget with a cornered border, padding and margin.

      Parameters:
      w - the widget to wrap
      Returns:
      a new widget that wraps the given one
    • add

      public void add(com.google.gwt.user.client.ui.Widget w)
      Adds the given child widget.

      Specified by:
      add in interface com.google.gwt.user.client.ui.HasWidgets
      Overrides:
      add in class com.google.gwt.user.client.ui.SimplePanel
      Parameters:
      w - the widget
    • addButton

      public void addButton(com.google.gwt.user.client.ui.Widget button)
      Adds a button widget to the button panel.

      Parameters:
      button - the button widget
    • addButton

      public void addButton(com.google.gwt.user.client.ui.Widget button, int position)
      Adds a button widget to the button panel before the given position.

      Parameters:
      button - the button widget
      position - the position to insert the button
    • addDialogClose

      public void addDialogClose(com.google.gwt.user.client.Command cmd)
      Adds a close "button" to the top of the popup.

      Parameters:
      cmd - the command that should be executed when the close button is clicked
    • catchNotifications

      public void catchNotifications()
      Replaces current notification widget by an overlay.

    • center

      public void center()
      Overrides:
      center in class com.google.gwt.user.client.ui.PopupPanel
      See Also:
      • PopupPanel.center()
    • centerHorizontally

      public void centerHorizontally(int top)
      Shows the dialog and centers it horizontally, but positions it at a fixed vertical position.

      Parameters:
      top - the top position
    • clear

      public void clear()
      Specified by:
      clear in interface com.google.gwt.user.client.ui.HasWidgets
      Overrides:
      clear in class com.google.gwt.user.client.ui.Panel
      See Also:
      • Panel.clear()
    • getAvailableHeight

      public int getAvailableHeight(int fixedContentHeight)
      Returns the maximum available height inside the popup.

      Parameters:
      fixedContentHeight - fixed content height to deduct from the available height
      Returns:
      the maximum available height
    • getCaption

      public String getCaption()
      Returns the dialog caption text.

      Returns:
      the dialog caption
    • getWidget

      public com.google.gwt.user.client.ui.Widget getWidget(int index)
      Returns the child widget with the given index.

      Parameters:
      index - the index
      Returns:
      the child widget
    • getWidgetCount

      public int getWidgetCount()
      Returns the number of child widgets.

      Returns:
      the number of child widgets
    • getWidgetIndex

      public int getWidgetIndex(com.google.gwt.user.client.ui.IsWidget child)
      Returns the index of the given widget.

      Parameters:
      child - the child widget
      Returns:
      the index of the child widget
    • getWidgetIndex

      public int getWidgetIndex(com.google.gwt.user.client.ui.Widget child)
      Returns the index of the given child widget.

      Parameters:
      child - the child widget
      Returns:
      the index
    • getWidth

      public int getWidth()
      Returns the dialog content width, -1 if not set.

      Returns:
      the dialog content width
    • hasCaption

      public boolean hasCaption()
      Returns true if a caption is set for this popup false otherwise.

      Returns:
      true if a caption is set for this popup false otherwise
    • hide

      public void hide()
      Description copied from interface: I_CmsAutoHider
      Hides the widget.

      Specified by:
      hide in interface I_CmsAutoHider
      Overrides:
      hide in class com.google.gwt.user.client.ui.PopupPanel
      See Also:
      • PopupPanel.hide()
    • hide

      public void hide(boolean autoClosed)
      Overrides:
      hide in class com.google.gwt.user.client.ui.PopupPanel
      See Also:
      • PopupPanel.hide(boolean)
    • insert

      public void insert(com.google.gwt.user.client.ui.Widget w, int beforeIndex) throws IndexOutOfBoundsException
      Inserts a child widget before the given index.

      Parameters:
      w - the child widget
      beforeIndex - the index
      Throws:
      IndexOutOfBoundsException - if the index is out of bounds
    • insertFront

      public void insertFront(com.google.gwt.user.client.ui.Widget widget)
      Inserts a widget as the first widget in the popup.

      Parameters:
      widget - the widget to insert
    • iterator

      public Iterator<com.google.gwt.user.client.ui.Widget> iterator()
      Specified by:
      iterator in interface com.google.gwt.user.client.ui.HasWidgets
      Specified by:
      iterator in interface Iterable<com.google.gwt.user.client.ui.Widget>
      Overrides:
      iterator in class com.google.gwt.user.client.ui.SimplePanel
      See Also:
      • SimplePanel.iterator()
    • onBrowserEvent

      public void onBrowserEvent(com.google.gwt.user.client.Event event)
      Specified by:
      onBrowserEvent in interface com.google.gwt.user.client.EventListener
      Overrides:
      onBrowserEvent in class com.google.gwt.user.client.ui.Widget
      See Also:
      • Widget.onBrowserEvent(com.google.gwt.user.client.Event)
    • remove

      public boolean remove(int index)
      Removes a child widget.

      Parameters:
      index - the index of the widget to remove
      Returns:
      true if the there was a widget at the given index to remove
    • remove

      public boolean remove(com.google.gwt.user.client.ui.Widget w)
      Specified by:
      remove in interface com.google.gwt.user.client.ui.HasWidgets
      Overrides:
      remove in class com.google.gwt.user.client.ui.SimplePanel
      See Also:
      • SimplePanel.remove(com.google.gwt.user.client.ui.Widget)
    • removeAllButtons

      public void removeAllButtons()
      Removes all buttons.

    • removeButton

      public void removeButton(com.google.gwt.user.client.ui.Widget button)
      Removes the given button widget from the button panel.

      Parameters:
      button - the button widget to remove
    • removePadding

      public void removePadding()
      Removes the padding from the popup's content.

    • setBackgroundColor

      public void setBackgroundColor(String color)
      Sets the popup's content background.

      Parameters:
      color - the color to set
    • setCaption

      public void setCaption(String caption)
      Sets the captions text.

      Parameters:
      caption - the text to set
    • setHeight

      public void setHeight(int height)
      Sets the height for the popup content.

      Parameters:
      height - the height in pixels
    • setHeight

      @Deprecated public void setHeight(String height)
      Deprecated.
      Overrides:
      setHeight in class com.google.gwt.user.client.ui.PopupPanel
      See Also:
      • PopupPanel.setHeight(java.lang.String)
    • setMainContent

      public void setMainContent(com.google.gwt.user.client.ui.Widget w)
      Replaces the content from the main widget.

      Parameters:
      w - the widget that should replace the main content
    • setPixelSize

      @Deprecated public void setPixelSize(int width, int height)
      Deprecated.
      Overrides:
      setPixelSize in class com.google.gwt.user.client.ui.UIObject
      See Also:
      • UIObject.setSize(java.lang.String, java.lang.String)
    • setPositionFixed

      public void setPositionFixed()
      Sets the popup's dialog position to 'fixed'.

    • setSize

      @Deprecated public void setSize(String width, String height)
      Deprecated.
      Overrides:
      setSize in class com.google.gwt.user.client.ui.UIObject
      See Also:
      • UIObject.setSize(java.lang.String, java.lang.String)
    • setSpecialBackgroundClass

      public void setSpecialBackgroundClass(String cssClassName)
      Sets an additional CSS class to the main content element.

      Parameters:
      cssClassName - the CSS class to set
    • setUseAnimation

      public void setUseAnimation(boolean use)
      Sets the use animation flag.

      Parameters:
      use - true if the animation should be used, default is true
    • setWidget

      @Deprecated public void setWidget(com.google.gwt.user.client.ui.Widget w)
      Deprecated.
      Unsupported operation.

      Specified by:
      setWidget in interface com.google.gwt.user.client.ui.HasOneWidget
      Overrides:
      setWidget in class com.google.gwt.user.client.ui.PopupPanel
      See Also:
      • PopupPanel.setWidget(com.google.gwt.user.client.ui.Widget)
    • setWidth

      public void setWidth(int width)
      Sets the width for the popup content.

      Parameters:
      width - the width in pixels
    • setWidth

      @Deprecated public void setWidth(String width)
      Deprecated.
      Overrides:
      setWidth in class com.google.gwt.user.client.ui.PopupPanel
      See Also:
      • PopupPanel.setWidth(java.lang.String)
    • show

      public void show()
      Overrides:
      show in class com.google.gwt.user.client.ui.PopupPanel
      See Also:
      • PopupPanel.show()
    • add

      protected void add(com.google.gwt.user.client.ui.Widget child, com.google.gwt.dom.client.Element container)
      Adds a new child widget to the panel, attaching its Element to the specified container Element.
      Parameters:
      child - the child widget to be added
      container - the element within which the child will be contained
    • adjustIndex

      protected int adjustIndex(com.google.gwt.user.client.ui.Widget child, int beforeIndex)
      Adjusts beforeIndex to account for the possibility that the given widget is already a child of this panel.
      Parameters:
      child - the widget that might be an existing child
      beforeIndex - the index at which it will be added to this panel
      Returns:
      the modified index
    • beginDragging

      protected void beginDragging(com.google.gwt.event.dom.client.MouseDownEvent event)
      Called on mouse down in the caption area, begins the dragging loop by turning on event capture.
      Parameters:
      event - the mouse down event that triggered dragging
      See Also:
    • checkIndexBoundsForAccess

      protected void checkIndexBoundsForAccess(int index)
      Checks that index is in the range [0, getWidgetCount()), which is the valid range on accessible indexes.
      Parameters:
      index - the index being accessed
    • checkIndexBoundsForInsertion

      protected void checkIndexBoundsForInsertion(int index)
      Checks that index is in the range [0, getWidgetCount()], which is the valid range for indexes on an insertion.
      Parameters:
      index - the index where insertion will occur
    • continueDragging

      protected void continueDragging(com.google.gwt.event.dom.client.MouseMoveEvent event)
      Called on mouse move in the caption area, continues dragging if it was started by beginDragging(com.google.gwt.event.dom.client.MouseDownEvent).
      Parameters:
      event - the mouse move event that continues dragging
      See Also:
    • createDialogNotificationWidget

      Creates a new notification widget for this dialog.

      Returns:
      the notification widget for this dialog
    • doAttachChildren

      protected void doAttachChildren()
      Overrides:
      doAttachChildren in class com.google.gwt.user.client.ui.Panel
      See Also:
      • Panel.doAttachChildren()
    • doDetachChildren

      protected void doDetachChildren()
      Overrides:
      doDetachChildren in class com.google.gwt.user.client.ui.Panel
      See Also:
      • Panel.doDetachChildren()
    • endDragging

      protected void endDragging(com.google.gwt.event.dom.client.MouseUpEvent event)
      Called on mouse up in the caption area, ends dragging by ending event capture.
      Parameters:
      event - the mouse up event that ended dragging
      See Also:
    • getChildren

      protected com.google.gwt.user.client.ui.WidgetCollection getChildren()
      Gets the list of children contained in this panel.
      Returns:
      a collection of child widgets
    • getContainerElement

      protected com.google.gwt.user.client.Element getContainerElement()
      Overrides:
      getContainerElement in class com.google.gwt.user.client.ui.PopupPanel
      See Also:
      • PopupPanel.getContainerElement()
    • insert

      protected void insert(com.google.gwt.user.client.ui.Widget child, com.google.gwt.dom.client.Element container, int beforeIndex, boolean domInsert)
      Insert a new child Widget into this Panel at a specified index, attaching its Element to the specified container Element. The child Element will either be attached to the container at the same index, or simply appended to the container, depending on the value of domInsert.
      Parameters:
      child - the child Widget to be added
      container - the Element within which child will be contained
      beforeIndex - the index before which child will be inserted
      domInsert - if true, insert child into container at beforeIndex; otherwise append child to the end of container.
    • installNotificationWidget

      protected void installNotificationWidget()
      Sets the notification widget.

    • onDetach

      protected void onDetach()
      Override to work around the glass overlay still showing after dialog hide.

      Overrides:
      onDetach in class com.google.gwt.user.client.ui.Widget
      See Also:
      • Widget.onDetach()
    • onPreviewNativeEvent

      protected void onPreviewNativeEvent(com.google.gwt.user.client.Event.NativePreviewEvent event)
      Overrides:
      onPreviewNativeEvent in class com.google.gwt.user.client.ui.PopupPanel
      See Also:
      • PopupPanel.onPreviewNativeEvent(com.google.gwt.user.client.Event.NativePreviewEvent)
    • showArrow

      protected void showArrow(com.google.gwt.dom.client.Element arrow)
      Appends the arrow element to the popup's dialog.

      Parameters:
      arrow - the arrow element to add