Tuesday, May 3, 2016

jQuery Notification in ZK


1- Download jQuery Plugin.

Link- https://github.com/kamranahmedse/jquery-toast-plugin

Javascript code .

$(document).ready(function() {
toastr.options = {
"closeButton" : true,
"debug" : false,
"progressBar" : true,
"preventDuplicates" : true,
"positionClass" : "toast-top-right",
"onclick" : null,
"showDuration" : "400",
"hideDuration" : "1000",
"timeOut" : "1200",
"extendedTimeOut" : "1000",
"showEasing" : "swing",
"hideEasing" : "linear",
"showMethod" : "fadeIn",
"hideMethod" : "fadeOut"
}


});

ZK Viewmodel  code.

public static void showInfoNotification(String title, String message) {
Clients.evalJavaScript("toastr.info('" + message + "', '" + title + "');");
}

public static void showErrorNotification(String title, String message) {
Clients.evalJavaScript("toastr.error('" + message + "', '" + title + "');");
}

public static void showSuccessNotification(String title, String message) {
Clients.evalJavaScript("toastr.success('" + message + "', '" + title + "');");
}

public static void showWarningNotification(String title, String message) {
Clients.evalJavaScript("toastr.warning('" + message + "', '" + title + "');");
}

public static void showInfoNotification(String message) {
Clients.evalJavaScript("toastr.info('" + message + "', '');");
}

public static void showErrorNotification(String message) {
Clients.evalJavaScript("toastr.error('" + message + "', '');");
}

public static void showSuccessNotification(String message) {
Clients.evalJavaScript("toastr.success('" + message + "', '');");
}

public static void showWarningNotification(String message) {
Clients.evalJavaScript("toastr.warning('" + message + "', '');");
}


How to Calculate the Future Investment Value of Investment.

Below java program for calculate future investment value. Here calculate s using the formula futureInvestmentValue =investmentAmount x (...