Author: jacopoc
Date: Fri Mar 20 08:21:11 2009 New Revision: 756369 URL: http://svn.apache.org/viewvc?rev=756369&view=rev Log: This is a work in progress for a refactoring of the various screen and form widget renderers; the new renderer will create output by calling Fremarker macros defined in external (configurable) files; the work is still not complete, and for this reason it is not enabled yet. Part of task OFBIZ-1235 Added: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java (with props) ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (with props) ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java (with props) ofbiz/trunk/framework/widget/templates/ ofbiz/trunk/framework/widget/templates/foScreenMacroLibrary.ftl (with props) ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl (with props) ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl (with props) ofbiz/trunk/framework/widget/templates/textScreenMacroLibrary.ftl (with props) ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl (with props) ofbiz/trunk/framework/widget/templates/xmlScreenMacroLibrary.ftl (with props) Modified: ofbiz/trunk/framework/widget/config/widget.properties Modified: ofbiz/trunk/framework/widget/config/widget.properties URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/config/widget.properties?rev=756369&r1=756368&r2=756369&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/config/widget.properties (original) +++ ofbiz/trunk/framework/widget/config/widget.properties Fri Mar 20 08:21:11 2009 @@ -31,3 +31,20 @@ # If set to N, the search result list will be empty when the Find screen # first appears. widget.defaultNoConditionFind=N + +# Configurations for the Widget View Handlers implemented using the MacroScreenViewHandler +# html output +screen.screenrenderer=component://widget/templates/htmlScreenMacroLibrary.ftl +screen.formrenderer=component://widget/templates/htmlFormMacroLibrary.ftl +screen.default.contenttype=UTF-8 +screen.default.encoding=none +# text output +screentext.screenrenderer=component://widget/templates/textScreenMacroLibrary.ftl +screentext.formrenderer=component://widget/templates/textFormMacroLibrary.ftl +screentext.default.contenttype=UTF-8 +screentext.default.encoding=none +# xml output +screenxml.screenrenderer=component://widget/templates/xmlScreenMacroLibrary.ftl +screenxml.formrenderer=component://widget/templates/xmlFormMacroLibrary.ftl +screenxml.default.contenttype=UTF-8 +screenxml.default.encoding=none Added: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java?rev=756369&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java (added) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java Fri Mar 20 08:21:11 2009 @@ -0,0 +1,334 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.widget.screen; + +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.ofbiz.base.location.FlexibleLocation; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.FileUtil; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.base.util.template.FreeMarkerWorker; +import org.ofbiz.widget.form.FormStringRenderer; +import org.ofbiz.widget.form.ModelForm; +import org.ofbiz.widget.form.ModelFormField; +import org.ofbiz.widget.form.ModelFormField.CheckField; +import org.ofbiz.widget.form.ModelFormField.DateFindField; +import org.ofbiz.widget.form.ModelFormField.DateTimeField; +import org.ofbiz.widget.form.ModelFormField.DisplayField; +import org.ofbiz.widget.form.ModelFormField.DropDownField; +import org.ofbiz.widget.form.ModelFormField.FileField; +import org.ofbiz.widget.form.ModelFormField.HiddenField; +import org.ofbiz.widget.form.ModelFormField.HyperlinkField; +import org.ofbiz.widget.form.ModelFormField.IgnoredField; +import org.ofbiz.widget.form.ModelFormField.ImageField; +import org.ofbiz.widget.form.ModelFormField.LookupField; +import org.ofbiz.widget.form.ModelFormField.PasswordField; +import org.ofbiz.widget.form.ModelFormField.RadioField; +import org.ofbiz.widget.form.ModelFormField.RangeFindField; +import org.ofbiz.widget.form.ModelFormField.ResetField; +import org.ofbiz.widget.form.ModelFormField.SubmitField; +import org.ofbiz.widget.form.ModelFormField.TextField; +import org.ofbiz.widget.form.ModelFormField.TextFindField; +import org.ofbiz.widget.form.ModelFormField.TextareaField; + +import freemarker.core.Environment; +import freemarker.template.Template; +import freemarker.template.TemplateException; + + +/** + * Widget Library - Csv Form Renderer implementation + * + */ +public class MacroFormRenderer implements FormStringRenderer { + + public static final String module = MacroFormRenderer.class.getName(); + private Template macroLibrary; + private Environment environment; + + public MacroFormRenderer(String macroLibraryPath, Appendable writer) throws TemplateException, IOException { + macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath); + Map<String, Object> input = UtilMisc.toMap("key", null); + environment = FreeMarkerWorker.renderTemplate(macroLibrary, input, writer); + } + + private void executeMacro(Appendable writer, String macro) throws IOException { + try { + Reader templateReader = new StringReader(macro); + // FIXME: I am using a Date as an hack to provide a unique name for the template... + Template template = new Template((new java.util.Date()).toString(), templateReader, FreeMarkerWorker.getDefaultOfbizConfig()); + templateReader.close(); + environment.include(template); + } catch (TemplateException e) { + Debug.logError(e, "Error rendering screen thru ftl", module); + } catch (IOException e) { + Debug.logError(e, "Error rendering screen thru ftl", module); + } + } + + private void appendWhitespace(Appendable writer) throws IOException { + // appending line ends for now, but this could be replaced with a simple space or something + writer.append("\r\n"); + //writer.append(' '); + } + + private void makeTextString(Appendable writer, String widgetStyle, String text) throws IOException { + // TODO: escape characters here + //writer.append(text); + StringWriter sr = new StringWriter(); + sr.append("<@renderField "); + sr.append("text=\""); + sr.append(text); + sr.append("\""); + sr.append(" />"); + executeMacro(writer, sr.toString()); + } + + public void renderDisplayField(Appendable writer, Map<String, Object> context, DisplayField displayField) throws IOException { + ModelFormField modelFormField = displayField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), displayField.getDescription(context)); + } + + public void renderHyperlinkField(Appendable writer, Map<String, Object> context, HyperlinkField hyperlinkField) throws IOException { + ModelFormField modelFormField = hyperlinkField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), hyperlinkField.getDescription(context)); + } + + public void renderTextField(Appendable writer, Map<String, Object> context, TextField textField) throws IOException { + ModelFormField modelFormField = textField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context))); + } + + public void renderTextareaField(Appendable writer, Map<String, Object> context, TextareaField textareaField) throws IOException { + ModelFormField modelFormField = textareaField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textareaField.getDefaultValue(context))); + } + + public void renderDateTimeField(Appendable writer, Map<String, Object> context, DateTimeField dateTimeField) throws IOException { + ModelFormField modelFormField = dateTimeField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateTimeField.getDefaultValue(context))); + } + + public void renderDropDownField(Appendable writer, Map<String, Object> context, DropDownField dropDownField) throws IOException { + ModelFormField modelFormField = dropDownField.getModelFormField(); + ModelForm modelForm = modelFormField.getModelForm(); + String currentValue = modelFormField.getEntry(context); + List allOptionValues = dropDownField.getAllOptionValues(context, modelForm.getDelegator(context)); + // if the current value should go first, display it + if (UtilValidate.isNotEmpty(currentValue) && "first-in-list".equals(dropDownField.getCurrent())) { + String explicitDescription = dropDownField.getCurrentDescription(context); + if (UtilValidate.isNotEmpty(explicitDescription)) { + this.makeTextString(writer, modelFormField.getWidgetStyle(), explicitDescription); + } else { + this.makeTextString(writer, modelFormField.getWidgetStyle(), ModelFormField.FieldInfoWithOptions.getDescriptionForOptionKey(currentValue, allOptionValues)); + } + } else { + Iterator optionValueIter = allOptionValues.iterator(); + while (optionValueIter.hasNext()) { + ModelFormField.OptionValue optionValue = (ModelFormField.OptionValue) optionValueIter.next(); + String noCurrentSelectedKey = dropDownField.getNoCurrentSelectedKey(context); + if ((UtilValidate.isNotEmpty(currentValue) && currentValue.equals(optionValue.getKey()) && "selected".equals(dropDownField.getCurrent())) || + (UtilValidate.isEmpty(currentValue) && noCurrentSelectedKey != null && noCurrentSelectedKey.equals(optionValue.getKey()))) { + this.makeTextString(writer, modelFormField.getWidgetStyle(), optionValue.getDescription()); + break; + } + } + } + } + + public void renderCheckField(Appendable writer, Map<String, Object> context, CheckField checkField) { + } + + public void renderRadioField(Appendable writer, Map<String, Object> context, RadioField radioField) { + } + + public void renderSubmitField(Appendable writer, Map<String, Object> context, SubmitField submitField) { + } + + public void renderResetField(Appendable writer, Map<String, Object> context, ResetField resetField) { + } + + public void renderHiddenField(Appendable writer, Map<String, Object> context, HiddenField hiddenField) { + } + + public void renderHiddenField(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String value) { + } + + public void renderIgnoredField(Appendable writer, Map<String, Object> context, IgnoredField ignoredField) { + } + + public void renderFieldTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { + this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getTitle(context)); + } + + public void renderSingleFormFieldTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) throws IOException { + renderFieldTitle(writer, context, modelFormField); + } + + public void renderFormOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderMultiFormClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatListWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatListWrapperClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatHeaderRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatHeaderRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + this.appendWhitespace(writer); + } + + public void renderFormatHeaderRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) { + } + + public void renderFormatHeaderRowCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) { + } + + public void renderFormatHeaderRowFormCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatHeaderRowFormCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatHeaderRowFormCellTitleSeparator(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, boolean isLast) { + } + + public void renderFormatItemRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatItemRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) throws IOException { + this.appendWhitespace(writer); + } + + public void renderFormatItemRowCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField, int positionSpan) { + } + + public void renderFormatItemRowCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm, ModelFormField modelFormField) { + } + + public void renderFormatItemRowFormCellOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatItemRowFormCellClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatSingleWrapperOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatSingleWrapperClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatFieldRowOpen(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatFieldRowClose(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFormatFieldRowTitleCellOpen(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) { + } + + public void renderFormatFieldRowTitleCellClose(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) { + } + + public void renderFormatFieldRowSpacerCell(Appendable writer, Map<String, Object> context, ModelFormField modelFormField) { + } + + public void renderFormatFieldRowWidgetCellOpen(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) { + } + + public void renderFormatFieldRowWidgetCellClose(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, int positions, int positionSpan, Integer nextPositionInRow) { + } + + public void renderFormatEmptySpace(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + // TODO + } + + public void renderTextFindField(Appendable writer, Map<String, Object> context, TextFindField textFindField) throws IOException { + ModelFormField modelFormField = textFindField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textFindField.getDefaultValue(context))); + } + + public void renderRangeFindField(Appendable writer, Map<String, Object> context, RangeFindField rangeFindField) throws IOException { + ModelFormField modelFormField = rangeFindField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, rangeFindField.getDefaultValue(context))); + } + + public void renderDateFindField(Appendable writer, Map<String, Object> context, DateFindField dateFindField) throws IOException { + ModelFormField modelFormField = dateFindField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, dateFindField.getDefaultValue(context))); + } + + public void renderLookupField(Appendable writer, Map<String, Object> context, LookupField lookupField) throws IOException { + ModelFormField modelFormField = lookupField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, lookupField.getDefaultValue(context))); + } + + public void renderNextPrev(Appendable writer, Map<String, Object> context, ModelForm modelForm) { + } + + public void renderFileField(Appendable writer, Map<String, Object> context, FileField textField) throws IOException { + ModelFormField modelFormField = textField.getModelFormField(); + this.makeTextString(writer, modelFormField.getWidgetStyle(), modelFormField.getEntry(context, textField.getDefaultValue(context))); + } + + public void renderPasswordField(Appendable writer, Map<String, Object> context, PasswordField passwordField) { + } + + public void renderImageField(Appendable writer, Map<String, Object> context, ImageField imageField) { + // TODO + } + + public void renderFieldGroupOpen(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) { + // TODO + } + + public void renderFieldGroupClose(Appendable writer, Map<String, Object> context, ModelForm.FieldGroup fieldGroup) { + // TODO + } + + public void renderBanner(Appendable writer, Map<String, Object> context, ModelForm.Banner banner) { + // TODO + } + + public void renderHyperlinkTitle(Appendable writer, Map<String, Object> context, ModelFormField modelFormField, String titleText) { + } +} Propchange: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroFormRenderer.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java?rev=756369&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java (added) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java Fri Mar 20 08:21:11 2009 @@ -0,0 +1,468 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.widget.screen; + +import java.io.File; +import java.io.IOException; +import java.io.Reader; +import java.io.StringReader; +import java.io.StringWriter; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; + +import javax.servlet.ServletContext; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.ofbiz.base.location.FlexibleLocation; +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.FileUtil; +import org.ofbiz.base.util.UtilGenerics; +import org.ofbiz.base.util.UtilHttp; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.base.util.template.FreeMarkerWorker; +import org.ofbiz.webapp.control.RequestHandler; +import org.ofbiz.widget.form.FormStringRenderer; +import org.ofbiz.widget.form.ModelForm; +import org.ofbiz.widget.html.HtmlFormRenderer; +import org.ofbiz.widget.html.HtmlScreenRenderer.ScreenletMenuRenderer; +import org.ofbiz.widget.menu.MenuStringRenderer; +import org.ofbiz.widget.screen.ModelScreenWidget; +import org.ofbiz.widget.screen.ScreenStringRenderer; + +import freemarker.core.Environment; +import freemarker.template.Template; +import freemarker.template.TemplateException; + +public class MacroScreenRenderer implements ScreenStringRenderer { + + public static final String module = MacroScreenRenderer.class.getName(); + private Template macroLibrary; + private Environment environment; + private int elementId = 999; + + public MacroScreenRenderer(String macroLibraryPath, Appendable writer) throws TemplateException, IOException { + macroLibrary = FreeMarkerWorker.getTemplate(macroLibraryPath); + Map<String, Object> input = UtilMisc.toMap("key", null); + environment = FreeMarkerWorker.renderTemplate(macroLibrary, input, writer); + } + + private String getNextElementId() { + elementId++; + return "hsr" + elementId; + } + + private void executeMacro(Appendable writer, String macro) throws IOException { + try { + Reader templateReader = new StringReader(macro); + // FIXME: I am using a Date as an hack to provide a unique name for the template... + Template template = new Template((new java.util.Date()).toString(), templateReader, FreeMarkerWorker.getDefaultOfbizConfig()); + templateReader.close(); + environment.include(template); + } catch (TemplateException e) { + Debug.logError(e, "Error rendering screen thru ftl", module); + } catch (IOException e) { + Debug.logError(e, "Error rendering screen thru ftl", module); + } + } + + public void renderSectionBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { + // TODO: not implemented FIXME + } + public void renderSectionEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Section section) throws IOException { + // TODO: not implemented FIXME + } + + public void renderContainerBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException { + String containerId = container.getId(context); + String autoUpdateTarget = container.getAutoUpdateTargetExdr(context); + HttpServletRequest request = (HttpServletRequest) context.get("request"); + String autoUpdateLink = null; + if (UtilValidate.isNotEmpty(autoUpdateTarget) && UtilHttp.isJavaScriptEnabled(request)) { + if (UtilValidate.isEmpty(containerId)) { + containerId = getNextElementId(); + } + HttpServletResponse response = (HttpServletResponse) context.get("response"); + ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); + RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); + autoUpdateLink = rh.makeLink(request, response, autoUpdateTarget); + } + StringWriter sr = new StringWriter(); + sr.append("<@renderContainerBegin "); + sr.append("containerId=\""); + sr.append(containerId); + sr.append("\" style=\""); + sr.append(container.getStyle(context)); + sr.append("\" autoUpdateLink=\""); + sr.append(autoUpdateLink); + sr.append("\" autoUpdateInterval=\""); + sr.append(container.getAutoUpdateInterval()); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + } + + public void renderContainerEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Container container) throws IOException { + StringWriter sr = new StringWriter(); + sr.append("<@renderContainerEnd/>"); + executeMacro(writer, sr.toString()); + } + + public void renderLabel(Appendable writer, Map<String, Object> context, ModelScreenWidget.Label label) throws IOException { + String labelText = label.getText(context); + String style = label.getStyle(context); + String id = label.getId(context); + StringWriter sr = new StringWriter(); + sr.append("<@renderLabel "); + sr.append("text=\""); + sr.append(label.getText(context)); + sr.append("\" id=\""); + sr.append(label.getId(context)); + sr.append("\" style=\""); + sr.append(label.getStyle(context)); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + } + + public void renderHorizontalSeparator(Appendable writer, Map<String, Object> context, ModelScreenWidget.HorizontalSeparator separator) throws IOException { + StringWriter sr = new StringWriter(); + sr.append("<@renderHorizontalSeparator "); + sr.append("id=\""); + sr.append(separator.getId(context)); + sr.append("\" style=\""); + sr.append(separator.getStyle(context)); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + } + + public void renderLink(Appendable writer, Map<String, Object> context, ModelScreenWidget.Link link) throws IOException { + // TODO: not implemented + } + + public void renderImage(Appendable writer, Map<String, Object> context, ModelScreenWidget.Image image) throws IOException { + // TODO: not implemented + } + + public void renderContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { + // TODO: not implemented + } + + public void renderContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { + // TODO: not implemented + } + + public void renderContentEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { + // TODO: not implemented + } + + public void renderContentFrame(Appendable writer, Map<String, Object> context, ModelScreenWidget.Content content) throws IOException { + // TODO: not implemented + } + + public void renderSubContentBegin(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { + // TODO: not implemented + } + + public void renderSubContentBody(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { + // TODO: not implemented + } + + public void renderSubContentEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.SubContent content) throws IOException { + // TODO: not implemented + } + + public void appendWhitespace(Appendable writer) throws IOException { + // appending line ends for now, but this could be replaced with a simple space or something + writer.append("\r\n"); + } + public void renderScreenletBegin(Appendable writer, Map<String, Object> context, boolean collapsed, ModelScreenWidget.Screenlet screenlet) throws IOException { + HttpServletRequest request = (HttpServletRequest) context.get("request"); + HttpServletResponse response = (HttpServletResponse) context.get("response"); + boolean javaScriptEnabled = UtilHttp.isJavaScriptEnabled(request); + ModelScreenWidget.Menu tabMenu = screenlet.getTabMenu(); + if (tabMenu != null) { + tabMenu.renderWidgetString(writer, context, this); + } + StringWriter sr = new StringWriter(); + sr.append("<@renderScreenletBegin "); + sr.append("id=\""); + sr.append(screenlet.getId(context)); + sr.append("\" />"); + executeMacro(writer, sr.toString()); + + String title = screenlet.getTitle(context); + boolean collapsible = screenlet.collapsible(); + ModelScreenWidget.Menu navMenu = screenlet.getNavigationMenu(); + ModelScreenWidget.Form navForm = screenlet.getNavigationForm(); + String collapsibleAreaId = null; + if (UtilValidate.isNotEmpty(title) || navMenu != null || navForm != null || collapsible) { + writer.append("<div class=\"screenlet-title-bar\">"); + appendWhitespace(writer); + writer.append("<ul>"); + appendWhitespace(writer); + if (UtilValidate.isNotEmpty(title)) { + writer.append("<li class=\"h3\">"); + writer.append(title); + writer.append("</li>"); + appendWhitespace(writer); + } + if (collapsible) { + collapsibleAreaId = this.getNextElementId(); + String expandToolTip = null; + String collapseToolTip = null; + Map<String, Object> uiLabelMap = UtilGenerics.checkMap(context.get("uiLabelMap")); + Map<String, Object> paramMap = UtilGenerics.checkMap(context.get("requestParameters")); + Map<String, Object> requestParameters = new HashMap<String, Object>(paramMap); + if (uiLabelMap != null) { + expandToolTip = (String) uiLabelMap.get("CommonExpand"); + collapseToolTip = (String) uiLabelMap.get("CommonCollapse"); + } + writer.append("<li class=\""); + if (collapsed) { + writer.append("collapsed\"><a "); + if (javaScriptEnabled) { + writer.append("onclick=\"javascript:toggleScreenlet(this, '" + collapsibleAreaId + "', '" + expandToolTip + "', '" + collapseToolTip + "');\""); + } else { + requestParameters.put(screenlet.getPreferenceKey(context) + "_collapsed", "false"); + String queryString = UtilHttp.urlEncodeArgs(requestParameters); + writer.append("href=\"" + request.getRequestURI() + "?" + queryString + "\""); + } + if (UtilValidate.isNotEmpty(expandToolTip)) { + writer.append(" title=\"" + expandToolTip + "\""); + } + } else { + writer.append("expanded\"><a "); + if (javaScriptEnabled) { + writer.append("onclick=\"javascript:toggleScreenlet(this, '" + collapsibleAreaId + "', '" + expandToolTip + "', '" + collapseToolTip + "');\""); + } else { + requestParameters.put(screenlet.getPreferenceKey(context) + "_collapsed", "true"); + String queryString = UtilHttp.urlEncodeArgs(requestParameters); + writer.append("href=\"" + request.getRequestURI() + "?" + queryString + "\""); + } + if (UtilValidate.isNotEmpty(collapseToolTip)) { + writer.append(" title=\"" + collapseToolTip + "\""); + } + } + writer.append("> </a></li>"); + appendWhitespace(writer); + } + if (!collapsed) { + if (navMenu != null) { + MenuStringRenderer savedRenderer = (MenuStringRenderer) context.get("menuStringRenderer"); + MenuStringRenderer renderer = new ScreenletMenuRenderer(request, response); + context.put("menuStringRenderer", renderer); + navMenu.renderWidgetString(writer, context, this); + context.put("menuStringRenderer", savedRenderer); + } else if (navForm != null) { + renderScreenletPaginateMenu(writer, context, navForm); + } + } + writer.append("</ul>"); + appendWhitespace(writer); + writer.append("<br class=\"clear\" />"); + appendWhitespace(writer); + writer.append("</div>"); + appendWhitespace(writer); + writer.append("<div"); + if (UtilValidate.isNotEmpty(collapsibleAreaId)) { + writer.append(" id=\"" + collapsibleAreaId + "\""); + if (collapsed) { + writer.append(" style=\"display: none;\""); + } + } + if (screenlet.padded()) { + writer.append(" class=\"screenlet-body\""); + } + writer.append(">"); + appendWhitespace(writer); + } + } + + public void renderScreenletSubWidget(Appendable writer, Map<String, Object> context, ModelScreenWidget subWidget, ModelScreenWidget.Screenlet screenlet) throws GeneralException, IOException { + if (subWidget.equals(screenlet.getNavigationForm())) { + HttpServletRequest request = (HttpServletRequest) context.get("request"); + HttpServletResponse response = (HttpServletResponse) context.get("response"); + if (request != null && response != null) { + Map<String, Object> globalCtx = UtilGenerics.checkMap(context.get("globalContext")); + globalCtx.put("NO_PAGINATOR", true); + FormStringRenderer savedRenderer = (FormStringRenderer) context.get("formStringRenderer"); + HtmlFormRenderer renderer = new HtmlFormRenderer(request, response); + renderer.setRenderPagination(false); + context.put("formStringRenderer", renderer); + subWidget.renderWidgetString(writer, context, this); + context.put("formStringRenderer", savedRenderer); + } + } else { + subWidget.renderWidgetString(writer, context, this); + } + } + public void renderScreenletEnd(Appendable writer, Map<String, Object> context, ModelScreenWidget.Screenlet screenlet) throws IOException { + StringWriter sr = new StringWriter(); + sr.append("<@renderScreenletEnd/>"); + executeMacro(writer, sr.toString()); + } + + protected void renderScreenletPaginateMenu(Appendable writer, Map<String, Object> context, ModelScreenWidget.Form form) throws IOException { + HttpServletResponse response = (HttpServletResponse) context.get("response"); + HttpServletRequest request = (HttpServletRequest) context.get("request"); + ModelForm modelForm = form.getModelForm(context); + modelForm.runFormActions(context); + modelForm.preparePager(context); + String targetService = modelForm.getPaginateTarget(context); + if (targetService == null) { + targetService = "${targetService}"; + } + + // get the parametrized pagination index and size fields + int paginatorNumber = modelForm.getPaginatorNumber(context); + String viewIndexParam = modelForm.getPaginateIndexField(context); + String viewSizeParam = modelForm.getPaginateSizeField(context); + + int viewIndex = modelForm.getViewIndex(context); + int viewSize = modelForm.getViewSize(context); + int listSize = modelForm.getListSize(context); + + int lowIndex = modelForm.getLowIndex(context); + int highIndex = modelForm.getHighIndex(context); + int actualPageSize = modelForm.getActualPageSize(context); + + // if this is all there seems to be (if listSize < 0, then size is unknown) + if (actualPageSize >= listSize && listSize >= 0) return; + + // needed for the "Page" and "rows" labels + Map uiLabelMap = (Map) context.get("uiLabelMap"); + String ofLabel = ""; + if (uiLabelMap == null) { + Debug.logWarning("Could not find uiLabelMap in context", module); + } else { + ofLabel = (String) uiLabelMap.get("CommonOf"); + ofLabel = ofLabel.toLowerCase(); + } + + // for legacy support, the viewSizeParam is VIEW_SIZE and viewIndexParam is VIEW_INDEX when the fields are "viewSize" and "viewIndex" + if (viewIndexParam.equals("viewIndex" + "_" + paginatorNumber)) viewIndexParam = "VIEW_INDEX" + "_" + paginatorNumber; + if (viewSizeParam.equals("viewSize" + "_" + paginatorNumber)) viewSizeParam = "VIEW_SIZE" + "_" + paginatorNumber; + + ServletContext ctx = (ServletContext) request.getAttribute("servletContext"); + RequestHandler rh = (RequestHandler) ctx.getAttribute("_REQUEST_HANDLER_"); + + Map<String, Object> inputFields = UtilGenerics.toMap(context.get("requestParameters")); + // strip out any multi form fields if the form is of type multi + if (modelForm.getType().equals("multi")) { + inputFields = UtilHttp.removeMultiFormParameters(inputFields); + } + String queryString = UtilHttp.urlEncodeArgs(inputFields); + // strip legacy viewIndex/viewSize params from the query string + queryString = UtilHttp.stripViewParamsFromQueryString(queryString, "" + paginatorNumber); + // strip parametrized index/size params from the query string + HashSet<String> paramNames = new HashSet<String>(); + paramNames.add(viewIndexParam); + paramNames.add(viewSizeParam); + queryString = UtilHttp.stripNamedParamsFromQueryString(queryString, paramNames); + + String anchor = ""; + String paginateAnchor = modelForm.getPaginateTargetAnchor(); + if (paginateAnchor != null) anchor = "#" + paginateAnchor; + + // preparing the link text, so that later in the code we can reuse this and just add the viewIndex + String prepLinkText = ""; + prepLinkText = targetService; + if (prepLinkText.indexOf("?") < 0) { + prepLinkText += "?"; + } else if (!prepLinkText.endsWith("?")) { + prepLinkText += "&"; + } + if (!UtilValidate.isEmpty(queryString) && !queryString.equals("null")) { + prepLinkText += queryString + "&"; + } + prepLinkText += viewSizeParam + "=" + viewSize + "&" + viewIndexParam + "="; + + String linkText; + + appendWhitespace(writer); + // The current screenlet title bar navigation syling requires rendering + // these links in reverse order + // Last button + writer.append("<li class=\"" + modelForm.getPaginateLastStyle()); + if (highIndex < listSize) { + writer.append("\"><a href=\""); + int page = (listSize / viewSize) - 1; + linkText = prepLinkText + page + anchor; + // - make the link + writer.append(rh.makeLink(request, response, linkText)); + writer.append("\">" + modelForm.getPaginateLastLabel(context) + "</a>"); + } else { + // disabled button + writer.append(" disabled\">" + modelForm.getPaginateLastLabel(context)); + } + writer.append("</li>"); + appendWhitespace(writer); + // Next button + writer.append("<li class=\"" + modelForm.getPaginateNextStyle()); + if (highIndex < listSize) { + writer.append("\"><a href=\""); + linkText = prepLinkText + (viewIndex + 1) + anchor; + // - make the link + writer.append(rh.makeLink(request, response, linkText)); + writer.append("\">" + modelForm.getPaginateNextLabel(context) + "</a>"); + } else { + // disabled button + writer.append(" disabled\">" + modelForm.getPaginateNextLabel(context)); + } + writer.append("</li>"); + appendWhitespace(writer); + if (listSize > 0) { + writer.append("<li>"); + writer.append((lowIndex + 1) + " - " + (lowIndex + actualPageSize ) + " " + ofLabel + " " + listSize); + writer.append("</li>"); + appendWhitespace(writer); + } + // Previous button + writer.append("<li class=\"nav-previous"); + if (viewIndex > 0) { + writer.append("\"><a href=\""); + linkText = prepLinkText + (viewIndex - 1) + anchor; + // - make the link + writer.append(rh.makeLink(request, response, linkText)); + writer.append("\">" + modelForm.getPaginatePreviousLabel(context) + "</a>"); + } else { + // disabled button + writer.append(" disabled\">" + modelForm.getPaginatePreviousLabel(context)); + } + writer.append("</li>"); + appendWhitespace(writer); + // First button + writer.append("<li class=\"nav-first"); + if (viewIndex > 0) { + writer.append("\"><a href=\""); + linkText = prepLinkText + 0 + anchor; + writer.append(rh.makeLink(request, response, linkText)); + writer.append("\">" + modelForm.getPaginateFirstLabel(context) + "</a>"); + } else { + writer.append(" disabled\">" + modelForm.getPaginateFirstLabel(context)); + } + writer.append("</li>"); + appendWhitespace(writer); + } + +} Propchange: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenRenderer.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java?rev=756369&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java (added) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java Fri Mar 20 08:21:11 2009 @@ -0,0 +1,112 @@ +/******************************************************************************* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + *******************************************************************************/ +package org.ofbiz.widget.screen; + +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.util.Map; + +import javax.servlet.ServletContext; +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.xml.parsers.ParserConfigurationException; + +import org.ofbiz.base.util.Debug; +import org.ofbiz.base.util.GeneralException; +import org.ofbiz.base.util.UtilJ2eeCompat; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; +import org.ofbiz.base.util.UtilValidate; +import org.ofbiz.base.util.template.FreeMarkerWorker; +import org.ofbiz.webapp.view.AbstractViewHandler; +import org.ofbiz.webapp.view.ViewHandlerException; +import org.xml.sax.SAXException; + +import org.ofbiz.widget.form.FormStringRenderer; +import org.ofbiz.widget.screen.ScreenStringRenderer; +import org.ofbiz.widget.screen.MacroScreenRenderer; +import org.ofbiz.widget.screen.MacroFormRenderer; + +import freemarker.template.TemplateException; +import freemarker.template.utility.StandardCompress; + +public class MacroScreenViewHandler extends AbstractViewHandler { + + public static final String module = MacroScreenViewHandler.class.getName(); + + protected ServletContext servletContext = null; + + public void init(ServletContext context) throws ViewHandlerException { + this.servletContext = context; + } + + public void render(String name, String page, String info, String contentType, String encoding, HttpServletRequest request, HttpServletResponse response) throws ViewHandlerException { + Writer writer = null; + try { + // use UtilJ2eeCompat to get this setup properly + boolean useOutputStreamNotWriter = false; + if (this.servletContext != null) { + useOutputStreamNotWriter = UtilJ2eeCompat.useOutputStreamNotWriter(this.servletContext); + } + if (useOutputStreamNotWriter) { + ServletOutputStream ros = response.getOutputStream(); + writer = new OutputStreamWriter(ros, UtilProperties.getPropertyValue("widget", getName() + ".default.contenttype", "UTF-8")); + } else { + writer = response.getWriter(); + } + + // compress output if configured to do so + if (UtilValidate.isEmpty(encoding)) { + encoding = UtilProperties.getPropertyValue("widget", getName() + ".default.encoding", "none"); + } + boolean compressOutput = "compressed".equals(encoding); + if (!compressOutput && this.servletContext != null) { + compressOutput = "true".equals((String) this.servletContext.getAttribute("compressHTML")); + } + if (compressOutput) { + // StandardCompress defaults to a 2k buffer. That could be increased + // to speed up output. + writer = new StandardCompress().getWriter(writer, null); + } + + ScreenStringRenderer screenStringRenderer = new MacroScreenRenderer(UtilProperties.getPropertyValue("widget", getName() + ".screenrenderer"), writer); + FormStringRenderer formStringRenderer = new MacroFormRenderer(UtilProperties.getPropertyValue("widget", getName() + ".formrenderer"), writer); + + ScreenRenderer screens = new ScreenRenderer(writer, null, screenStringRenderer); + screens.populateContextForRequest(request, response, servletContext); + // this is the object used to render forms from their definitions + screens.getContext().put("formStringRenderer", formStringRenderer); + screens.render(page); + writer.flush(); + } catch (TemplateException e) { + Debug.logError(e, "Error initializing screen renderer", module); + throw new ViewHandlerException(e.getMessage()); + } catch (IOException e) { + throw new ViewHandlerException("Error in the response writer/output stream: " + e.toString(), e); + } catch (SAXException e) { + throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e); + } catch (ParserConfigurationException e) { + throw new ViewHandlerException("XML Error rendering page: " + e.toString(), e); + } catch (GeneralException e) { + throw new ViewHandlerException("Lower level error rendering page: " + e.toString(), e); + } + } +} Propchange: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/MacroScreenViewHandler.java ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/widget/templates/foScreenMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/foScreenMacroLibrary.ftl?rev=756369&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/templates/foScreenMacroLibrary.ftl (added) +++ ofbiz/trunk/framework/widget/templates/foScreenMacroLibrary.ftl Fri Mar 20 08:21:11 2009 @@ -0,0 +1,53 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#assign foStyles = { + "tabletext":"border-left=\"solid black\" border-right=\"solid black\" padding-left=\"2pt\" padding-top=\"2pt\"", + "tabletextright":"border-left=\"solid black\" border-right=\"solid black\" padding-left=\"2pt\" padding-top=\"2pt\" text-align=\"right\"", + "tableheadverysmall":"column-width=\"0.3in\"", + "tableheadsmall":"column-width=\"0.5in\"", + "tableheadmedium":"column-width=\"1.5in\"", + "tableheadwide":"column-width=\"3in\"", + "head1":"font-size=\"12\" font-weight=\"bold\"", + "head2":"font-weight=\"bold\"", + "head3":"font-weight=\"bold\" font-style=\"italic\"", + "error":"color=\"red\""}/> + +<#macro renderSectionBegin></#macro> +<#macro renderSectionEnd> +</#macro> +<#macro renderContainerBegin containerId style autoUpdateLink autoUpdateInterval><fo:block <#if style?has_content>${foStyles[style]}</#if>></#macro> +<#macro renderContainerEnd></fo:block></#macro> +<#macro renderContentBegin></#macro> +<#macro renderContentBody></#macro> +<#macro renderContentEnd></#macro> +<#macro renderSubContentBegin></#macro> +<#macro renderSubContentBody></#macro> +<#macro renderSubContentEnd></#macro> + +<#macro renderHorizontalSeparator id style><fo:block><fo:leader leader-length="100%" leader-pattern="rule" rule-style="solid" rule-thickness="0.1mm" color="black"/></fo:block></#macro> +<#macro renderLabel text id style><#if text?exists>${text}</#if></#macro> +<#macro renderLink></#macro> +<#macro renderImage></#macro> + +<#macro renderContentFrame></#macro> +<#macro renderScreenletBegin id></#macro> +<#macro renderScreenletSubWidget></#macro> +<#macro renderScreenletEnd></#macro> + Propchange: ofbiz/trunk/framework/widget/templates/foScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/templates/foScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/widget/templates/foScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl?rev=756369&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl (added) +++ ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl Fri Mar 20 08:21:11 2009 @@ -0,0 +1,46 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#macro renderSectionBegin></#macro> +<#macro renderSectionEnd> +</#macro> +<#macro renderContainerBegin id style autoUpdateLink autoUpdateInterval> +<#if autoUpdateLink?has_content> +<script type="text/javascript">ajaxUpdateAreaPeriodic('${id}', '${autoUpdateLink}', '', '${autoUpdateInterval}');</script> +</#if> +<div<#if id?hasContent> id="${id}"</#if><#if style?hasContent> class="${style}"</#if>> +</#macro> +<#macro renderContainerEnd></div></#macro> +<#macro renderContentBegin></#macro> +<#macro renderContentBody></#macro> +<#macro renderContentEnd></#macro> +<#macro renderSubContentBegin></#macro> +<#macro renderSubContentBody></#macro> +<#macro renderSubContentEnd></#macro> + +<#macro renderHorizontalSeparator id style><hr<#if id?hasContent> id="${id}"</#if><#if style?hasContent> class="${style}"</#if>/></#macro> +<#macro renderLabel text id style><#if text?exists><#if id?has_content || style?has_content><span<#if id?hasContent> id="${id}"</#if><#if style?hasContent> class="${style}"</#if>></#if>${text}<#if id?has_content || style?has_content></span></#if></#if></#macro> +<#macro renderLink></#macro> +<#macro renderImage></#macro> + +<#macro renderContentFrame></#macro> +<#macro renderScreenletBegin id><div class="screenlet"<#if id?hasContent> id="${id}"</#if>></#macro> +<#macro renderScreenletSubWidget></#macro> +<#macro renderScreenletEnd></div></div></#macro> + Propchange: ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/widget/templates/htmlScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl?rev=756369&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl (added) +++ ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl Fri Mar 20 08:21:11 2009 @@ -0,0 +1,88 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#macro renderField text><#if text?exists>${text}</#if></#macro> + +<#macro renderDisplayField></#macro> +<#macro renderHyperlinkField></#macro> + +<#macro renderTextField></#macro> +<#macro renderTextareaField></#macro> +<#macro renderDateTimeField></#macro> + +<#macro renderDropDownField></#macro> +<#macro renderCheckField></#macro> +<#macro renderRadioField></#macro> + +<#macro renderSubmitField></#macro> +<#macro renderResetField></#macro> + +<#macro renderHiddenField></#macro> +<#macro renderHiddenField></#macro> +<#macro renderIgnoredField></#macro> + +<#macro renderFieldTitle></#macro> +<#macro renderSingleFormFieldTitle></#macro> + +<#macro renderFormOpen></#macro> +<#macro renderFormClose></#macro> +<#macro renderMultiFormClose></#macro> + +<#macro renderFormatListWrapperOpen formName></#macro> +<#macro renderFormatListWrapperClose formName></#macro> + +<#macro renderFormatHeaderRowOpen></#macro> +<#macro renderFormatHeaderRowClose></#macro> +<#macro renderFormatHeaderRowCellOpen></#macro> +<#macro renderFormatHeaderRowCellClose></#macro> + +<#macro renderFormatHeaderRowFormCellOpen></#macro> +<#macro renderFormatHeaderRowFormCellClose></#macro> +<#macro renderFormatHeaderRowFormCellTitleSeparator></#macro> + +<#macro renderFormatItemRowOpen formName></#macro> +<#macro renderFormatItemRowClose formName></#macro> +<#macro renderFormatItemRowCellOpen fieldName></#macro> +<#macro renderFormatItemRowCellClose fieldName></#macro> +<#macro renderFormatItemRowFormCellOpen></#macro> +<#macro renderFormatItemRowFormCellClose></#macro> + +<#macro renderFormatSingleWrapperOpen formName></#macro> +<#macro renderFormatSingleWrapperClose formName></#macro> + +<#macro renderFormatFieldRowOpen></#macro> +<#macro renderFormatFieldRowClose></#macro> +<#macro renderFormatFieldRowTitleCellOpen></#macro> +<#macro renderFormatFieldRowTitleCellClose></#macro> +<#macro renderFormatFieldRowSpacerCell></#macro> +<#macro renderFormatFieldRowWidgetCellOpen></#macro> +<#macro renderFormatFieldRowWidgetCellClose></#macro> + +<#macro renderFormatEmptySpace></#macro> + +<#macro renderTextFindField></#macro> +<#macro renderDateFindField></#macro> +<#macro renderRangeFindField></#macro> +<#macro renderLookupField></#macro> +<#macro renderFileField></#macro> +<#macro renderPasswordField></#macro> +<#macro renderImageField></#macro> +<#macro renderBanner></#macro> +<#macro renderFieldGroupOpen></#macro> +<#macro renderFieldGroupClose></#macro> Propchange: ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/widget/templates/textFormMacroLibrary.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/widget/templates/textScreenMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/textScreenMacroLibrary.ftl?rev=756369&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/templates/textScreenMacroLibrary.ftl (added) +++ ofbiz/trunk/framework/widget/templates/textScreenMacroLibrary.ftl Fri Mar 20 08:21:11 2009 @@ -0,0 +1,41 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#macro renderSectionBegin></#macro> +<#macro renderSectionEnd> +</#macro> +<#macro renderContainerBegin containerId style autoUpdateLink autoUpdateInterval></#macro> +<#macro renderContainerEnd></#macro> +<#macro renderContentBegin></#macro> +<#macro renderContentBody></#macro> +<#macro renderContentEnd></#macro> +<#macro renderSubContentBegin></#macro> +<#macro renderSubContentBody></#macro> +<#macro renderSubContentEnd></#macro> + +<#macro renderHorizontalSeparator id style></#macro> +<#macro renderLabel text id style><#if text?exists>${text}</#if></#macro> +<#macro renderLink></#macro> +<#macro renderImage></#macro> + +<#macro renderContentFrame></#macro> +<#macro renderScreenletBegin id></#macro> +<#macro renderScreenletSubWidget></#macro> +<#macro renderScreenletEnd></#macro> + Propchange: ofbiz/trunk/framework/widget/templates/textScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/templates/textScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/framework/widget/templates/textScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl?rev=756369&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl (added) +++ ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl Fri Mar 20 08:21:11 2009 @@ -0,0 +1,36 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#macro renderField text><#if text?exists>xml${text}</#if></#macro> + +<#macro renderFormatListWrapperOpen formName><${formName}Export></#macro> + +<#macro renderFormatListWrapperClose formName></${formName}Export></#macro> + +<#macro renderFormatItemRowOpen formName><${formName}></#macro> + +<#macro renderFormatItemRowClose formName></${formName}></#macro> + +<#macro renderFormatItemRowCellOpen fieldName><${fieldName}></#macro> + +<#macro renderFormatItemRowCellClose fieldName></${fieldName}></#macro> + +<#macro renderFormatSingleWrapperOpen formName><${formName}Export></#macro> + +<#macro renderFormatSingleWrapperClose formName></${formName}Export></#macro> Propchange: ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/widget/templates/xmlFormMacroLibrary.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/trunk/framework/widget/templates/xmlScreenMacroLibrary.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/templates/xmlScreenMacroLibrary.ftl?rev=756369&view=auto ============================================================================== --- ofbiz/trunk/framework/widget/templates/xmlScreenMacroLibrary.ftl (added) +++ ofbiz/trunk/framework/widget/templates/xmlScreenMacroLibrary.ftl Fri Mar 20 08:21:11 2009 @@ -0,0 +1,40 @@ +<#-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<#macro renderSectionBegin></#macro> +<#macro renderSectionEnd></#macro> +<#macro renderContainerBegin containerId style autoUpdateLink autoUpdateInterval></#macro> +<#macro renderContainerEnd></#macro> +<#macro renderContentBegin></#macro> +<#macro renderContentBody></#macro> +<#macro renderContentEnd></#macro> +<#macro renderSubContentBegin></#macro> +<#macro renderSubContentBody></#macro> +<#macro renderSubContentEnd></#macro> + +<#macro renderHorizontalSeparator id style></#macro> +<#macro renderLabel text id style><#if text?exists>${text}</#if></#macro> +<#macro renderLink></#macro> +<#macro renderImage></#macro> + +<#macro renderContentFrame></#macro> +<#macro renderScreenletBegin id></#macro> +<#macro renderScreenletSubWidget></#macro> +<#macro renderScreenletEnd></#macro> + Propchange: ofbiz/trunk/framework/widget/templates/xmlScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/framework/widget/templates/xmlScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/framework/widget/templates/xmlScreenMacroLibrary.ftl ------------------------------------------------------------------------------ svn:mime-type = text/plain |
Free forum by Nabble | Edit this page |