`
79343654
  • 浏览: 46219 次
  • 性别: Icon_minigender_1
  • 来自: 太原
社区版块
存档分类
最新评论

Struts2 jQuery Plugin Showcase Version 3.2.0 用到的所有JS归类

阅读更多

/*

 * Function for Theme Handling

 *

 */

function changeTheme(newTheme) {

if (newTheme=='showcase')

themePathPrefix = "themes/";

else {

themeHref = $('#jquery_theme_link').attr('href');

if ($("#google").attr('checked')) {

if (themeHref.indexOf("http:")==0) {

prefixIndex = themeHref.indexOf("themes/")+7;

themePathPrefix=themeHref.substring(0,prefixIndex);

}

else {

$("#themeform").submit();

return false;

}

}

else {

themePathPrefix = "struts/themes/";

}

}

$('#jquery_theme_link').attr('href',themePathPrefix+newTheme+'/jquery-ui.css');

}

 

/*

 * Function for Custome Validation Example

 *

 */

function customeValidation(form, errors) {

 

// List for errors

var list = $('#formerrors');

 

// Handle non field errors

if (errors.errors) {

$.each(errors.errors, function(index, value) {

list.append('<li>' + value + '</li>\n');

});

}

 

// Handle field errors

if (errors.fieldErrors) {

$.each(errors.fieldErrors, function(index, value) {

var elem = $('#' + index + 'Error');

if (elem) {

elem.html(value[0]);

elem.addClass('errorLabel');

}

});

}

}

 

/*

 * Function for Tree Node Delete Example

 *

 */

function deleteTreeNode(url, obj) {

$("#result2").load(url +"?echo=Delete%20Node%20"+obj[0].id);

}

 

$(document).ready(function() {

 

$.subscribe('changeTextfield', function(event, data) {

$('#result').html('Textfield '+data.id+' value is '+data.value);

});

 

/*

* Subscribe Topics for AJAX Link Event Example

*/

$.subscribe('beforeLink', function(event, data) {

alert('Before request ');

$('#result').html('Loading ...');

});

$.subscribe('completeLink', function(event, data) {

$('#result').append('<br/><br/><strong>Completed request ' + event.originalEvent.request.statusText + ' completed with ' + event.originalEvent.status + '.</strong><br/>Status: ' + event.originalEvent.request.status);

});

$.subscribe('errorStateLink', function(event, data) {

$('#result').html('<br/><br/><strong>Error request ' + event.originalEvent.request.statusText + ' completed with ' + event.originalEvent.status + '.</strong><br/>Status: ' + event.originalEvent.request.status);

});

 

/*

* Subscribe Topics for AJAX Div Event Example

*/

$.subscribe('beforeDiv', function(event, data) {

alert('Before request ');

});

$.subscribe('completeDiv', function(event, data) {

if (event.originalEvent.status == "success") {

$('#resultnormal').append('<br/><br/><strong>Completed request ' + event.originalEvent.request.statusText + ' completed with ' + event.originalEvent.status + '.</strong><br/>Status: ' + event.originalEvent.request.status);

}

});

$.subscribe('errorDiv', function(event, data) {

$('#resulterror').html('<br/><br/><strong>Error request ' + event.originalEvent.request.statusText + ' completed with ' + event.originalEvent.status + '.</strong><br/>Status: ' + event.originalEvent.request.status);

});

 

/*

* Subscribe Topics for AJAX Form Event Example

*/

$.subscribe('beforeForm', function(event, data) {

var fData = event.originalEvent.formData;

alert('About to submit: \n\n' + fData[0].value + ' to target ' + event.originalEvent.options.target + ' with timeout ' + event.originalEvent.options.timeout);

var form = event.originalEvent.form[0];

if (form.echo.value.length < 2) {

alert('Please enter a value with min 2 characters');

event.originalEvent.options.submit = false;

}

});

$.subscribe('completeForm', function(event, data) {

alert('status: ' + event.originalEvent.status + '\n\nresponseText: \n' + event.originalEvent.request.responseText + '\n\nThe output div should have already been updated with the responseText.');

});

$.subscribe('errorStateForm', function(event, data) {

alert('status: ' + event.originalEvent.status + '\n\nrequest status: ' + event.originalEvent.request.status);

});

 

/*

* Subscribe Topics for AJAX Datepicker Examples

*/

  $.subscribe('onDpChangeMonthAndYear', function(event,data) {

    alert('Change month to : '+event.originalEvent.month+' and year to '+event.originalEvent.year);

  });

$.subscribe('onDpClose', function(event,data) {

   alert('Selected Date : '+event.originalEvent.dateText);

});

 

/*

* Subscribe Topics for Dialog Event Example

*/

$.subscribe('dialogopentopic', function(event, ui) {

alert('run topic on dialog open');

});

$.subscribe('dialogclosetopic', function(event, ui) {

alert('run topic on dialog close');

});

$.subscribe('dialogbeforeclosetopic', function(event, ui) {

alert('run topic befor dialog close');

});

 

/*

* Subscribe Topics for Grid Loadonce Example

*/

$.subscribe('showloadcolumns', function(event, data) {

$.struts2_jquery.require("js/plugins/grid.setcolumns.js");

$("#gridloadtable").jqGrid('setColumns', {});

});

 

/*

* Subscribe Topics for GridEdit Event Example

*/

$.subscribe('rowselect', function(event, data) {

$("#gridinfo").html('<p>Edit Mode for Row : ' + event.originalEvent.id + '</p>');

});

    $.subscribe('oneditsuccess', function(event, data){

var message = event.originalEvent.response.statusText;

$("#gridinfo").html('<p>Status: ' + message + '</p>');

});

$.subscribe('rowadd', function(event, data) {

$("#gridedittable").jqGrid('editGridRow', "new", {

height : 280,

reloadAfterSubmit : false

});

});

$.subscribe('searchgrid', function(event, data) {

$("#gridedittable").jqGrid('searchGrid', {

sopt : [ 'cn', 'bw', 'eq', 'ne', 'lt', 'gt', 'ew' ]

});

});

$.subscribe('showcolumns', function(event, data) {

$.struts2_jquery.require("js/plugins/grid.setcolumns.js");

$("#gridedittable").jqGrid('setColumns', {});

});

 

/*

* Subscribe Topics for Grid Multiselect Example

*/

$.subscribe('getselectedids', function(event, data) {

var s;

s = $("#gridmultitable").jqGrid('getGridParam', 'selarrrow');

alert('Selected Rows : ' + s);

});

 

/*

* Subscribe Topics for Progressbar Change Example

*/

$.subscribe('progressbarchangetopic', function(event, data) {

alert('value changed to : ' + $("#progressbarchange").progressbar('option', 'value'));

});

$.subscribe('progressbarclicktopic', function(event, data) {

$("#progressbarchange").progressbar('value', parseInt((Math.random() * (90)), 10));

});

 

/*

* Subscribe Topics for Slider Range Example

*/

$.subscribe('sliderStop', function(event, data) {

alert('Slider stoped with value : ' + event.originalEvent.ui.value);

});

$.subscribe('sliderRangeStop', function(event, data) {

alert('Slider stoped with values : ' + event.originalEvent.ui.values[0] + ' - ' + event.originalEvent.ui.values[1]);

});

 

/*

* Subscribe Topics for Remote Tabs Example

*/

$.subscribe('tabchange', function(event, data) {

 

var tab = event.originalEvent.ui.index;

$('#changepanel').html('Change to Tab <strong>' + tab + '.</strong>');

$('#infopanel').html('');

if (tab == 2) {

$('#remotetabs').tabs('enable', 3);

} else if (tab == 3) {

$('#remotetabs').tabs('enable', 4);

}

});

$.subscribe('tabcomplete', function(event, ui) {

$('#infopanel').html('<strong>Completed request with Status ' + event.originalEvent.status + '.</strong><br/>Status: ' + event.originalEvent.request.status);

});

    $.subscribe("removeTabEvent", function(event, ui) {

        alert("Tab "+event.originalEvent.ui.tab.text+" was removed.");

    });

 

/*

* Remove Error Labels when Validation Forms are successfully

*/

$.subscribe('removeErrors', function(event, data) {

$('.errorLabel').html('').removeClass('errorLabel');

$('#formerrors').html('');

});

 

/*

* Topic for Remote Link with JSON Result.

*/

$.subscribe('handleJsonResult', function(event, data) {

$('#result').html("<ul id='languagesList'></ul>");

var list = $('#languagesList');

$.each(event.originalEvent.data, function(index, value) {

list.append('<li>' + value + '</li>\n');

});

});

 

/*

* Hide the target after action is complete.

*/

$.subscribe('hideTarget', function(event, data) {

$('#'+event.originalEvent.targets).delay(2000).hide("blind", 2500);

});

 

/*

* Topic for Drag and Drop Example.

*/

$.subscribe('ondrop', function(event,data) {

    $(data).addClass('ui-state-highlight').find('p').html($(event.originalEvent.ui.draggable).attr('id')+' dropped!');

    $(event.originalEvent.ui.draggable).find('p').html('I was dragged!');

});

 

/*

* Topic for Reload Div Examples.

*/

  var refreshDiv1 = 0;

var refreshDiv2 = 0;

var refreshDiv3 = 0;

var refreshList = 0;

 

$.subscribe('refreshlist', function(event, data) {

$.publish('reloadlist');

});

$.subscribe('refreshdiv', function(event, data) {

$.publish('reloaddiv1');

});

$.subscribe('completediv1', function(event, data) {

if (event.originalEvent.status == "success") {

$('#counter1').html(++refreshDiv1);

}

});

$.subscribe('completediv2', function(event, data) {

if (event.originalEvent.status == "success") {

$('#counter2').html(++refreshDiv2);

setTimeout( function() {

$.publish('reloaddiv2');

}, 10000);

}

});

$.subscribe('completediv3', function(event, data) {

if (event.originalEvent.status == "success") {

$('#counter4').html(++refreshDiv3);

setTimeout( function() {

$.publish('reloaddiv3');

}, 15000);

}

});

$.subscribe('completelist', function(event, data) {

if (event.originalEvent.status == "success") {

$('#counter3').html(++refreshList);

}

});

 

  $.subscribe('autocompleteChange', function(event, data) {

  var ui = event.originalEvent.ui;

  if(ui.item) {

    var message = ui.item.value;

    if(ui.item.key) {

    message = '( '+ ui.item.key +' ) '+message;

    }

  $('#topics').html('<b>'+message+'</b>');

  }

});

 

  $.subscribe('autocompleteFocus', function(event, data) {

  var ui = event.originalEvent.ui;

  var message = ui.item.value;

  if(ui.item.key) {

  message = '( '+ ui.item.key +' ) '+message;

  }

$('#topics').html('<u>'+message+'</u>');

});

 

  $.subscribe('autocompleteSelect', function(event, data) {

  var ui = event.originalEvent.ui;

  var message = ui.item.value;

  if(ui.item.key) {

  message = '( '+ ui.item.key +' ) '+message;

  }

$('#topics').html('<i>'+message+'</i>');

});

 

/*

* Subscribe Topics for Chart Example

*/

$.subscribe('chartHover', function(event, data) {

    $("#topicsHover").text(event.originalEvent.pos.x.toFixed(2)+','+event.originalEvent.pos.y.toFixed(2));

});

$.subscribe('chartClick', function(event, data) {

var item = event.originalEvent.item;

    if (item) {

      $("#topicsClick").text("You clicked point " + item.dataIndex + " ("+item.datapoint[0]+","+item.datapoint[1]+") in " + item.series.label + ".");

      event.originalEvent.plot.highlight(item.series, item.datapoint);

    }

});

 

/*

* Subscribe Topics for Tree Example

*/

$.subscribe('treeClicked', function(event, data) {

 var item = event.originalEvent.data.rslt.obj;

 alert('Clicked ID : ' + item.attr("id") + ' - Text ' + item.text());

});

 

/*

* Subscribe Topics for Reichtext Example

*/

$.subscribe('focusRichtext', function(event, data) {

$("#result").addClass('ui-state-active');

$("#result").removeClass('ui-state-highlight');

});

$.subscribe('blurRichtext', function(event, data) {

$("#result").removeClass('ui-state-active');

$("#result").removeClass('ui-state-highlight');

});

$.subscribe('highlightRichtext', function(event, data) {

$("#result").removeClass('ui-state-active');

$("#result").addClass('ui-state-highlight');

});

 

/*

* Menu Highlight

*/

$('div.ui-widget-header > ul > li').click(function() {

$('div.ui-widget-header > ul > li').removeClass('ui-state-active');

$(this).addClass('ui-state-active');

}, function() {

});

$('div.ui-widget-header > ul > li').hover(function() {

$(this).addClass('ui-state-hover');

}, function() {

$(this).removeClass('ui-state-hover');

});

});


分享到:
评论

相关推荐

    struts2-jquery-plugin-3.1.0.jar

    struts2-jquery-plugin-3.1.0.jar

    struts2-jquery-plug ShowCase

    Struts2与jQuery的集成主要依赖于struts2-jquery-plugin,这个插件提供了一系列的标签库,使开发者可以直接在JSP页面中使用jQuery功能,而无需编写大量的JavaScript代码。例如,`&lt;sj:head&gt;`标签会自动引入jQuery库和...

    struts2-jquery-plugin-2.0.0

    struts2-jquery-plugin-2.0.0 struts2-jquery-plugin-2.0.0 struts2-jquery-plugin-2.0.0

    struts2-jquery-plugin

    struts2 jquery plugin ,学习struts2 ,又希望在其中使用Jquery的朋友,不妨看看

    struts2-jquery-plugin使用手册,自己写的

    Struts2-jQuery-Plugin是基于Struts2框架的一个扩展插件,它为开发者提供了丰富的jQuery UI组件,使得在Struts2应用中实现交互式的用户界面变得更加便捷。这个使用手册将详细阐述如何集成并利用该插件提升Web应用的...

    struts2-jquery-plugin插件3.3.3

    最新的struts2-jquery-plugin插件3.3.3,包括jquery-ui和grid,使用标签实现。

    struts2-plugin之jquery

    Struts2-plugin之jQuery是一个关于Java Web开发中的热门框架Struts2与前端库jQuery整合使用的主题。Struts2是一款强大的MVC(Model-View-Controller)框架,它为开发者提供了处理HTTP请求、业务逻辑控制以及视图展示...

    jquery和struts2的整合

    &lt;script src="/struts2-jquery-plugin/js/struts2-jquery-plugin.js"&gt; &lt;link rel="stylesheet" href="/struts2-jquery-plugin/css/struts2-jquery.css" /&gt; ``` (4) **使用jQuery与Struts2交互**:利用jQuery的Ajax...

    struts2-jquery-plugin-3_7_1

    struts2-jquery-plugin jar文件

    Struts2+Jquery+Ajax

    "struts2 jar"文件包含了Struts2框架的核心库,可能包括struts2-core、struts2-convention、struts2-json-plugin等依赖,这些是开发Struts2应用必不可少的组件。 "Struts2"可能是项目实例代码,包括Action类、视图...

    netbeans7.2_struts2_plugin

    首先,我们来看标题"NetBeans7.2_struts2_plugin",这表明我们要讨论的是在NetBeans 7.2版本中用于支持Struts2开发的插件。这个插件是NetBeans IDE为了提供Struts2框架的开发辅助工具而设计的,它包括了对Struts2...

    struts jquery

    在实际项目中,通常会有一些特定的Struts 2与jQuery的整合库,如"struts2-jquery-plugin",它提供了一系列的标签和组件,使开发者能更快速地构建具有交互性的页面。例如,`&lt;sj:submit&gt;`标签可以实现AJAX提交,`...

    Struts2JQueryJson

    Struts2JQueryJson是一个基于Struts2框架与jQuery库,结合JSON(JavaScript Object Notation)数据格式,实现Ajax异步加载对象数据的技术方案。在Web应用开发中,这种技术可以提升用户体验,因为它允许页面部分内容...

    struts2 json plugin jar包

    struts2 json plugin jar包

    struts2-json-plugin-2.3.24-API文档-中文版.zip

    赠送jar包:struts2-json-plugin-2.3.24.jar; 赠送原API文档:struts2-json-plugin-2.3.24-javadoc.jar; 赠送源代码:struts2-json-plugin-2.3.24-sources.jar; 赠送Maven依赖信息文件:struts2-json-plugin-...

    struts2-json-plugin

    struts2-json-plugin,Struts JSON插件

    struts2-json-plugin-2.3.8.jar

    Struts2 JSON Plugin是针对Apache Struts2框架的一个重要组件,版本为2.3.8。这个插件主要的功能是让Struts2应用程序能够轻松地处理JSON(JavaScript Object Notation)数据格式,使得Web应用可以方便地进行JSON序列...

    jQuery Tabs插件EasyTabs.js

    **jQuery EasyTabs.js 插件详解** jQuery EasyTabs.js 是一款功能强大且易于使用的轻量级插件,专为创建响应式的Tab式布局而设计。它允许开发者通过简单的配置选项和自定义事件来实现各种Tab切换效果,为网页内容...

    struts2-struts1-plugin-2.1.8.1.jar

    最新struts2-struts1-plugin-2.1.8.1.jar

    struts2-struts1-plugin-2.1.6.jar

    struts2-struts1-plugin-2.1.6.jar

Global site tag (gtag.js) - Google Analytics