ICEfaces
  1. ICEfaces
  2. ICE-4390

Make it so the dataExporter component will create the export file and initiate the download with a single click

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.8.1
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      dataExporter + generate file

      Description

      Make it so the dataExporter component would not require a click to create a file

        Issue Links

          Activity

          Hide
          Adnan Durrani added a comment -

          Following new attribute added. Setting it to false omits the need of click on a link to create a file. Default value is true.

          • clickToCreateFile

          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-dataExporter-props.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-dataExporter-props.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java
          Completed: At revision: 18802

          Show
          Adnan Durrani added a comment - Following new attribute added. Setting it to false omits the need of click on a link to create a file. Default value is true. clickToCreateFile Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-dataExporter-props.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-dataExporter-props.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java Completed: At revision: 18802
          Hide
          Ken Fyten added a comment - - edited

          I think we need to reconsider how this component works. I don't understand the use-case for having to click twice to download an export file? If possible, we should both generate the export file and initiate the download with a single click to the "label" on this component. This makes the component nicer to user from a user's perspective and makes the component more efficient as it doesn't generate the file until a user actually requests it.

          We could then deprecate the "clickToCreateFileText" attribute altogether that was in the original 1.8 release for this component (make it a no-op attribute and mark it as deprecated in the TLD docs). We would no longer require the new "clickToCreateFile" attribute added as part of the original commit on this JIRA. As it hasn't released yet, we can simply remove it altogether.

          Show
          Ken Fyten added a comment - - edited I think we need to reconsider how this component works. I don't understand the use-case for having to click twice to download an export file? If possible, we should both generate the export file and initiate the download with a single click to the "label" on this component. This makes the component nicer to user from a user's perspective and makes the component more efficient as it doesn't generate the file until a user actually requests it. We could then deprecate the "clickToCreateFileText" attribute altogether that was in the original 1.8 release for this component (make it a no-op attribute and mark it as deprecated in the TLD docs). We would no longer require the new "clickToCreateFile" attribute added as part of the original commit on this JIRA. As it hasn't released yet, we can simply remove it altogether.
          Hide
          Adnan Durrani added a comment -

          Following changes made:

          • "clickToCreateFileImage" attribute removed.
          • "clickToCreateFileattribute" attribute removed.
          • "clickToCreateFileText" still exist but no-op marked as deprecated.
          • The render is now response writer based.
          • Only one click is required to create and download the file.
          • File will only be created if clicked to download.

          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputresource\OutputResource.java
          Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-dataExporter-props.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-dataExporter-props.xml
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputresource\OutputResource.java
          Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java
          Completed: At revision: 18901

          Show
          Adnan Durrani added a comment - Following changes made: "clickToCreateFileImage" attribute removed. "clickToCreateFileattribute" attribute removed. "clickToCreateFileText" still exist but no-op marked as deprecated. The render is now response writer based. Only one click is required to create and download the file. File will only be created if clicked to download. Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputresource\OutputResource.java Modified: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-dataExporter-props.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporterRenderer.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component-metadata\src\main\resources\conf\ice_cust_properties\cust-dataExporter-props.xml Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\outputresource\OutputResource.java Sending content: D:\work\development\head\svn\ossrepo\icefaces\trunk\icefaces\component\src\com\icesoft\faces\component\dataexporter\DataExporter.java Completed: At revision: 18901
          Hide
          Adnan Durrani added a comment -

          Tld Docs updated revision 18905

          Show
          Adnan Durrani added a comment - Tld Docs updated revision 18905
          Hide
          John Carlson added a comment - - edited

          Can you provide an example of a single click to create, download and delete a file? Are you sure you can do this in the context of JSF? So far we're using our own Servlets for downloads (non data exporter downloads). Here's my example. I also use Maps when the dataExporter is in the context of a repeated structure (loop of tables). An example of that would be useful too. I'm really clogging up my faces-config.xml with stuff.

          <ice:dataExporter for="configAndCalib"
          binding="#

          {dataExporterNoHashCheckExcel}

          "
          image="images/Excel-16x16.png" type="excel"
          style="text-decoration:underline"
          clickToCreateFileText="Click to create excel file" />
          <ice:dataExporter for="configAndCalib"
          binding="#

          {dataExporterNoHashCheckCsv}

          "
          image="images/Excel-16x16.png" type="csv"
          style="text-decoration:underline"
          clickToCreateFileText="Click to create csv file" />

          <managed-bean>
          <managed-bean-name>dataExporterNoHashCheckExcel</managed-bean-name>
          <managed-bean-class>gov.llnl.nif.datavis.sdavis.view.DataExporterNoHashCheck</managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
          </managed-bean>

          <managed-bean>
          <managed-bean-name>dataExporterNoHashCheckCsv</managed-bean-name>
          <managed-bean-class>gov.llnl.nif.datavis.sdavis.view.DataExporterNoHashCheck</managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
          </managed-bean>

          package gov.llnl.nif.datavis.sdavis.view;

          import javax.faces.component.UIData;

          import com.icesoft.faces.application.D2DViewHandler;
          import com.icesoft.faces.component.dataexporter.DataExporter;

          public class DataExporterNoHashCheck extends DataExporter {
          public UIData getUIData() {
          String forStr = getFor();
          UIData forComp = (UIData)D2DViewHandler.findComponent(forStr, this);

          if (forComp == null)

          { throw new IllegalArgumentException( "could not find UIData referenced by attribute @for = '" + forStr + "'"); }

          else if (!(forComp instanceof UIData))

          { throw new IllegalArgumentException( "uiComponent referenced by attribute @for = '" + forStr + "' must be of type " + UIData.class.getName() + ", not type " + forComp.getClass().getName()); }

          return forComp;
          }

          }

          Show
          John Carlson added a comment - - edited Can you provide an example of a single click to create, download and delete a file? Are you sure you can do this in the context of JSF? So far we're using our own Servlets for downloads (non data exporter downloads). Here's my example. I also use Maps when the dataExporter is in the context of a repeated structure (loop of tables). An example of that would be useful too. I'm really clogging up my faces-config.xml with stuff. <ice:dataExporter for="configAndCalib" binding="# {dataExporterNoHashCheckExcel} " image="images/Excel-16x16.png" type="excel" style="text-decoration:underline" clickToCreateFileText="Click to create excel file" /> <ice:dataExporter for="configAndCalib" binding="# {dataExporterNoHashCheckCsv} " image="images/Excel-16x16.png" type="csv" style="text-decoration:underline" clickToCreateFileText="Click to create csv file" /> <managed-bean> <managed-bean-name>dataExporterNoHashCheckExcel</managed-bean-name> <managed-bean-class>gov.llnl.nif.datavis.sdavis.view.DataExporterNoHashCheck</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> <managed-bean> <managed-bean-name>dataExporterNoHashCheckCsv</managed-bean-name> <managed-bean-class>gov.llnl.nif.datavis.sdavis.view.DataExporterNoHashCheck</managed-bean-class> <managed-bean-scope>request</managed-bean-scope> </managed-bean> package gov.llnl.nif.datavis.sdavis.view; import javax.faces.component.UIData; import com.icesoft.faces.application.D2DViewHandler; import com.icesoft.faces.component.dataexporter.DataExporter; public class DataExporterNoHashCheck extends DataExporter { public UIData getUIData() { String forStr = getFor(); UIData forComp = (UIData)D2DViewHandler.findComponent(forStr, this); if (forComp == null) { throw new IllegalArgumentException( "could not find UIData referenced by attribute @for = '" + forStr + "'"); } else if (!(forComp instanceof UIData)) { throw new IllegalArgumentException( "uiComponent referenced by attribute @for = '" + forStr + "' must be of type " + UIData.class.getName() + ", not type " + forComp.getClass().getName()); } return forComp; } }
          Hide
          John Carlson added a comment -

          Is there a regression problem with this? It requires two clicks in 1.8.2, unless my example above is wrong.

          Show
          John Carlson added a comment - Is there a regression problem with this? It requires two clicks in 1.8.2, unless my example above is wrong.

            People

            • Assignee:
              Adnan Durrani
              Reporter:
              Adnan Durrani
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: