Package org.apache.jetspeed.layout

Examples of org.apache.jetspeed.layout.Coordinate


                {
                    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();
View Full Code Here


            fragmentProperties.put( DESKTOP_EXTENDED, posExtended );
        }
               
        // add fragment
        PortletPlacementContext placement = new PortletPlacementContextImpl( requestContext, placeInLayoutFragment, 1 );
        Coordinate returnCoordinate = placement.add( placeFragment, getCoordinateFromParams( requestContext ) );
        Page page = placement.syncPageFragments();

        placeInLayoutFragment.getFragments().add( placeFragment );
        if ( pageManager != null && ! batch )
        {
            pageManager.updatePage( page );
        }

        // Need to determine what the old col and row were
        resultMap.put( OLDCOL, String.valueOf( returnCoordinate.getOldCol() ) );
        resultMap.put( OLDROW, String.valueOf( returnCoordinate.getOldRow() ) );
        // Need to determine what the new col and row were
        resultMap.put( NEWCOL, String.valueOf( returnCoordinate.getNewCol() ) );
        resultMap.put( NEWROW, String.valueOf( returnCoordinate.getNewRow() ) );

        return success;
    }
View Full Code Here

        if ( a_sRow != null )
        {
            a_iRow = Integer.parseInt( a_sRow );
        }

        Coordinate a_oCoordinate = new CoordinateImpl( 0, 0, a_iCol, a_iRow );
        return a_oCoordinate;
    }
View Full Code Here

        {
      // The key is a Fragment
      Fragment fragment = (Fragment) keyIterator.next();
     
      // Get the Coordinate associated with this fragment
      Coordinate coordinate = (Coordinate)this.fragmentCoordinateMap.get(fragment);
     
      // Make sure we have both
      if(fragment != null && coordinate != null)
            {
        // Get the array list for the column
        Vector columnArray = this.columnsList[coordinate.getOldCol()];
       
        int row = coordinate.getOldRow();
       
        // Before setting the fragment in the array it might
        // be necessary to add blank rows before this row
        // An ArrayList can only set an element that already exists
        prepareList(columnArray, row);
View Full Code Here

            for (int ix = 0; ix < column.size(); ix++)
            {               
                Fragment frag = (Fragment)column.get(ix);
                if (frag == null)
                    continue;
                Coordinate c = (Coordinate)this.fragmentCoordinateMap.get(frag);
                if (c == null)
                    continue;
                if (c.getNewCol() == row)
                {
                    row++;
                }
               
            }
            // Make sure that the column has room to add the row
            if(row < 0 || row > column.size()) {
              // Add to the end
              column.addElement(fragment);
              row = column.size()-1;
            } else {
              column.add(row, fragment);
            }
            Coordinate newCoord = new CoordinateImpl(col, row, col, row);
            this.fragmentCoordinateMap.put(fragment, newCoord);
            return newCoord;
        }
        return coordinate;
  }
View Full Code Here

  public Coordinate moveAbsolute(Fragment fragment, Coordinate newCoordinate)
    throws PortletPlacementException
    {
    // Find the fragment
    Coordinate oldCoordinate = (Coordinate)this.fragmentCoordinateMap.get(fragment);
    if(oldCoordinate == null)
        {
      throw new PortletPlacementException("could not find fragment");
    }
   
    // Save the old coordinates
    int oldCol = oldCoordinate.getOldCol();
    int oldRow = oldCoordinate.getOldRow();

    // Create a new coordinate object with both the old and new positions
    int newCol = newCoordinate.getNewCol();
    int newRow = newCoordinate.getNewRow();
   
View Full Code Here

  protected Coordinate moveDirection(Fragment fragment, int deltaCol, int deltaRow)
    throws PortletPlacementException
    {
    // Find the fragment
    Coordinate foundCoordinate = (Coordinate)this.fragmentCoordinateMap.get(fragment);
    if(foundCoordinate == null)
        {
      throw new PortletPlacementException("could not find fragment");
    }

    // Check the coordinates to make sure that there is room to move down
    int oldCol = foundCoordinate.getOldCol();
    int oldRow = foundCoordinate.getOldRow();
   
    Vector columnArray = this.columnsList[oldCol];
   
    // Check the row and column boundaries to make sure there is room
    // to do the move
    if((oldRow + deltaRow + 1 > columnArray.size()) || ((oldRow + deltaRow) < 0) ||
       (oldCol + deltaCol + 1 > this.columnsList.length) || ((oldCol + deltaCol) < 0))
        {
      // Out of bounds, don't do the move
      Coordinate c = new CoordinateImpl(oldCol, oldRow, oldCol, oldRow);
            //debugFragments("move direction (1)");
            return c;
    }
        else
        {
      Coordinate c = moveAbsolute(fragment, new CoordinateImpl(oldCol, oldRow, oldCol + deltaCol, oldRow + deltaRow));
            //debugFragments("move direction (2)");
            return c;
    }       
  }
View Full Code Here

  }

  public Coordinate remove(Fragment fragment) throws PortletPlacementException
    {
    // Locate the fragment
    Coordinate coordinate = (Coordinate)this.fragmentCoordinateMap.get(fragment);
    if(coordinate == null)
        {
      throw new PortletPlacementException("fragment not found:" + fragment.getName());
    }
   
    int col = coordinate.getOldCol();
    int row = coordinate.getOldRow();
   
    if(col < 0 || col > this.columnsList.length)
        {
      throw new PortletPlacementException("column out of bounds:" + fragment.getName());
    }
View Full Code Here

    }
   
    public int getFragmentCol( Fragment fragment )
    {
      if ( fragment == null ) return -1;
    Coordinate coordinate = (Coordinate)this.fragmentCoordinateMap.get( fragment.getId() );
     
    if ( coordinate == null )
      return -1;
    if ( coordinate.getNewCol() >= )
      return coordinate.getNewCol();
    return coordinate.getOldCol();
    }
View Full Code Here

        throws PortletPlacementException
    {
    if ( fragment == null )
        throw new NullPointerException( "PortletPlacementContext moveAbsolute() cannot accept a null Fragment argument" );

    Coordinate currentCoordinate = (Coordinate)this.fragmentCoordinateMap.get( fragment.getId() );
    int currentCol = getLatestColumn( currentCoordinate );
    int currentRow = getLatestRow( currentCoordinate );
   
    int newCol = normalizeColumnIndex( getLatestColumn( newCoordinate ), this.columnsList, currentCol );
    int newRow = getLatestRow( newCoordinate );
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.layout.Coordinate

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.