Skip to content

Commit

Permalink
修复进度条
Browse files Browse the repository at this point in the history
  • Loading branch information
yiifaa committed Jun 23, 2017
1 parent bda2260 commit f41b2f7
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 152 deletions.
Binary file added Birt视图层次.xmind
Binary file not shown.
7 changes: 7 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,12 @@ birt报表网页预览版

## 2017-06-23
1. 删除了无用的jsp.jar
2. 替换了布局的头部;
3. 修复了非安全"Connection"-"keep-alive"Bug;
4. 替换了分页组件;
5. 为系统添加了中国国际化(国际化文件:src/org/eclipse/birt/report/resource/Messages_zh-CN.properties)
6. 添加了JSTL支持
7. 绘制了Birt视图层次,参见Birt视图层次.xmind



196 changes: 94 additions & 102 deletions WebContent/birt/ajax/ui/app/BirtProgressBar.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
/******************************************************************************
* Copyright (c) 2004 Actuate Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Actuate Corporation - Initial implementation.
*****************************************************************************/

/**
* BirtProgressBar
* ...
*/
BirtProgressBar = Class.create( );
BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
BirtProgressBar = Class.create();
BirtProgressBar.prototype = Object.extend(new AbstractUIComponent(),
{
/**
* Latency that will trigger the progress bar.
Expand Down Expand Up @@ -60,32 +50,37 @@ BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
* Initialization routine required by "ProtoType" lib.
* @return, void
*/
initialize : function( id )
{
this.__initBase( id );
this.__mask = this.__create_mask( );
this.__cb_bind_closure = this.__cb_bind.bindAsEventListener( this );
this.__neh_click_closure = this.__neh_click.bindAsEventListener( this );
initialize : function(id) {
// 初始化对话框
this.view = jQuery(document.getElementById(id));
this.view.modal({
backdrop : 'static',
keyboard : false,
show : false // 默认是否显示
})
// 其他代码
this.__initBase(id);
// this.__mask = this.__create_mask();
this.__cb_bind_closure = this.__cb_bind.bindAsEventListener(this);
this.__neh_click_closure = this.__neh_click.bindAsEventListener(this);

this.__installEventHandlers( id );
this.__installEventHandlers(id);
},

/**
* Binding data to the dialog UI. Data includes zoom scaling factor.
*
* @return, void
*/
__cb_bind : function( )
__cb_bind : function()
{
if( birtCommunicationManager.__active )
{
this.__timer = window.setTimeout( this.__cb_bind_closure, this.__interval );
this.__l_show( );
if(birtCommunicationManager.__active) {
this.__timer = window.setTimeout(this.__cb_bind_closure, this.__interval);
this.__l_show();
}
else
{
window.clearTimeout( this.__timer );
this.__l_hide( );
else {
window.clearTimeout(this.__timer);
this.__l_hide();
}
},

Expand All @@ -95,11 +90,12 @@ BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
* @id, response id
* @return, void
*/
__installEventHandlers : function( id )
__installEventHandlers : function(id)
{
var oCancel = this.__loc_cancel_button( );
if( oCancel )
Event.observe( oCancel, 'click', this.__neh_click_closure, false );
var oCancel = this.__loc_cancel_button();
if(oCancel) {
Event.observe(oCancel, 'click', this.__neh_click_closure, false);
}
},

/**
Expand All @@ -108,27 +104,26 @@ BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
* @id, response id
* @return, void
*/
__start : function( )
__start : function()
{
// check taskid
var taskid = birtUtility.getTaskId( );
if( taskid.length > 0 )
{
var taskid = birtUtility.getTaskId();
if(taskid.length > 0) {
// if taskid existed, show 'Cancel' button
this.__l_show_cancel_button( );
this.__l_show_cancel_button();

// enable 'cancel' button
var oCancel = this.__loc_cancel_button( );
if( oCancel )
var oCancel = this.__loc_cancel_button();
if(oCancel) {
oCancel.disabled = false;
}
}
else
{
else {
// hide 'Cancel' button
this.__l_hide_cancel_button( );
this.__l_hide_cancel_button();
}

this.__timer = window.setTimeout( this.__cb_bind_closure, this.__interval );
this.__timer = window.setTimeout(this.__cb_bind_closure, this.__interval);
},

/**
Expand All @@ -137,13 +132,13 @@ BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
* @id, response id
* @return, void
*/
__stop : function( )
__stop : function()
{
window.clearTimeout( this.__timer );
this.__l_hide( );
window.clearTimeout(this.__timer);
this.__l_hide();

// clear taskid
birtUtility.clearTaskId( );
birtUtility.clearTaskId();
},

/**
Expand All @@ -152,60 +147,61 @@ BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
* @id, response id
* @return, void
*/
__create_mask : function( )
__create_mask : function()
{
var oMask = document.createElement( 'iframe' );
var oMask = document.createElement('iframe');
// Workaround for IE https secure warning
oMask.src = "birt/pages/common/blank.html";
oMask.style.position = 'absolute';
oMask.style.top = '0px';
oMask.style.left = '0px';
oMask.style.width = '100%';
var height = BirtPosition.viewportHeight( );
var height = BirtPosition.viewportHeight();
oMask.style.height = height + 'px';
oMask.style.zIndex = '300';
oMask.style.backgroundColor = '#dbe4ee';
oMask.style.filter = 'alpha( opacity = 0.0 )';
oMask.style.filter = 'alpha(opacity = 0.0)';
oMask.style.opacity = '.0';
oMask.scrolling = 'no';
oMask.marginHeight = '0px';
oMask.marginWidth = '0px';
oMask.style.display = 'none';
document.body.appendChild( oMask );
document.body.appendChild(oMask);

return oMask;
},

/**
* Show progress bar.
*/
__l_show : function( )
{
[ this.__mask, this.__instance ].each( Element.show );
BirtPosition.center( this.__instance );
__l_show : function() {
this.view.modal('show')
// [ this.__mask, this.__instance ].each(Element.show);
// BirtPosition.center(this.__instance);
},

/**
* Hide progress bar.
*/
__l_hide : function( )
{
[ this.__instance, this.__mask ].each( Element.hide );
__l_hide : function() {
this.view.modal('hide')
// [ this.__instance, this.__mask ].each(Element.hide);
},

/**
* Returns 'cancel' button
* @return, INPUT
*/
__loc_cancel_button: function( )
{
var oIEC = this.__instance.getElementsByTagName( "input" );
__loc_cancel_button: function() {
return document.getElementById(this.__cancel_button);
/**
var oIEC = this.__instance.getElementsByTagName("input");
var oCancel;
if( oIEC && oIEC.length > 0 )
if(oIEC && oIEC.length > 0)
{
for( var i = 0 ; i < oIEC.length; i++ )
for(var i = 0 ; i < oIEC.length; i++)
{
if( oIEC[i].type == 'button' )
if(oIEC[i].type == 'button')
{
oCancel = oIEC[i];
break;
Expand All @@ -214,6 +210,7 @@ BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
}
return oCancel;
**/
},

/**
Expand All @@ -222,19 +219,14 @@ BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
* @event, incoming browser native event
* @return, void
*/
__neh_click: function( event )
{
var oTaskId = document.getElementById( this.__task_id );
if( oTaskId && window.confirm( Constants.error.confirmCancelTask ) )
{
if( this.__redirect )
{
this.cancel( oTaskId.value );
}
else
{
birtEventDispatcher.broadcastEvent( birtEvent.__E_CANCEL_TASK, { name : Constants.PARAM_TASKID, value : oTaskId.value } );
Event.element( event ).disabled = true;
__neh_click: function(event) {
var oTaskId = document.getElementById(this.__task_id);
if(oTaskId && window.confirm(Constants.error.confirmCancelTask)) {
if(this.__redirect) {
this.cancel(oTaskId.value);
} else {
birtEventDispatcher.broadcastEvent(birtEvent.__E_CANCEL_TASK, { name : Constants.PARAM_TASKID, value : oTaskId.value });
Event.element(event).disabled = true;
}
}
},
Expand All @@ -244,61 +236,62 @@ BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
*
* @return, void
*/
cancel: function( taskid )
cancel: function(taskid)
{
if( !taskid )
{
var oTaskId = document.getElementById( this.__task_id );
if( oTaskId )
if(!taskid) {
var oTaskId = document.getElementById(this.__task_id);
if(oTaskId) {
taskid = oTaskId.value;
}
}

if( !taskid || taskid.length <= 0 )
if(!taskid || taskid.length <= 0)
return;

var hiddenForm = document.createElement( 'form' );
var hiddenForm = document.createElement('form');
hiddenForm.method = 'post';
hiddenForm.target = '_self';
var url = soapURL;
url = url.replace( /[\/][a-zA-Z]+[?]/, '/CancelTask.jsp?' );
url = url.replace(/[\/][a-zA-Z]+[?]/, '/CancelTask.jsp?');
hiddenForm.action = url;

var taskidInput = document.createElement( 'input' );
var taskidInput = document.createElement('input');
taskidInput.type = 'hidden';
taskidInput.name = Constants.PARAM_TASKID;
taskidInput.value = taskid;
hiddenForm.appendChild( taskidInput );
hiddenForm.appendChild(taskidInput);

var divObj = document.createElement( "DIV" );
document.body.appendChild( divObj );
var divObj = document.createElement("DIV");
document.body.appendChild(divObj);
divObj.style.display = "none";
divObj.appendChild( hiddenForm );
divObj.appendChild(hiddenForm);

hiddenForm.submit( );
hiddenForm.submit();
},

/**
* Show "Cancel" button.
*
* @return, void
*/
__l_show_cancel_button: function( )
__l_show_cancel_button: function()
{
var container = document.getElementById( this.__cancel_button );
if( container )
var container = document.getElementById(this.__cancel_button);
if(container) {
container.style.display = 'block';
}
},

/**
* Hide "Cancel" button.
*
* @return, void
*/
__l_hide_cancel_button: function( )
{
var container = document.getElementById( this.__cancel_button );
if( container )
__l_hide_cancel_button: function() {
var container = document.getElementById(this.__cancel_button);
if(container) {
container.style.display = 'none';
}
},

/**
Expand All @@ -307,8 +300,7 @@ BirtProgressBar.prototype = Object.extend( new AbstractUIComponent( ),
* @param, flag
* @return, void
*/
setRedirect : function( flag )
{
setRedirect : function(flag) {
this.__redirect = flag;
}
} );
});
Loading

0 comments on commit f41b2f7

Please sign in to comment.