diff --git a/framework/common/widget/CommonScreens.xml b/framework/common/widget/CommonScreens.xml index a56fe9aa6d..c74b17bd25 100644 --- a/framework/common/widget/CommonScreens.xml +++ b/framework/common/widget/CommonScreens.xml @@ -93,11 +93,15 @@ under the License.
+ + diff --git a/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.bsh b/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.bsh new file mode 100644 index 0000000000..a3c1ff81b7 --- /dev/null +++ b/framework/example/webapp/example/WEB-INF/actions/includes/findExampleFeatures.bsh @@ -0,0 +1,46 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import java.util.TreeSet; +import javolution.util.FastList; +import org.ofbiz.entity.condition.EntityConditionList; +import org.ofbiz.entity.condition.EntityExpr; +import org.ofbiz.entity.condition.EntityFieldValue; +import org.ofbiz.entity.condition.EntityFunction; +import org.ofbiz.entity.condition.EntityOperator; +import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilValidate; + +delegator = request.getAttribute("delegator"); + +andExprs = FastList.newInstance(); +fieldValue = request.getParameter("exampleFeatureId"); +if (UtilValidate.isNotEmpty(fieldValue)) { + andExprs.add(new EntityExpr(new EntityFunction.UPPER(new EntityFieldValue("exampleFeatureId")), + EntityOperator.LIKE, "%" + fieldValue.toUpperCase() + "%")); +} + +List autocompleteOptions = null; +if (andExprs.size() > 0) { + entityConditionList = new EntityConditionList(andExprs, EntityOperator.AND); + autocompleteOptions = delegator.findList("ExampleFeature", entityConditionList, new TreeSet(UtilMisc.toList("exampleFeatureId", "description")), UtilMisc.toList("-exampleFeatureId"), null, false); + //context.put("autocompleteOptions", autocompleteOptions); + request.setAttribute("autocompleteOptions", autocompleteOptions); +} +return "success"; \ No newline at end of file diff --git a/framework/example/webapp/example/WEB-INF/controller.xml b/framework/example/webapp/example/WEB-INF/controller.xml index 40e9a1d87d..600e0e7787 100644 --- a/framework/example/webapp/example/WEB-INF/controller.xml +++ b/framework/example/webapp/example/WEB-INF/controller.xml @@ -28,6 +28,8 @@ under the License. Example Component Site Configuration File Copyright 2001-2008 The Apache Software Foundation + +