当前位置: 首页>>代码示例>>Java>>正文


Java Configuration.getChild方法代码示例

本文整理汇总了Java中org.apache.avalon.framework.configuration.Configuration.getChild方法的典型用法代码示例。如果您正苦于以下问题:Java Configuration.getChild方法的具体用法?Java Configuration.getChild怎么用?Java Configuration.getChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.avalon.framework.configuration.Configuration的用法示例。


在下文中一共展示了Configuration.getChild方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
private void configure(PSRenderingUtil psUtil, Configuration cfg) {
    psUtil.setAutoRotateLandscape(
        cfg.getChild("auto-rotate-landscape").getValueAsBoolean(false));
    Configuration child;
    child = cfg.getChild("language-level");
    if (child != null) {
        psUtil.setLanguageLevel(child.getValueAsInteger(
                PSGenerator.DEFAULT_LANGUAGE_LEVEL));
    }
    child = cfg.getChild("optimize-resources");
    if (child != null) {
        psUtil.setOptimizeResources(child.getValueAsBoolean(false));
    }
    child = cfg.getChild("rendering");
    if (child != null) {
        psUtil.setRenderingMode(PSRenderingMode.valueOf(
                child.getValue(psUtil.getRenderingMode().toString())
                .toUpperCase(Locale.ENGLISH)));
    }
    psUtil.setSafeSetPageDevice(
        cfg.getChild("safe-set-page-device").getValueAsBoolean(false));
    psUtil.setDSCComplianceEnabled(
        cfg.getChild("dsc-compliant").getValueAsBoolean(true));
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:25,代码来源:PSRendererConfigurator.java

示例2: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void configure(Configuration cfg) throws ConfigurationException {
    //Module width (MUST ALWAYS BE FIRST BECAUSE QUIET ZONE MAY DEPEND ON IT)
    Length mw = new Length(cfg.getChild("module-width").getValue("0.21mm"), "mm");
    getBean().setModuleWidth(mw.getValueAsMillimeter());

    super.configure(cfg);

    //Checksum mode
    getCodabarBean().setChecksumMode(ChecksumMode.byName(
        cfg.getChild("checksum").getValue(ChecksumMode.CP_AUTO.getName())));

    //Wide factor
    getCodabarBean().setWideFactor(
        cfg.getChild("wide-factor").getValueAsFloat((float)CodabarBean.DEFAULT_WIDE_FACTOR));

    Configuration hr = cfg.getChild("human-readable", false);
    if (hr != null) {
        //Display start/stop character and checksum in hr-message or not
        getCodabarBean().setDisplayStartStop(
                hr.getChild("display-start-stop").getValueAsBoolean(
                        CodabarBean.DEFAULT_DISPLAY_START_STOP));
    }
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:25,代码来源:Codabar.java

示例3: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void configure(Configuration cfg) throws ConfigurationException {
    Interleaved2Of5Bean bean = getInterleaved2Of5Bean();
    //Module width (MUST ALWAYS BE FIRST BECAUSE QUIET ZONE MAY DEPEND ON IT)
    Length mw = new Length(cfg.getChild("module-width")
                    .getValue(bean.getModuleWidth() + "mm"), "mm");
    bean.setModuleWidth(mw.getValueAsMillimeter());

    super.configure(cfg);

    //Checksum mode
    bean.setChecksumMode(ChecksumMode.byName(
        cfg.getChild("checksum").getValue(ChecksumMode.CP_AUTO.getName())));

    //Wide factor
    bean.setWideFactor(
        cfg.getChild("wide-factor").getValueAsFloat((float)bean.getWideFactor()));

    Configuration hr = cfg.getChild("human-readable", false);
    if (hr != null) {
        //Display checksum in hr-message or not
        bean.setDisplayChecksum(
                hr.getChild("display-checksum").getValueAsBoolean(false));
    }
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:26,代码来源:Interleaved2Of5.java

示例4: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void configure(Configuration cfg) throws ConfigurationException {
    super.configure(cfg);

    //Bearer bar width
    Configuration c = cfg.getChild("bearer-bar-width", false);
    if (c != null) {
        Length w = new Length(c.getValue(), "mw");
        if (w.getUnit().equalsIgnoreCase("mw")) {
            getITFBean().setBearerBarWidth(w.getValue() * getBean().getModuleWidth());
        } else {
            getITFBean().setBearerBarWidth(w.getValueAsMillimeter());
        }
    }

    //Bearer ox
    c = cfg.getChild("bearer-box", false);
    if (c != null) {
        getITFBean().setBearerBox(c.getValueAsBoolean());
    }
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:22,代码来源:ITF14.java

示例5: setPDFDocVersion

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
private void setPDFDocVersion(Configuration cfg, PDFRenderingUtil pdfUtil) throws FOPException {
    Configuration pdfVersion = cfg.getChild(PDFConfigurationConstants.PDF_VERSION, false);
    if (pdfVersion != null) {
        String version = pdfVersion.getValue(null);
        if (version != null && version.length() != 0) {
            try {
                pdfUtil.setPDFVersion(version);
            } catch (IllegalArgumentException e) {
                throw new FOPException(e.getMessage());
            }
        } else {
            throw new FOPException("The PDF version has not been set.");
        }
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:16,代码来源:PDFRendererConfigurator.java

示例6: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void configure(Configuration cfg) throws ConfigurationException {
    this.converter = cfg.getChild("converter").getValue();
    this.deleteTempFiles = cfg.getChild("delete-temp-files").getValueAsBoolean(true);
    if (cfg.getChild("target-format", false) != null) {
        this.targetFormat = cfg.getChild("target-format").getValue();
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:9,代码来源:AbstractPSPDFBitmapProducer.java

示例7: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void configure(Configuration configuration) throws ConfigurationException {
    this.threads = configuration.getChild("threads").getValueAsInteger(10);
    this.outputDir = new File(configuration.getChild("output-dir").getValue());
    this.writeToDevNull = configuration.getChild("devnull").getValueAsBoolean(false);
    Configuration tasks = configuration.getChild("tasks");
    this.repeat = tasks.getAttributeAsInteger("repeat", 1);
    Configuration[] entries = tasks.getChildren("task");
    for (int i = 0; i < entries.length; i++) {
        this.taskList.add(new TaskDef(entries[i]));
    }
    this.fopCfg = configuration.getChild("processor");
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:14,代码来源:FOPTestbed.java

示例8: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
 */
public void configure(Configuration cfg) throws ConfigurationException {
    //Module width (MUST ALWAYS BE FIRST BECAUSE QUIET ZONE MAY DEPEND ON IT)
    Length mw = new Length(cfg.getChild("module-width").getValue("0.21mm"), "mm");
    getEAN128Bean().setModuleWidth(mw.getValueAsMillimeter());

    super.configure(cfg);
    
    //Checksum mode        
    getEAN128Bean().setChecksumMode(ChecksumMode.byName(
        cfg.getChild("checksum").getValue(ChecksumMode.CP_AUTO.getName())));
    //Checkdigit place holder
    getEAN128Bean().setCheckDigitMarker(getFirstChar(
            cfg.getChild("check-digit-marker").getValue("\u00f0")));
    //Template
    getEAN128Bean().setTemplate(cfg.getChild("template").getValue(""));
    //group seperator aka FNC_1 
    getEAN128Bean().setGroupSeparator(getFirstChar(
            cfg.getChild("group-separator").getValue("\u00f1")));

    Configuration hr = cfg.getChild("human-readable", false);
    if (hr != null) {
        //omit Brackets for AI
        getEAN128Bean().setOmitBrackets(
                hr.getChild("omit-brackets").getValueAsBoolean(false));
    }
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:30,代码来源:EAN128.java

示例9: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
 */
public void configure(Configuration cfg) throws ConfigurationException {
    //Module width (MUST ALWAYS BE FIRST BECAUSE QUIET ZONE MAY DEPEND ON IT)
    Length mw = new Length(cfg.getChild("module-width").getValue("0.19mm"), "mm");
    getCode39Bean().setModuleWidth(mw.getValueAsMillimeter());

    super.configure(cfg);

    //Checksum mode    
    getCode39Bean().setChecksumMode(ChecksumMode.byName(
        cfg.getChild("checksum").getValue(ChecksumMode.CP_AUTO.getName())));

    //Wide factor    
    getCode39Bean().setWideFactor(
        cfg.getChild("wide-factor").getValueAsFloat((float)Code39Bean.DEFAULT_WIDE_FACTOR));

    //Inter-character gap width    
    Length igw = new Length(cfg.getChild("interchar-gap-width").getValue("1mw"), "mw");
    if (igw.getUnit().equalsIgnoreCase("mw")) {
        getCode39Bean().setIntercharGapWidth(
                igw.getValue() * getCode39Bean().getModuleWidth());
    } else {
        getCode39Bean().setIntercharGapWidth(igw.getValueAsMillimeter());
    }
    
    if (cfg.getChild("extended-charset", false) != null) {
        getCode39Bean().setExtendedCharSetEnabled(
                cfg.getChild("extended-charset").getValueAsBoolean());
    }
    
    Configuration hr = cfg.getChild("human-readable", false);
    if (hr != null) {
        //Display start/stop character and checksum in hr-message or not
        getCode39Bean().setDisplayStartStop(
                hr.getChild("display-start-stop").getValueAsBoolean(false));
        getCode39Bean().setDisplayChecksum(
                hr.getChild("display-checksum").getValueAsBoolean(false));
    }
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:42,代码来源:Code39.java

示例10: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/** {@inheritDoc} */
public void configure(Configuration cfg) throws ConfigurationException {
    //Module width (MUST ALWAYS BE FIRST BECAUSE QUIET ZONE MAY DEPEND ON IT)
    Length mw = new Length(cfg.getChild("module-width").getValue(
            POSTNETBean.DEFAULT_MODULE_WIDTH + Length.INCH), Length.MM);
    getPOSTNETBean().setModuleWidth(mw.getValueAsMillimeter());

    super.configure(cfg);

    //Checksum mode    
    getPOSTNETBean().setChecksumMode(ChecksumMode.byName(
        cfg.getChild("checksum").getValue(ChecksumMode.CP_AUTO.getName())));

    //Inter-character gap width    
    Length igw = new Length(cfg.getChild("interchar-gap-width").getValue(
            POSTNETBean.DEFAULT_MODULE_WIDTH + Length.INCH), Length.MM);
    getPOSTNETBean().setIntercharGapWidth(igw.getValueAsMillimeter());

    Length h = new Length(cfg.getChild("tall-bar-height").getValue(
            POSTNETBean.DEFAULT_TALL_BAR_HEIGHT + Length.INCH), Length.MM);
    getPOSTNETBean().setBarHeight(h.getValueAsMillimeter());
    
    Length hbh = new Length(cfg.getChild("short-bar-height").getValue(
            POSTNETBean.DEFAULT_SHORT_BAR_HEIGHT + Length.INCH), Length.MM);
    getPOSTNETBean().setShortBarHeight(hbh.getValueAsMillimeter());

    getPOSTNETBean().setBaselinePosition(BaselineAlignment.byName(
        cfg.getChild("baseline-alignment").getValue(BaselineAlignment.ALIGN_BOTTOM.getName())));

    Configuration hr = cfg.getChild("human-readable", false);
    if (hr != null) {
        //Display checksum in hr-message or not
        getPOSTNETBean().setDisplayChecksum(
                hr.getChild("display-checksum").getValueAsBoolean(false));
    }
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:37,代码来源:POSTNET.java

示例11: checkCfgTree

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
private void checkCfgTree(final Configuration cfg) throws Exception {
    assertNotNull(cfg);
    assertEquals("root", cfg.getName());
    assertEquals("value", cfg.getAttribute("name"));
    assertNull(cfg.getValue(null));
    Configuration childcfg = cfg.getChild("child");
    assertNotNull(childcfg);
    assertEquals("child", childcfg.getName());
    assertEquals("bar", childcfg.getAttribute("foo"));
    assertEquals("hello", childcfg.getValue());
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:12,代码来源:ConfigurationUtilTestCase.java

示例12: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Initializes font info settings from the user configuration
 * 
 * @param fontInfoList a font info list
 * @throws FOPException if an exception occurs while processing the configuration
 */
public void configure(List<EmbedFontInfo> fontInfoList) throws FOPException {
	Configuration fontsCfg = cfg.getChild("fonts", false);
	if (fontsCfg != null) {
		long start = 0;
		if (log.isDebugEnabled()) {
			log.debug("Starting font configuration...");
			start = System.currentTimeMillis();
		}

		FontAdder fontAdder = new FontAdder(fontManager, fontResolver, listener);

		// native o/s search (autodetect) configuration
		boolean autodetectFonts = (fontsCfg.getChild("auto-detect", false) != null);
		if (autodetectFonts) {
			FontDetector fontDetector = new FontDetector(fontManager, fontAdder, strict, listener);
			fontDetector.detect(fontInfoList);
		}

		// Add configured directories to FontInfo list
		addDirectories(fontsCfg, fontAdder, fontInfoList);

		// Add fonts from configuration to FontInfo list
		addFonts(fontsCfg, fontManager.getFontCache(), fontInfoList);

		// Update referenced fonts (fonts which are not to be embedded)
		fontManager.updateReferencedFonts(fontInfoList);

		// Renderer-specific referenced fonts
		Configuration referencedFontsCfg = fontsCfg.getChild("referenced-fonts", false);
		if (referencedFontsCfg != null) {
			FontTriplet.Matcher matcher = FontManagerConfigurator.createFontsMatcher(referencedFontsCfg, strict);
			fontManager.updateReferencedFonts(fontInfoList, matcher);
		}

		// Update font cache if it has changed
		fontManager.saveCache();

		if (log.isDebugEnabled()) {
			log.debug("Finished font configuration in " + (System.currentTimeMillis() - start) + "ms");
		}
	}
}
 
开发者ID:hongliangpan,项目名称:manydesigns.cn,代码行数:49,代码来源:FontInfoConfigurator.java

示例13: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Initializes font info settings from the user configuration
 * @param fontInfoList a font info list
 * @throws FOPException if an exception occurs while processing the configuration
 */
public void configure(List<EmbedFontInfo> fontInfoList)
        throws FOPException {
    Configuration fontsCfg = cfg.getChild("fonts", false);
    if (fontsCfg != null) {
        long start = 0;
        if (log.isDebugEnabled()) {
            log.debug("Starting font configuration...");
            start = System.currentTimeMillis();
        }

        FontAdder fontAdder = new FontAdder(fontManager, fontResolver, listener);

        // native o/s search (autodetect) configuration
        boolean autodetectFonts = (fontsCfg.getChild("auto-detect", false) != null);
        if (autodetectFonts) {
            FontDetector fontDetector = new FontDetector(fontManager, fontAdder, strict,
                    listener);
            fontDetector.detect(fontInfoList);
        }

        // Add configured directories to FontInfo list
        addDirectories(fontsCfg, fontAdder, fontInfoList);

        // Add fonts from configuration to FontInfo list
        addFonts(fontsCfg, fontManager.getFontCache(), fontInfoList);

        // Update referenced fonts (fonts which are not to be embedded)
        fontManager.updateReferencedFonts(fontInfoList);

        // Renderer-specific referenced fonts
        Configuration referencedFontsCfg = fontsCfg.getChild("referenced-fonts", false);
        if (referencedFontsCfg != null) {
            FontTriplet.Matcher matcher = FontManagerConfigurator.createFontsMatcher(
                    referencedFontsCfg, strict);
            fontManager.updateReferencedFonts(fontInfoList, matcher);
        }

        // Update font cache if it has changed
        fontManager.saveCache();

        if (log.isDebugEnabled()) {
            log.debug("Finished font configuration in "
                    + (System.currentTimeMillis() - start) + "ms");
        }
    }
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:52,代码来源:FontInfoConfigurator.java

示例14: buildFontListFromConfiguration

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * Builds a list of AFPFontInfo objects for use with the setup() method.
 *
 * @param cfg Configuration object
 * @param eventProducer for AFP font related events
 * @return List the newly created list of fonts
 * @throws ConfigurationException if something's wrong with the config data
 */
private List<AFPFontInfo> buildFontListFromConfiguration(Configuration cfg,
        AFPEventProducer eventProducer) throws FOPException, ConfigurationException {

    Configuration fonts = cfg.getChild("fonts");
    FontManager fontManager = this.userAgent.getFactory().getFontManager();

    // General matcher
    FontTriplet.Matcher referencedFontsMatcher = fontManager.getReferencedFontsMatcher();
    // Renderer-specific matcher
    FontTriplet.Matcher localMatcher = null;

    // Renderer-specific referenced fonts
    Configuration referencedFontsCfg = fonts.getChild("referenced-fonts", false);
    if (referencedFontsCfg != null) {
        localMatcher = FontManagerConfigurator.createFontsMatcher(
                referencedFontsCfg, this.userAgent.getFactory().validateUserConfigStrictly());
    }

    List<AFPFontInfo> fontList = new java.util.ArrayList<AFPFontInfo>();
    Configuration[] font = fonts.getChildren("font");
    final String fontPath = null;
    for (int i = 0; i < font.length; i++) {
        AFPFontInfo afi = buildFont(font[i], fontPath);
        if (afi != null) {
            if (log.isDebugEnabled()) {
                log.debug("Adding font " + afi.getAFPFont().getFontName());
            }
            List<FontTriplet> fontTriplets = afi.getFontTriplets();
            for (int j = 0; j < fontTriplets.size(); ++j) {
                FontTriplet triplet = fontTriplets.get(j);
                if (log.isDebugEnabled()) {
                    log.debug("  Font triplet "
                            + triplet.getName() + ", "
                            + triplet.getStyle() + ", "
                            + triplet.getWeight());
                }

                if ((referencedFontsMatcher != null && referencedFontsMatcher.matches(triplet))
                        || (localMatcher != null && localMatcher.matches(triplet))) {
                    afi.getAFPFont().setEmbeddable(false);
                    break;
                }
            }

            fontList.add(afi);
        }
    }
    return fontList;
}
 
开发者ID:pellcorp,项目名称:fop,代码行数:58,代码来源:AFPRendererConfigurator.java

示例15: configure

import org.apache.avalon.framework.configuration.Configuration; //导入方法依赖的package包/类
/**
 * @see org.apache.avalon.framework.configuration.Configurable#configure(Configuration)
 */
public void configure(Configuration cfg) throws ConfigurationException {
    //Module width (MUST ALWAYS BE FIRST BECAUSE QUIET ZONE MAY DEPEND ON IT)
    String mws = cfg.getChild("module-width").getValue(null);
    if (mws != null) {
        Length mw = new Length(mws, "mm");
        getPDF417Bean().setModuleWidth(mw.getValueAsMillimeter());
    }

    super.configure(cfg);

    Configuration child;
    child = cfg.getChild("min-columns", false);
    if (child != null) {
        getPDF417Bean().setMinCols(child.getValueAsInteger());
    }
    child = cfg.getChild("max-columns", false);
    if (child != null) {
        getPDF417Bean().setMaxCols(child.getValueAsInteger());
    }
    child = cfg.getChild("min-rows", false);
    if (child != null) {
        getPDF417Bean().setMinRows(child.getValueAsInteger());
    }
    child = cfg.getChild("max-rows", false);
    if (child != null) {
        getPDF417Bean().setMaxRows(child.getValueAsInteger());
    }
    
    //Setting "columns" will override min/max-columns and min/max-rows!!!
    child = cfg.getChild("columns", false);
    if (child != null) {
        getPDF417Bean().setColumns(child.getValueAsInteger());
    }
    
    getPDF417Bean().setErrorCorrectionLevel(cfg.getChild("ec-level").getValueAsInteger(
            PDF417Bean.DEFAULT_ERROR_CORRECTION_LEVEL));
    
    String rhs = cfg.getChild("row-height").getValue(null);
    if (rhs != null) {
        Length rh = new Length(rhs, "mw");
        if (rh.getUnit().equalsIgnoreCase("mw")) {
            getPDF417Bean().setRowHeight(rh.getValue() * getBean().getModuleWidth());
        } else {
            getPDF417Bean().setRowHeight(rh.getValueAsMillimeter());
        }
    } else {
        getPDF417Bean().setRowHeight(
                PDF417Bean.DEFAULT_X_TO_Y_FACTOR * getBean().getModuleWidth());
    }
    
    child = cfg.getChild("width-to-height-ratio", false);
    if (child != null) {
        getPDF417Bean().setWidthToHeightRatio(child.getValueAsFloat());
    }
}
 
开发者ID:thanakrit,项目名称:barcode4j,代码行数:59,代码来源:PDF417.java


注:本文中的org.apache.avalon.framework.configuration.Configuration.getChild方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。