Java Code Examples for net.sf.mpxj.ProjectFile#getFilters()
The following examples show how to use
net.sf.mpxj.ProjectFile#getFilters() .
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: MppFilterTest.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * Test filter data. * * @param mpp ProjectFile instance */ private void testFilters(ProjectFile mpp) { // // Test all data types // FilterContainer filters = mpp.getFilters(); Filter filter = filters.getFilterByName("Filter 1"); assertEquals("(Duration1 EQUALS 9.0w)", filter.getCriteria().toString()); filter = filters.getFilterByName("Filter 2"); assertEquals("(Number1 EQUALS 99.0)", filter.getCriteria().toString()); filter = filters.getFilterByName("Filter 3"); assertEquals("(% Complete EQUALS 10.0)", filter.getCriteria().toString()); filter = filters.getFilterByName("Filter 4"); assertEquals("(Cost1 EQUALS 99.0)", filter.getCriteria().toString()); filter = filters.getFilterByName("Filter 5"); assertEquals("(Text1 EQUALS Hello)", filter.getCriteria().toString()); filter = filters.getFilterByName("Filter 6"); assertEquals("(Flag1 EQUALS true)", filter.getCriteria().toString()); filter = filters.getFilterByName("Filter 7"); assertEquals("(Date1 EQUALS Tue Jul 18 00:00:00 BST 2006)", filter.getCriteria().toString()); // // Test all operators // filter = filters.getFilterByName("Filter 8"); assertEquals("((Number1 EQUALS 10.0) AND (Number2 DOES_NOT_EQUAL 10.0) AND (Number3 IS_GREATER_THAN 10.0) AND (Number4 IS_GREATER_THAN_OR_EQUAL_TO 10.0) AND (Number5 IS_LESS_THAN 10.0) AND (Number6 IS_LESS_THAN_OR_EQUAL_TO 10.0) AND (Number7 IS_WITHIN 10.0,20.0) AND (Number8 IS_NOT_WITHIN 10.0,20.0))", filter.getCriteria().toString()); }
Example 2
Source File: MppFilterTest.java From mpxj with GNU Lesser General Public License v2.1 | 5 votes |
/** * Validate filter logical operator evaluation. * * @param mpp project file */ private void testLogicalOperatorEvaluation(ProjectFile mpp) { Task task6 = mpp.getTaskByID(Integer.valueOf(6)); Task task7 = mpp.getTaskByID(Integer.valueOf(7)); FilterContainer filters = mpp.getFilters(); // Number1==13 && Number2==7 Filter filter = filters.getFilterByName("Filter 19"); assertFalse(filter.evaluate(task6, null)); assertTrue(filter.evaluate(task7, null)); // Number1==12 || Number1==13 filter = filters.getFilterByName("Filter 20"); assertTrue(filter.evaluate(task6, null)); assertTrue(filter.evaluate(task7, null)); // Duration==10d && Number1==13 && Number2==7 filter = filters.getFilterByName("Filter 21"); assertFalse(filter.evaluate(task6, null)); assertTrue(filter.evaluate(task7, null)); // Duration==10d || Number1==12 || Number2==7 filter = filters.getFilterByName("Filter 22"); assertTrue(filter.evaluate(task6, null)); assertTrue(filter.evaluate(task7, null)); // Duration==10d && Number1==12 || Number1==13 filter = filters.getFilterByName("Filter 23"); assertTrue(filter.evaluate(task6, null)); assertTrue(filter.evaluate(task7, null)); }
Example 3
Source File: GanttChartView.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * Create a GanttChartView from the fixed and var data blocks associated * with a view. * * @param parent parent MPP file * @param fixedMeta fixed meta data block * @param fixedData fixed data block * @param varData var data block * @param fontBases map of font bases * @throws IOException */ GanttChartView(ProjectFile parent, byte[] fixedMeta, byte[] fixedData, Var2Data varData, Map<Integer, FontBase> fontBases) throws IOException { super(parent, fixedData, varData); // System.out.println(varData.getVarMeta()); // MPPUtility.fileDump("c:\\temp\\"+getName()+"-vardata.txt", varData.toString().getBytes()); m_filters = parent.getFilters(); m_showInMenu = (fixedMeta[8] & 0x08) != 0; byte[] propsData = varData.getByteArray(m_id, getPropertiesID()); if (propsData != null) { Props9 props = new Props9(new ByteArrayInputStream(propsData)); //MPPUtility.fileDump("c:\\temp\\props.txt", props.toString().getBytes()); byte[] tableData = props.getByteArray(TABLE_PROPERTIES); if (tableData != null) { m_tableWidth = MPPUtility.getShort(tableData, 35); m_highlightFilter = (tableData[7] != 0); } byte[] filterName = props.getByteArray(FILTER_NAME); if (filterName != null) { m_defaultFilterName = MPPUtility.getUnicodeString(filterName, 0); } byte[] groupName = props.getByteArray(GROUP_NAME); if (groupName != null) { m_groupName = MPPUtility.getUnicodeString(groupName, 0); } processViewProperties(fontBases, props); processDefaultBarStyles(props); processExceptionBarStyles(props); byte[] columnData = props.getByteArray(COLUMN_PROPERTIES); if (columnData != null) { processTableFontStyles(fontBases, columnData); } byte[] progressLineData = props.getByteArray(PROGRESS_LINE_PROPERTIES); if (progressLineData != null) { processProgressLines(fontBases, progressLineData); } byte[] autoFilterData = props.getByteArray(AUTO_FILTER_PROPERTIES); if (autoFilterData != null) { processAutoFilters(autoFilterData); } } //MPPUtility.fileDump("c:\\temp\\GanttChartView9.txt", toString().getBytes()); }