Search in sources :

Example 6 with PrintDataElement

use of org.compiere.print.PrintDataElement in project adempiere by adempiere.

the class PrintDataExcelExporter method getPDE.

private PrintDataElement getPDE(int row, int col) {
    if (m_printData.getRowIndex() != row)
        m_printData.setRowIndex(row);
    //
    MPrintFormatItem item = m_printFormat.getItem(col);
    int AD_Column_ID = item.getAD_Column_ID();
    Object obj = null;
    if (AD_Column_ID > 0)
        obj = m_printData.getNode(Integer.valueOf(AD_Column_ID));
    if (obj != null && obj instanceof PrintDataElement) {
        return (PrintDataElement) obj;
    }
    return null;
}
Also used : PrintDataElement(org.compiere.print.PrintDataElement) MPrintFormatItem(org.compiere.print.MPrintFormatItem)

Example 7 with PrintDataElement

use of org.compiere.print.PrintDataElement in project adempiere by adempiere.

the class LayoutEngine method createBarcodeElement.

//	createImageElement
/**
	 * 	Create Barcode Element
	 *	@param item item
	 *	@return barcode element
	 */
private PrintElement createBarcodeElement(MPrintFormatItem item) {
    //	Get Data
    Object obj = m_data.getNode(new Integer(item.getAD_Column_ID()));
    if (obj == null)
        return null;
    else if (obj instanceof PrintDataElement)
        ;
    else {
        log.log(Level.SEVERE, "Element not PrintDataElement " + obj.getClass());
        return null;
    }
    //	Convert DataElement to String
    PrintDataElement data = (PrintDataElement) obj;
    if (data.isNull() && item.isSuppressNull())
        return null;
    String stringContent = data.getValueDisplay(m_format.getLanguage());
    if ((stringContent == null || stringContent.length() == 0) && item.isSuppressNull())
        return null;
    BarcodeElement element = new BarcodeElement(stringContent, item);
    if (element.isValid())
        return element;
    return null;
}
Also used : PrintDataElement(org.compiere.print.PrintDataElement)

Example 8 with PrintDataElement

use of org.compiere.print.PrintDataElement in project adempiere by adempiere.

the class LayoutEngine method createImageElement.

//	createBoxElement
/**
	 * 	Create Image Element from item
	 *	@param item item
	 *	@return image element
	 */
private PrintElement createImageElement(MPrintFormatItem item) {
    Object obj = m_data.getNode(new Integer(item.getAD_Column_ID()));
    if (obj == null)
        return null;
    else if (obj instanceof PrintDataElement)
        ;
    else {
        log.log(Level.SEVERE, "Element not PrintDataElement " + obj.getClass());
        return null;
    }
    PrintDataElement data = (PrintDataElement) obj;
    if (data.isNull() && item.isSuppressNull())
        return null;
    String url = data.getValueDisplay(m_format.getLanguage());
    if ((url == null || url.length() == 0)) {
        if (item.isSuppressNull())
            return null;
        else
            //	should create an empty area
            return null;
    }
    ImageElement element = null;
    if (data.getDisplayType() == DisplayType.Image) {
        element = ImageElement.get(data, url);
    } else {
        element = ImageElement.get(url);
    }
    return element;
}
Also used : PrintDataElement(org.compiere.print.PrintDataElement)

Aggregations

PrintDataElement (org.compiere.print.PrintDataElement)8 MPrintFormatItem (org.compiere.print.MPrintFormatItem)3 Color (java.awt.Color)2 Font (java.awt.Font)2 Point (java.awt.Point)2 MQuery (org.compiere.model.MQuery)2 MPrintColor (org.compiere.print.MPrintColor)2 MPrintFont (org.compiere.print.MPrintFont)2 MPrintFormat (org.compiere.print.MPrintFormat)2 PrintData (org.compiere.print.PrintData)2 KeyNamePair (org.compiere.util.KeyNamePair)2 ValueNamePair (org.compiere.util.ValueNamePair)2 Rectangle (java.awt.Rectangle)1 Point2D (java.awt.geom.Point2D)1 PrinterException (java.awt.print.PrinterException)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 PrintWriter (java.io.PrintWriter)1 Timestamp (java.sql.Timestamp)1 ArrayList (java.util.ArrayList)1