moveToLayoutFragment,
currentLayoutFragment ) ;
}
else
{
PortletPlacementContext placement = null;
if ( currentLayoutFragment != null )
placement = new PortletPlacementContextImpl(requestContext, currentLayoutFragment, 1);
else
{
placement = new PortletPlacementContextImpl(requestContext);
}
Fragment fragment = placement.getFragmentById(moveFragmentId);
if (fragment == null)
{
success = false;
resultMap.put(REASON, "Failed to find fragment for portlet id: " + moveFragmentId );
return success;
}
Coordinate returnCoordinate = null;
float oldX = 0f, oldY = 0f, oldZ = 0f, oldWidth = 0f, oldHeight = 0f;
float x = -1f, y = -1f, z = -1f, width = -1f, height = -1f;
boolean absHeightChanged = false;
String posExtended = getActionParameter(requestContext, DESKTOP_EXTENDED);
if ( posExtended != null )
{
Map fragmentProperties = fragment.getProperties();
if ( fragmentProperties == null )
{
success = false;
resultMap.put(REASON, "Failed to acquire fragment properties map for portlet id: " + moveFragmentId );
return success;
}
String oldDeskExt = (String)fragmentProperties.get( DESKTOP_EXTENDED );
resultMap.put( OLD_DESKTOP_EXTENDED, ( (oldDeskExt != null) ? oldDeskExt : "" ) );
fragmentProperties.put( DESKTOP_EXTENDED, posExtended );
}
// Only required for moveabs
if (iMoveType == ABS)
{
Coordinate a_oCoordinate = getCoordinateFromParams(requestContext);
returnCoordinate = placement.moveAbsolute(fragment, a_oCoordinate);
String sHeight = getActionParameter(requestContext, HEIGHT);
if ( sHeight != null && sHeight.length() > 0 )
{
oldHeight = fragment.getLayoutHeight();
height = Float.parseFloat(sHeight);
fragment.setLayoutHeight(height);
absHeightChanged = true;
}
}
else if (iMoveType == LEFT)
{
returnCoordinate = placement.moveLeft(fragment);
}
else if (iMoveType == RIGHT)
{
returnCoordinate = placement.moveRight(fragment);
}
else if (iMoveType == UP)
{
returnCoordinate = placement.moveUp(fragment);
}
else if (iMoveType == DOWN)
{
returnCoordinate = placement.moveDown(fragment);
}
else if (iMoveType == CARTESIAN)
{
String sx = getActionParameter(requestContext, X);
String sy = getActionParameter(requestContext, Y);
String sz = getActionParameter(requestContext, Z);
String sWidth = getActionParameter(requestContext, WIDTH);
String sHeight = getActionParameter(requestContext, HEIGHT);
if (sx != null)
{
oldX = fragment.getLayoutX();
x = Float.parseFloat(sx);
fragment.setLayoutX(x);
}
if (sy != null)
{
oldY = fragment.getLayoutY();
y = Float.parseFloat(sy);
fragment.setLayoutY(y);
}
if (sz != null)
{
oldZ = fragment.getLayoutZ();
z = Float.parseFloat(sz);
fragment.setLayoutZ(z);
}
if (sWidth != null)
{
oldWidth = fragment.getLayoutWidth();
width = Float.parseFloat(sWidth);
fragment.setLayoutWidth(width);
}
if (sHeight != null)
{
oldHeight = fragment.getLayoutHeight();
height = Float.parseFloat(sHeight);
fragment.setLayoutHeight(height);
}
}
// synchronize back to the page layout root fragment
Page page = placement.syncPageFragments();
if (pageManager != null && !batch)
{
pageManager.updatePage(page);
}