📄 databuffer.java
字号:
while (contentsRowI.hasNext()) {
GenericValue testEntity = (GenericValue) contentsRowI.next();
if (testEntity.getEntityName().equals(entityName)) {
if (TIMER) {
utilTimer.timerString(5,
"[DataBuffer.getGenericValue(entityName, contentsRow)] Finished");
}
return testEntity;
}
}
throw new GenericEntityException(
"No generic value found with entity name " + entityName);
}
/**
* DOCUMENT ME!
*
* @return
*/
public GenericDelegator getDelegator() {
return delegator;
}
/**
* DOCUMENT ME!
*
* @param delegator_
*/
public void setDelegator(GenericDelegator delegator_) {
delegator = delegator_;
}
/**
* DOCUMENT ME!
*
* @return
*/
public DataMatrix getParentDataMatrix() {
return parentDataMatrix;
}
/**
* DOCUMENT ME!
*
* @param parentDataMatrix_
*/
public void setParentDataMatrix(DataMatrix parentDataMatrix_) {
parentDataMatrix = parentDataMatrix_;
}
/**
* DOCUMENT ME!
*
* @return
*/
public int getRowCount() {
return rowCount;
}
/**
* DOCUMENT ME!
*
* @param rowCount_
*/
public void setRowCount(int rowCount_) {
rowCount = rowCount_;
}
//-------------------------------------------------------------------------
// Put values from the screen into the data buffer
//-------------------------------------------------------------------------
/*
// This works, but it is not used because it is slow to do the buffers separately.
public int fillFromHtml(
HttpServletRequest request,
String htmlNamePrefix,
UIScreenSection uiScreenSection)
throws GenericEntityException {
UtilTimer utilTimer = new UtilTimer();
if (TIMER) utilTimer.timerString(5, "[DataBuffer.fillFromHtml] Start");
// Get the row count.
if (request.getParameter("rowCount")==null)
throw new GenericEntityException("rowCount parameter not found in request object.");
if (request.getParameter("rowCount").equals(""))
throw new GenericEntityException("rowCount parameter is empty in request object.");
try {
setRowCount(Integer.valueOf(request.getParameter("rowCount")).intValue());
} catch (NumberFormatException e) {
throw new GenericEntityException("rowCount parameter in request object does not contain a number.");
}
for (int row = 0; row < getRowCount(); row++) {
// Create an array list of empty generic values to hold the values from the screen for one row.
addContentsRow(getRowFromHTML(row, request, htmlNamePrefix, uiScreenSection));
}
if (TIMER) utilTimer.timerString(5, "[DataBuffer.fillFromHtml] Finished");
return getRowCount();
}
//-------------------------------------------------------------------------
// Get an array list containing the values from the screen by entity.
//-------------------------------------------------------------------------
// This works, but it is not used because it is slow to do the buffers separately.
public Vector getRowFromHTML(
int row,
HttpServletRequest request,
String htmlNamePrefix,
UIScreenSection uiScreenSection)
throws GenericEntityException {
UtilTimer utilTimer = new UtilTimer();
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Start");
Vector contentsRow = createEmptyRow();
// Loop through the entities and attributes for the current screen section, and get the value
// from the request object for each one, and store it in the contents.
for (int entityNbr = 0; entityNbr < getParentDataMatrix().getEntityParamVector().size(); entityNbr++) {
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Start processing entity " + String.valueOf(entityNbr));
String entityName = getParentDataMatrix().getEntityName(entityNbr);
GenericValue gV = getGenericValue(entityName, contentsRow);
for (int attributeNbr = 0; attributeNbr < getParentDataMatrix().getAttributeVector(entityNbr).size(); attributeNbr++) {
String attributeName = getParentDataMatrix().getAttributeName(entityNbr, attributeNbr);
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Start processing attribute " + attributeName);
String paramName = UIWebUtility.getParamName(htmlNamePrefix, entityName, attributeName, row);
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Start getting UIFieldInfo");
UIFieldInfo uiFieldInfo = uiScreenSection.getUiField(entityName, attributeName);
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Finished getting UIFieldInfo");
if (uiFieldInfo != null && uiFieldInfo.getDisplayOrder() > 0) {
// This field was put into the form (as visible or hidden). Get the display object.
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Start getting UIDisplayObject");
// UIDisplayObject uiDisplayObject = new UIDisplayObject(uiFieldInfo.getDisplayObjectId(), getDelegator());
UIDisplayObject uiDisplayObject = uiFieldInfo.getUiDisplayObject();
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Finished getting UIDisplayObject");
// Find out if this field is a check box. If so, need to use special handling.
boolean isCheckbox = false;
if (uiDisplayObject.getDisplayTypeId().equals(uiDisplayObject.DISPLAY_TYPE_CHECKBOX)) {
isCheckbox = true;
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Start getting UIDisplayObject attributes");
uiDisplayObject.loadAttributes();
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Finished getting UIDisplayObject attributes");
}
if (request.getParameter(paramName)==null) {
// Attribute does not appear in the parameters.
if (isCheckbox) {
// Check box. Get the unchecked value, and store it in the buffer.
EventUtility.storeCorrectDataType(gV, attributeName, uiDisplayObject.getAttribUncheckedValue(), getDelegator());
} else {
// Skip this attribute. It is not displayed on the screen section.
}
} else {
if (isCheckbox) {
// Check box. Get the checked value, and store it in the buffer.
EventUtility.storeCorrectDataType(gV, attributeName, uiDisplayObject.getAttribCheckedValue(), getDelegator());
} else {
// Non-checkbox field. Just store the value.
String attributeValue = request.getParameter(paramName);
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Calling storeCorrectDataType");
EventUtility.storeCorrectDataType(gV, attributeName, attributeValue, getDelegator());
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Finished storeCorrectDataType");
}
}
}
}
}
if (TIMER) utilTimer.timerString(6, "[DataBuffer.getRowFromHTML] Finished");
return contentsRow;
}
*/
public Vector createEmptyRow() throws GenericEntityException {
UtilTimer utilTimer = new UtilTimer();
if (TIMER) {
utilTimer.timerString(5, "[DataBuffer.createEmptyRow] Start");
}
Vector entityNameVector = getParentDataMatrix().getEntityNameVector();
Vector contentsRow = new Vector(entityNameVector.size());
Iterator entityIterator = entityNameVector.iterator();
while (entityIterator.hasNext()) {
String entityName = (String) entityIterator.next();
ModelEntity entityME = getDelegator().getModelEntity(entityName);
GenericValue blankGV = new GenericValue(entityME);
blankGV.setDelegator(getDelegator());
contentsRow.add(blankGV);
}
if (TIMER) {
utilTimer.timerString(5, "[DataBuffer.createEmptyRow] Finished");
}
return contentsRow;
}
/**
* DOCUMENT ME!
*
* @throws GenericEntityException
*/
public void addEmptyRow() throws GenericEntityException {
UtilTimer utilTimer = new UtilTimer();
if (TIMER) {
utilTimer.timerString(5, "[DataBuffer.addEmptyRow] Start");
}
addContentsRow(createEmptyRow());
if (TIMER) {
utilTimer.timerString(5, "[DataBuffer.addEmptyRow] Finished");
}
return;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -