📄 uidisplayobject.java
字号:
/*
*
* Copyright (c) 2004 SourceTap - www.sourcetap.com
*
* The contents of this file are subject to the SourceTap Public License
* ("License"); You may not use this file except in compliance with the
* License. You may obtain a copy of the License at http://www.sourcetap.com/license.htm
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
*/
package com.sourcetap.sfa.ui;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import org.ofbiz.base.util.UtilTimer;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericPK;
import org.ofbiz.entity.GenericValue;
import org.ofbiz.entity.model.ModelEntity;
/**
* DOCUMENT ME!
*
*/
public class UIDisplayObject {
public static final String module = UIDisplayObject.class.getName();
private static final boolean TIMER = false;
public static final String DISPLAY_TYPE_CHECKBOX = "CHECKBOX";
public static final String DISPLAY_TYPE_CURRENCY = "CURRENCY";
public static final String DISPLAY_TYPE_DATE = "DATE";
public static final String DISPLAY_TYPE_DATETIME = "DATETIME";
public static final String DISPLAY_TYPE_HIDDEN = "HIDDEN";
public static final String DISPLAY_TYPE_NUMBER = "NUMBER";
public static final String DISPLAY_TYPE_PERCENT = "PERCENT";
public static final String DISPLAY_TYPE_SEARCH_TEXT = "SEARCH_TEXT";
public static final String DISPLAY_TYPE_SELECT = "SELECT";
public static final String DISPLAY_TYPE_TEXT = "TEXT";
public static final String DISPLAY_TYPE_TEXTAREA = "TEXTAREA";
public static final String DISPLAY_TYPE_TIME = "TIME";
public static final String DISPLAY_TYPE_FILE = "FILE";
protected String displayObjectId = "";
protected String displayTypeId = "";
protected String attribAlign = "";
protected String attribAnchorHrefDef = "";
protected String attribAnchorTarget = "";
protected String attribCheckedDisplay = "Yes";
protected String attribCheckedValue = "Y";
protected String attribClass = "";
protected String attribCols = "";
protected String attribDisabled = "";
protected String attribDisplayMask = "";
protected String attribEmptyFirst = "";
protected String attribEntity = "";
protected String attribEntityDisplayDef = "";
protected String attribEventHandling = "";
protected String attribEntityFindDef = "";
protected String attribEntityFindMethod = "";
protected String attribEntityOrderDef = "";
protected String attribEntityPkFindDef = "";
protected String attribEntityValueDef = "";
protected String attribEntitySearchDef = "";
protected String attribFixedValues = "";
protected String attribFillMethod = "";
protected String attribMaxLength = "";
protected String attribRows = "";
protected String attribSize = "";
protected String attribReadOnly = "";
protected String attribUncheckedDisplay = "No";
protected String attribUncheckedValue = "N";
protected String attribWrap = "";
protected GenericDelegator delegator = null;
protected boolean attributesLoaded = false;
public UIDisplayObject(String displayObjectId, GenericDelegator delegator)
throws GenericEntityException {
UtilTimer timer = new UtilTimer();
if (TIMER) {
timer.timerString(3, "[UIDisplayObject.UIDisplayObject] Start");
}
// Get the UI display object generic value from the database.
ModelEntity uiDisplayObjectEntity = delegator.getModelEntity(
"UiDisplayObject");
HashMap findMap = new HashMap();
findMap.put("displayObjectId", displayObjectId);
GenericPK uiDisplayObjectPK = new GenericPK(uiDisplayObjectEntity,
findMap);
GenericValue uiDisplayObjectGV = delegator.findByPrimaryKey(uiDisplayObjectPK);
if (uiDisplayObjectGV == null) {
throw new GenericEntityException(
"No display object was found with ID " + displayObjectId);
}
setDisplayObjectId(displayObjectId);
setDisplayTypeId(uiDisplayObjectGV.getString("displayTypeId"));
setDelegator(delegator);
if (TIMER) {
timer.timerString(3, "[UIDisplayObject.UIDisplayObject] End");
}
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getDisplayObjectId() {
return displayObjectId;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getDisplayTypeId() {
return displayTypeId;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribAlign() {
return attribAlign;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribAnchorHrefDef() {
return attribAnchorHrefDef;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribAnchorTarget() {
return attribAnchorTarget;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribCheckedDisplay() {
return attribCheckedDisplay;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribCheckedValue() {
return attribCheckedValue;
}
/**
* DOCUMENT ME!
*
* @param action
* @param isMandatory
*
* @return
*/
public String getAttribClass(String action, boolean isMandatory) {
if (attribClass.equals("")) {
// Class is empty. Just return it.
return attribClass;
} else {
if (action.equals(UIScreenSection.ACTION_SHOW_QUERY) ||
action.equals(UIScreenSection.ACTION_SHOW_QUERY_REPORT) ||
action.equals(UIScreenSection.ACTION_SHOW_REPORT)) {
return attribClass + "Query";
} else if (isMandatory) {
return attribClass + "Mandatory";
} else {
return attribClass;
}
}
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribCols() {
return attribCols;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribDisabled() {
return attribDisabled;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribDisplayMask() {
return attribDisplayMask;
}
/**
* DOCUMENT ME!
*
* @param action
*
* @return
*/
public String getAttribEmptyFirst(String action) {
if (action.equals(UIScreenSection.ACTION_SHOW_QUERY)) {
return "Y";
} else {
return attribEmptyFirst;
}
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribEntity() {
return attribEntity;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribEntityDisplayDef() {
return attribEntityDisplayDef;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribEventHandling() {
return attribEventHandling;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribEntityFindDef() {
return attribEntityFindDef;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribEntityFindMethod() {
return attribEntityFindMethod;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribEntityOrderDef() {
return attribEntityOrderDef;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribEntityPkFindDef() {
return attribEntityPkFindDef;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribEntityValueDef() {
return attribEntityValueDef;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribEntitySearchDef() {
return attribEntitySearchDef;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribFixedValues() {
return attribFixedValues;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribFillMethod() {
return attribFillMethod;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribMaxLength() {
return attribMaxLength;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribRows() {
return attribRows;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribSize() {
return attribSize;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribReadOnly() {
return attribReadOnly;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribUncheckedDisplay() {
return attribUncheckedDisplay;
}
/**
* DOCUMENT ME!
*
* @return
*/
public String getAttribUncheckedValue() {
return attribUncheckedValue;
}
/**
* DOCUMENT ME!
*
* @return
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -