Java Code Examples for net.sf.mpxj.ProjectCalendar#getName()
The following examples show how to use
net.sf.mpxj.ProjectCalendar#getName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractCalendarFactory.java From mpxj with GNU Lesser General Public License v2.1 | 6 votes |
/** * The way calendars are stored in an MPP14 file means that there * can be forward references between the base calendar unique ID for a * derived calendar, and the base calendar itself. To get around this, * we initially populate the base calendar name attribute with the * base calendar unique ID, and now in this method we can convert those * ID values into the correct names. * * @param baseCalendars list of calendars and base calendar IDs * @param map map of calendar ID values and calendar objects */ private void updateBaseCalendarNames(List<Pair<ProjectCalendar, Integer>> baseCalendars, HashMap<Integer, ProjectCalendar> map) { for (Pair<ProjectCalendar, Integer> pair : baseCalendars) { ProjectCalendar cal = pair.getFirst(); Integer baseCalendarID = pair.getSecond(); ProjectCalendar baseCal = map.get(baseCalendarID); if (baseCal != null && baseCal.getName() != null) { cal.setParent(baseCal); } else { // Remove invalid calendar to avoid serious problems later. m_file.removeCalendar(cal); } } }
Example 2
Source File: ProjectTreeController.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * Add a calendar node. * * @param parentNode parent node * @param calendar calendar */ private void addCalendar(MpxjTreeNode parentNode, final ProjectCalendar calendar) { MpxjTreeNode calendarNode = new MpxjTreeNode(calendar, CALENDAR_EXCLUDED_METHODS) { @Override public String toString() { return calendar.getName(); } }; parentNode.add(calendarNode); MpxjTreeNode daysFolder = new MpxjTreeNode("Days"); calendarNode.add(daysFolder); for (Day day : Day.values()) { addCalendarDay(daysFolder, calendar, day); } MpxjTreeNode exceptionsFolder = new MpxjTreeNode("Exceptions"); calendarNode.add(exceptionsFolder); for (ProjectCalendarException exception : calendar.getCalendarExceptions()) { addCalendarException(exceptionsFolder, exception); } }
Example 3
Source File: MPXWriter.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * Write a calendar. * * @param record calendar instance * @throws IOException */ private void writeCalendar(ProjectCalendar record) throws IOException { // // Test used to ensure that we don't write the default calendar used for the "Unassigned" resource // if (record.getParent() == null || record.getResource() != null) { m_buffer.setLength(0); if (record.getParent() == null) { m_buffer.append(MPXConstants.BASE_CALENDAR_RECORD_NUMBER); m_buffer.append(m_delimiter); if (record.getName() != null) { m_buffer.append(record.getName()); } } else { m_buffer.append(MPXConstants.RESOURCE_CALENDAR_RECORD_NUMBER); m_buffer.append(m_delimiter); m_buffer.append(record.getParent().getName()); } for (DayType day : record.getDays()) { if (day == null) { day = DayType.DEFAULT; } m_buffer.append(m_delimiter); m_buffer.append(day.getValue()); } m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); ProjectCalendarHours[] hours = record.getHours(); for (int loop = 0; loop < hours.length; loop++) { if (hours[loop] != null) { writeCalendarHours(record, hours[loop]); } } if (!record.getCalendarExceptions().isEmpty()) { // // A quirk of MS Project is that these exceptions must be // in date order in the file, otherwise they are ignored. // The getCalendarExceptions method now guarantees that // the exceptions list is sorted when retrieved. // for (ProjectCalendarException ex : record.getCalendarExceptions()) { writeCalendarException(record, ex); } } m_eventManager.fireCalendarWrittenEvent(record); } }