- 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:
public static Report loadReport(String xml) throws LoadReportException { ... } public static Report loadReport(InputStream is) throws LoadReportException { ... }
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.
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); }