Restricting movability of portlet by width

In Setting width of portlet column in WebSphere Portal entry i did explain how to set width of vertical container, Now the next question is how do i make sure that if my portlet requires say 600px to display markup, user does not drag it into container which is only 300 px in size. In other words how do i restrict where user is able to drag the portlet.

By default the WPS wont check width of portlet before either adding or moving portlet to container so you will have to follow these steps to enable that support

First go the Configure Mode in the Edit layout portlet and check "Check portlets width before adding or moving portlets to a column" Check box like this


Then go the WebSphere Application Server Admin Console for WebSphere Portal server and go to Resource Environment Provider -> WP_ConfigService and add a Custom Property like this



Property Name -> PortletPlacementFilterImpl
Property Value -> com.ibm.wps.model.filters.portletplacement.impl.WidthFilterImpl

Save your changes and restart the WebSphere Portal Server


Follow the steps described in the Setting width of portlet column in WebSphere Portal entry to set width for the vertical column.

Last step would be to set what is the width of portlet or putting restrictions on the portlet, that you can do by setting a MAX_WIDTH preference like this



Now if you try, you wont be able to drag or add this portlet which has MAX_WIDTH set to 500px to any container with width less than 500 px. If you try that the portlet wont get dragged to the smaller container but no error is displayed to user, but if you look inside the SystemOut.log you will see this error

No comments: