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

The following examples show how to use com.lowagie.text.Element#ALIGN_TOP . 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: 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 5
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 ) );
}