Search in sources :

Example 1 with Page

use of org.compiere.print.layout.Page in project adempiere by adempiere.

the class View method getDrillDown.

//	getPaperHeight
/**
	 * 	Get Drill Down
	 *  @param absolutePoint point
	 *  @return Drill Down
	 */
public MQuery getDrillDown(Point absolutePoint) {
    int pageNo = (int) getPageNoAt(absolutePoint);
    Rectangle pageRectangle = getRectangleOfPage(pageNo, false);
    Point relativePoint = new Point((int) (absolutePoint.x / getScale() - pageRectangle.x), (int) (absolutePoint.y / getScale() - pageRectangle.y));
    Page page = (Page) m_layout.getPages().get(pageNo - 1);
    //
    log.config("Relative=" + relativePoint + ", " + page);
    //	log.config("AbsolutePoint=" + absolutePoint + ", PageNo=" + pageNo + ", pageRectangle=" + pageRectangle);
    MQuery retValue = page.getDrillDown(relativePoint);
    if (retValue == null)
        retValue = m_layout.getHeaderFooter().getDrillDown(relativePoint);
    return retValue;
}
Also used : Rectangle(java.awt.Rectangle) Page(org.compiere.print.layout.Page) MQuery(org.compiere.model.MQuery) Point(java.awt.Point) Point(java.awt.Point)

Example 2 with Page

use of org.compiere.print.layout.Page in project adempiere by adempiere.

the class View method getDrillAcross.

//	getDrillDown
/**
	 * 	Get Drill Across
	 *  @param absolutePoint point
	 *  @return Drill Across
	 */
public MQuery getDrillAcross(Point absolutePoint) {
    int pageNo = (int) getPageNoAt(absolutePoint);
    Rectangle pageRectangle = getRectangleOfPage(pageNo);
    Point relativePoint = new Point((int) (absolutePoint.x / getScale() - pageRectangle.x), (int) (absolutePoint.y / getScale() - pageRectangle.y));
    Page page = (Page) m_layout.getPages().get(pageNo - 1);
    //
    log.config("Relative=" + relativePoint + ", " + page);
    //	log.config("AbsolutePoint=" + absolutePoint + ", PageNo=" + pageNo + ", pageRectangle=" + pageRectangle);
    return page.getDrillAcross(relativePoint);
}
Also used : Rectangle(java.awt.Rectangle) Page(org.compiere.print.layout.Page) Point(java.awt.Point) Point(java.awt.Point)

Example 3 with Page

use of org.compiere.print.layout.Page in project adempiere by adempiere.

the class View method paintComponent.

//	IsArchivable
/**
	 * 	Paint Component
	 * 	@param g Graphics
	 */
public void paintComponent(Graphics g) {
    //	log.fine( "View.paintComponent", g.getClip());
    Graphics2D g2D = (Graphics2D) g;
    g2D.scale(getScale(), getScale());
    Rectangle bounds = g2D.getClipBounds();
    //
    g2D.setColor(COLOR_BACKGROUND);
    g2D.fillRect(bounds.x, bounds.y, bounds.width, bounds.height);
    //	for all pages
    for (int page = 0; page < m_layout.getPages().size(); page++) {
        Rectangle pageRectangle = getRectangleOfPage(page + 1, false);
        if (bounds.intersects(pageRectangle)) {
            Page p = (Page) m_layout.getPages().get(page);
            //	sets context
            p.paint(g2D, pageRectangle, true, false);
            m_layout.getHeaderFooter().paint(g2D, pageRectangle, true);
        }
    //	paint page
    }
//	for all pages
}
Also used : Rectangle(java.awt.Rectangle) Page(org.compiere.print.layout.Page) Point(java.awt.Point) Graphics2D(java.awt.Graphics2D)

Aggregations

Point (java.awt.Point)3 Rectangle (java.awt.Rectangle)3 Page (org.compiere.print.layout.Page)3 Graphics2D (java.awt.Graphics2D)1 MQuery (org.compiere.model.MQuery)1