public class PortalLayoutContainer extends Composite implements PortalValidateDropEvent.HasPortalValidateDropHandlers, PortalDropEvent.HasPortalDropHandlers
Portlet
s. Supports drag and drop of child
Portlets
between columns as well as modifying the order within
columns.
PortalLayoutContainer is not a container itself, but a Composite that wraps
an internal container.
PortalLayoutContainer internally creates a
CssFloatLayoutContainer
for each column. The add, insert, remove
methods work against these internal containers, getWidget(int)
returns the internal containers. The portlets are children of the internal
containers, not the portlet container itself.
Code Snippet:
public void onModuleLoad() { PortalLayoutContainer c = new PortalLayoutContainer(3); c.add(createPortlet("Portlet 1", "Content 1"), 0); c.add(createPortlet("Portlet 2", "Content 2"), 1); c.add(createPortlet("Portlet 3", "Content 3"), 2); Viewport v = new Viewport(); v.add(c); RootPanel.get().add(v); } private Portlet createPortlet(String h, String l) { Portlet p = new Portlet(); p.setHeadingText(h); p.setWidget(new Label(l)); p.setPixelSize(200, 200); return p; }
Modifier and Type | Class and Description |
---|---|
static interface |
PortalLayoutContainer.PortalLayoutAppearance |
adjustSize, allowTextSelection, cacheSizes, disableContextMenu, disabled, disabledStyle, ensureVisibilityOnSizing, height, hidden, lastSize, layer, left, mask, maskMessage, monitorWindowResize, pageX, pageY, resizeHandler, shim, tabIndex, toolTip, toolTipConfig, top, width, windowResizeDelay, windowResizeTask
Constructor and Description |
---|
PortalLayoutContainer(int numColumns)
Creates a portal layout container with the default appearance and the
specified number of columns.
|
PortalLayoutContainer(PortalLayoutContainer.PortalLayoutAppearance appearance,
int numColumns)
Creates a portal layout container with the specified appearance and number
of columns.
|
Modifier and Type | Method and Description |
---|---|
void |
add(IsWidget w,
int column)
Adds a portlet to the portal.
|
HandlerRegistration |
addDropHandler(PortalDropEvent.PortalDropHandler handler)
Adds a
PortalDropEvent.PortalDropHandler handler for PortalDropEvent events. |
HandlerRegistration |
addValidateDropHandler(PortalValidateDropEvent.PortalValidateDropHandler handler)
Adds a
PortalValidateDropEvent.PortalValidateDropHandler handler for PortalValidateDropEvent events. |
void |
clear()
Removes all portlets from all columns.
|
protected DragHandler |
createHandler() |
PortalLayoutContainer.PortalLayoutAppearance |
getAppearance() |
AutoScrollSupport |
getAutoScrollSupport()
Returns the scroll support instance.
|
int |
getColumnCount()
Returns the number of columns.
|
Container |
getContainer()
Returns the internal container managed by this class that contains the
child CssFloatLayoutContainer's for each column.
|
int |
getPortletColumn(Portlet portlet)
Returns the column of the given porlet.
|
int |
getPortletIndex(Portlet portlet)
Returns the index of the column for the given portlet.
|
int |
getSpacing()
Returns the spacing between portlets.
|
protected CssFloatLayoutContainer |
getWidget(int index)
Returns the column container for the given column.
|
void |
insert(IsWidget w,
int index,
int column)
Inserts a portlet.
|
boolean |
isAutoScroll()
Returns true if auto scroll is enabled (defaults to true).
|
protected void |
onPortletDragCancel(DragCancelEvent event) |
protected void |
onPortletDragEnd(DragEndEvent de) |
protected void |
onPortletDragLeave(DragLeaveEvent de) |
protected void |
onPortletDragMove(DragMoveEvent de) |
protected void |
onPortletDragStart(DragStartEvent de) |
void |
remove(IsWidget w,
int column)
Removes a portlet from the portal.
|
void |
setAutoScroll(boolean autoScroll)
True to automatically scroll the portal container when the user hovers over
the top and bottom of the container (defaults to true).
|
void |
setColumnWidth(int colIndex,
double width)
Sets the column's width.
|
void |
setSpacing(int spacing)
Sets the spacing between portlets (defaults to 10).
|
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, onDisable, onEnable, onResize, setHeight, setPixelSize, setWidth
addBeforeHideHandler, addBeforeShowContextMenuHandler, addBeforeShowHandler, addBlurHandler, addDisableHandler, addEnableHandler, addFocusHandler, addHideHandler, addMoveHandler, addResizeHandler, addShowContextMenuHandler, addShowHandler, addStyleDependentName, addStyleOnOver, adjustPosition, adjustSize, applyState, assertAfterRender, assertPreRender, blur, clearSizeCache, disable, disableContextMenu, disableEvents, enable, enableEvents, fireCancellableEvent, fireEvent, focus, getData, getElement, getFocusEl, getFocusSupport, getHideMode, getId, getItemId, getOffsetHeight, getOffsetWidth, getPositionEl, getShadow, getShadowPosition, getStateId, getTabIndex, getToolTip, hide, hideShadow, hideToolTip, isAllowTextSelection, isAutoHeight, isAutoWidth, isDeferHeight, isEnabled, isMonitorWindowResize, isRendered, isStateful, isVisible, isVisible, mask, mask, notifyHide, notifyShow, onAfterFirstAttach, onBlur, onFocus, onHide, onHideContextMenu, onLoad, onPosition, onRightClick, onShow, onShowContextMenu, onUnload, onWindowResize, removeStyleDependentName, removeStyleOnOver, removeToolTip, setAllowTextSelection, setBorders, setBounds, setBounds, setContextMenu, setData, setDeferHeight, setEnabled, setHeight, setHideMode, setId, setItemId, setMonitorWindowResize, setPagePosition, setPosition, setShadow, setShadowPosition, setSize, setStateful, setStateId, setStyleDependentName, setTabIndex, setToolTip, setToolTipConfig, setVisible, setWidth, show, sync, syncSize, unmask
public PortalLayoutContainer(int numColumns)
numColumns
- the number of columns managed by this portalpublic PortalLayoutContainer(PortalLayoutContainer.PortalLayoutAppearance appearance, int numColumns)
appearance
- the portal layout appearancenumColumns
- the number of columns managed by this portalpublic void add(IsWidget w, int column)
w
- the portletcolumn
- the column to add topublic HandlerRegistration addDropHandler(PortalDropEvent.PortalDropHandler handler)
PortalDropEvent.HasPortalDropHandlers
PortalDropEvent.PortalDropHandler
handler for PortalDropEvent
events.addDropHandler
in interface PortalDropEvent.HasPortalDropHandlers
handler
- the handlerpublic HandlerRegistration addValidateDropHandler(PortalValidateDropEvent.PortalValidateDropHandler handler)
PortalValidateDropEvent.HasPortalValidateDropHandlers
PortalValidateDropEvent.PortalValidateDropHandler
handler for PortalValidateDropEvent
events.addValidateDropHandler
in interface PortalValidateDropEvent.HasPortalValidateDropHandlers
handler
- the handlerpublic void clear()
public PortalLayoutContainer.PortalLayoutAppearance getAppearance()
public AutoScrollSupport getAutoScrollSupport()
public int getColumnCount()
public Container getContainer()
public int getPortletColumn(Portlet portlet)
portlet
- the portletpublic int getPortletIndex(Portlet portlet)
portlet
- the portletpublic int getSpacing()
public void insert(IsWidget w, int index, int column)
w
- the portlet to addedindex
- the insert indexcolumn
- the column to insert intopublic boolean isAutoScroll()
public void remove(IsWidget w, int column)
w
- the widthcolumn
- the columnpublic void setAutoScroll(boolean autoScroll)
autoScroll
- true to enable auto scrollAutoScrollSupport
public void setColumnWidth(int colIndex, double width)
colIndex
- the column indexwidth
- the column widthpublic void setSpacing(int spacing)
spacing
- the spacing in pixelsprotected DragHandler createHandler()
protected CssFloatLayoutContainer getWidget(int index)
index
- the column indexprotected void onPortletDragCancel(DragCancelEvent event)
protected void onPortletDragEnd(DragEndEvent de)
protected void onPortletDragLeave(DragLeaveEvent de)
protected void onPortletDragMove(DragMoveEvent de)
protected void onPortletDragStart(DragStartEvent de)
Copyright © 2018. All rights reserved.