Package org.apache.isis.core.commons.config

Examples of org.apache.isis.core.commons.config.IsisConfiguration


    protected String table;
    protected List<FieldMapping> fieldMappings = new ArrayList<FieldMapping>();
    protected Map<ObjectAssociation, FieldMapping> fieldMappingLookup = new HashMap<ObjectAssociation, FieldMapping>();

    private void setUpFieldMappers(final FieldMappingLookup lookup, final ObjectMappingLookup objectMapperLookup, final String className, final String parameterBase) {
        final IsisConfiguration configParameters = IsisContext.getConfiguration();
        table = configParameters.getString(parameterBase + ".table." + className);
        if (table == null) {
            final String name = getTableNameFromSpecification(specification);
            table = name;
        } else {
            table = Sql.tableIdentifier(table);
        }

        dbCreatesId = configParameters.getBoolean(parameterBase + "db-ids", false);
        if (configParameters.getBoolean(parameterBase + "all-fields", true)) {
            setupFullMapping(lookup, objectMapperLookup, className, configParameters, parameterBase);
        } else {
            // setupSpecifiedMapping(specification, configParameters,
            // parameterBase);
        }
View Full Code Here


        final ObjectAssociation[] oneToOneProperties = new ObjectAssociation[simpleFieldCount];
        final ObjectAssociation[] oneToManyProperties = new ObjectAssociation[collectionFieldCount];
        collectionMappers = new CollectionMapper[collectionFieldCount];
        collectionMapperFields = new String[collectionFieldCount];
        final IsisConfiguration subset = IsisContext.getConfiguration().createSubset(parameterBase + ".mapper.");

        for (int i = 0, simpleFieldNo = 0, collectionFieldNo = 0; i < fields.size(); i++) {
            final ObjectAssociation field = fields.get(i);
            if (field.isNotPersisted()) {
                continue;
            } else if (field.isOneToManyAssociation()) {
                oneToManyProperties[collectionFieldNo] = field;

                // TODO: Replace "new ForeignKeyCollectionMapper" with a factory
                // method(?) to allow a different
                // default CollectionMapper

                // TODO: I think the default order should be changed - and I
                // think I (KAM) have dropped support for the
                // original "association-table" implementation. This means the
                // current checks are misleading.
                final String type = subset.getString(field.getId());
                if (type == null || type.equals("association-table")) {
                    // collectionMappers[collectionFieldNo] = new
                    // AutoCollectionMapper(specification,
                    // oneToManyProperties[collectionFieldNo], lookup);
                    // collectionMappers[collectionFieldNo] = new
View Full Code Here

public abstract class AbstractFieldMappingFactory implements FieldMappingFactory {

    protected String getTypeOverride(final ObjectSpecification object, final ObjectAssociation field, final String type) {
        // isis.persistor.sql.automapper.default
        final IsisConfiguration configParameters = IsisContext.getConfiguration();
        final String find = object.getShortIdentifier() + "." + field.getId();
        final String property = SqlObjectStore.BASE_NAME + ".automapper.type." + find;
        final String dataType = configParameters.getString(property, type);
        return dataType;
    }
View Full Code Here

        final String useVersioningProperty = getStringProperty(propertiesBase, isisConfiguration, "versioning", "true");
        final int isTrue = useVersioningProperty.compareToIgnoreCase("true");
        useVersioning(isTrue == 0);

        final String BASE_DATATYPE = propertiesBase + ".datatypes.";
        final IsisConfiguration dataTypes = isisConfiguration.getProperties(BASE_DATATYPE);
        populateSqlDataTypes(dataTypes, BASE_DATATYPE);

    }
View Full Code Here

    public void init() {
        fieldMappingLookup.init();

        final String prefix = SqlObjectStore.BASE_NAME + ".mapper.";
        final IsisConfiguration subset = IsisContext.getConfiguration().createSubset(prefix);
        for (final String className : subset) {
            final String value = subset.getString(className);

            if (value.startsWith("auto.")) {
                final String propertiesBase = SqlObjectStore.BASE_NAME + ".automapper." + value.substring(5) + ".";
                add(className, objectMappingFactory.createMapper(className, propertiesBase, fieldMappingLookup, this));
            } else if (value.trim().equals("auto")) {
View Full Code Here

    private int maxCharWidth;
    private final FontMetrics metrics;
    private final String propertyName;

    protected AwtText(final String propertyName, final String defaultFont) {
        final IsisConfiguration cfg = IsisContext.getConfiguration();
        font = cfg.getFont(FONT_PROPERTY_STEM + propertyName, Font.decode(defaultFont));
        LOG.info("font " + propertyName + " loaded as " + font);

        this.propertyName = propertyName;

        if (font == null) {
            font = cfg.getFont(FONT_PROPERTY_STEM + ColorsAndFonts.TEXT_DEFAULT, new Font("SansSerif", Font.PLAIN, 12));
        }

        metrics = fontMetricsComponent.getFontMetrics(font);

        maxCharWidth = metrics.getMaxAdvance() + 1;
        if (maxCharWidth == 0) {
            maxCharWidth = (charWidth('X') + 3);
        }

        lineSpacing = cfg.getInteger(SPACING_PROPERTYSTEM + propertyName, 0);

        ascentAdjust = cfg.getBoolean(ASCENT_ADJUST, false);

        LOG.debug("font " + propertyName + " height=" + metrics.getHeight() + ", leading=" + metrics.getLeading() + ", ascent=" + metrics.getAscent() + ", descent=" + metrics.getDescent() + ", line spacing=" + lineSpacing);
    }
View Full Code Here

    public String toString() {
        return font.toString();
    }

    public static String defaultFontFamily() {
        final IsisConfiguration cfg = IsisContext.getConfiguration();
        return cfg.getString(FONT_PROPERTY_STEM + "family", "SansSerif");
    }
View Full Code Here

        final IsisConfiguration cfg = IsisContext.getConfiguration();
        return cfg.getString(FONT_PROPERTY_STEM + "family", "SansSerif");
    }

    public static int defaultFontSizeSmall() {
        final IsisConfiguration cfg = IsisContext.getConfiguration();
        return cfg.getInteger(FONT_PROPERTY_STEM + "size.small", 10);
    }
View Full Code Here

        final IsisConfiguration cfg = IsisContext.getConfiguration();
        return cfg.getInteger(FONT_PROPERTY_STEM + "size.small", 10);
    }

    public static int defaultFontSizeMedium() {
        final IsisConfiguration cfg = IsisContext.getConfiguration();
        return cfg.getInteger(FONT_PROPERTY_STEM + "size.medium", 11);
    }
View Full Code Here

        final IsisConfiguration cfg = IsisContext.getConfiguration();
        return cfg.getInteger(FONT_PROPERTY_STEM + "size.medium", 11);
    }

    public static int defaultFontSizeLarge() {
        final IsisConfiguration cfg = IsisContext.getConfiguration();
        return cfg.getInteger(FONT_PROPERTY_STEM + "size.large", 12);
    }
View Full Code Here

TOP

Related Classes of org.apache.isis.core.commons.config.IsisConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.