⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 uifieldinfo.java

📁 国外的一套开源CRM
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * 
 * 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 org.ofbiz.base.util.UtilTimer;
import org.ofbiz.entity.GenericDelegator;
import org.ofbiz.entity.GenericEntityException;
import org.ofbiz.entity.GenericValue;


/**
 * DOCUMENT ME!
 *
 */
public class UIFieldInfo {
	public static final String module = UIFieldInfo.class.getName();
    private static final boolean TIMER = false;
    protected static final int DEFAULT_WIDTH = 100;
    protected String sectionId = "";
    protected String partyId = "";
    protected String attributeId = "";
    protected String displayLabel = "";
    protected int displayLength = DEFAULT_WIDTH;
    protected int maxLength = DEFAULT_WIDTH;

    //	protected boolean isUpdateable = false;
    protected boolean isReadOnly = false;
    protected boolean isVisible = true;
    protected boolean isMandatory = false;
    protected boolean isSearchable = false;
    protected int displayOrder = 0;
    protected String displayObjectId = "";
    protected int rowSpan = 0;
    protected int colSpan = 0;
    protected boolean startOnNewRow = false;

    //	protected UIScreen uiScreen = null;
    //	protected UIScreenSection uiScreenSection = null;
    //	protected UIEntity uiEntity = null;
    protected UIScreenSectionEntity uiScreenSectionEntity = null;
    protected UIAttribute uiAttribute = null;
    protected UIDisplayObject uiDisplayObject = null;

    public UIFieldInfo(GenericValue uiScreenSectionInfoGV,
        GenericDelegator delegator, UICache uiCache)
        throws GenericEntityException {
        UtilTimer timer = new UtilTimer();

        if (TIMER) {
            timer.timerString(1, "[UIFieldInfo.UIFieldInfo] Start");
        }

        setSectionId(uiScreenSectionInfoGV.getString("sectionId"));
        setPartyId(uiScreenSectionInfoGV.getString("partyId"));
        setAttributeId(uiScreenSectionInfoGV.getString("attributeId"));
        setDisplayObjectId(uiScreenSectionInfoGV.getString("displayObjectId"));
        setMaxLength(uiScreenSectionInfoGV.getString("maxLength"));
        setIsMandatory(uiScreenSectionInfoGV.getString("isMandatory"));
        setIsReadOnly(uiScreenSectionInfoGV.getString("isReadOnly"));
        setIsVisible(uiScreenSectionInfoGV.getString("isVisible"));
        setIsSearchable(uiScreenSectionInfoGV.getString("isSearchable"));
        setDisplayOrder(uiScreenSectionInfoGV.getString("displayOrder"));
        setDisplayLabel(uiScreenSectionInfoGV.getString("displayLabel"));
        setDisplayLength(uiScreenSectionInfoGV.getString("displayLength"));
        setColSpan(uiScreenSectionInfoGV.getString("colSpan"));
        setRowSpan(uiScreenSectionInfoGV.getString("rowSpan"));
        setStartOnNewRow(uiScreenSectionInfoGV.getString("startOnNewRow"));

        // Get the UIDisplayObject.
        if (TIMER) {
            timer.timerString(2,
                "[UIFieldInfo.UIFieldInfo] Looking for UIDisplayObject in cache.");
        }

        String displayObjectId = getDisplayObjectId();
        UIDisplayObject uiDisplayObject = uiCache.getUiDisplayObject(displayObjectId);

        if (uiDisplayObject == null) {
            if (TIMER) {
                timer.timerString(2,
                    "[UIFieldInfo.UIFieldInfo] UIDisplayObject not found in cache. Creating a new one.");
            }

            uiDisplayObject = new UIDisplayObject(displayObjectId, delegator);
            uiCache.putUiDisplayObject(displayObjectId, uiDisplayObject);
        } else {
            if (TIMER) {
                timer.timerString(2,
                    "[UIFieldInfo.UIFieldInfo] Found UIDisplayObject in cache.");
            }
        }

        setUiDisplayObject(uiDisplayObject);

        if (TIMER) {
            timer.timerString(2, "[UIFieldInfo.UIFieldInfo] Got UIDisplayObject");
        }

        // Get the UIAttribute object.
        if (TIMER) {
            timer.timerString(2,
                "[UIFieldInfo.UIFieldInfo] Looking for UIAttribute " +
                attributeId + " in cache.");
        }

        String attributeId = getAttributeId();
        UIAttribute uiAttribute = uiCache.getUiAttribute(attributeId);

        if (uiAttribute == null) {
            throw new GenericEntityException("Attribute " + attributeId +
                " does not appear in any of the entities for this screen section.");
        } else {
            if (TIMER) {
                timer.timerString(2,
                    "[UIFieldInfo.UIFieldInfo] Found UIAttribute in cache.");
            }
        }

        setUiAttribute(uiAttribute);

        if (TIMER) {
            timer.timerString(2, "[UIFieldInfo.UIFieldInfo] Got UIAttribute");
        }

        // Get the UIScreenSectionEntity object.
        if (TIMER) {
            timer.timerString(2,
                "[UIFieldInfo.UIFieldInfo] Looking for UIScreenSectionEntity in cache.");
        }

        String sectionId = getSectionId();
        String entityId = getUiAttribute().getEntityId();
        UIScreenSectionEntity uiScreenSectionEntity = uiCache.getUiScreenSectionEntity(sectionId,
                entityId);

        if (uiScreenSectionEntity == null) {

            throw new GenericEntityException("Attribute '" +
                getUiAttribute().getAttributeName() +
                "' does not appear in any of the entities for this screen section.");
        } else {
            if (TIMER) {
                timer.timerString(2,
                    "[UIFieldInfo.UIFieldInfo] Found UIScreenSectionEntity in cache.");
            }
        }

        setUiScreenSectionEntity(uiScreenSectionEntity);

        if (TIMER) {
            timer.timerString(2,
                "[UIFieldInfo.UIFieldInfo] Got UIScreenSectionEntity");
        }

        if (TIMER) {
            timer.timerString(1, "[UIFieldInfo.UIFieldInfo] End");
        }
    }

    /**
     * DOCUMENT ME!
     *
     * @param sectionId_ 
     */
    public void setSectionId(String sectionId_) {
        sectionId = (sectionId_ == null) ? "" : sectionId_;
    }

    /**
     * DOCUMENT ME!
     *
     * @return 
     */
    public String getSectionId() {
        return sectionId;
    }

    /**
     * DOCUMENT ME!
     *
     * @param partyId_ 
     */
    public void setPartyId(String partyId_) {
        partyId = (partyId_ == null) ? "" : partyId_;
    }

    /**
     * DOCUMENT ME!
     *
     * @return 
     */
    public String getPartyId() {
        return partyId;
    }

    /**
     * DOCUMENT ME!
     *
     * @param attributeId_ 
     */
    public void setAttributeId(String attributeId_) {
        attributeId = (attributeId_ == null) ? "" : attributeId_;
    }

    /**
     * DOCUMENT ME!
     *
     * @return 
     */
    public String getAttributeId() {
        return attributeId;
    }

    /**
     * DOCUMENT ME!
     *
     * @param displayLabel_ 
     */
    public void setDisplayLabel(String displayLabel_) {
        displayLabel = (displayLabel_ == null) ? "" : displayLabel_;
    }

    /**
     * DOCUMENT ME!
     *
     * @return 
     */
    public String getDisplayLabel() {
        if (displayLabel == null) {
            return getUiAttribute().getAttributeName();
        } else {
            return displayLabel;
        }
    }

    /**
     * DOCUMENT ME!
     *
     * @param displayLength_ 
     */
    public void setDisplayLength(int displayLength_) {
        displayLength = displayLength_;
    }

    /**
     * DOCUMENT ME!
     *
     * @param displayLength_ 
     */
    public void setDisplayLength(String displayLength_) {
        displayLength = (displayLength_ == null) ? 0
                                                 : Integer.valueOf(displayLength_)
                                                          .intValue();
    }

    /**
     * DOCUMENT ME!
     *
     * @return 
     */
    public int getDisplayLength() {
        return displayLength;
    }

    /**
     * DOCUMENT ME!
     *
     * @param maxLength_ 
     */
    public void setMaxLength(int maxLength_) {
        maxLength = maxLength_;
    }

    /**
     * DOCUMENT ME!
     *
     * @param maxLength_ 
     */
    public void setMaxLength(String maxLength_) {
        maxLength = (maxLength_ == null) ? 0
                                         : Integer.valueOf(maxLength_).intValue();
    }

    /**
     * DOCUMENT ME!
     *
     * @return 
     */
    public int getMaxLength() {
        return maxLength;
    }

    /**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -