Class DDGridLayout

java.lang.Object
com.vaadin.server.AbstractClientConnector
com.vaadin.ui.AbstractComponent
com.vaadin.ui.AbstractComponentContainer
com.vaadin.ui.AbstractLayout
com.vaadin.ui.GridLayout
io.jmix.ui.widget.addon.dragdroplayouts.DDGridLayout
All Implemented Interfaces:
com.vaadin.event.ConnectorEventListener, com.vaadin.event.ContextClickEvent.ContextClickNotifier, com.vaadin.event.dd.DragSource, com.vaadin.event.dd.DropTarget, com.vaadin.event.LayoutEvents.LayoutClickNotifier, com.vaadin.event.MethodEventSource, com.vaadin.event.SerializableEventListener, com.vaadin.server.ClientConnector, com.vaadin.server.Sizeable, com.vaadin.server.VariableOwner, com.vaadin.shared.Connector, com.vaadin.ui.Component, com.vaadin.ui.Component.HasContextHelp, com.vaadin.ui.ComponentContainer, com.vaadin.ui.HasComponents, com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.Layout, com.vaadin.ui.Layout.AlignmentHandler, com.vaadin.ui.Layout.MarginHandler, com.vaadin.ui.Layout.SpacingHandler, com.vaadin.ui.LegacyComponent, DragFilterSupport, DragGrabFilterSupport, DragImageReferenceSupport, HasDragCaptionProvider, LayoutDragSource, ShimSupport, Serializable, Iterable<com.vaadin.ui.Component>, EventListener

public class DDGridLayout extends com.vaadin.ui.GridLayout implements LayoutDragSource, com.vaadin.event.dd.DropTarget, ShimSupport, com.vaadin.ui.LegacyComponent, DragFilterSupport, DragImageReferenceSupport, DragGrabFilterSupport, HasDragCaptionProvider
Grid layout with drag and drop support
Since:
0.4.0
See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    class 
    Target details for a drop event
    static class 
    Contains the transferable details when dragging from a GridLayout.

    Nested classes/interfaces inherited from class com.vaadin.ui.GridLayout

    com.vaadin.ui.GridLayout.Area, com.vaadin.ui.GridLayout.OutOfBoundsException, com.vaadin.ui.GridLayout.OverlapsException

    Nested classes/interfaces inherited from class com.vaadin.server.AbstractClientConnector

    com.vaadin.server.AbstractClientConnector.IncorrectConcurrentAccessHandler

    Nested classes/interfaces inherited from interface com.vaadin.server.ClientConnector

    com.vaadin.server.ClientConnector.AttachEvent, com.vaadin.server.ClientConnector.AttachListener, com.vaadin.server.ClientConnector.ConnectorErrorEvent, com.vaadin.server.ClientConnector.DetachEvent, com.vaadin.server.ClientConnector.DetachListener

    Nested classes/interfaces inherited from interface com.vaadin.ui.Component

    com.vaadin.ui.Component.ErrorEvent, com.vaadin.ui.Component.Event, com.vaadin.ui.Component.Focusable, com.vaadin.ui.Component.HasContextHelp, com.vaadin.ui.Component.Listener

    Nested classes/interfaces inherited from interface com.vaadin.ui.Component.HasContextHelp

    com.vaadin.ui.Component.HasContextHelp.ContextHelpIconClickEvent, com.vaadin.ui.Component.HasContextHelp.ContextHelpIconClickListener

    Nested classes/interfaces inherited from interface com.vaadin.ui.HasComponents

    com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier, com.vaadin.ui.HasComponents.ComponentAttachEvent, com.vaadin.ui.HasComponents.ComponentAttachListener, com.vaadin.ui.HasComponents.ComponentDetachEvent, com.vaadin.ui.HasComponents.ComponentDetachListener

    Nested classes/interfaces inherited from interface com.vaadin.ui.Layout

    com.vaadin.ui.Layout.AlignmentHandler, com.vaadin.ui.Layout.MarginHandler, com.vaadin.ui.Layout.SpacingHandler

    Nested classes/interfaces inherited from interface com.vaadin.server.Sizeable

    com.vaadin.server.Sizeable.Unit
  • Field Summary

    Fields inherited from class com.vaadin.ui.AbstractComponent

    componentErrorProvider, DESIGN_ATTR_PLAIN_TEXT, requiredError

    Fields inherited from interface com.vaadin.server.Sizeable

    SIZE_UNDEFINED, UNITS_CM, UNITS_EM, UNITS_EX, UNITS_INCH, UNITS_MM, UNITS_PERCENTAGE, UNITS_PICAS, UNITS_PIXELS, UNITS_POINTS
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs an empty grid layout that is extended as needed.
    DDGridLayout(int columns, int rows)
    Constructor for grid of given size (number of cells).
    DDGridLayout(int columns, int rows, com.vaadin.ui.Component... children)
    Constructor for grid of given size (number of cells).
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    beforeClientResponse(boolean initial)
     
    void
    changeVariables(Object source, Map<String,Object> variables)
     
     
    Get a filter which determines which components can be dragged from the layout and which cannot.
     
    Returns the drag image provider
    Gets the drag mode which controls how drags can be made.
    com.vaadin.event.dd.DropHandler
     
    com.vaadin.event.Transferable
    boolean
    Are shims used over iframes so dragging is possible
    void
    paintContent(com.vaadin.server.PaintTarget target)
     
    void
    Sets the ratio which determines how a cell is divided into drop zones.
    void
    Sets the ratio which determines how a cell is divided into drop zones.
    void
     
    void
    Set a filter which determines which components can be dragged from the layout and which cannot.
    void
     
    void
    Set a component as a drag image for a component in the layout.
    void
    Sets the drag mode which controls how drags can be made.
    void
    setDropHandler(com.vaadin.event.dd.DropHandler dropHandler)
    void
    setShim(boolean shim)
    False to disable the iframe shim used to enable dragging iframe based components (defaults to true).
    com.vaadin.event.dd.TargetDetails

    Methods inherited from class com.vaadin.ui.GridLayout

    addComponent, addComponent, addComponent, addLayoutClickListener, getColumnExpandRatio, getColumns, getComponent, getComponentAlignment, getComponentArea, getComponentCount, getCursorX, getCursorY, getCustomAttributes, getDefaultComponentAlignment, getMargin, getRowExpandRatio, getRows, getState, insertRow, isHideEmptyRowsAndColumns, isSpacing, iterator, newLine, readDesign, removeAllComponents, removeComponent, removeComponent, removeLayoutClickListener, removeRow, replaceComponent, setColumnExpandRatio, setColumns, setComponentAlignment, setCursorX, setCursorY, setDefaultComponentAlignment, setHideEmptyRowsAndColumns, setMargin, setMargin, setRowExpandRatio, setRows, setSpacing, space, writeDesign

    Methods inherited from class com.vaadin.ui.AbstractLayout

    isRequiredIndicatorVisible, readMargin, setRequiredIndicatorVisible, writeMargin

    Methods inherited from class com.vaadin.ui.AbstractComponentContainer

    addComponentAttachListener, addComponentDetachListener, addComponents, fireComponentAttachEvent, fireComponentDetachEvent, getComponentIterator, moveComponentsFrom, removeComponentAttachListener, removeComponentDetachListener, setHeight, setWidth

    Methods inherited from class com.vaadin.ui.AbstractComponent

    addContextClickListener, addContextHelpIconClickListener, addListener, addShortcutListener, addStyleName, attach, detach, ensureContextHelpInitialized, findAncestor, fireComponentErrorEvent, fireComponentEvent, fireContextHelpClick, focus, getActionManager, getCaption, getComponentError, getComponentErrorProvider, getContextHelpText, getData, getDebugId, getDescription, getErrorMessage, getHeight, getHeightUnits, getIcon, getId, getJTestId, getLocale, getParent, getPrimaryStyleName, getRequiredError, getStyleName, getWidth, getWidthUnits, isCaptionAsHtml, isConnectorEnabled, isContextHelpTextHtmlEnabled, isEnabled, isOrHasAncestor, isReadOnly, isResponsive, isVisible, removeContextClickListener, removeListener, removeShortcutListener, removeStyleName, setCaption, setCaptionAsHtml, setComponentError, setComponentErrorProvider, setContextHelpText, setContextHelpTextHtmlEnabled, setData, setDebugId, setDescription, setDescription, setEnabled, setHeight, setHeightFull, setHeightUndefined, setIcon, setId, setJTestId, setLocale, setParent, setPrimaryStyleName, setReadOnly, setRequiredError, setResponsive, setSizeFull, setSizeUndefined, setStyleName, setVisible, setWidth, setWidthFull, setWidthUndefined

    Methods inherited from class com.vaadin.server.AbstractClientConnector

    addAttachListener, addDetachListener, addExtension, addListener, addListener, addListener, addListener, addListener, addListener, addMethodInvocationToQueue, createState, encodeState, equals, fireEvent, getAllChildrenIterable, getConnectorId, getErrorHandler, getExtensions, getIncorrectConcurrentAccessHandler, getListeners, getResource, getRpcManager, getRpcProxy, getSession, getStateType, getUI, handleConnectorRequest, hashCode, hasListeners, isAttached, isThis, markAsDirty, markAsDirtyRecursive, registerRpc, registerRpc, removeAttachListener, removeDetachListener, removeExtension, removeListener, removeListener, removeListener, removeListener, removeListener, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setConnectorResource, setErrorHandler, setIncorrectConcurrentAccessHandler, setResource, updateDiffstate

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.server.ClientConnector

    addAttachListener, addDetachListener, detach, encodeState, getErrorHandler, getExtensions, getRpcManager, getStateType, handleConnectorRequest, isAttached, isConnectorEnabled, markAsDirtyRecursive, removeAttachListener, removeDetachListener, removeExtension, requestRepaint, requestRepaintAll, retrievePendingRpcCalls, setErrorHandler

    Methods inherited from interface com.vaadin.ui.Component

    addListener, addStyleName, addStyleNames, attach, getCaption, getDescription, getIcon, getId, getJTestId, getLocale, getParent, getPrimaryStyleName, getStyleName, getUI, isEnabled, isVisible, readDesign, removeListener, removeStyleName, removeStyleNames, setCaption, setEnabled, setIcon, setId, setJTestId, setParent, setPrimaryStyleName, setStyleName, setStyleName, setVisible, writeDesign

    Methods inherited from interface com.vaadin.ui.ComponentContainer

    addComponents, getComponentIterator, moveComponentsFrom

    Methods inherited from interface com.vaadin.shared.Connector

    getConnectorId

    Methods inherited from interface com.vaadin.ui.HasComponents.ComponentAttachDetachNotifier

    addComponentAttachListener, addComponentDetachListener, removeComponentAttachListener, removeComponentDetachListener

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator

    Methods inherited from interface com.vaadin.ui.LegacyComponent

    markAsDirty

    Methods inherited from interface com.vaadin.server.Sizeable

    getHeight, getHeightUnits, getWidth, getWidthUnits, setHeight, setHeight, setHeightFull, setHeightUndefined, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull, setWidthUndefined

    Methods inherited from interface com.vaadin.server.VariableOwner

    isEnabled
  • Constructor Details

    • DDGridLayout

      public DDGridLayout(int columns, int rows)
      Constructor for grid of given size (number of cells). Note that grid's final size depends on the items that are added into the grid. Grid grows if you add components outside the grid's area.
      Parameters:
      columns - Number of columns in the grid.
      rows - Number of rows in the grid.
    • DDGridLayout

      public DDGridLayout(int columns, int rows, com.vaadin.ui.Component... children)
      Constructor for grid of given size (number of cells). Note that grid's final size depends on the items that are added into the grid. Grid grows if you add components outside the grid's area.
      Parameters:
      columns - Number of columns in the grid.
      rows - Number of rows in the grid.
      children - Child components
    • DDGridLayout

      public DDGridLayout()
      Constructs an empty grid layout that is extended as needed.
  • Method Details

    • getDragGrabFilter

      @Nullable public DragGrabFilter getDragGrabFilter()
      Specified by:
      getDragGrabFilter in interface DragGrabFilterSupport
      Returns:
      Drag grab filter
    • setDragGrabFilter

      public void setDragGrabFilter(@Nullable DragGrabFilter dragGrabFilter)
      Specified by:
      setDragGrabFilter in interface DragGrabFilterSupport
      Parameters:
      dragGrabFilter - drag grab filter
    • setDragCaptionProvider

      public void setDragCaptionProvider(@Nullable DragCaptionProvider provider)
      Specified by:
      setDragCaptionProvider in interface HasDragCaptionProvider
    • getDragCaptionProvider

      @Nullable public DragCaptionProvider getDragCaptionProvider()
      Specified by:
      getDragCaptionProvider in interface HasDragCaptionProvider
    • paintContent

      public void paintContent(com.vaadin.server.PaintTarget target) throws com.vaadin.server.PaintException
      Specified by:
      paintContent in interface com.vaadin.ui.LegacyComponent
      Throws:
      com.vaadin.server.PaintException
    • changeVariables

      public void changeVariables(Object source, Map<String,Object> variables)
      Specified by:
      changeVariables in interface com.vaadin.server.VariableOwner
    • getDropHandler

      public com.vaadin.event.dd.DropHandler getDropHandler()
      Specified by:
      getDropHandler in interface com.vaadin.event.dd.DropTarget
    • setDropHandler

      public void setDropHandler(com.vaadin.event.dd.DropHandler dropHandler)
    • getDragMode

      public LayoutDragMode getDragMode()
      Gets the drag mode which controls how drags can be made. The layout supports two modes, NONE which disables dragging from the layout and CLONE which enables dragging the component from the layout.
      Specified by:
      getDragMode in interface LayoutDragSource
      Returns:
      The drag mode
    • setDragMode

      public void setDragMode(LayoutDragMode mode)
      Sets the drag mode which controls how drags can be made. The layout supports two modes, NONE which disables dragging from the layout and CLONE which enables dragging the component from the layout.
      Specified by:
      setDragMode in interface LayoutDragSource
      Parameters:
      mode - The mode to set
    • translateDropTargetDetails

      public com.vaadin.event.dd.TargetDetails translateDropTargetDetails(Map<String,Object> clientVariables)
      Specified by:
      translateDropTargetDetails in interface com.vaadin.event.dd.DropTarget
    • getTransferable

      public com.vaadin.event.Transferable getTransferable(Map<String,Object> rawVariables)
      Specified by:
      getTransferable in interface com.vaadin.event.dd.DragSource
    • setComponentHorizontalDropRatio

      public void setComponentHorizontalDropRatio(float ratio)
      Sets the ratio which determines how a cell is divided into drop zones. The ratio is measured from the left and right borders. For example, setting the ratio to 0.3 will divide the drop zone in three equal parts (left,middle,right). Setting the ratio to 0.5 will disable dropping in the middle and setting it to 0 will disable dropping at the sides.
      Parameters:
      ratio - A ratio between 0 and 0.5. Default is 0.2
    • setComponentVerticalDropRatio

      public void setComponentVerticalDropRatio(float ratio)
      Sets the ratio which determines how a cell is divided into drop zones. The ratio is measured from the top and bottom borders. For example, setting the ratio to 0.3 will divide the drop zone in three equal parts (top,center,bottom). Setting the ratio to 0.5 will disable dropping in the center and setting it to 0 will disable dropping at the sides.
      Parameters:
      ratio - A ratio between 0 and 0.5. Default is 0.2
    • setShim

      public void setShim(boolean shim)
      False to disable the iframe shim used to enable dragging iframe based components (defaults to true).
      Specified by:
      setShim in interface ShimSupport
      Parameters:
      shim - Are the iframes shimmed
    • isShimmed

      public boolean isShimmed()
      Are shims used over iframes so dragging is possible
      Specified by:
      isShimmed in interface ShimSupport
      Returns:
      Are the iframes shimmed
    • getDragFilter

      public DragFilter getDragFilter()
      Get a filter which determines which components can be dragged from the layout and which cannot. This does not effect the drag mode, but only provides a means to make exceptions in the drag mode. The drag filter is only used when dragging is enabled in the layout, i.e drag mode is NOT LayoutDragMode.NONE By default the drag filter permits dragging all components when the layout drag mode allows it.
      Specified by:
      getDragFilter in interface DragFilterSupport
      Specified by:
      getDragFilter in interface LayoutDragSource
      Returns:
      dragFilter The filter to use, by default DragFilter.ALL is used.
    • setDragFilter

      public void setDragFilter(DragFilter dragFilter)
      Set a filter which determines which components can be dragged from the layout and which cannot. This does not effect the drag mode, but only provides a means to make exceptions in the drag mode. The drag filter is only used when dragging is enabled in the layout, i.e drag mode is NOT LayoutDragMode.NONE By default the drag filter permits dragging all components when the layout drag mode allows it.
      Specified by:
      setDragFilter in interface DragFilterSupport
      Specified by:
      setDragFilter in interface LayoutDragSource
      Parameters:
      dragFilter - The filter to use, by default DragFilter.ALL is used.
    • getState

      public DDGridLayoutState getState()
      Overrides:
      getState in class com.vaadin.ui.GridLayout
    • beforeClientResponse

      public void beforeClientResponse(boolean initial)
      Specified by:
      beforeClientResponse in interface com.vaadin.server.ClientConnector
      Overrides:
      beforeClientResponse in class com.vaadin.ui.GridLayout
    • setDragImageProvider

      public void setDragImageProvider(@Nullable DragImageProvider provider)
      Description copied from interface: DragImageReferenceSupport
      Set a component as a drag image for a component in the layout. The drag image will be shown instead of the component when the user drag a component in the layout.
      Specified by:
      setDragImageProvider in interface DragImageReferenceSupport
      Parameters:
      provider - The image provider
    • getDragImageProvider

      @Nullable public DragImageProvider getDragImageProvider()
      Description copied from interface: DragImageReferenceSupport
      Returns the drag image provider
      Specified by:
      getDragImageProvider in interface DragImageReferenceSupport
      Returns:
      the image provider