Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormFieldBuilder.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormFieldBuilder.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormFieldBuilder.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelFormFieldBuilder.java Sun Dec 17 11:07:31 2017 @@ -168,10 +168,11 @@ public class ModelFormFieldBuilder { String subElementName = UtilXml.getTagNameIgnorePrefix(subElement); if ("on-field-event-update-area".equals(subElementName)) { UpdateArea updateArea = new UpdateArea(subElement); - if ("change".equals(updateArea.getEventType())) + if ("change".equals(updateArea.getEventType())) { onChangeUpdateAreas.add(updateArea); - else if ("click".equals(updateArea.getEventType())) + } else if ("click".equals(updateArea.getEventType())) { onClickUpdateAreas.add(updateArea); + } } else { if (this.fieldType != null) { throw new IllegalArgumentException("Multiple field types found: " + this.fieldType + ", " + subElementName); @@ -182,58 +183,59 @@ public class ModelFormFieldBuilder { } if (UtilValidate.isEmpty(this.fieldType)) { this.induceFieldInfo(modelForm, null, entityModelReader, dispatchContext); - } else if ("display".equals(this.fieldType)) + } else if ("display".equals(this.fieldType)) { this.fieldInfo = new DisplayField(childElement, null); - else if ("display-entity".equals(this.fieldType)) + } else if ("display-entity".equals(this.fieldType)) { this.fieldInfo = new DisplayEntityField(childElement, null); - else if ("hyperlink".equals(this.fieldType)) + } else if ("hyperlink".equals(this.fieldType)) { this.fieldInfo = new HyperlinkField(childElement, null); - else if ("text".equals(this.fieldType)) + } else if ("text".equals(this.fieldType)) { this.fieldInfo = new TextField(childElement, null); - else if ("textarea".equals(this.fieldType)) + } else if ("textarea".equals(this.fieldType)) { this.fieldInfo = new TextareaField(childElement, null); - else if ("date-time".equals(this.fieldType)) + } else if ("date-time".equals(this.fieldType)) { this.fieldInfo = new DateTimeField(childElement, null); - else if ("drop-down".equals(this.fieldType)) + } else if ("drop-down".equals(this.fieldType)) { this.fieldInfo = new DropDownField(childElement, null); - else if ("check".equals(this.fieldType)) + } else if ("check".equals(this.fieldType)) { this.fieldInfo = new CheckField(childElement, null); - else if ("radio".equals(this.fieldType)) + } else if ("radio".equals(this.fieldType)) { this.fieldInfo = new RadioField(childElement, null); - else if ("submit".equals(this.fieldType)) + } else if ("submit".equals(this.fieldType)) { this.fieldInfo = new SubmitField(childElement, null); - else if ("reset".equals(this.fieldType)) + } else if ("reset".equals(this.fieldType)) { this.fieldInfo = new ResetField(childElement, null); - else if ("hidden".equals(this.fieldType)) + } else if ("hidden".equals(this.fieldType)) { this.fieldInfo = new HiddenField(childElement, null); - else if ("ignored".equals(this.fieldType)) + } else if ("ignored".equals(this.fieldType)) { this.fieldInfo = new IgnoredField(childElement, null); - else if ("text-find".equals(this.fieldType)) + } else if ("text-find".equals(this.fieldType)) { this.fieldInfo = new TextFindField(childElement, null); - else if ("date-find".equals(this.fieldType)) + } else if ("date-find".equals(this.fieldType)) { this.fieldInfo = new DateFindField(childElement, null); - else if ("range-find".equals(this.fieldType)) + } else if ("range-find".equals(this.fieldType)) { this.fieldInfo = new RangeFindField(childElement, null); - else if ("lookup".equals(this.fieldType)) + } else if ("lookup".equals(this.fieldType)) { this.fieldInfo = new LookupField(childElement, null); - else if ("include-menu".equals(this.fieldType)) + } else if ("include-menu".equals(this.fieldType)) { this.fieldInfo = new MenuField(childElement, null); - else if ("include-form".equals(this.fieldType)) + } else if ("include-form".equals(this.fieldType)) { this.fieldInfo = new FormField(childElement, null); - else if ("include-grid".equals(this.fieldType)) + } else if ("include-grid".equals(this.fieldType)) { this.fieldInfo = new GridField(childElement, null); - else if ("include-screen".equals(this.fieldType)) + } else if ("include-screen".equals(this.fieldType)) { this.fieldInfo = new ScreenField(childElement, null); - else if ("file".equals(this.fieldType)) + } else if ("file".equals(this.fieldType)) { this.fieldInfo = new FileField(childElement, null); - else if ("password".equals(this.fieldType)) + } else if ("password".equals(this.fieldType)) { this.fieldInfo = new PasswordField(childElement, null); - else if ("image".equals(this.fieldType)) + } else if ("image".equals(this.fieldType)) { this.fieldInfo = new ImageField(childElement, null); - else if ("container".equals(this.fieldType)) + } else if ("container".equals(this.fieldType)) { this.fieldInfo = new ContainerField(childElement, null); - else + } else { throw new IllegalArgumentException("The field sub-element with name " + this.fieldType + " is not supported"); + } } public ModelFormFieldBuilder(ModelFormField modelFormField) { @@ -493,16 +495,19 @@ public class ModelFormFieldBuilder { } private boolean induceFieldInfo(ModelForm modelForm, String defaultFieldType, ModelReader entityModelReader, DispatchContext dispatchContext) { - if (induceFieldInfoFromEntityField(defaultFieldType, entityModelReader)) + if (induceFieldInfoFromEntityField(defaultFieldType, entityModelReader)) { return true; - if (induceFieldInfoFromServiceParam(defaultFieldType, entityModelReader, dispatchContext)) + } + if (induceFieldInfoFromServiceParam(defaultFieldType, entityModelReader, dispatchContext)) { return true; + } return false; } public boolean induceFieldInfoFromEntityField(ModelEntity modelEntity, ModelField modelField, String defaultFieldType) { - if (modelEntity == null || modelField == null) + if (modelEntity == null || modelField == null) { return false; + } this.entityName = modelEntity.getEntityName(); this.fieldName = modelField.getName(); if ("find".equals(defaultFieldType)) { @@ -612,8 +617,9 @@ public class ModelFormFieldBuilder { } private boolean induceFieldInfoFromEntityField(String defaultFieldType, ModelReader entityModelReader) { - if (UtilValidate.isEmpty(this.getEntityName()) || UtilValidate.isEmpty(this.getFieldName())) + if (UtilValidate.isEmpty(this.getEntityName()) || UtilValidate.isEmpty(this.getFieldName())) { return false; + } try { ModelEntity modelEntity = entityModelReader.getModelEntity(this.getEntityName()); ModelField modelField = modelEntity.getField(this.getFieldName()); @@ -629,8 +635,9 @@ public class ModelFormFieldBuilder { } public boolean induceFieldInfoFromServiceParam(ModelService modelService, ModelParam modelParam, String defaultFieldType) { - if (modelService == null || modelParam == null) + if (modelService == null || modelParam == null) { return false; + } this.serviceName = modelService.name; this.attributeName = modelParam.name; if ("find".equals(defaultFieldType)) { @@ -686,8 +693,9 @@ public class ModelFormFieldBuilder { private boolean induceFieldInfoFromServiceParam(String defaultFieldType, ModelReader entityModelReader, DispatchContext dispatchContext) { - if (UtilValidate.isEmpty(this.getServiceName()) || UtilValidate.isEmpty(this.getAttributeName())) + if (UtilValidate.isEmpty(this.getServiceName()) || UtilValidate.isEmpty(this.getAttributeName())) { return false; + } try { ModelService modelService = dispatchContext.getModelService(this.getServiceName()); ModelParam modelParam = modelService.getParam(this.getAttributeName()); @@ -712,66 +720,96 @@ public class ModelFormFieldBuilder { } public void mergeOverrideModelFormField(ModelFormFieldBuilder builder) { - if (builder == null) + if (builder == null) { return; - if (UtilValidate.isNotEmpty(builder.getName())) + } + if (UtilValidate.isNotEmpty(builder.getName())) { this.name = builder.getName(); - if (UtilValidate.isNotEmpty(builder.getMapAcsr())) + } + if (UtilValidate.isNotEmpty(builder.getMapAcsr())) { this.mapAcsr = builder.getMapAcsr(); - if (UtilValidate.isNotEmpty(builder.getEntityName())) + } + if (UtilValidate.isNotEmpty(builder.getEntityName())) { this.entityName = builder.getEntityName(); - if (UtilValidate.isNotEmpty(builder.getServiceName())) + } + if (UtilValidate.isNotEmpty(builder.getServiceName())) { this.serviceName = builder.getServiceName(); - if (UtilValidate.isNotEmpty(builder.getEntryAcsr())) + } + if (UtilValidate.isNotEmpty(builder.getEntryAcsr())) { this.entryAcsr = builder.getEntryAcsr(); - if (UtilValidate.isNotEmpty(builder.getParameterName())) + } + if (UtilValidate.isNotEmpty(builder.getParameterName())) { this.parameterName = builder.getParameterName(); - if (UtilValidate.isNotEmpty(builder.getFieldName())) + } + if (UtilValidate.isNotEmpty(builder.getFieldName())) { this.fieldName = builder.getFieldName(); - if (!builder.getAttributeName().isEmpty()) + } + if (!builder.getAttributeName().isEmpty()) { this.attributeName = builder.getAttributeName(); - if (UtilValidate.isNotEmpty(builder.getTitle())) + } + if (UtilValidate.isNotEmpty(builder.getTitle())) { this.title = builder.getTitle(); - if (UtilValidate.isNotEmpty(builder.getTooltip())) + } + if (UtilValidate.isNotEmpty(builder.getTooltip())) { this.tooltip = builder.getTooltip(); - if (builder.getSortField() != null) + } + if (builder.getSortField() != null) { this.sortField = builder.getSortField(); - if (UtilValidate.isNotEmpty(builder.getSortFieldHelpText())) + } + if (UtilValidate.isNotEmpty(builder.getSortFieldHelpText())) { this.sortFieldHelpText = builder.getSortFieldHelpText(); - if (UtilValidate.isNotEmpty(builder.getTitleAreaStyle())) + } + if (UtilValidate.isNotEmpty(builder.getTitleAreaStyle())) { this.titleAreaStyle = builder.getTitleAreaStyle(); - if (UtilValidate.isNotEmpty(builder.getWidgetAreaStyle())) + } + if (UtilValidate.isNotEmpty(builder.getWidgetAreaStyle())) { this.widgetAreaStyle = builder.getWidgetAreaStyle(); - if (UtilValidate.isNotEmpty(builder.getTitleStyle())) + } + if (UtilValidate.isNotEmpty(builder.getTitleStyle())) { this.titleStyle = builder.getTitleStyle(); - if (UtilValidate.isNotEmpty(builder.getWidgetStyle())) + } + if (UtilValidate.isNotEmpty(builder.getWidgetStyle())) { this.widgetStyle = builder.getWidgetStyle(); - if (UtilValidate.isNotEmpty(builder.getRedWhen())) + } + if (UtilValidate.isNotEmpty(builder.getRedWhen())) { this.redWhen = builder.getRedWhen(); - if (UtilValidate.isNotEmpty(builder.getEvent())) + } + if (UtilValidate.isNotEmpty(builder.getEvent())) { this.event = builder.getEvent(); - if (!builder.getAction().isEmpty()) + } + if (!builder.getAction().isEmpty()) { this.action = builder.getAction(); - if (UtilValidate.isNotEmpty(builder.getUseWhen())) + } + if (UtilValidate.isNotEmpty(builder.getUseWhen())) { this.useWhen = builder.getUseWhen(); - if (UtilValidate.isNotEmpty(builder.getIgnoreWhen())) + } + if (UtilValidate.isNotEmpty(builder.getIgnoreWhen())) { this.ignoreWhen = builder.getIgnoreWhen(); - if (builder.getFieldInfo() != null) + } + if (builder.getFieldInfo() != null) { this.setFieldInfo(builder.getFieldInfo()); - if (UtilValidate.isNotEmpty(builder.getHeaderLink())) + } + if (UtilValidate.isNotEmpty(builder.getHeaderLink())) { this.headerLink = builder.getHeaderLink(); - if (UtilValidate.isNotEmpty(builder.getHeaderLinkStyle())) + } + if (UtilValidate.isNotEmpty(builder.getHeaderLinkStyle())) { this.headerLinkStyle = builder.getHeaderLinkStyle(); - if (UtilValidate.isNotEmpty(builder.getIdName())) + } + if (UtilValidate.isNotEmpty(builder.getIdName())) { this.idName = builder.getIdName(); - if (UtilValidate.isNotEmpty(builder.getOnChangeUpdateAreas())) + } + if (UtilValidate.isNotEmpty(builder.getOnChangeUpdateAreas())) { this.onChangeUpdateAreas.addAll(builder.getOnChangeUpdateAreas()); - if (UtilValidate.isNotEmpty(builder.getOnClickUpdateAreas())) + } + if (UtilValidate.isNotEmpty(builder.getOnClickUpdateAreas())) { this.onClickUpdateAreas.addAll(builder.getOnClickUpdateAreas()); - if (UtilValidate.isNotEmpty(builder.getParentFormName())) + } + if (UtilValidate.isNotEmpty(builder.getParentFormName())) { this.parentFormName = builder.getParentFormName(); - if (UtilValidate.isNotEmpty(builder.getTabindex())) + } + if (UtilValidate.isNotEmpty(builder.getTabindex())) { this.tabindex = builder.getTabindex(); + } this.encodeOutput = builder.getEncodeOutput(); this.position = builder.getPosition(); this.requiredField = builder.getRequiredField(); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelGrid.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelGrid.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelGrid.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelGrid.java Sun Dec 17 11:07:31 2017 @@ -28,7 +28,7 @@ import org.w3c.dom.Element; /** * Models the <grid> element. - * + * * @see <code>widget-form.xsd</code> */ @SuppressWarnings("serial") @@ -38,14 +38,14 @@ public class ModelGrid extends ModelForm * ----------------------------------------------------------------------- * * DEVELOPERS PLEASE READ * ----------------------------------------------------------------------- * - * + * * This model is intended to be a read-only data structure that represents * an XML element. Outside of object construction, the class should not * have any behaviors. All behavior should be contained in model visitors. - * + * * Instances of this class will be shared by multiple threads - therefore * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME! - * + * */ public static final String module = ModelGrid.class.getName(); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenu.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenu.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenu.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenu.java Sun Dec 17 11:07:31 2017 @@ -35,7 +35,7 @@ import org.w3c.dom.Element; /** * Models the <menu> element. - * + * * @see <code>widget-menu.xsd</code> */ @SuppressWarnings("serial") @@ -45,14 +45,14 @@ public class ModelMenu extends ModelWidg * ----------------------------------------------------------------------- * * DEVELOPERS PLEASE READ * ----------------------------------------------------------------------- * - * + * * This model is intended to be a read-only data structure that represents * an XML element. Outside of object construction, the class should not * have any behaviors. - * + * * Instances of this class will be shared by multiple threads - therefore * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME! - * + * */ public static final String module = ModelMenu.class.getName(); @@ -192,58 +192,83 @@ public class ModelMenu extends ModelWidg } } } - if (!menuElement.getAttribute("type").isEmpty()) + if (!menuElement.getAttribute("type").isEmpty()) { type = menuElement.getAttribute("type"); - if (!menuElement.getAttribute("target").isEmpty()) + } + if (!menuElement.getAttribute("target").isEmpty()) { target = menuElement.getAttribute("target"); - if (!menuElement.getAttribute("id").isEmpty()) + } + if (!menuElement.getAttribute("id").isEmpty()) { id = menuElement.getAttribute("id"); - if (!menuElement.getAttribute("title").isEmpty()) + } + if (!menuElement.getAttribute("title").isEmpty()) { title = FlexibleStringExpander.getInstance(menuElement.getAttribute("title")); - if (!menuElement.getAttribute("tooltip").isEmpty()) + } + if (!menuElement.getAttribute("tooltip").isEmpty()) { tooltip = menuElement.getAttribute("tooltip"); - if (!menuElement.getAttribute("default-entity-name").isEmpty()) + } + if (!menuElement.getAttribute("default-entity-name").isEmpty()) { defaultEntityName = menuElement.getAttribute("default-entity-name"); - if (!menuElement.getAttribute("default-title-style").isEmpty()) + } + if (!menuElement.getAttribute("default-title-style").isEmpty()) { defaultTitleStyle = menuElement.getAttribute("default-title-style"); - if (!menuElement.getAttribute("default-selected-style").isEmpty()) + } + if (!menuElement.getAttribute("default-selected-style").isEmpty()) { defaultSelectedStyle = menuElement.getAttribute("default-selected-style"); - if (!menuElement.getAttribute("default-widget-style").isEmpty()) + } + if (!menuElement.getAttribute("default-widget-style").isEmpty()) { defaultWidgetStyle = menuElement.getAttribute("default-widget-style"); - if (!menuElement.getAttribute("default-tooltip-style").isEmpty()) + } + if (!menuElement.getAttribute("default-tooltip-style").isEmpty()) { defaultTooltipStyle = menuElement.getAttribute("default-tooltip-style"); - if (!menuElement.getAttribute("default-menu-item-name").isEmpty()) + } + if (!menuElement.getAttribute("default-menu-item-name").isEmpty()) { defaultMenuItemName = menuElement.getAttribute("default-menu-item-name"); - if (!menuElement.getAttribute("default-permission-operation").isEmpty()) + } + if (!menuElement.getAttribute("default-permission-operation").isEmpty()) { defaultPermissionOperation = menuElement.getAttribute("default-permission-operation"); - if (!menuElement.getAttribute("default-permission-entity-action").isEmpty()) + } + if (!menuElement.getAttribute("default-permission-entity-action").isEmpty()) { defaultPermissionEntityAction = menuElement.getAttribute("default-permission-entity-action"); - if (!menuElement.getAttribute("default-associated-content-id").isEmpty()) + } + if (!menuElement.getAttribute("default-associated-content-id").isEmpty()) { defaultAssociatedContentId = FlexibleStringExpander.getInstance(menuElement .getAttribute("default-associated-content-id")); - if (!menuElement.getAttribute("orientation").isEmpty()) + } + if (!menuElement.getAttribute("orientation").isEmpty()) { orientation = menuElement.getAttribute("orientation"); - if (!menuElement.getAttribute("menu-width").isEmpty()) + } + if (!menuElement.getAttribute("menu-width").isEmpty()) { menuWidth = menuElement.getAttribute("menu-width"); - if (!menuElement.getAttribute("default-cell-width").isEmpty()) + } + if (!menuElement.getAttribute("default-cell-width").isEmpty()) { defaultCellWidth = menuElement.getAttribute("default-cell-width"); - if (!menuElement.getAttribute("default-hide-if-selected").isEmpty()) + } + if (!menuElement.getAttribute("default-hide-if-selected").isEmpty()) { defaultHideIfSelected = "true".equals(menuElement.getAttribute("default-hide-if-selected")); - if (!menuElement.getAttribute("default-disabled-title-style").isEmpty()) + } + if (!menuElement.getAttribute("default-disabled-title-style").isEmpty()) { defaultDisabledTitleStyle = menuElement.getAttribute("default-disabled-title-style"); - if (!menuElement.getAttribute("selected-menuitem-context-field-name").isEmpty()) + } + if (!menuElement.getAttribute("selected-menuitem-context-field-name").isEmpty()) { selectedMenuItemContextFieldName = FlexibleMapAccessor.getInstance(menuElement .getAttribute("selected-menuitem-context-field-name")); - if (!menuElement.getAttribute("menu-container-style").isEmpty()) + } + if (!menuElement.getAttribute("menu-container-style").isEmpty()) { menuContainerStyleExdr = FlexibleStringExpander.getInstance(menuElement.getAttribute("menu-container-style")); - if (!menuElement.getAttribute("default-align").isEmpty()) + } + if (!menuElement.getAttribute("default-align").isEmpty()) { defaultAlign = menuElement.getAttribute("default-align"); - if (!menuElement.getAttribute("default-align-style").isEmpty()) + } + if (!menuElement.getAttribute("default-align-style").isEmpty()) { defaultAlignStyle = menuElement.getAttribute("default-align-style"); - if (!menuElement.getAttribute("fill-style").isEmpty()) + } + if (!menuElement.getAttribute("fill-style").isEmpty()) { fillStyle = menuElement.getAttribute("fill-style"); - if (!menuElement.getAttribute("extra-index").isEmpty()) + } + if (!menuElement.getAttribute("extra-index").isEmpty()) { extraIndex = FlexibleStringExpander.getInstance(menuElement.getAttribute("extra-index")); + } // read all actions under the "actions" element Element actionsElement = UtilXml.firstChildElement(menuElement, "actions"); if (actionsElement != null) { @@ -477,8 +502,9 @@ public class ModelMenu extends ModelWidg public int renderedMenuItemCount(Map<String, Object> context) { int count = 0; for (ModelMenuItem item : this.menuItemList) { - if (item.shouldBeRendered(context)) + if (item.shouldBeRendered(context)) { count++; + } } return count; } @@ -531,4 +557,4 @@ public class ModelMenu extends ModelWidg public void runActions(Map<String, Object> context) { AbstractModelAction.runSubActions(this.actions, context); } -} +} \ No newline at end of file Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuAction.java Sun Dec 17 11:07:31 2017 @@ -62,7 +62,7 @@ public abstract class ModelMenuAction { /** * Models the <set> element. - * + * * @see <code>widget-common.xsd</code> */ @SuppressWarnings("serial") @@ -106,7 +106,9 @@ public abstract class ModelMenuAction { String newKey = currentWidgetTrail + "|" + originalName; HttpSession session = (HttpSession)context.get("session"); newValue = session.getAttribute(newKey); - if (Debug.verboseOn()) Debug.logVerbose("In user getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, module); + if (Debug.verboseOn()) { + Debug.logVerbose("In user getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, module); + } } else if (!this.valueExdr.isEmpty()) { newValue = this.valueExdr.expandString(context); } @@ -118,7 +120,9 @@ public abstract class ModelMenuAction { String newKey = currentWidgetTrail + "|" + originalName; ServletContext servletContext = (ServletContext)context.get("application"); newValue = servletContext.getAttribute(newKey); - if (Debug.verboseOn()) Debug.logVerbose("In application getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, module); + if (Debug.verboseOn()) { + Debug.logVerbose("In application getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, module); + } } else if (!this.valueExdr.isEmpty()) { newValue = this.valueExdr.expandString(context); } @@ -126,7 +130,9 @@ public abstract class ModelMenuAction { } else { if (!this.fromField.isEmpty()) { newValue = this.fromField.get(context); - if (Debug.verboseOn()) Debug.logVerbose("In screen getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, module); + if (Debug.verboseOn()) { + Debug.logVerbose("In screen getting value for field from [" + this.fromField.getOriginalName() + "]: " + newValue, module); + } } else if (!this.valueExdr.isEmpty()) { newValue = this.valueExdr.expandString(context); } @@ -160,7 +166,9 @@ public abstract class ModelMenuAction { String newKey = currentWidgetTrail + "|" + originalName; HttpSession session = (HttpSession)context.get("session"); session.setAttribute(newKey, newValue); - if (Debug.verboseOn()) Debug.logVerbose("In user setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, module); + if (Debug.verboseOn()) { + Debug.logVerbose("In user setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, module); + } } else if (this.toScope != null && "application".equals(this.toScope)) { String originalName = this.field.getOriginalName(); @@ -168,10 +176,14 @@ public abstract class ModelMenuAction { String newKey = currentWidgetTrail + "|" + originalName; ServletContext servletContext = (ServletContext)context.get("application"); servletContext.setAttribute(newKey, newValue); - if (Debug.verboseOn()) Debug.logVerbose("In application setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, module); + if (Debug.verboseOn()) { + Debug.logVerbose("In application setting value for field from [" + this.field.getOriginalName() + "]: " + newValue, module); + } } else { - if (Debug.verboseOn()) Debug.logVerbose("In screen setting field [" + this.field.getOriginalName() + "] to value: " + newValue, module); + if (Debug.verboseOn()) { + Debug.logVerbose("In screen setting field [" + this.field.getOriginalName() + "] to value: " + newValue, module); + } this.field.put(context, newValue); } @@ -220,7 +232,4 @@ public abstract class ModelMenuAction { return fromScope; } } -} - - - +} \ No newline at end of file Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuCondition.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuCondition.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuCondition.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuCondition.java Sun Dec 17 11:07:31 2017 @@ -23,7 +23,7 @@ import org.w3c.dom.Element; /** * Models the <condition> element. - * + * * @see <code>widget-menu.xsd</code> */ public final class ModelMenuCondition { @@ -32,14 +32,14 @@ public final class ModelMenuCondition { * ----------------------------------------------------------------------- * * DEVELOPERS PLEASE READ * ----------------------------------------------------------------------- * - * + * * This model is intended to be a read-only data structure that represents * an XML element. Outside of object construction, the class should not * have any behaviors. - * + * * Instances of this class will be shared by multiple threads - therefore * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME! - * + * */ public static final String module = ModelMenuCondition.class.getName(); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuItem.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuItem.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuItem.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelMenuItem.java Sun Dec 17 11:07:31 2017 @@ -42,7 +42,7 @@ import org.w3c.dom.Element; /** * Models the <menu-item> element. - * + * * @see <code>widget-menu.xsd</code> */ @SuppressWarnings("serial") @@ -52,14 +52,14 @@ public class ModelMenuItem extends Model * ----------------------------------------------------------------------- * * DEVELOPERS PLEASE READ * ----------------------------------------------------------------------- * - * + * * This model is intended to be a read-only data structure that represents * an XML element. Outside of object construction, the class should not * have any behaviors. - * + * * Instances of this class will be shared by multiple threads - therefore * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME! - * + * */ public static final String module = ModelMenuItem.class.getName(); @@ -109,13 +109,15 @@ public class ModelMenuItem extends Model this.tooltipStyle = menuItemElement.getAttribute("tooltip-style"); this.selectedStyle = menuItemElement.getAttribute("selected-style"); String hideIfSelected = menuItemElement.getAttribute("hide-if-selected"); - if (!hideIfSelected.isEmpty()) - if ("true".equalsIgnoreCase(hideIfSelected)) + if (!hideIfSelected.isEmpty()) { + if ("true".equalsIgnoreCase(hideIfSelected)) { this.hideIfSelected = Boolean.TRUE; - else + } else { this.hideIfSelected = Boolean.FALSE; - else + } + } else { this.hideIfSelected = null; + } this.disableIfEmpty = menuItemElement.getAttribute("disable-if-empty"); this.align = menuItemElement.getAttribute("align"); this.alignStyle = menuItemElement.getAttribute("align-style"); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenCondition.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenCondition.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenCondition.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenCondition.java Sun Dec 17 11:07:31 2017 @@ -27,7 +27,7 @@ import org.w3c.dom.Element; /** * Models the <condition> element. - * + * * @see <code>widget-screen.xsd</code> */ @SuppressWarnings("serial") @@ -37,14 +37,14 @@ public final class ModelScreenCondition * ----------------------------------------------------------------------- * * DEVELOPERS PLEASE READ * ----------------------------------------------------------------------- * - * + * * This model is intended to be a read-only data structure that represents * an XML element. Outside of object construction, the class should not * have any behaviors. - * + * * Instances of this class will be shared by multiple threads - therefore * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME! - * + * */ public static final String module = ModelScreenCondition.class.getName(); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelScreenWidget.java Sun Dec 17 11:07:31 2017 @@ -71,7 +71,9 @@ public abstract class ModelScreenWidget public ModelScreenWidget(ModelScreen modelScreen, Element widgetElement) { super(widgetElement); this.modelScreen = modelScreen; - if (Debug.verboseOn()) Debug.logVerbose("Reading Screen sub-widget with name: " + widgetElement.getNodeName(), module); + if (Debug.verboseOn()) { + Debug.logVerbose("Reading Screen sub-widget with name: " + widgetElement.getNodeName(), module); + } } public abstract void renderWidgetString(Appendable writer, Map<String, Object> context, ScreenStringRenderer screenStringRenderer) throws GeneralException, IOException; @@ -92,7 +94,9 @@ public abstract class ModelScreenWidget return; } for (ModelScreenWidget subWidget: subWidgets) { - if (Debug.verboseOn()) Debug.logVerbose("Rendering screen " + subWidget.getModelScreen().getName() + "; widget class is " + subWidget.getClass().getName(), module); + if (Debug.verboseOn()) { + Debug.logVerbose("Rendering screen " + subWidget.getModelScreen().getName() + "; widget class is " + subWidget.getClass().getName(), module); + } // render the sub-widget itself subWidget.renderWidgetString(writer, context, screenStringRenderer); @@ -588,8 +592,9 @@ public abstract class ModelScreenWidget Map<String, Object> requestParameters = UtilGenerics.checkMap(context.get("requestParameters")); if (requestParameters != null) { String collapsedParam = (String) requestParameters.get(preferenceKey); - if (collapsedParam != null) + if (collapsedParam != null) { collapsed = "true".equals(collapsedParam); + } } } try { @@ -772,7 +777,9 @@ public abstract class ModelScreenWidget String location = this.getLocation(context); if (name.isEmpty()) { - if (Debug.verboseOn()) Debug.logVerbose("In the include-screen tag the screen name was empty, ignoring include; in screen [" + getModelScreen().getName() + "]", module); + if (Debug.verboseOn()) { + Debug.logVerbose("In the include-screen tag the screen name was empty, ignoring include; in screen [" + getModelScreen().getName() + "]", module); + } return; } @@ -1232,15 +1239,7 @@ public abstract class ModelScreenWidget ModelTree modelTree = null; try { modelTree = TreeFactory.getTreeFromLocation(this.getLocation(context), this.getName(context), getModelScreen().getDelegator(context), getModelScreen().getDispatcher(context)); - } catch (IOException e) { - String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString(); - Debug.logError(e, errMsg, module); - throw new RuntimeException(errMsg); - } catch (SAXException e) { - String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString(); - Debug.logError(e, errMsg, module); - throw new RuntimeException(errMsg); - } catch (ParserConfigurationException e) { + } catch (IOException | SAXException | ParserConfigurationException e) { String errMsg = "Error rendering included tree named [" + name + "] at location [" + location + "]: " + e.toString(); Debug.logError(e, errMsg, module); throw new RuntimeException(errMsg); @@ -1355,11 +1354,13 @@ public abstract class ModelScreenWidget this.enableEditName = FlexibleStringExpander.getInstance(subContentElement.getAttribute("enable-edit-name")); this.xmlEscape = "true".equals(subContentElement.getAttribute("xml-escape")); String width = subContentElement.getAttribute("width"); - if (width.isEmpty()) + if (width.isEmpty()) { width = "60%"; + } this.height = subContentElement.getAttribute("height"); - if (this.height.isEmpty()) + if (this.height.isEmpty()) { width = "400px"; + } this.width = width; this.border = subContentElement.getAttribute("border"); } @@ -1394,7 +1395,9 @@ public abstract class ModelScreenWidget return; } if (content != null) { - if (content.get("dataResourceId") != null) expandedDataResourceId = content.getString("dataResourceId"); + if (content.get("dataResourceId") != null) { + expandedDataResourceId = content.getString("dataResourceId"); + } } else { String errMsg = "Could not find content with contentId [" + expandedContentId + "] "; Debug.logError(errMsg, module); @@ -1422,16 +1425,11 @@ public abstract class ModelScreenWidget screenStringRenderer.renderContentEnd(writer, context, this); } UtilGenerics.<MapStack<String>>cast(context).pop(); - } catch (IOException e) { + } catch (IOException | GenericEntityException e) { String errMsg = "Error rendering content with contentId [" + getContentId(context) + "]: " + e.toString(); Debug.logError(e, errMsg, module); throw new RuntimeException(errMsg); - } catch (GenericEntityException e) { - String errMsg = "Error obtaining content with contentId [" + getContentId(context) + "]: " + e.toString(); - Debug.logError(e, errMsg, module); - throw new RuntimeException(errMsg); } - } public String getContentId(Map<String, Object> context) { @@ -1559,7 +1557,7 @@ public abstract class ModelScreenWidget @Override public void accept(ModelWidgetVisitor visitor) throws Exception { // TODO Auto-generated method stub - + } } @@ -1911,19 +1909,19 @@ public abstract class ModelScreenWidget .orderBy("columnSeqId") .cache(true) .queryList(); - + // Renders the portalPage header screenStringRenderer.renderPortalPageBegin(writer, context, this); - + // First column has no previous column String prevColumnSeqId = ""; - + // Iterates through the PortalPage columns ListIterator <GenericValue>columnsIterator = portalPageColumns.listIterator(); while(columnsIterator.hasNext()) { GenericValue columnValue = columnsIterator.next(); String columnSeqId = columnValue.getString("columnSeqId"); - + // Renders the portalPageColumn header screenStringRenderer.renderPortalPageColumnBegin(writer, context, this, columnValue); @@ -1942,7 +1940,7 @@ public abstract class ModelScreenWidget if (columnsIterator.hasNext()) { nextColumnSeqId = portalPageColumns.get(columnsIterator.nextIndex()).getString("columnSeqId"); } - + // Iterates through the Portlets in the Column ListIterator <GenericValue>portletsIterator = portalPagePortlets.listIterator(); while(portletsIterator.hasNext()) { @@ -1963,19 +1961,19 @@ public abstract class ModelScreenWidget context.put("nextPortletSeqId", nextPortletSeqId); context.put("prevColumnSeqId", prevColumnSeqId); context.put("nextColumnSeqId", nextColumnSeqId); - + // Get portlet's attributes portletAttributes = EntityQuery.use(delegator) .from("PortletAttribute") .where("portalPageId", portletValue.get("portalPageId"), "portalPortletId", portletValue.get("portalPortletId"), "portletSeqId", portletValue.get("portletSeqId")) .queryList(); - + ListIterator <GenericValue>attributesIterator = portletAttributes.listIterator(); while (attributesIterator.hasNext()) { GenericValue attribute = attributesIterator.next(); context.put(attribute.getString("attrName"), attribute.getString("attrValue")); } - + // Renders the portalPagePortlet screenStringRenderer.renderPortalPagePortletBegin(writer, context, this, portletValue); screenStringRenderer.renderPortalPagePortletBody(writer, context, this, portletValue); @@ -1986,7 +1984,7 @@ public abstract class ModelScreenWidget GenericValue attribute = attributesIterator.previous(); context.remove(attribute.getString("attrName")); } - + // Uses the actual portlet as prevPortlet for next iteration prevPortletId = (String) portletValue.get("portalPortletId"); prevPortletSeqId = (String) portletValue.get("portletSeqId"); @@ -1999,14 +1997,10 @@ public abstract class ModelScreenWidget } // Renders the portalPage footer screenStringRenderer.renderPortalPageEnd(writer, context, this); - } catch (IOException e) { + } catch (IOException | GenericEntityException e) { String errMsg = "Error rendering PortalPage with portalPageId [" + getId(context) + "]: " + e.toString(); Debug.logError(e, errMsg, module); throw new RuntimeException(errMsg); - } catch (GenericEntityException e) { - String errMsg = "Error obtaining PortalPage with portalPageId [" + getId(context) + "]: " + e.toString(); - Debug.logError(e, errMsg, module); - throw new RuntimeException(errMsg); } } @@ -2018,7 +2012,7 @@ public abstract class ModelScreenWidget GenericValue portalPage = getPortalPageValue(context); return portalPage.getString("originalPortalPageId"); } - + public String getActualPortalPageId(Map<String, Object> context) { GenericValue portalPage = getPortalPageValue(context); return portalPage.getString("portalPageId"); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelSingleForm.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelSingleForm.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelSingleForm.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelSingleForm.java Sun Dec 17 11:07:31 2017 @@ -28,7 +28,7 @@ import org.w3c.dom.Element; /** * Models the <form> element. - * + * * @see <code>widget-form.xsd</code> */ @SuppressWarnings("serial") @@ -38,14 +38,14 @@ public class ModelSingleForm extends Mod * ----------------------------------------------------------------------- * * DEVELOPERS PLEASE READ * ----------------------------------------------------------------------- * - * + * * This model is intended to be a read-only data structure that represents * an XML element. Outside of object construction, the class should not * have any behaviors. All behavior should be contained in model visitors. - * + * * Instances of this class will be shared by multiple threads - therefore * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME! - * + * */ public static final String module = ModelSingleForm.class.getName(); Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTheme.java Sun Dec 17 11:07:31 2017 @@ -81,7 +81,6 @@ public class ModelTheme implements Seria */ public ModelTheme(Element themeElement) { this.name = themeElement.getAttribute("name"); - ModelTheme initOriginTheme = null; Map<String, VisualTheme> initVisualThemes = new HashMap<>(); Map<String, Object> initWidgetPropertiesMap = new HashMap<>(); Map<String, Object> initThemePropertiesMap = new HashMap<>(); @@ -157,7 +156,9 @@ public class ModelTheme implements Seria for (Element screen : UtilXml.childElementList(screenPurpose)) { String name = screen.getAttribute("name"); String location = screen.getAttribute("location"); - if (UtilValidate.isEmpty(location)) location = defaultLocation; + if (UtilValidate.isEmpty(location)) { + location = defaultLocation; + } if (UtilValidate.isEmpty(location)) { Debug.logWarning("We can resolve the screen location " + name + " in the theme " + this.name + " so no added it", module); continue; @@ -272,7 +273,7 @@ public class ModelTheme implements Seria * @param property */ private void addThemeProperty(Map<String, Object> initThemePropertiesMap, Element property) { - FlexibleMapAccessor name = FlexibleMapAccessor.getInstance((String) property.getAttribute("name")); + FlexibleMapAccessor<Object> name = FlexibleMapAccessor.getInstance(property.getAttribute("name")); String value = property.getAttribute("value"); String type = property.getAttribute("type"); if (UtilValidate.isEmpty(type) || type.endsWith("String")) { @@ -287,7 +288,9 @@ public class ModelTheme implements Seria } public Object getProperty(String propertyName) { if (! themePropertiesMap.containsKey(propertyName) - || themePropertiesMap.get(propertyName) == null) return ""; + || themePropertiesMap.get(propertyName) == null) { + return ""; + } return themePropertiesMap.get(propertyName); } @@ -301,48 +304,66 @@ public class ModelTheme implements Seria public String getType(String name) { ModelTemplate modelTemplate = modelTemplateMap.get(name); - if (modelTemplate != null) return modelTemplate.getType(); + if (modelTemplate != null) { + return modelTemplate.getType(); + } return null; } public String getEncoder(String name) { ModelTemplate modelTemplate = modelTemplateMap.get(name); - if (modelTemplate != null) return modelTemplate.getEncoder(); + if (modelTemplate != null) { + return modelTemplate.getEncoder(); + } return null; } public String getCompress(String name) { ModelTemplate modelTemplate = modelTemplateMap.get(name); - if (modelTemplate != null) return modelTemplate.getCompress(); + if (modelTemplate != null) { + return modelTemplate.getCompress(); + } return null; } public String getContentType(String name) { ModelTemplate modelTemplate = modelTemplateMap.get(name); - if (modelTemplate != null) return modelTemplate.getContentType(); + if (modelTemplate != null) { + return modelTemplate.getContentType(); + } return null; } public String getEncoding(String name) { ModelTemplate modelTemplate = modelTemplateMap.get(name); - if (modelTemplate != null) return modelTemplate.getEncoding(); + if (modelTemplate != null) { + return modelTemplate.getEncoding(); + } return null; } public String getScreenRendererLocation(String name) { ModelTemplate modelTemplate = modelTemplateMap.get(name); - if (modelTemplate != null) return modelTemplate.getScreenRendererLocation(); + if (modelTemplate != null) { + return modelTemplate.getScreenRendererLocation(); + } return null; } public String getFormRendererLocation(String name) { ModelTemplate modelTemplate = modelTemplateMap.get(name); - if (modelTemplate != null) return modelTemplate.getFormRendererLocation(); + if (modelTemplate != null) { + return modelTemplate.getFormRendererLocation(); + } return null; } public String getTreeRendererLocation(String name) { ModelTemplate modelTemplate = modelTemplateMap.get(name); - if (modelTemplate != null) return modelTemplate.getTreeRendererLocation(); + if (modelTemplate != null) { + return modelTemplate.getTreeRendererLocation(); + } return null; } public String getMenuRendererLocation(String name) { ModelTemplate modelTemplate = modelTemplateMap.get(name); - if (modelTemplate != null) return modelTemplate.getMenuRendererLocation(); + if (modelTemplate != null) { + return modelTemplate.getMenuRendererLocation(); + } return null; } @@ -353,7 +374,6 @@ public class ModelTheme implements Seria /** * the ModelTemplate class, manage the complexity of macro library definition and the rendering technology */ - @SuppressWarnings("serial") private class ModelTemplate implements Serializable { private final String name; private final String type; Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTree.java Sun Dec 17 11:07:31 2017 @@ -58,7 +58,7 @@ import org.xml.sax.SAXException; /** * Models the <tree> element. - * + * * @see <code>widget-tree.xsd</code> */ @SuppressWarnings("serial") @@ -68,14 +68,14 @@ public class ModelTree extends ModelWidg * ----------------------------------------------------------------------- * * DEVELOPERS PLEASE READ * ----------------------------------------------------------------------- * - * + * * This model is intended to be a read-only data structure that represents * an XML element. Outside of object construction, the class should not * have any behaviors. - * + * * Instances of this class will be shared by multiple threads - therefore * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME! - * + * */ public static final String module = ModelTree.class.getName(); @@ -100,8 +100,9 @@ public class ModelTree extends ModelWidg // A temporary hack to accommodate those who might still be using "render-style" instead of "default-render-style" if (defaultRenderStyle.isEmpty() || "simple".equals(defaultRenderStyle)) { String rStyle = treeElement.getAttribute("render-style"); - if (!rStyle.isEmpty()) + if (!rStyle.isEmpty()) { defaultRenderStyle = rStyle; + } } this.defaultRenderStyle = defaultRenderStyle; this.defaultWrapStyleExdr = FlexibleStringExpander.getInstance(treeElement.getAttribute("default-wrap-style")); @@ -172,10 +173,11 @@ public class ModelTree extends ModelWidg HttpServletRequest request = (HttpServletRequest) context.get("request"); String s1 = request.getRequestURI(); int pos = s1.lastIndexOf('/'); - if (pos >= 0) + if (pos >= 0) { expColReq = s1.substring(pos + 1); - else + } else { expColReq = s1; + } } //append also the request parameters Map<String, Object> paramMap = UtilGenerics.checkMap(context.get("requestParameters")); @@ -239,8 +241,9 @@ public class ModelTree extends ModelWidg List<String> trail = null; if (UtilValidate.isNotEmpty(treeString)) { trail = StringUtil.split(treeString, "|"); - if (UtilValidate.isEmpty(trail)) + if (UtilValidate.isEmpty(trail)) { throw new RuntimeException("Tree 'trail' value is empty."); + } context.put("rootEntityId", trail.get(0)); context.put(getDefaultPkName(context), trail.get(0)); } else { @@ -288,7 +291,7 @@ public class ModelTree extends ModelWidg /** * Models the <node> element. - * + * * @see <code>widget-tree.xsd</code> */ public static class ModelNode extends ModelWidget { @@ -391,9 +394,7 @@ public class ModelTree extends ModelWidg String nodeName = subNode.getNodeName(context); ModelNode node = modelTree.nodeMap.get(nodeName); List<ModelAction> subNodeActions = subNode.getActions(); - //if (Debug.infoOn()) Debug.logInfo(" context.currentValue:" + context.get("currentValue"), module); AbstractModelAction.runSubActions(subNodeActions, context); - // List dataFound = (List)context.get("dataFound"); Iterator<? extends Map<String, ? extends Object>> dataIter = subNode.getListIterator(context); if (dataIter instanceof EntityListIterator) { try (EntityListIterator eli = (EntityListIterator) dataIter) { @@ -444,8 +445,9 @@ public class ModelTree extends ModelWidg } public String getRenderStyle() { - if (this.renderStyle.isEmpty()) + if (this.renderStyle.isEmpty()) { return modelTree.getRenderStyle(); + } return this.renderStyle; } @@ -486,21 +488,6 @@ public class ModelTree extends ModelWidg } if (nodeCount == null && modelField != null || this.modelTree.forceChildCheck) { getChildren(context); - /* - String id = (String)context.get(modelTree.getPkName()); - if (UtilValidate.isNotEmpty(id)) { - try { - int leafCount = ContentManagementWorker.updateStatsTopDown(delegator, id, UtilMisc.toList("SUB_CONTENT", "PUBLISH_LINK")); - GenericValue entity = delegator.findOne(entName, UtilMisc.toMap(modelTree.getPkName(), id), true); - obj = entity.get("childBranchCount"); - if (obj != null) - nodeCount = (Long)obj; - } catch (GenericEntityException e) { - Debug.logError(e, module); - throw new RuntimeException(e.getMessage()); - } - } - */ nodeCount = Long.valueOf(subNodeValues.size()); String pkName = this.getPkName(context); String id = null; @@ -534,8 +521,9 @@ public class ModelTree extends ModelWidg public boolean isExpandCollapse() { boolean isExpCollapse = false; String rStyle = getRenderStyle(); - if (rStyle != null && "expand-collapse".equals(rStyle)) + if (rStyle != null && "expand-collapse".equals(rStyle)) { isExpCollapse = true; + } return isExpCollapse; } @@ -560,7 +548,6 @@ public class ModelTree extends ModelWidg passed = false; } } - //Debug.logInfo("in ModelMenu, name:" + this.getName(), module); if (passed) { List<String> currentNodeTrail = UtilGenerics.toList(context.get("currentNodeTrail")); context.put("processChildren", Boolean.TRUE); @@ -575,15 +562,15 @@ public class ModelTree extends ModelWidg } currentNodeTrail.add(id); treeStringRenderer.renderNodeBegin(writer, context, this, depth); - //if (Debug.infoOn()) Debug.logInfo(" context:" + - // context.entrySet(), module); try { String screenName = null; - if (!screenNameExdr.isEmpty()) + if (!screenNameExdr.isEmpty()) { screenName = screenNameExdr.expandString(context); + } String screenLocation = null; - if (!screenLocationExdr.isEmpty()) + if (!screenLocationExdr.isEmpty()) { screenLocation = screenLocationExdr.expandString(context); + } if (screenName != null && screenLocation != null) { ScreenStringRenderer screenStringRenderer = treeStringRenderer.getScreenStringRenderer(context); ModelScreen modelScreen = ScreenFactory.getScreenFromLocation(screenLocation, screenName); @@ -597,16 +584,12 @@ public class ModelTree extends ModelWidg } treeStringRenderer.renderLastElement(writer, context, this); Boolean processChildren = (Boolean) context.get("processChildren"); - //if (Debug.infoOn()) Debug.logInfo(" processChildren:" + processChildren, module); if (processChildren.booleanValue()) { List<Object[]> subNodeValues = getChildren(context); int newDepth = depth + 1; for (Object[] arr : subNodeValues) { ModelNode node = (ModelNode) arr[0]; Map<String, Object> val = UtilGenerics.checkMap(arr[1]); - //GenericPK pk = val.getPrimaryKey(); - //if (Debug.infoOn()) Debug.logInfo(" pk:" + pk, - // module); String thisPkName = node.getPkName(context); String thisEntityId = (String) val.get(thisPkName); MapStack<String> newContext = MapStack.create(context); @@ -628,27 +611,16 @@ public class ModelTree extends ModelWidg } } } - } catch (ScreenRenderException e) { - String errMsg = "Error rendering included label with name [" + getName() + "] : " + e.toString(); - Debug.logError(e, errMsg, module); - throw new RuntimeException(errMsg); - } catch (SAXException e) { + } catch (ScreenRenderException | SAXException | ParserConfigurationException | IOException e) { String errMsg = "Error rendering included label with name [" + getName() + "] : " + e.toString(); Debug.logError(e, errMsg, module); throw new RuntimeException(errMsg); - } catch (ParserConfigurationException e3) { - String errMsg = "Error rendering included label with name [" + getName() + "] : " + e3.toString(); - Debug.logError(e3, errMsg, module); - throw new RuntimeException(errMsg); - } catch (IOException e2) { - String errMsg = "Error rendering included label with name [" + getName() + "] : " + e2.toString(); - Debug.logError(e2, errMsg, module); - throw new RuntimeException(errMsg); } treeStringRenderer.renderNodeEnd(writer, context, this); int removeIdx = currentNodeTrail.size() - 1; - if (removeIdx >= 0) + if (removeIdx >= 0) { currentNodeTrail.remove(removeIdx); + } } } @@ -657,8 +629,9 @@ public class ModelTree extends ModelWidg List<?> trail = UtilGenerics.checkList(context.get("targetNodeTrail")); int openDepth = modelTree.getOpenDepth(); int postTrailOpenDepth = modelTree.getPostTrailOpenDepth(); - if (trail != null) + if (trail != null) { trailSize = trail.size(); + } boolean showPeers = false; String rStyle = getRenderStyle(); @@ -673,12 +646,13 @@ public class ModelTree extends ModelWidg showPeers = true; } else { int depthAfterTrail = currentDepth - trailSize; - if (depthAfterTrail >= 0 && depthAfterTrail <= postTrailOpenDepth) + if (depthAfterTrail >= 0 && depthAfterTrail <= postTrailOpenDepth) { showPeers = true; + } } return showPeers; } - + public List<ModelAction> getActions() { return actions; } @@ -721,7 +695,7 @@ public class ModelTree extends ModelWidg /** * Models the <image> element. - * + * * @see <code>widget-tree.xsd</code> */ public static class Image { @@ -786,7 +760,7 @@ public class ModelTree extends ModelWidg /** * Models the <label> element. - * + * * @see <code>widget-tree.xsd</code> */ public static final class Label { @@ -845,7 +819,7 @@ public class ModelTree extends ModelWidg /** * Models the <link> element. - * + * * @see <code>widget-tree.xsd</code> */ public static class Link { @@ -1052,7 +1026,7 @@ public class ModelTree extends ModelWidg /** * Models the <sub-node> element. - * + * * @see <code>widget-tree.xsd</code> */ public static class ModelSubNode extends ModelWidget { Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeAction.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeAction.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeAction.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeAction.java Sun Dec 17 11:07:31 2017 @@ -58,14 +58,14 @@ public abstract class ModelTreeAction ex * ----------------------------------------------------------------------- * * DEVELOPERS PLEASE READ * ----------------------------------------------------------------------- * - * + * * This model is intended to be a read-only data structure that represents * an XML element. Outside of object construction, the class should not * have any behaviors. - * + * * Instances of this class will be shared by multiple threads - therefore * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME! - * + * */ public static final String module = ModelTreeAction.class.getName(); @@ -133,7 +133,7 @@ public abstract class ModelTreeAction ex /** * Models the <entity-and> element. - * + * * @see <code>widget-tree.xsd</code> */ public static class EntityAnd extends ModelTreeAction { @@ -144,12 +144,14 @@ public abstract class ModelTreeAction ex super(modelSubNode, entityAndElement); boolean useCache = "true".equalsIgnoreCase(entityAndElement.getAttribute("use-cache")); Document ownerDoc = entityAndElement.getOwnerDocument(); - if (!useCache) + if (!useCache) { UtilXml.addChildElement(entityAndElement, "use-iterator", ownerDoc); + } String listName = UtilFormatOut.checkEmpty(entityAndElement.getAttribute("list"), entityAndElement.getAttribute("list-name")); - if (UtilValidate.isEmpty(listName)) + if (UtilValidate.isEmpty(listName)) { listName = "_LIST_ITERATOR_"; + } this.listName = listName; entityAndElement.setAttribute("list-name", this.listName); finder = new ByAndFinder(entityAndElement); @@ -193,7 +195,7 @@ public abstract class ModelTreeAction ex /** * Models the <entity-condition> element. - * + * * @see <code>widget-tree.xsd</code> */ public static class EntityCondition extends ModelTreeAction { @@ -204,12 +206,14 @@ public abstract class ModelTreeAction ex super(modelSubNode, entityConditionElement); Document ownerDoc = entityConditionElement.getOwnerDocument(); boolean useCache = "true".equalsIgnoreCase(entityConditionElement.getAttribute("use-cache")); - if (!useCache) + if (!useCache) { UtilXml.addChildElement(entityConditionElement, "use-iterator", ownerDoc); + } String listName = UtilFormatOut.checkEmpty(entityConditionElement.getAttribute("list"), entityConditionElement.getAttribute("list-name")); - if (UtilValidate.isEmpty(listName)) + if (UtilValidate.isEmpty(listName)) { listName = "_LIST_ITERATOR_"; + } this.listName = listName; entityConditionElement.setAttribute("list-name", this.listName); finder = new ByConditionFinder(entityConditionElement); @@ -253,7 +257,7 @@ public abstract class ModelTreeAction ex /** * Models the <script> element. - * + * * @see <code>widget-tree.xsd</code> */ public static class Script extends ModelTreeAction { @@ -321,7 +325,7 @@ public abstract class ModelTreeAction ex /** * Models the <service> element. - * + * * @see <code>widget-tree.xsd</code> */ public static class Service extends ModelTreeAction { @@ -410,11 +414,9 @@ public abstract class ModelTreeAction ex Map<String, Object> result = WidgetWorker.getDispatcher(context).runSync(serviceNameExpanded, serviceContext); ModelActionUtil.contextPutQueryStringOrAllResult(context, result, this.resultMapNameAcsr); String resultMapListName = resultMapListNameExdr.expandString(context); - //String resultMapListIteratorName = resultMapListIteratorNameExdr.expandString(context); String resultMapValueName = resultMapValueNameExdr.expandString(context); String valueName = valueNameExdr.expandString(context); if (this.getModelSubNode() != null) { - //ListIterator iter = null; if (UtilValidate.isNotEmpty(resultMapListName)) { List<? extends Map<String, ? extends Object>> lst = UtilGenerics.checkList(result.get(resultMapListName)); if (lst != null) { Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeCondition.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeCondition.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeCondition.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelTreeCondition.java Sun Dec 17 11:07:31 2017 @@ -22,7 +22,7 @@ import org.w3c.dom.Element; /** * Models the <condition> element. - * + * * @see <code>widget-tree.xsd</code> */ public class ModelTreeCondition { Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidget.java Sun Dec 17 11:07:31 2017 @@ -130,7 +130,7 @@ public abstract class ModelWidget implem * rendering context. If <code>widget.verbose</code> is set to <code>false</code> in the * <code>widget.properties</code> file, then that setting will override all other settings and * disable all widget boundary comments. - * + * * @param context Optional context Map */ public static boolean widgetBoundaryCommentsEnabled(Map<String, ? extends Object> context) { Modified: ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java?rev=1818472&r1=1818471&r2=1818472&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/widget/src/main/java/org/apache/ofbiz/widget/model/ModelWidgetCondition.java Sun Dec 17 11:07:31 2017 @@ -62,14 +62,14 @@ public abstract class ModelWidgetConditi * ----------------------------------------------------------------------- * * DEVELOPERS PLEASE READ * ----------------------------------------------------------------------- * - * + * * This model is intended to be a read-only data structure that represents * an XML element. Outside of object construction, the class should not * have any behaviors. - * + * * Instances of this class will be shared by multiple threads - therefore * it is immutable. DO NOT CHANGE THE OBJECT'S STATE AT RUN TIME! - * + * */ public static final String module = ModelWidgetCondition.class.getName(); @@ -103,7 +103,7 @@ public abstract class ModelWidgetConditi /** * Models the <and> element. - * + * * @see <code>widget-common.xsd</code> */ public static class And extends ModelWidgetCondition implements Condition { @@ -137,7 +137,7 @@ public abstract class ModelWidgetConditi public static interface ConditionFactory { /** * Returns a new <code>Condition</code> instance built from <code>conditionElement</code>. - * + * * @param modelWidget The <code>ModelWidget</code> that contains the <code>Condition</code> instance. * @param conditionElement The XML element used to build the <code>Condition</code> instance. * @return A new <code>Condition</code> instance built from <code>conditionElement</code>. @@ -196,7 +196,7 @@ public abstract class ModelWidgetConditi /** * Models the <if-compare> element. - * + * * @see <code>widget-common.xsd</code> */ public static class IfCompare extends ModelWidgetCondition implements Condition { @@ -209,8 +209,9 @@ public abstract class ModelWidgetConditi private IfCompare(ConditionFactory factory, ModelWidget modelWidget, Element condElement) { super(factory, modelWidget, condElement); String fieldAcsr = condElement.getAttribute("field"); - if (fieldAcsr.isEmpty()) + if (fieldAcsr.isEmpty()) { fieldAcsr = condElement.getAttribute("field-name"); + } this.fieldAcsr = FlexibleMapAccessor.getInstance(fieldAcsr); this.valueExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("value")); this.operator = condElement.getAttribute("operator"); @@ -246,7 +247,7 @@ public abstract class ModelWidgetConditi /** * Models the <if-compare-field> element. - * + * * @see <code>widget-common.xsd</code> */ public static class IfCompareField extends ModelWidgetCondition implements Condition { @@ -259,12 +260,14 @@ public abstract class ModelWidgetConditi private IfCompareField(ConditionFactory factory, ModelWidget modelWidget, Element condElement) { super(factory, modelWidget, condElement); String fieldAcsr = condElement.getAttribute("field"); - if (fieldAcsr.isEmpty()) + if (fieldAcsr.isEmpty()) { fieldAcsr = condElement.getAttribute("field-name"); + } this.fieldAcsr = FlexibleMapAccessor.getInstance(fieldAcsr); String toFieldAcsr = condElement.getAttribute("to-field"); - if (toFieldAcsr.isEmpty()) + if (toFieldAcsr.isEmpty()) { toFieldAcsr = condElement.getAttribute("to-field-name"); + } this.toFieldAcsr = FlexibleMapAccessor.getInstance(toFieldAcsr); this.operator = condElement.getAttribute("operator"); this.type = condElement.getAttribute("type"); @@ -301,7 +304,7 @@ public abstract class ModelWidgetConditi /** * Models the <if-empty> element. - * + * * @see <code>widget-common.xsd</code> */ public static class IfEmpty extends ModelWidgetCondition implements Condition { @@ -310,8 +313,9 @@ public abstract class ModelWidgetConditi private IfEmpty(ConditionFactory factory, ModelWidget modelWidget, Element condElement) { super(factory, modelWidget, condElement); String fieldAcsr = condElement.getAttribute("field"); - if (fieldAcsr.isEmpty()) + if (fieldAcsr.isEmpty()) { fieldAcsr = condElement.getAttribute("field-name"); + } this.fieldAcsr = FlexibleMapAccessor.getInstance(fieldAcsr); } @@ -324,7 +328,7 @@ public abstract class ModelWidgetConditi /** * Models the <if-entity-permission> element. - * + * * @see <code>widget-common.xsd</code> */ public static class IfEntityPermission extends ModelWidgetCondition implements Condition { @@ -343,7 +347,7 @@ public abstract class ModelWidgetConditi /** * Models the <if-has-permission> element. - * + * * @see <code>widget-common.xsd</code> */ public static class IfHasPermission extends ModelWidgetCondition implements Condition { @@ -382,7 +386,7 @@ public abstract class ModelWidgetConditi /** * Models the <if-regexp> element. - * + * * @see <code>widget-common.xsd</code> */ public static class IfRegexp extends ModelWidgetCondition implements Condition { @@ -392,8 +396,9 @@ public abstract class ModelWidgetConditi private IfRegexp(ConditionFactory factory, ModelWidget modelWidget, Element condElement) { super(factory, modelWidget, condElement); String fieldAcsr = condElement.getAttribute("field"); - if (fieldAcsr.isEmpty()) + if (fieldAcsr.isEmpty()) { fieldAcsr = condElement.getAttribute("field-name"); + } this.fieldAcsr = FlexibleMapAccessor.getInstance(fieldAcsr); this.exprExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("expr")); } @@ -418,8 +423,9 @@ public abstract class ModelWidgetConditi Debug.logError(e, "Could not convert object to String, using empty String", module); } // always use an empty string by default - if (fieldString == null) + if (fieldString == null) { fieldString = ""; + } PatternMatcher matcher = new Perl5Matcher(); return matcher.matches(fieldString, pattern); } @@ -427,7 +433,7 @@ public abstract class ModelWidgetConditi /** * Models the <if-service-permission> element. - * + * * @see <code>widget-common.xsd</code> */ public static class IfServicePermission extends ModelWidgetCondition implements Condition { @@ -509,7 +515,7 @@ public abstract class ModelWidgetConditi /** * Models the <if-validate-method> element. - * + * * @see <code>widget-common.xsd</code> */ public static class IfValidateMethod extends ModelWidgetCondition implements Condition { @@ -520,8 +526,9 @@ public abstract class ModelWidgetConditi private IfValidateMethod(ConditionFactory factory, ModelWidget modelWidget, Element condElement) { super(factory, modelWidget, condElement); String fieldAcsr = condElement.getAttribute("field"); - if (fieldAcsr.isEmpty()) + if (fieldAcsr.isEmpty()) { fieldAcsr = condElement.getAttribute("field-name"); + } this.fieldAcsr = FlexibleMapAccessor.getInstance(fieldAcsr); this.methodExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("method")); this.classExdr = FlexibleStringExpander.getInstance(condElement.getAttribute("class")); @@ -542,8 +549,9 @@ public abstract class ModelWidgetConditi } } // always use an empty string by default - if (fieldString == null) + if (fieldString == null) { fieldString = ""; + } Class<?>[] paramTypes = new Class[] { String.class }; Object[] params = new Object[] { fieldString }; Class<?> valClass; @@ -573,7 +581,7 @@ public abstract class ModelWidgetConditi /** * Models the <not> element. - * + * * @see <code>widget-common.xsd</code> */ public static class Not extends ModelWidgetCondition implements Condition { @@ -593,7 +601,7 @@ public abstract class ModelWidgetConditi /** * Models the <or> element. - * + * * @see <code>widget-common.xsd</code> */ public static class Or extends ModelWidgetCondition implements Condition { @@ -618,7 +626,7 @@ public abstract class ModelWidgetConditi /** * Models the <xor> element. - * + * * @see <code>widget-common.xsd</code> */ public static class Xor extends ModelWidgetCondition implements Condition { @@ -645,4 +653,4 @@ public abstract class ModelWidgetConditi return foundOneTrue; } } -} +} \ No newline at end of file |
Free forum by Nabble | Edit this page |