Skip to content

Commit

Permalink
fixed issues rdicroce#13 - graphicsImage formatter
Browse files Browse the repository at this point in the history
Thanks to IgorKvasn (https://github.com/IgorKvasn)
  • Loading branch information
cesardiaz-dev committed Jun 13, 2018
1 parent 7719827 commit bf2407f
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.lapis.jsfexporter.impl.value;

import com.lapis.jsfexporter.spi.IValueFormatter;
import javax.faces.component.html.HtmlGraphicImage;
import javax.faces.context.FacesContext;

public class GraphicsImageFormatter implements IValueFormatter<HtmlGraphicImage> {

@Override
public Class<HtmlGraphicImage> getSupportedClass() {
return HtmlGraphicImage.class;
}

@Override
public int getPrecedence() {
return 0;
}

@Override
public String formatValue(FacesContext context, HtmlGraphicImage component) {
return component.getAlt();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ com.lapis.jsfexporter.impl.value.OutputFormatFormatter
com.lapis.jsfexporter.impl.value.PanelGroupFormatter
com.lapis.jsfexporter.impl.value.SelectOneFormatter
com.lapis.jsfexporter.impl.value.UICommandFormatter
com.lapis.jsfexporter.impl.value.ValueHolderFormatter
com.lapis.jsfexporter.impl.value.ValueHolderFormatter
com.lapis.jsfexporter.impl.value.GraphicsImageFormatter
1 change: 1 addition & 0 deletions jsf-exporter-test/src/main/webapp/faces/index.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<li><h:link outcome="/faces/primefaces/dataTableGrouping.xhtml" value="p:dataTable with p:columnGroup" /></li>
<li><h:link outcome="/faces/primefaces/dataTableLazy.xhtml" value="p:dataTable with lazy loading" /></li>
<li><h:link outcome="/faces/primefaces/dataTableNonLazy.xhtml" value="p:dataTable with normal loading" /></li>
<li><h:link outcome="/faces/primefaces/dataTableNonLazyAndImages.xhtml" value="p:dataTable with image in cells" /></li>
<li><h:link outcome="/faces/primefaces/dataTablePaginated.xhtml" value="p:dataTable with pagination" /></li>

<li><h:link outcome="/faces/primefaces/treeTable.xhtml" value="p:treeTable" /></li>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<!--
#%L
Lapis JSF Exporter - Test WAR
%%
Copyright (C) 2013 - 2015 Lapis Software Associates
%%
Licensed 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.
#L%
-->
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:l="http://www.lapis.com/jsf/exporter"
template="../template.xhtml">
<ui:define name="content">
<h:form>
<p:commandButton value="Export CSV" ajax="false">
<l:dataExporter source="table" fileType="csv" fileName="cars"/>
</p:commandButton>
<p:commandButton value="Export XML" ajax="false">
<l:dataExporter source="table" fileType="xml" fileName="cars"/>
</p:commandButton>
<p:commandButton value="Export PDF" ajax="false">
<l:dataExporter source="table" fileType="pdf" fileName="cars"/>
</p:commandButton>
<p:commandButton value="Export XLSX" ajax="false">
<l:dataExporter source="table" fileType="excel" fileName="cars"/>
</p:commandButton>
<p:commandButton value="Export DOCX" ajax="false">
<l:dataExporter source="table" fileType="word" fileName="cars"/>
</p:commandButton>

<p:dataTable id="table" var="car" value="#{nonLazyTableBean.cars}" editable="true">
<p:column>
<f:facet name="header">
<h:outputText value="Make (i.e. Manufacturer)" />
</f:facet>
<h:outputText value="#{car.make}" />
</p:column>
<p:column headerText="Color">
<h:outputText value="#{car.color}" />
</p:column>
<p:column headerText="Year">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{car.year}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{car.year}">
<f:validateLongRange minimum="1900"/>
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Price">
<p:cellEditor>
<f:facet name="output">
<h:panelGroup>
<h:outputText value="$" />
<h:outputText value="#{car.price}" />
</h:panelGroup>
</f:facet>
<f:facet name="input">
<p:inputText value="#{car.price}">
<f:validateLongRange minimum="1"/>
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Image - HTML" style="text-align: center;">
<h:graphicImage library="images" name="image.png" alt="this is image's alt"/>
</p:column>
<p:column headerText="Image - Primefaces" style="text-align: center;">
<p:graphicImage library="images" name="image2.gif" alt="this is second image's alt"/>
</p:column>
<p:column headerText="Actions" exportable="false">
<p:rowEditor/>
</p:column>
</p:dataTable>
</h:form>
</ui:define>
</ui:composition>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit bf2407f

Please sign in to comment.