Package org.apache.jetspeed.layout

Examples of org.apache.jetspeed.layout.Coordinate


        {
      // 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++;
                }
               
            }
            column.add(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

            fragment.setType(Fragment.PORTLET);
            fragment.setName(portletId);
            fragment.setLayoutColumn(iCol);
            fragment.setLayoutRow(iRow);
           
            Coordinate coordinate = placement.add(fragment, new CoordinateImpl(iCol, iRow, iCol, iRow));
            Page page = placement.syncPageFragments();                                               
           
            // TODO: this does not handle nested layouts           
            Fragment root = requestContext.getPage().getRootFragment();
            root.getFragments().add(fragment);           
            pageManager.updatePage(page);

            resultMap.put(STATUS, "success");
            resultMap.put(NEWCOL, String.valueOf(coordinate
                    .getNewCol()));
            resultMap.put(NEWROW, String.valueOf(coordinate
                    .getNewRow()));
           
        }
        catch (Exception e)
        {
View Full Code Here

                return success;
            }
           
            PortletPlacementContext placement = new PortletPlacementContextImpl(requestContext);
            Fragment fragment = placement.getFragmentById(portletId);
            Coordinate returnCoordinate = null;

            // Only required for moveabs
            if (iMoveType == ABS)
            {
                String a_sCol = requestContext.getRequestParameter(COL);
                String a_sRow = requestContext.getRequestParameter(ROW);

                // Convert the col and row into integers
                int a_iCol = Integer.parseInt(a_sCol);
                int a_iRow = Integer.parseInt(a_sRow);

                Coordinate a_oCoordinate = new CoordinateImpl(0, 0, a_iCol,
                        a_iRow);
                returnCoordinate = placement.moveAbsolute(fragment, a_oCoordinate);
            }
            else if (iMoveType == LEFT)
            {
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

    {
      boolean success = true;

      String moveFragmentId = fragment.getId();
      boolean addFragment = (placeInLayoutFragment != null);
        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;

        // desktop extended
        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 newCoordinate = getCoordinateFromParams( requestContext );
            returnCoordinate = placement.moveAbsolute( fragment, newCoordinate, addFragment );
            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.