NextReports is a very flexible tool to generate any kind or reports / documents. Because it offers possibility to select column sizes, you can practically generate anything from business cards, envelopes, invoices. To illustrate this we can show a simple report to generate business cards for your employees. This can be arranged as you like and printed on an A4.
Layout can be for example as:
Any dynamic fields can be expressed through database columns or expressions, image can be inserted wherever you like, you can adjust your horizontal size by setting columns dimensions, you can adjust your vertical size by setting properties like font size and padding for any cell.
Generated report looks like:
Do you want to generate to a business card A4 template which has two columns? Just use this report as a sub report with a parameter "Employee" which you will use in your query:
Your master report will have a simple query where you will select the employe column with the alias "Employee", identical with sub report parameter name:
and in your layout you will add two sub reports:
So your generated report will be :
Thursday, October 11, 2012
Wednesday, October 03, 2012
NextReports: Widgets with dynamic parameters
NextReports widgets (charts, tables, alarms, pivots) can show you important and live data inside dashboards. The entities behind (charts or reports) can have or not parameters. You can have for example a chart showing exchange rates for the last two weeks without using date parameters (like the one found on the demo server). The query used to perform this using MySql is:
If you want to have parameters, to tweak them for server UI, you must define them with a default source inside designer definition. You can define start date for example to be with 7 days previous to current date like:
End date parameter will be just the current date:
NextReports is able to schedule a report with such parameters using a dynamic check flag. By selecting it, the server assumes that the values for those parameters will be computed at run time instead of using the computed stored (static) default values.
For widgets there was not possible to have dynamic values for parameters. With the forthcoming 5.4 version it will be possible to select dynamic flags for widget settings like in scheduler definition:
In this way you can play with same widget both in seeing data for a dynamic period of time and in analyzing data for a specific static period of time.
If you want to have parameters, to tweak them for server UI, you must define them with a default source inside designer definition. You can define start date for example to be with 7 days previous to current date like:
End date parameter will be just the current date:
NextReports is able to schedule a report with such parameters using a dynamic check flag. By selecting it, the server assumes that the values for those parameters will be computed at run time instead of using the computed stored (static) default values.
For widgets there was not possible to have dynamic values for parameters. With the forthcoming 5.4 version it will be possible to select dynamic flags for widget settings like in scheduler definition:
In this way you can play with same widget both in seeing data for a dynamic period of time and in analyzing data for a specific static period of time.
Tuesday, October 02, 2012
NextReports: Barcodes
Because version 5.3 brought possibility to insert a report in another report, now you can generate even invoices with NextReports. For that a new bar code element was added.
An example with EAN.UCC-13 type looks like:
Do you need to a QRCode? You can do it:
The following bar code types are supported: EAN.UCC-13, EAN.UCC-8, UCC-12, UPC-E, SUPP2, SUPP5, CODE128, CODE128-RAW, INTER25, CODE39, CODE39EXT, CODABAR, PDF417, DATAMATRIX, QRCODE.
An example with EAN.UCC-13 type looks like:
Do you need to a QRCode? You can do it:
The following bar code types are supported: EAN.UCC-13, EAN.UCC-8, UCC-12, UPC-E, SUPP2, SUPP5, CODE128, CODE128-RAW, INTER25, CODE39, CODE39EXT, CODABAR, PDF417, DATAMATRIX, QRCODE.
Thursday, September 27, 2012
Analyzing NextReports downloads with NextReports
Because NextReports is a reporting tool, it can be used to make analysis even on itself. We use NextReports to analyze the download process of its artifacts: engine, designer, server and update (designer download started from application update).
To make this analysis possible a simple pivot is used. This pivot can show things like:
A simple selection that shows the number of downloads for every artifact is like this:
Report used by pivot also has parameters which allows to filter data. For example it is easy to select a period of time between to dates, country, product, version:
Results will show more than simple statistics. It is easy to spot attacks of Denial Of Service type if a large number of downloads is seen from the same ip:
Also it is possible to know how many downloads are done in a period of time, seeing totals for product or for artifact:
This is just an example when NextReports pivot can be really useful to make analysis and get a lot of answers from raw data.
To make this analysis possible a simple pivot is used. This pivot can show things like:
- location from where the download was started through fields like country, city, ip.
- artifact that was downloaded through fields like product, file, version
- time when the download was done through a date field
A simple selection that shows the number of downloads for every artifact is like this:
Report used by pivot also has parameters which allows to filter data. For example it is easy to select a period of time between to dates, country, product, version:
Results will show more than simple statistics. It is easy to spot attacks of Denial Of Service type if a large number of downloads is seen from the same ip:
Also it is possible to know how many downloads are done in a period of time, seeing totals for product or for artifact:
This is just an example when NextReports pivot can be really useful to make analysis and get a lot of answers from raw data.
Monday, September 24, 2012
NextReports: Pivot Widget
NextReports Server allows users to add a pivot widget inside a dashboard. This pivot can be created from any report found on server. Pivot widget is based on a simple sql query without OLAP integration.
User selects what he wants to see on ROW, COLUMN and DATA. Also two check boxes will make the totals for rows and columns visible or not.
When user clicks compute, data is presented to user. Also, on compute action, user selection is saved and when user returns to the widget, this selection is made automatically.
Being a widget, user can also detach a pivot and make it as big as the screen with F11 key to have more space if needed.
Alongside drill-down, pivot widget brings a new BI feature to analyze data.
Because we want to contribute to java open source, our wicket pivot project was put on github.
Do you have something to say about our pivot? Please tell us more on our forum.
User selects what he wants to see on ROW, COLUMN and DATA. Also two check boxes will make the totals for rows and columns visible or not.
When user clicks compute, data is presented to user. Also, on compute action, user selection is saved and when user returns to the widget, this selection is made automatically.
Being a widget, user can also detach a pivot and make it as big as the screen with F11 key to have more space if needed.
Alongside drill-down, pivot widget brings a new BI feature to analyze data.
Because we want to contribute to java open source, our wicket pivot project was put on github.
Do you have something to say about our pivot? Please tell us more on our forum.
Thursday, August 30, 2012
NextReports Server: A good-looking login screen
Application login screen must offer more than just a simple form for credentials. This screen can be the place where user has access to information. Here users can learn what's your application about and can access links to everything they need like manuals, tutorials, license policy and so on.
NextReports Server login was improved to show more info about NextReports Suite in following releases.
Besides all previous links, now users can go directly to next-reports web site to read about engine, designer and server.
NextReports Server login was improved to show more info about NextReports Suite in following releases.
Besides all previous links, now users can go directly to next-reports web site to read about engine, designer and server.
Thursday, August 23, 2012
NextReports: Easy way to use subreports
Following previous post "NextReports: Parent and children reports" it's time to show a simple example of a sub-report usage.
A sub-report is just a simple report with one or more parameters. Let's think about a report which shows a list of employees and the hours they worked for a specific project:
This report has a $P{Project} parameter. When we run it, the value is asked:
and after selection the result is like:
To use this report as a sub-report, we have to create a master report. We use as example a report that selects a list with projects and total hours worked for projects. In one cell we will insert the sub-report, making the layout looking like:
To make our sub-report have the $P{Project} parameter completed for every column $C{Project} NextReports has a simple convention: The column from master report must have an alias with the same name as the parameter from sub-report. In our case both alias column from master and parameter from sub-report have the name Project.
When we run this report we will get a nice PDF. We just use some colors to see what is from master and what is from sub-report.
A sub-report is just a simple report with one or more parameters. Let's think about a report which shows a list of employees and the hours they worked for a specific project:
This report has a $P{Project} parameter. When we run it, the value is asked:
and after selection the result is like:
To use this report as a sub-report, we have to create a master report. We use as example a report that selects a list with projects and total hours worked for projects. In one cell we will insert the sub-report, making the layout looking like:
To make our sub-report have the $P{Project} parameter completed for every column $C{Project} NextReports has a simple convention: The column from master report must have an alias with the same name as the parameter from sub-report. In our case both alias column from master and parameter from sub-report have the name Project.
When we run this report we will get a nice PDF. We just use some colors to see what is from master and what is from sub-report.
Tuesday, August 21, 2012
NextReports: Simplify Perspectives
NextReports Designer uses a concept called "perspectives". Any report or chart can be seen from two perspectives : query (sql) and layout.
Because NextReports has two types of layout entities (charts & reports), designer main toolbar contains three perspective actions:
In the new 5.3 release only two perspective actions will be shown, making user interface more concise:
Practically, "Layout Perspective" will show a report layout or a chart layout . "Layout Perspective" action will be disabled when just a query is loaded and enabled when a report or a chart is loaded.
Because NextReports has two types of layout entities (charts & reports), designer main toolbar contains three perspective actions:
- Query Perspective
- Report Perspective
- Chart Perspective
In the new 5.3 release only two perspective actions will be shown, making user interface more concise:
- Query Perspective
- Layout Perspective
Practically, "Layout Perspective" will show a report layout or a chart layout . "Layout Perspective" action will be disabled when just a query is loaded and enabled when a report or a chart is loaded.
Monday, July 30, 2012
NextReports: Parent and children reports
With 5.3 version, NextReports will bring a very needed feature: possibility to insert a report inside another report. In the same way a chart is inserted inside a report, now a new action is available allowing to add a report. As for charts, all parameters from parent report are passed to child report if child has some identically with parent's ones.
If the child report is inserted inside detail band, to make it acting as a sub-report, it has to meet a simple convention condition. For any child report parameter, if user wants the parameter to have a record-dependent value, the column from parent report (which has to pass the value to sub-report parameter value) must have an alias with the same name as the sub-report parameter name.
Besides a relation of report/sub-report, a parent report can contain just a simple set of children reports allowing to have more queries inside a report. To make this possible, the children reports can be inserted in header or footer bands.
To make work with children charts and reports easier, NextReports Designer will allow to edit children directly from parent report. When we will Edit a chart or a report, designer will open the child and user can do any changes he wants. After the child report/chart is edited, user will return to the parent report through a special action
:
Using this kind of navigation (edit inner report/chart - back to parent), user can go inside & outside to an infinite number of children reports.
If the child report is inserted inside detail band, to make it acting as a sub-report, it has to meet a simple convention condition. For any child report parameter, if user wants the parameter to have a record-dependent value, the column from parent report (which has to pass the value to sub-report parameter value) must have an alias with the same name as the sub-report parameter name.
Besides a relation of report/sub-report, a parent report can contain just a simple set of children reports allowing to have more queries inside a report. To make this possible, the children reports can be inserted in header or footer bands.
To make work with children charts and reports easier, NextReports Designer will allow to edit children directly from parent report. When we will Edit a chart or a report, designer will open the child and user can do any changes he wants. After the child report/chart is edited, user will return to the parent report through a special action
:Using this kind of navigation (edit inner report/chart - back to parent), user can go inside & outside to an infinite number of children reports.
Monday, July 23, 2012
NextReports: Table Widgets with Style
NextReports dashboards can contain table widgets, which basically represent grid reports created with the designer.
Forthcoming version of NextReports will take into account the layout of the report making table widgets to contain corresponding style. This means colors, font style, padding and alignment will be visible. Some properties like font family, font size and borders are not taken into account, being irrelevant.
A major benefit of using styles for table widgets is interpreting formatting conditions (with relevant properties) for cells and rows. Such example can look like :
Forthcoming version of NextReports will take into account the layout of the report making table widgets to contain corresponding style. This means colors, font style, padding and alignment will be visible. Some properties like font family, font size and borders are not taken into account, being irrelevant.
A major benefit of using styles for table widgets is interpreting formatting conditions (with relevant properties) for cells and rows. Such example can look like :
Thursday, June 21, 2012
NextReports Server: Queries
NextReports Server manages reports and charts. Both are created upon an sql query which was not seen anywhere on the server. The only thing users could see was the list of parameters values used to run a query.
Version 5.3 of server will bring more information regarding sql queries. First, in monitor a new column Query will be added:
By clicking it, the full query (with all parameters replaced by the actual run values) will be seen:
In Info actions for report and chart, users will see also the query:
Search actions for report or chart will bring a new entry "Sql Contains" which will look for all entities whose sql queries contain the entered text:
It is possible now to search for a special column or table (for example) used in our reports, identifying very fast what reports may be affected by column or table name changes.
Version 5.3 of server will bring more information regarding sql queries. First, in monitor a new column Query will be added:
By clicking it, the full query (with all parameters replaced by the actual run values) will be seen:
In Info actions for report and chart, users will see also the query:
Search actions for report or chart will bring a new entry "Sql Contains" which will look for all entities whose sql queries contain the entered text:
It is possible now to search for a special column or table (for example) used in our reports, identifying very fast what reports may be affected by column or table name changes.
Wednesday, June 20, 2012
NextReports Designer: your home, your data
NextReports Designer contains internally a lot of user data:
will be created.
There are some things you must be aware of.
When you import from an older version, you must select the user data folder, meaning:
Because there are more users which can work on the same designer, from version 5.3 more instances are allowed. Previous versions allowed only for one instance of NextReports Designer.
- config files which can be modified from UI like settings, servers
- demo data base
- generated logs
- all created queries, reports, charts
- all generated files through export / preview actions
- report and chart templates
- data sources and schemes definitions
- workspace files
- If you install designer as an administrator and you want to use it as a regular user you must have write rights in installation directory
- Two or more users on same computer can see all data and cannot work concurrently
There are some things you must be aware of.
When you import from an older version, you must select the user data folder, meaning:
- old installation folder for version < 5.3 or
- .nextreports-
<version> folder for version >= 5.3
Because there are more users which can work on the same designer, from version 5.3 more instances are allowed. Previous versions allowed only for one instance of NextReports Designer.
Tuesday, May 29, 2012
NextReports Server : Drill down with ease
NextReports Server allows to link an infinite number of drill-down widgets.
Version 5.2 of NextReports Server has a new "Up to Root" link which will make it easier to return to the first entity from wherever the user is inside the drill flow:
Version 5.2 of NextReports Server has a new "Up to Root" link which will make it easier to return to the first entity from wherever the user is inside the drill flow:
Tuesday, May 15, 2012
Wicket : Change an AjaxSelfUpdatingTimerBehavior
NextReports Server supports an automatic refresh for widgets. Just clicking "Edit Settings" for one widget will bring the following dialog:
Here user can modify "Refresh Time" which tells how many seconds should pass till next auto refresh.
To make this happen , an AjaxSelfUpdatingTimerBehavior is used. By default there is no refresh time set (value is 0). A change will imply to stop previous AjaxSelfUpdatingTimerBehavior and to create a new one if that's the case:
Here user can modify "Refresh Time" which tells how many seconds should pass till next auto refresh.
To make this happen , an AjaxSelfUpdatingTimerBehavior is used. By default there is no refresh time set (value is 0). A change will imply to stop previous AjaxSelfUpdatingTimerBehavior and to create a new one if that's the case:
for (Behavior behavior : widgetPanel.getBehaviors()) {
if (behavior instanceof AjaxSelfUpdatingTimerBehavior) {
((AjaxSelfUpdatingTimerBehavior) behavior).stop();
}
}
if (refreshTime > 0) {
widgetPanel.add(new AjaxSelfUpdatingTimerBehavior(Duration.seconds(refreshTime)));
}
There are two things to have in mind:- AjaxSelfUpdatingTimerBehavior must not be removed because, after stop, the event is called one more time on the client, so it has to be present.
- When we already have a refresh time set (greater than 0) and we want to modify its value, if a refresh is done when the dialog is opened, the desired panel no longer exists. So the user will be informed about this through a message (otherwise an error would have been raised):
Wednesday, May 09, 2012
NextReports : Templates for Parameters' Values
When we define parameters in NextReports Designer we can select default values for parameters. These values will be automatically selected in user interface when user runs the report.
There are some special cases of reports with a lot of parameters, when the user may want to have more than a group of default values. To allow such functionality, version 5.2 of NextReports Server will bring a new feature : Templates for Parameters' Values.
Basically, inside the runtime parameters panel, user will be able to save a template of values or to select a previously saved template to automatically load all values.
To save a template, user has to check "Save as" option and to enter a name for the template. Advancing to next step or just finishing will save the values template inside repository. On other runs for same report, user will be able to select the template.
Templates can also be removed by selecting them from a list.
So, in case you have reports with many (dependent) parameters and you need the way to run more variants without a lot of selecting , start using values templates.
There are some special cases of reports with a lot of parameters, when the user may want to have more than a group of default values. To allow such functionality, version 5.2 of NextReports Server will bring a new feature : Templates for Parameters' Values.
Basically, inside the runtime parameters panel, user will be able to save a template of values or to select a previously saved template to automatically load all values.
To save a template, user has to check "Save as" option and to enter a name for the template. Advancing to next step or just finishing will save the values template inside repository. On other runs for same report, user will be able to select the template.
Templates can also be removed by selecting them from a list.
So, in case you have reports with many (dependent) parameters and you need the way to run more variants without a lot of selecting , start using values templates.
Monday, April 30, 2012
Wicket 1.5 and general models
NextReports Server is in process for Wicket 1.5 migration. A lot of things need to be addressed, but in particularly one of them has to be noticed.
Running reports in NextReports Server consists of a number of steps, one of them being selecting parameters. Depending of parameter's type, user can choose the values using a specific UI component like text field, check box, combo box, calendar, selection lists and so on.
Model used for a parameter is something generic like Serializable, because it's type can be anything. One problem appeared at migration from version 1.4 to version 1.5. A simple String TextField with a Serializable model (objectModel in our case):
Running reports in NextReports Server consists of a number of steps, one of them being selecting parameters. Depending of parameter's type, user can choose the values using a specific UI component like text field, check box, combo box, calendar, selection lists and so on.
Model used for a parameter is something generic like Serializable, because it's type can be anything. One problem appeared at migration from version 1.4 to version 1.5. A simple String TextField with a Serializable model (objectModel in our case):
TextField<String> textField = new TextField<String>("txtValue",
new PropertyModel<String>(this, "objectModel"));
When we put a value in our text field, on submit we get : "is not a valid Serializable" error. That shows us Wicket 1.5 does not know that String declaration in our case is a Serializable type. To make models accept a general type , we should now create also the converter used by the component to specify the class type:TextField<String> textField = new TextField<String>("txtValue",
new PropertyModel<String>(this, "objectModel")) {
@Override
public <C> IConverter<C> getConverter(Class<C> type) {
return new AbstractConverter() {
public Object convertToObject(String value, Locale locale) {
return value;
}
@Override
protected Class getTargetType() {
return String.class;
}
};
}
Wednesday, April 18, 2012
NextReports : Row Formatting Conditions
Till version 5.2 NextReports allowed only cell formatting conditions. But the new version will also bring the possibility to add row formatting conditions.
User can select now a row
and row properties will be seen:
Clicking on formatting conditions, user can add, edit or remove them:
In this example we just alternate background color for rows:
We can go further and alternate not rows, but records data. Consider the following report:
We will modify row formatting conditions for all rows like following:
We will obtain:
We can modify more properties for a row formatting condition. For next report:
we will select background and border properties:
Result is:
We can have any expression used for row formatting. Next shows a row formatting simulation if productivity is less than 50%:
If you want to combine cell and row formatting conditions, keep in mind that cell formatting conditions will overwrite row formatting conditions.
User can select now a row
and row properties will be seen:
Clicking on formatting conditions, user can add, edit or remove them:
In this example we just alternate background color for rows:
We can go further and alternate not rows, but records data. Consider the following report:
We will modify row formatting conditions for all rows like following:
We will obtain:
We can modify more properties for a row formatting condition. For next report:
we will select background and border properties:
Result is:
We can have any expression used for row formatting. Next shows a row formatting simulation if productivity is less than 50%:
If you want to combine cell and row formatting conditions, keep in mind that cell formatting conditions will overwrite row formatting conditions.
Thursday, March 22, 2012
NextReports : Text Rotation
In version 5.2 of NextReports a new property for cells is added: text rotation. This property has meaning only for PDF or EXCEL exporter formats. It can have only three degrees values :
And for -90 degrees value:
- 0 : no rotation
- 90 : text is rotated to the left with 90 degrees
- -90 : text is rotated to the right with 90 degrees
And for -90 degrees value:
Monday, March 19, 2012
NextReports Engine : Report Conversion
Version 5.1 of NextReports was already released, but there is the time to look into next version.
One of the biggest feature, NextReports will resolve in version 5.2 is report conversion. This is not a 'visible' feature to the end user, but a back-end functionality.
NextReports supported from start back-end compatibility with older type of reports. Any new functionality was brought to life without breaking compatibility. For NextReports Engine users (developers) this means that anytime when a ReportUtil.loadReport(String xml) or a ReportUtil.loadReport(InputStream is) was done, no xml exception was raised.
To be more flexible in NextReports evolution, an entirely new convert process was integrated. Using a chain of xml converters, a Next report can be modified to a new structure. Practically if a report with version X is loaded by an Y version of engine, where Y > X, the load method will do the following:
The only differences to NextReports Engine are the signatures of the load methods from ReportUtil class which now throw a LoadReportException:
One of the biggest feature, NextReports will resolve in version 5.2 is report conversion. This is not a 'visible' feature to the end user, but a back-end functionality.
NextReports supported from start back-end compatibility with older type of reports. Any new functionality was brought to life without breaking compatibility. For NextReports Engine users (developers) this means that anytime when a ReportUtil.loadReport(String xml) or a ReportUtil.loadReport(InputStream is) was done, no xml exception was raised.
To be more flexible in NextReports evolution, an entirely new convert process was integrated. Using a chain of xml converters, a Next report can be modified to a new structure. Practically if a report with version X is loaded by an Y version of engine, where Y > X, the load method will do the following:
- get report version (X in this case)
- apply a converter chain process if needed
- load the resulted xml
The only differences to NextReports Engine are the signatures of the load methods from ReportUtil class which now throw a LoadReportException:
public static Report loadReport(String xml) throws LoadReportException { ... }
public static Report loadReport(InputStream is) throws LoadReportException { ... }
Friday, March 09, 2012
NextReports : Notifications with Wicket Push
With version 5.1, NextReports Server implements a much-desired feature: message notification.
In previous versions, when a report was manually set to run, user was redirected to Monitor section. Here running processes can be seen and with an auto-refresh at some time the result will appear in history table, containing the link to the document.
In current version, after a manually run, a message in the top right corner will notify that the process started and that a new message will be issued after finish. This first message has a short life of 5 sec and it will disappear after time elapsed. When process is finished, a new message will be shown containing the link to resulted document. This message will live until the user will close it.
If an error occurred during export process, an error message will be shown.
To see the actual error user has to go to Monitor section and look in history table to "Success" column.
If you schedule a report, you will only be notified about it. No messages when the process is finished will be issued.
To implement this notification feature, NextReports uses wicket-stuff push and jQuery jGrowl.
Using a general Observer pattern, first we need an event ReportResultEvent and a listener interface:
Finally our wicket page will contain a message label:
In previous versions, when a report was manually set to run, user was redirected to Monitor section. Here running processes can be seen and with an auto-refresh at some time the result will appear in history table, containing the link to the document.
In current version, after a manually run, a message in the top right corner will notify that the process started and that a new message will be issued after finish. This first message has a short life of 5 sec and it will disappear after time elapsed. When process is finished, a new message will be shown containing the link to resulted document. This message will live until the user will close it.
If an error occurred during export process, an error message will be shown.
To see the actual error user has to go to Monitor section and look in history table to "Success" column.
If you schedule a report, you will only be notified about it. No messages when the process is finished will be issued.
To implement this notification feature, NextReports uses wicket-stuff push and jQuery jGrowl.
Using a general Observer pattern, first we need an event ReportResultEvent and a listener interface:
public interface ReportListener {
public void onFinishRun(ReportResultEvent result);
}
Our ReportService will manage report listeners for current logged user:public void addReportListener(ReportListener reportListener) {
reportListeners.put(SecurityUtil.getLoggedUsername(), reportListener);
}
public void removeReportListener() {
reportListeners.remove(SecurityUtil.getLoggedUsername());
}
public void notifyReportListener(ReportResultEvent event) {
ReportListener reportListener = reportListeners.get(event.getCreator());
if (reportListener != null) {
reportListener.onFinishRun(event);
}
}
When the process is finished we will create the event and we will notify all listeners:ReportResultEvent event = new ReportResultEvent(...); reportService.notifyReportListener(event);To use jGrowl in Wicket it's easy with an AjaxBehavior. Messages will be kept in Session FeedbakMessages list.
public class MessageAjaxBehavior extends AbstractDefaultAjaxBehavior {
public void renderHead(IHeaderResponse response) {
super.renderHead(response);
response.renderJavascriptReference(
new JavascriptResourceReference(MessageAjaxBehavior.class, "jquery.jgrowl.js"));
response.renderCSSReference(
new CompressedResourceReference(JGrowlAjaxBehavior.class, "jquery.jgrowl.css"));
response.renderCSSReference(
new CompressedResourceReference(JGrowlAjaxBehavior.class, "jgrowl.css"));
String feedback = renderFeedback();
if (!StringUtils.isEmpty(feedback)) {
response.renderOnDomReadyJavascript(feedback);
}
}
protected void respond(AjaxRequestTarget target) {
String feedback = renderFeedback();
if (!StringUtils.isEmpty(feedback)) {
target.appendJavascript(feedback);
}
}
.......
}
Rendered feedback message contains the jgrowl javascript text. Message can be sticky to live until user close it, or it can have a time-elapsed life using life with a millisecond value.$.jGrowl("message",
{
theme: 'css-class',
sticky: true // life: 5000
}
)
All options of jGrowl can be found here. Finally our wicket page will contain a message label:
Label messageLabel = new Label("message", "");
messageLabel .setOutputMarkupId(true);
messageLabel .add(new MessageAjaxBehavior());
And we will initialize push service:
protected void onInitialize() {
super.onInitialize();
initPush();
reportService.addReportListener(new ReportListener() {
public void onFinishRun(ReportResultEvent result) {
if (pushService.isConnected(pushNode)) {
// forward the Message event via the push service
// to the push event handler
Message message = createMessage(result);
pushService.publish(pushNode, message);
}
}
});
}
private void initPush() {
// instantiate push event handler
IPushEventHandler handler = new AbstractPushEventHandler() {
public void onEvent(AjaxRequestTarget target, Message event,
IPushNode node, IPushEventContext context) {
getSession().getFeedbackMessages().add(
new FeedbackMessage(null, event.getText(), messageType));
target.addComponent(messageLabel);
}
};
// obtain a reference to a Push service implementation
pushService = TimerPushService.get();
// install push node into this panel
pushNode = pushService.installNode(this, handler);
}
Subscribe to:
Posts (Atom)



















































