Examples of HtmlColumn


Examples of javax.faces.component.html.HtmlColumn

    {
        if (uiComponent instanceof UIColumn)
        {
            // allow column to override style class, new in JSF 1.2
            if (uiComponent instanceof HtmlColumn) {
                HtmlColumn column = (HtmlColumn)uiComponent;
                if (isHeader && column.getHeaderClass()!=null)
                    styleClass = column.getHeaderClass();
                else if (!isHeader && column.getFooterClass()!=null)
                    styleClass = column.getFooterClass();
            }else{
                //This code corrects MYFACES-1790, because HtmlColumnTag
                //has as component type javax.faces.Column, so as side
                //effect it not create HtmlColumn, it create UIColumn
                //classes.
                UIColumn column = (UIColumn) uiComponent;               
                if (isHeader){
                    String headerClass = (String) column.getAttributes().get("headerClass");
                    if (headerClass != null){
                        styleClass = (String) headerClass;
                    }
                }else{
                    String footerClass = (String) column.getAttributes().get("footerClass");
                    if (footerClass != null){
                        styleClass = (String) footerClass;
                    }
                }
            }
View Full Code Here

Examples of org.apache.myfaces.custom.column.HtmlColumn

                                          ResponseWriter writer, UIComponent uiComponent,
                                          UIComponent facet, String headerStyleClass, int colspan)
        throws IOException {
        if (uiComponent instanceof HtmlColumn) {

            HtmlColumn column = (HtmlColumn) uiComponent;

            if (amISpannedOver("header", uiComponent)) {
                return;
            }

            writer.startElement(determineHeaderCellTag(facesContext, uiComponent.getParent()), uiComponent);

            String columnId = column.getColumnId();
            if (columnId != null)
            {
                writer.writeAttribute(HTML.ID_ATTR, columnId, null);
            }
View Full Code Here

Examples of org.apache.myfaces.custom.column.HtmlColumn

                                          ResponseWriter writer, UIComponent uiComponent,
                                          UIComponent facet, String headerStyleClass, int colspan)
        throws IOException {
        if (uiComponent instanceof HtmlColumn) {

            HtmlColumn column = (HtmlColumn) uiComponent;

            if (amISpannedOver("header", uiComponent)) {
                return;
            }

            writer.startElement(determineHeaderCellTag(facesContext, uiComponent.getParent()), uiComponent);

            String columnId = column.getColumnId();
            if (columnId != null)
            {
                writer.writeAttribute(HTML.ID_ATTR, columnId, null);
            }
View Full Code Here

Examples of org.apache.myfaces.custom.column.HtmlColumn

                                          ResponseWriter writer, UIComponent uiComponent,
                                          UIComponent facet, String headerStyleClass, int colspan)
        throws IOException {
        if (uiComponent instanceof HtmlColumn) {

            HtmlColumn column = (HtmlColumn) uiComponent;

            if (amISpannedOver("header", uiComponent)) {
                return;
            }

            writer.startElement(determineHeaderCellTag(facesContext, uiComponent.getParent()), uiComponent);

            String columnId = column.getColumnId();
            if (columnId != null)
            {
                writer.writeAttribute(HTML.ID_ATTR, columnId, null);
            }
View Full Code Here

Examples of org.apache.myfaces.custom.column.HtmlColumn

                                          ResponseWriter writer, UIComponent uiComponent,
                                          UIComponent facet, String headerStyleClass, int colspan)
        throws IOException {
        if (uiComponent instanceof HtmlColumn) {

            HtmlColumn column = (HtmlColumn) uiComponent;

            if (amISpannedOver("header", uiComponent)) {
                return;
            }

            writer.startElement(determineHeaderCellTag(facesContext, uiComponent.getParent()), uiComponent);

            String columnId = column.getColumnId();
            if (columnId != null)
            {
                writer.writeAttribute(HTML.ID_ATTR, columnId, null);
            }
View Full Code Here

Examples of org.apache.myfaces.custom.column.HtmlColumn

                                          ResponseWriter writer, UIComponent uiComponent,
                                          UIComponent facet, String headerStyleClass, int colspan)
        throws IOException {
        if (uiComponent instanceof HtmlColumn) {

            HtmlColumn column = (HtmlColumn) uiComponent;

            if (amISpannedOver("header", uiComponent)) {
                return;
            }

            writer.startElement(determineHeaderCellTag(facesContext, uiComponent.getParent()), uiComponent);

            String columnId = column.getColumnId();
            if (columnId != null)
            {
                writer.writeAttribute(HTML.ID_ATTR, columnId, null);
            }
View Full Code Here

Examples of org.metawidget.statically.faces.component.html.widgetbuilder.HtmlColumn

      HtmlCommandLink removeLink = new HtmlCommandLink();
      removeLink.putAttribute("styleClass", "remove-button");
      String removeExpression = COLLECTION_VAR + ".remove(" + dataTable.getAttribute("var") + ")";
      removeLink.putAttribute("action", StaticFacesUtils.wrapExpression(removeExpression));

      HtmlColumn column = new HtmlColumn();
      column.putAttribute("headerClass", "remove-column");
      column.putAttribute("footerClass", "remove-column");
      column.getChildren().add(removeLink);
      dataTable.getChildren().add(column);

      // If bidirectional, an 'Add' button too

      String inverseRelationship = attributes.get(INVERSE_RELATIONSHIP);

      if (inverseRelationship != null)
      {
         String componentType = WidgetBuilderUtils.getComponentType(attributes);

         if (componentType != null)
         {
            String controllerName = StringUtils.decapitalize(ClassUtils.getSimpleName(componentType));

            HtmlCommandLink addLink = new HtmlCommandLink();
            addLink.putAttribute("styleClass", "add-button");
            String addExpression = COLLECTION_VAR + ".add(" + controllerName + "Bean.added)";
            addLink.putAttribute("action", StaticFacesUtils.wrapExpression(addExpression));

            // Use a f:setPropertyActionListener to initialize the bidirectional relationship

            SetPropertyActionListener setPropertyActionListener = new SetPropertyActionListener();
            setPropertyActionListener.putAttribute(
                     "target",
                     StaticFacesUtils.wrapExpression(controllerName + "Bean.add." + inverseRelationship));
            StandardBindingProcessor bindingProcessor = metawidget.getWidgetProcessor(StandardBindingProcessor.class);

            if (bindingProcessor != null)
            {
               bindingProcessor.processWidget(setPropertyActionListener, ENTITY, attributes,
                        (StaticUIMetawidget) metawidget);
            }
            addLink.getChildren().add(setPropertyActionListener);

            // (id is useful for unit tests)

            String id = StaticFacesUtils.unwrapExpression(setPropertyActionListener.getValue())
                     + StringUtils.SEPARATOR_DOT_CHAR + attributes.get(NAME) + StringUtils.SEPARATOR_DOT_CHAR + "Add";

            addLink.putAttribute("id", StringUtils.camelCase(id, StringUtils.SEPARATOR_DOT_CHAR));

            Facet footerFacet = new Facet();
            footerFacet.putAttribute("name", "footer");
            footerFacet.getChildren().add(addLink);
            column.getChildren().add(footerFacet);
         }
      }
   }
View Full Code Here

Examples of org.metawidget.statically.faces.component.html.widgetbuilder.HtmlColumn

      // Create the column

      super.addColumnComponent(dataTable, tableAttributes, elementName, columnAttributes, metawidget);
      List<StaticWidget> columns = dataTable.getChildren();
      HtmlColumn column = (HtmlColumn) columns.get(columns.size() - 1);

      // If we can determine the componentType, wrap it with a link

      if (tableAttributes.get(TOP_LEVEL_PARAMETERIZED_TYPE) != null)
      {
         componentType = tableAttributes.get(TOP_LEVEL_PARAMETERIZED_TYPE);
      }

      if (componentType != null)
      {
         String controllerName = StringUtils.decapitalize(ClassUtils.getSimpleName(componentType));

         // Create a link...

         HtmlOutcomeTargetLink link = new HtmlOutcomeTargetLink();
         link.putAttribute("outcome", getTargetDir() + "/" + controllerName + "/view");

         // ...pointing to the id

         String primaryKeyName = "id";
         String inspectedType = metawidget.inspect(null, componentType);

         if (inspectedType != null)
         {
            Element root = XmlUtils.documentFromString(inspectedType).getDocumentElement();
            NodeList elements = root.getFirstChild().getChildNodes();

            for (int loop = 0, length = elements.getLength(); loop < length; loop++)
            {
               Element element = (Element) elements.item(loop);

               if (element.hasAttribute(PRIMARY_KEY))
               {
                  primaryKeyName = element.getAttribute(NAME);
                  break;
               }
            }
         }

         Param param = new Param();
         param.putAttribute("name", "id");
         param.putAttribute(
                  "value",
                  StaticFacesUtils.wrapExpression(dataTable.getAttribute("var") + StringUtils.SEPARATOR_DOT_CHAR
                           + primaryKeyName));
         link.getChildren().add(param);
         link.getChildren().add(column.getChildren().remove(1));
         column.getChildren().add(link);

         // If bidirectional, add a footer facet

         if (tableAttributes.containsKey(INVERSE_RELATIONSHIP) && !metawidget.isReadOnly())
         {
            // If it's an inverse relationship, we really should have been able to determine sub-properties, so we
            // should never be at 'entity' level *unless* componentType couldn't resolve to an actual type

            if (!ENTITY.equals(elementName))
            {
               StaticHtmlMetawidget footerMetawidget = new StaticHtmlMetawidget();
               Map<String, String> footerAttributes = CollectionUtils.newHashMap();
               metawidget.initNestedMetawidget(footerMetawidget, footerAttributes);

               // (footer facets should never have a 'required' attribute)

               footerMetawidget.removeWidgetProcessor(footerMetawidget
                        .getWidgetProcessor(RequiredAttributeProcessor.class));
               footerMetawidget.setValue(StaticFacesUtils.wrapExpression(controllerName + "Bean.add." + columnName));
               footerMetawidget.setPath(componentType + StringUtils.SEPARATOR_FORWARD_SLASH_CHAR + columnName);
               footerMetawidget.setLayout(new SimpleLayout());

               Facet footerFacet = new Facet();
               footerFacet.putAttribute("name", "footer");
               footerFacet.getChildren().add(footerMetawidget);

               ReadableIdProcessor readableIdProcessor = metawidget.getWidgetProcessor(ReadableIdProcessor.class);

               if (readableIdProcessor != null)
               {
                  readableIdProcessor.processWidget(footerMetawidget, elementName, columnAttributes, metawidget);
               }

               HtmlMessage message = new HtmlMessage();
               message.putAttribute("for", footerMetawidget.getAttribute("id"));
               message.putAttribute("styleClass", "error");
               footerFacet.getChildren().add(message);
               column.getChildren().add(footerFacet);
            }
         }
      }
   }
View Full Code Here

Examples of org.metawidget.statically.faces.component.html.widgetbuilder.HtmlColumn

      HtmlCommandLink removeLink = new HtmlCommandLink();
      removeLink.putAttribute("styleClass", "remove-button");
      String removeExpression = COLLECTION_VAR + ".remove(" + dataTable.getAttribute("var") + ")";
      removeLink.putAttribute("action", StaticFacesUtils.wrapExpression(removeExpression));

      HtmlColumn column = new HtmlColumn();
      column.putAttribute("headerClass", "remove-column");
      column.putAttribute("footerClass", "remove-column");
      column.getChildren().add(removeLink);
      dataTable.getChildren().add(column);

      // If bidirectional, an 'Add' button too

      String inverseRelationship = attributes.get(INVERSE_RELATIONSHIP);

      if (inverseRelationship != null)
      {
         String componentType = WidgetBuilderUtils.getComponentType(attributes);

         if (componentType != null)
         {
            String controllerName = StringUtils.decapitalize(ClassUtils.getSimpleName(componentType));

            HtmlCommandLink addLink = new HtmlCommandLink();
            addLink.putAttribute("styleClass", "add-button");
            String addExpression = COLLECTION_VAR + ".add(" + controllerName + "Bean.added)";
            addLink.putAttribute("action", StaticFacesUtils.wrapExpression(addExpression));

            // Use a f:setPropertyActionListener to initialize the bidirectional relationship

            SetPropertyActionListener setPropertyActionListener = new SetPropertyActionListener();
            setPropertyActionListener.putAttribute(
                     "target",
                     StaticFacesUtils.wrapExpression(controllerName + "Bean.add." + inverseRelationship));
            StandardBindingProcessor bindingProcessor = metawidget.getWidgetProcessor(StandardBindingProcessor.class);

            if (bindingProcessor != null)
            {
               bindingProcessor.processWidget(setPropertyActionListener, ENTITY, attributes,
                        (StaticUIMetawidget) metawidget);
            }
            addLink.getChildren().add(setPropertyActionListener);

            // (id is useful for unit tests)

            String id = StaticFacesUtils.unwrapExpression(setPropertyActionListener.getValue())
                     + StringUtils.SEPARATOR_DOT_CHAR + attributes.get(NAME) + StringUtils.SEPARATOR_DOT_CHAR + "Add";

            addLink.putAttribute("id", StringUtils.camelCase(id, StringUtils.SEPARATOR_DOT_CHAR));

            Facet footerFacet = new Facet();
            footerFacet.putAttribute("name", "footer");
            footerFacet.getChildren().add(addLink);
            column.getChildren().add(footerFacet);
         }
      }
   }
View Full Code Here

Examples of org.metawidget.statically.faces.component.html.widgetbuilder.HtmlColumn

      // Create the column

      super.addColumnComponent(dataTable, tableAttributes, elementName, columnAttributes, metawidget);
      List<StaticWidget> columns = dataTable.getChildren();
      HtmlColumn column = (HtmlColumn) columns.get(columns.size() - 1);

      // If we can determine the componentType, wrap it with a link

      if (tableAttributes.get(TOP_LEVEL_PARAMETERIZED_TYPE) != null)
      {
         componentType = tableAttributes.get(TOP_LEVEL_PARAMETERIZED_TYPE);
      }

      if (componentType != null)
      {
         String controllerName = StringUtils.decapitalize(ClassUtils.getSimpleName(componentType));

         // Create a link...

         HtmlOutcomeTargetLink link = new HtmlOutcomeTargetLink();
         link.putAttribute("outcome", getTargetDir() + "/" + controllerName + "/view");

         // ...pointing to the id

         String primaryKeyName = "id";
         String inspectedType = metawidget.inspect(null, componentType);

         if (inspectedType != null)
         {
            Element root = XmlUtils.documentFromString(inspectedType).getDocumentElement();
            NodeList elements = root.getFirstChild().getChildNodes();

            for (int loop = 0, length = elements.getLength(); loop < length; loop++)
            {
               Element element = (Element) elements.item(loop);

               if (element.hasAttribute(PRIMARY_KEY))
               {
                  primaryKeyName = element.getAttribute(NAME);
                  break;
               }
            }
         }

         Param param = new Param();
         param.putAttribute("name", "id");
         param.putAttribute(
                  "value",
                  StaticFacesUtils.wrapExpression(dataTable.getAttribute("var") + StringUtils.SEPARATOR_DOT_CHAR
                           + primaryKeyName));
         link.getChildren().add(param);
         link.getChildren().add(column.getChildren().remove(1));
         column.getChildren().add(link);

         // If bidirectional, add a footer facet

         if (tableAttributes.containsKey(INVERSE_RELATIONSHIP) && !metawidget.isReadOnly())
         {
            // If it's an inverse relationship, we really should have been able to determine sub-properties, so we
            // should never be at 'entity' level *unless* componentType couldn't resolve to an actual type

            if (!ENTITY.equals(elementName))
            {
               StaticHtmlMetawidget footerMetawidget = new StaticHtmlMetawidget();
               Map<String, String> footerAttributes = CollectionUtils.newHashMap();
               metawidget.initNestedMetawidget(footerMetawidget, footerAttributes);

               // (footer facets should never have a 'required' attribute)

               footerMetawidget.removeWidgetProcessor(footerMetawidget
                        .getWidgetProcessor(RequiredAttributeProcessor.class));
               footerMetawidget.setValue(StaticFacesUtils.wrapExpression(controllerName + "Bean.add." + columnName));
               footerMetawidget.setPath(componentType + StringUtils.SEPARATOR_FORWARD_SLASH_CHAR + columnName);
               footerMetawidget.setLayout(new SimpleLayout());

               Facet footerFacet = new Facet();
               footerFacet.putAttribute("name", "footer");
               footerFacet.getChildren().add(footerMetawidget);

               ReadableIdProcessor readableIdProcessor = metawidget.getWidgetProcessor(ReadableIdProcessor.class);

               if (readableIdProcessor != null)
               {
                  readableIdProcessor.processWidget(footerMetawidget, elementName, columnAttributes, metawidget);
               }

               HtmlMessage message = new HtmlMessage();
               message.putAttribute("for", footerMetawidget.getAttribute("id"));
               message.putAttribute("styleClass", "error");
               footerFacet.getChildren().add(message);
               column.getChildren().add(footerFacet);
            }
         }
      }
   }
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.