Java Code Examples for com.lowagie.text.Element#ALIGN_BOTTOM

The following examples show how to use com.lowagie.text.Element#ALIGN_BOTTOM . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HtmlEncoder.java    From gcs with Mozilla Public License 2.0 6 votes vote down vote up
/**
* Translates the alignment value.
*
* @param   alignment   the alignment value
* @return  the translated value
*/
   
   public static String getAlignment(int alignment) {
       switch(alignment) {
           case Element.ALIGN_LEFT:
               return HtmlTags.ALIGN_LEFT;
           case Element.ALIGN_CENTER:
               return HtmlTags.ALIGN_CENTER;
           case Element.ALIGN_RIGHT:
               return HtmlTags.ALIGN_RIGHT;
           case Element.ALIGN_JUSTIFIED:
           case Element.ALIGN_JUSTIFIED_ALL:
               return HtmlTags.ALIGN_JUSTIFIED;
           case Element.ALIGN_TOP:
               return HtmlTags.ALIGN_TOP;
           case Element.ALIGN_MIDDLE:
               return HtmlTags.ALIGN_MIDDLE;
           case Element.ALIGN_BOTTOM:
               return HtmlTags.ALIGN_BOTTOM;
           case Element.ALIGN_BASELINE:
               return HtmlTags.ALIGN_BASELINE;
               default:
                   return "";
       }
   }
 
Example 2
Source File: HtmlEncoder.java    From itext2 with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
* Translates the alignment value.
*
* @param   alignment   the alignment value
* @return  the translated value
*/
   
   public static String getAlignment(int alignment) {
       switch(alignment) {
           case Element.ALIGN_LEFT:
               return HtmlTags.ALIGN_LEFT;
           case Element.ALIGN_CENTER:
               return HtmlTags.ALIGN_CENTER;
           case Element.ALIGN_RIGHT:
               return HtmlTags.ALIGN_RIGHT;
           case Element.ALIGN_JUSTIFIED:
           case Element.ALIGN_JUSTIFIED_ALL:
               return HtmlTags.ALIGN_JUSTIFIED;
           case Element.ALIGN_TOP:
               return HtmlTags.ALIGN_TOP;
           case Element.ALIGN_MIDDLE:
               return HtmlTags.ALIGN_MIDDLE;
           case Element.ALIGN_BOTTOM:
               return HtmlTags.ALIGN_BOTTOM;
           case Element.ALIGN_BASELINE:
               return HtmlTags.ALIGN_BASELINE;
               default:
                   return "";
       }
   }
 
Example 3
Source File: HtmlEncoder.java    From MesquiteCore with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
* Translates the alignment value.
*
* @param   alignment   the alignment value
* @return  the translated value
*/
   
   public static String getAlignment(int alignment) {
       switch(alignment) {
           case Element.ALIGN_LEFT:
               return HtmlTags.ALIGN_LEFT;
           case Element.ALIGN_CENTER:
               return HtmlTags.ALIGN_CENTER;
           case Element.ALIGN_RIGHT:
               return HtmlTags.ALIGN_RIGHT;
           case Element.ALIGN_JUSTIFIED:
           case Element.ALIGN_JUSTIFIED_ALL:
               return HtmlTags.ALIGN_JUSTIFIED;
           case Element.ALIGN_TOP:
               return HtmlTags.ALIGN_TOP;
           case Element.ALIGN_MIDDLE:
               return HtmlTags.ALIGN_MIDDLE;
           case Element.ALIGN_BOTTOM:
               return HtmlTags.ALIGN_BOTTOM;
           case Element.ALIGN_BASELINE:
               return HtmlTags.ALIGN_BASELINE;
               default:
                   return "";
       }
   }
 
Example 4
Source File: PdfCell.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Sets the bottom of the Rectangle and determines the proper {link #verticalOffset} to
 * appropriately align the contents vertically.
 * 
 * @param value
 */
@Override
public void setBottom(float value) {
	super.setBottom(value);
	float firstLineRealHeight = firstLineRealHeight();

	float totalHeight = ury - value; // can't use top (already compensates for cellspacing)
	float nonContentHeight = cellpadding() * 2f + cellspacing() * 2f;
	nonContentHeight += getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);

	float interiorHeight = totalHeight - nonContentHeight;
	float extraHeight = 0.0f;

	switch (verticalAlignment) {
		case Element.ALIGN_BOTTOM:
			extraHeight = interiorHeight - contentHeight;
			break;
		case Element.ALIGN_MIDDLE:
			extraHeight = (interiorHeight - contentHeight) / 2.0f;
			break;
		default:    // ALIGN_TOP
			extraHeight = 0f;
	}

	extraHeight += cellpadding() + cellspacing();
	extraHeight += getBorderWidthInside(TOP);
	if (firstLine != null) {
		firstLine.height = firstLineRealHeight + extraHeight;
	}
}
 
Example 5
Source File: PdfCell.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Sets the bottom of the Rectangle and determines the proper {link #verticalOffset}
 * to appropriately align the contents vertically.
 * @param value
 */
public void setBottom(float value) {
    super.setBottom(value);
    float firstLineRealHeight = firstLineRealHeight();

    float totalHeight = ury - value; // can't use top (already compensates for cellspacing)
    float nonContentHeight = (cellpadding() * 2f) + (cellspacing() * 2f);
    nonContentHeight += getBorderWidthInside(TOP) + getBorderWidthInside(BOTTOM);

    float interiorHeight = totalHeight - nonContentHeight;
    float extraHeight = 0.0f;

    switch (verticalAlignment) {
        case Element.ALIGN_BOTTOM:
            extraHeight = interiorHeight - contentHeight;
            break;
        case Element.ALIGN_MIDDLE:
            extraHeight = (interiorHeight - contentHeight) / 2.0f;
            break;
        default:    // ALIGN_TOP
            extraHeight = 0f;
    }

    extraHeight += cellpadding() + cellspacing();
    extraHeight += getBorderWidthInside(TOP);
    if (firstLine != null) {
        firstLine.height = firstLineRealHeight + extraHeight;
    }
}
 
Example 6
Source File: RtfCell.java    From itext2 with GNU Lesser General Public License v3.0 4 votes vote down vote up
/**
* Write the cell definition part of this RtfCell
*/
  public void writeDefinition(final OutputStream result) throws IOException 
  {
      if(this.mergeType == MERGE_VERT_PARENT) {
          result.write(DocWriter.getISOBytes("\\clvmgf"));
      } else if(this.mergeType == MERGE_VERT_CHILD) {
          result.write(DocWriter.getISOBytes("\\clvmrg"));
      }
      switch (verticalAlignment) {
          case Element.ALIGN_BOTTOM:
              result.write(DocWriter.getISOBytes("\\clvertalb"));
              break;
          case Element.ALIGN_CENTER:
          case Element.ALIGN_MIDDLE:
              result.write(DocWriter.getISOBytes("\\clvertalc"));
              break;
          case Element.ALIGN_TOP:
              result.write(DocWriter.getISOBytes("\\clvertalt"));
              break;
      }
      this.borders.writeContent(result);

      if(this.backgroundColor != null) {
          result.write(DocWriter.getISOBytes("\\clcbpat"));
          result.write(intToByteArray(this.backgroundColor.getColorNumber()));
      }
      this.document.outputDebugLinebreak(result);
      
      result.write(DocWriter.getISOBytes("\\clftsWidth3"));
      this.document.outputDebugLinebreak(result);
      
      result.write(DocWriter.getISOBytes("\\clwWidth"));
      result.write(intToByteArray(this.cellWidth));
      this.document.outputDebugLinebreak(result);
      
      if(this.cellPadding > 0) {
          result.write(DocWriter.getISOBytes("\\clpadl"));
          result.write(intToByteArray(this.cellPadding / 2));
          result.write(DocWriter.getISOBytes("\\clpadt"));
          result.write(intToByteArray(this.cellPadding / 2));
          result.write(DocWriter.getISOBytes("\\clpadr"));
          result.write(intToByteArray(this.cellPadding / 2));
          result.write(DocWriter.getISOBytes("\\clpadb"));
          result.write(intToByteArray(this.cellPadding / 2));
          result.write(DocWriter.getISOBytes("\\clpadfl3"));
          result.write(DocWriter.getISOBytes("\\clpadft3"));
          result.write(DocWriter.getISOBytes("\\clpadfr3"));
          result.write(DocWriter.getISOBytes("\\clpadfb3"));
      }
      result.write(DocWriter.getISOBytes("\\cellx"));
      result.write(intToByteArray(this.cellRight));
  }
 
Example 7
Source File: PatchRtfCell.java    From pentaho-reporting with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Write the cell definition part of this PatchRtfCell
 */
public void writeDefinition( final OutputStream result ) throws IOException {
  if ( this.mergeType == MERGE_VERT_PARENT ) {
    result.write( DocWriter.getISOBytes( "\\clvmgf" ) );
  } else if ( this.mergeType == MERGE_VERT_CHILD ) {
    result.write( DocWriter.getISOBytes( "\\clvmrg" ) );
  }
  switch ( verticalAlignment ) {
    case Element.ALIGN_BOTTOM:
      result.write( DocWriter.getISOBytes( "\\clvertalb" ) );
      break;
    case Element.ALIGN_CENTER:
    case Element.ALIGN_MIDDLE:
      result.write( DocWriter.getISOBytes( "\\clvertalc" ) );
      break;
    case Element.ALIGN_TOP:
      result.write( DocWriter.getISOBytes( "\\clvertalt" ) );
      break;
  }
  this.borders.writeContent( result );

  if ( this.backgroundColor != null ) {
    result.write( DocWriter.getISOBytes( "\\clcbpat" ) );
    result.write( intToByteArray( this.backgroundColor.getColorNumber() ) );
  }
  this.document.outputDebugLinebreak( result );

  result.write( DocWriter.getISOBytes( "\\clftsWidth3" ) );
  this.document.outputDebugLinebreak( result );

  result.write( DocWriter.getISOBytes( "\\clwWidth" ) );
  result.write( intToByteArray( this.cellWidth ) );
  this.document.outputDebugLinebreak( result );

  if ( this.cellPadding > 0 ) {
    result.write( DocWriter.getISOBytes( "\\clpadl" ) );
    result.write( intToByteArray( this.cellPadding / 2 ) );
    result.write( DocWriter.getISOBytes( "\\clpadt" ) );
    result.write( intToByteArray( this.cellPadding / 2 ) );
    result.write( DocWriter.getISOBytes( "\\clpadr" ) );
    result.write( intToByteArray( this.cellPadding / 2 ) );
    result.write( DocWriter.getISOBytes( "\\clpadb" ) );
    result.write( intToByteArray( this.cellPadding / 2 ) );
    result.write( DocWriter.getISOBytes( "\\clpadfl3" ) );
    result.write( DocWriter.getISOBytes( "\\clpadft3" ) );
    result.write( DocWriter.getISOBytes( "\\clpadfr3" ) );
    result.write( DocWriter.getISOBytes( "\\clpadfb3" ) );
  }
  result.write( DocWriter.getISOBytes( "\\cellx" ) );
  result.write( intToByteArray( this.cellRight ) );
}