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

📄 formfield.java

📁 CRMS客户关系管理系统(JAVA版),这是一个客户关系管理系统。
💻 JAVA
字号:
    /* CRMS, customer relationship management system    Copyright (C) 2003  Service To Youth Council    This program is free software; you can redistribute it and/or modify    it under the terms of the GNU General Public License as published by    the Free Software Foundation; either version 2 of the License, or    (at your option) any later version.    This program is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU General Public License for more details.    You should have received a copy of the GNU General Public License    along with this program; if not, write to the Free Software    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA    For further information contact the SYC ICT department on GPL@syc.net.au    98 Kermode Street    North Adelaide    South Australia    SA 5006     +61 (0)8 8367 0755    *//* * FormField.java * * Created on 11 April 2003, 02:43 */package crms.form;import java.util.*;import crms.util.AbstractCode;import java.security.InvalidParameterException;import org.jdom.*;/** * * @author  dmurphy */public class FormField {        private String name = null;        private EntityLocation location = null;    private FieldType type = null;        private ArrayList options = null;        private EntitySize internalSize = null;        private String text = null;        private String defaultOption = null;    private String clazz = null;        /** Creates a new instance of FormField */    public FormField(String name) {        this.name = name;    }        public String getName() {        return name;    }        public void setLocation(EntityLocation loc) {        this.location = loc;    }        public EntityLocation getLocation() {        return location;    }        public void setType(FieldType type) {        this.type = type;    }        public FieldType getType() {        return type;    }        public void setText(String text) {        this.text = text;    }        public String getText() {        return text;    }        /**     * Sets the internal size for this field (for example, for a TextArea     * it would specify the number of rows and columns of characters).     * @param size EntitySize object representing the internal size of this field.     */        public void setInternalSize(EntitySize size) {        this.internalSize = size;    }        public EntitySize getInternalSize() {        return internalSize;    }        public void addOption(FieldOption option) {        if (options == null) {            options = new ArrayList();        }        options.add(option);    }        public FieldOption getOption(int i) {        if (options == null) {            return null;        }        return (FieldOption) options.get(i);    }        public int getOptionCount() {        if (options == null) {            return 0;        }        return options.size();    }        public void setOptions(List list) {        options = new ArrayList();                for (int i=0; i < list.size(); i++) {            Object item = list.get(i);                        if (item instanceof FieldOption) {                FieldOption fOpt = (FieldOption) item;                options.add(fOpt);            } else if (item instanceof AbstractCode) {                AbstractCode code = (AbstractCode) item;                options.add(new FieldOption(code));            }        }    }        /**     *  Set the options on this field to be those legal values     *  from an AbstractCode class.     */        public void setOptions(Class clazz) {        if (! AbstractCode.class.isAssignableFrom(clazz)) {            throw new InvalidParameterException("Parameter must be of class AbstractCode");        }        setOptions(AbstractCode.getTypes(clazz));    }        public List getOptions() {        return options;    }        public void setDefaultOption(String code) {        this.defaultOption = code;    }        public String getDefaultOption() {        return defaultOption;    }        public void setListClass(String clazz) {        this.clazz = clazz;    }        public String getListClass() {        return clazz;    }        public Element getElement() {        Element fieldElement = new Element(FormXML.NODE_FIELD);        fieldElement.setAttribute(FormXML.ATTR_NAME, getName());                fieldElement.addContent( getType().getElement());                Element textElement = new Element(FormXML.NODE_FIELD_TEXT);        textElement.setText(getText());        fieldElement.addContent(textElement);                fieldElement.addContent(getLocation().getElement());        Element internalSizeElement = new Element(FormXML.NODE_FIELD_INTERNAL_SIZE);        internalSizeElement.setAttribute(FormXML.ATTR_SIZE_WIDTH, String.valueOf(getInternalSize().getWidth()));        internalSizeElement.setAttribute(FormXML.ATTR_SIZE_HEIGHT, String.valueOf(getInternalSize().getHeight()));                fieldElement.addContent(internalSizeElement);                if (getListClass() != null) {            Element classElement = new Element(FormXML.NODE_CLASS);            classElement.setAttribute(FormXML.ATTR_NAME, getListClass());            fieldElement.addContent(classElement);        }                Element optionsElement = new Element(FormXML.NODE_OPTIONS);                for (int i=0; i < getOptionCount(); i++) {            FieldOption option = getOption(i);            optionsElement.addContent(option.getElement());        }                Element defaultOptionElement = new Element(FormXML.NODE_OPTION_DEFAULT);        String def = getDefaultOption();        if (def != null) {            defaultOptionElement.setAttribute(FormXML.ATTR_CODE, getDefaultOption());            optionsElement.addContent(defaultOptionElement);        }                fieldElement.addContent(optionsElement);                return fieldElement;    }    }

⌨️ 快捷键说明

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