Author: adrianc
Date: Wed Dec 7 22:55:48 2011 New Revision: 1211693 URL: http://svn.apache.org/viewvc?rev=1211693&view=rev Log: Screen Widget Redesign - added ScreenWidgetVisitor interface, also added accept methods to ModelWidget subclasses. Added: ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetVisitor.java (with props) Modified: ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Modified: ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java?rev=1211693&r1=1211692&r2=1211693&view=diff ============================================================================== --- ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java (original) +++ ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/HtmlWidget.java Wed Dec 7 22:55:48 2011 @@ -246,6 +246,11 @@ public class HtmlWidget extends ModelScr } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { renderHtmlTemplate(writer, this.locationExdr, context); } @@ -272,6 +277,11 @@ public class HtmlWidget extends ModelScr } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { // isolate the scope MapStack<String> contextMs; @@ -314,6 +324,11 @@ public class HtmlWidget extends ModelScr } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { // render sub-widgets renderSubWidgetsString(this.subWidgets, writer, context, screenStringRenderer); @@ -324,4 +339,9 @@ public class HtmlWidget extends ModelScr return "<html-template-decorator-section name=\"" + this.name + "\"/>"; } } + + @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } } Modified: ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java?rev=1211693&r1=1211692&r2=1211693&view=diff ============================================================================== --- ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java (original) +++ ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/IterateSectionWidget.java Wed Dec 7 22:55:48 2011 @@ -101,6 +101,11 @@ public class IterateSectionWidget extend } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { boolean isEntrySet = false; Modified: ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=1211693&r1=1211692&r2=1211693&view=diff ============================================================================== --- ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) +++ ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Wed Dec 7 22:55:48 2011 @@ -81,6 +81,8 @@ public abstract class ModelScreenWidget if (Debug.verboseOn()) Debug.logVerbose("Reading Screen sub-widget with name: " + widgetElement.getNodeName(), module); } + public abstract void accept(ScreenWidgetVisitor visitor); + public abstract void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException; public abstract String rawString(); @@ -169,6 +171,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { // check the condition, if there is one boolean condTrue = true; @@ -252,6 +259,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { try { screenStringRenderer.renderContainerBegin(writer, context, this); @@ -355,6 +367,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { boolean collapsed = getInitiallyCollapsed(context); if (this.collapsible) { @@ -448,6 +465,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { screenStringRenderer.renderHorizontalSeparator(writer, context, this); } @@ -480,6 +502,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { // if we are not sharing the scope, protect it using the MapStack boolean protectScope = !shareScope(context); @@ -556,6 +583,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override @SuppressWarnings("unchecked") public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { // isolate the scope @@ -608,6 +640,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { // render sub-widgets renderSubWidgetsString(this.subWidgets, writer, context, screenStringRenderer); @@ -627,6 +664,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { Map<String, ? extends Object> preRenderedContent = UtilGenerics.checkMap(context.get("preRenderedContent")); if (preRenderedContent != null && preRenderedContent.containsKey(this.name)) { @@ -674,6 +716,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { try { screenStringRenderer.renderLabel(writer, context, this); @@ -723,6 +770,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { boolean protectScope = !shareScope(context); if (protectScope) { @@ -811,6 +863,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { boolean protectScope = !shareScope(context); if (protectScope) { @@ -903,6 +960,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { ModelScreenWidget subWidget = null; subWidget = subWidgets.get(screenStringRenderer.getRendererName()); @@ -958,6 +1020,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { try { // pushing the contentId on the context as "contentId" is done @@ -1178,6 +1245,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { try { screenStringRenderer.renderSubContentBegin(writer, context, this); @@ -1234,6 +1306,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws IOException { // try finding the menuStringRenderer by name in the context in case one was prepared and put there MenuStringRenderer menuStringRenderer = (MenuStringRenderer) context.get("menuStringRenderer"); @@ -1332,6 +1409,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { try { screenStringRenderer.renderLink(writer, context, this); @@ -1514,6 +1596,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) { try { screenStringRenderer.renderImage(writer, context, this); @@ -1611,6 +1698,11 @@ public abstract class ModelScreenWidget } @Override + public void accept(ScreenWidgetVisitor visitor) { + visitor.visit(this); + } + + @Override public void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException { try { Delegator delegator = (Delegator) context.get("delegator"); Added: ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetVisitor.java URL: http://svn.apache.org/viewvc/ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetVisitor.java?rev=1211693&view=auto ============================================================================== --- ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetVisitor.java (added) +++ ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetVisitor.java Wed Dec 7 22:55:48 2011 @@ -0,0 +1,95 @@ +/******************************************************************************* + * 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 org.ofbiz.widget.screen.HtmlWidget.HtmlTemplate; +import org.ofbiz.widget.screen.HtmlWidget.HtmlTemplateDecorator; +import org.ofbiz.widget.screen.HtmlWidget.HtmlTemplateDecoratorSection; +import org.ofbiz.widget.screen.ModelScreenWidget.Container; +import org.ofbiz.widget.screen.ModelScreenWidget.Content; +import org.ofbiz.widget.screen.ModelScreenWidget.DecoratorScreen; +import org.ofbiz.widget.screen.ModelScreenWidget.DecoratorSection; +import org.ofbiz.widget.screen.ModelScreenWidget.DecoratorSectionInclude; +import org.ofbiz.widget.screen.ModelScreenWidget.Form; +import org.ofbiz.widget.screen.ModelScreenWidget.HorizontalSeparator; +import org.ofbiz.widget.screen.ModelScreenWidget.Image; +import org.ofbiz.widget.screen.ModelScreenWidget.IncludeScreen; +import org.ofbiz.widget.screen.ModelScreenWidget.Label; +import org.ofbiz.widget.screen.ModelScreenWidget.Link; +import org.ofbiz.widget.screen.ModelScreenWidget.Menu; +import org.ofbiz.widget.screen.ModelScreenWidget.PlatformSpecific; +import org.ofbiz.widget.screen.ModelScreenWidget.PortalPage; +import org.ofbiz.widget.screen.ModelScreenWidget.Screenlet; +import org.ofbiz.widget.screen.ModelScreenWidget.Section; +import org.ofbiz.widget.screen.ModelScreenWidget.SubContent; +import org.ofbiz.widget.screen.ModelScreenWidget.Tree; + +/** + * Screen widget visitor. + */ +public interface ScreenWidgetVisitor { + + void visit(Container container); + + void visit(Content content); + + void visit(DecoratorScreen decoratorScreen); + + void visit(DecoratorSection decoratorSection); + + void visit(DecoratorSectionInclude decoratorSectionInclude); + + void visit(Form form); + + void visit(HorizontalSeparator horizontalSeparator); + + void visit(HtmlTemplate htmlTemplate); + + void visit(HtmlTemplateDecorator htmlTemplateDecorator); + + void visit(HtmlTemplateDecoratorSection htmlTemplateDecoratorSection); + + void visit(HtmlWidget htmlWidget); + + void visit(Image image); + + void visit(IncludeScreen includeScreen); + + void visit(IterateSectionWidget iterateSectionWidget); + + void visit(Label label); + + void visit(Link link); + + void visit(Menu menu); + + void visit(ModelScreen modelScreen); + + void visit(PlatformSpecific platformSpecific); + + void visit(PortalPage portalPage); + + void visit(Screenlet screenlet); + + void visit(Section section); + + void visit(SubContent subContent); + + void visit(Tree tree); +} Propchange: ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetVisitor.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/20111115ScreenWidgetRedesign/framework/widget/src/org/ofbiz/widget/screen/ScreenWidgetVisitor.java ------------------------------------------------------------------------------ svn:keywords = Author Date Id Rev URL |
Free forum by Nabble | Edit this page |