Class CmsPaddedPanel

  • 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.AcceptsOneWidget, 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, java.lang.Iterable<com.google.gwt.user.client.ui.Widget>

    public class CmsPaddedPanel
    extends com.google.gwt.user.client.ui.SimplePanel
    Basic panel class with a horizontal pseudo-padding.

    This padding is implemented by dynamically setting the size and margins of the contained widget after insertion into the DOM.

    It only works with a single child widget right now and thus extends SimplePanel.

    Since:
    8.0.0
    • 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
      • 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 I_CmsInputCss CSS
      The CSS bundle used for this widget.
      • Fields inherited from class com.google.gwt.user.client.ui.UIObject

        DEBUG_ID_PREFIX
    • Constructor Summary

      Constructors 
      Constructor Description
      CmsPaddedPanel​(int paddingX)
      Constructs a new instance of this widget.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void onLoad()
      We override the onLoad method because the width of the internal text box needs to be calculated after the widget is attached to the DOM.
      void setPaddingX​(int paddingX)
      Sets the horizontal padding of this widget and updates the style for this widget.
      void updatePadding()
      Updates the horizontal "padding" for this text box.
      • Methods inherited from class com.google.gwt.user.client.ui.SimplePanel

        add, getContainerElement, getWidget, iterator, remove, setWidget, setWidget
      • Methods inherited from class com.google.gwt.user.client.ui.Panel

        add, adopt, clear, doAttachChildren, doDetachChildren, 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, onBrowserEvent, onDetach, 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, resolvePotentialElement, 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
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Field Detail

      • CSS

        public static final I_CmsInputCss CSS
        The CSS bundle used for this widget.
    • Constructor Detail

      • CmsPaddedPanel

        public CmsPaddedPanel​(int paddingX)
        Constructs a new instance of this widget.

        Parameters:
        paddingX - the horizontal padding to use
    • Method Detail

      • setPaddingX

        public void setPaddingX​(int paddingX)
        Sets the horizontal padding of this widget and updates the style for this widget.

        Parameters:
        paddingX - the new padding value
      • updatePadding

        public void updatePadding()
        Updates the horizontal "padding" for this text box.

        This isn't done via the CSS padding property, because if we set the width of the widget to 100%, a real padding would make a part of the widget stick outside of its parent element. Instead, we change the width of the textbox and its left and right margins.

      • onLoad

        protected void onLoad()
        We override the onLoad method because the width of the internal text box needs to be calculated after the widget is attached to the DOM.

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