Java 类com.lowagie.text.pdf.PdfGraphics2D 实例源码

项目:MesquiteCore    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
    if (g == null)
        return;
    setPrintingInProcess(true);
    if (getFieldWidth()==0 || getFieldHeight()==0)
        setFieldSize(getBounds().width, getBounds().height);
    int ww = getWidth();
    int hh = getHeight();

    setSize(getFieldWidth(), getFieldHeight());
    //super.paint(g);
    if (tree==null)
        MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
    else if ((!suppress) && (!tree.isLocked())) {
        repaintsPending = 0;

        /* NEEDS TO DRAW BACKGROUND EXTRAS */
        int dRoot = getTreeDrawing().getDrawnRoot();
        if (!tree.nodeExists(dRoot))
            dRoot = tree.getRoot();
        printAllBackgroundExtras(tree, dRoot, g);
        getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
        printAllExtras(tree, dRoot, g);
        if (ownerDrawModule.labelBranchLengths.getValue())
            drawBranchLengthsOnTree(tree, dRoot, g);
        if (ownerDrawModule.showNodeNumbers.getValue())
            drawNodeNumbersOnTree(tree, dRoot, g);
        if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
            ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
        if (g instanceof PdfGraphics2D)     //headless:  comment out
            printComponentsPDF(g);      //headless:  comment out
        else                                        //headless:  comment out
            printComponents(g);
    } 
    else MesquiteMessage.warnProgrammer("tree drawing suppressed");
    setSize(ww, hh);
    setPrintingInProcess(false);
}
项目:balloonist    文件:ITextStyleStrategy.java   
/**
 * Produces a filtered Map, replacing text attributes in a Map that would be unpalatable to
 * the PDFGraphics2D.drawString()
 * method in iText, which only accepts FONT, SIZE, UNDERLINE, and SUPERSCRIPT
 */
public Map replaceUnsavoryAttributes(final Graphics2D graphics2D, Map requestedAttributesMap)
{
    if (requestedAttributesMap==null)
        return null;

    if (graphics2D instanceof PdfGraphics2D)
    {
        // System.out.println("requestedAttributesMap.getClass().getName()="+requestedAttributesMap.getClass().getName());

        Font replacement = null;

        Map filtered = new HashMap();

        Iterator walk = requestedAttributesMap.keySet().iterator();

        // System.out.println("requestedAttributesMap before filtering: "+requestedAttributesMap);

        while (walk.hasNext())
        {
            TextAttribute textAttribute = (TextAttribute) walk.next();
            if (textAttribute == TextAttribute.FAMILY)
            {
                Font font = new Font(requestedAttributesMap);
            }

            if (textAttribute == TextAttribute.FONT || textAttribute == TextAttribute.SIZE
                    || textAttribute == TextAttribute.UNDERLINE || textAttribute == TextAttribute.SUPERSCRIPT)
            {
                filtered.put(textAttribute, requestedAttributesMap.get(textAttribute));
            }
        }

        // System.out.println("requestedAttributesMap after removal: "+requestedAttributesMap);

        if (replacement!=null)
        {
            // System.out.println("setting font replacement...");
            filtered.put(TextAttribute.FONT, replacement);
        }

        // System.out.println("requestedAttributesMap after filtering: "+requestedAttributesMap);

        return filtered;
    }
    else
    {
        return requestedAttributesMap;
    }
}
项目:MesquiteArchive    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
        if (g == null)
            return;
        setPrintingInProcess(true);
        if (getFieldWidth()==0 || getFieldHeight()==0)
            setFieldSize(getBounds().width, getBounds().height);
        int ww = getWidth();
        int hh = getHeight();

        setSize(getFieldWidth(), getFieldHeight());
        //super.paint(g);
        if (tree==null)
            MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
        else if ((!suppress) && (!tree.isLocked())) {
            repaintsPending = 0;
            /* NEEDS TO DRAW BACKGROUND EXTRAS */
            int dRoot = getTreeDrawing().getDrawnRoot();
            if (!tree.nodeExists(dRoot))
                dRoot = tree.getRoot();
            printAllBackgroundExtras(tree, dRoot, g);
            getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
            printAllExtras(tree, dRoot, g);
            if (ownerDrawModule.labelBranchLengths.getValue())
                drawBranchLengthsOnTree(tree, dRoot, g);
            if (ownerDrawModule.showNodeNumbers.getValue())
                drawNodeNumbersOnTree(tree, dRoot, g);
            if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
                ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
            if (g instanceof PdfGraphics2D)     //headless:  comment out
                printComponentsPDF(g);      //headless:  comment out
            else                                        //headless:  comment out
                printComponents(g);
        } 
        else MesquiteMessage.warnProgrammer("tree drawing suppressed");
        setSize(ww, hh);
        setPrintingInProcess(false);
    }
项目:MesquiteArchive    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
        if (g == null)
            return;
        setPrintingInProcess(true);
        if (getFieldWidth()==0 || getFieldHeight()==0)
            setFieldSize(getBounds().width, getBounds().height);
        int ww = getWidth();
        int hh = getHeight();

        setSize(getFieldWidth(), getFieldHeight());
        //super.paint(g);
        if (tree==null)
            MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
        else if ((!suppress) && (!tree.isLocked())) {
            repaintsPending = 0;
            /* NEEDS TO DRAW BACKGROUND EXTRAS */
            int dRoot = getTreeDrawing().getDrawnRoot();
            if (!tree.nodeExists(dRoot))
                dRoot = tree.getRoot();
            printAllBackgroundExtras(tree, dRoot, g);
            getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
            printAllExtras(tree, dRoot, g);
            if (ownerDrawModule.labelBranchLengths.getValue())
                drawBranchLengthsOnTree(tree, dRoot, g);
            if (ownerDrawModule.showNodeNumbers.getValue())
                drawNodeNumbersOnTree(tree, dRoot, g);
            if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
                ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
            if (g instanceof PdfGraphics2D)
                printComponentsPDF(g);
            else
                printComponents(g);
        } 
        else MesquiteMessage.warnProgrammer("tree drawing suppressed");
        setSize(ww, hh);
        setPrintingInProcess(false);
    }
项目:MesquiteArchive    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
        setPrintingInProcess(true);
        if (getFieldWidth()==0 || getFieldHeight()==0)
            setFieldSize(getBounds().width, getBounds().height);
        int ww = getWidth();
        int hh = getHeight();

        Point translate = new Point(translatePoint);
        translate.x = 0;
        translate.y = 0;
        setSize(getFieldWidth(), getFieldHeight());
        //super.paint(g);
        if (tree==null)
            MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
        else if ((!suppress) && (!tree.isLocked())) {
            repaintsPending = 0;
            /* NEEDS TO DRAW BACKGROUND EXTRAS */
            int dRoot = getTreeDrawing().getDrawnRoot();
            if (!tree.nodeExists(dRoot))
                dRoot = tree.getRoot();
            printAllBackgroundExtras(tree, dRoot, g);
            getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
            printAllExtras(tree, dRoot, g);
            if (ownerDrawModule.labelBranchLengths.getValue())
                drawBranchLengthsOnTree(tree, dRoot, g);
            if (ownerDrawModule.showNodeNumbers.getValue())
                drawNodeNumbersOnTree(tree, dRoot, g);
            if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
                ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
            if (g instanceof PdfGraphics2D)
                printComponentsPDF(g);
            else
                printComponents(g);
        } 
        else MesquiteMessage.warnProgrammer("tree drawing suppressed");
        translatePoint.x = translate.y;
        translatePoint.y = translate.y;
        setSize(ww, hh);
        setPrintingInProcess(false);
    }
项目:MesquiteArchive    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
        setPrintingInProcess(true);
        if (getFieldWidth()==0 || getFieldHeight()==0)
            setFieldSize(getBounds().width, getBounds().height);
        int ww = getWidth();
        int hh = getHeight();

        setSize(getFieldWidth(), getFieldHeight());
        //super.paint(g);
        if (tree==null)
            MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
        else if ((!suppress) && (!tree.isLocked())) {
            repaintsPending = 0;
            /* NEEDS TO DRAW BACKGROUND EXTRAS */
            int dRoot = getTreeDrawing().getDrawnRoot();
            if (!tree.nodeExists(dRoot))
                dRoot = tree.getRoot();
            printAllBackgroundExtras(tree, dRoot, g);
            getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
            printAllExtras(tree, dRoot, g);
            if (ownerDrawModule.labelBranchLengths.getValue())
                drawBranchLengthsOnTree(tree, dRoot, g);
            if (ownerDrawModule.showNodeNumbers.getValue())
                drawNodeNumbersOnTree(tree, dRoot, g);
            if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
                ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
            if (g instanceof PdfGraphics2D)
                printComponentsPDF(g);
            else
                printComponents(g);
        } 
        else MesquiteMessage.warnProgrammer("tree drawing suppressed");
        setSize(ww, hh);
        setPrintingInProcess(false);
    }
项目:MesquiteArchive    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
        if (g == null)
            return;
        setPrintingInProcess(true);
        if (getFieldWidth()==0 || getFieldHeight()==0)
            setFieldSize(getBounds().width, getBounds().height);
        int ww = getWidth();
        int hh = getHeight();

        setSize(getFieldWidth(), getFieldHeight());
        //super.paint(g);
        if (tree==null)
            MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
        else if ((!suppress) && (!tree.isLocked())) {
            repaintsPending = 0;
            /* NEEDS TO DRAW BACKGROUND EXTRAS */
            int dRoot = getTreeDrawing().getDrawnRoot();
            if (!tree.nodeExists(dRoot))
                dRoot = tree.getRoot();
            printAllBackgroundExtras(tree, dRoot, g);
            getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
            printAllExtras(tree, dRoot, g);
            if (ownerDrawModule.labelBranchLengths.getValue())
                drawBranchLengthsOnTree(tree, dRoot, g);
            if (ownerDrawModule.showNodeNumbers.getValue())
                drawNodeNumbersOnTree(tree, dRoot, g);
            if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
                ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
            if (g instanceof PdfGraphics2D)     //headless:  comment out
                printComponentsPDF(g);      //headless:  comment out
            else                                        //headless:  comment out
                printComponents(g);
        } 
        else MesquiteMessage.warnProgrammer("tree drawing suppressed");
        setSize(ww, hh);
        setPrintingInProcess(false);
    }
项目:MesquiteArchive    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
        setPrintingInProcess(true);
        if (getFieldWidth()==0 || getFieldHeight()==0)
            setFieldSize(getBounds().width, getBounds().height);
        int ww = getWidth();
        int hh = getHeight();

        setSize(getFieldWidth(), getFieldHeight());
        //super.paint(g);
        if (tree==null)
            MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
        else if ((!suppress) && (!tree.isLocked())) {
            repaintsPending = 0;
            /* NEEDS TO DRAW BACKGROUND EXTRAS */
            int dRoot = getTreeDrawing().getDrawnRoot();
            if (!tree.nodeExists(dRoot))
                dRoot = tree.getRoot();
            printAllBackgroundExtras(tree, dRoot, g);
            getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
            printAllExtras(tree, dRoot, g);
            if (ownerDrawModule.labelBranchLengths.getValue())
                drawBranchLengthsOnTree(tree, dRoot, g);
            if (ownerDrawModule.showNodeNumbers.getValue())
                drawNodeNumbersOnTree(tree, dRoot, g);
            if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
                ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
            if (g instanceof PdfGraphics2D)
                printComponentsPDF(g);
            else
                printComponents(g);
        } 
        else MesquiteMessage.warnProgrammer("tree drawing suppressed");
        setSize(ww, hh);
        setPrintingInProcess(false);
    }
项目:MesquiteArchive    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
        if (g == null)
            return;
        setPrintingInProcess(true);
        if (getFieldWidth()==0 || getFieldHeight()==0)
            setFieldSize(getBounds().width, getBounds().height);
        int ww = getWidth();
        int hh = getHeight();

        setSize(getFieldWidth(), getFieldHeight());
        //super.paint(g);
        if (tree==null)
            MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
        else if ((!suppress) && (!tree.isLocked())) {
            repaintsPending = 0;
            /* NEEDS TO DRAW BACKGROUND EXTRAS */
            int dRoot = getTreeDrawing().getDrawnRoot();
            if (!tree.nodeExists(dRoot))
                dRoot = tree.getRoot();
            printAllBackgroundExtras(tree, dRoot, g);
            getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
            printAllExtras(tree, dRoot, g);
            if (ownerDrawModule.labelBranchLengths.getValue())
                drawBranchLengthsOnTree(tree, dRoot, g);
            if (ownerDrawModule.showNodeNumbers.getValue())
                drawNodeNumbersOnTree(tree, dRoot, g);
            if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
                ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
            if (g instanceof PdfGraphics2D)     //headless:  comment out
                printComponentsPDF(g);      //headless:  comment out
            else                                        //headless:  comment out
                printComponents(g);
        } 
        else MesquiteMessage.warnProgrammer("tree drawing suppressed");
        setSize(ww, hh);
        setPrintingInProcess(false);
    }
项目:MesquiteArchive    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
        if (g == null)
            return;
        setPrintingInProcess(true);
        if (getFieldWidth()==0 || getFieldHeight()==0)
            setFieldSize(getBounds().width, getBounds().height);
        int ww = getWidth();
        int hh = getHeight();

        setSize(getFieldWidth(), getFieldHeight());
        //super.paint(g);
        if (tree==null)
            MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
        else if ((!suppress) && (!tree.isLocked())) {
            repaintsPending = 0;
            /* NEEDS TO DRAW BACKGROUND EXTRAS */
            int dRoot = getTreeDrawing().getDrawnRoot();
            if (!tree.nodeExists(dRoot))
                dRoot = tree.getRoot();
            printAllBackgroundExtras(tree, dRoot, g);
            getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
            printAllExtras(tree, dRoot, g);
            if (ownerDrawModule.labelBranchLengths.getValue())
                drawBranchLengthsOnTree(tree, dRoot, g);
            if (ownerDrawModule.showNodeNumbers.getValue())
                drawNodeNumbersOnTree(tree, dRoot, g);
            if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
                ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
            if (g instanceof PdfGraphics2D)
                printComponentsPDF(g);
            else
                printComponents(g);
        } 
        else MesquiteMessage.warnProgrammer("tree drawing suppressed");
        setSize(ww, hh);
        setPrintingInProcess(false);
    }
项目:MesquiteArchive    文件:BasicTreeDrawCoordinator.java   
public void printAll(Graphics g) {
        if (g == null)
            return;
        setPrintingInProcess(true);
        if (getFieldWidth()==0 || getFieldHeight()==0)
            setFieldSize(getBounds().width, getBounds().height);
        int ww = getWidth();
        int hh = getHeight();

        setSize(getFieldWidth(), getFieldHeight());
        //super.paint(g);
        if (tree==null)
            MesquiteMessage.warnProgrammer("tree NULL in tree draw coord");
        else if ((!suppress) && (!tree.isLocked())) {
            repaintsPending = 0;
            /* NEEDS TO DRAW BACKGROUND EXTRAS */
            int dRoot = getTreeDrawing().getDrawnRoot();
            if (!tree.nodeExists(dRoot))
                dRoot = tree.getRoot();
            printAllBackgroundExtras(tree, dRoot, g);
            getTreeDrawing().drawTree(tree, dRoot, g); //OTHER ROOTS
            printAllExtras(tree, dRoot, g);
            if (ownerDrawModule.labelBranchLengths.getValue())
                drawBranchLengthsOnTree(tree, dRoot, g);
            if (ownerDrawModule.showNodeNumbers.getValue())
                drawNodeNumbersOnTree(tree, dRoot, g);
            if (!suppressNames && ownerModule!=null && ((DrawTreeCoordinator)ownerModule).getNamesTask()!=null)
                ((DrawTreeCoordinator)ownerModule).getNamesTask().drawNames(this, tree, dRoot, g);
            if (g instanceof PdfGraphics2D)     //headless:  comment out
                printComponentsPDF(g);      //headless:  comment out
            else                                        //headless:  comment out
                printComponents(g);
        } 
        else MesquiteMessage.warnProgrammer("tree drawing suppressed");
        setSize(ww, hh);
        setPrintingInProcess(false);
    }