⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 modelscreenwidget.java

📁 Sequoia ERP是一个真正的企业级开源ERP解决方案。它提供的模块包括:电子商务应用(e-commerce), POS系统(point of sales),知识管理,存货与仓库管理
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            // render sub-widgets            renderSubWidgetsString(this.subWidgets, writer, context, screenStringRenderer);        }        public String rawString() {            return "<decorator-section name=\"" + this.name + "\">";        }    }        public static class DecoratorSectionInclude extends ModelScreenWidget {        protected String name;                public DecoratorSectionInclude(ModelScreen modelScreen, Element decoratorSectionElement) {            super(modelScreen, decoratorSectionElement);            this.name = decoratorSectionElement.getAttribute("name");        }        public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {            SectionsRenderer sections = (SectionsRenderer) context.get("sections");            // for now if sections is null, just log a warning; may be permissible to make the screen for flexible            if (sections == null) {                Debug.logWarning("In decorator-section-include could not find sections object in the context, not rendering section with name [" + this.name + "]", module);            } else {                sections.render(this.name);            }        }        public String rawString() {            return "<decorator-section-include name=\"" + this.name + "\">";        }    }        public static class Label extends ModelScreenWidget {        protected FlexibleStringExpander textExdr;                protected FlexibleStringExpander idExdr;        protected FlexibleStringExpander styleExdr;                public Label(ModelScreen modelScreen, Element labelElement) {            super(modelScreen, labelElement);            // put the text attribute first, then the pcdata under the element, if both are there of course            String textAttr = UtilFormatOut.checkNull(labelElement.getAttribute("text"));            String pcdata = UtilFormatOut.checkNull(UtilXml.elementValue(labelElement));            this.textExdr = new FlexibleStringExpander(textAttr + pcdata);            this.idExdr = new FlexibleStringExpander(labelElement.getAttribute("id"));            this.styleExdr = new FlexibleStringExpander(labelElement.getAttribute("style"));        }        public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {            try {                screenStringRenderer.renderLabel(writer, context, this);            } catch (IOException e) {                String errMsg = "Error rendering label in screen named [" + this.modelScreen.getName() + "]: " + e.toString();                Debug.logError(e, errMsg, module);                throw new RuntimeException(errMsg);            }        }                public String getText(Map context) {            return this.textExdr.expandString(context);        }                public String getId(Map context) {            return this.idExdr.expandString(context);        }                public String getStyle(Map context) {            return this.styleExdr.expandString(context);        }                public String rawString() {            return "<label id=\"" + this.idExdr.getOriginal() + "\" style=\"" + this.styleExdr.getOriginal() + "\" text=\"" + this.textExdr.getOriginal() + "\"/>";        }    }    public static class Form extends ModelScreenWidget {        protected FlexibleStringExpander nameExdr;        protected FlexibleStringExpander locationExdr;        protected FlexibleStringExpander shareScopeExdr;                public Form(ModelScreen modelScreen, Element formElement) {            super(modelScreen, formElement);            this.nameExdr = new FlexibleStringExpander(formElement.getAttribute("name"));            this.locationExdr = new FlexibleStringExpander(formElement.getAttribute("location"));            this.shareScopeExdr = new FlexibleStringExpander(formElement.getAttribute("share-scope"));        }        public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) {            boolean protectScope = !shareScope(context);            if (protectScope) {                if (!(context instanceof MapStack)) {                    context = MapStack.create(context);                }                ((MapStack) context).push();            }                        String name = this.getName(context);            String location = this.getLocation(context);            ModelForm modelForm = null;            try {                modelForm = FormFactory.getFormFromLocation(this.getLocation(context), this.getName(context), this.modelScreen.getDelegator(context), this.modelScreen.getDispatcher(context));            } catch (IOException e) {                String errMsg = "Error rendering included form named [" + name + "] at location [" + location + "]: " + e.toString();                Debug.logError(e, errMsg, module);                throw new RuntimeException(errMsg);            } catch (SAXException e) {                String errMsg = "Error rendering included form named [" + name + "] at location [" + location + "]: " + e.toString();                Debug.logError(e, errMsg, module);                throw new RuntimeException(errMsg);            } catch (ParserConfigurationException e) {                String errMsg = "Error rendering included form named [" + name + "] at location [" + location + "]: " + e.toString();                Debug.logError(e, errMsg, module);                throw new RuntimeException(errMsg);            }                        // try finding the formStringRenderer by name in the context in case one was prepared and put there            FormStringRenderer formStringRenderer = (FormStringRenderer) context.get("formStringRenderer");            // if there was no formStringRenderer put in place, now try finding the request/response in the context and creating a new one            if (formStringRenderer == null) {                HttpServletRequest request = (HttpServletRequest) context.get("request");                HttpServletResponse response = (HttpServletResponse) context.get("response");                if (request != null && response != null) {                    formStringRenderer = new HtmlFormRenderer(request, response);                }            }            // still null, throw an error            if (formStringRenderer == null) {                throw new IllegalArgumentException("Could not find a formStringRenderer in the context, and could not find HTTP request/response objects need to create one.");            }                        //Debug.logInfo("before renderFormString, context:" + context, module);            StringBuffer renderBuffer = new StringBuffer();            modelForm.renderFormString(renderBuffer, context, formStringRenderer);            try {                writer.write(renderBuffer.toString());            } catch (IOException e) {                String errMsg = "Error rendering included form named [" + name + "] at location [" + location + "]: " + e.toString();                Debug.logError(e, errMsg, module);                throw new RuntimeException(errMsg);            }            if (protectScope) {                ((MapStack) context).pop();            }        }                public String getName(Map context) {            return this.nameExdr.expandString(context);        }                public String getLocation(Map context) {            return this.locationExdr.expandString(context);        }                public boolean shareScope(Map context) {            String shareScopeString = this.shareScopeExdr.expandString(context);            // defaults to false, so anything but true is false            return "true".equals(shareScopeString);        }        public String rawString() {            return "<include-form name=\"" + this.nameExdr.getOriginal() + "\" location=\"" + this.locationExdr.getOriginal() + "\" share-scope=\"" + this.shareScopeExdr.getOriginal() + "\"/>";        }    }    public static class Tree extends ModelScreenWidget {        protected FlexibleStringExpander nameExdr;        protected FlexibleStringExpander locationExdr;        protected FlexibleStringExpander shareScopeExdr;                public Tree(ModelScreen modelScreen, Element treeElement) {            super(modelScreen, treeElement);            this.nameExdr = new FlexibleStringExpander(treeElement.getAttribute("name"));            this.locationExdr = new FlexibleStringExpander(treeElement.getAttribute("location"));            this.shareScopeExdr = new FlexibleStringExpander(treeElement.getAttribute("share-scope"));        }        public void renderWidgetString(Writer writer, Map context, ScreenStringRenderer screenStringRenderer) throws GeneralException {            boolean protectScope = !shareScope(context);            if (protectScope) {                if (!(context instanceof MapStack)) {                    context = MapStack.create(context);                }                ((MapStack) context).push();            }                        String name = this.getName(context);            String location = this.getLocation(context);            ModelTree modelTree = null;            try {                modelTree = TreeFactory.getTreeFromLocation(this.getLocation(context), this.getName(context), this.modelScreen.getDelegator(context), this.modelScreen.getDispatcher(context));            } catch (IOException e) {                String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString();                Debug.logError(e, errMsg, module);                throw new RuntimeException(errMsg);            } catch (SAXException e) {                String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString();                Debug.logError(e, errMsg, module);                throw new RuntimeException(errMsg);            } catch (ParserConfigurationException e) {                String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString();                Debug.logError(e, errMsg, module);                throw new RuntimeException(errMsg);            }                        // try finding the treeStringRenderer by name in the context in case one was prepared and put there            TreeStringRenderer treeStringRenderer = (TreeStringRenderer) context.get("treeStringRenderer");            // if there was no treeStringRenderer put in place, now try finding the request/response in the context and creating a new one            if (treeStringRenderer == null) {                treeStringRenderer = new HtmlTreeRenderer();                /*                String renderClassStyle = modelTree.getRenderStyle();                if (UtilValidate.isNotEmpty(renderClassStyle) && renderClassStyle.equals("simple"))                     treeStringRenderer = new HtmlTreeRenderer();                else                    treeStringRenderer = new HtmlTreeExpandCollapseRenderer();                */             }            // still null, throw an error            if (treeStringRenderer == null) {                throw new IllegalArgumentException("Could not find a treeStringRenderer in the context, and could not find HTTP request/response objects need to create one.");            }                        StringBuffer renderBuffer = new StringBuffer();            modelTree.renderTreeString(renderBuffer, context, treeStringRenderer);            try {                writer.write(renderBuffer.toString());            } catch (IOException e) {                String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString();                Debug.logError(e, errMsg, module);                throw new RuntimeException(errMsg);            }            if (protectScope) {                ((MapStack) context).pop();            }        }                public String getName(Map context) {            return this.nameExdr.expandString(context);        }                public String getLocation(Map context) {            return this.locationExdr.expandString(context);        }                public boolean shareScope(Map context) {            String shareScopeString = this.shareScopeExdr.expandString(context);            // defaults to false, so anything but true is false            return "true".equals(shareScopeString);        }        public String rawString() {            return "<include-tree name=\"" + this.nameExdr.getOriginal() + "\" location=\"" + this.locationExdr.getOriginal() + "\" share-scope=\"" + this.shareScopeExdr.getOriginal() + "\"/>";        }    }    public static class PlatformSpecific extends ModelScreenWidget {        protected ModelScreenWidget subWidget;                public PlatformSpecific(ModelScreen modelScreen, Element platformSpecificElement) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -