textreportelement.java

来自「优秀的打印控件全源代码,类似水晶表的设计器!」· Java 代码 · 共 877 行 · 第 1/2 页

JAVA
877
字号
               }                        //g.setClip(null);      //g.setClip(orgClipBounds);      Java2DUtil.resetClip(g);      position.x += 10;      position.y += 10;      x_shift_origin += 10;      y_shift_origin += 10;            drawBorder( g, zoom_factor,  x_shift_origin,y_shift_origin);      //drawGraphicsElement(g,this.getGraphicElementPen(), zoom_factor,  x_shift_origin,y_shift_origin, 0);   }      /** Getter for property align.    * @return Value of property align.    *    */   public java.lang.String getAlign()   {      return align;   }      /** Setter for property align.    * @param align New value of property align.    *    */   public void setAlign(java.lang.String align)   {      this.align = align;   }      /** Getter for property bold.    * @return Value of property bold.    *    */   public boolean isBold()   {      return bold;   }      /** Setter for property bold.    * @param bold New value of property bold.    *    */   public void setBold(boolean bold)   {      this.bold = bold;   }      /** Getter for property font.    * @return Value of property font.    *    */   public java.awt.Font getFont()   {      return font;   }      /** Setter for property font.    * @param font New value of property font.    *    */   public void setFont(java.awt.Font font)   {      this.font = font;   }      /** Getter for property fontName.    * @return Value of property fontName.    *    */   public java.lang.String getFontName()   {      return fontName;   }      /** Setter for property fontName.    * @param fontName New value of property fontName.    *    */   public void setFontName(java.lang.String fontName)   {      this.fontName = fontName;   }      /** Getter for property fontSize.    * @return Value of property fontSize.    *    */   public int getFontSize()   {      return fontSize;   }      /** Setter for property fontSize.    * @param fontSize New value of property fontSize.    *    */   public void setFontSize(int fontSize)   {      this.fontSize = fontSize;   }      /** Getter for property italic.    * @return Value of property italic.    *    */   public boolean isItalic()   {      return italic;   }      /** Setter for property italic.    * @param italic New value of property italic.    *    */   public void setItalic(boolean italic)   {      this.italic = italic;   }      /** Getter for property lineSpacing.    * @return Value of property lineSpacing.    *    */   public java.lang.String getLineSpacing()   {      return lineSpacing;   }      /** Setter for property lineSpacing.    * @param lineSpacing New value of property lineSpacing.    *    */   public void setLineSpacing(java.lang.String lineSpacing)   {      this.lineSpacing = lineSpacing;   }      /** Getter for property pdfEmbedded.    * @return Value of property pdfEmbedded.    *    */   public boolean isPdfEmbedded()   {      return pdfEmbedded;   }      /** Setter for property pdfEmbedded.    * @param pdfEmbedded New value of property pdfEmbedded.    *    */   public void setPdfEmbedded(boolean pdfEmbedded)   {      this.pdfEmbedded = pdfEmbedded;   }      /** Getter for property pdfEncoding.    * @return Value of property pdfEncoding.    *    */   public java.lang.String getPdfEncoding()   {      return pdfEncoding;   }      /** Setter for property pdfEncoding.    * @param pdfEncoding New value of property pdfEncoding.    *    */   public void setPdfEncoding(java.lang.String pdfEncoding)   {      this.pdfEncoding = pdfEncoding;   }      /** Getter for property PDFFontName.    * @return Value of property PDFFontName.    *    */   public java.lang.String getPDFFontName()   {      return PDFFontName;   }      /** Setter for property PDFFontName.    * @param PDFFontName New value of property PDFFontName.    *    */   public void setPDFFontName(java.lang.String PDFFontName)   {      this.PDFFontName = PDFFontName;   }      /** Getter for property reportFont.    * @return Value of property reportFont.    *    */   public java.lang.String getReportFont()   {      return reportFont;   }      /** Setter for property reportFont.    * @param reportFont New value of property reportFont.    *    */   public void setReportFont(java.lang.String reportFont)   {      this.reportFont = reportFont;   }      /** Getter for property strikeTrought.    * @return Value of property strikeTrought.    *    */   public boolean isStrikeTrought()   {      return strikeTrought;   }      /** Setter for property strikeTrought.    * @param strikeTrought New value of property strikeTrought.    *    */   public void setStrikeTrought(boolean strikeTrought)   {      this.strikeTrought = strikeTrought;   }      /** Getter for property text.    * @return Value of property text.    *    */   public java.lang.String getText()   {      return text;   }      /** Setter for property text.    * @param text New value of property text.    *    */   public void setText(java.lang.String text)   {      this.text = text;   }      /** Getter for property TTFFont.    * @return Value of property TTFFont.    *    */   public java.lang.String getTTFFont()   {      return TTFFont;   }      /** Setter for property TTFFont.    * @param TTFFont New value of property TTFFont.    *    */   public void setTTFFont(java.lang.String TTFFont)   {      this.TTFFont = TTFFont;   }      /** Getter for property underline.    * @return Value of property underline.    *    */   public boolean isUnderline()   {      return underline;   }      /** Setter for property underline.    * @param underline New value of property underline.    *    */   public void setUnderline(boolean underline)   {      this.underline = underline;   }      /** Getter for property verticalAlign.    * @return Value of property verticalAlign.    *    */   public java.lang.String getVerticalAlign()   {      return verticalAlign;   }      /** Setter for property verticalAlign.    * @param verticalAlign New value of property verticalAlign.    *    */   public void setVerticalAlign(java.lang.String verticalAlign)   {      this.verticalAlign = verticalAlign;   }      /** Getter for property Rotate.    *  Rotate can be one of the values: "none", "left", "right"    * @return Value of property Rotate.    */   public java.lang.String getRotate()   {      return rotate;   }      /** Setter for property Rotate.    * @param Rotate New value of property Rotate.    *    */   public void setRotate(java.lang.String rotate)   {      this.rotate = rotate;   }      public int getTextHeight(java.awt.FontMetrics fm)   {      //      return fm.getAscent() + (this.getLineCount()-1)*(fm.getHeight());   }      public int getLineCount()   {      // For any \n, return a line...      String text = this.getText();      text = text.replace('\r', ' ');      int line=1;      while (text.indexOf('\n')>0)      {         line++;         text = text.substring( text.indexOf('\n') + 1);      }      return line;   }    public void copyBaseReportElement(ReportElement destination, ReportElement source)   {      super.copyBaseReportElement(destination, source);            if (destination instanceof TextReportElement &&      source instanceof TextReportElement )      {         ((TextReportElement)destination).setAlign(new String(  ((TextReportElement)source).getAlign() ));         ((TextReportElement)destination).setReportFont(((TextReportElement)source).getReportFont());         ((TextReportElement)destination).setFontName(new String(  ((TextReportElement)source).getFontName() ));         ((TextReportElement)destination).setPDFFontName(new String(  ((TextReportElement)source).getPDFFontName() ));         ((TextReportElement)destination).setFontSize( ((TextReportElement)source).getFontSize() );         ((TextReportElement)destination).setTTFFont(new String(  ((TextReportElement)source).getTTFFont() ));         ((TextReportElement)destination).setBold( ((TextReportElement)source).isBold() );         ((TextReportElement)destination).setItalic( ((TextReportElement)source).isItalic() );         ((TextReportElement)destination).setUnderline(  ((TextReportElement)source).isUnderline() );         ((TextReportElement)destination).setStrikeTrought(  ((TextReportElement)source).isStrikeTrought() );         ((TextReportElement)destination).setLineSpacing(new String(  ((TextReportElement)source).getLineSpacing() ));         ((TextReportElement)destination).setVerticalAlign(new String(  ((TextReportElement)source).getVerticalAlign() ));         ((TextReportElement)destination).setPdfEmbedded( ((TextReportElement)source).isPdfEmbedded());         ((TextReportElement)destination).setPdfEncoding(new String(  ((TextReportElement)source).getPdfEncoding() ));         ((TextReportElement)destination).setText(new String(  ((TextReportElement)source).getText() ));      }   }   private class TextReportElementLayout {       private TextLayout layout;       private float x;       private float y;       private TextReportElementLayout(TextLayout layout, float x, float y) {           this.layout = layout;           this.x = x;           this.y = y;       }       void drawWithOffset(Graphics2D g2, float yOffset) {           layout.draw(g2, x, y + yOffset);       }   }   static List getRotations() {       return Rotation.rotations;   }   /** Getter for property isStyledText.    * @return Value of property isStyledText.    *    */   public boolean isIsStyledText() {       return isStyledText;   }      /** Setter for property isStyledText.    * @param isStyledText New value of property isStyledText.    *    */   public void setIsStyledText(boolean isStyledText) {       this.isStyledText = isStyledText;   }      static class Rotation {       static private ArrayList rotations;       private String name;       private int number;       Rotation(String name, int number) {           this.name = name;           this.number = number;           rotations = new ArrayList();           rotations.add(this);       }       public int getNumber() {         return number;       }       public String getName() {           return name;       }       public String toString() {           return getName();       }   }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?