Java Code Examples for net.sf.mpxj.ProjectFile#getDataLinks()

The following examples show how to use net.sf.mpxj.ProjectFile#getDataLinks() . 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: ProjectTreeController.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Add data links to the tree.
 *
 * @param parentNode parent tree node
 * @param file data links container
 */
private void addDataLinks(MpxjTreeNode parentNode, ProjectFile file)
{
   for (DataLink dataLink : file.getDataLinks())
   {
      final DataLink d = dataLink;
      MpxjTreeNode childNode = new MpxjTreeNode(dataLink, TABLE_EXCLUDED_METHODS)
      {
         @Override public String toString()
         {
            String name = d.getID();
            if (name == null)
            {
               name = "";
            }

            int index = name.lastIndexOf('!');
            if (index == -1 || index == name.length() - 1)
            {
               return "(none)";
            }
            return name.substring(index + 1);
         }
      };
      parentNode.add(childNode);
   }
}
 
Example 2
Source File: DataLinksTest.java    From mpxj with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Test an individual project.
 *
 * @param file project file
 */
private void testDataLinks(File file) throws MPXJException
{
   ProjectFile project = new UniversalProjectReader().read(file);
   DataLinkContainer dataLinks = project.getDataLinks();
   assertEquals(3, dataLinks.size());
}