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

📄 taskpropertiestaghandler.java

📁 It is all about project scheduling. GanttProject is a tool for creating a project schedule by means
💻 JAVA
字号:
/* * Created on Mar 10, 2005 * * TODO To change the template for this generated file go to * Window - Preferences - Java - Code Style - Code Templates */package net.sourceforge.ganttproject.parser;import java.util.ArrayList;import java.util.GregorianCalendar;import java.util.List;import net.sourceforge.ganttproject.GanttCalendar;import net.sourceforge.ganttproject.GanttTreeTable;import net.sourceforge.ganttproject.Mediator;import net.sourceforge.ganttproject.task.CustomColumn;import org.w3c.util.DateParser;import org.w3c.util.InvalidDateException;import org.xml.sax.Attributes;/** * @author bbaranne Mar 10, 2005 */public class TaskPropertiesTagHandler implements TagHandler, ParsingListener {    private List columns = null;    private GanttTreeTable treeTable = null;    public TaskPropertiesTagHandler(GanttTreeTable ganttTreeTable) {        treeTable = ganttTreeTable;        columns = new ArrayList();    }    /**     * @see net.sourceforge.ganttproject.parser.TagHandler#startElement(String,     *      String, String, Attributes)     */    public void startElement(String namespaceURI, String sName, String qName,            Attributes attrs) {        if (qName.equals("taskproperty"))            loadTaskProperty(attrs);    }    /**     * @see net.sourceforge.ganttproject.parser.TagHandler#endElement(String,     *      String, String)     */    public void endElement(String namespaceURI, String sName, String qName) {        // System.out.println(Mediator.getCustomColumnsStorage().toString());    }    private void loadTaskProperty(Attributes atts) {        String name = atts.getValue("name");        String id = atts.getValue("id");        String type = atts.getValue("valuetype");        if (atts.getValue("type").equals("custom")) {            CustomColumn cc;            String valueStr = atts.getValue("defaultvalue");            Object defValue = null;            Class clType = null;            if (type.equals("text")) {                clType = String.class;                defValue = valueStr.toString();            } else if (type.equals("boolean")) {                clType = Boolean.class;                defValue = Boolean.valueOf(valueStr);            } else if (type.equals("int")) {                clType = Integer.class;                defValue = Integer.valueOf(valueStr);            } else if (type.equals("double")) {                clType = Double.class;                defValue = Double.valueOf(valueStr);            } else if (type.equals("date")) {                clType = GregorianCalendar.class;                try {                    defValue = new GanttCalendar(DateParser.parse(valueStr));                } catch (InvalidDateException e) {                    e.printStackTrace();                }            } else {                clType = String.class; // TODO remove if(...text)                defValue = "";            }            cc = new CustomColumn(name, clType, defValue);            cc.setId(id);            Mediator.getCustomColumnsManager().addNewCustomColumn(cc);        }        // // else if(atts.getValue("type").equals("default"))        // // {        // GanttTreeTable.DisplayedColumn dc = treeTable.new        // DisplayedColumn(id);        // System.out.println(dc);        // // if(dc.isDisplayed())        // columns.add(dc);        // // }    }    /**     * @see net.sourceforge.ganttproject.parser.ParsingListener#parsingStarted()     */    public void parsingStarted() {        // nothing to do.    }    /*     * (non-Javadoc)     *      * @see net.sourceforge.ganttproject.parser.ParsingListener#parsingFinished()     */    public void parsingFinished() {        // this.treeTable.setDisplayedColumns(columns);    }}

⌨️ 快捷键说明

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