Package org.ofbiz.base.util.string

Examples of org.ofbiz.base.util.string.FlexibleStringExpander


    }

    public void renderFieldGroupOpen(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) throws IOException {
        String style = fieldGroup.getStyle();
        String id = fieldGroup.getId();
        FlexibleStringExpander titleNotExpanded = FlexibleStringExpander.getInstance(fieldGroup.getTitle());
        String title = titleNotExpanded.expandString(context);
        Boolean collapsed = fieldGroup.initiallyCollapsed();
        String collapsibleAreaId = fieldGroup.getId() + "_body";

        if (UtilValidate.isNotEmpty(style) || UtilValidate.isNotEmpty(id) || UtilValidate.isNotEmpty(title)) {
View Full Code Here


     * @param titleText
     */
    public void renderHyperlinkTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) throws IOException {
        if (UtilValidate.isNotEmpty(modelFormField.getHeaderLink())) {
            StringBuilder targetBuffer = new StringBuilder();
            FlexibleStringExpander target = FlexibleStringExpander.getInstance(modelFormField.getHeaderLink());
            String fullTarget = target.expandString(context);
            targetBuffer.append(fullTarget);
            String targetType = HyperlinkField.DEFAULT_TARGET_TYPE;
            if (UtilValidate.isNotEmpty(targetBuffer.toString()) && targetBuffer.toString().toLowerCase().startsWith("javascript:")) {
                targetType="plain";
            }
View Full Code Here

            result.put("contentFrameId", contentId);
            result.put("contentId", (String) context.get("contentId"));
            result.put("dataResourceId", (String) context.get("dataResourceId"));
           
            // File to use for original image
            FlexibleStringExpander filenameExpander = FlexibleStringExpander.getInstance(imageFilenameFormat);
            String fileLocation = filenameExpander.expandString(UtilMisc.toMap("location", "products", "type", sizeType, "id", contentId));
            String filenameToUse = fileLocation;
            if (fileLocation.lastIndexOf("/") != -1) {
                filenameToUse = fileLocation.substring(fileLocation.lastIndexOf("/") + 1);
            }
           
View Full Code Here

    public static boolean checkWhen(Map context, String whenStr) {

        boolean isWhen = true; //opposite default from checkReturnWhen
        if (UtilValidate.isNotEmpty(whenStr)) {
            FlexibleStringExpander fse = FlexibleStringExpander.getInstance(whenStr);
            String newWhen = fse.expandString(context);
            //if (Debug.infoOn()) Debug.logInfo("newWhen:" + newWhen,null);
            //if (Debug.infoOn()) Debug.logInfo("context:" + context,null);
            try {
                Boolean isWhenObj = (Boolean) BshUtil.eval(newWhen, context);
                isWhen = isWhenObj.booleanValue();
View Full Code Here

    }

    public static boolean checkReturnWhen(Map<String, Object> context, String whenStr) {
        boolean isWhen = false; //opposite default from checkWhen
        if (UtilValidate.isNotEmpty(whenStr)) {
            FlexibleStringExpander fse = FlexibleStringExpander.getInstance(whenStr);
            String newWhen = fse.expandString(context);
            try {
                Boolean isWhenObj = (Boolean) BshUtil.eval(newWhen, context);
                isWhen = isWhenObj.booleanValue();
            } catch (EvalError e) {
                Debug.logError("Error in evaluating :" + whenStr + " : " + e.getMessage(), null);
View Full Code Here

    public void eval(Map<String, Object> context) {
        if (fieldName != null) {
            // try to expand the envName
            if (UtilValidate.isEmpty(value)) {
                if (UtilValidate.isNotEmpty(envName) && envName.startsWith("${")) {
                    FlexibleStringExpander exp = new FlexibleStringExpander(envName);
                    String s = exp.expandString(context);
                    if (UtilValidate.isNotEmpty(s)) {
                        value = s;
                    }
                    Debug.log("Expanded String: " + s, module);
                }
View Full Code Here

        public FlexibleStringExpander rightText;
        public FlexibleStringExpander rightTextStyle;
       
        public Banner(Element sortOrderElement, ModelForm modelForm) {
            this.modelForm = modelForm;
            this.style = new FlexibleStringExpander(sortOrderElement.getAttribute("style"));
            this.text = new FlexibleStringExpander(sortOrderElement.getAttribute("text"));
            this.textStyle = new FlexibleStringExpander(sortOrderElement.getAttribute("text-style"));
            this.leftText = new FlexibleStringExpander(sortOrderElement.getAttribute("left-text"));
            this.leftTextStyle = new FlexibleStringExpander(sortOrderElement.getAttribute("left-text-style"));
            this.rightText = new FlexibleStringExpander(sortOrderElement.getAttribute("right-text"));
            this.rightTextStyle = new FlexibleStringExpander(sortOrderElement.getAttribute("right-text-style"));
        }
View Full Code Here

    protected FlexibleStringExpander passStyleExdr;
    protected FlexibleStringExpander failStyleExdr;

    public ModelMenuCondition(ModelMenuItem modelMenuItem, Element conditionElement) {
        this.modelMenuItem = modelMenuItem;
        this.passStyleExdr = new FlexibleStringExpander(conditionElement.getAttribute("pass-style"));
        this.failStyleExdr = new FlexibleStringExpander(conditionElement.getAttribute("disabled-style"));
        Element firstChildElement = UtilXml.firstChildElement(conditionElement);
        this.rootCondition = readCondition(modelMenuItem, firstChildElement);
    }
View Full Code Here

        protected FlexibleStringExpander actionExdr;
        protected FlexibleStringExpander resExdr;

        public IfServicePermission(ModelMenuItem modelMenuItem, Element condElement) {
            super(modelMenuItem, condElement);
            this.serviceExdr = new FlexibleStringExpander(condElement.getAttribute("service-name"));
            this.actionExdr = new FlexibleStringExpander(condElement.getAttribute("main-action"));
            this.resExdr = new FlexibleStringExpander(condElement.getAttribute("resource-description"));           
        }
View Full Code Here

        protected FlexibleStringExpander permissionExdr;
        protected FlexibleStringExpander actionExdr;
       
        public IfHasPermission(ModelMenuItem modelMenuItem, Element condElement) {
            super (modelMenuItem, condElement);
            this.permissionExdr = new FlexibleStringExpander(condElement.getAttribute("permission"));
            this.actionExdr = new FlexibleStringExpander(condElement.getAttribute("action"));
        }
View Full Code Here

TOP

Related Classes of org.ofbiz.base.util.string.FlexibleStringExpander

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.