Tomcat wont start with SAXParseException: Content is not allowed in prolog.

clock January 19, 2011 15:16 by author Flexicious

One of our customers reported that our demo with the Spring/Java/Hibernate example was no longer working. Worse yet, as soon as you hit that example, no other server calls where working. For some reason, it turns out that our Tomcat instance started, but never fully initialized. The issue took a lot of cycles to figure out, but turns out, our tomcat-users.xml file was foobared. It had nothing but a bunch of spaces. We replaced it with:

<?xml version='1.0' encoding='utf-8'?>
<tomcat-users>
  <role rolename="tomcat"/>
  <role rolename="role1"/>
  <user username="tomcat" password="xxxxx" roles="tomcat"/>
  <user username="both" password="xxxxx" roles="tomcat,role1"/>
  <user username="role1" password="xxxxx" roles="role1"/>
</tomcat-users>

And yay! our Spring/Java/Hibernate example is working!



ASDOCS - missing msvcr71.dll, Unable To Transcode, and Could not create toplevel.xml

clock January 18, 2011 14:21 by author Flexicious

So interesting issues today -Tried to run asdocs, and all sorts of pain:

First when we ran our ASDOCS tool on a newly built Win 7 machine - failed with the error "The program can't start because MSVCR71.dll is missing from your computer. Try reinstalling the program to fix this problem".

Well there are many ways to fix this. Easiest - Start -> Search for msvcr71.dll, if its on your computer, this should find it. Else, just download it from dll-files like described here. You can then paste it into your bin directory - in our case C:\Program Files (x86)\Adobe\Adobe Flash Builder Burrito\sdks\4.1.0\bin, and you are good to go!

Next obstacle: Error: Unable to transcode ../assets/images ....
-> We actually did not find a solution to this, but since there was only one file that had these embed tags, we put a copy of the assets folder next to the file that did, and all was well. If anyone knows of a better way, let us know and we will update the post. The one thing that is of interest here is that asdocs like to have a "/" before the path. So instead of assets/images, you need to have /assets/images.

Third obstacle:
Error: Could not create toplevel.xml: Element type "default" must be followed by either attribute specifications, ">" or "/>".
-> This turned out to be rather tricky - This happens when asdocs fails to parse the comments in your code. Pay attention to the error message - in our case we had a few instances where we had @default = XXX and @defaultValue= XXX. This obviosly never complains during compile time, but you will make asdocs very angry if you put this in your comments. Finally, once we resovled these issues, asdocs played nice with us !

Oh - if you are using asdocs, you MUST check out asdocr by Grant Skinner.



Customizing the Print/Excel Output

clock January 15, 2011 12:15 by author Flexicious

We had a customer request help in implementing a feature that will probably be handy to a lot of you.

What they basically wanted is that they wanted to customize the print as well as the export output to display information about the filter being currently applied. The idea would be the same if you want to perform any kind of customization to the print/excel output. Basically, we provide certain plugin mechanisms for you to hook into the print/export flow. There are a series of My*.mxml/as files that we provide, that you can customize to suit your requirements. This example demonstrates how you would implement a customization like this.

The solution for this feature is as follows:

1) Implement the logic to convert the filter to a human readable string (Review SampleUIUtils.as, getFilterString)

2) For the print, modify your Print Area of interest (we used the ReportHeader) to call the function above and display the output (See MyReportHeader.mxml, and MyPrintOptions.as)

3) For the export, extend the built in exporters to include the filter information in the export output. (See MyCsvExporter.as, and MyExportOptions.as)

4) In your CustomPagerControl, ensure you are calling PrintController and ExportController like this:

ExportController.instance().export(this.grid,MyExportOptions.create(1)
PrintController.instance().print(this.grid,MyPrintOptions.create())

Please feel free to reach out with any questions!

 

SampleUIUtils.as (3.35 kb)

MyReportHeader.mxml (1.88 kb)

MyPrintOptions.as (1.98 kb)

MyCsvExporter.as (611.00 bytes)

MyExportOptions.as (1.16 kb)

 

===================================================

Update: Another common request is to provide formatting to the XLS output, or to change the extension of the CSVExporter to xls. The ExcelExporter that ships out of the box will create a CSV document, and it will have the csv extension. The approach to both these queries is to use a custom ExcelExporter. Attached below is one such implementation, MyXlsExporter. You can wire this up exactly like above, by inserting it into the MyExportOptions.as and using an instance of MyExportOptions in your CustomPagerControl.

 

MyXlsExporter.as (2.13 kb)

===================================================

Another common issue reported is with Excel not being able to display certain UNICODE characters in the CSV output. The way to handle this is via sending HTML output to excel. Below files demonstrates how to do this.

MyExportOptions.as (1.18 kb)

Utf8ExcelExporter.as (1.09 kb)

 

==================================================

For Ultimate, its a lot easier to override the click event of the excel export button. In Classic (like shown above) you need to create your own pager control. In ultimate, you can simply define a custom toolbarExcelHandlerFunction like below:

public function defaultExcelHandlerFunction():void{
ExtendedExportController.instance().export(this,MyExportOptions.create())
}
Here is a flex project that demonstrates how to do this.

UTF8ExcelExport.zip (6.06 kb)

 

==================================================

Yet Another update - we've added support for highly customizable Excel 2007 OOXML output with Flexicious 3.1 - please review http://blog.flexicious.com/post/Flexicious-30-Release-Grid-Edition.aspx


ISummaryCalculator, GroupingCollection2, and SummaryField2 with the Filter

clock January 13, 2011 10:46 by author Flexicious

Following up on the heels of an older blog post where we demonstrated how to filter out parent entities in hierarchical data when there are no children, here is an example that demonstrates how to update the summary totals that reflect the filter criteria.

To do this, we simply need to implement our own Summary Calculator. (Which is the CustomSummaryCalculator), and in the summary calculator, we check to see if the item is being filtered out before adding it to the summary.


CJ.mxml (3.93 kb)

CustomSummaryOperation.as (3.33 kb)



Flash Builder Burrito Problems View Stealing Focus

clock January 3, 2011 16:06 by author Flexicious

We had an annoying little problem with Flash Builder Burrito with the Problems View Stealing the focus with a bunch of warnings every time  "Design Mode could not load" XXXX.swc. It may be incompatible with this SDK, or Invalid. (DesignAssetLoader.CompleteTimeout). Although we were unable to find a way to resolve these errors, we could make them go away by disabling the design view altogether. You can do this by going into Window-> Enable Design View. 

Who needs the design view anyway?? MXML all the way!

HAPPY NEW YEAR from all of us here at Flexicious!



Customizing the Settings/Print/Export popups - (adding support for AdvancedDataGridColumnGroup example)

clock January 2, 2011 21:20 by author Flexicious

Question: In the Settings/Print/Export popups, It would be nice to have the header text(s) of all the parent AdvancedDataGridColumnGroup headers appended with the actual column header text.

Answer: These popups are in the client section of the code, i.e. you can fully control their appearance. Attached, please find a modified SettingsPopup.mxml that uses a custom labelFunction to append the column group if there is one.

SettingsPopup.mxml (3.68 kb)



Maintaining focus in filter enabled server based grids

clock January 2, 2011 19:16 by author Flexicious

Question: In server mode, when you filter on a text input column, the text input will loose focus when the data provider is set. How can we maintain focus?

Answer: This happens because when you reset the dataprovider, we rebuild the filter row. To maintain focus, you simply need to track the column that triggered the filter, and in the result event, where you set the dataprovider, call the setFilterFocus method. Something like this:

private var filterTriggerColumn:String="";

//This event is fired when the user changes the sort, page or filter
            private function onFilterPageSortChange(event:FilterPageSortChangeEvent):void
            {
                //here we build our custom filter object and send it to the server
                dotNetRemoteObject.getEmployees(new MyFilter(event.filter));
                //we keep track of the field that triggered the filter, to ensure we set the focus back into it
                filterTriggerColumn=event.triggerEvent.currentTarget.searchField;
                   
            }

           //Function to call when server call returns.
            private function onEmployeesResult(event:ResultEvent):void
            {
              
                   ...
                    //if the filter was a result of user interaction, we set the focus into the field again.
                    if(filterTriggerColumn){
                        dgEmployeesServer.validateNow();
                        dgEmployeesServer.setFilterFocus(filterTriggerColumn);
                        filterTriggerColumn="";
                    }
                }
            }

 

Attached, is the updated version of our Server Paging example that demonstrates this. (ServerGridDotNet.mxml)

A similar issue also occurs when the ExtendedAdvancedDatagrid is used with lockedColumns. The solution is similar, that we need to track the column that caused the filter and set focus back on it when the filter complete. (FocusIssue.mxml)

 

ServerGridDotNet.mxml (9.31 kb)

FocusIssue.mxml (4.75 kb)