newPortlet.setVisible(false);
PortalColumn column = portalLayout.addPortlet(newPortlet);
// also insert a blank spacer element, which will trigger the built-in
// animateMembers layout animation
final LayoutSpacer placeHolder = new LayoutSpacer();
placeHolder.setRect(newPortlet.getRect());
column.addMember(placeHolder, 0); // add to top
// create an outline around the clicked button
final Canvas outline = new Canvas();
outline.setLeft(form.getAbsoluteLeft() + addPortlet.getLeft());
outline.setTop(form.getAbsoluteTop());
outline.setWidth(addPortlet.getWidth());
outline.setHeight(addPortlet.getHeight());
outline.setBorder("2px solid #8289A6");
outline.draw();
outline.bringToFront();
outline.animateRect(newPortlet.getPageLeft(), newPortlet.getPageTop(),
newPortlet.getVisibleWidth(), newPortlet.getViewportHeight(),
new AnimationCallback() {
public void execute(boolean earlyFinish) {
// callback at end of animation - destroy placeholder and outline; show the new portlet
placeHolder.destroy();
outline.destroy();
newPortlet.show();
}
}, 750);
}