Package org.apache.jetspeed.layout

Examples of org.apache.jetspeed.layout.Coordinate


    if ( fragment == null )
        throw new NullPointerException( "PortletPlacementContext moveDirection() cannot accept a null Fragment argument" );

    if ( deltaCol != 0 || deltaRow != 0 )
    {
      Coordinate currentCoordinate = (Coordinate)this.fragmentCoordinateMap.get( fragment.getId() );
      if ( currentCoordinate == null )
        throw new NullPointerException( "PortletPlacementContext moveDirection() cannot locate target fragment (" + fragment.getId() + ")" );
 
      int currentCol = getLatestColumn( currentCoordinate );
      int currentRow = getLatestRow( currentCoordinate );
View Full Code Here


  public Coordinate remove( Fragment fragment ) throws PortletPlacementException
    {
    if ( fragment == null )
        throw new NullPointerException( "PortletPlacementContext remove() cannot accept a null Fragment argument" );
   
    Coordinate currentCoordinate = (Coordinate)this.fragmentCoordinateMap.get( fragment.getId() );
    if ( currentCoordinate == null )
      throw new NullPointerException( "PortletPlacementContext remove() cannot locate target fragment (" + fragment.getId() + ")" );

    int currentCol = getLatestColumn( currentCoordinate );
    int currentRow = getLatestRow( currentCoordinate );
View Full Code Here

              ArrayList column = this.columnsList[colIndex];
              int colRowCount = column.size();
            for ( int rowIndex= 0; rowIndex < colRowCount; rowIndex++ )
            {
              Fragment fragment = (Fragment)column.get( rowIndex );
                  Coordinate coordinate = (Coordinate)this.fragmentCoordinateMap.get( fragment.getId() );
                  boolean needsReplacementCoordinate = false;
                 
                  if ( getLatestColumn( coordinate ) != colIndex || getLatestRow( coordinate ) != rowIndex )
                    needsReplacementCoordinate = true;

                  if ( needsReplacementCoordinate )
              {
                Coordinate replacementCoordinate = new CoordinateImpl( coordinate.getOldCol(), coordinate.getOldRow(), colIndex, rowIndex );
                this.fragmentCoordinateMap.put( fragment.getId(), replacementCoordinate );
              }
              if ( updateFragmentObjects )
                  {
                    fragment.setLayoutColumn( colIndex );
View Full Code Here

    }
   
    public int getFragmentRow( Fragment fragment )
    {
      if ( fragment == null ) return -1;
    Coordinate coordinate = (Coordinate)this.fragmentCoordinateMap.get( fragment.getId() );
     
    if ( coordinate == null )
      return -1;
    if ( coordinate.getNewRow() >= )
      return coordinate.getNewRow();
    return coordinate.getOldRow();
    }
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 = (Vector)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

                {
                    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

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.