/*
* Created on 2004-1-2
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package appeon.aje.forms.core;
import nextapp.echo.Component;
import appeon.aje.forms.core.event.BlockEvent;
import appeon.aje.forms.core.event.BlockListener;
//import nextapp.echoservlet.ClientActionProducer;
//import nextapp.echoservlet.ClientInputProducer;
/**
* @author [email protected]
* This class is written by charles j lee
* you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
public class BlockScrollBar extends Component implements BlockListener
{
private int xPosition = 0;
private int yPosition = 0;
private Block block = null;
private int width = 0;
private int length = 0;
private int maxRecordsNumber;
private boolean isAllRowFetched = false;
private int thumberTop = 0;
private int thumberLength = -1;
public final int NEXT_RECORD = 1;
public final int PREV_RECORD = -1;
public final int NEXT_PAGE = 2;
public final int PREV_PAGE = -2;
public final int CHANGE_POS = 3;
public final int MIN_THUMBER_LEN = 2;
private int changedPosition = 0;
//clientInput string is : changedPosition,thumberLength
public int getThumberLength(){
// if(this.thumberLength < MIN_THUMBER_LEN){
// changeThumberLength();
// }
return this.thumberLength;
}
public void changeThumber(){
IDataModel dataModel = block.getDataModel() ;
int currentMax = dataModel.getNumberOfRowsFetched() + dataModel.getSelectionStart();
if(currentMax > this.maxRecordsNumber) this.maxRecordsNumber = currentMax;
int displayNumber = block.getNumberOfRecordsDisplayed();
this.thumberTop = (int)((float)dataModel.getSelectionStart()
/(this.maxRecordsNumber + displayNumber)
* this.length);
thumberLength = (int)( ((float)displayNumber / (maxRecordsNumber + displayNumber))*length);
if(thumberLength < MIN_THUMBER_LEN){
thumberTop -= MIN_THUMBER_LEN - thumberLength;
thumberLength = MIN_THUMBER_LEN;
}
this.isAllRowFetched = dataModel.isLastRow();
}
public int getThumberTop(){
return this.thumberTop;
}
public void doAction(int actionType){
switch(actionType){
case NEXT_RECORD:
break;
case NEXT_PAGE:
break;
case PREV_RECORD:
break;
case PREV_PAGE:
break;
}
}
public void blockChanged(BlockEvent e){
//IF IS_LAST_RECORD THEN isAllRowFetched = true;
switch(e.getBlockOperation())
{
case BlockEvent.NAVIGATE:
case BlockEvent.INSERT_ROW:
case BlockEvent.DELETE_ROW:
case BlockEvent.QUERY_ROW:
changeThumber();
break;
case BlockEvent.UPDATE_ROW:
break;
case BlockEvent.ENTER_QUERY_MODE:
break;
}
}
public boolean isQueryMode(){
return this.getBlock().getDataModel().isQueryMode();
}
/**
* @return
*/
public Block getBlock() {
return block;
} /**
* @return
*/
public int getLength() {
return length;
} /**
* @return
*/
public int getWidth() {
return width;
} /**
* @return
*/
public int getXPosition() {
return xPosition;
} /**
* @return
*/
public int getYPosition() {
return yPosition;
} /**
* @param block
*/
public void setBlock(Block block) {
this.block = block;
} /**
* @param i
*/
public void setLength(int i) {
length = i;
} /**
* @param i
*/
public void setWidth(int i) {
width = i;
} /**
* @param i
*/
public void setXPosition(int i) {
xPosition = i;
} /**
* @param i
*/
public void setYPosition(int i) {
yPosition = i;
}}
* Created on 2004-1-2
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package appeon.aje.forms.core;
import nextapp.echo.Component;
import appeon.aje.forms.core.event.BlockEvent;
import appeon.aje.forms.core.event.BlockListener;
//import nextapp.echoservlet.ClientActionProducer;
//import nextapp.echoservlet.ClientInputProducer;
/**
* @author [email protected]
* This class is written by charles j lee
* you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*/
public class BlockScrollBar extends Component implements BlockListener
{
private int xPosition = 0;
private int yPosition = 0;
private Block block = null;
private int width = 0;
private int length = 0;
private int maxRecordsNumber;
private boolean isAllRowFetched = false;
private int thumberTop = 0;
private int thumberLength = -1;
public final int NEXT_RECORD = 1;
public final int PREV_RECORD = -1;
public final int NEXT_PAGE = 2;
public final int PREV_PAGE = -2;
public final int CHANGE_POS = 3;
public final int MIN_THUMBER_LEN = 2;
private int changedPosition = 0;
//clientInput string is : changedPosition,thumberLength
public int getThumberLength(){
// if(this.thumberLength < MIN_THUMBER_LEN){
// changeThumberLength();
// }
return this.thumberLength;
}
public void changeThumber(){
IDataModel dataModel = block.getDataModel() ;
int currentMax = dataModel.getNumberOfRowsFetched() + dataModel.getSelectionStart();
if(currentMax > this.maxRecordsNumber) this.maxRecordsNumber = currentMax;
int displayNumber = block.getNumberOfRecordsDisplayed();
this.thumberTop = (int)((float)dataModel.getSelectionStart()
/(this.maxRecordsNumber + displayNumber)
* this.length);
thumberLength = (int)( ((float)displayNumber / (maxRecordsNumber + displayNumber))*length);
if(thumberLength < MIN_THUMBER_LEN){
thumberTop -= MIN_THUMBER_LEN - thumberLength;
thumberLength = MIN_THUMBER_LEN;
}
this.isAllRowFetched = dataModel.isLastRow();
}
public int getThumberTop(){
return this.thumberTop;
}
public void doAction(int actionType){
switch(actionType){
case NEXT_RECORD:
break;
case NEXT_PAGE:
break;
case PREV_RECORD:
break;
case PREV_PAGE:
break;
}
}
public void blockChanged(BlockEvent e){
//IF IS_LAST_RECORD THEN isAllRowFetched = true;
switch(e.getBlockOperation())
{
case BlockEvent.NAVIGATE:
case BlockEvent.INSERT_ROW:
case BlockEvent.DELETE_ROW:
case BlockEvent.QUERY_ROW:
changeThumber();
break;
case BlockEvent.UPDATE_ROW:
break;
case BlockEvent.ENTER_QUERY_MODE:
break;
}
}
public boolean isQueryMode(){
return this.getBlock().getDataModel().isQueryMode();
}
/**
* @return
*/
public Block getBlock() {
return block;
} /**
* @return
*/
public int getLength() {
return length;
} /**
* @return
*/
public int getWidth() {
return width;
} /**
* @return
*/
public int getXPosition() {
return xPosition;
} /**
* @return
*/
public int getYPosition() {
return yPosition;
} /**
* @param block
*/
public void setBlock(Block block) {
this.block = block;
} /**
* @param i
*/
public void setLength(int i) {
length = i;
} /**
* @param i
*/
public void setWidth(int i) {
width = i;
} /**
* @param i
*/
public void setXPosition(int i) {
xPosition = i;
} /**
* @param i
*/
public void setYPosition(int i) {
yPosition = i;
}}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货