當前位置: 首頁>>代碼示例>>Java>>正文


Java MessageHandler類代碼示例

本文整理匯總了Java中org.apache.fop.messaging.MessageHandler的典型用法代碼示例。如果您正苦於以下問題:Java MessageHandler類的具體用法?Java MessageHandler怎麽用?Java MessageHandler使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MessageHandler類屬於org.apache.fop.messaging包,在下文中一共展示了MessageHandler類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getFOPContentHandler

import org.apache.fop.messaging.MessageHandler; //導入依賴的package包/類
/**
 * @param os
 *        the stream to which the PDF output will be written by FOP
 * @return the content handler of a FOP Driver object which is used to process
 *         FO data
 */
public static ContentHandler getFOPContentHandler (final OutputStream os)
{
  final Driver fop = new Driver ();

  // Avalon logging framework
  final ConsoleLogger log = new ConsoleLogger (ConsoleLogger.LEVEL_WARN);
  MessageHandler.setScreenLogger (log);
  fop.setLogger (log);

  // Default: produce PDF
  fop.setRenderer (Driver.RENDER_PDF);
  fop.setOutputStream (os);

  return fop.getContentHandler ();
}
 
開發者ID:phax,項目名稱:ph-stx,代碼行數:22,代碼來源:FOPEmitter.java

示例2: renderBarcodeUsingSVG

import org.apache.fop.messaging.MessageHandler; //導入依賴的package包/類
protected void renderBarcodeUsingSVG(Renderer renderer) {
    try {
        renderer.renderSVGArea(createSVGArea());
    } catch (BarcodeCanvasSetupException bcse) {
        MessageHandler.errorln(
            "Couldn't render barcode due to BarcodeCanvasSetupException: " 
                + bcse.getMessage());
    }
}
 
開發者ID:thanakrit,項目名稱:barcode4j,代碼行數:10,代碼來源:BarcodeArea.java

示例3: configureFop

import org.apache.fop.messaging.MessageHandler; //導入依賴的package包/類
private void configureFop() {
  MessageHandler.setQuiet(true);
  fopLogger = new Log4JLogger(log4j);
  MessageHandler.setScreenLogger(fopLogger);
}
 
開發者ID:mauyr,項目名稱:openbravo-brazil,代碼行數:6,代碼來源:ConfigParameters.java

示例4: layout

import org.apache.fop.messaging.MessageHandler; //導入依賴的package包/類
/**
 * layout this formatting object.
 *
 * @param area the area to layout the object into
 *
 * @return the status of the layout
 */
public int layout(final Area area) throws FOPException {
    if (!(area instanceof ForeignObjectArea)) {
        // this is an error
        throw new FOPException("Barcode not in fo:instream-foreign-object");
    }

    if (this.marker == START) {
        this.fs = area.getFontState();

        this.marker = 0;
    }

    //MessageHandler.logln("Creating barcode area");

    /* create a barcode area */
    /* if width and height are zero, get the bounds of the content. */
    final ForeignObjectArea foa = (ForeignObjectArea)area;

    Element e = this.doc.getDocumentElement();

    //if(!e.hasAttributeNS(XMLSupport.XMLNS_NAMESPACE_URI, "xmlns")) {
        e.setAttributeNS(XMLNS_NAMESPACE_URI, "xmlns", BarcodeConstants.NAMESPACE);
    //}

    Configuration cfg = ConfigurationUtil.buildConfiguration(this.doc);
    try {
        String msg = ConfigurationUtil.getMessage(cfg);
        msg = MessageUtil.unescapeUnicode(msg);

        int orientation = cfg.getAttributeAsInteger("orientation", 0);

        //MessageHandler.logln("Barcode message: " + msg);
        final String renderMode = cfg.getAttribute("render-mode", "native");
        //MessageHandler.logln("Render mode: " + renderMode);

        BarcodeGenerator bargen = BarcodeUtil.getInstance().
                createBarcodeGenerator(cfg);
        String expandedMsg = VariableUtil.getExpandedMessage(foa.getPage(), msg);
        BarcodeDimension bardim = bargen.calcDimensions(expandedMsg);
        final float w = (float)UnitConv.mm2pt(bardim.getWidthPlusQuiet(orientation)) * 1000;
        final float h = (float)UnitConv.mm2pt(bardim.getHeightPlusQuiet(orientation)) * 1000;


        BarcodeArea barcodeArea = createArea(fs, w, h);
        barcodeArea.setParent(foa);
        barcodeArea.setPage(foa.getPage());
        barcodeArea.setBarcode(bargen, expandedMsg, renderMode, orientation);
        barcodeArea.start();
        barcodeArea.end();

        /* add the SVG area to the containing area */
        foa.setObject(barcodeArea);
        foa.setIntrinsicWidth(barcodeArea.getWidth());
        foa.setIntrinsicHeight(barcodeArea.getHeight());

        /* return status */
        return Status.OK;
    } catch (ConfigurationException ce) {
        MessageHandler.errorln("Error in barcode XML: " + ce.getMessage());
        throw new FOPException("Error in barcode XML", ce);
    } catch (BarcodeException be) {
        MessageHandler.errorln("Error generating barcode: " + be.getMessage());
        throw new FOPException("Error generating barcode", be);
    }
}
 
開發者ID:thanakrit,項目名稱:barcode4j,代碼行數:73,代碼來源:BarcodeElement.java


注:本文中的org.apache.fop.messaging.MessageHandler類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。