Author: jacopoc Date: Tue Sep 30 06:20:29 2014 New Revision: 1628361 URL: http://svn.apache.org/r1628361 Log: Removed deprecated methods in the widget API; cleaned up a bunch of old commented out code; fixed formatting issues; some minor code improvements (no functional changes).
Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl ofbiz/trunk/themes/droppingcrumbs/includes/appbarClose.ftl ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/ModelWidget.java Tue Sep 30 06:20:29 2014 @@ -38,7 +38,6 @@ public class ModelWidget implements Seri */ public static final String enableBoundaryCommentsParam = "widgetVerbose"; protected String name; - protected boolean enableWidgetBoundaryComments = false; private String systemId; private int startColumn; private int startLine; @@ -104,27 +103,6 @@ public class ModelWidget implements Seri } /** - * Returns true if boundary comments are enabled for this widget, otherwise - * returns false. - * @return True if boundary comments are enabled for this widget - * @deprecated Use the static <code>widgetBoundaryCommentsEnabled</code> method instead - */ - @Deprecated - public boolean boundaryCommentsEnabled() { - return enableWidgetBoundaryComments; - } - - /** - * Enables/disables boundary comments for this widget. - * @param context The screen rendering context - * @deprecated Do not use this - it is not thread-safe - */ - @Deprecated - public void setWidgetBoundaryComments(Map<String, ? extends Object> context) { - enableWidgetBoundaryComments = widgetBoundaryCommentsEnabled(context); - } - - /** * Returns <code>true</code> if widget boundary comments are enabled. Widget boundary comments are * enabled by setting <code>widget.verbose=true</code> in the <code>widget.properties</code> file. * The <code>true</code> setting can be overridden in <code>web.xml</code> or in the screen Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/FormFactory.java Tue Sep 30 06:20:29 2014 @@ -52,13 +52,7 @@ public class FormFactory { public static Map<String, ModelForm> getFormsFromLocation(String resourceName, ModelReader entityModelReader, DispatchContext dispatchContext) throws IOException, SAXException, ParserConfigurationException { - /* - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader == null) { - loader = FormFactory.class.getClassLoader(); - } - */ - URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); //, loader); + URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, true); return readFormDocument(formFileDoc, entityModelReader, dispatchContext, resourceName); } @@ -68,13 +62,7 @@ public class FormFactory { String cacheKey = resourceName + "#" + formName; ModelForm modelForm = formLocationCache.get(cacheKey); if (modelForm == null) { - /* - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader == null) { - loader = FormFactory.class.getClassLoader(); - } - */ - URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); //, loader); + URL formFileUrl = FlexibleLocation.resolveLocation(resourceName); Document formFileDoc = UtilXml.readXmlDocument(formFileUrl, true, true); if (formFileDoc == null) { throw new IllegalArgumentException("Could not find resource [" + resourceName + "]"); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/form/ModelForm.java Tue Sep 30 06:20:29 2014 @@ -172,9 +172,6 @@ public class ModelForm extends ModelWidg */ protected FieldGroup defaultFieldGroup; - /** Default hyperlink target. */ - public static String DEFAULT_TARGET_TYPE = "intra-app"; - /** Pagination settings and defaults. */ public static int DEFAULT_PAGE_SIZE = 10; public static int MAX_PAGE_SIZE = 10000; @@ -312,10 +309,6 @@ public class ModelForm extends ModelWidg this.useWhenFields = parent.useWhenFields; - //these are done below in a special way... - //this.fieldList = parent.fieldList; - //this.fieldMap = parent.fieldMap; - // Create this fieldList/Map from clones of parent's for (ModelFormField parentChildField: parent.fieldList) { ModelFormField childField = new ModelFormField(this); @@ -539,7 +532,6 @@ public class ModelForm extends ModelWidg } else { modelFormField = this.addUpdateField(modelFormField); } - //Debug.logInfo("Added field " + modelFormField.getName() + " from def, mapName=" + modelFormField.getMapName(), module); } // Create the default field group @@ -1516,8 +1508,6 @@ public class ModelForm extends ModelWidg getListLimits(context, obj); int listSize = ((Integer) context.get("listSize")).intValue(); - //int viewIndex = ((Integer) context.get("viewIndex")).intValue(); - //int viewSize = ((Integer) context.get("viewSize")).intValue(); int lowIndex = ((Integer) context.get("lowIndex")).intValue(); int highIndex = ((Integer) context.get("highIndex")).intValue(); @@ -3272,7 +3262,6 @@ public class ModelForm extends ModelWidg ModelFormField.HyperlinkField link = (ModelFormField.HyperlinkField) modelFormField.getFieldInfo(); String target = link.getTarget(null); String urlMode = link.getTargetType(); - // Debug.logInfo("In findRequestNamesLinkedtoInWidget found link [" + link.rawString() + "] with target [" + target + "]", module); Set<String> controllerLocAndRequestSet = ConfigXMLReader.findControllerRequestUniqueForTargetType(target, urlMode); if (controllerLocAndRequestSet != null) { Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/MenuFactory.java Tue Sep 30 06:20:29 2014 @@ -32,8 +32,6 @@ import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.cache.UtilCache; -import org.ofbiz.entity.Delegator; -import org.ofbiz.service.LocalDispatcher; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.xml.sax.SAXException; @@ -94,24 +92,13 @@ public class MenuFactory { return modelMenuMap; } - @Deprecated - public static Map<String, ModelMenu> readMenuDocument(Document menuFileDoc, Delegator delegator, LocalDispatcher dispatcher, String menuLocation) { - return readMenuDocument(menuFileDoc, menuLocation); - } - public static ModelMenu getMenuFromLocation(String resourceName, String menuName) throws IOException, SAXException, ParserConfigurationException { Map<String, ModelMenu> modelMenuMap = menuLocationCache.get(resourceName); if (modelMenuMap == null) { synchronized (MenuFactory.class) { modelMenuMap = menuLocationCache.get(resourceName); if (modelMenuMap == null) { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader == null) { - loader = MenuFactory.class.getClassLoader(); - } - - URL menuFileUrl = null; - menuFileUrl = FlexibleLocation.resolveLocation(resourceName); //, loader); + URL menuFileUrl = FlexibleLocation.resolveLocation(resourceName); Document menuFileDoc = UtilXml.readXmlDocument(menuFileUrl, true, true); modelMenuMap = readMenuDocument(menuFileDoc, resourceName); menuLocationCache.put(resourceName, modelMenuMap); @@ -129,11 +116,4 @@ public class MenuFactory { } return modelMenu; } - - @Deprecated - public static ModelMenu getMenuFromLocation(String resourceName, String menuName, Delegator delegator, LocalDispatcher dispatcher) - throws IOException, SAXException, ParserConfigurationException { - return getMenuFromLocation(resourceName, menuName); - } - } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenu.java Tue Sep 30 06:20:29 2014 @@ -24,20 +24,14 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.ofbiz.base.util.BshUtil; import org.ofbiz.base.util.Debug; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.collections.FlexibleMapAccessor; import org.ofbiz.base.util.string.FlexibleStringExpander; -import org.ofbiz.entity.Delegator; -import org.ofbiz.service.LocalDispatcher; import org.ofbiz.widget.ModelWidget; import org.w3c.dom.Element; -import bsh.EvalError; -import bsh.Interpreter; - /** * Widget Library - Menu model class */ @@ -209,7 +203,6 @@ public class ModelMenu extends ModelWidg this.defaultCellWidth = menuElement.getAttribute("default-cell-width"); if (menuElement.hasAttribute("default-hide-if-selected")) { String val = menuElement.getAttribute("default-hide-if-selected"); - //Debug.logInfo("in ModelMenu, hideIfSelected, val:" + val, module); if (val != null && val.equalsIgnoreCase("true")) defaultHideIfSelected = Boolean.TRUE; else @@ -250,49 +243,28 @@ public class ModelMenu extends ModelWidg } } - @Deprecated - public ModelMenu(Element menuElement, Delegator delegator, LocalDispatcher dispatcher) { - this(menuElement); - } /** * add/override modelMenuItem using the menuItemList and menuItemMap * * @return The same ModelMenuItem, or if merged with an existing item, the existing item. */ public ModelMenuItem addUpdateMenuItem(ModelMenuItem modelMenuItem) { - - // not a conditional item, see if a named item exists in Map - ModelMenuItem existingMenuItem = this.menuItemMap.get(modelMenuItem.getName()); - if (existingMenuItem != null) { - // does exist, update the item by doing a merge/override - existingMenuItem.mergeOverrideModelMenuItem(modelMenuItem); - return existingMenuItem; - } else { - // does not exist, add to List and Map - this.menuItemList.add(modelMenuItem); - this.menuItemMap.put(modelMenuItem.getName(), modelMenuItem); - return modelMenuItem; - } - } - - public ModelMenuItem getModelMenuItemByName(String name) { - ModelMenuItem existingMenuItem = this.menuItemMap.get(name); + // not a conditional item, see if a named item exists in Map + ModelMenuItem existingMenuItem = this.menuItemMap.get(modelMenuItem.getName()); + if (existingMenuItem != null) { + // does exist, update the item by doing a merge/override + existingMenuItem.mergeOverrideModelMenuItem(modelMenuItem); return existingMenuItem; + } else { + // does not exist, add to List and Map + this.menuItemList.add(modelMenuItem); + this.menuItemMap.put(modelMenuItem.getName(), modelMenuItem); + return modelMenuItem; + } } - public ModelMenuItem getModelMenuItemByContentId(String contentId, Map<String, Object> context) { - - ModelMenuItem existingMenuItem = null; - if (UtilValidate.isEmpty(contentId)) - return existingMenuItem; - for (ModelMenuItem mi : this.menuItemList) { - String assocContentId = mi.getAssociatedContentId(context); - if (contentId.equals(assocContentId)) { - existingMenuItem = mi; - break; - } - } - return existingMenuItem; + public ModelMenuItem getModelMenuItemByName(String name) { + return this.menuItemMap.get(name); } /** @@ -311,19 +283,12 @@ public class ModelMenu extends ModelWidg * use the same menu definitions for many types of menu UIs */ public void renderMenuString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { - - boolean passed = true; - - //Debug.logInfo("in ModelMenu, name:" + this.getName(), module); - if (passed) { - ModelMenuAction.runSubActions(this.actions, context); - if ("simple".equals(this.type)) { - this.renderSimpleMenuString(writer, context, menuStringRenderer); - } else { - throw new IllegalArgumentException("The type " + this.getType() + " is not supported for menu with name " + this.getName()); - } + ModelMenuAction.runSubActions(this.actions, context); + if ("simple".equals(this.type)) { + this.renderSimpleMenuString(writer, context, menuStringRenderer); + } else { + throw new IllegalArgumentException("The type " + this.getType() + " is not supported for menu with name " + this.getName()); } - //Debug.logInfo("in ModelMenu, buffer:" + buffer.toString(), module); } public int renderedMenuItemCount(Map<String, Object> context) @@ -337,21 +302,15 @@ public class ModelMenu extends ModelWidg } public void renderSimpleMenuString(Appendable writer, Map<String, Object> context, MenuStringRenderer menuStringRenderer) throws IOException { - //Iterator menuItemIter = null; - //Set alreadyRendered = new TreeSet(); - // render menu open menuStringRenderer.renderMenuOpen(writer, context, this); // render formatting wrapper open menuStringRenderer.renderFormatSimpleWrapperOpen(writer, context, this); - //Debug.logInfo("in ModelMenu, menuItemList:" + menuItemList, module); // render each menuItem row, except hidden & ignored rows - // include portal pages if specified - //menuStringRenderer.renderFormatSimpleWrapperRows(writer, context, this); for (ModelMenuItem item : this.menuItemList) { - item.renderMenuItemString(writer, context, menuStringRenderer); + item.renderMenuItemString(writer, context, menuStringRenderer); } // render formatting wrapper close menuStringRenderer.renderFormatSimpleWrapperClose(writer, context, this); @@ -360,22 +319,6 @@ public class ModelMenu extends ModelWidg menuStringRenderer.renderMenuClose(writer, context, this); } - /** - * @deprecated Use getDispatcher(Map<String, Object>) instead, this method will throw an {@link UnsupportedOperationException} if used - */ - @Deprecated - public LocalDispatcher getDispacher() { - throw new UnsupportedOperationException("This method is no longer supported, use getDispatcher(Map<String, Object>) instead."); - } - - /** - * @deprecated Use getDelegator(Map<String, Object>) instead, this method will throw an {@link UnsupportedOperationException} if used - */ - @Deprecated - public Delegator getDelegator() { - throw new UnsupportedOperationException("This method is no longer supported, use getDelegator(Map<String, Object>) instead."); - } - public String getDefaultEntityName() { return this.defaultEntityName; } @@ -388,7 +331,6 @@ public class ModelMenu extends ModelWidg return this.defaultAlignStyle; } - public String getDefaultTitleStyle() { return this.defaultTitleStyle; } @@ -450,15 +392,6 @@ public class ModelMenu extends ModelWidg return menuLocation + "#" + name; } - public Interpreter getBshInterpreter(Map<String, Object> context) throws EvalError { - Interpreter bsh = (Interpreter) context.get("bshInterpreter"); - if (bsh == null) { - bsh = BshUtil.makeInterpreter(context); - context.put("bshInterpreter", bsh); - } - return bsh; - } - /** * @param string */ Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/menu/ModelMenuItem.java Tue Sep 30 06:20:29 2014 @@ -39,7 +39,6 @@ import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.collections.FlexibleMapAccessor; import org.ofbiz.base.util.string.FlexibleStringExpander; import org.ofbiz.entity.GenericValue; -import org.ofbiz.entityext.permission.EntityPermissionChecker; import org.ofbiz.widget.WidgetWorker; import org.ofbiz.widget.PortalPageWorker; import org.w3c.dom.Element; @@ -78,10 +77,6 @@ public class ModelMenuItem { protected List<ModelMenuItem> menuItemList = new LinkedList<ModelMenuItem>(); protected Map<String, ModelMenuItem> menuItemMap = new HashMap<String, ModelMenuItem>(); - - public static String DEFAULT_TARGET_TYPE = "intra-app"; - - protected EntityPermissionChecker permissionChecker; protected ModelMenuItem parentMenuItem; protected ModelMenuCondition condition; protected boolean disabled = false; @@ -137,7 +132,6 @@ public class ModelMenuItem { this.cellWidth = fieldElement.getAttribute("cell-width"); dataMap.put("name", this.name); - //dataMap.put("associatedContentId", this.associatedContentId); Element subMenuElement = UtilXml.firstChildElement(fieldElement, "sub-menu"); if (subMenuElement != null) { @@ -161,21 +155,15 @@ public class ModelMenuItem { } Element linkElement = UtilXml.firstChildElement(fieldElement, "link"); - //if (Debug.infoOn()) Debug.logInfo("in ModelMenuItem, linkElement:" + linkElement, module); if (linkElement != null) { link = new Link(linkElement, this); } -// Element permissionElement = UtilXml.firstChildElement(fieldElement, "if-entity-permission"); -// if (permissionElement != null) -// permissionChecker = new EntityPermissionChecker(permissionElement); - // read in add item defs, add/override one by one using the menuItemList and menuItemMap List<? extends Element> itemElements = UtilXml.childElementList(fieldElement, "menu-item"); for (Element itemElement: itemElements) { ModelMenuItem modelMenuItem = new ModelMenuItem(itemElement, this); modelMenuItem = this.addUpdateMenuItem(modelMenuItem); - //Debug.logInfo("Added item " + modelMenuItem.getName() + " from def, mapName=" + modelMenuItem.getMapName(), module); } // read condition under the "condition" element Element conditionElement = UtilXml.firstChildElement(fieldElement, "condition"); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ModelScreenWidget.java Tue Sep 30 06:20:29 2014 @@ -350,13 +350,6 @@ public abstract class ModelScreenWidget return this.autoUpdateTargetExdr.expandString(context); } - /** - * @deprecated Use the version that takes a context parameter. - */ - public String getAutoUpdateInterval() { - return this.autoUpdateInterval.getOriginal(); - } - public String getAutoUpdateInterval(Map<String, Object> context) { return this.autoUpdateInterval.expandString(context); } @@ -584,7 +577,7 @@ public abstract class ModelScreenWidget context.put("_WIDGETTRAIL_", widgetTrail); } - // dont need the renderer here, will just pass this on down to another screen call; screenStringRenderer.renderContainerBegin(writer, context, this); + // don't need the renderer here, will just pass this on down to another screen call; screenStringRenderer.renderContainerBegin(writer, context, this); String name = this.getName(context); String location = this.getLocation(context); @@ -821,7 +814,6 @@ public abstract class ModelScreenWidget UtilGenerics.<MapStack<String>>cast(context).push(); } ModelForm modelForm = getModelForm(context); - //Debug.logInfo("before renderFormString, context:" + context, module); try { modelForm.renderFormString(writer, context, formStringRenderer); } catch (IOException e) { @@ -1081,91 +1073,8 @@ public abstract class ModelScreenWidget mimeTypeId = content.getString("mimeTypeId"); } - if (UtilValidate.isNotEmpty(mimeTypeId) - && ((mimeTypeId.indexOf("application") >= 0) || (mimeTypeId.indexOf("image")) >= 0)) { - -/* - // this code is not yet working, will update it the next few weeks...(Hans) - if (mimeTypeId.equals("application/pdf")) { - TransformerFactory tfactory = TransformerFactory.newInstance(); - try { - - // - // this part is not working. If somebody can help to make it work? - // currently using only real temp files for debugging purposes. - // - // most of the code should be replaced by functions in xslTransform.java and other files. - // for debugging here mostly code using the code outside of ofbiz. - // - SAXParserFactory pfactory= SAXParserFactory.newInstance(); - pfactory.setNamespaceAware(true); - pfactory.setValidating(true); - pfactory.setXIncludeAware(true); - XMLReader reader = null; - try { - reader = pfactory.newSAXParser().getXMLReader(); - } catch (Exception e) { - throw new TransformerException("Error creating SAX parser/reader", e); - } - - // do the actual preprocessing fr includes - String fileName = "/home/hans/ofbiz/svn/applications/commonext/documents/ApacheOfbiz.xml"; - SAXSource source = new SAXSource(reader, new InputSource(fileName)); - // compile the xsl template - Transformer transformer1 = tfactory.newTransformer(new StreamSource("/home/hans/ofbiz/svn/applications/content/template/docbook/fo/docbook.xsl")); - // and apply the xsl template to the source document and save in a result string - StringWriter sw = new StringWriter(); - StreamResult sr = new StreamResult(sw); - transformer1.transform(source, sr); - // store into a file for debugging -// java.io.FileWriter fw = new java.io.FileWriter(new java.io.File("/tmp/file1.fo")); -// fw.write(sw.toString()); -// fw.close(); - - - FopFactory fopFactory = FopFactory.newInstance(); - FOUserAgent foUserAgent = fopFactory.newFOUserAgent(); - // configure foUserAgent as desired - - // Setup output stream. Note: Using BufferedOutputStream - // for performance reasons (helpful with FileOutputStreams). -// OutputStream out = new FileOutputStream("/tmp/file.pdf"); -// out = new BufferedOutputStream(out); -// OutputStream outWriter = (OutputStream) writer; - ByteArrayOutputStream out = new ByteArrayOutputStream(); - Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, foUserAgent, out); - - // Setup JAXP using identity transformer - TransformerFactory factory = TransformerFactory.newInstance(); - Transformer transformer = factory.newTransformer(); // identity transformer - - // Setup input stream - Source src = new StreamSource(new ByteArrayInputStream(sw.toString().getBytes())); - - // Resulting SAX events (the generated FO) must be piped through to FOP - Result result = new SAXResult(fop.getDefaultHandler()); - - // Start XSLT transformation and FOP processing - transformer.transform(src, result); - - out.flush(); - out.close(); - // to a file for debugging - FileOutputStream fw = new FileOutputStream("/tmp/file.pdf"); - fw.write(out.toByteArray()); - fw.close(); - HttpServletResponse response = (HttpServletResponse) context.get("response"); - response.setContentType("application/pdf"); - response.setContentLength(out.size()); - response.setHeader("Content-Disposition", "attachment;filename=" + fileName); - writer.append(new String(out.toByteArray())); - } catch(Exception e) { - Debug.logError("Exception converting from FO to PDF: " + e, module); - } - } else { -*/ screenStringRenderer.renderContentFrame(writer, context, this); -// } - } else { + if (!(UtilValidate.isNotEmpty(mimeTypeId) + && ((mimeTypeId.indexOf("application") >= 0) || (mimeTypeId.indexOf("image")) >= 0))) { screenStringRenderer.renderContentBegin(writer, context, this); screenStringRenderer.renderContentBody(writer, context, this); screenStringRenderer.renderContentEnd(writer, context, this); Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/screen/ScreenFactory.java Tue Sep 30 06:20:29 2014 @@ -113,13 +113,8 @@ public class ScreenFactory { modelScreenMap = screenLocationCache.get(resourceName); if (modelScreenMap == null) { long startTime = System.currentTimeMillis(); - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - if (loader == null) { - loader = ScreenFactory.class.getClassLoader(); - } - URL screenFileUrl = null; - screenFileUrl = FlexibleLocation.resolveLocation(resourceName, loader); + screenFileUrl = FlexibleLocation.resolveLocation(resourceName); if (screenFileUrl == null) { throw new IllegalArgumentException("Could not resolve location to URL: " + resourceName); } Modified: ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java (original) +++ ofbiz/trunk/framework/widget/src/org/ofbiz/widget/tree/TreeFactory.java Tue Sep 30 06:20:29 2014 @@ -23,12 +23,9 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; -import javax.servlet.ServletContext; -import javax.servlet.http.HttpServletRequest; import javax.xml.parsers.ParserConfigurationException; import org.ofbiz.base.location.FlexibleLocation; -import org.ofbiz.base.util.UtilHttp; import org.ofbiz.base.util.UtilXml; import org.ofbiz.base.util.cache.UtilCache; import org.ofbiz.entity.Delegator; @@ -46,7 +43,6 @@ public class TreeFactory { public static final String module = TreeFactory.class.getName(); public static final UtilCache<String, Map<String, ModelTree>> treeLocationCache = UtilCache.createUtilCache("widget.tree.locationResource", 0, 0, false); - public static final UtilCache<String, Map<String, ModelTree>> treeWebappCache = UtilCache.createUtilCache("widget.tree.webappResource", 0, 0, false); public static ModelTree getTreeFromLocation(String resourceName, String treeName, Delegator delegator, LocalDispatcher dispatcher) throws IOException, SAXException, ParserConfigurationException { @@ -76,36 +72,6 @@ public class TreeFactory { return modelTree; } - public static ModelTree getTreeFromWebappContext(String resourceName, String treeName, HttpServletRequest request) - throws IOException, SAXException, ParserConfigurationException { - String webappName = UtilHttp.getApplicationName(request); - String cacheKey = webappName + "::" + resourceName; - - - Map<String, ModelTree> modelTreeMap = treeWebappCache.get(cacheKey); - if (modelTreeMap == null) { - synchronized (TreeFactory.class) { - modelTreeMap = treeWebappCache.get(cacheKey); - if (modelTreeMap == null) { - ServletContext servletContext = (ServletContext) request.getAttribute("servletContext"); - Delegator delegator = (Delegator) request.getAttribute("delegator"); - LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); - - URL treeFileUrl = servletContext.getResource(resourceName); - Document treeFileDoc = UtilXml.readXmlDocument(treeFileUrl, true, true); - modelTreeMap = readTreeDocument(treeFileDoc, delegator, dispatcher, cacheKey); - treeWebappCache.put(cacheKey, modelTreeMap); - } - } - } - - ModelTree modelTree = modelTreeMap.get(treeName); - if (modelTree == null) { - throw new IllegalArgumentException("Could not find tree with name [" + treeName + "] in webapp resource [" + resourceName + "] in the webapp [" + webappName + "]"); - } - return modelTree; - } - public static Map<String, ModelTree> readTreeDocument(Document treeFileDoc, Delegator delegator, LocalDispatcher dispatcher, String treeLocation) { Map<String, ModelTree> modelTreeMap = new HashMap<String, ModelTree>(); if (treeFileDoc != null) { Modified: ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl (original) +++ ofbiz/trunk/themes/bluelight/includes/appbarOpen.ftl Tue Sep 30 06:20:29 2014 @@ -23,7 +23,7 @@ under the License. <#assign displayApps = Static["org.ofbiz.webapp.control.LoginWorker"].getAppBarWebInfos(security, userLogin, ofbizServerName, "main")> <#assign displaySecondaryApps = Static["org.ofbiz.webapp.control.LoginWorker"].getAppBarWebInfos(security, userLogin, ofbizServerName, "secondary")> -<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName,delegator,dispatcher)> +<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName)> <#if appModelMenu.getModelMenuItemByName(headerItem)??> <#if headerItem!="main"> <#assign show_last_menu = true> Modified: ofbiz/trunk/themes/droppingcrumbs/includes/appbarClose.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/droppingcrumbs/includes/appbarClose.ftl?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/themes/droppingcrumbs/includes/appbarClose.ftl (original) +++ ofbiz/trunk/themes/droppingcrumbs/includes/appbarClose.ftl Tue Sep 30 06:20:29 2014 @@ -16,7 +16,7 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> -<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName,delegator,dispatcher)> +<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName)> <#if appModelMenu.getModelMenuItemByName(headerItem)??> <#if headerItem!="main"> <div class="breadcrumbs-sep"> Modified: ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl (original) +++ ofbiz/trunk/themes/droppingcrumbs/includes/appbarOpen.ftl Tue Sep 30 06:20:29 2014 @@ -24,7 +24,7 @@ under the License. <#assign displayApps = Static["org.ofbiz.webapp.control.LoginWorker"].getAppBarWebInfos(security, userLogin, ofbizServerName, "main")> <#assign displaySecondaryApps = Static["org.ofbiz.webapp.control.LoginWorker"].getAppBarWebInfos(security, userLogin, ofbizServerName, "secondary")> -<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName,delegator,dispatcher)> +<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName)> <#if appModelMenu.getModelMenuItemByName(headerItem)??> <#if headerItem!="main"> <#assign show_last_menu = true> Modified: ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl (original) +++ ofbiz/trunk/themes/tomahawk/includes/appbarClose.ftl Tue Sep 30 06:20:29 2014 @@ -16,7 +16,7 @@ KIND, either express or implied. See th specific language governing permissions and limitations under the License. --> -<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName,delegator,dispatcher)> +<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName)> <#if person?has_content> <#assign userName = (person.firstName!) + " " + (person.middleName!) + " " + person.lastName!> <#elseif partyGroup?has_content> Modified: ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl?rev=1628361&r1=1628360&r2=1628361&view=diff ============================================================================== --- ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl (original) +++ ofbiz/trunk/themes/tomahawk/includes/appbarOpen.ftl Tue Sep 30 06:20:29 2014 @@ -24,7 +24,7 @@ under the License. <#assign displayApps = Static["org.ofbiz.webapp.control.LoginWorker"].getAppBarWebInfos(security, userLogin, ofbizServerName, "main")> <#assign displaySecondaryApps = Static["org.ofbiz.webapp.control.LoginWorker"].getAppBarWebInfos(security, userLogin, ofbizServerName, "secondary")> -<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName,delegator,dispatcher)> +<#assign appModelMenu = Static["org.ofbiz.widget.menu.MenuFactory"].getMenuFromLocation(applicationMenuLocation,applicationMenuName)> <#if appModelMenu.getModelMenuItemByName(headerItem)??> <#if headerItem!="main"> <#assign show_last_menu = true>