Examples of HtmlPanelGrid


Examples of org.metawidget.statically.faces.component.html.layout.HtmlPanelGrid

      // If not bidirectional, create an 'Add' section (bidirectional does it 'in place')

      if (!attributes.containsKey(INVERSE_RELATIONSHIP))
      {
         HtmlPanelGrid panelGrid = new HtmlPanelGrid();
         panelGrid.putAttribute("styleClass", "data-table-footer");
         panelGrid.putAttribute("columns", "2");
         panelGrid.putAttribute("columnClasses", ",remove-column");

         // Select menu at bottom

         HtmlSelectOneMenu select = new HtmlSelectOneMenu();
         String selectId = dataTable.getAttribute("id") + "Select";
         select.putAttribute("id", selectId);
         String requestScopedValue = "requestScope['" + selectId + "']";
         select.setValue(StaticFacesUtils.wrapExpression(requestScopedValue));
         String simpleComponentType = ClassUtils.getSimpleName(componentType);
         String controllerName = StringUtils.decapitalize(simpleComponentType);
         select.setConverter(StaticFacesUtils.wrapExpression(controllerName + "Bean.converter"));
         addSelectItems(select, StaticFacesUtils.wrapExpression(controllerName + "Bean.all"), attributes);
         panelGrid.getChildren().add(select);

         // Create 'Add' button

         HtmlCommandLink addLink = new HtmlCommandLink();
         addLink.putAttribute("styleClass", "add-button");
         String addExpression = COLLECTION_VAR + ".add(" + requestScopedValue + ")";
         addLink.putAttribute("action", StaticFacesUtils.wrapExpression(addExpression));
         addLink.putAttribute("onclick", "if (document.getElementById(document.forms[0].id+':" + selectId
                  + "').selectedIndex < 1) { alert('Must select a " + StringUtils.uncamelCase(simpleComponentType)
                  + "'); return false; }");

         // (id is useful for unit tests)

         addLink.putAttribute("id", dataTable.getAttribute("id") + "Add");
         panelGrid.getChildren().add(addLink);

         panelGroup.getChildren().add(panelGrid);
      }

      return panelGroup;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.