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

📄 vacationtaghandler.java

📁 It is all about project scheduling. GanttProject is a tool for creating a project schedule by means
💻 JAVA
字号:
/** *  */package net.sourceforge.ganttproject.parser;import net.sourceforge.ganttproject.GanttCalendar;import net.sourceforge.ganttproject.calendar.GanttDaysOff;import net.sourceforge.ganttproject.resource.HumanResource;import net.sourceforge.ganttproject.resource.HumanResourceManager;import net.sourceforge.ganttproject.resource.ResourceManager;import org.xml.sax.Attributes;/** * @author nbohn */public class VacationTagHandler implements TagHandler, ParsingListener {    private ResourceManager myResourceManager;    public VacationTagHandler(ResourceManager resourceManager) {        myResourceManager = (HumanResourceManager) resourceManager;    }    public void startElement(String namespaceURI, String sName, String qName,            Attributes attrs) {        if (qName.equals("vacation")) {            loadResource(attrs);        }    }    private void loadResource(Attributes atts) {        try {            // <vacation start="2005-04-14" end="2005-04-14" resourceid="0"/>            // GanttCalendar.parseXMLDate(attrs.getValue(i)).getTime()            String startAsString = atts.getValue("start");            String endAsString = atts.getValue("end");            String resourceIdAsString = atts.getValue("resourceid");            HumanResource hr;            hr = (HumanResource) myResourceManager.getById(Integer                    .parseInt(resourceIdAsString));            hr.addDaysOff(new GanttDaysOff(GanttCalendar                    .parseXMLDate(startAsString), GanttCalendar                    .parseXMLDate(endAsString)));        } catch (NumberFormatException e) {            System.out                    .println("ERROR in parsing XML File year is not numeric: "                            + e.toString());            return;        }    }    public void endElement(String namespaceURI, String sName, String qName) {        // TODO Auto-generated method stub    }    public void parsingStarted() {        // TODO Auto-generated method stub    }    public void parsingFinished() {        // TODO Auto-generated method stub    }}

⌨️ 快捷键说明

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