Package org.criticalfailure.torchlight.core.domain.entity.object

Examples of org.criticalfailure.torchlight.core.domain.entity.object.ObjectProperty


    public ObjectProperty translateFrom(ObjectPropertySO so, ICampaignStorageManager csm)
            throws StorageObjectTranslationException {

        logger.debug("translate from: " + so);

        ObjectProperty op = objectPropertyFactory.createObjectProperty(null, true);
        logger.trace("op: " + op);

        translateFromWithMerge(so, op, csm);

        return op;
View Full Code Here


        logger.info("Executing 'clone object property' action: " + event);

        int sequence = 1;

        if(selectedObject != null) {
            ObjectProperty op = objectPropertyFactory.createObjectProperty(selectedObject);
            logger.trace("op: " + op);

            // give the property a name that isn't being used
            String proposedName = "";
            boolean inUse = false;
            do {
                proposedName = selectedObject.getName() + "-" + sequence;
                logger.trace("proposedName: " + proposedName);

                inUse = false;
                for(ObjectProperty prop : objectTemplate.getProperties()) {
                    logger.trace("prop: " + prop);
                    if(proposedName.equals(prop.getName())) {
                        logger.debug("name is in use: " + proposedName);
                        inUse = true;
                        break;
                    }
                }

                logger.debug("increment sequence");
                sequence++;
            } while(inUse);

            op.setName(proposedName);

            objectTemplate.addProperty(op);
            op.setObjectTemplate(objectTemplate);

            try {
                objectTemplate.save();
            }
            catch(Exception e) {
View Full Code Here

                    case 2: // formatted value
                        return null;

                    case 3: // validator
                    {
                        ObjectProperty op = ((ObjectData)element).getObjectProperty();
                        logger.trace("op: " + op);

                        if(op != null) {
                            if(StringUtils.stripToNull(op.getValidatorType()) != null) {
                                logger.debug("there is a validator");

                                String s = StringUtils.stripToNull(dataNotes.get(element));
                                logger.trace("s: " + s);
                                if(s != null) {
                                    return validatorWarnImage;
                                }

                                return objectPropertyValidatorImage;
                            }
                        }

                        return null;
                    }

                    case 4: // calculator
                    {
                        ObjectProperty op = ((ObjectData)element).getObjectProperty();
                        logger.trace("op: " + op);

                        if(op != null) {
                            if(StringUtils.stripToNull(op.getCalculatorType()) != null) {
                                return objectPropertyCalculatorImage;
                            }
                        }

                        return null;
View Full Code Here

                    case 1: // value
                        return ((ObjectData)element).getStringValue();

                    case 2: // formatted value
                    {
                        ObjectProperty op = ((ObjectData)element).getObjectProperty();
                        logger.trace("op: " + op);

                        if(op != null) {
                            try {
                                return formatterHelper.format(op, (ObjectData)element);
                            }
                            catch(ObjectPropertyFormatterException e) {
                                logger.error("Exception caught while executing formatter: " + e.getLocalizedMessage(),
                                        e);

                                alertService.addAlert(new Alert(Alert.Type.ERROR, this.getClass().getSimpleName(), e
                                        .getLocalizedMessage()));
                            }
                        }

                        return null;
                    }

                    case 3: // validator
                    {
                        ObjectProperty op = ((ObjectData)element).getObjectProperty();
                        logger.trace("op: " + op);

                        if(op != null) {
                            String v = op.getValidatorType();
                            logger.trace("v: " + v);

                            if(v != null) {
                                return v;
                            }
                        }

                        return Messages
                                .getString("object.instance.editor.property_list.table.column.validator.none.label");
                    }

                    case 4: // calculator
                    {
                        ObjectProperty op = ((ObjectData)element).getObjectProperty();
                        logger.trace("op: " + op);

                        if(op != null) {
                            String v = op.getCalculatorType();
                            logger.trace("v: " + v);

                            if(v != null) {
                                return v;
                            }
View Full Code Here

         */
        public Font getFont(Object element) {
            logger.debug("get font: " + element);

            if(element instanceof ObjectData) {
                ObjectProperty op = ((ObjectData)element).getObjectProperty();
                logger.trace("op: " + op);

                if(op == null) {
                    // italicize the font if there is no corresponding property for it
                    return JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT);
View Full Code Here

         */
        public Color getBackground(Object element) {

            if(element instanceof ObjectProperty) {
                if(StringUtils.stripToNull(searchString) != null) {
                    ObjectProperty op = (ObjectProperty)element;
                    logger.trace("op: " + op);

                    if(StringUtils.containsIgnoreCase(op.getName(), searchString)) {
                        return Display.getCurrent().getSystemColor(SWT.COLOR_GRAY);
                    }
                }
            }
            return null;
View Full Code Here

    public ObjectPropertyValidationResult validate(ObjectInstance instance, ObjectData datum, String proposedValue)
            throws ObjectPropertyValidationException {

        logger.info("Performing validation on object datum: " + datum + "; proposed-value: " + proposedValue);

        ObjectProperty op = datum.getObjectProperty();
        logger.trace("op: " + op);

        if(op != null) {
            String validatorType = StringUtils.stripToNull(op.getValidatorType());
            logger.trace("validatorType: " + validatorType);

            if(validatorType != null) {
                IObjectPropertyValidator validator = objectPropertyValidatorListener.getValidator(validatorType);
                logger.trace("validator: " + validator);
View Full Code Here

            if((part instanceof ObjectInstanceEditor) && (obj instanceof ObjectData)) {
                logger.debug("selection is what we're interested in; enable");
                selectedObject = (ObjectData)obj;

                // check if it's calculated
                ObjectProperty op = selectedObject.getObjectProperty();
                logger.trace("op: " + op);

                if(op != null) {
                    if(StringUtils.stripToNull(op.getCalculatorType()) != null) {
                        logger.debug("associated object property has a calculator");
                        setEnabled(true);
                        return;
                    }
                }
View Full Code Here

        ObjectData datum = objectInstance.getData().get(objectDataName);
        logger.trace("datum: " + datum);

        try {
            ObjectProperty op = datum.getObjectProperty();
            logger.trace("op: " + op);

            if(datum == null) {
                if(op == null) {
                    op = objectPropertyFactory.createObjectProperty(objectInstance.getCampaign(), true);
                    logger.trace("op: " + op);

                    op.setName(objectDataName);
                    op.setObjectTemplate(objectInstance.getObjectTemplate());
                    objectInstance.getObjectTemplate().addProperty(op);

                    objectInstance.getObjectTemplate().save();
                }
View Full Code Here

        // if the dialog didn't populate the template with properties, create some defaults
        if(template.getProperties().isEmpty()) {
            logger.info("Creating default properties for object template: " + template);

            // label property
            ObjectProperty op = objectPropertyFactory.createObjectProperty(template.getCampaign(), false);
            op.setName("name");

            template.addProperty(op);
            template.setLabelProperty(op.getName());
        }

        return true;
    }
View Full Code Here

TOP

Related Classes of org.criticalfailure.torchlight.core.domain.entity.object.ObjectProperty

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.