📄 form.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 *//* * Form.java * * Created on 11 April 2003, 02:38 */package crms.form;import java.util.*;import org.jdom.*;import org.jdom.output.*;/** * * @author dmurphy */public class Form { private String title = null; private String name = null; private ArrayList fields = null; private EntitySize size = null; private Date created = null; private String preProcessor = null; /** Creates a new instance of Form */ public Form(String name) { this.name = name; } public void setTitle(String title) { this.title = title; } public String getTitle() { return title; } public String getName() { return name; } public void setDateCreated(Date created) { this.created = created; } public Date getDateCreated() { return this.created; } public void setSize(EntitySize size) { this.size = size; } public EntitySize getSize() { return size; } public void addField(FormField field) { if (fields == null) { fields = new ArrayList(); } fields.add(field); } public FormField getField(int i) { if (fields == null) { return null; } return (FormField) fields.get(i); } public int getFieldCount() { if (fields == null) { return 0; } return fields.size(); } public void setPreprocessor(String clazz) { this.preProcessor = clazz; } public String getPreprocessor() { return preProcessor; } public void setFieldValue(String fieldName, String newValue) { for (int i=0; i < getFieldCount(); i++) { FormField field = getField(i); if (field.getName().toLowerCase().equals(fieldName.toLowerCase())) { field.setText(newValue); break; } } } public Element getElement() { Element formElement = new Element(FormXML.NODE_FORM); Element titleElement = new Element(FormXML.NODE_FORM_TITLE); titleElement.setText(getTitle()); formElement.addContent(titleElement); formElement.setAttribute(FormXML.ATTR_NAME, getName()); if (getPreprocessor() != null) { Element preprocessorElement = new Element(FormXML.NODE_PREPROCESSOR); preprocessorElement.setAttribute(FormXML.ATTR_NAME, getPreprocessor()); } EntitySize size = getSize(); if (size != null) { formElement.addContent(size.getElement()); } Element fieldsElement = new Element(FormXML.NODE_FIELDS); for (int i=0; i < getFieldCount(); i++) { FormField field = getField(i); fieldsElement.addContent(field.getElement()); } formElement.addContent(fieldsElement); return formElement; } public StringBuffer toXML() { XMLOutputter out = new XMLOutputter(" ", true); return new StringBuffer(out.outputString(getElement())); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -