Coverage Report
16.06.2009 15:43:13
measured on June 16, 2009 3:43:13 PM CEST
Description:
Name Amount
default package 1
package 25
class 217
method 1265
anonymous class 56
enumeration 15
interface 1
Date Name Comment
June 16, 2009 3:43:05 PM CEST org.revager.test.ApplicationDataTest:resetAndInitializeDatabase
June 16, 2009 3:43:09 PM CEST org.revager.test.ApplicationDataTest:tryToNotifyObservers
June 16, 2009 3:43:09 PM CEST org.revager.test.ApplicationDataTest:getUnsetAppSetting
June 16, 2009 3:43:09 PM CEST org.revager.test.ApplicationDataTest:setUnsetAppSetting
June 16, 2009 3:43:09 PM CEST org.revager.test.ApplicationDataTest:getAndSetAppSettings
June 16, 2009 3:43:09 PM CEST org.revager.test.ApplicationDataTest:addAndRemoveLastReviews
June 16, 2009 3:43:10 PM CEST org.revager.test.ApplicationDataTest:getEmptyCatalogList
June 16, 2009 3:43:10 PM CEST org.revager.test.ApplicationDataTest:removeAllCatalogData
June 16, 2009 3:43:10 PM CEST org.revager.test.ApplicationDataTest:getAndSetNameOfCatalog
June 16, 2009 3:43:10 PM CEST org.revager.test.ApplicationDataTest:setExistingNameOfCatalog
June 16, 2009 3:43:10 PM CEST org.revager.test.ApplicationDataTest:addAndRemoveCatalogs
June 16, 2009 3:43:10 PM CEST org.revager.test.ApplicationDataTest:pushCatalogs
June 16, 2009 3:43:10 PM CEST org.revager.test.ApplicationDataTest:setExistingNameOfCategory
June 16, 2009 3:43:10 PM CEST org.revager.test.ApplicationDataTest:modifyAndManageCatalog
June 16, 2009 3:43:11 PM CEST org.revager.test.ApplicationDataTest:pushAspects
June 16, 2009 3:43:11 PM CEST org.revager.test.ApplicationDataTest:getStringRepOfEmptyAspect
June 16, 2009 3:43:11 PM CEST org.revager.test.ApplicationDataTest:convertToResiAspect
June 16, 2009 3:43:11 PM CEST org.revager.test.ApplicationDataTest:getEmptyAttendeeList
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:removeAllAttendeeData
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:getAndSetNameOfAttendee
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:setExistingNameOfAttendee
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:addAndRemoveAttendees
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:modifyAttendee
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:convertToResiAttendee
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:removeAllCSVProfileData
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:getAndSetNameOfCSVProfile
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:setExistingNameOfCSVProfile
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:addAndRemoveCSVProfiles
June 16, 2009 3:43:12 PM CEST org.revager.test.ApplicationDataTest:modifyCSVProfile
June 16, 2009 3:43:13 PM CEST org.revager.test.ApplicationDataTest:setIncorrectColOrderCSVProfile
June 16, 2009 3:46:01 PM CEST org.revager.test.ApplicationTest:appExceptionWithoutMessage
June 16, 2009 3:46:01 PM CEST org.revager.test.ApplicationTest:appExceptionWithMessage
June 16, 2009 3:46:01 PM CEST org.revager.test.ApplicationTest:createNewReview
June 16, 2009 3:46:01 PM CEST org.revager.test.ApplicationTest:loadAndStoreReview
June 16, 2009 3:46:02 PM CEST org.revager.test.ApplicationTest:loadReviewFromAppData
June 16, 2009 3:46:02 PM CEST org.revager.test.ApplicationTest:storeReviewToAppData
June 16, 2009 3:46:02 PM CEST org.revager.test.ApplicationTest:backupAndRestoreReview
June 16, 2009 3:46:02 PM CEST org.revager.test.ApplicationTest:importAndExportCatalogXML
June 16, 2009 3:46:02 PM CEST org.revager.test.ApplicationTest:importAndExportAspectsXML
June 16, 2009 3:46:02 PM CEST org.revager.test.ApplicationTest:exportMeetingProtocolPDF
June 16, 2009 3:46:03 PM CEST org.revager.test.ApplicationTest:exportReviewProtocolPDF
June 16, 2009 3:46:04 PM CEST org.revager.test.ApplicationTest:exportMeetingFindingsCSV
June 16, 2009 3:46:04 PM CEST org.revager.test.ApplicationTest:exportMeetingFindingsCSVEmpty
June 16, 2009 3:46:05 PM CEST org.revager.test.ApplicationTest:exportReviewFindingsCSV
June 16, 2009 3:46:05 PM CEST org.revager.test.ApplicationTest:exportReviewFindingsCSVEmpty
June 16, 2009 3:46:05 PM CEST org.revager.test.ApplicationTest:exportInvitationsPDF
June 16, 2009 3:46:05 PM CEST org.revager.test.ApplicationTest:exportInvitationsDir
June 16, 2009 3:46:05 PM CEST org.revager.test.ApplicationTest:exportInvitationsZIP
June 16, 2009 3:46:05 PM CEST org.revager.test.ApplicationTest:testResiFileFilter
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:dataExceptionWithoutMessage
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:dataExceptionWithMessage
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getInstancesOfDataClasses
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getAndSetLocale
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getAndSetMode
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:setInvalidMode
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getInvalidResource
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getLocaleStr
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getInvalidLocaleStr
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getRegularModeParameter
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getDefaultFallbackModeParameter
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getInvalidModeParameter
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getResource
June 16, 2009 3:46:34 PM CEST org.revager.test.DataTest:getIcon
June 16, 2009 3:46:49 PM CEST org.revager.test.ExportTest:exportExceptionWithoutMessage
June 16, 2009 3:46:49 PM CEST org.revager.test.ExportTest:exportExceptionWithMessage
June 16, 2009 3:46:49 PM CEST org.revager.test.ExportTest:createReviewProtocols
June 16, 2009 3:46:53 PM CEST org.revager.test.ExportTest:createMeetingProtocols
June 16, 2009 3:46:54 PM CEST org.revager.test.ExportTest:createInvitationsAsPDF
June 16, 2009 3:46:54 PM CEST org.revager.test.ExportTest:createInvitationsAsZIP
June 16, 2009 3:46:54 PM CEST org.revager.test.ExportTest:createInvitationsAsDir
June 16, 2009 3:46:54 PM CEST org.revager.test.ExportTest:createFindingsListAsCSV
June 16, 2009 3:47:06 PM CEST org.revager.test.HelpDataTest:getChapters
June 16, 2009 3:47:06 PM CEST org.revager.test.HelpDataTest:getChapterContent
June 16, 2009 3:47:06 PM CEST org.revager.test.HelpDataTest:getChapterNumber
June 16, 2009 3:47:06 PM CEST org.revager.test.HelpDataTest:getChapterTitle
June 16, 2009 3:47:06 PM CEST org.revager.test.HelpDataTest:getNotExistingChapterTitle
June 16, 2009 3:47:06 PM CEST org.revager.test.HelpDataTest:getNotExistingChapterContent
June 16, 2009 3:47:22 PM CEST org.revager.test.ManagementTest:manageAspects
June 16, 2009 3:47:23 PM CEST org.revager.test.ManagementTest:manageAttendees
June 16, 2009 3:47:23 PM CEST org.revager.test.ManagementTest:manageFindings
June 16, 2009 3:47:23 PM CEST org.revager.test.ManagementTest:manageMeetings
June 16, 2009 3:47:23 PM CEST org.revager.test.ManagementTest:manageProtocols
June 16, 2009 3:47:23 PM CEST org.revager.test.ManagementTest:manageReview
June 16, 2009 3:47:24 PM CEST org.revager.test.ManagementTest:manageSeverities
June 16, 2009 3:47:33 PM CEST org.revager.test.ResiDataTest:handleReview
June 16, 2009 3:47:33 PM CEST org.revager.test.ResiDataTest:handleCatalog
June 16, 2009 3:47:33 PM CEST org.revager.test.ResiDataTest:handleAspects
June 16, 2009 3:47:33 PM CEST org.revager.test.ResiDataTest:tryToNotifyObservers
June 16, 2009 3:47:44 PM CEST org.revager.test.ResiIOTest:loadIOProvider
June 16, 2009 3:47:45 PM CEST org.revager.test.ResiIOTest:loadCompleteReview
June 16, 2009 3:47:45 PM CEST org.revager.test.ResiIOTest:storeCompleteReview
June 16, 2009 3:47:45 PM CEST org.revager.test.ResiIOTest:loadIncompleteReview
June 16, 2009 3:47:45 PM CEST org.revager.test.ResiIOTest:storeIncompleteReview
June 16, 2009 3:47:46 PM CEST org.revager.test.ResiIOTest:loadIncorrectReview
June 16, 2009 3:47:46 PM CEST org.revager.test.ResiIOTest:loadReviewAsBackupWithoutBackupedBefore
June 16, 2009 3:47:46 PM CEST org.revager.test.ResiIOTest:storeAndLoadCompleteReviewAsBackup
June 16, 2009 3:47:46 PM CEST org.revager.test.ResiIOTest:storeAndLoadIncompleteReviewAsBackup
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:storeAndLoadNearlyEmptyReviewAsBackup
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:loadCatalog
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:loadIncorrectCatalog
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:modifyAndStoreCatalog
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:storeIncorrectCatalog
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:loadAspects
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:loadIncorrectAspects
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:modifyAndStoreAspects
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:storeIncorrectAspects
June 16, 2009 3:47:47 PM CEST org.revager.test.ResiIOTest:throwExceptionWithoutMessage
Statement Coverage
default package 4497 / 8336 53 %
neos 4497 / 8336 53 %
resi 4497 / 8336 53 %
tools 80 / 155 51 %
TreeMeeting 0 / 7 0 %
public Meeting getMeeting() 0 / 1 0 %
public void setMeeting(Meeting meeting) 0 / 1 0 %
public String toString() 0 / 5 0 %
PDFTools 2 / 2 100 %
public static float cmToPt(float cm) 1 / 1 100 %
public static float ptToCm(float pt) 1 / 1 100 %
ObservingTextField 0 / 3 0 %
public void update(Observable o, Object arg) 0 / 3 0 %
GUITools 0 / 59 0 %
public static void addComponent(Container cont, GridBagLayout gbl, Component c, int x, int y, int width, int height, double weightx, double weighty, int t, int l, int b, int r, int i, int z) 0 / 12 0 %
public static JButton newImageButton(ImageIcon icon, ImageIcon rolloverIcon) 0 / 9 0 %
public static JButton newImageButton() 0 / 1 0 %
public static JButton newInvisibleStrutButton() 0 / 7 0 %
public static JPanel newPopupBasePanel() 0 / 5 0 %
public static JScrollPane setIntoScrllPn(JTextArea txt) 0 / 4 0 %
public static JScrollPane getMessagePane(String message) 0 / 13 0 %
public static void formatSpinner(JSpinner sp) 0 / 8 0 %
FileTools 71 / 77 92 %
public static boolean deleteDirectory(File directory) 4 / 4 100 %
public static void copyFile(File source, File target) throws IOException 6 / 6 100 %
public static List<File> getListOfFiles(File directory) 4 / 4 100 %
public static void writeToZip(List<File> files, File zipFile, boolean urlEncoded, boolean transformUmlauts) throws IOException 18 / 19 94 %
public static void extractZipFile(File zipFile, File targetDirectory, boolean urlEncoded) throws IOException 15 / 16 93 %
private static String transformUmlauts(String origFileName) 8 / 8 100 %
private static boolean containsFileName(String fileName, List<File> files) 2 / 2 100 %
private static boolean copyStream(InputStream source, OutputStream target, boolean closeTarget) 8 / 10 80 %
private static int readBytesBlocking(InputStream in, byte b[], int off, int len, int timeoutInMillis) throws IOException 6 / 8 75 %
AppTools 7 / 7 100 %
public static String getRandomString() 7 / 7 100 %
test 1117 / 1537 72 %
DIRTY 0 / 344 0 %
TreeExpansionTest 0 / 17 0 %
public static void main(String args[]) 0 / 17 0 %
TreeWillExpandListener 0 / 8 0 %
public void treeWillCollapse(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException 0 / 4 0 %
public void treeWillExpand(TreeExpansionEvent treeExpansionEvent) throws ExpandVetoException 0 / 4 0 %
TestTextPopupWindow 0 / 4 0 %
public static void main(String[] args) 0 / 4 0 %
TestSeveritiesManagement 0 / 23 0 %
public static void main(String[] args) 0 / 23 0 %
TestSearch 0 / 17 0 %
public static String getLocalString(String searchString,String chapterContent) 0 / 17 0 %
TestPDFExport 0 / 12 0 %
public static void main(String[] args) 0 / 12 0 %
TestManagement 0 / 3 0 %
public static void main(String[] args) 0 / 3 0 %
TestMainFrame 0 / 9 0 %
public static void main(String[] args) 0 / 9 0 %
TestHelpData 0 / 6 0 %
public static void main(String[] args) 0 / 6 0 %
TestGui 0 / 1 0 %
public static void main(String[] args) 0 / 1 0 %
TestDialog1 0 / 24 0 %
public TestDialog1(Frame parent) 0 / 23 0 %
ActionListener 0 / 2 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 2 0 %
ActionListener 0 / 1 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 1 0 %
public static void main(String[] args) 0 / 1 0 %
TestDayPicker 0 / 22 0 %
public static void main(String argv[]) 0 / 22 0 %
ActionListener 0 / 4 0 %
public void actionPerformed(ActionEvent e) 0 / 4 0 %
ObservingTextField 0 / 4 0 %
public void update(Observable o, Object arg) 0 / 4 0 %
TestCSVExport 0 / 8 0 %
public static void main(String[] args) throws DataException, ExportException 0 / 8 0 %
TestAttendeeTableModel 0 / 31 0 %
public static void main(String argv[]) 0 / 29 0 %
ActionListener 0 / 5 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 5 0 %
TestAttendeeMgmt 0 / 7 0 %
public static void main(String[] args) 0 / 7 0 %
TestAttendeeGeneral 0 / 5 0 %
public static void main(String[] args) 0 / 5 0 %
PageNumbersWatermark 0 / 31 0 %
public static void main(String args[]) 0 / 12 0 %
public void onOpenDocument(PdfWriter writer, Document document) 0 / 3 0 %
public void onEndPage(PdfWriter writer, Document document) 0 / 11 0 %
public void onCloseDocument(PdfWriter writer, Document document) 0 / 5 0 %
HelpTest 0 / 1 0 %
public static void main(String[] args) 0 / 1 0 %
GeneralTest 0 / 4 0 %
public static void main(String[] args) 0 / 4 0 %
EndPage 0 / 19 0 %
public static void main(String[] args) 0 / 9 0 %
public void onEndPage(PdfWriter writer, Document document) 0 / 10 0 %
CheckNodeTreeExample 0 / 37 0 %
public CheckNodeTreeExample() 0 / 18 0 %
NodeSelectionListener 0 / 13 0 %
NodeSelectionListener(JTree tree) 0 / 1 0 %
public void mouseClicked(MouseEvent e) 0 / 0 ---
@Override public void mouseEntered(MouseEvent e) 0 / 0 ---
@Override public void mouseExited(MouseEvent e) 0 / 0 ---
@Override public void mousePressed(MouseEvent e) 0 / 12 0 %
@Override public void mouseReleased(MouseEvent e) 0 / 0 ---
public static void main(String args[]) 0 / 5 0 %
WindowAdapter 0 / 1 0 %
public void windowClosing(WindowEvent e) 0 / 1 0 %
CheckRenderer 0 / 50 0 %
public CheckRenderer() 0 / 7 0 %
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row, boolean hasFocus) 0 / 11 0 %
public Dimension getPreferredSize() 0 / 3 0 %
public void doLayout() 0 / 10 0 %
public void setBackground(Color color) 0 / 2 0 %
TreeLabel 0 / 17 0 %
public TreeLabel() 0 / 0 ---
public void setBackground(Color color) 0 / 2 0 %
public void paint(Graphics g) 0 / 10 0 %
public Dimension getPreferredSize() 0 / 3 0 %
public void setSelected(boolean isSelected) 0 / 1 0 %
public void setFocus(boolean hasFocus) 0 / 1 0 %
CheckNode 0 / 9 0 %
public CheckNode() 0 / 1 0 %
public CheckNode(Object userObject) 0 / 1 0 %
public CheckNode(Object userObject, boolean allowsChildren, boolean isSelected) 0 / 2 0 %
public void setSelected(boolean isSelected) 0 / 4 0 %
public boolean isSelected() 0 / 1 0 %
ResiIOTest 70 / 85 82 %
@BeforeClass public static void setUp() throws DataException 0 / 3 0 %
@Test public void loadIOProvider() 1 / 1 100 %
@Test public void loadCompleteReview() throws ResiIOException 5 / 5 100 %
@Test public void storeCompleteReview() throws ResiIOException 7 / 7 100 %
@Test(expected = ResiIOException.class) public void loadIncompleteReview() throws ResiIOException 1 / 1 100 %
@Test(expected = ResiIOException.class) public void storeIncompleteReview() throws ResiIOException 3 / 3 100 %
@Test(expected = ResiIOException.class) public void loadIncorrectReview() throws ResiIOException 1 / 1 100 %
@Test(expected = ResiIOException.class) public void loadReviewAsBackupWithoutBackupedBefore() throws ResiIOException 1 / 1 100 %
@Test public void storeAndLoadCompleteReviewAsBackup() throws ResiIOException 8 / 8 100 %
@Test public void storeAndLoadIncompleteReviewAsBackup() throws ResiIOException 9 / 9 100 %
@Test public void storeAndLoadNearlyEmptyReviewAsBackup() throws ResiIOException 9 / 9 100 %
@Test public void loadCatalog() throws ResiIOException 3 / 3 100 %
@Test(expected = ResiIOException.class) public void loadIncorrectCatalog() throws ResiIOException 1 / 1 100 %
@Test public void modifyAndStoreCatalog() throws ResiIOException 6 / 6 100 %
@Test(expected = ResiIOException.class) public void storeIncorrectCatalog() throws ResiIOException 2 / 2 100 %
@Test public void loadAspects() throws ResiIOException 3 / 3 100 %
@Test(expected = ResiIOException.class) public void loadIncorrectAspects() throws ResiIOException 1 / 1 100 %
@Test public void modifyAndStoreAspects() throws ResiIOException 6 / 6 100 %
@Test(expected = ResiIOException.class) public void storeIncorrectAspects() throws ResiIOException 2 / 2 100 %
@Test(expected = ResiIOException.class) public void throwExceptionWithoutMessage() throws ResiIOException 1 / 1 100 %
@AfterClass public static void cleanUp() 0 / 2 0 %
ResiDataTest 35 / 35 100 %
@Test public void handleReview() 11 / 11 100 %
@Test public void handleCatalog() 11 / 11 100 %
@Test public void handleAspects() 11 / 11 100 %
@Test public void tryToNotifyObservers() 2 / 2 100 %
ManagementTest 356 / 371 95 %
@BeforeClass public static void setUp() throws DataException 0 / 4 0 %
@Test public void manageAspects() throws ResiIOException, IOException, ApplicationException 57 / 57 100 %
@Test public void manageAttendees() throws ResiIOException, IOException, ApplicationException, DataException 101 / 101 100 %
@Test public void manageFindings() throws ResiIOException, IOException, ApplicationException 54 / 54 100 %
@Test public void manageMeetings() throws ResiIOException, IOException, ApplicationException 26 / 26 100 %
@Test public void manageProtocols() throws ResiIOException, IOException, ApplicationException, DatatypeConfigurationException 16 / 16 100 %
@Test public void manageReview() throws ResiIOException, IOException, ApplicationException 64 / 64 100 %
@Test public void manageSeverities() throws ResiIOException, IOException, ApplicationException 38 / 38 100 %
@AfterClass public static void cleanUp() 0 / 2 0 %
HelpDataTest 12 / 12 100 %
@Test public void getChapters() throws DataException 2 / 2 100 %
@Test public void getChapterContent() throws DataException 2 / 2 100 %
@Test public void getChapterNumber() throws DataException 2 / 2 100 %
@Test public void getChapterTitle() throws DataException 2 / 2 100 %
@Test(expected = DataException.class) public void getNotExistingChapterTitle() throws DataException 2 / 2 100 %
@Test(expected = DataException.class) public void getNotExistingChapterContent() throws DataException 2 / 2 100 %
ExportTest 118 / 142 83 %
@BeforeClass public static void setUp() throws DataException, ResiIOException, IOException, ApplicationException 0 / 13 0 %
@Test(expected = ExportException.class) public void exportExceptionWithoutMessage() throws ExportException 1 / 1 100 %
@Test(expected = ExportException.class) public void exportExceptionWithMessage() throws ExportException 1 / 1 100 %
@Test public void createReviewProtocols() throws ExportException, DataException 26 / 26 100 %
@Test public void createMeetingProtocols() throws ExportException, DataException 23 / 23 100 %
@Test public void createInvitationsAsPDF() throws ExportException, DataException 19 / 19 100 %
@Test public void createInvitationsAsZIP() throws ExportException, DataException 12 / 12 100 %
@Test public void createInvitationsAsDir() throws ExportException, DataException 12 / 12 100 %
@Test public void createFindingsListAsCSV() throws DataException, ExportException 24 / 24 100 %
@AfterClass public static void cleanUp() 0 / 5 0 %
DataTest 36 / 36 100 %
@Test(expected = DataException.class) public void dataExceptionWithoutMessage() throws DataException 1 / 1 100 %
@Test(expected = DataException.class) public void dataExceptionWithMessage() throws DataException 1 / 1 100 %
@Test public void getInstancesOfDataClasses() 4 / 4 100 %
@Test public void getAndSetLocale() 3 / 3 100 %
@Test public void getAndSetMode() 3 / 3 100 %
@Test public void setInvalidMode() 3 / 3 100 %
@Test public void getIcon() 2 / 2 100 %
@Test public void getResource() 2 / 2 100 %
@Test public void getInvalidResource() 3 / 3 100 %
@Test public void getLocaleStr() 3 / 3 100 %
@Test public void getInvalidLocaleStr() 2 / 2 100 %
@Test public void getRegularModeParameter() 3 / 3 100 %
@Test public void getDefaultFallbackModeParameter() 3 / 3 100 %
@Test public void getInvalidModeParameter() 3 / 3 100 %
ApplicationTest 84 / 105 80 %
@BeforeClass public static void setUp() throws IOException, DataException 0 / 4 0 %
@Test(expected = ApplicationException.class) public void appExceptionWithoutMessage() throws ApplicationException 1 / 1 100 %
@Test(expected = ApplicationException.class) public void appExceptionWithMessage() throws ApplicationException 1 / 1 100 %
@Test public void createNewReview() 1 / 1 100 %
@Test public void loadAndStoreReview() throws ResiIOException, IOException, ApplicationException 7 / 7 100 %
@Test(expected = ApplicationException.class) public void loadReviewFromAppData() throws ResiIOException, IOException, ApplicationException 1 / 1 100 %
@Test(expected = ApplicationException.class) public void storeReviewToAppData() throws ResiIOException, IOException, ApplicationException 1 / 1 100 %
@Test public void backupAndRestoreReview() throws ResiIOException, DataException 4 / 4 100 %
@Test public void importAndExportCatalogXML() throws ResiIOException 2 / 2 100 %
@Test public void importAndExportAspectsXML() throws ResiIOException 2 / 2 100 %
@Test public void exportMeetingProtocolPDF() throws ResiIOException, IOException, ApplicationException, ExportException, DataException 2 / 2 100 %
@Test public void exportReviewProtocolPDF() throws ExportException, DataException, ResiIOException, IOException, ApplicationException 2 / 2 100 %
@Test public void exportMeetingFindingsCSV() throws ExportException, ApplicationException, DataException, ResiIOException, IOException 2 / 2 100 %
@Test(expected = ApplicationException.class) public void exportMeetingFindingsCSVEmpty() throws ExportException, ApplicationException, DataException, ResiIOException, IOException 4 / 4 100 %
@Test public void exportReviewFindingsCSV() throws ResiIOException, IOException, ApplicationException, ExportException, DataException 2 / 2 100 %
@Test(expected = ApplicationException.class) public void exportReviewFindingsCSVEmpty() throws ResiIOException, IOException, ApplicationException, ExportException, DataException 3 / 3 100 %
@Test public void exportInvitationsPDF() throws ExportException, DataException, ResiIOException, IOException, ApplicationException 2 / 2 100 %
@Test public void exportInvitationsDir() throws ResiIOException, IOException, ApplicationException, ExportException, DataException 2 / 2 100 %
@Test public void exportInvitationsZIP() throws ExportException, DataException, ResiIOException, IOException, ApplicationException 2 / 2 100 %
@Test public void testResiFileFilter() 43 / 43 100 %
@AfterClass public static void cleanUp() 0 / 6 0 %
ApplicationDataTest 406 / 407 99 %
@Test public void resetAndInitializeDatabase() throws SQLException, DataException 9 / 9 100 %
@Test public void tryToNotifyObservers() 1 / 1 100 %
@Test public void getUnsetAppSetting() throws DataException 4 / 4 100 %
@Test public void setUnsetAppSetting() throws DataException 1 / 1 100 %
@Test public void getAndSetAppSettings() throws DataException 8 / 8 100 %
@Test public void addAndRemoveLastReviews() throws DataException 15 / 15 100 %
@Test public void getEmptyCatalogList() throws DataException 2 / 2 100 %
@Test public void removeAllCatalogData() throws DataException 4 / 4 100 %
@Test public void getAndSetNameOfCatalog() throws DataException 4 / 4 100 %
@Test(expected = DataException.class) public void setExistingNameOfCatalog() throws DataException 4 / 4 100 %
@Test public void addAndRemoveCatalogs() throws DataException 22 / 22 100 %
@Test public void pushCatalogs() throws DataException 27 / 27 100 %
@Test(expected = DataException.class) public void setExistingNameOfCategory() throws DataException 5 / 5 100 %
@Test public void modifyAndManageCatalog() throws DataException 70 / 70 100 %
@Test public void pushAspects() throws DataException 30 / 30 100 %
@Test public void getStringRepOfEmptyAspect() throws DataException 4 / 4 100 %
@Test public void convertToResiAspect() throws DataException 7 / 7 100 %
@Test public void getEmptyAttendeeList() throws DataException 2 / 2 100 %
@Test public void removeAllAttendeeData() throws DataException 3 / 3 100 %
@Test public void getAndSetNameOfAttendee() throws DataException 6 / 6 100 %
@Test(expected = DataException.class) public void setExistingNameOfAttendee() throws DataException 4 / 4 100 %
@Test public void addAndRemoveAttendees() throws DataException 27 / 27 100 %
@Test public void modifyAttendee() throws DataException 32 / 32 100 %
@Test public void convertToResiAttendee() throws DataException 6 / 6 100 %
@Test public void removeAllCSVProfileData() throws DataException 3 / 3 100 %
@Test public void getAndSetNameOfCSVProfile() throws DataException 5 / 5 100 %
@Test(expected = DataException.class) public void setExistingNameOfCSVProfile() throws DataException 4 / 4 100 %
@Test public void addAndRemoveCSVProfiles() throws DataException 23 / 23 100 %
@Test public void modifyCSVProfile() throws DataException 67 / 67 100 %
@Test(expected = DataException.class) public void setIncorrectColOrderCSVProfile() throws DataException 7 / 7 100 %
@AfterClass public static void deleteDatabase() 0 / 1 0 %
io 66 / 70 94 %
impl 61 / 65 93 %
XMLResiValidationEventHandler 5 / 5 100 %
public boolean handleEvent(ValidationEvent event) 3 / 3 100 %
public String getMessage() 1 / 1 100 %
XMLResiIOFactory 4 / 4 100 %
public XMLResiIOFactory() 1 / 1 100 %
@Override public ResiIO getIOProvider() 2 / 2 100 %
XMLResiIO 52 / 56 92 %
ValidationMode 0 / 0 ---
public XMLResiIO() 4 / 5 80 %
private Unmarshaller getUnmarshaller(JAXBContext context, ValidationMode mode) throws JAXBException 4 / 4 100 %
private Marshaller getMarshaller(JAXBContext context, ValidationMode mode) throws JAXBException 6 / 6 100 %
@Override public void loadAspects(String filePath) throws ResiIOException 5 / 5 100 %
@Override public void loadCatalog(String filePath) throws ResiIOException 5 / 5 100 %
@Override public void loadReview(String filePath) throws ResiIOException 5 / 5 100 %
@Override public void loadReviewBackup() throws ResiIOException 7 / 8 87 %
@Override public void storeAspects(String filePath) throws ResiIOException 3 / 3 100 %
@Override public void storeCatalog(String filePath) throws ResiIOException 3 / 3 100 %
@Override public void storeReview(String filePath) throws ResiIOException 3 / 3 100 %
@Override public void storeReviewBackup() throws ResiIOException 5 / 7 71 %
ResiIOFactory 3 / 3 100 %
public static ResiIOFactory getInstance() 2 / 2 100 %
public abstract ResiIO getIOProvider() 0 / 0 ---
ResiIOException 2 / 2 100 %
public ResiIOException() 1 / 1 100 %
public ResiIOException(String message) 1 / 1 100 %
ResiIO 0 / 0 ---
public abstract void loadReview(String filePath) throws ResiIOException 0 / 0 ---
public abstract void loadCatalog(String filePath) throws ResiIOException 0 / 0 ---
public abstract void loadAspects(String filePath) throws ResiIOException 0 / 0 ---
public abstract void loadReviewBackup() throws ResiIOException 0 / 0 ---
public abstract void storeReview(String filePath) throws ResiIOException 0 / 0 ---
public abstract void storeCatalog(String filePath) throws ResiIOException 0 / 0 ---
public abstract void storeAspects(String filePath) throws ResiIOException 0 / 0 ---
public abstract void storeReviewBackup() throws ResiIOException 0 / 0 ---
gui 0 / 3111 0 %
workers 0 / 108 0 %
SaveReviewWorker 0 / 10 0 %
public SaveReviewWorker(String filePath) 0 / 1 0 %
@Override protected Void doInBackground() 0 / 8 0 %
RestoreReviewWorker 0 / 10 0 %
@Override protected Void doInBackground() throws Exception 0 / 10 0 %
NewReviewWorker 0 / 14 0 %
@Override protected Void doInBackground() throws Exception 0 / 14 0 %
LoadReviewWorker 0 / 16 0 %
public LoadReviewWorker(String filePath) 0 / 1 0 %
@Override protected Void doInBackground() 0 / 14 0 %
LoadHelpWorker 0 / 15 0 %
public LoadHelpWorker() 0 / 1 0 %
public LoadHelpWorker(String helpChapter, String helpChapterAnchor) 0 / 3 0 %
public LoadHelpWorker(String helpChapter) 0 / 1 0 %
@Override protected Void doInBackground() throws Exception 0 / 7 0 %
LoadEmbeddedHelpWorker 0 / 31 0 %
public LoadEmbeddedHelpWorker(JPanel panelHelp, String helpChapter, String helpChapterAnchor) 0 / 3 0 %
@Override protected String doInBackground() throws Exception 0 / 25 0 %
HyperlinkListener 0 / 2 0 %
public void hyperlinkUpdate(HyperlinkEvent ev) 0 / 2 0 %
ExportCSVWorker 0 / 1 0 %
CSVType 0 / 0 ---
@Override protected Object doInBackground() throws Exception 0 / 1 0 %
CreatePDFProtocolWorker 0 / 1 0 %
ProtocolType 0 / 0 ---
@Override protected Object doInBackground() throws Exception 0 / 1 0 %
CreateInvitationsWorker 0 / 1 0 %
InvitationType 0 / 0 ---
@Override protected Object doInBackground() throws Exception 0 / 1 0 %
AutoSaveWorker 0 / 1 0 %
@Override protected Object doInBackground() throws Exception 0 / 1 0 %
AutoBackupWorker 0 / 8 0 %
@Override protected Void doInBackground() 0 / 8 0 %
models 0 / 57 0 %
SeverityTableModel 0 / 8 0 %
@Override public int getColumnCount() 0 / 1 0 %
@Override public int getRowCount() 0 / 2 0 %
@Override public Object getValueAt(int rowIndex, int columnIndex) 0 / 2 0 %
public void setValueAt(Object insertion, int row, int column) 0 / 2 0 %
public boolean isCellEditable( int rowIndex, int columnIndex ) 0 / 1 0 %
ReviewerTableModel 0 / 9 0 %
public ReviewerTableModel(Attendee att) 0 / 1 0 %
@Override public int getColumnCount() 0 / 1 0 %
@Override public int getRowCount() 0 / 2 0 %
@Override public Object getValueAt(int row, int column) 0 / 5 0 %
ReferenceTableModel 0 / 7 0 %
@Override public int getColumnCount() 0 / 1 0 %
@Override public int getRowCount() 0 / 1 0 %
@Override public Object getValueAt(int rowIndex, int columnIndex) 0 / 1 0 %
public void setValueAt(Object insertion, int row, int column) 0 / 3 0 %
public boolean isCellEditable( int rowIndex, int columnIndex ) 0 / 1 0 %
InvitationsTableModel 0 / 8 0 %
@Override public int getColumnCount() 0 / 1 0 %
@Override public int getRowCount() 0 / 1 0 %
@Override public Object getValueAt(int rowIndex, int columnIndex) 0 / 2 0 %
public boolean isCellEditable(int row, int col) 0 / 2 0 %
public Class getColumnClass(int columnIndex) 0 / 2 0 %
AttendeeTableModel 0 / 10 0 %
@Override public int getColumnCount() 0 / 1 0 %
@Override public int getRowCount() 0 / 1 0 %
public String getColumnName( int column) 0 / 3 0 %
@Override public Object getValueAt(int rowIndex, int columnIndex) 0 / 5 0 %
AspectTableModel 0 / 15 0 %
public AspectTableModel() 0 / 4 0 %
@Override public int getColumnCount() 0 / 1 0 %
@Override public int getRowCount() 0 / 1 0 %
@Override public Object getValueAt(int rowIndex, int columnIndex) 0 / 3 0 %
private String getAttendeesString(List<Attendee> attList) 0 / 6 0 %
actions 0 / 386 0 %
severities 0 / 32 0 %
RemoveSeverityAction 0 / 4 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 4 0 %
PushSeverityUpAction 0 / 6 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 6 0 %
PushSeverityTopAction 0 / 5 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 5 0 %
PushSeverityDownAction 0 / 6 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 6 0 %
PushSeverityBottomAction 0 / 6 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 6 0 %
EditSeverityAction 0 / 2 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 2 0 %
ConfirmSeverityAction 0 / 0 ---
AddSeverityAction 0 / 3 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 3 0 %
protocol 0 / 0 ---
EditProtocolAction 0 / 0 ---
CommentProtocolAction 0 / 0 ---
AddProtocolAction 0 / 0 ---
product 0 / 13 0 %
RemoveProductReferenceAction 0 / 4 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 4 0 %
EditProductReferenceAction 0 / 2 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 2 0 %
EditProductAction 0 / 4 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 4 0 %
AddProductReferenceAction 0 / 3 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 3 0 %
meeting 0 / 40 0 %
SelectMeetingAction 0 / 0 ---
RemoveMeetingAction 0 / 3 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 3 0 %
EditMeetingAction 0 / 4 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 4 0 %
ConfirmMeetingAction 0 / 23 0 %
public Calendar dateString2Calendar(String s,DateFormat df) throws ParseException 0 / 4 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 19 0 %
CommentMeetingAction 0 / 7 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 7 0 %
AddMeetingAction 0 / 3 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 3 0 %
invitations 0 / 2 0 %
RemoveFileFromInvitationsAction 0 / 0 ---
OpenInvitationsDialogAction 0 / 2 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 2 0 %
GenerateInvitationsAction 0 / 0 ---
@Override public void actionPerformed(ActionEvent arg0) 0 / 0 ---
AddFileToInvitationsAction 0 / 0 ---
help 0 / 50 0 %
SearchAction 0 / 42 0 %
public SearchAction() 0 / 1 0 %
public static String getLocalString(String searchString,String chapterContent) 0 / 17 0 %
public void actionPerformed(ActionEvent SearchHelp) 0 / 24 0 %
ResetAction 0 / 7 0 %
@Override public void actionPerformed(ActionEvent ResetHelp) 0 / 7 0 %
OpenHelpAction 0 / 1 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 1 0 %
attendee 0 / 74 0 %
SelectEmphasesAction 0 / 0 ---
SelectAttendeeAction 0 / 0 ---
RemoveAttendeeAction 0 / 5 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 5 0 %
PushUpAspectAction 0 / 8 0 %
public PushUpAspectAction(Attendee att, ReviewerTableModel rtm, JTable aspectTbl) 0 / 3 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 5 0 %
PushDownAspectAction 0 / 8 0 %
public PushDownAspectAction(Attendee att, ReviewerTableModel rtm, JTable aspectTbl) 0 / 3 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 5 0 %
EditAttendeeAction 0 / 4 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 4 0 %
ConfirmAttendeeAction 0 / 46 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 45 0 %
AddAttendeeAction 0 / 3 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 3 0 %
aspects 0 / 73 0 %
RemoveAspFromRevAction 0 / 8 0 %
public RemoveAspFromRevAction(JTable aspectTbl, Attendee att, ReviewerTableModel rtm) 0 / 3 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 5 0 %
RemoveAction 0 / 0 ---
@Override public void actionPerformed(ActionEvent arg0) 0 / 0 ---
OpenAspectsManagerAction 0 / 2 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 2 0 %
ImportCatalogAction 0 / 0 ---
ExportCatalogAction 0 / 0 ---
EditCatalogAction 0 / 0 ---
AutoDistributionAction 0 / 0 ---
AddReviewerAction 0 / 0 ---
AddCatalogAction 0 / 0 ---
AddAspectToReviewerAction 0 / 18 0 %
public AddAspectToReviewerAction(Attendee att, ReviewerTableModel rtm) 0 / 2 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 8 0 %
public void expandAll(JTree tree, boolean expand) 0 / 2 0 %
private void expandAll(JTree tree, TreePath parent, boolean expand) 0 / 6 0 %
AddAspectAction 0 / 12 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 12 0 %
AddAspToSelectedRevsAction 0 / 16 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 8 0 %
public void expandAll(JTree tree, boolean expand) 0 / 2 0 %
private void expandAll(JTree tree, TreePath parent, boolean expand) 0 / 6 0 %
AddAspToAllRevsAction 0 / 17 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 9 0 %
public void expandAll(JTree tree, boolean expand) 0 / 2 0 %
private void expandAll(JTree tree, TreePath parent, boolean expand) 0 / 6 0 %
TextPopupWindowAction 0 / 6 0 %
public TextPopupWindowAction(TextPopupWindow popupWin, ButtonClicked buttonClk) 0 / 2 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 2 0 %
SelectModeAction 0 / 2 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 2 0 %
SelectDirectoryAction 0 / 0 ---
SaveReviewAsAction 0 / 3 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 3 0 %
SaveReviewAction 0 / 4 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 4 0 %
OpenScribeModusAction 0 / 2 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 2 0 %
OpenModeratorModusAction 0 / 2 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 2 0 %
NewReviewAction 0 / 4 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 4 0 %
ManageSeveritiesAction 0 / 1 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 1 0 %
LoadReviewAction 0 / 3 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 3 0 %
InitializeMainFrameAction 0 / 6 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 6 0 %
ExportCSVReviewAction 0 / 0 ---
@Override public void actionPerformed(ActionEvent arg0) 0 / 0 ---
ExportCSVMeetingAction 0 / 0 ---
ExitAction 0 / 12 0 %
public ExitAction() 0 / 4 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 5 0 %
private void exitApplication() 0 / 3 0 %
EditAspectsAction 0 / 0 ---
@Override public void actionPerformed(ActionEvent e) 0 / 0 ---
DatePickerAction 0 / 4 0 %
public void actionPerformed(ActionEvent e) 0 / 4 0 %
CreatePDFReviewProtocolAction 0 / 0 ---
CreatePDFMeetingProtocolAction 0 / 0 ---
CreateInvitationsAction 0 / 0 ---
ActionRegistry 0 / 53 0 %
public static ActionRegistry getInstance() 0 / 2 0 %
public void register(Action action) 0 / 1 0 %
private Map<String, Action> getActions() 0 / 2 0 %
public Action get(String className) 0 / 1 0 %
private ActionRegistry() 0 / 46 0 %
UI 0 / 63 0 %
Status 0 / 0 ---
Platform 0 / 0 ---
public Status getStatus() 0 / 1 0 %
public void setStatus(Status status) 0 / 2 0 %
public Platform getPlatform() 0 / 1 0 %
public static UI getInstance() 0 / 2 0 %
public MainFrame getMainFrame() 0 / 3 0 %
public HelpBrowserFrame getHelpBrowserFrame() 0 / 2 0 %
public AssistantDialog getAssistantDialog() 0 / 2 0 %
public EditProductDialog getEditProductDialog() 0 / 2 0 %
public ManageSeveritiesDialog getManageSeveritiesDialog() 0 / 2 0 %
public MeetingDialog getMeetingDialog() 0 / 2 0 %
public AttendeeDialog getAttendeeDialog() 0 / 2 0 %
public AspectsManagerFrame getAspectsManagerFrame() 0 / 2 0 %
public EditProtocolDialog getEditProtocolDialog() 0 / 2 0 %
public ExportCSVDialog getExportCSVDialog() 0 / 2 0 %
public CreatePDFProtocolDialog getCreatePDFProtocolDialog() 0 / 2 0 %
public CreateInvitationsDialog getCreateInvitationsDialog() 0 / 2 0 %
public SettingsDialog getSettingsDialog() 0 / 2 0 %
public SelectAspectsDialog getSelectAspectsDialog() 0 / 2 0 %
public FileChooser getFileChooser() 0 / 2 0 %
private UI() 0 / 11 0 %
public void run() 0 / 8 0 %
@Override public void update(Observable o, Object arg) 0 / 1 0 %
TextPopupWindow 0 / 57 0 %
ButtonClicked 0 / 0 ---
public TextPopupWindow(Window parent, String titleText, String inputText, boolean multiLine) 0 / 52 0 %
public ButtonClicked getButtonClicked() 0 / 1 0 %
public void setButtonClicked(ButtonClicked buttonClicked) 0 / 1 0 %
public String getInput() 0 / 1 0 %
SettingsDialog 0 / 0 ---
SelectAspectsDialog 0 / 0 ---
NodeSelectionListener 0 / 95 0 %
NodeSelectionListener(JTree tree) 0 / 1 0 %
public void mouseClicked(MouseEvent e) 0 / 0 ---
@Override public void mouseEntered(MouseEvent e) 0 / 0 ---
@Override public void mouseExited(MouseEvent e) 0 / 0 ---
@Override public void mousePressed(MouseEvent e) 0 / 2 0 %
@Override public void mouseReleased(MouseEvent e) 0 / 0 ---
private void deselectParent(TreePath path) 0 / 6 0 %
private void selectParent(TreePath path) 0 / 6 0 %
private void deselectChilds(TreePath path) 0 / 4 0 %
private void repaintCategoryBx(AppCatalog catalog, String category) 0 / 3 0 %
private void setNodeBehaviour(boolean selectable,MouseEvent e) 0 / 73 0 %
ActionListener 0 / 9 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 9 0 %
ActionListener 0 / 5 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 5 0 %
ActionListener 0 / 5 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 5 0 %
ActionListener 0 / 5 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 5 0 %
ActionListener 0 / 5 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 5 0 %
ActionListener 0 / 5 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 5 0 %
NewAspectPopupWindow 0 / 117 0 %
public JTextArea getDescriptionTxtArea() 0 / 1 0 %
public JComboBox getCategoryBx() 0 / 1 0 %
public JComboBox getCatalogBx() 0 / 1 0 %
public JTextField getCategoryTxtFld() 0 / 1 0 %
public JTextField getCatalogTxtFld() 0 / 1 0 %
ButtonClicked 0 / 0 ---
public NewAspectPopupWindow(Window parent, String titleText) 0 / 107 0 %
ItemListener 0 / 4 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 4 0 %
ItemListener 0 / 4 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 4 0 %
ItemListener 0 / 4 0 %
@Override public void itemStateChanged(ItemEvent arg0) 0 / 4 0 %
public ButtonClicked getButtonClicked() 0 / 1 0 %
public void setButtonClicked(ButtonClicked buttonClicked) 0 / 1 0 %
public String getDirective() 0 / 1 0 %
MeetingDialog 0 / 121 0 %
public Calendar getBegin() 0 / 4 0 %
public Calendar getEnd() 0 / 4 0 %
public int getHBegin() 0 / 1 0 %
public int getMEnd() 0 / 1 0 %
public int getHEnd() 0 / 1 0 %
public String getCanceled() 0 / 1 0 %
public void setCanceled(String canceled) 0 / 1 0 %
public String getLocationTxt() 0 / 1 0 %
public void setLocationTxt(String locationTxt) 0 / 1 0 %
public ObservingTextField getDateTxtFld() 0 / 1 0 %
public void setDateTxtFld(ObservingTextField dateTxtFld) 0 / 1 0 %
@SuppressWarnings("deprecation") public void setMode() 0 / 36 0 %
public MeetingDialog(Frame parent) 0 / 63 0 %
ItemListener 0 / 2 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 2 0 %
ActionListener 0 / 1 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 1 0 %
WindowAdapter 0 / 1 0 %
@Override public void windowClosing(WindowEvent e) 0 / 1 0 %
ManageSeveritiesDialog 0 / 71 0 %
public SeverityTableModel getStm() 0 / 1 0 %
public JTable getSeverityTbl() 0 / 1 0 %
public void clearSeveritiesDialog() 0 / 48 0 %
public ManageSeveritiesDialog(Frame parent) 0 / 17 0 %
ActionListener 0 / 1 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 1 0 %
WindowAdapter 0 / 1 0 %
@Override public void windowClosing(WindowEvent e) 0 / 1 0 %
MainFrame 0 / 387 0 %
public String getTextRevName() 0 / 1 0 %
public String getTextRevDesc() 0 / 1 0 %
public String getTextRevComm() 0 / 1 0 %
public DefaultMutableTreeNode getNodeMeetingRoot() 0 / 1 0 %
public DefaultTreeModel getDTM() 0 / 1 0 %
public JButton getEditAttendee() 0 / 1 0 %
public JButton getRemoveAttendee() 0 / 1 0 %
public AttendeeTableModel getAttendeesTableModel() 0 / 1 0 %
public JTree getMeetingsTree() 0 / 1 0 %
public void setMeetingsTree(JTree meetingsTree) 0 / 1 0 %
public JTable getAttendeesTable() 0 / 1 0 %
public void setAttendeesTable(JTable attendeeTable) 0 / 1 0 %
private void createLeftPane() 0 / 38 0 %
FocusListener 0 / 1 0 %
@Override public void focusGained(FocusEvent e) 0 / 0 ---
@Override public void focusLost(FocusEvent e) 0 / 1 0 %
FocusListener 0 / 1 0 %
@Override public void focusGained(FocusEvent e) 0 / 0 ---
@Override public void focusLost(FocusEvent e) 0 / 1 0 %
FocusListener 0 / 1 0 %
@Override public void focusGained(FocusEvent e) 0 / 0 ---
@Override public void focusLost(FocusEvent e) 0 / 1 0 %
MouseListener 0 / 2 0 %
@Override public void mouseClicked(MouseEvent e) 0 / 2 0 %
@Override public void mouseEntered(MouseEvent e) 0 / 0 ---
@Override public void mouseExited(MouseEvent e) 0 / 0 ---
@Override public void mousePressed(MouseEvent e) 0 / 0 ---
@Override public void mouseReleased(MouseEvent e) 0 / 0 ---
private void createRightPane() 0 / 88 0 %
private void createToolBar() 0 / 47 0 %
private void updateToolBar() 0 / 20 0 %
private void createMenu() 0 / 75 0 %
private void updateMenu() 0 / 16 0 %
private void createMeetingsTree() 0 / 15 0 %
private void updateContentPane() 0 / 6 0 %
private void createHints() 0 / 3 0 %
private void updateHints() 0 / 7 0 %
public MainFrame() 0 / 18 0 %
WindowListener 0 / 1 0 %
@Override public void windowActivated(WindowEvent arg0) 0 / 0 ---
@Override public void windowClosed(WindowEvent arg0) 0 / 0 ---
@Override public void windowClosing(WindowEvent arg0) 0 / 1 0 %
@Override public void windowDeactivated(WindowEvent arg0) 0 / 0 ---
@Override public void windowDeiconified(WindowEvent arg0) 0 / 0 ---
@Override public void windowIconified(WindowEvent arg0) 0 / 0 ---
@Override public void windowOpened(WindowEvent arg0) 0 / 0 ---
@Override public void update(Observable obs, Object obj) 0 / 11 0 %
public void updateTitle() 0 / 8 0 %
@Override public void switchToProgressMode() 0 / 2 0 %
@Override public void switchToEditMode() 0 / 2 0 %
@Override public void switchToClearMode() 0 / 2 0 %
HintItem 0 / 23 0 %
public HintItem(String text, int type, String helpChapter, String helpChapterAnchor) 0 / 5 0 %
public HintItem(String text, int type, String helpChapter) 0 / 1 0 %
public HintItem(String text, int type) 0 / 1 0 %
public int getType() 0 / 1 0 %
public void setType(int type) 0 / 1 0 %
public String getText() 0 / 1 0 %
public void setText(String text) 0 / 1 0 %
public String getHelpChapter() 0 / 1 0 %
public void setHelpChapter(String helpChapter) 0 / 1 0 %
public String getHelpChapterAnchor() 0 / 1 0 %
public void setHelpChapterAnchor(String helpChapterAnchor) 0 / 1 0 %
HelpBrowserFrame 0 / 135 0 %
public HelpBrowserFrame() 0 / 72 0 %
KeyListener 0 / 1 0 %
@Override public void keyTyped(KeyEvent arg0) 0 / 0 ---
@Override public void keyPressed(KeyEvent arg0) 0 / 0 ---
@Override public void keyReleased(KeyEvent arg0) 0 / 1 0 %
TreeWillExpandListener 0 / 1 0 %
public void treeWillExpand(TreeExpansionEvent e) 0 / 0 ---
public void treeWillCollapse(TreeExpansionEvent e) throws ExpandVetoException 0 / 1 0 %
TreeSelectionListener 0 / 11 0 %
@Override public void valueChanged(TreeSelectionEvent arg0) 0 / 11 0 %
@Override public void setVisible(boolean b) 0 / 2 0 %
private void resetBodyPane() 0 / 15 0 %
HyperlinkListener 0 / 5 0 %
public void hyperlinkUpdate(HyperlinkEvent ev) 0 / 5 0 %
private void setErrorPage() 0 / 1 0 %
private void setHelpChapter(String helpChapter) 0 / 7 0 %
private void setHelpChapterAnchor(String helpChapterAnchor) 0 / 4 0 %
synchronized public void showHelp() 0 / 1 0 %
synchronized public void showHelp(String chapter) 0 / 2 0 %
synchronized public void showHelp(String chapter, String anchor) 0 / 5 0 %
public static JTextField getSrchTxtFld() 0 / 1 0 %
public static JEditorPane getBodyPane() 0 / 1 0 %
synchronized public static void setTree(DefaultMutableTreeNode root) 0 / 1 0 %
public static JTree getTree() 0 / 1 0 %
public static String getHelpStartTitle() 0 / 1 0 %
public static String getHelpStartContent() 0 / 1 0 %
public HelpBrowserFrame getHBF() 0 / 1 0 %
public static DefaultMutableTreeNode getStandardRoot() 0 / 10 0 %
FileChooser 0 / 107 0 %
public File getDir() 0 / 1 0 %
public void setDir(File dir) 0 / 2 0 %
public void resetDir() 0 / 1 0 %
public File getFile() 0 / 1 0 %
public void setFile(File file) 0 / 5 0 %
public void clearFile() 0 / 1 0 %
public FileChooser() 0 / 2 0 %
@SuppressWarnings("serial") public int showDialog(Window parent, int chooserMode, int resiFileFilterType) 0 / 86 0 %
JFileChooser 0 / 13 0 %
@Override public void approveSelection() 0 / 13 0 %
ExportCSVDialog 0 / 0 ---
EditProtocolDialog 0 / 52 0 %
private void creatingBody() 0 / 3 0 %
private void creatingOrgTab() 0 / 38 0 %
public EditProtocolDialog() 0 / 9 0 %
EditProductDialog 0 / 87 0 %
public JTable getReferenceTbl() 0 / 1 0 %
public ReferenceTableModel getRtm() 0 / 1 0 %
public JTextField getNameTxtFld() 0 / 1 0 %
public JTextField getVersionTxtFld() 0 / 1 0 %
public void clearProductDialog() 0 / 60 0 %
public EditProductDialog(Frame parent) 0 / 20 0 %
ActionListener 0 / 1 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 1 0 %
WindowAdapter 0 / 1 0 %
@Override public void windowClosing(WindowEvent e) 0 / 1 0 %
DatePicker 0 / 237 0 %
DayLabel 0 / 18 0 %
public DayLabel(DatePicker parent, int day) 0 / 5 0 %
public void setCurrentDayStyle() 0 / 3 0 %
public void setSelectedDayStyle() 0 / 3 0 %
public void setWeekendStyle() 0 / 2 0 %
@Override public void mouseClicked(MouseEvent e) 0 / 1 0 %
@Override public void mousePressed(MouseEvent e) 0 / 0 ---
@Override public void mouseReleased(MouseEvent e) 0 / 0 ---
@Override public void mouseEntered(MouseEvent e) 0 / 3 0 %
@Override public void mouseExited(MouseEvent e) 0 / 1 0 %
@Override public void mouseDragged(MouseEvent e) 0 / 0 ---
@Override public void mouseMoved(MouseEvent e) 0 / 0 ---
MonthPanel 0 / 36 0 %
public MonthPanel(DatePicker parent, Calendar c) 0 / 10 0 %
private void setDaysOfMonth(Calendar c) 0 / 26 0 %
NavigatePanel 0 / 92 0 %
public NavigatePanel(DatePicker parent) 0 / 51 0 %
public void setCurrentMonth(Calendar c) 0 / 6 0 %
private void setMonthComboBox(Calendar c) 0 / 8 0 %
private void setYearComboBox(Calendar c) 0 / 8 0 %
public void setLabel(Calendar c) 0 / 5 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 14 0 %
DatePickerCloseAction 0 / 3 0 %
public DatePickerCloseAction(Window datePicker) 0 / 1 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 1 0 %
public DatePicker(Window parent, Observer observer) 0 / 1 0 %
public DatePicker(Window parent, Observer observer, Date selDate) 0 / 36 0 %
public void start(Component comp) 0 / 9 0 %
@Override public void run() 0 / 2 0 %
public Date parseDate(String date) 0 / 3 0 %
public String formatDate(Date date) 0 / 3 0 %
public String formatDate(Date date, String pattern) 0 / 2 0 %
public String formatDate(Calendar date) 0 / 2 0 %
public String formatDate(Calendar date, String pattern) 0 / 2 0 %
public void register(Observer observer) 0 / 1 0 %
public void unregister(Observer observer) 0 / 1 0 %
public Calendar getCalendar() 0 / 1 0 %
public void setSelectedDate(Date d) 0 / 3 0 %
protected void updateScreen(Calendar c) 0 / 4 0 %
protected void setMonthPanel(Calendar calendar) 0 / 4 0 %
protected void dayPicked(int day) 0 / 6 0 %
public String getString(String key) 0 / 1 0 %
public boolean isCloseOnSelect() 0 / 1 0 %
@Override public void windowGainedFocus(WindowEvent e) 0 / 0 ---
@Override public void windowLostFocus(WindowEvent e) 0 / 1 0 %
public JDialog getScreen() 0 / 1 0 %
public void setCloseOnSelect(boolean closeOnSelect) 0 / 1 0 %
CreatePDFProtocolDialog 0 / 0 ---
CreateInvitationsDialog 0 / 100 0 %
public void clearInvitationsDialog() 0 / 73 0 %
ItemListener 0 / 8 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 8 0 %
ItemListener 0 / 10 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 10 0 %
ActionListener 0 / 3 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 3 0 %
public CreateInvitationsDialog(Frame parent) 0 / 21 0 %
ActionListener 0 / 2 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 2 0 %
WindowAdapter 0 / 1 0 %
@Override public void windowClosing(WindowEvent e) 0 / 1 0 %
CheckRenderer 0 / 50 0 %
public CheckRenderer() 0 / 7 0 %
public Component getTreeCellRendererComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row, boolean hasFocus) 0 / 11 0 %
public Dimension getPreferredSize() 0 / 3 0 %
public void doLayout() 0 / 10 0 %
public void setBackground(Color color) 0 / 2 0 %
TreeLabel 0 / 17 0 %
public TreeLabel() 0 / 0 ---
public void setBackground(Color color) 0 / 2 0 %
public void paint(Graphics g) 0 / 10 0 %
public Dimension getPreferredSize() 0 / 3 0 %
public void setSelected(boolean isSelected) 0 / 1 0 %
public void setFocus(boolean hasFocus) 0 / 1 0 %
CheckNode 0 / 9 0 %
public CheckNode() 0 / 1 0 %
public CheckNode(Object userObject) 0 / 1 0 %
public CheckNode(Object userObject, boolean allowsChildren, boolean isSelected) 0 / 2 0 %
public void setSelected(boolean isSelected) 0 / 4 0 %
public boolean isSelected() 0 / 1 0 %
AttendeeDialog 0 / 121 0 %
public AppAttendee getSelectedAppAtt() 0 / 1 0 %
public StrengthTableModel getStm() 0 / 1 0 %
public JTable getStrengthTbl() 0 / 1 0 %
public JTextField getNameTxtFld() 0 / 1 0 %
public JTextArea getContactTxtArea() 0 / 1 0 %
public JComboBox getRoleBox() 0 / 1 0 %
public void setMode() 0 / 30 0 %
public AttendeeDialog(Frame parent) 0 / 83 0 %
ItemListener 0 / 8 0 %
@Override public void itemStateChanged(ItemEvent arg0) 0 / 8 0 %
ActionListener 0 / 4 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 4 0 %
WindowAdapter 0 / 4 0 %
@Override public void windowClosing(WindowEvent e) 0 / 4 0 %
AssistantDialog 0 / 123 0 %
Selection 0 / 0 ---
public Selection getSelected() 0 / 1 0 %
public String getPath() 0 / 1 0 %
public void setPath(String path) 0 / 1 0 %
public void setSelectMode() 0 / 23 0 %
public void setSelectReview() 0 / 61 0 %
ActionListener 0 / 3 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 3 0 %
ItemListener 0 / 6 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 6 0 %
ItemListener 0 / 6 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 6 0 %
ItemListener 0 / 6 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 6 0 %
public AssistantDialog(Frame parent) 0 / 25 0 %
ActionListener 0 / 3 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 3 0 %
ActionListener 0 / 1 0 %
@Override public void actionPerformed(ActionEvent arg0) 0 / 1 0 %
WindowAdapter 0 / 1 0 %
@Override public void windowClosing(WindowEvent e) 0 / 1 0 %
AspectsManagerFrame 0 / 238 0 %
public List<ReviewerTableModel> getAllRevTblMdlList() 0 / 1 0 %
public JButton getRemoveBttn() 0 / 1 0 %
public List<Attendee> getSelectedReviewers() 0 / 1 0 %
public JButton getPushBottomBttn() 0 / 1 0 %
public JButton getPushDownBttn() 0 / 1 0 %
public JButton getPushUpBttn() 0 / 1 0 %
public JButton getPushTopBttn() 0 / 1 0 %
public void setRootSelected(boolean selected) 0 / 1 0 %
public JButton getAcceptBttn() 0 / 1 0 %
public void setAcceptBttn(JButton bttn) 0 / 1 0 %
public JTree getTree() 0 / 1 0 %
public void setTree(JTree tree) 0 / 1 0 %
public JTextArea getDescriptionTxtArea() 0 / 1 0 %
public void setDescriptionTxtArea(JTextArea descriptionTxtArea) 0 / 1 0 %
public JTextField getDirectiveTxtFld() 0 / 1 0 %
public void setDirectiveTxtFld(JTextField directiveTxtFld) 0 / 1 0 %
public JComboBox getCategoryBx() 0 / 1 0 %
public void setCategoryBx(JComboBox categoryBx) 0 / 1 0 %
public JPanel getLeftBottomPnl() 0 / 1 0 %
public void setLeftBottomPnl(JPanel leftBottomPnl) 0 / 1 0 %
public String getCategory() 0 / 1 0 %
public void setCategoryBx(String cat) 0 / 1 0 %
public String getDescription() 0 / 1 0 %
public void setDescription(String desc) 0 / 1 0 %
public String getDirective() 0 / 1 0 %
public void setDirective(String directive) 0 / 1 0 %
public void clearFrame() 0 / 6 0 %
private void createToolBar() 0 / 23 0 %
private void createLeftPanel() 0 / 50 0 %
private void createRightPanel() 0 / 60 0 %
ItemListener 0 / 4 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 4 0 %
ItemListener 0 / 11 0 %
@Override public void itemStateChanged(ItemEvent e) 0 / 11 0 %
private void createReviewerPanel() 0 / 29 0 %
public AspectsManagerFrame(Frame parent) 0 / 12 0 %
public void repaintTree(TreePath path) 0 / 13 0 %
public void setSubPanelEnabled(boolean enabled) 0 / 10 0 %
AbstractFrame 0 / 202 0 %
@Override public Container getContentPane() 0 / 1 0 %
public void setIcon(ImageIcon icon) 0 / 1 0 %
@Override public Component add(Component comp) 0 / 1 0 %
public void addTopComponent(JComponent component) 0 / 2 0 %
public void clearTopComponents() 0 / 2 0 %
public void setTopComponentsVisible(boolean visible) 0 / 1 0 %
public void setHintsOpened(boolean hintsOpened) 0 / 1 0 %
synchronized public void setStatusMessage(String message, boolean inProgress) 0 / 3 0 %
public void setStatusBarVisible(boolean statusBar) 0 / 1 0 %
public void setLocationToCenter() 0 / 4 0 %
protected void gblAdd(GridBagLayout gbl, Container container, Component component, int posx, int posy, int width, int height, Insets insets, int fill, int anchor, double weightx, double weighty) 0 / 12 0 %
protected void gblAdd(GridBagLayout gbl, Container container, Component component, int posx, int posy, int width, int height, Insets insets, double weightx, double weighty) 0 / 1 0 %
public AbstractFrame() 0 / 62 0 %
ActionListener 0 / 1 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 1 0 %
public void setHints(List<HintItem> hints) 0 / 56 0 %
ActionListener 0 / 1 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 1 0 %
public void switchToEditMode() 0 / 4 0 %
public void switchToProgressMode() 0 / 4 0 %
public void switchToClearMode() 0 / 4 0 %
public void toggleHints() 0 / 13 0 %
AbstractDialog 0 / 165 0 %
@Override public Container getContentPane() 0 / 1 0 %
@Override public void setTitle(String title) 0 / 2 0 %
public void setDescription(String description) 0 / 4 0 %
public void addTopComponent(JComponent component) 0 / 3 0 %
public void clearTopComponents() 0 / 2 0 %
public void setHint(String hint) 0 / 3 0 %
public void setMessage(String message) 0 / 3 0 %
public void setIcon(ImageIcon icon) 0 / 1 0 %
@Override public void setMinimumSize(Dimension minimumSize) 0 / 2 0 %
@Override public Component add(Component comp) 0 / 1 0 %
public void addButton(JButton button) 0 / 1 0 %
private void disableButtons() 0 / 1 0 %
private void enableButtons() 0 / 1 0 %
public void setLocationToCenter() 0 / 3 0 %
public void setHelpChapter(String chapter) 0 / 1 0 %
public void setHelpChapter(String chapter, String anchor) 0 / 3 0 %
protected void gblAdd(GridBagLayout gbl, Container container, Component component, int posx, int posy, int width, int height, Insets insets, double weightx, double weighty) 0 / 11 0 %
public AbstractDialog(Frame parent) 0 / 68 0 %
ActionListener 0 / 1 0 %
@Override public void actionPerformed(ActionEvent e) 0 / 1 0 %
WindowAdapter 0 / 1 0 %
@Override public void windowClosing(WindowEvent e) 0 / 1 0 %
public void switchToEditMode() 0 / 4 0 %
public void switchToProgressMode() 0 / 4 0 %
public void toggleHelp() 0 / 22 0 %
export 1178 / 1200 98 %
ReviewProtocolPDFExporter 24 / 25 96 %
public ReviewProtocolPDFExporter(String filePath, boolean showSignFields, boolean attachProdExtRefs, boolean attachFindExtRefs) throws ExportException, DataException 4 / 4 100 %
@Override protected void writeContent() throws ExportException 15 / 16 93 %
ProtocolPDFExporter 628 / 638 98 %
protected ProtocolPDFExporter(String filePath, String headTitle, String headLogoPath, String footText) throws ExportException 1 / 1 100 %
protected void writeTitlePage(Meeting meeting, boolean attachProdExtRefs) throws ExportException 3 / 3 100 %
protected void writeTitlePage(List<Meeting> meetings, boolean attachProdExtRefs) throws ExportException 295 / 296 99 %
protected void writeMeeting(Meeting meeting, boolean attachExtRefs, boolean showSignatureFields) throws ExportException 105 / 106 99 %
protected void writeAttendees(Protocol protocol, boolean showAttendeesAspects, boolean showAttendeesPrepTime, boolean showSignatureFields) throws ExportException 101 / 108 93 %
protected void writeFindings(Protocol protocol, boolean attachExtRefs) throws ExportException 112 / 113 99 %
PDFPageEventHelper 105 / 106 99 %
public PDFPageEventHelper(String headTitle, String headLogoPath, String footText) 5 / 5 100 %
private void setMarks(PdfWriter writer, Document document) 10 / 10 100 %
@Override public void onOpenDocument(PdfWriter writer, Document document) 1 / 1 100 %
@Override public void onCloseDocument(PdfWriter writer, Document document) 5 / 5 100 %
@Override public void onEndPage(PdfWriter writer, Document document) 76 / 77 98 %
PDFExporter 21 / 22 95 %
protected PDFExporter(String filePath, String headTitle, String headLogoPath, String footText) throws ExportException 11 / 12 91 %
protected PdfPCell createVerticalStrut(float height, int colspan) 5 / 5 100 %
protected abstract void writeContent() throws ExportException 0 / 0 ---
public void writeToFile() throws ExportException 3 / 3 100 %
PDFCellEventExtRef 10 / 10 100 %
public PDFCellEventExtRef(PdfWriter writer, File file) 2 / 2 100 %
@Override public void cellLayout(PdfPCell cell, Rectangle rect, PdfContentByte[] canvas) 6 / 6 100 %
MeetingProtocolPDFExporter 14 / 15 93 %
public MeetingProtocolPDFExporter(String filePath, Meeting meeting, boolean showSignFields, boolean attachProdExtRefs, boolean attachFindExtRefs) throws ExportException, DataException 5 / 5 100 %
@Override protected void writeContent() throws ExportException 3 / 4 75 %
InvitationZIPExporter 17 / 18 94 %
public InvitationZIPExporter(String filePath, Meeting meeting, Attendee attendee, boolean attachProdExtRefs) 7 / 7 100 %
public void writeToFile() throws ExportException, DataException 3 / 4 75 %
InvitationPDFExporter 261 / 264 98 %
public InvitationPDFExporter(String filePath, Meeting meeting, Attendee attendee, boolean attachProdExtRefs) throws ExportException, DataException 4 / 4 100 %
private void writeTitlePage() throws ExportException 166 / 167 99 %
private void writeAspects() throws ExportException 60 / 61 98 %
@Override protected void writeContent() throws ExportException 19 / 20 95 %
InvitationDirExporter 16 / 17 94 %
public InvitationDirExporter(String dirPath, Meeting meeting, Attendee attendee, boolean attachProdExtRefs) 6 / 6 100 %
public void writeDir() throws ExportException, DataException 4 / 5 80 %
FindingsCSVExporter 43 / 45 95 %
public FindingsCSVExporter(AppCSVProfile csvProfile, Map<String, String> severityMappings, List<Finding> findings, String reporter) 11 / 12 91 %
public void addSeverityMapping(String sevName, String sevMapping) 2 / 2 100 %
@Override protected void writeContent() 24 / 25 96 %
ExportException 2 / 2 100 %
public ExportException() 1 / 1 100 %
public ExportException(String message) 1 / 1 100 %
CSVExporter 37 / 38 97 %
protected CSVExporter() 2 / 2 100 %
protected abstract void writeContent() 0 / 0 ---
protected String[] newLine() 1 / 1 100 %
public void writeToFile(String filePath) throws ExportException 20 / 21 95 %
public String getSeparator() 1 / 1 100 %
public void setSeparator(String separator) 2 / 2 100 %
public String getEncapsulator() 1 / 1 100 %
public void setEncapsulator(String encapsulator) 2 / 2 100 %
public int getColumns() 1 / 1 100 %
public void setColumns(int columns) 2 / 2 100 %
app 2056 / 2252 91 %
model 1349 / 1532 88 %
schema 103 / 202 50 %
Severities 2 / 4 50 %
public List<String> getSeverities() 2 / 2 100 %
public boolean isSetSeverities() 0 / 1 0 %
public void unsetSeverities() 0 / 1 0 %
Role 1 / 4 25 %
Role(String v) 1 / 1 100 %
public String value() 0 / 1 0 %
public static Role fromValue(String v) 0 / 2 0 %
Review 17 / 33 51 %
public String getName() 1 / 1 100 %
public void setName(String value) 1 / 1 100 %
public boolean isSetName() 0 / 1 0 %
public String getDescription() 1 / 1 100 %
public void setDescription(String value) 1 / 1 100 %
public boolean isSetDescription() 0 / 1 0 %
public Product getProduct() 1 / 1 100 %
public void setProduct(Product value) 1 / 1 100 %
public boolean isSetProduct() 0 / 1 0 %
public List<Attendee> getAttendees() 1 / 2 50 %
public boolean isSetAttendees() 0 / 1 0 %
public void unsetAttendees() 0 / 1 0 %
public List<Aspect> getAspects() 1 / 2 50 %
public boolean isSetAspects() 0 / 1 0 %
public void unsetAspects() 0 / 1 0 %
public Severities getSeverities() 1 / 1 100 %
public void setSeverities(Severities value) 1 / 1 100 %
public boolean isSetSeverities() 0 / 1 0 %
public List<Meeting> getMeetings() 1 / 2 50 %
public boolean isSetMeetings() 0 / 1 0 %
public void unsetMeetings() 0 / 1 0 %
public String getImpression() 1 / 1 100 %
public void setImpression(String value) 1 / 1 100 %
public boolean isSetImpression() 0 / 1 0 %
public String getRecommendation() 1 / 1 100 %
public void setRecommendation(String value) 1 / 1 100 %
public boolean isSetRecommendation() 0 / 1 0 %
public String getComments() 1 / 1 100 %
public void setComments(String value) 1 / 1 100 %
public boolean isSetComments() 0 / 1 0 %
Protocol 12 / 23 52 %
public Calendar getDate() 1 / 1 100 %
public void setDate(Calendar value) 1 / 1 100 %
public boolean isSetDate() 0 / 1 0 %
public Calendar getStart() 1 / 1 100 %
public void setStart(Calendar value) 1 / 1 100 %
public boolean isSetStart() 0 / 1 0 %
public Calendar getEnd() 1 / 1 100 %
public void setEnd(Calendar value) 1 / 1 100 %
public boolean isSetEnd() 0 / 1 0 %
public String getLocation() 1 / 1 100 %
public void setLocation(String value) 1 / 1 100 %
public boolean isSetLocation() 0 / 1 0 %
public List<AttendeeReference> getAttendeeReferences() 1 / 2 50 %
public boolean isSetAttendeeReferences() 0 / 1 0 %
public void unsetAttendeeReferences() 0 / 1 0 %
public List<Finding> getFindings() 1 / 2 50 %
public boolean isSetFindings() 0 / 1 0 %
public void unsetFindings() 0 / 1 0 %
public String getComments() 1 / 1 100 %
public void setComments(String value) 1 / 1 100 %
public boolean isSetComments() 0 / 1 0 %
Product 5 / 10 50 %
public String getName() 1 / 1 100 %
public void setName(String value) 1 / 1 100 %
public boolean isSetName() 0 / 1 0 %
public List<String> getReferences() 1 / 2 50 %
public boolean isSetReferences() 0 / 1 0 %
public void unsetReferences() 0 / 1 0 %
public String getVersion() 1 / 1 100 %
public void setVersion(String value) 1 / 1 100 %
public boolean isSetVersion() 0 / 1 0 %
ObjectFactory 0 / 18 0 %
public ObjectFactory() 0 / 0 ---
public Meeting createMeeting() 0 / 1 0 %
public Finding createFinding() 0 / 1 0 %
public Review createReview() 0 / 1 0 %
public Severities createSeverities() 0 / 1 0 %
public AspectsIds createAspectsIds() 0 / 1 0 %
public Attendee createAttendee() 0 / 1 0 %
public AttendeeReference createAttendeeReference() 0 / 1 0 %
public Aspects createAspects() 0 / 1 0 %
public Product createProduct() 0 / 1 0 %
public Catalog createCatalog() 0 / 1 0 %
public Aspect createAspect() 0 / 1 0 %
public Protocol createProtocol() 0 / 1 0 %
@XmlElementDecl(namespace = "http://www.informatik.uni-stuttgart.de/iste/se", name = "review") public JAXBElement<Review> createReview(Review value) 0 / 1 0 %
@XmlElementDecl(namespace = "http://www.informatik.uni-stuttgart.de/iste/se", name = "aspects") public JAXBElement<Aspects> createAspects(Aspects value) 0 / 1 0 %
@XmlElementDecl(namespace = "http://www.informatik.uni-stuttgart.de/iste/se", name = "catalog") public JAXBElement<Catalog> createCatalog(Catalog value) 0 / 1 0 %
Meeting 13 / 21 61 %
public Calendar getPlannedDate() 1 / 1 100 %
public void setPlannedDate(Calendar value) 1 / 1 100 %
public boolean isSetPlannedDate() 0 / 1 0 %
public Calendar getPlannedStart() 1 / 1 100 %
public void setPlannedStart(Calendar value) 1 / 1 100 %
public boolean isSetPlannedStart() 0 / 1 0 %
public Calendar getPlannedEnd() 1 / 1 100 %
public void setPlannedEnd(Calendar value) 1 / 1 100 %
public boolean isSetPlannedEnd() 0 / 1 0 %
public String getPlannedLocation() 1 / 1 100 %
public void setPlannedLocation(String value) 1 / 1 100 %
public boolean isSetPlannedLocation() 0 / 1 0 %
public Protocol getProtocol() 1 / 1 100 %
public void setProtocol(Protocol value) 1 / 1 100 %
public boolean isSetProtocol() 0 / 1 0 %
public String getCanceled() 1 / 1 100 %
public void setCanceled(String value) 0 / 1 0 %
public boolean isSetCanceled() 0 / 1 0 %
public String getComments() 1 / 1 100 %
public void setComments(String value) 1 / 1 100 %
public boolean isSetComments() 0 / 1 0 %
Finding 12 / 21 57 %
public Integer getId() 1 / 1 100 %
public void setId(Integer value) 1 / 1 100 %
public boolean isSetId() 0 / 1 0 %
public String getSeverity() 1 / 1 100 %
public void setSeverity(String value) 1 / 1 100 %
public boolean isSetSeverity() 0 / 1 0 %
public String getDescription() 1 / 1 100 %
public void setDescription(String value) 1 / 1 100 %
public boolean isSetDescription() 0 / 1 0 %
public List<String> getReferences() 2 / 2 100 %
public boolean isSetReferences() 0 / 1 0 %
public void unsetReferences() 0 / 1 0 %
public List<String> getAspects() 2 / 2 100 %
public boolean isSetAspects() 0 / 1 0 %
public void unsetAspects() 0 / 1 0 %
public List<String> getExternalReferences() 2 / 2 100 %
public boolean isSetExternalReferences() 0 / 1 0 %
public void unsetExternalReferences() 0 / 1 0 %
Catalog 2 / 6 33 %
public String getDescription() 1 / 1 100 %
public void setDescription(String value) 1 / 1 100 %
public boolean isSetDescription() 0 / 1 0 %
public Aspects getAspects() 0 / 1 0 %
public void setAspects(Aspects value) 0 / 1 0 %
public boolean isSetAspects() 0 / 1 0 %
AttendeeReference 4 / 6 66 %
public String getAttendee() 1 / 1 100 %
public void setAttendee(String value) 1 / 1 100 %
public boolean isSetAttendee() 0 / 1 0 %
public Duration getPreparationTime() 1 / 1 100 %
public void setPreparationTime(Duration value) 1 / 1 100 %
public boolean isSetPreparationTime() 0 / 1 0 %
Attendee 10 / 15 66 %
public String getId() 1 / 1 100 %
public void setId(String value) 1 / 1 100 %
public boolean isSetId() 0 / 1 0 %
public String getName() 1 / 1 100 %
public void setName(String value) 1 / 1 100 %
public boolean isSetName() 0 / 1 0 %
public String getContact() 1 / 1 100 %
public void setContact(String value) 1 / 1 100 %
public boolean isSetContact() 0 / 1 0 %
public Role getRole() 1 / 1 100 %
public void setRole(Role value) 1 / 1 100 %
public boolean isSetRole() 0 / 1 0 %
public AspectsIds getAspects() 1 / 1 100 %
public void setAspects(AspectsIds value) 1 / 1 100 %
public boolean isSetAspects() 0 / 1 0 %
AspectsIds 2 / 4 50 %
public List<String> getAspectIds() 2 / 2 100 %
public boolean isSetAspectIds() 0 / 1 0 %
public void unsetAspectIds() 0 / 1 0 %
Aspects 1 / 4 25 %
public List<Aspect> getAspects() 1 / 2 50 %
public boolean isSetAspects() 0 / 1 0 %
public void unsetAspects() 0 / 1 0 %
Aspect 8 / 12 66 %
public String getId() 1 / 1 100 %
public void setId(String value) 1 / 1 100 %
public boolean isSetId() 0 / 1 0 %
public String getCategory() 1 / 1 100 %
public void setCategory(String value) 1 / 1 100 %
public boolean isSetCategory() 0 / 1 0 %
public String getDirective() 1 / 1 100 %
public void setDirective(String value) 1 / 1 100 %
public boolean isSetDirective() 0 / 1 0 %
public String getDescription() 1 / 1 100 %
public void setDescription(String value) 1 / 1 100 %
public boolean isSetDescription() 0 / 1 0 %
Adapter7 2 / 3 66 %
public Calendar unmarshal(String value) 1 / 1 100 %
public String marshal(Calendar value) 1 / 2 50 %
Adapter6 2 / 3 66 %
public Calendar unmarshal(String value) 1 / 1 100 %
public String marshal(Calendar value) 1 / 2 50 %
Adapter5 2 / 3 66 %
public Calendar unmarshal(String value) 1 / 1 100 %
public String marshal(Calendar value) 1 / 2 50 %
Adapter4 2 / 3 66 %
public Integer unmarshal(String value) 1 / 1 100 %
public String marshal(Integer value) 1 / 2 50 %
Adapter3 2 / 3 66 %
public Calendar unmarshal(String value) 1 / 1 100 %
public String marshal(Calendar value) 1 / 2 50 %
Adapter2 2 / 3 66 %
public Calendar unmarshal(String value) 1 / 1 100 %
public String marshal(Calendar value) 1 / 2 50 %
Adapter1 2 / 3 66 %
public Calendar unmarshal(String value) 1 / 1 100 %
public String marshal(Calendar value) 1 / 2 50 %
appdata 763 / 812 93 %
AppSettingValue 0 / 0 ---
AppSettingKey 0 / 0 ---
AppCatalog 299 / 320 93 %
protected AppCatalog(String name) 2 / 2 100 %
@Override public String toString() 1 / 1 100 %
@Override public boolean equals(Object obj) 4 / 4 100 %
public static AppCatalog newInstance(String name) throws DataException 12 / 13 92 %
public String getName() 1 / 1 100 %
public void setName(String name) throws DataException 19 / 19 100 %
private void pushCatalog(PushMode mode) throws DataException 20 / 21 95 %
public void pushUp() throws DataException 1 / 1 100 %
public void pushDown() throws DataException 1 / 1 100 %
public void pushTop() throws DataException 1 / 1 100 %
public void pushBottom() throws DataException 1 / 1 100 %
public int getSortPos() throws DataException 10 / 11 90 %
private int getSortPosOfPredecessor() throws DataException 11 / 12 91 %
private int getSortPosOfSuccessor() throws DataException 11 / 12 91 %
public int getSortPosCategory(String category) throws DataException 11 / 12 91 %
private int getSortPosCategoryOfPre(String category) throws DataException 12 / 13 92 %
private int getSortPosCategoryOfSuc(String category) throws DataException 12 / 13 92 %
public int getFirstSortPosOfCategories() throws DataException 11 / 12 91 %
public int getLastSortPosOfCategories() throws DataException 11 / 12 91 %
private void pushCategory(String category, PushMode mode) throws DataException 22 / 23 95 %
public void pushUpCategory(String category) throws DataException 1 / 1 100 %
public void pushDownCategory(String category) throws DataException 1 / 1 100 %
public void pushTopCategory(String category) throws DataException 1 / 1 100 %
public void pushBottomCategory(String category) throws DataException 1 / 1 100 %
public int getNumberOfCategories() throws DataException 11 / 12 91 %
public List<String> getCategories() throws DataException 10 / 11 90 %
public List<String> getCategories(String filter) throws DataException 4 / 4 100 %
public boolean isCategory(String name) throws DataException 11 / 12 91 %
public void editCategory(String oldName, String newName) throws DataException 17 / 17 100 %
public int getFirstSortPosOfAspects(String category) throws DataException 12 / 13 92 %
public int getLastSortPosOfAspects(String category) throws DataException 12 / 13 92 %
public int getNumberOfAspects(String category) throws DataException 14 / 15 93 %
public int getNumberOfAspects() throws DataException 1 / 1 100 %
public List<AppAspect> getAspects(String category) throws DataException 11 / 12 91 %
public List<AppAspect> getAspects(String category, String filter) throws DataException 4 / 4 100 %
public AppAspect getAspect(int id) throws DataException 1 / 1 100 %
public AppAspect newAspect(String directive, String description, String category) throws DataException 1 / 1 100 %
public void removeAspect(AppAspect aspect) throws DataException 11 / 12 91 %
public void removeCategory(String category) 0 / 2 0 %
AppCSVProfile 187 / 199 93 %
protected AppCSVProfile(String name) 2 / 2 100 %
@Override public String toString() 1 / 1 100 %
@Override public boolean equals(Object obj) 4 / 4 100 %
public static AppCSVProfile newInstance(String name) throws DataException 14 / 15 93 %
public String getName() 1 / 1 100 %
public void setName(String name) throws DataException 19 / 19 100 %
public List<AppCSVColumnName> getColumnOrder() throws DataException 11 / 12 91 %
public void setColumnOrder(List<AppCSVColumnName> colList) throws DataException 16 / 16 100 %
public boolean isColsInFirstLine() throws DataException 11 / 12 91 %
public void setColsInFirstLine(boolean cfl) throws DataException 7 / 8 87 %
public boolean isEncapsulateContent() throws DataException 11 / 12 91 %
public void setEncapsulateContent(boolean ec) throws DataException 7 / 8 87 %
public String getColumnMapping(AppCSVColumnName col) throws DataException 11 / 12 91 %
public boolean existColumnMapping(AppCSVColumnName col) throws DataException 11 / 12 91 %
public void setColumnMapping(AppCSVColumnName col, String map) throws DataException 9 / 10 90 %
public void removeColumnMapping(AppCSVColumnName col) throws DataException 7 / 8 87 %
public List<String> getValidSeverityMappings() throws DataException 10 / 11 90 %
public void setValidSeverityMappings(List<String> mappings) throws DataException 18 / 19 94 %
public boolean isValidSeverityMapping(String mapping) throws DataException 1 / 1 100 %
private int getSortPosOfSeverityMapping(String mapping) throws DataException 1 / 1 100 %
private int getFirstSortPosOfSeverityMappings() 1 / 1 100 %
private int getLastSortPosOfSeverityMappings() throws DataException 1 / 1 100 %
public void pushUpSeverityMapping(String mapping) throws DataException 6 / 6 100 %
public void pushDownSeverityMapping(String mapping) throws DataException 6 / 6 100 %
AppCSVColumnName 0 / 0 ---
AppAttendee 105 / 111 94 %
protected AppAttendee(String name, String contact) 3 / 3 100 %
@Override public String toString() 3 / 3 100 %
@Override public boolean equals(Object obj) 4 / 5 80 %
public static AppAttendee newInstance(String name, String contact) throws DataException 13 / 14 92 %
public String getName() 1 / 1 100 %
public String getContact() throws DataException 1 / 1 100 %
public void setName(String name) throws DataException 1 / 1 100 %
public void setContact(String contact) throws DataException 1 / 1 100 %
public void setNameAndContact(String name, String contact) throws DataException 30 / 30 100 %
public List<String> getStrengths() throws DataException 11 / 12 91 %
public boolean isStrength(String str) throws DataException 12 / 13 92 %
public void addStrength(String str) throws DataException 8 / 9 88 %
public void removeStrength(String str) throws DataException 8 / 9 88 %
public Attendee getAsResiAttendee() throws DataException 7 / 7 100 %
AppAspect 172 / 182 94 %
public AppAspect(AppCatalog catalog, int id) 3 / 3 100 %
public AppAspect(AppCatalog catalog, String directive, String description, String categoryName) throws DataException 26 / 27 96 %
@Override public String toString() 2 / 2 100 %
@Override public boolean equals(Object obj) 4 / 4 100 %
public int getId() 1 / 1 100 %
public String getDirective() throws DataException 12 / 12 100 %
public void setDirective(String dir) throws DataException 7 / 8 87 %
public String getDescription() throws DataException 11 / 12 91 %
public void setDescription(String desc) throws DataException 7 / 8 87 %
public String getCategory() throws DataException 11 / 12 91 %
public void setCategory(String cat) throws DataException 18 / 19 94 %
private void pushAspect(PushMode mode) throws DataException 22 / 23 95 %
public void pushUp() throws DataException 1 / 1 100 %
public void pushDown() throws DataException 1 / 1 100 %
public void pushTop() throws DataException 1 / 1 100 %
public void pushBottom() throws DataException 1 / 1 100 %
public int getSortPos() throws DataException 10 / 11 90 %
private int getSortPosOfPredecessor() throws DataException 13 / 14 92 %
private int getSortPosOfSuccessor() throws DataException 13 / 14 92 %
public Aspect getAsResiAspect() throws DataException 6 / 6 100 %
ResiData 26 / 26 100 %
public Aspects getAspects() 1 / 1 100 %
public void setAspects(Aspects aspects) 1 / 1 100 %
public void clearAspects() 2 / 2 100 %
public Catalog getCatalog() 1 / 1 100 %
public void setCatalog(Catalog catalog) 1 / 1 100 %
public void clearCatalog() 2 / 2 100 %
public Review getReview() 1 / 1 100 %
public void setReview(Review review) 1 / 1 100 %
public void clearReview() 2 / 2 100 %
public void fireDataChanged() 2 / 2 100 %
public String getAspectsPath() 1 / 1 100 %
public void setAspectsPath(String aspectsPath) 1 / 1 100 %
public String getCatalogPath() 1 / 1 100 %
public void setCatalogPath(String catalogPath) 1 / 1 100 %
public String getReviewPath() 1 / 1 100 %
public void setReviewPath(String reviewPath) 1 / 1 100 %
HelpData 47 / 53 88 %
private String readHtmlFile(URL resource) throws IOException 13 / 13 100 %
private void readInChapters() throws DataException 11 / 16 68 %
public String[] getChapters() throws DataException 2 / 2 100 %
public int getChapterNumber(String chapter) throws DataException 5 / 6 83 %
public String getChapterTitle(String chapter) throws DataException 5 / 5 100 %
public String getChapterContent(String chapter) throws DataException 5 / 5 100 %
DataException 2 / 2 100 %
public DataException() 1 / 1 100 %
public DataException(String message) 1 / 1 100 %
Data 48 / 51 94 %
protected Data() 10 / 12 83 %
public static Data getInstance() 2 / 2 100 %
public ResiData getResiData() 1 / 1 100 %
public ApplicationData getAppData() 1 / 1 100 %
public HelpData getHelpData() 1 / 1 100 %
public Locale getLocale() 1 / 1 100 %
public void setLocale(Locale locale) 2 / 3 66 %
public String getMode() 1 / 1 100 %
public void setMode(String mode) 5 / 5 100 %
public ImageIcon getIcon(String iconFile) 1 / 1 100 %
public String getResource(String key) 3 / 3 100 %
public String getLocaleStr(String key) 4 / 4 100 %
public boolean getModeParam(String key) 5 / 5 100 %
ApplicationData 360 / 386 93 %
PushMode 0 / 0 ---
public void initialize() throws DataException 9 / 15 60 %
public Connection openConnection() throws DataException 4 / 5 80 %
public void resetDatabase() 3 / 3 100 %
public String getAppDataPath() 2 / 2 100 %
public String getCustomAppDataDirectory() 1 / 1 100 %
public void setCustomAppDataDirectory(String customDatabasePath) 3 / 3 100 %
private void createTables() throws DataException, SQLException 53 / 53 100 %
private void insertDefaultsApplicationSettings() throws DataException, SQLException 25 / 25 100 %
private void insertDefaultsCSVProfiles() throws DataException, SQLException 9 / 9 100 %
private void insertDefaultsCSVColumnMappings() throws DataException, SQLException 20 / 20 100 %
private void insertDefaultsCSVSeverityMappings() throws DataException, SQLException 7 / 7 100 %
public void fireDataChanged() 2 / 2 100 %
public String getSetting(AppSettingKey key) throws DataException 10 / 11 90 %
public AppSettingValue getSettingValue(AppSettingKey key) throws DataException 5 / 5 100 %
public void setSetting(AppSettingKey key, String value) throws DataException 9 / 10 90 %
public void setSettingValue(AppSettingKey key, AppSettingValue value) throws DataException 1 / 1 100 %
public List<String> getLastReviews() throws DataException 10 / 11 90 %
public void addLastReview(String filePath) throws DataException 13 / 14 92 %
public void removeLastReview(String filePath) throws DataException 6 / 7 85 %
public List<AppCatalog> getCatalogs() throws DataException 9 / 10 90 %
public List<AppCatalog> getCatalogs(String filter) throws DataException 4 / 4 100 %
public AppCatalog getCatalog(String name) throws DataException 10 / 11 90 %
public AppCatalog newCatalog(String name) throws DataException 1 / 1 100 %
public void removeCatalog(String name) throws DataException 12 / 13 92 %
public void removeCatalog(AppCatalog catalog) throws DataException 1 / 1 100 %
public int getNumberOfCatalogs() throws DataException 10 / 11 90 %
public int getFirstSortPosOfCatalogs() throws DataException 10 / 11 90 %
public int getLastSortPosOfCatalogs() throws DataException 10 / 11 90 %
public List<AppAttendee> getAttendees() throws DataException 9 / 10 90 %
public List<AppAttendee> getAttendees(String filter) throws DataException 7 / 7 100 %
public AppAttendee getAttendee(String name, String contact) throws DataException 11 / 12 91 %
public AppAttendee newAttendee(String name, String contact) throws DataException 1 / 1 100 %
public void removeAttendee(String name, String contact) throws DataException 11 / 12 91 %
public void removeAttendee(AppAttendee attendee) throws DataException 1 / 1 100 %
public int getNumberOfAttendees() throws DataException 10 / 11 90 %
public List<AppCSVProfile> getCSVProfiles() throws DataException 9 / 10 90 %
public List<AppCSVProfile> getCSVProfiles(String filter) throws DataException 4 / 4 100 %
public AppCSVProfile getCSVProfile(String name) throws DataException 10 / 11 90 %
public AppCSVProfile newCSVProfile(String name) throws DataException 1 / 1 100 %
public void removeCSVProfile(String name) throws DataException 12 / 13 92 %
public void removeCSVProfile(AppCSVProfile profile) throws DataException 1 / 1 100 %
public int getNumberOfCSVProfiles() throws DataException 10 / 11 90 %
comparators 11 / 14 78 %
MeetingComparator 2 / 2 100 %
@Override public int compare(Meeting meet1, Meeting meet2) 2 / 2 100 %
AttendeeComparator 4 / 5 80 %
@Override public int compare(Attendee att1, Attendee att2) 4 / 5 80 %
AspectComparator 5 / 7 71 %
@Override public int compare(Aspect asp1, Aspect asp2) 5 / 7 71 %
SeverityManagement 51 / 51 100 %
public void validateSeverities() 3 / 3 100 %
public boolean isSeverity(String sev) 2 / 2 100 %
public List<String> getSeverities() 1 / 1 100 %
public void addSeverity(String sev) 3 / 3 100 %
public String getReplaceSeverity(String sev) 4 / 4 100 %
public boolean isSeverityRemovable(String sev) 2 / 2 100 %
public void removeSeverity(String sev) 5 / 5 100 %
public void editSeverity(String oldSev, String newSev) 7 / 7 100 %
public int getNumberOfSeverities() 1 / 1 100 %
public void pushUpSeverity(String sev) 4 / 4 100 %
public void pushDownSeverity(String sev) 4 / 4 100 %
public void pushTopSeverity(String sev) 4 / 4 100 %
public void pushBottomSeverity(String sev) 4 / 4 100 %
public boolean isTopSeverity(String sev) 3 / 3 100 %
public boolean isBottomSeverity(String sev) 3 / 3 100 %
ReviewManagement 133 / 136 97 %
public String getExtRefFileName(String extRefURI) 5 / 5 100 %
public String getExtRefURI(String fileName) 1 / 1 100 %
public boolean isExtRef(String fileName) 5 / 5 100 %
public String addExtRefFile(File file) 12 / 14 85 %
public void validateExtRefs() 32 / 32 100 %
public void refactorReview() 5 / 5 100 %
public void setReviewName(String name) 3 / 3 100 %
public String getReviewName() 1 / 1 100 %
public void setReviewDescription(String desc) 3 / 3 100 %
public String getReviewDescription() 1 / 1 100 %
public void setReviewComments(String com) 3 / 3 100 %
public String getReviewComments() 1 / 1 100 %
public void setProductName(String name) 3 / 3 100 %
public String getProductName() 1 / 1 100 %
public void setProductVersion(String version) 3 / 3 100 %
public String getProductVersion() 1 / 1 100 %
public boolean isProductReference(String ref) 2 / 2 100 %
public boolean isProductReferenceRemovable(String ref) 2 / 2 100 %
public List<String> getProductReferences() 3 / 3 100 %
public void addProductReference(String ref) 3 / 3 100 %
public void removeProductReference(String ref) 2 / 2 100 %
public void editProductReference(String oldRef, String newRef) 3 / 3 100 %
public boolean isExtProdReferenceRemovable(File ref) 2 / 2 100 %
public List<File> getExtProdReferences() 4 / 4 100 %
public boolean addExtProdReference(File file) 5 / 6 83 %
public void removeExtProdReference(File file) 5 / 5 100 %
public void setImpression(String impr) 3 / 3 100 %
public String getImpression() 1 / 1 100 %
public void setRecommendation(String rec) 3 / 3 100 %
public String getRecommendation() 1 / 1 100 %
public int getNumberOfProdRefs() 1 / 1 100 %
public int getNumberOfSeverities() 1 / 1 100 %
public int getNumberOfAttendees() 1 / 1 100 %
public int getNumberOfAspects() 1 / 1 100 %
public int getNumberOfMeetings() 1 / 1 100 %
public int getNumberOfFindings() 4 / 4 100 %
ResiFileFilter 57 / 57 100 %
public ResiFileFilter(int type) 1 / 1 100 %
@Override public boolean accept(File path) 21 / 21 100 %
@Override public boolean accept(File dir, String name) 2 / 2 100 %
@Override public String getDescription() 20 / 20 100 %
ProtocolManagement 33 / 33 100 %
public Protocol getProtocol(Meeting meet) 1 / 1 100 %
public Protocol setProtocol(Calendar date, Calendar start, Calendar end, String location, Meeting meet) 7 / 7 100 %
public void setProtocol(Protocol prot, Meeting meet) 2 / 2 100 %
public void clearProtocol(Meeting meet) 2 / 2 100 %
public List<Attendee> getAttendees(Protocol prot) 4 / 4 100 %
public boolean isAttendee(Attendee att, Protocol prot) 2 / 2 100 %
public void addAttendee(Attendee att, Duration prep, Protocol prot) 5 / 5 100 %
public void removeAttendee(Attendee att, Protocol prot) 6 / 6 100 %
public Duration getAttendeePrepTime(Attendee att, Protocol prot) 3 / 3 100 %
MeetingManagement 26 / 26 100 %
public List<Meeting> getMeetings() 1 / 1 100 %
public Meeting getPredecessorMeeting(Meeting curMeet) 5 / 5 100 %
public Meeting addMeeting(Calendar date, Calendar start, Calendar end, String location) 7 / 7 100 %
public void addMeeting(Meeting meet) 4 / 4 100 %
public void removeMeeting(Meeting meet) 2 / 2 100 %
public void removeMeeting(int meetIndex) 2 / 2 100 %
public void editMeeting(Meeting oldMeet, Meeting newMeet) 4 / 4 100 %
ImportExportControl 41 / 42 97 %
InvitationType 0 / 0 ---
public Catalog importCatalogXML(String filePath) throws ResiIOException 2 / 2 100 %
public void exportCatalogXML(String filePath, Catalog cat) throws ResiIOException 2 / 2 100 %
public Aspects importAspectsXML(String filePath) throws ResiIOException 2 / 2 100 %
public void exportAspectsXML(String filePath, Aspects asps) throws ResiIOException 2 / 2 100 %
public void exportMeetingProtocolPDF(String filePath, Meeting meeting, boolean showSignFields, boolean attachProdExtRefs, boolean attachFindExtRefs) throws ExportException, DataException 2 / 2 100 %
public void exportReviewProtocolPDF(String filePath, boolean showSignFields, boolean attachProdExtRefs, boolean attachFindExtRefs) throws ExportException, DataException 2 / 2 100 %
public void exportMeetingFindingsCSV(String filePath, AppCSVProfile csvProfile, Meeting meeting, Map<String, String> severityMappings, String reporter) throws ExportException, ApplicationException 3 / 3 100 %
public void exportReviewFindingsCSV(String filePath, AppCSVProfile csvProfile, Map<String, String> severityMappings, String reporter) throws ExportException, ApplicationException 5 / 5 100 %
public void exportInvitations(String dirPath, InvitationType type, Meeting meeting, Attendee attendee, boolean attachProdExtRefs) throws ExportException, DataException 3 / 3 100 %
public void exportInvitations(String dirPath, InvitationType type, Meeting meeting, List<Attendee> attendees, boolean attachProdExtRefs) throws ExportException, DataException 17 / 18 94 %
FindingManagement 77 / 78 98 %
private int getLastId() 4 / 4 100 %
public void refactorIds() 6 / 6 100 %
public List<Finding> getFindings(Protocol prot) 1 / 1 100 %
public int getNumberOfFindings(Protocol prot) 1 / 1 100 %
public Finding addFinding(String description, String severity, Protocol prot) 5 / 5 100 %
public void addFinding(Finding find, Protocol prot) 3 / 3 100 %
public void removeFinding(Finding find, Protocol prot) 2 / 2 100 %
public void editFinding(Finding oldFind, Finding newFind, Protocol prot) 6 / 6 100 %
public List<String> getReferences(Finding find) 1 / 1 100 %
public void addReference(String ref, Finding find) 2 / 2 100 %
public void removeReference(String ref, Finding find) 2 / 2 100 %
public List<File> getExtReferences(Finding find) 5 / 5 100 %
public boolean addExtReference(File file, Finding find) 5 / 6 83 %
public void removeExtReference(File file, Finding find) 5 / 5 100 %
public List<String> getAspects(Finding find) 1 / 1 100 %
public void addAspect(Aspect asp, Finding find) 2 / 2 100 %
public void removeAspect(String asp, Finding find) 2 / 2 100 %
public void pushUpFinding(Finding find, Protocol prot) 4 / 4 100 %
public void pushDownFinding(Finding find, Protocol prot) 4 / 4 100 %
public void pushTopFinding(Finding find, Protocol prot) 4 / 4 100 %
public void pushBottomFinding(Finding find, Protocol prot) 4 / 4 100 %
public boolean isTopFinding(Finding find, Protocol prot) 3 / 3 100 %
public boolean isBottomFinding(Finding find, Protocol prot) 3 / 3 100 %
AttendeeManagement 117 / 120 97 %
private int getLastId() 3 / 3 100 %
private boolean isId(String id) 2 / 2 100 %
private boolean renameId(Attendee att, String newId) 4 / 5 80 %
public void refactorIds() 19 / 20 95 %
public void updateAttendeesDictionary() 4 / 4 100 %
public List<Attendee> getAttendees() 1 / 1 100 %
public Attendee getAttendee(int id) 3 / 3 100 %
public int getNumberOfAttendees() 1 / 1 100 %
public boolean isAttendee(Attendee att) 3 / 3 100 %
public Attendee addAttendee(String name, String contact, Role role, List<Aspect> aspects) 8 / 8 100 %
public Attendee addAttendee(AppAttendee appAtt, Role role, List<Aspect> aspects) 2 / 3 66 %
public Attendee addAttendee(Attendee att) 7 / 7 100 %
public boolean isAttendeeRemovable(Attendee att) 2 / 2 100 %
public void removeAttendee(Attendee att) 2 / 2 100 %
public boolean editAttendee(Attendee oldAtt, Attendee newAtt) 8 / 8 100 %
public List<Meeting> getMeetings(Attendee att) 4 / 4 100 %
public List<Aspect> getAspects(Attendee att) 3 / 3 100 %
public boolean hasAspect(Aspect asp, Attendee att) 2 / 2 100 %
public void addAspect(Aspect asp, Attendee att) 8 / 8 100 %
public void removeAspect(Aspect asp, Attendee att) 3 / 3 100 %
public int getNumberOfAspects(Attendee att) 2 / 2 100 %
public void pushUpAspect(Attendee att, Aspect asp) 4 / 4 100 %
public void pushDownAspect(Attendee att, Aspect asp) 4 / 4 100 %
public void pushTopAspect(Attendee att, Aspect asp) 4 / 4 100 %
public void pushBottomAspect(Attendee att, Aspect asp) 4 / 4 100 %
public boolean isTopAspect(Attendee att, Aspect asp) 3 / 3 100 %
public boolean isBottomAspect(Attendee att, Aspect asp) 3 / 3 100 %
public List<Attendee> getAttendeesWithAspect(Aspect asp) 3 / 3 100 %
AspectManagement 83 / 85 97 %
private int getLastId() 3 / 3 100 %
private boolean isId(String id) 2 / 2 100 %
private boolean renameId(Aspect asp, String newId) 6 / 7 85 %
public void refactorIds() 17 / 18 94 %
public List<Aspect> getAspects() 1 / 1 100 %
public Aspect getAspect(String id) 3 / 3 100 %
public Aspect getAspect(int id) 1 / 1 100 %
public boolean isAspect(Aspect asp) 3 / 3 100 %
public Aspect addAspect(String directive, String description, String category) 6 / 6 100 %
public Aspect addAspect(Aspect asp) 6 / 6 100 %
public void removeAspect(Aspect asp) 4 / 4 100 %
public boolean editAspect(Aspect oldAsp, Aspect newAsp) 8 / 8 100 %
public void pushUpAspect(Aspect asp) 4 / 4 100 %
public void pushDownAspect(Aspect asp) 4 / 4 100 %
public void pushTopAspect(Aspect asp) 4 / 4 100 %
public void pushBottomAspect(Aspect asp) 4 / 4 100 %
public boolean isTopAspect(Aspect asp) 3 / 3 100 %
public boolean isBottomAspect(Aspect asp) 3 / 3 100 %
ApplicationException 2 / 2 100 %
public ApplicationException() 1 / 1 100 %
public ApplicationException(String message) 1 / 1 100 %
ApplicationControl 54 / 54 100 %
public void clearReview() 15 / 15 100 %
public void newReview() 1 / 1 100 %
public void storeReview(String filePath) throws ResiIOException, IOException, ApplicationException 5 / 5 100 %
public void loadReview(String filePath) throws ResiIOException, IOException, ApplicationException 7 / 7 100 %
private void storeReviewAsXML(String filePath) throws ResiIOException 1 / 1 100 %
private void storeReviewAsZIP(String filePath) throws ResiIOException, IOException 4 / 4 100 %
private void loadReviewFromXML(String filePath) throws ResiIOException 2 / 2 100 %
private void loadReviewFromZIP(String filePath) throws ResiIOException, IOException 6 / 6 100 %
public void backupReview() throws ResiIOException, DataException 2 / 2 100 %
public void restoreReview() throws ResiIOException, DataException 5 / 5 100 %
public boolean isReviewRestorable() 1 / 1 100 %
Application 22 / 22 100 %
public static Application getInstance() 2 / 2 100 %
private Application() 10 / 10 100 %
public ApplicationControl getApplicationCtl() 1 / 1 100 %
public ImportExportControl getImportExportCtl() 1 / 1 100 %
public AspectManagement getAspectMgmt() 1 / 1 100 %
public AttendeeManagement getAttendeeMgmt() 1 / 1 100 %
public FindingManagement getFindingMgmt() 1 / 1 100 %
public MeetingManagement getMeetingMgmt() 1 / 1 100 %
public ProtocolManagement getProtocolMgmt() 1 / 1 100 %
public ReviewManagement getReviewMgmt() 1 / 1 100 %
public SeverityManagement getSeverityMgmt() 1 / 1 100 %
Main 0 / 11 0 %
public static void main(String[] args) 0 / 11 0 %
Runnable 0 / 1 0 %
@Override public void run() 0 / 1 0 %
Runnable 0 / 1 0 %
@Override public void run() 0 / 1 0 %
TreeMeeting.java
9   public class TreeMeeting {
10  
11        protected Meeting meeting;
12       
13        public Meeting getMeeting() {
14               return meeting;
15           }
16  
17           public void setMeeting(Meeting meeting) {
18               this.meeting = meeting;
19           }
20          
21           public String toString(){
22               String date=SimpleDateFormat.getDateInstance(DateFormat.LONG).format(meeting.getPlannedDate().getTime());
23               String start=SimpleDateFormat.getTimeInstance(DateFormat.SHORT).format(meeting.getPlannedStart().getTime());
24               String end=SimpleDateFormat.getTimeInstance(DateFormat.SHORT).format(meeting.getPlannedEnd().getTime());
25               String location=meeting.getPlannedLocation();
26  
27               return date+", "+start+"-"+end+" Uhr, "+location;    
28           }
29   }
PDFTools.java
27   public class PDFTools {
28  
29       /**
30        * Converts a length in centimeters to a length in points. It is assumed
31        * that the PDF is rendered with 72 dpi. This method is copied from an iText
32        * tutorial of Markus Knauss (licensed under the GPL).
33        *
34        * @param cm
35        *            to convert to centimeter
36        * @return centimeteras length in points.
37        */
38       public static float cmToPt(float cm) {
39           return ((cm / 2.54f) * 72.0f);
40       }
41  
42       /**
43        * Converts a length given in pt to cm. The conversion assumes that 72 dpi
44        * are used for rendering. This method is copied from an iText tutorial of
45        * Markus Knauss (licensed under the GPL).
46        *
47        * @param pt
48        *            to convert to cm
49        * @return pt length in cm
50        */
51       public static float ptToCm(float pt) {
52           // 72 pt = 1 inch = 2.54 cm
53           return ((pt / 72.0f) * 2.54f);
54       }
55  
56   }
ObservingTextField.java
11   @SuppressWarnings("serial")
12   public class ObservingTextField extends JTextField implements Observer {
13  
14       public void update(Observable o, Object arg) {
15           Calendar calendar = (Calendar) arg;
16           DatePicker dp = (DatePicker) o;
17  
18           setText(dp.formatDate(calendar));
19       }
20  
21   }
GUITools.java
43   public class GUITools {
44  
45       public static void addComponent(Container cont, GridBagLayout gbl,
46               Component c, int x, int y, int width, int height, double weightx,
47               double weighty, int t, int l, int b, int r, int i, int z) {
48  
49           GridBagConstraints gbc = new GridBagConstraints();
50           gbc.insets = new Insets(t, l, b, r);
51           gbc.fill = i;
52           gbc.anchor = z;
53           gbc.gridx = x;
54           gbc.gridy = y;
55           gbc.gridwidth = width;
56           gbc.gridheight = height;
57           gbc.weightx = weightx;
58           gbc.weighty = weighty;
59           gbl.setConstraints(c, gbc);
60           cont.add(c);
61       }
62  
63       public static JButton newImageButton(ImageIcon icon, ImageIcon rolloverIcon) {
64           JButton button = new JButton();
65           button.setContentAreaFilled(false);
66           button.setBorder(null);
67           button.setBorderPainted(false);
68           button.setCursor(new Cursor(Cursor.HAND_CURSOR));
69           button.setFocusable(false);
70  
71           button.setIcon(icon);
72           button.setRolloverIcon(rolloverIcon);
73  
74           return button;
75       }
76  
77       public static JButton newImageButton() {
78           return newImageButton(null, null);
79       }
80  
81       public static JButton newInvisibleStrutButton() {
82           JButton button = new JButton("  ");
83           button.setContentAreaFilled(false);
84           button.setBorder(null);
85           button.setBorderPainted(false);
86           button.setFocusable(false);
87           button.setEnabled(false);
88  
89           return button;
90       }
91  
92       public static JPanel newPopupBasePanel() {
93           JPanel panelBase = new JPanel();
94           panelBase.setLayout(new BorderLayout());
95           panelBase.setBorder(UI.POPUP_BORDER);
96           panelBase.setBackground(UI.POPUP_BACKGROUND);
97  
98           return panelBase;
99       }
100  
101       public static JScrollPane setIntoScrllPn(JTextArea txt) {
102           txt.setLineWrap(true);
103           txt.setWrapStyleWord(true);
104           JScrollPane scrllPn = new JScrollPane(txt,
105                   ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
106                   ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
107  
108           return scrllPn;
109       }
110  
111       public static JScrollPane getMessagePane(String message) {
112           if (message == null) {
113               message = "";
114           }
115  
116           JTextArea textArea = new JTextArea(message);
117           textArea.setLineWrap(true);
118           textArea.setWrapStyleWord(true);
119           // textArea.setMargin(new Insets(4, 4, 4, 4));
120           textArea.setEditable(false);
121           textArea.setFocusable(false);
122           textArea.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12));
123           textArea.setBorder(BorderFactory.createLineBorder(Color.WHITE, 4));
124  
125           JScrollPane scrollPane = new JScrollPane();
126           scrollPane.setPreferredSize(new Dimension(350, 100));
127           scrollPane.getViewport().setView(textArea);
128           scrollPane.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
129  
130           return scrollPane;
131       }
132       
133       public static void formatSpinner(JSpinner sp){
134           JSpinner.DefaultEditor defEditor = (JSpinner.DefaultEditor)sp.getEditor()  ;
135           JFormattedTextField ftf = defEditor.getTextField() ;
136           ftf.setFocusLostBehavior(JFormattedTextField.COMMIT_OR_REVERT);
137           InternationalFormatter intFormatter = (InternationalFormatter)ftf.getFormatter() ;
138           DecimalFormat decimalFormat = (DecimalFormat)intFormatter.getFormat() ;
139           decimalFormat.applyPattern("00")  ;
140           DecimalFormatSymbols geSymbols = new DecimalFormatSymbols(Data.getInstance().getLocale());
141           decimalFormat.setDecimalFormatSymbols(geSymbols)  ;
142  
143       }
144  
145   }
FileTools.java
42   public class FileTools {
43  
44       /**
45        * Deletes this given directory recursivly
46        *
47        * @param directory
48        *            the path to the directory as File object
49        * @return true if the path was deleted, otherwise false
50        */
51       public static boolean deleteDirectory(File directory) {
52           if (directory.exists()) {
53               File[] files = directory.listFiles();
54  
55               for (File f : files) {
56                   if (f.isDirectory()) {
57                       deleteDirectory(f);
58                   } else {
59                       f.delete();
60                   }
61               }
62           }
63  
64           return (directory.delete());
65       }
66  
67       /**
68        * Copies a given source file to target. The target file will be overridden
69        * if it exist.
70        *
71        * @param source
72        *            source file to copy
73        * @param target
74        *            target file to copy to
75        * @throws IOException
76        *             if an error occurs while copying the file
77        */
78       public static void copyFile(File source, File target) throws IOException {
79           InputStream in = new FileInputStream(source);
80           OutputStream out = new FileOutputStream(target);
81  
82           byte[] buffer = new byte[1024];
83           int length;
84  
85           while ((length = in.read(buffer)) > 0) {
86               out.write(buffer, 0, length);
87           }
88  
89           in.close();
90           out.close();
91       }
92  
93       /**
94        * Returns the list of all files, which are directly in the given directory;
95        * not recursivly
96        *
97        * @param directory
98        * @return
99        */
100       public static List<File> getListOfFiles(File directory) {
101           List<File> list = new ArrayList<File>();
102  
103           if (directory.exists() && directory.isDirectory()) {
104               File[] files = directory.listFiles();
105  
106               for (File f : files) {
107                   if (f.isFile()) {
108                       list.add(f);
109                   }
110               }
111           }
112  
113           return list;
114       }
115  
116       /**
117        *
118        * @param files
119        * @param zipFilePath
120        * @param urlEncoded
121        *            true if the files in the zip should be encoded with the
122        *            URLEncoder
123        * @throws IOException
124        */
125       public static void writeToZip(List<File> files, File zipFile,
126               boolean urlEncoded, boolean transformUmlauts) throws IOException {
127           /*
128            * Open the Zip
129            */
130           final FileOutputStream fos = new FileOutputStream(zipFile);
131           final ZipOutputStream zip = new ZipOutputStream(fos);
132           zip.setLevel(9);
133           zip.setMethod(ZipOutputStream.DEFLATED);
134  
135           /*
136            * Write given files to the Zip
137            */
138           for (File f : files) {
139               String fileName;
140  
141               if (urlEncoded) {
142                   fileName = URLEncoder.encode(f.getName(), "UTF-8");
143               } else if (transformUmlauts) {
144                   fileName = transformUmlauts(f.getName());
145                   
146                   while (containsFileName(fileName, files)) {
147                       fileName = "_" + fileName;
148                   }
149               } else {
150                   fileName = f.getName();
151               }
152  
153               final ZipEntry entry = new ZipEntry(fileName);
154               entry.setTime(f.lastModified());
155  
156               /*
157                * read contents of file external file we are going to put in the
158                * Zip
159                */
160               final int fileLength = (int) f.length();
161               final FileInputStream fis = new FileInputStream(f);
162               final byte[] wholeFile = new byte[fileLength];
163  
164               fis.read(wholeFile, 0, fileLength);
165               fis.close();
166  
167               /*
168                * no need to setCRC, or setSize as they are computed automatically.
169                */
170               zip.putNextEntry(entry);
171  
172               /*
173                * write the contents directly into the zip just after the Zip
174                * element
175                */
176               zip.write(wholeFile, 0, fileLength);
177               zip.closeEntry();
178           }
179  
180           /*
181            * close the entire Zip
182            */
183           zip.close();
184       }
185  
186       /**
187        * Extracts the given zip file to the given target directory.
188        *
189        * @param zipFile
190        *            file to extract
191        * @param targetDirectory
192        *            traget directory for extracting the file
193        * @param urlEncoded
194        *            true if the files in the zip are encoded with the URLEncoder
195        * @throws IOException
196        *             if an error occurs while extracting the zip file
197        */
198       public static void extractZipFile(File zipFile, File targetDirectory,
199               boolean urlEncoded) throws IOException {
200           final FileInputStream fis = new FileInputStream(zipFile);
201           final ZipInputStream zip = new ZipInputStream(fis);
202  
203           ZipFile file = new ZipFile(zipFile);
204  
205           /*
206            * loop over each entry in Zip
207            */
208           while (true) {
209               final ZipEntry entry = zip.getNextEntry();
210  
211               if (entry == null) {
212                   break;
213               }
214  
215               /*
216                * Input stream for a single file in the Zip
217                */
218               InputStream eis = file.getInputStream(entry);
219  
220               /*
221                * where we will write the element as an external file
222                */
223               String entryName;
224               
225               if (urlEncoded) {
226                   entryName = URLDecoder.decode(entry.getName(), "UTF-8");
227               } else {
228                   entryName = entry.getName();
229               }
230               
231               final File elementFile = new File(targetDirectory, entryName);
232  
233               if (!elementFile.isDirectory()) {
234                   final FileOutputStream fos = new FileOutputStream(elementFile);
235  
236                   copyStream(eis, fos, true);
237  
238                   fos.close();
239  
240                   elementFile.setLastModified(entry.getTime());
241               }
242  
243               zip.closeEntry();
244           }
245  
246           file.close();
247           zip.close();
248       }
249  
250       /**
251        *
252        * @param origFileName
253        * @return
254        */
255       private static String transformUmlauts(String origFileName) {
256           origFileName = origFileName.replace("ä", "ae");
257           origFileName = origFileName.replace("ö", "oe");
258           origFileName = origFileName.replace("ü", "ue");
259           origFileName = origFileName.replace("Ä", "Ae");
260           origFileName = origFileName.replace("Ö", "Oe");
261           origFileName = origFileName.replace("Ü", "Ue");
262           origFileName = origFileName.replace("ß", "ss");
263  
264           return origFileName;
265       }
266       
267       /**
268        *
269        * @param fileName
270        * @param files
271        * @return
272        */
273       private static boolean containsFileName(String fileName, List<File> files) {
274           for (File f : files) {
275               if (f.getName().equals(fileName)) {
276                   return true;
277               }
278           }
279           
280           return false;
281       }
282  
283       /**
284        * Copies directly from one stream to another without knowing the size,
285        * length or EOF of the source.
286        *
287        * @param source
288        *            Stream to copy from
289        * @param target
290        *            Stream to copy to
291        * @param closeTarget
292        *            true if the target Stream should be closed after copy
293        * @return true if copy was successful; otherwise false
294        */
295       private static boolean copyStream(InputStream source, OutputStream target,
296               boolean closeTarget) {
297           /*
298            * The buffer size for chunking
299            */
300           final int BUFFER_SIZE = 63 * 1024;
301  
302           /*
303            * The timeout for reading from input stream
304            */
305           final int READ_TIMEOUT = 40 * 1000;
306  
307           if (source == null || target == null) {
308               return false;
309           }
310  
311           try {
312               /*
313                * Read and write by chunks
314                */
315               int chunkSize = BUFFER_SIZE;
316  
317               byte[] ba = new byte[chunkSize];
318  
319               /*
320                * keep reading till hit EOF
321                */
322               int bytesRead;
323               while ((bytesRead = readBytesBlocking(source, ba, 0, chunkSize,
324                       READ_TIMEOUT)) > 0) {
325                   target.write(ba, 0, bytesRead);
326               }
327  
328               /*
329                * close the streams
330                */
331               source.close();
332  
333               if (closeTarget) {
334                   target.close();
335               }
336           } catch (IOException e) {
337               return false;
338           }
339  
340           /*
341            * all was ok
342            */
343           return true;
344       }
345  
346       /**
347        * This helper method reads blocks of a given InputStream. It is used by the
348        * copyStream method.
349        *
350        * @param in
351        *            the InputStream to read from
352        * @param b
353        *            the bytes to read as array
354        * @param off
355        *            the offset from which to read
356        * @param len
357        *            the length to read
358        * @param timeoutInMillis
359        *            the timeout in milliseconds to wait for reaction
360        * @return true if reading was successful; otherwise false
361        * @throws IOException
362        *             if an error occurs while reading the block
363        */
364       private static int readBytesBlocking(InputStream in, byte b[], int off,
365               int len, int timeoutInMillis) throws IOException {
366           final int SLEEP_TIME = 100;
367  
368           int totalBytesRead = 0;
369           int bytesRead;
370  
371           long whenToGiveUp = System.currentTimeMillis() + timeoutInMillis;
372  
373           while (totalBytesRead < len
374                   && (bytesRead = in.read(b, off + totalBytesRead, len
375                           - totalBytesRead)) >= 0) {
376               if (bytesRead == 0) {
377                   try {
378                       if (System.currentTimeMillis() >= whenToGiveUp) {
379                           throw new IOException("timeout");
380                       }
381                       /*
382                        * don't hammer the system and suck up all the CPU beating a
383                        * tight loop when there are no chars. If this keeps up we
384                        * may trigger a java.net.SocketTimeoutException exception.
385                        */
386                       Thread.sleep(SLEEP_TIME);
387                   } catch (InterruptedException e) {
388                       /*
389                        * do nothing
390                        */
391                   }
392               } else {
393                   totalBytesRead += bytesRead;
394  
395                   whenToGiveUp = System.currentTimeMillis() + timeoutInMillis;
396               }
397           }
398  
399           return totalBytesRead;
400       }
401  
402   }
AppTools.java
10   public class AppTools {
11  
12       /**
13        * Returns a random string with random length without numbers.
14        *
15        * @return a randomly generated string
16        */
17       public static String getRandomString() {
18           final int MAX_LENGTH = 20;
19  
20           String[] pool = new String[] { "*", "~", "#", "(", ")", "$", "+", "[",
21                   "]", "-", "_", ".", ",", "§", "a", "b", "c", "d", "e", "f",
22                   "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r",
23                   "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D",
24                   "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P",
25                   "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
26  
27           int randNumber = (int) ((Math.random() * MAX_LENGTH) + 1);
28           int randChar;
29  
30           StringBuilder result = new StringBuilder("");
31  
32           for (int i = 0; i < randNumber; i++) {
33               randChar = (int) (Math.random() * pool.length);
34               result.append(pool[randChar]);
35           }
36  
37           return result.toString();
38       }
39   }
TreeExpansionTest.java
14   public class TreeExpansionTest {
15     public static void main(String args[]) {
16       String title = ("JTree Expand Sample");
17       JFrame frame = new JFrame(title);
18       JTree tree = new JTree();
19       TreeWillExpandListener treeWillExpandListener = new TreeWillExpandListener() {
20         public void treeWillCollapse(TreeExpansionEvent treeExpansionEvent)
21             throws ExpandVetoException {
22           TreePath path = treeExpansionEvent.getPath();
23           DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
24               .getLastPathComponent();
25           String data = node.getUserObject().toString();
26           if (data.equals("colors")) {
27             throw new ExpandVetoException(treeExpansionEvent);
28           }
29         }
30  
31         public void treeWillExpand(TreeExpansionEvent treeExpansionEvent)
32             throws ExpandVetoException {
33           TreePath path = treeExpansionEvent.getPath();
34           DefaultMutableTreeNode node = (DefaultMutableTreeNode) path
35               .getLastPathComponent();
36           String data = node.getUserObject().toString();
37           if (data.equals("sports")) {
38             throw new ExpandVetoException(treeExpansionEvent);
39           }
40         }
41       };
42       tree.addTreeWillExpandListener(treeWillExpandListener);
43       JScrollPane scrollPane = new JScrollPane(tree);
44       frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
45       frame.setSize(300, 150);
46       frame.setVisible(true);
47     }
48   }
TestTextPopupWindow.java
13   public class TestTextPopupWindow {
14  
15       /**
16        * @param args
17        */
18       public static void main(String[] args) {
19  
20           TextPopupWindow popup = new TextPopupWindow(UI.getInstance()
21                   .getMainFrame(), "Bitte Name des Reviews eingeben:",
22                   "Review der Spezi ABC", true);
23  
24           popup.setVisible(true);
25  
26           System.out.println("EINGABE: " + popup.getInput());
27           System.out.println("BUTTON: " + popup.getButtonClicked().toString());
28  
29       }
30  
31   }
TestSeveritiesManagement.java
11   public class TestSeveritiesManagement {
12  
13       /**
14        * @param args
15        */
16       
17       public static void main(String[] args) {
18           List<String> test =new ArrayList<String>();
19  
20           Data.getInstance().getResiData().setReview(new Review());
21           Data.getInstance().getResiData().getReview().setSeverities(new Severities());
22           for(int index=0;index<10;index++){
23               
24               Application.getInstance().getSeverityMgmt().addSeverity(String.valueOf(index));
25           }
26           System.out.println(Application.getInstance().getSeverityMgmt().getSeverities());
27           Application.getInstance().getSeverityMgmt().removeSeverity(String.valueOf(3));
28           System.out.println(Application.getInstance().getSeverityMgmt().getSeverities());
29           Application.getInstance().getSeverityMgmt().editSeverity(String.valueOf(5),String.valueOf(10));
30           System.out.println(Application.getInstance().getSeverityMgmt().getSeverities());
31           Application.getInstance().getSeverityMgmt().pushUpSeverity(String.valueOf(1));
32           System.out.println(Application.getInstance().getSeverityMgmt().getSeverities());
33           Application.getInstance().getSeverityMgmt().pushDownSeverity(String.valueOf(7));
34           System.out.println(Application.getInstance().getSeverityMgmt().getSeverities());
35           Application.getInstance().getSeverityMgmt().pushDownSeverity(String.valueOf(7));
36           System.out.println(Application.getInstance().getSeverityMgmt().getSeverities());
37           Application.getInstance().getSeverityMgmt().pushTopSeverity(String.valueOf(8));
38           System.out.println(Application.getInstance().getSeverityMgmt().getSeverities());
39           Application.getInstance().getSeverityMgmt().pushBottomSeverity(String.valueOf(0));
40           System.out.println(Application.getInstance().getSeverityMgmt().getSeverities());
41           System.out.println(Application.getInstance().getSeverityMgmt().isBottomSeverity(String.valueOf(0)));
42           System.out.println(Application.getInstance().getSeverityMgmt().isBottomSeverity(String.valueOf(7)));
43           System.out.println(Application.getInstance().getSeverityMgmt().isTopSeverity(String.valueOf(1)));
44           System.out.println(Application.getInstance().getSeverityMgmt().isTopSeverity(String.valueOf(8)));
45           
46           
47       }
48  
49   }
TestSearch.java
5   public class TestSearch {
6       
7       public static String getLocalString(String searchString,String chapterContent){
8           
9           String localString="";
10           
11               if(chapterContent.indexOf("<")>0){
12                   String local=chapterContent.substring(0, chapterContent.indexOf("<"));
13  
14                   String localLow=local.toLowerCase();
15                   String searchLow=searchString.toLowerCase();
16                   if(localLow.indexOf(searchLow)!=-1){
17                       String replacement="";
18                       replacement=local.substring(0,localLow.indexOf(searchLow));
19                       replacement=replacement.concat(Data.getInstance().getLocaleStr("help.firstReplacement"));
20                       replacement=replacement.concat(local.substring(localLow.indexOf(searchLow),localLow.indexOf(searchLow)+searchString.length()));
21                       replacement=replacement.concat(Data.getInstance().getLocaleStr("help.lastReplacement"));
22                       localString=localString.concat(replacement);
23                       chapterContent=chapterContent.substring(localLow.indexOf(searchLow)+searchString.length());
24                       }else {
25                           localString=localString.concat(local);
26                           chapterContent=chapterContent.substring(chapterContent.indexOf("<"));
27                       }
28               }
29               if(chapterContent.indexOf("<")==0){
30                   localString=localString.concat(chapterContent.substring(0, chapterContent.indexOf(">")+1));
31                   chapterContent=chapterContent.substring(chapterContent.indexOf(">")+1);
32               }
33               if(chapterContent.indexOf("<")!=-1){
34                   localString=localString.concat(getLocalString(searchString,chapterContent));
35                   }
36               
37               
38           return localString;
39       }
40       
41   }
TestPDFExport.java
25   public class TestPDFExport {
26  
27       /**
28        * @param args
29        */
30       public static void main(String[] args) {
31           ResiIO io = ResiIOFactory.getInstance().getIOProvider();
32           String testReview = "/home/jojo/TestReview (guter Test).rev";
33  
34           try {
35               Data.getInstance().getAppData().initialize();
36  
37               Application.getInstance().getApplicationCtl()
38                       .loadReview(testReview);
39               
40               Data.getInstance().getAppData().setSetting(
41                       AppSettingKey.PDF_PROTOCOL_FOOT_TEXT,
42                       "(c) 2009 by Universität Stuttgart, Abteilung SE");
43               Data.getInstance().getAppData().setSetting(
44                       AppSettingKey.PDF_PROTOCOL_LOGO,
45                       "/home/jojo/se_logo_mit_uni.gif.jpeg");
46               
47               Data.getInstance().getAppData().setSetting(
48                       AppSettingKey.PDF_INVITATION_FOOT_TEXT,
49                       "(c) 2009 by Universität Stuttgart, Abteilung SE");
50               Data.getInstance().getAppData().setSetting(
51                       AppSettingKey.PDF_INVITATION_LOGO,
52                       "/home/jojo/se_logo_mit_uni.gif.jpeg");
53           } catch (Exception e) {
54               e.printStackTrace();
55           }
56  
57           try {
58               /*
59               ProtocolPDFExporter exporter = new ReviewProtocolPDFExporter(
60                       "/home/jojo/REVIEW_PROT.pdf", true, true, true);
61               exporter.writeToFile();
62  
63               exporter = new MeetingProtocolPDFExporter(
64                       "/home/jojo/MEETING_PROT.pdf", Data.getInstance().getResiData()
65                               .getReview().getMeetings().get(0), true, true, true);
66               exporter.writeToFile();
67  
68               Desktop.getDesktop().open(new File("/home/jojo/REVIEW_PROT.pdf"));
69               Desktop.getDesktop().open(new File("/home/jojo/MEETING_PROT.pdf"));
70               */
71               
72               /*
73               InvitationPDFExporter invExp = new InvitationPDFExporter("/home/jojo/INVITATION.pdf", Data.getInstance().getResiData()
74                       .getReview().getMeetings().get(1), Data.getInstance().getResiData()
75                       .getReview().getAttendees().get(2), true);
76               invExp.writeToFile();
77  
78               Desktop.getDesktop().open(new File("/home/jojo/INVITATION.pdf"));
79               */
80               
81               /*
82               InvitationZIPExporter invExp = new InvitationZIPExporter("/home/jojo/INVITATION.zip", Data.getInstance().getResiData()
83                       .getReview().getMeetings().get(1), Data.getInstance().getResiData()
84                       .getReview().getAttendees().get(2), true);
85               invExp.writeToFile();
86               */
87               
88               InvitationDirExporter invExp = new InvitationDirExporter("/home/jojo/INVITATION_DIR", Data.getInstance().getResiData()
89                       .getReview().getMeetings().get(1), Data.getInstance().getResiData()
90                       .getReview().getAttendees().get(2), true);
91               invExp.writeDir();
92           } catch (Exception e) {
93               e.printStackTrace();
94           }
95  
96       }
97  
98   }
TestManagement.java
14   public class TestManagement {
15  
16       public static void main(String[] args) {
17           
18           Data.getInstance().getResiData().setReview(new Review());
19           
20           Application.getInstance().getReviewMgmt().setReviewName("TEST");
21           
22           System.out.println(Application.getInstance().getReviewMgmt().getReviewName());
23           
24           //for (String element : List) {
25               
26           }
27       }
TestMainFrame.java
20   public class TestMainFrame {
21  
22       public static void main(String[] args) {
23           //UI.getInstance().setMode(UI.Mode.MODERATOR);
24  
25           List<HintItem> test = new ArrayList<HintItem>();
26  
27           test.add(new HintItem("Bitte Name des Reviews eintragen! Bitte Name des Reviews eintragen! Bitte Name des Reviews eintragen! Bitte Name des Reviews eintragen! Bitte Name des Reviews eintragen! Bitte Name des Reviews eintragen! Bitte Name des Reviews eintragen! Bitte Name des Reviews eintragen! ",
28                   HintItem.ERROR, "example", "test"));
29           test.add(new HintItem("Ein weiterer Eintrag", HintItem.WARNING, "review_management"));
30           test.add(new HintItem("Ein weiterer Eintrag", HintItem.WARNING));
31           
32           UI.getInstance().getMainFrame().setHints(test);
33  
34           UI.getInstance().getMainFrame().toggleHints();
35  
36           UI.getInstance().getMainFrame().setStatusMessage("Review-Datei wird geladen...", true);
37           
38           UI.getInstance().getMainFrame().setVisible(true);
39           
40           UI.getInstance().getMainFrame().setHints(null);
41       }
42       
43   }
TestHelpData.java
6   public class TestHelpData {
7  
8       public static void main(String[] args) {
9           
10           try {
11               for (String chapterId: Data.getInstance().getHelpData().getChapters()) {
12                   System.out.println(Data.getInstance().getHelpData().getChapterTitle(chapterId));
13                   System.out.println("=========================================");
14                   System.out.println(Data.getInstance().getHelpData().getChapterContent(chapterId));
15                   System.out.println("...\n...\n...\n");
16                   System.out.println(System.getProperty("file.encoding"));
17               }
18           } catch (DataException e) {
19               System.err.println("FEHLER: " + e.getMessage());
20           }
21           
22       }
23       
24   }
TestGui.java
8   public class TestGui {
9  
10       /**
11        * @param args
12        */
13       public static void main(String[] args) {
14           
15           //org.revager.gui.UI.getInstance().getHelpBrowserFrame();
16           //org.revager.gui.UI.getInstance().getMainFrame();
17           org.revager.gui.UI.getInstance().getAssistantDialog().setVisible(true);
18           //org.revager.gui.UI.getInstance().getAssistantDialog();
19           //UI.getInstance().getEditProductDialog().setVisible(true);
20           //UI.getInstance().getManageSeveritiesDialog().setVisible(true);
21           //UI.getInstance().getEditMeetingDialog().setVisible(true);
22           //UI.getInstance().getEditAttendeeDialog().setVisible(true);
23           
24       }    
25  
26   }
TestDialog1.java
22   @SuppressWarnings("serial")
23   public class TestDialog1 extends AbstractDialog {
24  
25       public TestDialog1(Frame parent) {
26           super(parent);
27  
28           setTitle("Ein Test-Dialog");
29           setDescription("Dies ist eine Testbeschreibung. "
30                   + "Hier wird beschrieben, "
31                   + "was der Benutzer in diesem Dialog tun kann. "
32                   + "Und noch ein bisschen Text.");
33           setIcon(Data.getInstance().getIcon("assistantDialog_64x64.png"));
34  
35           GridLayout gridLay = new GridLayout(2, 2);
36           getContentPane().setLayout(gridLay);
37  
38           addButton(new JButton("Bestätigen"));
39           addButton(new JButton("Abbrechen"));
40  
41           add(new JButton("Ein einfacher Button..."));
42           add(new JButton("Ein einfacher Button..."));
43  
44           JButton buttonTest2 = new JButton("Test");
45           buttonTest2.addActionListener(new ActionListener() {
46               @Override
47               public void actionPerformed(ActionEvent e) {
48                   setMessage("Dies ist eine Meldung...");
49                   switchToProgressMode();
50               }
51           });
52           add(buttonTest2);
53  
54           JButton buttonTest = new JButton("Test");
55           buttonTest.addActionListener(new ActionListener() {
56               @Override
57               public void actionPerformed(ActionEvent e) {
58                   setHint("Bitte geben Sie einen gültigen Wert ein.");
59               }
60           });
61           add(buttonTest);
62  
63           // setHelpChapter("example");
64           setHelpChapter("example", "test");
65  
66           setMinimumSize(new Dimension(600, 600));
67           setSize(new Dimension(650, 650));
68           setLocationToCenter();
69       }
70  
71       public static void main(String[] args) {
72           new TestDialog1(UI.getInstance().getMainFrame()).setVisible(true);
73       }
74  
75   }
TestDayPicker.java
23   public class TestDayPicker {
24  
25       public static void main(String argv[]) {
26           System.out
27                   .println("Usage: java -jar DatePacker.jar [ISO Language Code, e.g. de]");
28           final JFrame frame = new JFrame("Test Date Picker");
29           frame.getContentPane().setLayout(new FlowLayout());
30           frame.setSize(300, 150);
31           Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
32           frame.setLocation((int) (dim.getWidth() - frame.getWidth()) / 2,
33                   (int) (dim.getHeight() - frame.getHeight()) / 2);
34           frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
35  
36           // create a text-field that implements Observer
37           final ObservingTextField textField = new ObservingTextField();
38           textField.setColumns(10);
39           textField.setText("");
40           textField.setToolTipText("This is a text field that implments Observer interface.");
41           frame.getContentPane().add(textField);
42  
43           // create a button
44           String lang = null;
45           if (argv.length > 0)
46               lang = argv[0];
47           final JButton btn = new JButton("Pick Date");
48           frame.getContentPane().add(btn);
49           btn.addActionListener(new ActionListener() {
50               public void actionPerformed(ActionEvent e) {
51                   // instantiate the DatePicker
52                   DatePicker dp = new DatePicker(frame, textField);
53                   // previously selected date
54                   Date selectedDate = dp.parseDate(textField.getText());
55                   dp.setSelectedDate(selectedDate);
56                   dp.start(textField);
57               };
58           });
59           frame.setVisible(true);
60       }
61   }
TestDayPicker.java
63   @SuppressWarnings("serial")
64   class ObservingTextField extends JTextField implements Observer {
65       public void update(Observable o, Object arg) {
66           Calendar calendar = (Calendar) arg;
67           DatePicker dp = (DatePicker) o;
68           System.out.println("picked=" + dp.formatDate(calendar));
69           setText(dp.formatDate(calendar));
70       }
71   }
TestCSVExport.java
19   public class TestCSVExport {
20  
21       /**
22        * @param args
23        * @throws DataException
24        * @throws ExportException
25        */
26       public static void main(String[] args) throws DataException, ExportException {
27           String testReview = "/home/jojo/TestReview (guter Test).rev";
28  
29           try {
30               Data.getInstance().getAppData().initialize();
31  
32               Application.getInstance().getApplicationCtl()
33                       .loadReview(testReview);
34           } catch (Exception e) {
35               e.printStackTrace();
36           }
37  
38           Map<String, String> sevMap = new HashMap<String, String>();
39           sevMap.put("Hauptfehler", "major");
40  
41           FindingsCSVExporter exp = new FindingsCSVExporter(Data.getInstance()
42                   .getAppData().getCSVProfile("Trac"), sevMap, Data.getInstance()
43                   .getResiData().getReview().getMeetings().get(0).getProtocol()
44                   .getFindings(), "Johannes Wettinger");
45           
46           exp.writeToFile("/home/jojo/FINDINGS_TEST.csv");
47       }
48  
49   }
TestAttendeeTableModel.java
24   public class TestAttendeeTableModel {
25       
26       public static List<Aspects>    aspectsList = new ArrayList<Aspects>();
27   //    private static AspectsIds aspectsIds;
28       private static InvitationsTableModel tableModel= new InvitationsTableModel();
29       
30       public static void main(String argv[]) {
31           Data.getInstance().getResiData().clearReview();
32           Data.getInstance().getResiData().getReview().getAttendees();
33           Attendee att1=new Attendee();
34           att1.setContact("contact1");
35           att1.setId("1");
36           att1.setName("att1");
37           att1.setRole(Role.MODERATOR);
38           Data.getInstance().getResiData().getReview().getAttendees().add(att1);
39           
40           
41           
42           final Attendee att2=new Attendee();
43   //        att2.setAspects(aspectsIds);
44           att2.setContact("contact1");
45           att2.setId("2");
46           att2.setName("att2");
47           att2.setRole(Role.REVIEWER);
48           Data.getInstance().getResiData().getReview().getAttendees().add(att2);
49           
50           JButton test = new JButton("Test");
51           test.addActionListener(new ActionListener(){
52  
53               @Override
54               public void actionPerformed(ActionEvent arg0) {
55  
56                   att2.setContact("contact3");
57                   att2.setId("2");
58                   att2.setName("att3");
59                   att2.setRole(Role.REVIEWER);
60                   tableModel.fireTableDataChanged();
61  
62               }
63               
64           });
65           JTable testTable=new JTable(tableModel);
66           JDialog testDialog = new JDialog();
67           testDialog.setLayout(new BorderLayout());
68           testDialog.add(testTable,BorderLayout.NORTH);
69           testDialog.add(test,BorderLayout.SOUTH);
70           testDialog.pack();
71           testDialog.setVisible(true);
72           testDialog.setSize(500, 500);
73           
74  
75       }
76       
77  
78   }
TestAttendeeMgmt.java
12   public class TestAttendeeMgmt {
13       public static void main(String[] args) {
14           List<Attendee> test =new ArrayList<Attendee>();
15  
16           Data.getInstance().getResiData().setReview(new Review());
17           Data.getInstance().getResiData().getReview().getAttendees();
18           for(int index=0;index<10;index++){
19               Attendee localAttendee=new Attendee();
20               localAttendee.setName(String.valueOf(index));
21               Application.getInstance().getAttendeeMgmt().addAttendee(localAttendee);
22           }
23           
24           System.out.println(Application.getInstance().getAttendeeMgmt().getAttendees());
25           
26       /*    Application.getInstance().getAttendeeMgmt().removeAttendee(String.valueOf(3));
27           System.out.println(Application.getInstance().getAttendeeMgmt().getSeverities());
28           Application.getInstance().getAttendeeMgmt().editAttendee(String.valueOf(5),String.valueOf(10));
29           System.out.println(Application.getInstance().getAttendeeMgmt().getSeverities());
30           System.out.println(Application.getInstance().getAttendeeMgmt().getNumberOfSevs());
31           Application.getInstance().getAttendeeMgmt().pushUpAttendee(String.valueOf(1));
32           System.out.println(Application.getInstance().getAttendeeMgmt().getSeverities());
33           Application.getInstance().getAttendeeMgmt().pushDownAttendee(String.valueOf(7));
34           System.out.println(Application.getInstance().getAttendeeMgmt().getSeverities());
35           Application.getInstance().getAttendeeMgmt().pushDownAttendee(String.valueOf(7));
36           System.out.println(Application.getInstance().getAttendeeMgmt().getSeverities());
37           Application.getInstance().getAttendeeMgmt().pushTopAttendee(String.valueOf(8));
38           System.out.println(Application.getInstance().getAttendeeMgmt().getSeverities());
39           Application.getInstance().getAttendeeMgmt().pushBottomAttendee(String.valueOf(0));
40           System.out.println(Application.getInstance().getAttendeeMgmt().getSeverities());
41           System.out.println(Application.getInstance().getAttendeeMgmt().isBottomAttendee(String.valueOf(0)));
42           System.out.println(Application.getInstance().getAttendeeMgmt().isBottomAttendee(String.valueOf(7)));
43           System.out.println(Application.getInstance().getAttendeeMgmt().isTopAttendee(String.valueOf(1)));
44           System.out.println(Application.getInstance().getAttendeeMgmt().isTopAttendee(String.valueOf(8)));
45       */
46           
47       }
48   }
TestAttendeeGeneral.java
8   public class TestAttendeeGeneral {
9  
10       /**
11        * @param args
12        */
13       public static void main(String[] args) {
14           JComboBox roleBox = new JComboBox();
15           roleBox.addItem("Moderator");
16           roleBox.setSelectedItem("Moderator");
17           System.out.print(roleBox.getSelectedItem().toString());
18           Role roll=Role.fromValue("moderator");
19       }
20  
21   }
PageNumbersWatermark.java
34   public class PageNumbersWatermark extends PdfPageEventHelper {
35       /** The headertable. */
36       public PdfPTable table;
37       /** A template that will hold the total number of pages. */
38       public PdfTemplate tpl;
39       /** The font that will be used. */
40       public BaseFont helv;
41  
42       /**
43        * Generates a document with a header containing Page x of y and with a
44        * Watermark on every page.
45        *
46        * @param args
47        *            no arguments needed
48        */
49       public static void main(String args[]) {
50           try {
51               Document doc = new Document(PageSize.A4, 50, 50, 100, 72);
52               PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(
53                       "/home/jojo/TEST_pageNumbersWatermark.pdf"));
54               writer.setPageEvent(new PageNumbersWatermark());
55               doc.open();
56               
57               String text = "some padding text ";
58               for (int k = 0; k < 10; ++k)
59                   text += text;
60               Paragraph p = new Paragraph(text);
61               p.setAlignment(Element.ALIGN_JUSTIFIED);
62               doc.add(p);
63  
64               doc.close();
65               
66               Desktop.getDesktop().open(new File("/home/jojo/TEST_pageNumbersWatermark.pdf"));
67           } catch (Exception e) {
68               e.printStackTrace();
69           }
70       }
71  
72       /**
73        * @see com.lowagie.text.pdf.PdfPageEventHelper#onOpenDocument(com.lowagie.text.pdf.PdfWriter,
74        *      com.lowagie.text.Document)
75        */
76       public void onOpenDocument(PdfWriter writer, Document document) {
77           try {
78               // initialization of the template
79               tpl = writer.getDirectContent().createTemplate(100, 100);
80               
81               // initialization of the font
82               helv = BaseFont.createFont("Helvetica", BaseFont.WINANSI, false);
83           } catch (Exception e) {
84               throw new ExceptionConverter(e);
85           }
86       }
87  
88       /**
89        * @see com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter,
90        *      com.lowagie.text.Document)
91        */
92       public void onEndPage(PdfWriter writer, Document document) {
93           PdfContentByte cb = writer.getDirectContent();
94           cb.saveState();
95           // compose the footer
96           String text = "Page " + writer.getPageNumber() + " of ";
97           float textSize = helv.getWidthPoint(text, 12);
98           float textBase = document.bottom() - 20;
99           cb.beginText();
100           cb.setFontAndSize(helv, 12);
101           // for odd pagenumbers, show the footer at the left
102  
103           cb.setTextMatrix(document.left(), textBase);
104           cb.showText(text);
105           cb.endText();
106           cb.addTemplate(tpl, document.left() + textSize, textBase);
107       }
108  
109       /**
110        * @see com.lowagie.text.pdf.PdfPageEventHelper#onCloseDocument(com.lowagie.text.pdf.PdfWriter,
111        *      com.lowagie.text.Document)
112        */
113       public void onCloseDocument(PdfWriter writer, Document document) {
114           tpl.beginText();
115           tpl.setFontAndSize(helv, 12);
116           tpl.setTextMatrix(0, 0);
117           tpl.showText(Integer.toString(writer.getPageNumber() - 1));
118           tpl.endText();
119       }
120   }
HelpTest.java
3   public class HelpTest {
4  
5       /**
6        * @param args
7        */
8       public static void main(String[] args) {
9           org.revager.gui.UI.getInstance().getHelpBrowserFrame().setVisible(true);
10  
11       }
12  
13   }
GeneralTest.java
26   public class GeneralTest {
27  
28       /**
29        * @param args
30        * @throws IOException
31        */
32       public static void main(String[] args) {
33  
34           
35  
36           if (args.length >= 2) {
37               if (args[0].equals("-data".trim())) {
38                   Data.getInstance().getAppData().setCustomAppDataDirectory(
39                           args[1].trim());
40                   System.out.println(args[1].trim());
41               }
42           }
43           
44           /*
45           try {
46               List<File> list = FileTools.getListOfFiles(new File("/home/jojo"));
47           
48               FileTools.writeToZip(list, new File("/home/jojo/TEST.zip"));
49           
50               new File("/home/jojo/TTT---").mkdir();
51           
52               FileTools.extractZipFile(new File("/home/jojo/TEST.zip"), new File("/home/jojo/TTT---"));
53           } catch (IOException e) {
54               // TODO Auto-generated catch block
55               e.printStackTrace();
56           }
57           */
58           
59           /*
60           try {
61               Data.getInstance().getAppData().initialize();
62               
63               Application.getInstance().getApplicationCtl().loadReview("/home/jojo/TestReviewNEW.zip");
64               
65               Application.getInstance().getFindingMgmt().addExtReference(new File("/home/jojo/dpkg.list"), Application.getInstance().getMeetingMgmt().getMeetings().get(0).getProtocol().getFindings().get(0));
66               Application.getInstance().getFindingMgmt().addExtReference(new File("/home/jojo/dpkg.list"), Application.getInstance().getMeetingMgmt().getMeetings().get(0).getProtocol().getFindings().get(0));
67               Application.getInstance().getFindingMgmt().addExtReference(new File("/home/jojo/review.xml"), Application.getInstance().getMeetingMgmt().getMeetings().get(0).getProtocol().getFindings().get(0));
68               
69               Application.getInstance().getApplicationCtl().storeReview("/home/jojo/TestReviewNEW.zip");
70               
71               Application.getInstance().getApplicationCtl().clearReview();
72           } catch (Exception e) {
73               // TODO Auto-generated catch block
74               e.printStackTrace();
75           }
76           */
77           
78           /*
79           try {
80               URI abs = new URI("file", null, "/home/jojo/", null);
81               URI file = new URI("file:///home/jojo/rev%20Ätest.xml");
82               URI rel = new URI(null, null,"rev ätest.xml", null);
83               
84               
85               
86               System.out.println(abs.resolve(rel));
87               new File(abs.resolve(rel)).createNewFile();
88               
89               System.out.println(file);
90               System.out.println(file.toURL());
91               new File(file).createNewFile();
92           } catch (URISyntaxException e) {
93               // TODO Auto-generated catch block
94               e.printStackTrace();
95           }
96           */
97           
98           /*
99           try {
100               Data.getInstance().getAppData().initialize();
101               
102               
103               
104               JFileChooser chooser = new JFileChooser();
105               chooser.showOpenDialog(UI.getInstance().getMainFrame());
106               System.out.println(chooser.getSelectedFile().getAbsolutePath());
107           
108               Application.getInstance().getApplicationCtl().loadReview(chooser.getSelectedFile().getAbsolutePath());
109               Application.getInstance().getApplicationCtl().storeReview(chooser.getSelectedFile().getAbsolutePath());
110  
111               System.out.println(Data.getInstance().getResiData().getReview().getName() + "\n");
112               
113               
114               
115               FileDialog dialog = new FileDialog(UI.getInstance().getMainFrame());
116               dialog.setVisible(true);
117               System.out.println(dialog.getDirectory() + dialog.getFile());
118               
119               Application.getInstance().getApplicationCtl().clearReview();
120               
121               Application.getInstance().getApplicationCtl().loadReview(dialog.getDirectory() + dialog.getFile());
122               Application.getInstance().getApplicationCtl().storeReview(dialog.getDirectory() + dialog.getFile());
123               
124               System.out.println(Data.getInstance().getResiData().getReview().getName() + "\n");
125           } catch (Exception e) {
126               // TODO Auto-generated catch block
127               e.printStackTrace();
128           }
129           */
130           
131           /*
132           MainFrame mf = UI.getInstance().getMainFrame();
133           FileChooser fc = UI.getInstance().getFileChooser();
134           
135           int dRet;
136           
137           dRet = fc.showDialog(mf, FileChooser.MODE_OPEN_FILE, ResiFileFilter.TYPE_REVIEW);
138           System.out.println("BUTTON: " + dRet);
139           System.out.println("VERZ: " + fc.getDir());
140           System.out.println("DATEI: " + fc.getFile());
141           
142           dRet = fc.showDialog(mf, FileChooser.MODE_OPEN_FILE, ResiFileFilter.TYPE_REVIEW);
143           System.out.println("BUTTON: " + dRet);
144           System.out.println("VERZ: " + fc.getDir());
145           System.out.println("DATEI: " + fc.getFile());
146           
147           fc.clearFile();
148           dRet = fc.showDialog(mf, FileChooser.MODE_SAVE_FILE, ResiFileFilter.TYPE_REVIEW);
149           System.out.println("BUTTON: " + dRet);
150           System.out.println("VERZ: " + fc.getDir());
151           System.out.println("DATEI: " + fc.getFile());
152           
153           dRet = fc.showDialog(mf, FileChooser.MODE_SELECT_DIRECTORY, ResiFileFilter.TYPE_REVIEW);
154           System.out.println("BUTTON: " + dRet);
155           System.out.println("VERZ: " + fc.getDir());
156           System.out.println("DATEI: " + fc.getFile());
157           
158           dRet = fc.showDialog(mf, FileChooser.MODE_OPEN_FILE, ResiFileFilter.TYPE_CSV);
159           System.out.println("BUTTON: " + dRet);
160           System.out.println("VERZ: " + fc.getDir());
161           System.out.println("DATEI: " + fc.getFile());
162           
163           dRet = fc.showDialog(mf, FileChooser.MODE_SAVE_FILE, ResiFileFilter.TYPE_ASPECTS);
164           System.out.println("BUTTON: " + dRet);
165           System.out.println("VERZ: " + fc.getDir());
166           System.out.println("DATEI: " + fc.getFile());
167           */
168           
169           System.out.println(Application.getInstance().getReviewMgmt().getExtRefFileName("reviewfile:///T%C3%A4st%20Datei.txt"));
170  
171           System.out.println(Application.getInstance().getReviewMgmt().getExtRefURI("Täst Datei.txt"));
172       }
173   }
EndPage.java
30   public class EndPage extends PdfPageEventHelper {
31      
32       /**
33        * Demonstrates the use of PageEvents.
34        * @param args no arguments needed
35        */
36       public static void main(String[] args)
37       {
38           Document document = new Document(PageSize.A4, 50, 50, 70, 70);
39           try {
40               PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("/home/jojo/TEST_endpage.pdf"));
41               writer.setPageEvent(new EndPage());
42               document.open();
43               String text = "Lots of text. ";
44               for (int k = 0; k < 10; ++k)
45                   text += text;
46               document.add(new Paragraph(text));
47               document.close();
48           }
49           catch (Exception de) {
50               de.printStackTrace();
51           }
52       }
53      
54       /**
55        * @see com.lowagie.text.pdf.PdfPageEventHelper#onEndPage(com.lowagie.text.pdf.PdfWriter, com.lowagie.text.Document)
56        */
57       public void onEndPage(PdfWriter writer, Document document) {
58           try {
59               Rectangle page = document.getPageSize();
60               PdfPTable head = new PdfPTable(3);
61               for (int k = 1; k <= 6; ++k)
62                   head.addCell("head " + k);
63               head.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
64               head.writeSelectedRows(0, -1, document.leftMargin(), page.getHeight() - document.topMargin() + head.getTotalHeight(),
65                   writer.getDirectContent());
66               PdfPTable foot = new PdfPTable(3);
67               for (int k = 1; k <= 6; ++k)
68                   foot.addCell("foot " + k);
69               foot.setTotalWidth(page.getWidth() - document.leftMargin() - document.rightMargin());
70               foot.writeSelectedRows(0, -1, document.leftMargin(), document.bottomMargin(),
71                   writer.getDirectContent());
72           }
73           catch (Exception e) {
74               throw new ExceptionConverter(e);
75           }
76       }
77  
78   }
CheckNodeTreeExample.java
52   public class CheckNodeTreeExample extends JFrame {
53    
54       private ApplicationData appData = Data.getInstance().getAppData();
55       
56     public CheckNodeTreeExample() {
57       super("CheckNode TreeExample");
58      
59       /*
60       String[] strs = {"swing",     // 0
61            "platf",     // 1
62            "basic",     // 2
63            "metal",     // 3
64            "JTree"};    // 4
65                                               
66       CheckNode[] nodes = new CheckNode[strs.length];
67       for (int i=0;i<strs.length;i++) {
68         nodes[i] = new CheckNode(strs[i]);
69       }
70       nodes[0].add(nodes[1]);
71       nodes[1].add(nodes[2]);
72       nodes[1].add(nodes[3]);
73       nodes[0].add(nodes[4]);
74       nodes[3].setSelected(true);
75      
76       JTree tree = new JTree( nodes[0] );
77       */
78     
79       try {
80           appData.initialize();
81      
82           AppCatalog catalog = appData.newCatalog("Testkatalog 1");
83           
84           catalog.newAspect("Direktive", "Beschr-", "TestKategore");
85       } catch (Exception e) {
86           e.printStackTrace();
87       }
88      
89      
90      
91       CheckNode root = new CheckNode("Fragenkataloge");
92      
93       try {
94       for (AppCatalog ac : appData.getCatalogs()) {
95           CheckNode catalog = new CheckNode(ac);
96           
97           root.add(catalog);
98           
99           for (String cat : ac.getCategories()) {
100               CheckNode category = new CheckNode(cat);
101               
102               catalog.add(category);
103               
104               for (AppAspect asp : ac.getAspects(cat)) {
105                   CheckNode aspect = new CheckNode(asp);
106                   
107                   category.add(aspect);
108               }
109           }
110       }
111       } catch (Exception e) {
112           // TODO JoptionPane Fehlermeldung
113       }
114      
115       JTree tree = new JTree( root );
116      
117       tree.setCellRenderer(new CheckRenderer());
118       tree.getSelectionModel().setSelectionMode(
119         TreeSelectionModel.SINGLE_TREE_SELECTION
120       );
121       tree.addMouseListener(new NodeSelectionListener(tree));
122       JScrollPane sp = new JScrollPane(tree);
123        
124       getContentPane().add(sp,    BorderLayout.CENTER);
125     }
126  
127    
CheckNodeTreeExample.java
180     }
181  
182    
183     public static void main(String args[]) {
184       CheckNodeTreeExample frame = new CheckNodeTreeExample();
185       frame.addWindowListener(new WindowAdapter() {
186         public void windowClosing(WindowEvent e) {
187           System.exit(0);
188         }
189       });
190       frame.setSize(300, 200);
191       frame.setVisible(true);
192     }
193   }
CheckNodeTreeExample.java
195   class CheckRenderer extends JPanel implements TreeCellRenderer {
196     protected JCheckBox check;
197  
198     protected TreeLabel label;
199  
200     public CheckRenderer() {
201       setLayout(null);
202       check = new JCheckBox();
203       add(check);
204       label = new TreeLabel();
205       add(label);
206       check.setBackground(UIManager.getColor("Tree.textBackground"));
207       label.setForeground(UIManager.getColor("Tree.textForeground"));
208     }
209  
210     public Component getTreeCellRendererComponent(JTree tree, Object value,
211         boolean isSelected, boolean expanded, boolean leaf, int row,
212         boolean hasFocus) {
213       String stringValue = tree.convertValueToText(value, isSelected,
214           expanded, leaf, row, hasFocus);
215       setEnabled(tree.isEnabled());
216       check.setSelected(((CheckNode) value).isSelected());
217       label.setFont(tree.getFont());
218       label.setText(stringValue);
219       label.setSelected(isSelected);
220       label.setFocus(hasFocus);
221       if (leaf) {
222         label.setIcon(UIManager.getIcon("Tree.leafIcon"));
223       } else if (expanded) {
224         label.setIcon(UIManager.getIcon("Tree.openIcon"));
225       } else {
226         label.setIcon(UIManager.getIcon("Tree.closedIcon"));
227       }
228       return this;
229     }
230  
231     public Dimension getPreferredSize() {
232       Dimension d_check = check.getPreferredSize();
233       Dimension d_label = label.getPreferredSize();
234       return new Dimension(d_check.width + d_label.width,
235           (d_check.height < d_label.height ? d_label.height
236               : d_check.height));
237     }
238  
239     public void doLayout() {
240       Dimension d_check = check.getPreferredSize();
241       Dimension d_label = label.getPreferredSize();
242       int y_check = 0;
243       int y_label = 0;
244       if (d_check.height < d_label.height) {
245         y_check = (d_label.height - d_check.height) / 2;
246       } else {
247         y_label = (d_check.height - d_label.height) / 2;
248       }
249       check.setLocation(0, y_check);
250       check.setBounds(0, y_check, d_check.width, d_check.height);
251       label.setLocation(d_check.width, y_label);
252       label.setBounds(d_check.width, y_label, d_label.width, d_label.height);
253     }
254  
255     public void setBackground(Color color) {
256       if (color instanceof ColorUIResource)
257         color = null;
258       super.setBackground(color);
259     }
260  
261    
CheckNodeTreeExample.java
321     }
322   }
CheckNodeTreeExample.java
324   class CheckNode extends DefaultMutableTreeNode {
325  
326     protected boolean isSelected;
327  
328     public CheckNode() {
329       this(null);
330     }
331  
332     public CheckNode(Object userObject) {
333       this(userObject, true, false);
334     }
335  
336     public CheckNode(Object userObject, boolean allowsChildren,
337         boolean isSelected) {
338       super(userObject, allowsChildren);
339       this.isSelected = isSelected;
340     }
341  
342     public void setSelected(boolean isSelected) {
343       this.isSelected = isSelected;
344  
345       if (children != null) {
346         Enumeration<Object> e = children.elements();
347         //Iterator<Object> e1 = children.iterator();
348         while (e.hasMoreElements()) {
349           CheckNode node = (CheckNode) e.nextElement();
350           node.setSelected(isSelected);
351         }
352       }
353     }
354  
355     public boolean isSelected() {
356       return isSelected;
357     }
358  
359     // If you want to change "isSelected" by CellEditor,
360     /*
361      public void setUserObject(Object obj) { if (obj instanceof Boolean) {
362      setSelected(((Boolean)obj).booleanValue()); } else {
363      super.setUserObject(obj); } }
364     */
365  
366   }
ResiIOTest.java
46   public class ResiIOTest {
47  
48       private static ResiIO io;
49  
50       private static ResiData resiData = Data.getInstance().getResiData();
51  
52       private static String testDirectory = "org/revager/test/testdata/";
53  
54       private static String outputXML = testDirectory + "output.xml";
55  
56       private static String reviewExample = testDirectory
57               + "Resi Review Example.xml";
58       private static String reviewExampleIncomplete = testDirectory
59               + "Resi Review Example incomplete.xml";
60       private static String reviewExampleIncorrect = testDirectory
61               + "Resi Review Example incorrect.xml";
62  
63       private static String catalogExample = testDirectory
64               + "Resi Catalog Example.xml";
65       private static String catalogExampleIncorrect = testDirectory
66               + "Resi Catalog Example incorrect.xml";
67  
68       private static String aspectsExample = testDirectory
69               + "Resi Aspects Example.xml";
70       private static String aspectsExampleIncorrect = testDirectory
71               + "Resi Aspects Example incorrect.xml";
72  
73       @BeforeClass
74       public static void setUp() throws DataException {
75           Data.getInstance().getAppData()
76                   .setCustomAppDataDirectory(testDirectory);
77  
78           Data.getInstance().getAppData().resetDatabase();
79  
80           Data.getInstance().getAppData().initialize();
81       }
82  
83       @Test
84       public void loadIOProvider() {
85           io = ResiIOFactory.getInstance().getIOProvider();
86       }
87  
88       @Test
89       public void loadCompleteReview() throws ResiIOException {
90           io.loadReview(reviewExample);
91  
92           /*
93            * Check some values of the example
94            */
95           assertEquals("Review der Spezifikation XYZ", resiData.getReview()
96                   .getName());
97           assertEquals(
98                   "Es wird die Spezifikation XYZ des Projekts ABC begutachtet.",
99                   resiData.getReview().getDescription());
100           assertEquals("Spezifikation XYZ", resiData.getReview().getProduct()
101                   .getName());
102  
103           /*
104            * Check if path is ok
105            */
106           assertEquals(reviewExample, resiData.getReviewPath());
107       }
108  
109       @Test
110       public void storeCompleteReview() throws ResiIOException {
111           io.loadReview(reviewExample);
112  
113           resiData.getReview().setName("Test Output");
114  
115           io.storeReview(outputXML);
116  
117           /*
118            * Check if storing the review was ok
119            */
120           io.loadReview(outputXML);
121  
122           assertEquals("Test Output", resiData.getReview().getName());
123           assertEquals(
124                   "Es wird die Spezifikation XYZ des Projekts ABC begutachtet.",
125                   resiData.getReview().getDescription());
126           assertEquals("Spezifikation XYZ", resiData.getReview().getProduct()
127                   .getName());
128       }
129  
130       @Test(expected = ResiIOException.class)
131       public void loadIncompleteReview() throws ResiIOException {
132           io.loadReview(reviewExampleIncomplete);
133       }
134  
135       @Test(expected = ResiIOException.class)
136       public void storeIncompleteReview() throws ResiIOException {
137           io.loadReview(reviewExample);
138  
139           resiData.getReview().setName(null);
140  
141           io.storeReview(outputXML);
142       }
143  
144       @Test(expected = ResiIOException.class)
145       public void loadIncorrectReview() throws ResiIOException {
146           io.loadReview(reviewExampleIncorrect);
147       }
148  
149       @Test(expected = ResiIOException.class)
150       public void loadReviewAsBackupWithoutBackupedBefore()
151               throws ResiIOException {
152           io.loadReviewBackup();
153       }
154  
155       @Test
156       public void storeAndLoadCompleteReviewAsBackup() throws ResiIOException {
157           io.loadReview(reviewExample);
158  
159           io.storeReviewBackup();
160  
161           /*
162            * Reset ResiData model
163            */
164           resiData.setReview(null);
165           resiData.setReviewPath(null);
166  
167           io.loadReviewBackup();
168  
169           assertEquals(reviewExample, resiData.getReviewPath());
170           assertEquals("Review der Spezifikation XYZ", resiData.getReview()
171                   .getName());
172           assertEquals("Spezifikation XYZ", resiData.getReview().getProduct()
173                   .getName());
174       }
175  
176       @Test
177       public void storeAndLoadIncompleteReviewAsBackup() throws ResiIOException {
178           io.loadReview(reviewExample);
179  
180           resiData.getReview().setName(null);
181  
182           io.storeReviewBackup();
183  
184           /*
185            * Reset ResiData model
186            */
187           resiData.setReview(null);
188           resiData.setReviewPath(null);
189  
190           io.loadReviewBackup();
191  
192           assertEquals(reviewExample, resiData.getReviewPath());
193           assertEquals(null, resiData.getReview().getName());
194           assertEquals("Spezifikation XYZ", resiData.getReview().getProduct()
195                   .getName());
196       }
197  
198       @Test
199       public void storeAndLoadNearlyEmptyReviewAsBackup() throws ResiIOException {
200           /*
201            * Reset ResiData model
202            */
203           resiData.setReview(new Review());
204           resiData.setReviewPath(null);
205  
206           resiData.getReview().setName("Fast leeres Review");
207  
208           io.storeReviewBackup();
209  
210           /*
211            * Reset ResiData model
212            */
213           resiData.setReview(null);
214           resiData.setReviewPath(null);
215  
216           io.loadReviewBackup();
217  
218           assertEquals("", resiData.getReviewPath());
219           assertEquals("Fast leeres Review", resiData.getReview().getName());
220       }
221  
222       @Test
223       public void loadCatalog() throws ResiIOException {
224           io.loadCatalog(catalogExample);
225  
226           assertEquals(catalogExample, resiData.getCatalogPath());
227           assertEquals("Rules of Software Project Management", resiData
228                   .getCatalog().getDescription());
229       }
230  
231       @Test(expected = ResiIOException.class)
232       public void loadIncorrectCatalog() throws ResiIOException {
233           io.loadCatalog(catalogExampleIncorrect);
234       }
235  
236       @Test
237       public void modifyAndStoreCatalog() throws ResiIOException {
238           /*
239            * Reset ResiData model
240            */
241           resiData.setCatalog(null);
242           resiData.setCatalogPath(null);
243  
244           io.loadCatalog(catalogExample);
245  
246           resiData.getCatalog().setDescription(
247                   "Einige Regeln für das Projektmanagement im Softwarebereich");
248  
249           assertEquals(
250                   "Einige Regeln für das Projektmanagement im Softwarebereich",
251                   resiData.getCatalog().getDescription());
252  
253           io.storeCatalog(outputXML);
254       }
255  
256       @Test(expected = ResiIOException.class)
257       public void storeIncorrectCatalog() throws ResiIOException {
258           resiData.setCatalog(new Catalog());
259  
260           io.storeCatalog(outputXML);
261       }
262  
263       @Test
264       public void loadAspects() throws ResiIOException {
265           io.loadAspects(aspectsExample);
266  
267           assertEquals(aspectsExample, resiData.getAspectsPath());
268           assertEquals("Grafische Oberfläche", resiData.getAspects().getAspects()
269                   .get(0).getCategory());
270       }
271  
272       @Test(expected = ResiIOException.class)
273       public void loadIncorrectAspects() throws ResiIOException {
274           io.loadAspects(aspectsExampleIncorrect);
275       }
276  
277       @Test
278       public void modifyAndStoreAspects() throws ResiIOException {
279           /*
280            * Reset ResiData model
281            */
282           resiData.setAspects(null);
283           resiData.setAspectsPath(null);
284  
285           io.loadAspects(aspectsExample);
286  
287           resiData.getAspects().getAspects().get(0).setDirective(
288                   "Ist alles on Ordnung?");
289  
290           assertEquals("Ist alles on Ordnung?", resiData.getAspects()
291                   .getAspects().get(0).getDirective());
292  
293           io.storeAspects(outputXML);
294       }
295  
296       @Test(expected = ResiIOException.class)
297       public void storeIncorrectAspects() throws ResiIOException {
298           resiData.setAspects(new Aspects());
299  
300           io.storeAspects(outputXML);
301       }
302  
303       @Test(expected = ResiIOException.class)
304       public void throwExceptionWithoutMessage() throws ResiIOException {
305           throw new ResiIOException();
306       }
307  
308       @AfterClass
309       public static void cleanUp() {
310           FileTools.deleteDirectory(new File(Data.getInstance().getAppData()
311                   .getAppDataPath()));
312  
313           new File(outputXML).delete();
314       }
315  
316   }
ResiDataTest.java
36   public class ResiDataTest {
37       
38       private ResiData resiData;
39  
40       @Test
41       public void handleReview() {
42           resiData = Data.getInstance().getResiData();
43           Review exampleReview = new Review();
44           
45           assertEquals(null, resiData.getReview());
46           assertEquals(null, resiData.getReviewPath());
47           
48           resiData.setReview(exampleReview);
49           assertEquals(exampleReview, resiData.getReview());
50           
51           resiData.setReviewPath("/ein/pfad/zur review/datei.xml");
52           assertEquals("/ein/pfad/zur review/datei.xml", resiData.getReviewPath());
53           
54           resiData.clearReview();
55           
56           assertEquals(null, resiData.getReview());
57           assertEquals(null, resiData.getReviewPath());
58       }
59       
60       @Test
61       public void handleCatalog() {
62           resiData = Data.getInstance().getResiData();
63           Catalog exampleCatalog = new Catalog();
64           
65           assertEquals(null, resiData.getCatalog());
66           assertEquals(null, resiData.getCatalogPath());
67           
68           resiData.setCatalog(exampleCatalog);
69           assertEquals(exampleCatalog, resiData.getCatalog());
70           
71           resiData.setCatalogPath("/ein/pfad/zur review/datei.xml");
72           assertEquals("/ein/pfad/zur review/datei.xml", resiData.getCatalogPath());
73           
74           resiData.clearCatalog();
75           
76           assertEquals(null, resiData.getCatalog());
77           assertEquals(null, resiData.getCatalogPath());
78       }
79       
80       @Test
81       public void handleAspects() {
82           resiData = Data.getInstance().getResiData();
83           Aspects exampleAspects = new Aspects();
84           
85           assertEquals(null, resiData.getAspects());
86           assertEquals(null, resiData.getAspectsPath());
87           
88           resiData.setAspects(exampleAspects);
89           assertEquals(exampleAspects, resiData.getAspects());
90           
91           resiData.setAspectsPath("/ein/pfad/zur review/datei.xml");
92           assertEquals("/ein/pfad/zur review/datei.xml", resiData.getAspectsPath());
93           
94           resiData.clearAspects();
95           
96           assertEquals(null, resiData.getAspects());
97           assertEquals(null, resiData.getAspectsPath());
98       }
99       
100       @Test
101       public void tryToNotifyObservers() {
102           resiData = Data.getInstance().getResiData();
103           
104           resiData.fireDataChanged();
105       }
106       
107   }
ManagementTest.java
65   public class ManagementTest {
66  
67       private static String testdataDirectory = "org/revager/test/testdata/";
68  
69       private static String tempDirectory = System.getProperty("user.home")
70               + "/tmp-revager_/";
71  
72       private static String exampleReview = testdataDirectory
73               + "Review Example 2.rev";
74       private static String exampleReviewMod = testdataDirectory
75               + "Review Example 3.rev";
76  
77       private static File extRef1 = new File(testdataDirectory + "coffee.gif");
78       private static File extRef2 = new File(testdataDirectory + "smiley.png");
79       private static File extRef3 = new File(testdataDirectory + "tux.gif");
80       private static File extRef3Mod = new File(testdataDirectory + "tux1.gif");
81       private static File extRef4 = new File(testdataDirectory + "wallpaper");
82  
83       @BeforeClass
84       public static void setUp() throws DataException {
85           File tempDir = new File(tempDirectory);
86  
87           tempDir.mkdir();
88  
89           Data.getInstance().getAppData()
90                   .setCustomAppDataDirectory(tempDirectory);
91  
92           Data.getInstance().getAppData().initialize();
93       }
94  
95       @Test
96       public void manageAspects() throws ResiIOException, IOException,
97               ApplicationException {
98           ReviewManagement revMgmt = Application.getInstance().getReviewMgmt();
99           AspectManagement aspMgmt = Application.getInstance().getAspectMgmt();
100  
101           Application.getInstance().getApplicationCtl().loadReview(exampleReview);
102  
103           /*
104            * Create new unknown aspect.
105            */
106           Aspect unknownAsp = new Aspect();
107           unknownAsp.setCategory("cat");
108           unknownAsp.setDescription("desc");
109           unknownAsp.setDirective("dir");
110  
111           /*
112            * Create new test aspects.
113            */
114           Aspect testAsp1 = new Aspect();
115           testAsp1.setCategory("CATEGORY");
116           testAsp1.setDescription("DESCRIPTION");
117           testAsp1.setDirective("DIRECTIVE");
118  
119           Aspect testAsp2 = new Aspect();
120           testAsp2.setCategory("Bestimmte Kategorie");
121           testAsp2.setDescription("Irgendeine Beschreibung");
122           testAsp2.setDirective("Test-Direktive");
123  
124           Aspect testAsp3 = new Aspect();
125           testAsp3.setCategory("Kategorie");
126           testAsp3.setDescription("Beschreibung");
127           testAsp3.setDirective("Direktive");
128  
129           /*
130            * Get aspects by id and compare them.
131            */
132           for (Aspect a : aspMgmt.getAspects()) {
133               assertEquals(a, aspMgmt.getAspect(Integer.parseInt(a.getId())));
134               assertTrue(aspMgmt.isAspect(a));
135           }
136  
137           assertFalse(aspMgmt.isAspect(unknownAsp));
138  
139           assertEquals(Data.getInstance().getResiData().getReview().getAspects()
140                   .size(), revMgmt.getNumberOfAspects());
141  
142           /*
143            * Add new aspects.
144            */
145           Aspect asp1 = aspMgmt.addAspect(testAsp1);
146           Aspect asp2 = aspMgmt.addAspect(testAsp2.getDirective(), testAsp2
147                   .getDescription(), testAsp2.getCategory());
148  
149           assertTrue(aspMgmt.isAspect(testAsp1));
150           assertTrue(aspMgmt.isAspect(testAsp2));
151           assertTrue(aspMgmt.isAspect(asp1));
152           assertTrue(aspMgmt.isAspect(asp2));
153  
154           Data.getInstance().getResiData().getReview().getAttendees().get(0)
155                   .getAspects().getAspectIds().add(asp1.getId());
156  
157           /*
158            * Ensure that no duplicates can be added.
159            */
160           int numOfAsp = revMgmt.getNumberOfAspects();
161  
162           aspMgmt.addAspect(testAsp1);
163  
164           assertEquals(numOfAsp, revMgmt.getNumberOfAspects());
165  
166           /*
167            * Remove existing aspect.
168            */
169           numOfAsp = revMgmt.getNumberOfAspects();
170  
171           aspMgmt.removeAspect(asp1);
172  
173           assertEquals(numOfAsp - 1, revMgmt.getNumberOfAspects());
174  
175           /*
176            * Remove not existing aspect.
177            */
178           numOfAsp = revMgmt.getNumberOfAspects();
179  
180           aspMgmt.removeAspect(unknownAsp);
181  
182           assertEquals(numOfAsp, revMgmt.getNumberOfAspects());
183  
184           /*
185            * Edit aspects.
186            */
187           assertFalse(aspMgmt.editAspect(asp1, testAsp3));
188           assertTrue(aspMgmt.editAspect(asp2, testAsp3));
189           assertFalse(aspMgmt.editAspect(asp2, testAsp3));
190  
191           /*
192            * Push aspects.
193            */
194           asp1 = aspMgmt.addAspect(testAsp1);
195  
196           assertFalse(aspMgmt.isTopAspect(asp1));
197           assertTrue(aspMgmt.isBottomAspect(asp1));
198  
199           aspMgmt.pushTopAspect(asp1);
200  
201           assertTrue(aspMgmt.isTopAspect(asp1));
202           assertFalse(aspMgmt.isBottomAspect(asp1));
203  
204           aspMgmt.pushDownAspect(asp1);
205  
206           assertFalse(aspMgmt.isTopAspect(asp1));
207           assertFalse(aspMgmt.isBottomAspect(asp1));
208  
209           aspMgmt.pushBottomAspect(asp1);
210  
211           assertFalse(aspMgmt.isTopAspect(asp1));
212           assertTrue(aspMgmt.isBottomAspect(asp1));
213  
214           aspMgmt.pushUpAspect(asp1);
215  
216           assertFalse(aspMgmt.isTopAspect(asp1));
217           assertFalse(aspMgmt.isBottomAspect(asp1));
218       }
219  
220       @Test
221       public void manageAttendees() throws ResiIOException, IOException,
222               ApplicationException, DataException {
223           AttendeeManagement attMgmt = Application.getInstance()
224                   .getAttendeeMgmt();
225           AspectManagement aspMgmt = Application.getInstance().getAspectMgmt();
226  
227           Application.getInstance().getApplicationCtl().loadReview(exampleReview);
228  
229           /*
230            * Create new unknown attendee.
231            */
232           Attendee unknownAtt = new Attendee();
233           unknownAtt.setName("Unbekannter Teilnehmer");
234           unknownAtt.setContact("Kontakt...");
235           unknownAtt.setRole(Role.REVIEWER);
236  
237           /*
238            * Create new test attendees.
239            */
240           Attendee testAtt1 = new Attendee();
241           testAtt1.setName("Teilnehmer 1");
242           testAtt1.setContact("Kontaktdaten von Teilnehmer 1...");
243           testAtt1.setRole(Role.REVIEWER);
244  
245           Attendee testAtt2 = new Attendee();
246           testAtt2.setName("Teilnehmer 2");
247           testAtt2.setContact("Kontaktdaten von Teilnehmer 2...");
248           testAtt2.setRole(Role.REVIEWER);
249  
250           Attendee testAtt3 = new Attendee();
251           testAtt3.setName("Teilnehmer 3");
252           testAtt3.setContact("Kontaktdaten von Teilnehmer 3...");
253           testAtt3.setRole(Role.MODERATOR);
254  
255           /*
256            * Create test aspects and add them to the review
257            */
258           Aspect testAsp1 = new Aspect();
259           testAsp1.setCategory("CATEGORY");
260           testAsp1.setDescription("DESCRIPTION");
261           testAsp1.setDirective("DIRECTIVE");
262  
263           Aspect testAsp2 = new Aspect();
264           testAsp2.setCategory("Bestimmte Kategorie");
265           testAsp2.setDescription("Irgendeine Beschreibung");
266           testAsp2.setDirective("Test-Direktive");
267  
268           Aspect testAsp3 = new Aspect();
269           testAsp3.setCategory("Bestimmte Kategorie 3");
270           testAsp3.setDescription("Irgendeine Beschreibung 3");
271           testAsp3.setDirective("Test-Direktive 3");
272  
273           Aspect testAsp3Identical = new Aspect();
274           testAsp3Identical.setCategory(testAsp3.getCategory());
275           testAsp3Identical.setDescription(testAsp3.getDescription());
276           testAsp3Identical.setDirective(testAsp3.getDirective());
277  
278           Aspect asp1 = aspMgmt.addAspect(testAsp1);
279           Aspect asp2 = aspMgmt.addAspect(testAsp2);
280  
281           /*
282            * Get attendees by id and compare them.
283            */
284           for (Attendee a : attMgmt.getAttendees()) {
285               assertEquals(a, attMgmt.getAttendee(Integer.parseInt(a.getId())));
286               assertTrue(attMgmt.isAttendee(a));
287           }
288  
289           assertFalse(attMgmt.isAttendee(unknownAtt));
290  
291           assertEquals(Data.getInstance().getResiData().getReview()
292                   .getAttendees().size(), attMgmt.getNumberOfAttendees());
293  
294           /*
295            * Add attendees
296            */
297           AppAttendee appAtt = Data.getInstance().getAppData().newAttendee(
298                   testAtt1.getName(), testAtt1.getContact());
299  
300           Attendee att1 = attMgmt.addAttendee(appAtt, testAtt1.getRole(), null);
301  
302           List<Aspect> someAspects = new ArrayList<Aspect>();
303           someAspects.add(asp1);
304           someAspects.add(asp2);
305  
306           Attendee att2 = attMgmt.addAttendee(testAtt2.getName(), testAtt2
307                   .getContact(), testAtt2.getRole(), someAspects);
308  
309           assertTrue(attMgmt.isAttendee(testAtt1));
310           assertTrue(attMgmt.isAttendee(testAtt2));
311           assertTrue(attMgmt.isAttendee(att1));
312           assertTrue(attMgmt.isAttendee(att2));
313  
314           AttendeeReference ar = new AttendeeReference();
315           ar.setAttendee(att1.getId());
316           Data.getInstance().getResiData().getReview().getMeetings().get(0)
317                   .getProtocol().getAttendeeReferences().add(ar);
318  
319           /*
320            * Ensure that no duplicates can be added
321            */
322           int numOfAtt = attMgmt.getNumberOfAttendees();
323  
324           attMgmt.addAttendee(att1);
325  
326           assertEquals(numOfAtt, attMgmt.getNumberOfAttendees());
327  
328           /*
329            * Remove existing attendee.
330            */
331           numOfAtt = attMgmt.getNumberOfAttendees();
332  
333           assertFalse(attMgmt.isAttendeeRemovable(att1));
334           assertTrue(attMgmt.isAttendeeRemovable(att2));
335  
336           attMgmt.removeAttendee(att2);
337  
338           assertEquals(numOfAtt - 1, attMgmt.getNumberOfAttendees());
339  
340           /*
341            * Edit attendees.
342            */
343           assertFalse(attMgmt.editAttendee(att2, testAtt3));
344           assertTrue(attMgmt.editAttendee(att1, testAtt3));
345           assertFalse(attMgmt.editAttendee(att1, testAtt3));
346  
347           /*
348            * Meetings of an attendee.
349            */
350           att2 = attMgmt.addAttendee(testAtt2);
351           assertEquals(1, attMgmt.getMeetings(att1).size());
352           assertEquals(0, attMgmt.getMeetings(att2).size());
353  
354           /*
355            * Add and remove aspects.
356            */
357           att1 = attMgmt.addAttendee(testAtt1);
358  
359           attMgmt.addAspect(testAsp3, att1);
360           attMgmt.addAspect(testAsp3Identical, att1);
361  
362           attMgmt.addAspect(asp1, att1);
363  
364           assertTrue(attMgmt.hasAspect(asp1, att1));
365           attMgmt.addAspect(asp2, att1);
366           assertTrue(attMgmt.hasAspect(asp2, att1));
367  
368           assertEquals(3, attMgmt.getAspects(att1).size());
369           assertEquals(3, attMgmt.getNumberOfAspects(att1));
370  
371           attMgmt.addAspect(asp1, att2);
372           assertTrue(attMgmt.hasAspect(asp1, att2));
373  
374           assertEquals(1, attMgmt.getAspects(att2).size());
375           assertEquals(1, attMgmt.getNumberOfAspects(att2));
376  
377           attMgmt.removeAspect(asp1, att2);
378  
379           assertEquals(0, attMgmt.getAspects(att2).size());
380           assertEquals(0, attMgmt.getNumberOfAspects(att2));
381  
382           /*
383            * Push aspects of attendee.
384            */
385           attMgmt.pushBottomAspect(att1, asp1);
386  
387           assertFalse(attMgmt.isTopAspect(att1, asp1));
388           assertTrue(attMgmt.isBottomAspect(att1, asp1));
389  
390           attMgmt.pushTopAspect(att1, asp1);
391  
392           assertTrue(attMgmt.isTopAspect(att1, asp1));
393           assertFalse(attMgmt.isBottomAspect(att1, asp1));
394  
395           attMgmt.pushDownAspect(att1, asp1);
396  
397           assertFalse(attMgmt.isTopAspect(att1, asp1));
398           assertFalse(attMgmt.isBottomAspect(att1, asp1));
399  
400           attMgmt.pushBottomAspect(att1, asp1);
401  
402           assertFalse(attMgmt.isTopAspect(att1, asp1));
403           assertTrue(attMgmt.isBottomAspect(att1, asp1));
404  
405           attMgmt.pushUpAspect(att1, asp1);
406  
407           assertFalse(attMgmt.isTopAspect(att1, asp1));
408           assertFalse(attMgmt.isBottomAspect(att1, asp1));
409  
410           /*
411            * Get attendees with aspect
412            */
413           for (Attendee a : attMgmt.getAttendeesWithAspect(asp1)) {
414               assertTrue(attMgmt.hasAspect(asp1, a));
415           }
416  
417           /*
418            * Update attendees in database
419            */
420           attMgmt.updateAttendeesDictionary();
421       }
422  
423       @Test
424       public void manageFindings() throws ResiIOException, IOException,
425               ApplicationException {
426           FindingManagement findMgmt = Application.getInstance().getFindingMgmt();
427  
428           Application.getInstance().getApplicationCtl().loadReview(exampleReview);
429  
430           /*
431            * Aspects
432            */
433           Aspect asp1 = Data.getInstance().getResiData().getReview().getAspects()
434                   .get(0);
435           Aspect asp2 = Data.getInstance().getResiData().getReview().getAspects()
436                   .get(1);
437  
438           Protocol prot = Data.getInstance().getResiData().getReview()
439                   .getMeetings().get(0).getProtocol();
440  
441           assertEquals(3, findMgmt.getFindings(prot).size());
442           assertEquals(3, findMgmt.getNumberOfFindings(prot));
443  
444           /*
445            * Add new findings
446            */
447           Finding find1 = findMgmt.addFinding("Beschreibung des Befunds...",
448                   "Hauptfehler", prot);
449           Finding find2 = findMgmt.addFinding("Beschreibung des Befunds...",
450                   "Nebenfehler", prot);
451  
452           /*
453            * Remove finding
454            */
455           findMgmt.removeFinding(find1, prot);
456  
457           /*
458            * Edit finding
459            */
460           find1 = findMgmt.addFinding("Beschreibung des Befunds...",
461                   "Hauptfehler", prot);
462           findMgmt.editFinding(find1, find2, prot);
463  
464           /*
465            * Add references
466            */
467           findMgmt.addReference("Fehler ist auf Seite 23", find2);
468           findMgmt.addReference("...und auf S. 26", find2);
469           findMgmt.addReference("noch eine Ref.", find2);
470  
471           assertEquals("Fehler ist auf Seite 23", findMgmt.getReferences(find2)
472                   .get(0));
473           assertEquals("...und auf S. 26", findMgmt.getReferences(find2).get(1));
474           assertEquals("noch eine Ref.", findMgmt.getReferences(find2).get(2));
475  
476           /*
477            * Remove reference
478            */
479           findMgmt.removeReference("...und auf S. 26", find2);
480  
481           assertEquals("Fehler ist auf Seite 23", findMgmt.getReferences(find2)
482                   .get(0));
483           assertEquals("noch eine Ref.", findMgmt.getReferences(find2).get(1));
484  
485           /*
486            * Add external references
487            */
488           findMgmt.addExtReference(extRef1, find2);
489           findMgmt.addExtReference(extRef2, find2);
490           findMgmt.addExtReference(extRef3, find2);
491           findMgmt.addExtReference(extRef3, find2);
492  
493           assertEquals(extRef1.getName(), findMgmt.getExtReferences(find2).get(0)
494                   .getName());
495           assertEquals(extRef2.getName(), findMgmt.getExtReferences(find2).get(1)
496                   .getName());
497           assertEquals(extRef3.getName(), findMgmt.getExtReferences(find2).get(2)
498                   .getName());
499           assertEquals(extRef3Mod.getName(), findMgmt.getExtReferences(find2)
500                   .get(3).getName());
501  
502           /*
503            * Remove external reference
504            */
505           findMgmt.removeExtReference(findMgmt.getExtReferences(find2).get(2),
506                   find2);
507  
508           assertEquals(extRef1.getName(), findMgmt.getExtReferences(find2).get(0)
509                   .getName());
510           assertEquals(extRef2.getName(), findMgmt.getExtReferences(find2).get(1)
511                   .getName());
512           assertEquals(extRef3Mod.getName(), findMgmt.getExtReferences(find2)
513                   .get(2).getName());
514  
515           /*
516            * Add aspects
517            */
518           findMgmt.addAspect(asp1, find2);
519           findMgmt.addAspect(asp2, find2);
520  
521           assertEquals(asp1.getDirective() + " (" + asp1.getCategory() + ")",
522                   findMgmt.getAspects(find2).get(0));
523           assertEquals(asp2.getDirective() + " (" + asp2.getCategory() + ")",
524                   findMgmt.getAspects(find2).get(1));
525  
526           /*
527            * Remove aspect
528            */
529           findMgmt.removeAspect(asp1.getDirective() + " (" + asp1.getCategory()
530                   + ")", find2);
531  
532           assertEquals(asp2.getDirective() + " (" + asp2.getCategory() + ")",
533                   findMgmt.getAspects(find2).get(0));
534  
535           /*
536            * Push findings
537            */
538           findMgmt.addFinding(find1, prot);
539  
540           assertFalse(findMgmt.isTopFinding(find1, prot));
541           assertTrue(findMgmt.isBottomFinding(find1, prot));
542  
543           findMgmt.pushTopFinding(find1, prot);
544  
545           assertTrue(findMgmt.isTopFinding(find1, prot));
546           assertFalse(findMgmt.isBottomFinding(find1, prot));
547  
548           findMgmt.pushDownFinding(find1, prot);
549  
550           assertFalse(findMgmt.isTopFinding(find1, prot));
551           assertFalse(findMgmt.isBottomFinding(find1, prot));
552  
553           findMgmt.pushBottomFinding(find1, prot);
554  
555           assertFalse(findMgmt.isTopFinding(find1, prot));
556           assertTrue(findMgmt.isBottomFinding(find1, prot));
557  
558           findMgmt.pushUpFinding(find1, prot);
559  
560           assertFalse(findMgmt.isTopFinding(find1, prot));
561           assertFalse(findMgmt.isBottomFinding(find1, prot));
562       }
563  
564       @Test
565       public void manageMeetings() throws ResiIOException, IOException,
566               ApplicationException {
567           MeetingManagement meetMgmt = Application.getInstance().getMeetingMgmt();
568  
569           Application.getInstance().getApplicationCtl().loadReview(exampleReview);
570  
571           /*
572            * Meetings of this review
573            */
574           Meeting meet1 = meetMgmt.getMeetings().get(0);
575           Meeting meet2 = meetMgmt.getMeetings().get(1);
576           Meeting meet3 = meetMgmt.getMeetings().get(2);
577  
578           /*
579            * Test getMeetings method
580            */
581           assertEquals(Data.getInstance().getResiData().getReview().getMeetings()
582                   .size(), meetMgmt.getMeetings().size());
583  
584           int i = 0;
585  
586           for (Meeting m : meetMgmt.getMeetings()) {
587               assertEquals(Data.getInstance().getResiData().getReview()
588                       .getMeetings().get(i), m);
589  
590               i++;
591           }
592  
593           /*
594            * Test predecessor meeting method
595            */
596           assertEquals(meet1, meetMgmt.getPredecessorMeeting(meet2));
597           assertNull(meetMgmt.getPredecessorMeeting(meet1));
598  
599           /*
600            * Add meeting
601            */
602           Calendar date = meet3.getPlannedDate();
603           date.add(Calendar.DATE, 2);
604           Calendar start = meet3.getPlannedStart();
605           Calendar end = meet3.getPlannedEnd();
606  
607           Meeting newMeet = meetMgmt.addMeeting(date, start, end,
608                   "an einem sicheren Ort ;-)");
609  
610           /* try to add duplicate */
611           meetMgmt.addMeeting(newMeet);
612  
613           assertEquals(newMeet, meetMgmt.getMeetings().get(3));
614           assertEquals(4, meetMgmt.getMeetings().size());
615  
616           /*
617            * Remove meeting
618            */
619           meetMgmt.removeMeeting(newMeet);
620           assertEquals(3, meetMgmt.getMeetings().size());
621  
622           meetMgmt.removeMeeting(0);
623           assertEquals(2, meetMgmt.getMeetings().size());
624  
625           /*
626            * Edit meeting
627            */
628           newMeet = meetMgmt.addMeeting(date, start, end,
629                   "an einem sicheren Ort ;-)");
630  
631           meetMgmt.editMeeting(meet2, newMeet);
632  
633           assertEquals(3, meetMgmt.getMeetings().size());
634       }
635  
636       @Test
637       public void manageProtocols() throws ResiIOException, IOException,
638               ApplicationException, DatatypeConfigurationException {
639           ProtocolManagement protMgmt = Application.getInstance()
640                   .getProtocolMgmt();
641  
642           Application.getInstance().getApplicationCtl().loadReview(exampleReview);
643  
644           Meeting meet1 = Data.getInstance().getResiData().getReview()
645                   .getMeetings().get(0);
646           Meeting meet2 = Data.getInstance().getResiData().getReview()
647                   .getMeetings().get(1);
648  
649           /*
650            * Set protocol
651            */
652           Protocol prot1 = protMgmt.setProtocol(meet1.getPlannedDate(), meet1
653                   .getPlannedStart(), meet1.getPlannedEnd(), meet1
654                   .getPlannedLocation(), meet1);
655  
656           assertEquals(prot1, protMgmt.getProtocol(meet1));
657  
658           /*
659            * Clear protocol
660            */
661           protMgmt.clearProtocol(meet1);
662  
663           assertNull(protMgmt.getProtocol(meet1));
664  
665           /*
666            * attendees of a protocol
667            */
668           int i = 0;
669  
670           for (Attendee a : protMgmt.getAttendees(meet2.getProtocol())) {
671               assertEquals(meet2.getProtocol().getAttendeeReferences().get(i)
672                       .getAttendee(), a.getId());
673  
674               assertTrue(protMgmt.isAttendee(a, meet2.getProtocol()));
675  
676               i++;
677           }
678  
679           /*
680            * remove and add attendee
681            */
682           Attendee att = protMgmt.getAttendees(meet2.getProtocol()).get(0);
683  
684           protMgmt.removeAttendee(att, meet2.getProtocol());
685  
686           protMgmt.addAttendee(att, DatatypeFactory.newInstance().newDuration(
687                   "PT1H15M"), meet2.getProtocol());
688  
689           /*
690            * get preparation time
691            */
692           assertEquals(DatatypeFactory.newInstance().newDuration("PT1H15M"),
693                   protMgmt.getAttendeePrepTime(att, meet2.getProtocol()));
694       }
695  
696       @Test
697       public void manageReview() throws ResiIOException, IOException,
698               ApplicationException {
699           final String REVIEW_FILE = Data.getInstance().getResource(
700                   "reviewFileName");
701  
702           final String EXTREF_PREFIX = Data.getInstance().getResource(
703                   "extRefURIPrefix");
704  
705           ReviewManagement revMgmt = Application.getInstance().getReviewMgmt();
706           Review rev = Data.getInstance().getResiData().getReview();
707  
708           Application.getInstance().getApplicationCtl().loadReview(
709                   exampleReviewMod);
710  
711           /*
712            * file name and URI of external references
713            */
714           assertEquals("Datei mit Ümläute.gif", revMgmt.getExtRefFileName(revMgmt
715                   .getExtRefURI("Datei mit Ümläute.gif")));
716  
717           /*
718            * invalid URI
719            */
720           assertEquals("\\\\invalid_uri://\\::\\/::,,:s", revMgmt
721                   .getExtRefFileName(EXTREF_PREFIX
722                           + "\\\\invalid_uri://\\::\\/::,,:s"));
723  
724           /*
725            * existence of external references
726            */
727           assertTrue(revMgmt.isExtRef(REVIEW_FILE));
728           assertTrue(revMgmt.isExtRef("error.log"));
729           assertTrue(revMgmt.isExtRef("dpkg.list"));
730           assertFalse(revMgmt.isExtRef("datei_gibts_nicht.txt"));
731  
732           /*
733            * validate external references
734            */
735           revMgmt.validateExtRefs();
736  
737           /*
738            * review name
739            */
740           assertEquals(rev.getName(), revMgmt.getReviewName());
741  
742           revMgmt.setReviewName("Neuer Name für das Review");
743           assertEquals("Neuer Name für das Review", revMgmt.getReviewName());
744  
745           /*
746            * review description
747            */
748           assertEquals(rev.getDescription(), revMgmt.getReviewDescription());
749  
750           revMgmt.setReviewDescription("Neue Beschreibung für das Review");
751           assertEquals("Neue Beschreibung für das Review", revMgmt
752                   .getReviewDescription());
753  
754           /*
755            * review comments
756            */
757           assertEquals(rev.getComments(), revMgmt.getReviewComments());
758  
759           revMgmt.setReviewComments("Neue Kommentare für das Review");
760           assertEquals("Neue Kommentare für das Review", revMgmt
761                   .getReviewComments());
762  
763           /*
764            * product name
765            */
766           assertEquals(rev.getProduct().getName(), revMgmt.getProductName());
767  
768           revMgmt.setProductName("Neue Bezeichnung für das Produkt");
769           assertEquals("Neue Bezeichnung für das Produkt", revMgmt
770                   .getProductName());
771  
772           /*
773            * product version
774            */
775           assertEquals(rev.getProduct().getVersion(), revMgmt.getProductVersion());
776  
777           revMgmt.setProductVersion("Neue Version des Produkts");
778           assertEquals("Neue Version des Produkts", revMgmt.getProductVersion());
779  
780           /*
781            * impression
782            */
783           assertEquals(rev.getImpression(), revMgmt.getImpression());
784  
785           revMgmt.setImpression("Eindruck...");
786           assertEquals("Eindruck...", revMgmt.getImpression());
787  
788           /*
789            * recommendation
790            */
791           assertEquals(rev.getRecommendation(), revMgmt.getRecommendation());
792  
793           revMgmt.setRecommendation("Empfehlung...");
794           assertEquals("Empfehlung...", revMgmt.getRecommendation());
795  
796           /*
797            * Remove all external references
798            */
799           for (File ref : revMgmt.getExtProdReferences()) {
800               revMgmt.removeExtProdReference(ref);
801           }
802  
803           /*
804            * Manage product references
805            */
806           for (String ref : revMgmt.getProductReferences()) {
807               assertTrue(revMgmt.isProductReference(ref));
808  
809               if (revMgmt.isProductReferenceRemovable(ref)) {
810                   revMgmt.removeProductReference(ref);
811               }
812           }
813  
814           assertEquals(1, revMgmt.getProductReferences().size());
815           assertFalse(revMgmt.isProductReference("nicht existierende Referenz"));
816  
817           String prodRef1 = "Referenz zum Prüfling";
818           String prodRef2 = "Weitere Referenz zum Prüfling";
819  
820           revMgmt.addProductReference(prodRef1);
821  
822           assertTrue(revMgmt.isProductReference(prodRef1));
823  
824           revMgmt.editProductReference(prodRef1, prodRef2);
825  
826           assertFalse(revMgmt.isProductReference(prodRef1));
827           assertTrue(revMgmt.isProductReference(prodRef2));
828  
829           /*
830            * Add some external product references and remove all product
831            * references
832            */
833           revMgmt.addExtProdReference(extRef1);
834           revMgmt.addExtProdReference(extRef2);
835           revMgmt.addExtProdReference(extRef3);
836  
837           for (String ref : revMgmt.getProductReferences()) {
838               revMgmt.removeProductReference(ref);
839           }
840  
841           /*
842            * Manage external product references
843            */
844           for (File ref : revMgmt.getExtProdReferences()) {
845               if (revMgmt.isExtProdReferenceRemovable(ref)) {
846                   revMgmt.removeExtProdReference(ref);
847               }
848           }
849  
850           assertEquals(1, revMgmt.getExtProdReferences().size());
851  
852           revMgmt.addExtProdReference(extRef1);
853           revMgmt.addExtProdReference(extRef2);
854           revMgmt.addExtProdReference(extRef2);
855           revMgmt.addExtProdReference(extRef4);
856           revMgmt.addExtProdReference(extRef4);
857  
858           assertEquals(6, revMgmt.getExtProdReferences().size());
859  
860           /*
861            * Reload review and check numbers
862            */
863           Application.getInstance().getApplicationCtl().loadReview(
864                   exampleReviewMod);
865  
866           assertEquals(2, revMgmt.getNumberOfAspects());
867           assertEquals(3, revMgmt.getNumberOfSeverities());
868           assertEquals(3, revMgmt.getNumberOfAttendees());
869           assertEquals(9, revMgmt.getNumberOfFindings());
870           assertEquals(3, revMgmt.getNumberOfMeetings());
871           assertEquals(4, revMgmt.getNumberOfProdRefs());
872       }
873  
874       @Test
875       public void manageSeverities() throws ResiIOException, IOException,
876               ApplicationException {
877           SeverityManagement sevMgmt = Application.getInstance()
878                   .getSeverityMgmt();
879  
880           Application.getInstance().getApplicationCtl().loadReview(
881                   exampleReviewMod);
882  
883           /*
884            * validate the severites in the findings of the loaded review
885            */
886           sevMgmt.validateSeverities();
887  
888           /*
889            * number of severities
890            */
891           assertEquals(3, sevMgmt.getNumberOfSeverities());
892  
893           /*
894            * check existing and not existing severities
895            */
896           assertTrue(sevMgmt.isSeverity("Hauptfehler"));
897           assertFalse(sevMgmt.isSeverity("major"));
898  
899           /*
900            * check replacement severities
901            */
902           assertEquals("Kritischer Fehler", sevMgmt
903                   .getReplaceSeverity("Hauptfehler"));
904           assertEquals("Hauptfehler", sevMgmt.getReplaceSeverity("Nebenfehler"));
905  
906           /*
907            * edit severities
908            */
909           sevMgmt.editSeverity("Hauptfehler", "Schwerer Fehler");
910           sevMgmt.editSeverity("Nebenfehler", "Beiläufiger Fehler");
911  
912           assertTrue(sevMgmt.isSeverity("Schwerer Fehler"));
913           assertTrue(sevMgmt.isSeverity("Beiläufiger Fehler"));
914           assertFalse(sevMgmt.isSeverity("Hauptfehler"));
915           assertFalse(sevMgmt.isSeverity("Nebenfehler"));
916  
917           /*
918            * try to remove all severities
919            */
920           int i = 0;
921  
922           List<String> sevs = sevMgmt.getSeverities();
923  
924           while (i < sevs.size()) {
925               if (sevMgmt.isSeverityRemovable(sevs.get(i))) {
926                   sevMgmt.removeSeverity(sevs.get(i));
927                   i--;
928               }
929  
930               i++;
931           }
932  
933           assertEquals(1, sevMgmt.getSeverities().size());
934  
935           /*
936            * add new severities
937            */
938           sevMgmt.addSeverity("major");
939           sevMgmt.addSeverity("minor");
940           sevMgmt.addSeverity("critical");
941  
942           assertEquals(4, sevMgmt.getSeverities().size());
943  
944           /*
945            * Push severities
946            */
947           assertFalse(sevMgmt.isTopSeverity("critical"));
948           assertTrue(sevMgmt.isBottomSeverity("critical"));
949  
950           sevMgmt.pushTopSeverity("critical");
951  
952           assertTrue(sevMgmt.isTopSeverity("critical"));
953           assertFalse(sevMgmt.isBottomSeverity("critical"));
954  
955           sevMgmt.pushDownSeverity("critical");
956  
957           assertFalse(sevMgmt.isTopSeverity("critical"));
958           assertFalse(sevMgmt.isBottomSeverity("critical"));
959  
960           sevMgmt.pushBottomSeverity("critical");
961  
962           assertFalse(sevMgmt.isTopSeverity("critical"));
963           assertTrue(sevMgmt.isBottomSeverity("critical"));
964  
965           sevMgmt.pushUpSeverity("critical");
966  
967           assertFalse(sevMgmt.isTopSeverity("critical"));
968           assertFalse(sevMgmt.isBottomSeverity("critical"));
969       }
970  
971       @AfterClass
972       public static void cleanUp() {
973           FileTools.deleteDirectory(new File(Data.getInstance().getAppData()
974                   .getAppDataPath()));
975  
976           FileTools.deleteDirectory(new File(tempDirectory));
977       }
978  
979   }
HelpDataTest.java
35   public class HelpDataTest {
36  
37       private HelpData helpData;
38  
39       @Test
40       public void getChapters() throws DataException {
41           helpData = Data.getInstance().getHelpData();
42  
43           assertNotNull(helpData.getChapters());
44       }
45  
46       @Test
47       public void getChapterContent() throws DataException {
48           helpData = new HelpData();
49  
50           assertNotNull(helpData.getChapterContent("start"));
51       }
52  
53       @Test
54       public void getChapterNumber() throws DataException {
55           helpData = new HelpData();
56  
57           assertEquals(0, helpData.getChapterNumber("start"));
58       }
59  
60       @Test
61       public void getChapterTitle() throws DataException {
62           helpData = new HelpData();
63  
64           assertNotNull(helpData.getChapterTitle("start"));
65       }
66       
67       @Test(expected = DataException.class)
68       public void getNotExistingChapterTitle() throws DataException {
69           helpData = new HelpData();
70  
71           helpData.getChapterTitle("gibts_nicht");
72       }
73       
74       @Test(expected = DataException.class)
75       public void getNotExistingChapterContent() throws DataException {
76           helpData = new HelpData();
77  
78           helpData.getChapterContent("gibts_nicht");
79       }
80  
81   }
ExportTest.java
58   public class ExportTest {
59  
60       private static String testdataDirectory = "org/revager/test/testdata/";
61  
62       private static String exampleReview = testdataDirectory
63               + "Review Example 1.rev";
64  
65       private static String outputPDF = testdataDirectory + "output.pdf";
66       private static String outputCSV = testdataDirectory + "output.csv";
67       private static String outputZIP = testdataDirectory + "output.zip";
68       private static String outputDir = testdataDirectory + "output";
69  
70       private static Meeting meeting;
71       private static Attendee reviewer;
72       private static Attendee scribe;
73       private static Attendee moderator;
74  
75       private static AppCSVProfile csvProfile;
76  
77       @BeforeClass
78       public static void setUp() throws DataException, ResiIOException,
79               IOException, ApplicationException {
80           /*
81            * Set Application data and load example review
82            */
83           Data.getInstance().getAppData().setCustomAppDataDirectory(
84                   testdataDirectory);
85  
86           Data.getInstance().getAppData().resetDatabase();
87  
88           Data.getInstance().getAppData().initialize();
89  
90           Application.getInstance().getApplicationCtl().loadReview(exampleReview);
91  
92           /*
93            * Set application settings
94            */
95           Data.getInstance().getAppData().setSetting(
96                   AppSettingKey.PDF_PROTOCOL_FOOT_TEXT,
97                   "(c) 2009 by Universität Stuttgart, Abteilung SE");
98           Data.getInstance().getAppData().setSetting(
99                   AppSettingKey.PDF_PROTOCOL_LOGO,
100                   "org/revager/test/testdata/Logo SE.jpg");
101  
102           Data.getInstance().getAppData().setSetting(
103                   AppSettingKey.PDF_INVITATION_FOOT_TEXT,
104                   "(c) 2009 by Universität Stuttgart, Abteilung SE");
105           Data.getInstance().getAppData().setSetting(
106                   AppSettingKey.PDF_INVITATION_LOGO,
107                   "org/revager/test/testdata/Logo SE.jpg");
108  
109           /*
110            * Set test meeting and attendees
111            */
112           meeting = Data.getInstance().getResiData().getReview().getMeetings()
113                   .get(2);
114           reviewer = Data.getInstance().getResiData().getReview().getAttendees()
115                   .get(0);
116           scribe = Data.getInstance().getResiData().getReview().getAttendees()
117                   .get(1);
118           moderator = Data.getInstance().getResiData().getReview().getAttendees()
119                   .get(2);
120  
121           /*
122            * default csv profile
123            */
124           csvProfile = Data.getInstance().getAppData().getCSVProfile("Trac");
125       }
126  
127       @Test(expected = ExportException.class)
128       public void exportExceptionWithoutMessage() throws ExportException {
129           throw new ExportException();
130       }
131  
132       @Test(expected = ExportException.class)
133       public void exportExceptionWithMessage() throws ExportException {
134           throw new ExportException("Test-Meldung");
135       }
136  
137       @Test
138       public void createReviewProtocols() throws ExportException, DataException {
139           ProtocolPDFExporter exporter;
140  
141           exporter = new ReviewProtocolPDFExporter(outputPDF, true, true, true);
142           exporter.writeToFile();
143  
144           exporter = new ReviewProtocolPDFExporter(outputPDF, true, true, false);
145           exporter.writeToFile();
146  
147           exporter = new ReviewProtocolPDFExporter(outputPDF, true, false, true);
148           exporter.writeToFile();
149  
150           exporter = new ReviewProtocolPDFExporter(outputPDF, true, false, false);
151           exporter.writeToFile();
152  
153           exporter = new ReviewProtocolPDFExporter(outputPDF, false, true, true);
154           exporter.writeToFile();
155  
156           exporter = new ReviewProtocolPDFExporter(outputPDF, false, true, false);
157           exporter.writeToFile();
158  
159           exporter = new ReviewProtocolPDFExporter(outputPDF, false, false, true);
160           exporter.writeToFile();
161  
162           exporter = new ReviewProtocolPDFExporter(outputPDF, false, false, false);
163           exporter.writeToFile();
164  
165           /*
166            * Modify head and foot of the protocol pdf files: Delete logo and foot
167            * text.
168            *
169            * Delete description, comments, recommendation and impression of the
170            * review.
171            *
172            * Delete comments of meeting and protocol.
173            */
174           Data.getInstance().getAppData().setSetting(
175                   AppSettingKey.PDF_PROTOCOL_FOOT_TEXT, "");
176           Data.getInstance().getAppData().setSetting(
177                   AppSettingKey.PDF_PROTOCOL_LOGO, "");
178           
179           Data.getInstance().getResiData().getReview().setComments("");
180           Data.getInstance().getResiData().getReview().setDescription("");
181           Data.getInstance().getResiData().getReview().setRecommendation("");
182           Data.getInstance().getResiData().getReview().setImpression("");
183           
184           meeting.setComments("");
185           meeting.getProtocol().setComments("");
186           
187           exporter = new ReviewProtocolPDFExporter(outputPDF, true, true, true);
188           exporter.writeToFile();
189       }
190  
191       @Test
192       public void createMeetingProtocols() throws ExportException, DataException {
193           Meeting meeting = Data.getInstance().getResiData().getReview()
194                   .getMeetings().get(0);
195           ProtocolPDFExporter exporter;
196  
197           exporter = new MeetingProtocolPDFExporter(outputPDF, meeting, true,
198                   true, true);
199           exporter.writeToFile();
200  
201           exporter = new MeetingProtocolPDFExporter(outputPDF, meeting, true,
202                   true, false);
203           exporter.writeToFile();
204  
205           exporter = new MeetingProtocolPDFExporter(outputPDF, meeting, true,
206                   false, true);
207           exporter.writeToFile();
208  
209           exporter = new MeetingProtocolPDFExporter(outputPDF, meeting, true,
210                   false, false);
211           exporter.writeToFile();
212  
213           exporter = new MeetingProtocolPDFExporter(outputPDF, meeting, false,
214                   true, true);
215           exporter.writeToFile();
216  
217           exporter = new MeetingProtocolPDFExporter(outputPDF, meeting, false,
218                   true, false);
219           exporter.writeToFile();
220  
221           exporter = new MeetingProtocolPDFExporter(outputPDF, meeting, false,
222                   false, true);
223           exporter.writeToFile();
224  
225           exporter = new MeetingProtocolPDFExporter(outputPDF, meeting, false,
226                   false, false);
227           exporter.writeToFile();
228           
229           /*
230            * Set meeting as planned.
231            */
232           meeting.getProtocol().setDate(meeting.getPlannedDate());
233           meeting.getProtocol().setStart(meeting.getPlannedStart());
234           meeting.getProtocol().setEnd(meeting.getPlannedEnd());
235           meeting.getProtocol().setLocation(meeting.getPlannedLocation());
236           
237           exporter = new MeetingProtocolPDFExporter(outputPDF, meeting, true,
238                   true, true);
239           exporter.writeToFile();
240       }
241  
242       @Test
243       public void createInvitationsAsPDF() throws ExportException, DataException {
244           InvitationPDFExporter exporter;
245  
246           exporter = new InvitationPDFExporter(outputPDF, meeting, reviewer, true);
247           exporter.writeToFile();
248  
249           exporter = new InvitationPDFExporter(outputPDF, meeting, reviewer,
250                   false);
251           exporter.writeToFile();
252  
253           exporter = new InvitationPDFExporter(outputPDF, meeting, scribe, true);
254           exporter.writeToFile();
255  
256           exporter = new InvitationPDFExporter(outputPDF, meeting, scribe, false);
257           exporter.writeToFile();
258  
259           exporter = new InvitationPDFExporter(outputPDF, meeting, moderator,
260                   true);
261           exporter.writeToFile();
262  
263           exporter = new InvitationPDFExporter(outputPDF, meeting, moderator,
264                   false);
265           exporter.writeToFile();
266  
267           /*
268            * Add a second moderator to the review and create an invitation
269            */
270           Attendee secondMod = new Attendee();
271           secondMod.setContact("irgendeine Kontaktadresse");
272           secondMod.setName("Hans Moddi");
273           secondMod.setRole(Role.MODERATOR);
274  
275           Application.getInstance().getAttendeeMgmt().addAttendee(secondMod);
276  
277           exporter = new InvitationPDFExporter(outputPDF, meeting, reviewer, true);
278           exporter.writeToFile();
279       }
280  
281       @Test
282       public void createInvitationsAsZIP() throws ExportException, DataException {
283           InvitationZIPExporter exporter;
284  
285           exporter = new InvitationZIPExporter(outputZIP, meeting, reviewer, true);
286           exporter.writeToFile();
287  
288           exporter = new InvitationZIPExporter(outputZIP, meeting, reviewer,
289                   false);
290           exporter.writeToFile();
291  
292           exporter = new InvitationZIPExporter(outputZIP, meeting, scribe, true);
293           exporter.writeToFile();
294  
295           exporter = new InvitationZIPExporter(outputZIP, meeting, scribe, false);
296           exporter.writeToFile();
297  
298           exporter = new InvitationZIPExporter(outputZIP, meeting, moderator,
299                   true);
300           exporter.writeToFile();
301  
302           exporter = new InvitationZIPExporter(outputZIP, meeting, moderator,
303                   false);
304           exporter.writeToFile();
305       }
306  
307       @Test
308       public void createInvitationsAsDir() throws ExportException, DataException {
309           InvitationDirExporter exporter;
310  
311           exporter = new InvitationDirExporter(outputDir, meeting, reviewer, true);
312           exporter.writeDir();
313  
314           exporter = new InvitationDirExporter(outputDir, meeting, reviewer,
315                   false);
316           exporter.writeDir();
317  
318           exporter = new InvitationDirExporter(outputDir, meeting, scribe, true);
319           exporter.writeDir();
320  
321           exporter = new InvitationDirExporter(outputDir, meeting, scribe, false);
322           exporter.writeDir();
323  
324           exporter = new InvitationDirExporter(outputDir, meeting, moderator,
325                   true);
326           exporter.writeDir();
327  
328           exporter = new InvitationDirExporter(outputDir, meeting, moderator,
329                   false);
330           exporter.writeDir();
331       }
332  
333       @Test
334       public void createFindingsListAsCSV() throws DataException, ExportException {
335           Map<String, String> sevMap = new HashMap<String, String>();
336           sevMap.put("Hauptfehler", "major");
337  
338           FindingsCSVExporter exporter = new FindingsCSVExporter(csvProfile,
339                   null, meeting.getProtocol().getFindings(), "Hans Moddi");
340           exporter.addSeverityMapping("Nebenfehler", "minor");
341           exporter.addSeverityMapping("Hauptfehler", "major");
342  
343           exporter.writeToFile(outputCSV);
344  
345           assertEquals(4, exporter.getColumns());
346  
347           exporter.setColumns(-1);
348           assertEquals(1, exporter.getColumns());
349           exporter.setColumns(4);
350  
351           exporter.setSeparator(null);
352           assertEquals(",", exporter.getSeparator());
353           exporter.setSeparator(";");
354  
355           exporter.writeToFile(outputCSV);
356  
357           exporter.setEncapsulator(null);
358           assertNull(exporter.getEncapsulator());
359           exporter.setEncapsulator("'");
360           assertEquals("'", exporter.getEncapsulator());
361  
362           exporter.writeToFile(outputCSV);
363  
364           exporter.setEncapsulator("\"");
365           assertEquals("\"", exporter.getEncapsulator());
366  
367           exporter.writeToFile(outputCSV);
368  
369           /*
370            * Modify csv profile
371            */
372           csvProfile.setEncapsulateContent(true);
373  
374           exporter = new FindingsCSVExporter(csvProfile, sevMap, meeting
375                   .getProtocol().getFindings(), "Hans Moddi");
376       }
377  
378       @AfterClass
379       public static void cleanUp() {
380           FileTools.deleteDirectory(new File(Data.getInstance().getAppData()
381                   .getAppDataPath()));
382  
383           new File(outputPDF).delete();
384           new File(outputCSV).delete();
385           new File(outputZIP).delete();
386           FileTools.deleteDirectory(new File(outputDir));
387       }
388  
389   }
DataTest.java
36   public class DataTest {
37  
38       private Data data;
39  
40       @Test(expected = DataException.class)
41       public void dataExceptionWithoutMessage() throws DataException {
42           throw new DataException();
43       }
44  
45       @Test(expected = DataException.class)
46       public void dataExceptionWithMessage() throws DataException {
47           throw new DataException("Test-Meldung");
48       }
49  
50       @Test
51       public void getInstancesOfDataClasses() {
52           data = Data.getInstance();
53  
54           assertNotNull(data.getAppData());
55           assertNotNull(data.getResiData());
56           assertNotNull(data.getHelpData());
57       }
58  
59       @Test
60       public void getAndSetLocale() {
61           data = Data.getInstance();
62  
63           data.setLocale(Locale.GERMANY);
64  
65           assertEquals(Locale.GERMANY, data.getLocale());
66       }
67  
68       @Test
69       public void getAndSetMode() {
70           data = Data.getInstance();
71  
72           data.setMode("moderator");
73  
74           assertEquals("moderator", data.getMode());
75       }
76  
77       @Test
78       public void setInvalidMode() {
79           data = Data.getInstance();
80  
81           System.err.println("\nSHOW ERROR MESSAGE BECAUSE OF INVALID MODE:");
82           data.setMode("diesenModusGibtsNicht");
83       }
84  
85       @Test
86       public void getIcon() {
87           data = Data.getInstance();
88  
89           data.getIcon("frameIcon_128x128.png");
90       }
91  
92       @Test
93       public void getResource() {
94           data = Data.getInstance();
95  
96           assertEquals("/org/revager/resources/appLogo.png", data
97                   .getResource("path.appLogo"));
98       }
99  
100       @Test
101       public void getInvalidResource() {
102           data = Data.getInstance();
103  
104           System.err.println("\nSHOW ERROR MESSAGE BECAUSE OF INVALID RESOURCE:");
105           data.getResource("dieseResourceGibtsNicht");
106       }
107  
108       @Test
109       public void getLocaleStr() {
110           data = Data.getInstance();
111  
112           data.setLocale(Locale.GERMANY);
113  
114           assertEquals("Neues Review", data.getLocaleStr("newReview"));
115       }
116  
117       @Test
118       public void getInvalidLocaleStr() {
119           data = Data.getInstance();
120  
121           assertEquals(data.getLocaleStr("noLocaleString"), data
122                   .getLocaleStr("diesenLocaleStrGibtsNicht"));
123       }
124  
125       @Test
126       public void getRegularModeParameter() {
127           data = Data.getInstance();
128  
129           data.setMode("moderator");
130  
131           assertFalse(data.getModeParam("ableToCreateNewProtocol"));
132       }
133  
134       @Test
135       public void getDefaultFallbackModeParameter() {
136           data = Data.getInstance();
137  
138           data.setMode("moderator");
139  
140           assertTrue(data.getModeParam("ableToManageSeverities"));
141       }
142  
143       @Test
144       public void getInvalidModeParameter() {
145           data = Data.getInstance();
146  
147           data.setMode("moderator");
148  
149           assertFalse(data.getModeParam("diesenParameterGibtsNicht"));
150       }
151  
152   }
ApplicationTest.java
49   public class ApplicationTest {
50  
51       private static String testdataDirectory = "org/revager/test/testdata/";
52       private static String tempDirectory = System.getProperty("user.home")
53               + "/tmp-revager_/";
54  
55       private static String exampleReviewZIP = testdataDirectory
56               + "Review Example 1.rev";
57       private static String exampleReviewXML = testdataDirectory
58               + "Resi Review Example.xml";
59       private static String exampleCatalog = testdataDirectory
60               + "Resi Catalog Example.xml";
61       private static String exampleAspects = testdataDirectory
62               + "Resi Aspects Example.xml";
63  
64       private static String outputXML = tempDirectory + "output.xml";
65       private static String outputPDF = tempDirectory + "output.pdf";
66       private static String outputCSV = tempDirectory + "output.csv";
67       private static String outputZIP = tempDirectory + "output.zip";
68       private static String outputDir = tempDirectory + "output";
69  
70       @BeforeClass
71       public static void setUp() throws IOException, DataException {
72           File tempDir = new File(tempDirectory);
73  
74           tempDir.mkdir();
75  
76           Data.getInstance().getAppData()
77                   .setCustomAppDataDirectory(tempDirectory);
78  
79           Data.getInstance().getAppData().initialize();
80       }
81  
82       @Test(expected = ApplicationException.class)
83       public void appExceptionWithoutMessage() throws ApplicationException {
84           throw new ApplicationException();
85       }
86  
87       @Test(expected = ApplicationException.class)
88       public void appExceptionWithMessage() throws ApplicationException {
89           throw new ApplicationException("Test-Meldung");
90       }
91  
92       @Test
93       public void createNewReview() {
94           Application.getInstance().getApplicationCtl().newReview();
95       }
96  
97       @Test
98       public void loadAndStoreReview() throws ResiIOException, IOException,
99               ApplicationException {
100           Application.getInstance().getApplicationCtl().loadReview(
101                   exampleReviewXML);
102  
103           assertEquals("Review der Spezifikation XYZ", Data.getInstance()
104                   .getResiData().getReview().getName());
105  
106           Application.getInstance().getApplicationCtl().storeReview(outputXML);
107  
108           Application.getInstance().getApplicationCtl().newReview();
109  
110           /*
111            * Load ZIP review
112            */
113           Application.getInstance().getApplicationCtl().loadReview(
114                   exampleReviewZIP);
115  
116           assertEquals("Review der Spezifikation XYZ", Data.getInstance()
117                   .getResiData().getReview().getName());
118  
119           Application.getInstance().getApplicationCtl()
120                   .storeReview(
121                           outputZIP
122                                   + "."
123                                   + Data.getInstance().getResource(
124                                           "fileEndingReviewZIP"));
125       }
126  
127       @Test(expected = ApplicationException.class)
128       public void loadReviewFromAppData() throws ResiIOException, IOException,
129               ApplicationException {
130           Application.getInstance().getApplicationCtl().loadReview(
131                   Data.getInstance().getAppData().getAppDataPath() + "test.xml");
132       }
133  
134       @Test(expected = ApplicationException.class)
135       public void storeReviewToAppData() throws ResiIOException, IOException,
136               ApplicationException {
137           Application.getInstance().getApplicationCtl().storeReview(
138                   Data.getInstance().getAppData().getAppDataPath() + "test.xml");
139       }
140  
141       @Test
142       public void backupAndRestoreReview() throws ResiIOException, DataException {
143           assertFalse(Application.getInstance().getApplicationCtl()
144                   .isReviewRestorable());
145  
146           Application.getInstance().getApplicationCtl().backupReview();
147  
148           assertTrue(Application.getInstance().getApplicationCtl()
149                   .isReviewRestorable());
150  
151           Application.getInstance().getApplicationCtl().restoreReview();
152       }
153  
154       @Test
155       public void importAndExportCatalogXML() throws ResiIOException {
156           Catalog testCat = Application.getInstance().getImportExportCtl()
157                   .importCatalogXML(exampleCatalog);
158  
159           Application.getInstance().getImportExportCtl().exportCatalogXML(
160                   outputXML, testCat);
161       }
162  
163       @Test
164       public void importAndExportAspectsXML() throws ResiIOException {
165           Aspects testAsp = Application.getInstance().getImportExportCtl()
166                   .importAspectsXML(exampleAspects);
167  
168           Application.getInstance().getImportExportCtl().exportAspectsXML(
169                   outputXML, testAsp);
170       }
171  
172       @Test
173       public void exportMeetingProtocolPDF() throws ResiIOException, IOException,
174               ApplicationException, ExportException, DataException {
175           Application.getInstance().getApplicationCtl().loadReview(
176                   exampleReviewZIP);
177  
178           Application.getInstance().getImportExportCtl()
179                   .exportMeetingProtocolPDF(
180                           outputPDF,
181                           Data.getInstance().getResiData().getReview()
182                                   .getMeetings().get(0), true, true, true);
183       }
184  
185       @Test
186       public void exportReviewProtocolPDF() throws ExportException,
187               DataException, ResiIOException, IOException, ApplicationException {
188           Application.getInstance().getApplicationCtl().loadReview(
189                   exampleReviewZIP);
190  
191           Application.getInstance().getImportExportCtl().exportReviewProtocolPDF(
192                   outputPDF, true, true, true);
193       }
194  
195       @Test
196       public void exportMeetingFindingsCSV() throws ExportException,
197               ApplicationException, DataException, ResiIOException, IOException {
198           Application.getInstance().getApplicationCtl().loadReview(
199                   exampleReviewZIP);
200  
201           Application.getInstance().getImportExportCtl()
202                   .exportMeetingFindingsCSV(
203                           outputCSV,
204                           Data.getInstance().getAppData().getCSVProfile("Trac"),
205                           Data.getInstance().getResiData().getReview()
206                                   .getMeetings().get(0), null, "Hans Moddi");
207       }
208  
209       @Test(expected = ApplicationException.class)
210       public void exportMeetingFindingsCSVEmpty() throws ExportException,
211               ApplicationException, DataException, ResiIOException, IOException {
212           Application.getInstance().getApplicationCtl().loadReview(
213                   exampleReviewZIP);
214  
215           Meeting meet = Data.getInstance().getResiData().getReview()
216                   .getMeetings().get(0);
217           meet.setProtocol(null);
218  
219           Application.getInstance().getImportExportCtl()
220                   .exportMeetingFindingsCSV(outputCSV,
221                           Data.getInstance().getAppData().getCSVProfile("Trac"),
222                           meet, null, "Hans Moddi");
223       }
224  
225       @Test
226       public void exportReviewFindingsCSV() throws ResiIOException, IOException,
227               ApplicationException, ExportException, DataException {
228           Application.getInstance().getApplicationCtl().loadReview(
229                   exampleReviewZIP);
230  
231           Application.getInstance().getImportExportCtl().exportReviewFindingsCSV(
232                   outputCSV,
233                   Data.getInstance().getAppData().getCSVProfile("Trac"), null,
234                   "Hans Moddi");
235       }
236  
237       @Test(expected = ApplicationException.class)
238       public void exportReviewFindingsCSVEmpty() throws ResiIOException,
239               IOException, ApplicationException, ExportException, DataException {
240           Application.getInstance().getApplicationCtl().loadReview(
241                   exampleReviewZIP);
242  
243           for (Meeting m : Data.getInstance().getResiData().getReview()
244                   .getMeetings()) {
245               m.setProtocol(null);
246           }
247  
248           Application.getInstance().getImportExportCtl().exportReviewFindingsCSV(
249                   outputCSV,
250                   Data.getInstance().getAppData().getCSVProfile("Trac"), null,
251                   "Hans Moddi");
252       }
253  
254       @Test
255       public void exportInvitationsPDF() throws ExportException, DataException,
256               ResiIOException, IOException, ApplicationException {
257           Application.getInstance().getApplicationCtl().loadReview(
258                   exampleReviewZIP);
259  
260           Application.getInstance().getImportExportCtl().exportInvitations(
261                   outputDir,
262                   ImportExportControl.InvitationType.PDF,
263                   Data.getInstance().getResiData().getReview().getMeetings().get(
264                           0),
265                   Data.getInstance().getResiData().getReview().getAttendees()
266                           .get(0), true);
267       }
268  
269       @Test
270       public void exportInvitationsDir() throws ResiIOException, IOException,
271               ApplicationException, ExportException, DataException {
272           Application.getInstance().getApplicationCtl().loadReview(
273                   exampleReviewZIP);
274  
275           Application.getInstance().getImportExportCtl().exportInvitations(
276                   outputDir,
277                   ImportExportControl.InvitationType.DIRECTORY,
278                   Data.getInstance().getResiData().getReview().getMeetings().get(
279                           0),
280                   Data.getInstance().getResiData().getReview().getAttendees()
281                           .get(0), true);
282       }
283  
284       @Test
285       public void exportInvitationsZIP() throws ExportException, DataException,
286               ResiIOException, IOException, ApplicationException {
287           Application.getInstance().getApplicationCtl().loadReview(
288                   exampleReviewZIP);
289  
290           Application.getInstance().getImportExportCtl().exportInvitations(
291                   outputDir,
292                   ImportExportControl.InvitationType.ZIP,
293                   Data.getInstance().getResiData().getReview().getMeetings().get(
294                           0),
295                   Data.getInstance().getResiData().getReview().getAttendees()
296                           .get(0), true);
297       }
298  
299       @Test
300       public void testResiFileFilter() {
301           File homeDir = new File(System.getProperty("user.home"));
302           File directory = new File("/ein/Verzeichnis/");
303           ResiFileFilter ff;
304  
305           ff = new ResiFileFilter(ResiFileFilter.TYPE_ALL);
306           assertTrue(ff.accept(directory, "test.doc"));
307           assertTrue(ff.accept(directory, "test"));
308           assertTrue(ff.accept(directory, "test.blabla"));
309           ff.getDescription();
310  
311           ff = new ResiFileFilter(ResiFileFilter.TYPE_ASPECTS);
312           assertTrue(ff.accept(directory, "test."
313                   + Data.getInstance().getResource("fileEndingAspects")));
314           assertTrue(ff.accept(directory, "test.xml"));
315           assertFalse(ff.accept(directory, "test.csv"));
316           ff.getDescription();
317  
318           ff = new ResiFileFilter(ResiFileFilter.TYPE_CATALOG);
319           assertTrue(ff.accept(directory, "test."
320                   + Data.getInstance().getResource("fileEndingCatalog")));
321           assertTrue(ff.accept(directory, "test.xml"));
322           assertFalse(ff.accept(directory, "test.csv"));
323           ff.getDescription();
324  
325           ff = new ResiFileFilter(ResiFileFilter.TYPE_CSV);
326           assertTrue(ff.accept(directory, "test.csv"));
327           assertTrue(ff.accept(directory, "test.txt"));
328           assertFalse(ff.accept(directory, "test.xml"));
329           ff.getDescription();
330  
331           ff = new ResiFileFilter(ResiFileFilter.TYPE_DIRECTORY);
332           assertTrue(ff.accept(homeDir, ""));
333           assertFalse(ff.accept(directory, "test.xml"));
334           ff.getDescription();
335  
336           ff = new ResiFileFilter(ResiFileFilter.TYPE_PDF);
337           assertTrue(ff.accept(directory, "test.pdf"));
338           assertFalse(ff.accept(directory, "test.xml"));
339           ff.getDescription();
340  
341           ff = new ResiFileFilter(ResiFileFilter.TYPE_ZIP);
342           assertTrue(ff.accept(directory, "test.zip"));
343           assertFalse(ff.accept(directory, "test.xml"));
344           ff.getDescription();
345  
346           ff = new ResiFileFilter(ResiFileFilter.TYPE_REVIEW);
347           assertTrue(ff.accept(directory, "test."
348                   + Data.getInstance().getResource("fileEndingReviewXML")));
349           assertTrue(ff.accept(directory, "test."
350                   + Data.getInstance().getResource("fileEndingReviewZIP")));
351           assertTrue(ff.accept(directory, "test.xml"));
352           assertFalse(ff.accept(directory, "test.csv"));
353           ff.getDescription();
354  
355           /*
356            * Invalid type accepts all
357            */
358           ff = new ResiFileFilter(9999999);
359           assertTrue(ff.accept(directory, "test.zip"));
360           ff.getDescription();
361       }
362  
363       @AfterClass
364       public static void cleanUp() {
365           FileTools.deleteDirectory(new File(Data.getInstance().getAppData()
366                   .getAppDataPath()));
367  
368           new File(outputPDF).delete();
369           new File(outputCSV).delete();
370           new File(outputZIP).delete();
371           FileTools.deleteDirectory(new File(outputDir));
372  
373           FileTools.deleteDirectory(new File(tempDirectory));
374       }
375  
376   }
ApplicationDataTest.java
55   public class ApplicationDataTest {
56  
57       private static ApplicationData appData;
58  
59       @Test
60       public void resetAndInitializeDatabase() throws SQLException, DataException {
61           appData = Data.getInstance().getAppData();
62  
63           assertEquals("", appData.getAppDataPath());
64  
65           appData.setCustomAppDataDirectory("org/revager/test/");
66           appData.setCustomAppDataDirectory("org/revager/test");
67           assertEquals("org/revager/test/", appData.getCustomAppDataDirectory());
68  
69           appData.initialize();
70  
71           assertTrue(appData.getAppDataPath().startsWith("org/revager/test/"));
72  
73           appData.resetDatabase();
74  
75           appData.initialize();
76       }
77  
78       @Test
79       public void tryToNotifyObservers() {
80           appData.fireDataChanged();
81       }
82  
83       @Test
84       public void getUnsetAppSetting() throws DataException {
85           String settingStr = appData
86                   .getSetting(AppSettingKey.APP_LAST_REVIEW_PATH);
87           assertNull(settingStr);
88  
89           AppSettingValue settingVal = appData
90                   .getSettingValue(AppSettingKey.APP_LAST_REVIEW_PATH);
91           assertNull(settingVal);
92       }
93  
94       @Test
95       public void setUnsetAppSetting() throws DataException {
96           appData.setSetting(AppSettingKey.PDF_INVITATION_FOOT_TEXT,
97                   "some foot text...");
98       }
99  
100       @Test
101       public void getAndSetAppSettings() throws DataException {
102           /*
103            * Test AppSettingValue
104            */
105           appData.setSettingValue(AppSettingKey.APP_DO_AUTO_SAVE,
106                   AppSettingValue.FALSE);
107           AppSettingValue setting1 = appData
108                   .getSettingValue(AppSettingKey.APP_DO_AUTO_SAVE);
109           assertEquals(AppSettingValue.FALSE, setting1);
110  
111           /*
112            * Test String
113            */
114           appData.setSetting(AppSettingKey.PDF_INVITATION_TEXT, "Hallo Welt");
115           String setting2String = appData
116                   .getSetting(AppSettingKey.PDF_INVITATION_TEXT);
117           assertEquals("Hallo Welt", setting2String);
118  
119           /*
120            * Test combination
121            */
122           AppSettingValue setting2Value = appData
123                   .getSettingValue(AppSettingKey.PDF_INVITATION_TEXT);
124           assertEquals(AppSettingValue.INVALID_VALUE, setting2Value);
125       }
126  
127       @Test
128       public void addAndRemoveLastReviews() throws DataException {
129           String review1 = "/home/jojo/Review_no1.rev";
130           String review2 = "/home/tester/review_2.rev";
131           String review3 = "/tmp/Review_temp.rev";
132  
133           /*
134            * Add reviews
135            */
136           appData.addLastReview(review1);
137           appData.addLastReview(review2);
138           appData.addLastReview(review3);
139           appData.addLastReview(review1);
140  
141           Iterator<String> iter = appData.getLastReviews().iterator();
142  
143           assertEquals(review1, iter.next());
144           assertEquals(review3, iter.next());
145           assertEquals(review2, iter.next());
146  
147           /*
148            * Remove review
149            */
150           appData.removeLastReview(review3);
151  
152           iter = appData.getLastReviews().iterator();
153  
154           assertEquals(review1, iter.next());
155           assertEquals(review2, iter.next());
156       }
157  
158       @Test
159       public void getEmptyCatalogList() throws DataException {
160           assertTrue(appData.getCatalogs().isEmpty());
161           assertEquals(0, appData.getNumberOfCatalogs());
162       }
163  
164       @Test
165       public void removeAllCatalogData() throws DataException {
166           for (AppCatalog catalog : appData.getCatalogs()) {
167               for (String category : catalog.getCategories()) {
168                   for (AppAspect aspect : catalog.getAspects(category)) {
169                       catalog.removeAspect(aspect);
170                   }
171               }
172  
173               appData.removeCatalog(catalog);
174           }
175  
176           assertTrue(appData.getCatalogs().isEmpty());
177           assertEquals(0, appData.getNumberOfCatalogs());
178       }
179  
180       @Test
181       public void getAndSetNameOfCatalog() throws DataException {
182           AppCatalog cat = appData.newCatalog("Testkatalog Nr. 1");
183           cat.setName("Neuer Name");
184  
185           assertEquals("Neuer Name", cat.getName());
186           assertEquals("Neuer Name", appData.getCatalog("Neuer Name").getName());
187       }
188  
189       @Test(expected = DataException.class)
190       public void setExistingNameOfCatalog() throws DataException {
191           removeAllCatalogData();
192  
193           AppCatalog cat1 = appData.newCatalog("Testkatalog Nr. 1");
194           AppCatalog cat2 = appData.newCatalog("Testkatalog Nr. 2");
195  
196           cat1.setName(cat2.getName());
197       }
198  
199       @Test
200       public void addAndRemoveCatalogs() throws DataException {
201           removeAllCatalogData();
202  
203           String catalog1 = "Testkatalog Nr. 1";
204           String catalog2 = "Weiterer Testkatalog";
205           String catalog3 = "Testkatalog der dritte";
206           String catalog4 = "Unbekannter Katalog";
207  
208           /*
209            * Add catalogs
210            */
211           appData.newCatalog(catalog1);
212           appData.newCatalog(catalog2);
213           appData.newCatalog(catalog3);
214  
215           assertEquals(3, appData.getNumberOfCatalogs());
216  
217           /*
218            * Search for an unknown catalog
219            */
220           assertNull(appData.getCatalog(catalog4));
221  
222           /*
223            * Test if catalogs are in the list
224            */
225           Iterator<AppCatalog> iter = appData.getCatalogs().iterator();
226  
227           assertEquals(catalog1, iter.next().getName());
228           assertEquals(catalog2, iter.next().getName());
229           assertEquals(catalog3, iter.next().getName());
230  
231           /*
232            * Remove catalog
233            */
234           appData.removeCatalog(catalog2);
235  
236           assertNull(appData.getCatalog(catalog2));
237           assertEquals(2, appData.getNumberOfCatalogs());
238  
239           iter = appData.getCatalogs().iterator();
240  
241           assertEquals(catalog1, iter.next().getName());
242           assertEquals(catalog3, iter.next().getName());
243  
244           /*
245            * Get sorting positions of catalogs
246            */
247           assertEquals(1, appData.getFirstSortPosOfCatalogs());
248           assertEquals(3, appData.getLastSortPosOfCatalogs());
249       }
250  
251       @Test
252       public void pushCatalogs() throws DataException {
253           removeAllCatalogData();
254  
255           AppCatalog catalog1 = appData.newCatalog("Testkatalog Nr. 1");
256           AppCatalog catalog2 = appData.newCatalog("Weiterer Katalog");
257           AppCatalog catalog3 = appData.newCatalog("Testkatalog der dritte");
258           AppCatalog catalog4 = appData.newCatalog("Letzter Katalog");
259  
260           /*
261            * Test the order of catalogs
262            */
263           Iterator<AppCatalog> iter = appData.getCatalogs().iterator();
264  
265           assertEquals(catalog1, iter.next());
266           assertEquals(catalog2, iter.next());
267           assertEquals(catalog3, iter.next());
268           assertEquals(catalog4, iter.next());
269  
270           /*
271            * Test the filter for getting catalogs
272            */
273           iter = appData.getCatalogs("testkatalo").iterator();
274  
275           assertEquals(catalog1, iter.next());
276           assertEquals(catalog3, iter.next());
277  
278           /*
279            * Push some catalogs
280            */
281           catalog4.pushUp();
282           catalog1.pushDown();
283  
284           /*
285            * Test the order of catalogs
286            */
287           iter = appData.getCatalogs().iterator();
288  
289           assertEquals(catalog2, iter.next());
290           assertEquals(catalog1, iter.next());
291           assertEquals(catalog4, iter.next());
292           assertEquals(catalog3, iter.next());
293  
294           /*
295            * Push some catalogs
296            */
297           catalog1.pushBottom();
298           catalog3.pushTop();
299  
300           /*
301            * Test the order of catalogs
302            */
303           iter = appData.getCatalogs().iterator();
304  
305           assertEquals(catalog3, iter.next());
306           assertEquals(catalog2, iter.next());
307           assertEquals(catalog4, iter.next());
308           assertEquals(catalog1, iter.next());
309       }
310  
311       @Test(expected = DataException.class)
312       public void setExistingNameOfCategory() throws DataException {
313           removeAllCatalogData();
314  
315           AppCatalog catalog = appData.newCatalog("Testkatalog Nr. 1");
316  
317           catalog.newAspect("Direktive", "Beschreibung", "Eine Kategorie");
318           catalog.newAspect("Direktive", "Beschreibung", "Andere Kategorie");
319  
320           catalog.editCategory("Eine Kategorie", "Andere Kategorie");
321       }
322  
323       @Test
324       public void modifyAndManageCatalog() throws DataException {
325           removeAllCatalogData();
326  
327           AppCatalog catalog = appData.newCatalog("Testkatalog Nr. 1");
328  
329           /*
330            * Add aspects to the catalog
331            */
332           AppAspect aspect1 = catalog
333                   .newAspect(
334                           "Positionierung der Buttons prüfen",
335                           "Vor allem die Andordnung der Buttons soll auf Usability geprüft werden.",
336                           "GUI");
337           AppAspect aspect2 = catalog
338                   .newAspect(
339                           "Lesbarkeit der Schrift prüfen",
340                           "Die Schriftgröße, Schriftart sowie die Schriftfarbe sollen überprüft werden.",
341                           "GUI");
342           AppAspect aspect3 = catalog.newAspect("Tue dies und das",
343                   "Beschreibung, was zu tun ist.", "Neue Kategorie");
344           AppAspect aspect4 = catalog
345                   .newAspect(
346                           "Skalierbarkeit der Fenster prüfen",
347                           "Es soll überprüft werden, ob die Größe der Fenster gut skalierbar sind.",
348                           "GUI");
349           AppAspect aspect5 = catalog.newAspect("Direktive", "Beschreibung",
350                   "Weitere Kategorie");
351           AppAspect aspect6 = catalog.newAspect("Direktive", "Beschreibung",
352                   "Noch eine Kategorie");
353  
354           /*
355            * Test the toString() methods
356            */
357           assertEquals("Testkatalog Nr. 1", catalog.toString());
358           assertEquals("Skalierbarkeit der Fenster prüfen", aspect4.toString());
359  
360           /*
361            * Check number of categories and number of aspects
362            */
363           assertEquals(4, catalog.getNumberOfCategories());
364           assertEquals(6, catalog.getNumberOfAspects());
365           assertEquals(3, catalog.getNumberOfAspects("GUI"));
366           assertEquals(1, catalog.getNumberOfAspects("Neue Kategorie"));
367           assertEquals(1, catalog.getNumberOfAspects("Weitere Kategorie"));
368           assertEquals(1, catalog.getNumberOfAspects("Noch eine Kategorie"));
369  
370           /*
371            * Try to get filtered categories and aspects
372            */
373           assertEquals(3, catalog.getCategories("Kategorie").size());
374           assertEquals(1, catalog.getCategories("GUI").size());
375           assertEquals(0, catalog.getCategories("Gibts nicht!").size());
376  
377           assertEquals(3, catalog.getAspects("GUI", "prüfen").size());
378           assertEquals(1, catalog.getAspects("GUI", "Skalierbarkeit").size());
379           assertEquals(0, catalog.getAspects("GUI",
380                   "Sowas gibts einfach nicht...").size());
381  
382           /*
383            * Test if the categories exist and their order
384            */
385           assertTrue(catalog.isCategory("GUI"));
386           assertTrue(catalog.isCategory("Noch eine Kategorie"));
387           assertFalse(catalog.isCategory("Unbekannte Kategorie"));
388  
389           Iterator<String> iterCategories = catalog.getCategories().iterator();
390           assertEquals("GUI", iterCategories.next());
391           assertEquals("Neue Kategorie", iterCategories.next());
392           assertEquals("Weitere Kategorie", iterCategories.next());
393           assertEquals("Noch eine Kategorie", iterCategories.next());
394  
395           catalog.pushUpCategory("Weitere Kategorie");
396           catalog.pushDownCategory("Noch eine Kategorie");
397           catalog.pushDownCategory("Neue Kategorie");
398  
399           iterCategories = catalog.getCategories().iterator();
400           assertEquals("GUI", iterCategories.next());
401           assertEquals("Weitere Kategorie", iterCategories.next());
402           assertEquals("Noch eine Kategorie", iterCategories.next());
403           assertEquals("Neue Kategorie", iterCategories.next());
404  
405           catalog.pushTopCategory("Noch eine Kategorie");
406           catalog.pushBottomCategory("GUI");
407  
408           iterCategories = catalog.getCategories().iterator();
409           assertEquals("Noch eine Kategorie", iterCategories.next());
410           assertEquals("Weitere Kategorie", iterCategories.next());
411           assertEquals("Neue Kategorie", iterCategories.next());
412           assertEquals("GUI", iterCategories.next());
413  
414           /*
415            * Test editCategory method
416            */
417           catalog.editCategory("Weitere Kategorie", "Eine andere Kategorie");
418  
419           Iterator<AppAspect> iterAspects = catalog.getAspects(
420                   "Eine andere Kategorie").iterator();
421           assertEquals(aspect5, iterAspects.next());
422  
423           /*
424            * Remove aspect and check if the category is also deleted
425            */
426           catalog.removeAspect(aspect6);
427  
428           assertEquals(0, catalog.getNumberOfAspects("Noch eine Kategorie"));
429           assertFalse(catalog.isCategory("Noch eine Kategorie"));
430  
431           /*
432            * Test if aspects are in the catalog (category GUI)
433            */
434           iterAspects = catalog.getAspects("GUI").iterator();
435           assertEquals(aspect1, iterAspects.next());
436           assertEquals(aspect2, iterAspects.next());
437           assertEquals(aspect4, iterAspects.next());
438  
439           /*
440            * Move aspect into an existing category
441            */
442           aspect5.setCategory("GUI");
443  
444           iterAspects = catalog.getAspects("GUI").iterator();
445           assertEquals(aspect1, iterAspects.next());
446           assertEquals(aspect2, iterAspects.next());
447           assertEquals(aspect4, iterAspects.next());
448           assertEquals(aspect5, iterAspects.next());
449  
450           /*
451            * Move aspect into a new category
452            */
453           aspect5.setCategory("Bewertung");
454  
455           iterAspects = catalog.getAspects("Bewertung").iterator();
456           assertEquals(aspect5, iterAspects.next());
457  
458           /*
459            * Modify aspect's properties
460            */
461           aspect5.setDirective("Eine neue Direktive");
462           aspect5.setDescription("Eine neue Beschreibung");
463  
464           assertEquals("Eine neue Direktive", aspect5.getDirective());
465           assertEquals("Eine neue Beschreibung", aspect5.getDescription());
466  
467           /*
468            * Test the getAspect method
469            */
470           assertEquals(aspect3, catalog.getAspect(aspect3.getId()));
471           assertEquals(aspect5, catalog.getAspect(aspect5.getId()));
472       }
473  
474       @Test
475       public void pushAspects() throws DataException {
476           removeAllCatalogData();
477  
478           AppCatalog catalog = appData.newCatalog("Testkatalog");
479  
480           AppAspect aspect1 = catalog.newAspect("Direktive 1", "Beschreibung",
481                   "Eine Kategorie");
482           AppAspect aspect2 = catalog.newAspect("Direktive 2", "Beschreibung",
483                   "Eine Kategorie");
484           AppAspect aspect3 = catalog.newAspect("Direktive 3", "Beschreibung",
485                   "Eine Kategorie");
486           AppAspect aspect4 = catalog.newAspect("Direktive 4", "Beschreibung",
487                   "Eine Kategorie");
488           AppAspect aspect5 = catalog.newAspect("Direktive 5", "Beschreibung",
489                   "Eine Kategorie");
490  
491           /*
492            * Original order
493            */
494           Iterator<AppAspect> iterAspects = catalog.getAspects("Eine Kategorie")
495                   .iterator();
496           assertEquals(aspect1, iterAspects.next());
497           assertEquals(aspect2, iterAspects.next());
498           assertEquals(aspect3, iterAspects.next());
499           assertEquals(aspect4, iterAspects.next());
500           assertEquals(aspect5, iterAspects.next());
501  
502           /*
503            * Push aspects
504            */
505           aspect2.pushUp();
506           aspect3.pushDown();
507  
508           iterAspects = catalog.getAspects("Eine Kategorie").iterator();
509           assertEquals(aspect2, iterAspects.next());
510           assertEquals(aspect1, iterAspects.next());
511           assertEquals(aspect4, iterAspects.next());
512           assertEquals(aspect3, iterAspects.next());
513           assertEquals(aspect5, iterAspects.next());
514  
515           /*
516            * Push aspects
517            */
518           aspect5.pushBottom();
519           aspect2.pushBottom();
520           aspect3.pushTop();
521  
522           iterAspects = catalog.getAspects("Eine Kategorie").iterator();
523           assertEquals(aspect3, iterAspects.next());
524           assertEquals(aspect1, iterAspects.next());
525           assertEquals(aspect4, iterAspects.next());
526           assertEquals(aspect5, iterAspects.next());
527           assertEquals(aspect2, iterAspects.next());
528       }
529  
530       @Test
531       public void getStringRepOfEmptyAspect() throws DataException {
532           removeAllCatalogData();
533  
534           AppCatalog catalog = appData.newCatalog("Testkatalog");
535  
536           AppAspect asp = new AppAspect(catalog, 5);
537  
538           assertEquals("", asp.toString());
539       }
540  
541       @Test
542       public void convertToResiAspect() throws DataException {
543           removeAllCatalogData();
544  
545           AppCatalog catalog = appData.newCatalog("Testkatalog");
546  
547           AppAspect appAsp = catalog.newAspect("Test-Direktive",
548                   "Test-Beschreibung", "Test-Kategorie");
549  
550           Aspect resiAsp = appAsp.getAsResiAspect();
551  
552           assertEquals("Test-Direktive", resiAsp.getDirective());
553           assertEquals("Test-Beschreibung", resiAsp.getDescription());
554           assertEquals("Test-Kategorie", resiAsp.getCategory());
555       }
556  
557       @Test
558       public void getEmptyAttendeeList() throws DataException {
559           assertTrue(appData.getAttendees().isEmpty());
560           assertEquals(0, appData.getNumberOfAttendees());
561       }
562  
563       @Test
564       public void removeAllAttendeeData() throws DataException {
565           for (AppAttendee att : appData.getAttendees()) {
566               appData.removeAttendee(att);
567           }
568  
569           assertTrue(appData.getAttendees().isEmpty());
570           assertEquals(0, appData.getNumberOfAttendees());
571       }
572  
573       @Test
574       public void getAndSetNameOfAttendee() throws DataException {
575           AppAttendee att = appData.newAttendee("Franz Faller", "Kontakt...");
576  
577           assertEquals("Franz Faller", att.getName());
578  
579           att.setName("Heinz Herbert");
580           att.setContact("Neuer Kontakt");
581  
582           assertEquals("Heinz Herbert", att.getName());
583  
584           assertEquals("Heinz Herbert", appData.getAttendee("Heinz Herbert",
585                   "Neuer Kontakt").getName());
586       }
587  
588       @Test(expected = DataException.class)
589       public void setExistingNameOfAttendee() throws DataException {
590           removeAllAttendeeData();
591  
592           AppAttendee att1 = appData.newAttendee("Franz Faller", "Kontakt...");
593           AppAttendee att2 = appData.newAttendee("Heinz Herbert", "Kontakt...");
594  
595           att1.setNameAndContact(att2.getName(), att2.getContact());
596       }
597  
598       @Test
599       public void addAndRemoveAttendees() throws DataException {
600           removeAllAttendeeData();
601  
602           /*
603            * Add attendees
604            */
605           AppAttendee att1 = appData.newAttendee("Franz Faller", "Kontakt...");
606           AppAttendee att2 = appData.newAttendee("Heinz Herbert", "Kontakt...");
607           AppAttendee att3 = appData.newAttendee("Albert Einstein", "Kontakt...");
608           AppAttendee att4 = appData.newAttendee("Klaus Kohl", "Kontakt...");
609           AppAttendee att5 = appData.newAttendee("Berta Brecht", "Kontakt...");
610  
611           assertEquals(5, appData.getNumberOfAttendees());
612  
613           /*
614            * Search for an unknown attendee
615            */
616           assertNull(appData.getCatalog("Mr. X"));
617  
618           /*
619            * Test if attendees are in the list in the right order
620            */
621           Iterator<AppAttendee> iter = appData.getAttendees().iterator();
622  
623           assertEquals(att3, iter.next());
624           assertEquals(att5, iter.next());
625           assertEquals(att1, iter.next());
626           assertEquals(att2, iter.next());
627           assertEquals(att4, iter.next());
628  
629           /*
630            * Test to filter the attendees
631            */
632           iter = appData.getAttendees("ErT").iterator();
633  
634           assertEquals(att3, iter.next());
635           assertEquals(att5, iter.next());
636           assertEquals(att2, iter.next());
637  
638           /*
639            * Remove attendees
640            */
641           appData.removeAttendee(att3);
642           appData.removeAttendee(att1.getName(), att1.getContact());
643  
644           assertNull(appData.getAttendee(att3.getName(), att3.getContact()));
645           assertNull(appData.getAttendee(att1.getName(), att1.getContact()));
646           assertEquals(3, appData.getNumberOfAttendees());
647  
648           iter = appData.getAttendees().iterator();
649  
650           assertEquals(att5, iter.next());
651           assertEquals(att2, iter.next());
652           assertEquals(att4, iter.next());
653       }
654  
655       @Test
656       public void modifyAttendee() throws DataException {
657           removeAllAttendeeData();
658  
659           AppAttendee attendee = appData.newAttendee("Franz Faller",
660                   "Kontakt-Infos des Teilnehmers usw usw usw");
661  
662           assertTrue(attendee.getStrengths().isEmpty());
663  
664           /*
665            * Test the toString() method
666            */
667           assertEquals(attendee.getName() + " ("
668                   + attendee.getContact().substring(0, 20) + "...)", attendee
669                   .toString());
670  
671           /*
672            * Modify contact
673            */
674           attendee.setContact("Tel. 0711-123456, eMail: franz.faller@company.de");
675           assertEquals("Tel. 0711-123456, eMail: franz.faller@company.de",
676                   attendee.getContact());
677  
678           /*
679            * Test to filter the attendees by contact
680            */
681           Iterator<AppAttendee> iterAttendees = appData
682                   .getAttendees("Company.de").iterator();
683  
684           assertEquals(attendee, iterAttendees.next());
685  
686           /*
687            * Add strengths to attendee
688            */
689           attendee.addStrength("GUI");
690           attendee.addStrength("User Interface");
691           attendee.addStrength("Business-Logik");
692           attendee.addStrength("Usability");
693  
694           Iterator<String> iterStrengths = attendee.getStrengths().iterator();
695  
696           assertEquals("Business-Logik", iterStrengths.next());
697           assertEquals("GUI", iterStrengths.next());
698           assertEquals("Usability", iterStrengths.next());
699           assertEquals("User Interface", iterStrengths.next());
700  
701           /*
702            * Remove strengths
703            */
704           attendee.removeStrength("Usability");
705           attendee.removeStrength("Business-Logik");
706  
707           iterStrengths = attendee.getStrengths().iterator();
708  
709           assertEquals("GUI", iterStrengths.next());
710           assertEquals("User Interface", iterStrengths.next());
711  
712           /*
713            * Try to add already existing strength
714            */
715           assertTrue(attendee.isStrength("GUI"));
716           attendee.addStrength("GUI");
717  
718           iterStrengths = attendee.getStrengths().iterator();
719  
720           assertEquals("GUI", iterStrengths.next());
721           assertEquals("User Interface", iterStrengths.next());
722  
723           /*
724            * Try to remove non-existing strength
725            */
726           assertFalse(attendee.isStrength("Unbekannte Kategorie"));
727           attendee.removeStrength("Unbekannte Kategorie");
728  
729           iterStrengths = attendee.getStrengths().iterator();
730  
731           assertEquals("GUI", iterStrengths.next());
732           assertEquals("User Interface", iterStrengths.next());
733       }
734  
735       @Test
736       public void convertToResiAttendee() throws DataException {
737           removeAllAttendeeData();
738  
739           AppAttendee attendee = appData.newAttendee("Ein Teilnehmer",
740                   "Kontakt...");
741           attendee.setContact("Kontaktadresse des Teilnehmers");
742  
743           Attendee resiAtt = attendee.getAsResiAttendee();
744  
745           assertEquals("Ein Teilnehmer", resiAtt.getName());
746           assertEquals("Kontaktadresse des Teilnehmers", resiAtt.getContact());
747       }
748  
749       @Test
750       public void removeAllCSVProfileData() throws DataException {
751           for (AppCSVProfile prof : appData.getCSVProfiles()) {
752               appData.removeCSVProfile(prof);
753           }
754  
755           assertTrue(appData.getCSVProfiles().isEmpty());
756           assertEquals(0, appData.getNumberOfCSVProfiles());
757       }
758  
759       @Test
760       public void getAndSetNameOfCSVProfile() throws DataException {
761           AppCSVProfile prof = appData.newCSVProfile("Trac");
762  
763           assertEquals("Trac", prof.getName());
764  
765           prof.setName("Trac Bugtracker");
766  
767           assertEquals("Trac Bugtracker", prof.getName());
768  
769           assertEquals("Trac Bugtracker", appData
770                   .getCSVProfile("Trac Bugtracker").getName());
771       }
772  
773       @Test(expected = DataException.class)
774       public void setExistingNameOfCSVProfile() throws DataException {
775           removeAllCSVProfileData();
776  
777           AppCSVProfile prof1 = appData.newCSVProfile("Trac");
778           AppCSVProfile prof2 = appData.newCSVProfile("Bugzilla");
779  
780           prof1.setName(prof2.getName());
781       }
782  
783       @Test
784       public void addAndRemoveCSVProfiles() throws DataException {
785           removeAllCSVProfileData();
786  
787           /*
788            * Add profiles
789            */
790           AppCSVProfile prof1 = appData.newCSVProfile("Trac Bug-Tracker");
791           AppCSVProfile prof2 = appData.newCSVProfile("Bugzilla");
792           AppCSVProfile prof3 = appData.newCSVProfile("Another Tracker");
793           AppCSVProfile prof4 = appData.newCSVProfile("H2O Bug-Tracker");
794  
795           assertEquals(4, appData.getNumberOfCSVProfiles());
796  
797           /*
798            * Search for an unknown profile
799            */
800           assertNull(appData.getCatalog("Unknown Tracker"));
801  
802           /*
803            * Test if profiles are in the list in the right order
804            */
805           Iterator<AppCSVProfile> iter = appData.getCSVProfiles().iterator();
806  
807           assertEquals(prof3, iter.next());
808           assertEquals(prof2, iter.next());
809           assertEquals(prof4, iter.next());
810           assertEquals(prof1, iter.next());
811  
812           /*
813            * Test to filter the profiles
814            */
815           iter = appData.getCSVProfiles("racker").iterator();
816  
817           assertEquals(prof3, iter.next());
818           assertEquals(prof4, iter.next());
819  
820           /*
821            * Remove profiles
822            */
823           appData.removeCSVProfile(prof3);
824           appData.removeCSVProfile(prof4.getName());
825  
826           assertNull(appData.getCSVProfile(prof3.getName()));
827           assertNull(appData.getCSVProfile(prof4.getName()));
828           assertEquals(2, appData.getNumberOfCSVProfiles());
829  
830           iter = appData.getCSVProfiles().iterator();
831  
832           assertEquals(prof2, iter.next());
833           assertEquals(prof1, iter.next());
834       }
835  
836       @Test
837       public void modifyCSVProfile() throws DataException {
838           removeAllCSVProfileData();
839  
840           AppCSVProfile prof = appData.newCSVProfile("Trac Bug-Tracker");
841  
842           /*
843            * Test the toString() method
844            */
845           assertEquals("Trac Bug-Tracker", prof.toString());
846  
847           /*
848            * Get standard order of columns
849            */
850           Iterator<AppCSVColumnName> iter = prof.getColumnOrder().iterator();
851           assertEquals(AppCSVColumnName.DESCRIPTION, iter.next());
852           assertEquals(AppCSVColumnName.REFERENCE, iter.next());
853           assertEquals(AppCSVColumnName.SEVERITY, iter.next());
854           assertEquals(AppCSVColumnName.REPORTER, iter.next());
855  
856           /*
857            * Change order of columns
858            */
859           List<AppCSVColumnName> colOrd = new ArrayList<AppCSVColumnName>();
860           colOrd.add(AppCSVColumnName.REPORTER);
861           colOrd.add(AppCSVColumnName.SEVERITY);
862           colOrd.add(AppCSVColumnName.DESCRIPTION);
863           colOrd.add(AppCSVColumnName.REFERENCE);
864  
865           prof.setColumnOrder(colOrd);
866  
867           iter = prof.getColumnOrder().iterator();
868           assertEquals(AppCSVColumnName.REPORTER, iter.next());
869           assertEquals(AppCSVColumnName.SEVERITY, iter.next());
870           assertEquals(AppCSVColumnName.DESCRIPTION, iter.next());
871           assertEquals(AppCSVColumnName.REFERENCE, iter.next());
872  
873           /*
874            * Get and set property colsInFirstLine
875            */
876           prof.isColsInFirstLine();
877  
878           prof.setColsInFirstLine(true);
879           assertTrue(prof.isColsInFirstLine());
880  
881           prof.setColsInFirstLine(false);
882           assertFalse(prof.isColsInFirstLine());
883  
884           /*
885            * Get and set property encapsulateContent
886            */
887           prof.isEncapsulateContent();
888  
889           prof.setEncapsulateContent(false);
890           assertFalse(prof.isEncapsulateContent());
891  
892           prof.setEncapsulateContent(true);
893           assertTrue(prof.isEncapsulateContent());
894  
895           /*
896            * Get and set column mappings
897            */
898           prof.setColumnMapping(AppCSVColumnName.DESCRIPTION, "beschreibung");
899           assertEquals("beschreibung", prof
900                   .getColumnMapping(AppCSVColumnName.DESCRIPTION));
901  
902           prof.setColumnMapping(AppCSVColumnName.REFERENCE, "link");
903           assertEquals("link", prof.getColumnMapping(AppCSVColumnName.REFERENCE));
904  
905           prof.setColumnMapping(AppCSVColumnName.REPORTER, "melder");
906           assertEquals("melder", prof.getColumnMapping(AppCSVColumnName.REPORTER));
907  
908           prof.removeColumnMapping(AppCSVColumnName.REFERENCE);
909           assertEquals(prof.getColumnMapping(AppCSVColumnName.REFERENCE), prof
910                   .getColumnMapping(AppCSVColumnName.REFERENCE));
911           assertEquals("melder", prof.getColumnMapping(AppCSVColumnName.REPORTER));
912           assertEquals("beschreibung", prof
913                   .getColumnMapping(AppCSVColumnName.DESCRIPTION));
914  
915           /*
916            * Try to overwrite an alread defined column mapping
917            */
918           prof.setColumnMapping(AppCSVColumnName.DESCRIPTION, "summary");
919           assertEquals("summary", prof
920                   .getColumnMapping(AppCSVColumnName.DESCRIPTION));
921  
922           /*
923            * Get and set severity mappings
924            */
925           assertTrue(prof.getValidSeverityMappings().isEmpty());
926  
927           List<String> sevMaps = new ArrayList<String>();
928           sevMaps.add("critical");
929           sevMaps.add("major");
930           sevMaps.add("minor");
931           sevMaps.add("good");
932           sevMaps.add("minor"); // duplicate! (has to be ignored)
933  
934           prof.setValidSeverityMappings(sevMaps);
935           assertEquals(4, prof.getValidSeverityMappings().size());
936  
937           Iterator<String> iterSevMaps = prof.getValidSeverityMappings()
938                   .iterator();
939           assertEquals("critical", iterSevMaps.next());
940           assertEquals("major", iterSevMaps.next());
941           assertEquals("minor", iterSevMaps.next());
942           assertEquals("good", iterSevMaps.next());
943  
944           /*
945            * Pushing severity mappings
946            */
947           prof.pushUpSeverityMapping("good");
948           prof.pushDownSeverityMapping("major");
949           prof.pushUpSeverityMapping("critical");
950  
951           iterSevMaps = prof.getValidSeverityMappings().iterator();
952           assertEquals("critical", iterSevMaps.next());
953           assertEquals("good", iterSevMaps.next());
954           assertEquals("major", iterSevMaps.next());
955           assertEquals("minor", iterSevMaps.next());
956  
957           /*
958            * Check if severity mappings are valid
959            */
960           assertTrue(prof.isValidSeverityMapping("critical"));
961           assertFalse(prof.isValidSeverityMapping("very good"));
962  
963           /*
964            * Reset severity mappings
965            */
966           prof.setValidSeverityMappings(null);
967           assertEquals(0, prof.getValidSeverityMappings().size());
968       }
969  
970       @Test(expected = DataException.class)
971       public void setIncorrectColOrderCSVProfile() throws DataException {
972           removeAllCSVProfileData();
973  
974           AppCSVProfile prof = appData.newCSVProfile("Trac");
975  
976           /*
977            * AppCSVColumnName.REFERENCE is missing
978            */
979           List<AppCSVColumnName> colOrd = new ArrayList<AppCSVColumnName>();
980           colOrd.add(AppCSVColumnName.REPORTER);
981           colOrd.add(AppCSVColumnName.SEVERITY);
982           colOrd.add(AppCSVColumnName.DESCRIPTION);
983  
984           prof.setColumnOrder(colOrd);
985       }
986  
987       @AfterClass
988       public static void deleteDatabase() {
989           FileTools.deleteDirectory(new File(Data.getInstance().getAppData()
990                   .getAppDataPath()));
991       }
992  
993   }
XMLResiValidationEventHandler.java
32   public class XMLResiValidationEventHandler implements ValidationEventHandler {
33  
34       
35       private String message = "no detailed information available";
36  
37       /*
38        * @see javax.xml.bind.ValidationEventHandler#handleEvent(javax.xml.bind.ValidationEvent)
39        */
40       public boolean handleEvent(ValidationEvent event) {
41           if (event.getSeverity() == ValidationEvent.FATAL_ERROR
42                   || event.getSeverity() == ValidationEvent.ERROR) {
43               ValidationEventLocator locator = event.getLocator();
44  
45               message = event.getMessage() + " [COLUMN = "
46                       + locator.getColumnNumber() + ", LINE = "
47                       + locator.getLineNumber() + "]";
48           }
49  
50           return false;
51       }
52  
53       /**
54        * Get the message from the last handled event.
55        *
56        * @return the message
57        */
58       public String getMessage() {
59           return message;
60       }
61  
62   }
XMLResiIOFactory.java
32   public class XMLResiIOFactory extends ResiIOFactory {
33       
34       /**
35        * Holds an instance of a {@link XMLResiIO} object.
36        */
37       private ResiIO XMLIO = null;
38       
39       public XMLResiIOFactory() {
40           super();
41       }
42  
43       /**
44        * Provides access to an IO provider object. In this special case
45        * to an object of type {@link XMLResiIO}.
46        *
47        * @see org.revager.io.ResiIOFactory#getIOProvider()
48        */
49       @Override
50       public ResiIO getIOProvider() {
51           if (XMLIO == null) {
52               XMLIO = new XMLResiIO();
53           }
54           
55           return XMLIO;
56       }
57  
58   }
XMLResiIO.java
52   public class XMLResiIO implements ResiIO {
53  
54       /**
55        * This enumeration gives the possibility to choose a validation mode for
56        * storing and loading Resi XML data.
57        *
58        * @author Johannes Wettinger
59        * @version 1.0
60        */
61       
XMLResiIO.java
63       }
64  
65       /*
66        * Some attributes for XML validation
67        */
68       private Schema resiSchema = null;
69  
70       private XMLResiValidationEventHandler eventHandler = null;
71  
72       /**
73        * Standard constructor with some preparations for XML validation
74        */
75       public XMLResiIO() {
76           super();
77  
78           eventHandler = new XMLResiValidationEventHandler();
79  
80           SchemaFactory schemaFactory = SchemaFactory
81                   .newInstance(javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI);
82  
83           try {
84               resiSchema = schemaFactory.newSchema(getClass().getResource(
85                       Data.getInstance().getResource("path.schema")));
86           } catch (SAXException e) {
87               /*
88                * Not part of unit testing because the exception is only thrown
89                * if an internal error occur.
90                */
91               System.err.println("Error while loading Resi XML schema: "
92                       + Data.getInstance().getResource("path.schema"));
93           }
94       }
95  
96       /**
97        * Get an Unmarshaller to the given JAXB context to read an XML file.
98        *
99        * @return the unmarshaller object to read an XML file
100        * @throws JAXBException
101        *             if setting up the unmarshaller fails
102        */
103       private Unmarshaller getUnmarshaller(JAXBContext context,
104               ValidationMode mode) throws JAXBException {
105           Unmarshaller uma = context.createUnmarshaller();
106  
107           /*
108            * XML validation
109            */
110           if (mode == ValidationMode.STRICT) {
111               uma.setSchema(resiSchema);
112               uma.setEventHandler(eventHandler);
113           }
114  
115           return uma;
116       }
117  
118       /**
119        * Get a Marshaller to the given JAXB context to write an XML file.
120        *
121        * @return the unmarshaller object to write an XML file
122        * @throws JAXBException
123        *             if setting up the marshaller fails
124        */
125       private Marshaller getMarshaller(JAXBContext context, ValidationMode mode)
126               throws JAXBException {
127           Marshaller ma = context.createMarshaller();
128  
129           /*
130            * XML validation
131            */
132           if (mode == ValidationMode.STRICT) {
133               ma.setSchema(resiSchema);
134               ma.setEventHandler(eventHandler);
135           }
136  
137           ma.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
138           ma.setProperty(Marshaller.JAXB_SCHEMA_LOCATION,
139                   "http://www.informatik.uni-stuttgart.de/iste/se "
140                           + Data.getInstance().getResource("xmlSchemaLocation"));
141  
142           return ma;
143       }
144  
145       /**
146        * Loads Aspects data stored in a XML file with a format as specified in the
147        * Resi XML schema.
148        *
149        * @param filePath
150        *            the path to the file to read
151        * @throws ResiIOException
152        *             if loading of XML file fails
153        */
154       @Override
155       public void loadAspects(String filePath) throws ResiIOException {
156           JAXBElement<Aspects> asp = null;
157  
158           try {
159               asp = getUnmarshaller(JAXBContext.newInstance(Aspects.class),
160                       ValidationMode.STRICT).unmarshal(
161                       new StreamSource(new File(filePath)), Aspects.class);
162  
163               /*
164                * Set the aspects object
165                */
166               Data.getInstance().getResiData().setAspects(asp.getValue());
167  
168               /*
169                * Save file path in the Data model
170                */
171               Data.getInstance().getResiData().setAspectsPath(filePath);
172           } catch (Exception e) {
173               throw new ResiIOException(eventHandler.getMessage());
174           }
175       }
176  
177       /**
178        * Loads Catalog data stored in a XML file with a format as specified in the
179        * Resi XML schema.
180        *
181        * @param filePath
182        *            the path to the file to read
183        * @throws ResiIOException
184        *             if loading of XML file fails
185        */
186       @Override
187       public void loadCatalog(String filePath) throws ResiIOException {
188           JAXBElement<Catalog> cat = null;
189  
190           try {
191               cat = getUnmarshaller(JAXBContext.newInstance(Catalog.class),
192                       ValidationMode.STRICT).unmarshal(
193                       new StreamSource(new File(filePath)), Catalog.class);
194  
195               /*
196                * Set the catalog object
197                */
198               Data.getInstance().getResiData().setCatalog(cat.getValue());
199  
200               /*
201                * Save file path in the Data model
202                */
203               Data.getInstance().getResiData().setCatalogPath(filePath);
204           } catch (Exception e) {
205               throw new ResiIOException(eventHandler.getMessage());
206           }
207       }
208  
209       /**
210        * Loads Review data stored in a XML file with a format as specified in the
211        * Resi XML schema.
212        *
213        * @param filePath
214        *            the path to the file to read
215        * @throws ResiIOException
216        *             if loading of XML file fails
217        */
218       @Override
219       public void loadReview(String filePath) throws ResiIOException {
220           JAXBElement<Review> rev = null;
221  
222           try {
223               // URI fileUri = new File(filePath).toURI();
224               // InputStream fileStream = fileUri.toURL().openStream();
225  
226               rev = getUnmarshaller(JAXBContext.newInstance(Review.class),
227                       ValidationMode.STRICT).unmarshal(
228                       new StreamSource(new File(filePath)), Review.class);
229  
230               /*
231                * Set the review object
232                */
233               Data.getInstance().getResiData().setReview(rev.getValue());
234  
235               /*
236                * Save file path in the Data model
237                */
238               Data.getInstance().getResiData().setReviewPath(filePath);
239           } catch (Exception e) {
240               throw new ResiIOException(eventHandler.getMessage());
241           }
242       }
243  
244       /**
245        * Loads review backup in a XML file with a format as specified in the Resi
246        * XML schema, but without strict validation.
247        *
248        * @throws ResiIOException
249        *             if loading of XML file fails
250        */
251       @Override
252       public void loadReviewBackup() throws ResiIOException {
253           JAXBElement<Review> rev = null;
254  
255           /*
256            * Read path of the backuped review file
257            */
258           String filePath;
259  
260           try {
261               filePath = Data.getInstance().getAppData().getSetting(
262                       AppSettingKey.APP_LAST_REVIEW_PATH);
263           } catch (DataException e) {
264               /*
265                * Not part of unit testing because the exception is only thrown
266                * if an internal error occur.
267                */
268               throw new ResiIOException(
269                       "Cannot read the path of backuped review file.");
270           }
271  
272           /*
273            * Path to backuped review data
274            */
275           String backupPath = Data.getInstance().getAppData().getAppDataPath()
276                   + Data.getInstance().getResource("revBakFileName");
277  
278           try {
279  
280               rev = getUnmarshaller(JAXBContext.newInstance(Review.class),
281                       ValidationMode.TOLERANT).unmarshal(
282                       new StreamSource(new File(backupPath)), Review.class);
283  
284               /*
285                * Set the review object
286                */
287               Data.getInstance().getResiData().setReview(rev.getValue());
288  
289               /*
290                * Save file path in the Data model
291                */
292               Data.getInstance().getResiData().setReviewPath(filePath);
293           } catch (Exception e) {
294               throw new ResiIOException(eventHandler.getMessage());
295           }
296       }
297  
298       /**
299        * Stores Aspects data stored in a XML file with a format as specified in
300        * the Resi XML schema.
301        *
302        * @param filePath
303        *            the path to the file to write
304        * @throws ResiIOException
305        *             if writing of XML file fails
306        */
307       @Override
308       public void storeAspects(String filePath) throws ResiIOException {
309           try {
310               getMarshaller(JAXBContext.newInstance(Aspects.class),
311                       ValidationMode.STRICT).marshal(
312                       new JAXBElement<Aspects>(new QName(
313                               "http://www.informatik.uni-stuttgart.de/iste/se",
314                               "aspects", ""), Aspects.class, Data.getInstance()
315                               .getResiData().getAspects()), new File(filePath));
316  
317           } catch (Exception e) {
318               throw new ResiIOException(eventHandler.getMessage());
319           }
320  
321           /*
322            * Save file path in the Data model
323            */
324           Data.getInstance().getResiData().setAspectsPath(filePath);
325       }
326  
327       /**
328        * Stores Catalog data stored in a XML file with a format as specified in
329        * the Resi XML schema.
330        *
331        * @param filePath
332        *            the path to the file to write
333        * @throws ResiIOException
334        *             if writing of XML file fails
335        */
336       @Override
337       public void storeCatalog(String filePath) throws ResiIOException {
338           try {
339               getMarshaller(JAXBContext.newInstance(Catalog.class),
340                       ValidationMode.STRICT).marshal(
341                       new JAXBElement<Catalog>(new QName(
342                               "http://www.informatik.uni-stuttgart.de/iste/se",
343                               "catalog", ""), Catalog.class, Data.getInstance()
344                               .getResiData().getCatalog()), new File(filePath));
345  
346           } catch (Exception e) {
347               throw new ResiIOException(eventHandler.getMessage());
348           }
349  
350           /*
351            * Save file path in the Data model
352            */
353           Data.getInstance().getResiData().setCatalogPath(filePath);
354       }
355  
356       /**
357        * Stores Review data stored in a XML file with a format as specified in the
358        * Resi XML schema.
359        *
360        * @param filePath
361        *            the path to the file to write
362        * @throws ResiIOException
363        *             if writing of XML file fails
364        */
365       @Override
366       public void storeReview(String filePath) throws ResiIOException {
367           try {
368               getMarshaller(JAXBContext.newInstance(Review.class),
369                       ValidationMode.STRICT).marshal(
370                       new JAXBElement<Review>(new QName(
371                               "http://www.informatik.uni-stuttgart.de/iste/se",
372                               "review", ""), Review.class, Data.getInstance()
373                               .getResiData().getReview()), new File(filePath));
374           } catch (Exception e) {
375               throw new ResiIOException(eventHandler.getMessage());
376           }
377  
378           /*
379            * Save file path in the Data model
380            */
381           Data.getInstance().getResiData().setReviewPath(filePath);
382       }
383  
384       /**
385        * Stores review as backup in a XML file with a format as specified in the
386        * Resi XML schema, but without strict validation.
387        *
388        * @throws ResiIOException
389        *             if writing of XML file fails
390        */
391       @Override
392       public void storeReviewBackup() throws ResiIOException {
393           /*
394            * Path to backup review data
395            */
396           String backupPath = Data.getInstance().getAppData().getAppDataPath()
397                   + Data.getInstance().getResource("revBakFileName");
398  
399           try {
400               getMarshaller(JAXBContext.newInstance(Review.class),
401                       ValidationMode.TOLERANT).marshal(
402                       new JAXBElement<Review>(new QName(
403                               "http://www.informatik.uni-stuttgart.de/iste/se",
404                               "review", ""), Review.class, Data.getInstance()
405                               .getResiData().getReview()), new File(backupPath));
406           } catch (Exception e) {
407               /*
408                * Not part of unit testing because the exception is only thrown
409                * if an internal error occur.
410                */
411               throw new ResiIOException(eventHandler.getMessage());
412           }
413  
414           /*
415            * Save path of backuped review file
416            */
417           String filePath = Data.getInstance().getResiData().getReviewPath();
418  
419           if (filePath == null) {
420               filePath = "";
421           }
422  
423           try {
424               Data.getInstance().getAppData().setSetting(
425                       AppSettingKey.APP_LAST_REVIEW_PATH, filePath);
426           } catch (DataException e) {
427               /*
428                * Not part of unit testing because the exception is only thrown
429                * if an internal error occur.
430                */
431               throw new ResiIOException(
432                       "Cannot save the path of backuped review file.");
433           }
434       }
435  
436   }
ResiIOFactory.java
32   public abstract class ResiIOFactory {
33  
34       /**
35        * Holds an instance of this class.
36        */
37       private static ResiIOFactory theInstance = null;
38  
39       /**
40        * Provides access to an instance of an implementation of
41        * this class.
42        *
43        * @return Instance of an implementation of this class.
44        */
45       public static ResiIOFactory getInstance() {
46           if (theInstance == null) {
47               theInstance = new XMLResiIOFactory();
48           }
49  
50           return theInstance;
51       }
52  
53       /**
54        * Provides access to an IO provider for loading and saving Resi data. An IO
55        * provider implements the {@link ResiIO} interface.
56        *
57        * @return IO provider
58        */
59       public abstract ResiIO getIOProvider();
60  
61   }
ResiIOException.java
28   @SuppressWarnings("serial")
29   public class ResiIOException extends Exception {
30  
31       public ResiIOException() {
32           super();
33       }
34  
35       public ResiIOException(String message) {
36           super(message);
37       }
38  
39   }
ResiIO.java
29   public interface ResiIO {
30  
31       /**
32        * Loads Review data from a file with the given name.
33        *
34        * @param filePath
35        *            Path to file to load data from
36        * @throws ResiIOException
37        *             If loading fails
38        */
39       public abstract void loadReview(String filePath) throws ResiIOException;
40  
41       /**
42        * Loads Catalog data from a file with the given name.
43        *
44        * @param filePath
45        *            Path to file to load data from
46        * @throws ResiIOException
47        *             If loading fails
48        */
49       public abstract void loadCatalog(String filePath) throws ResiIOException;
50  
51       /**
52        * Loads Aspects data from a file with the given name.
53        *
54        * @param filePath
55        *            Path to file to load data from
56        * @throws ResiIOException
57        *             If loading fails
58        */
59       public abstract void loadAspects(String filePath) throws ResiIOException;
60  
61       /**
62        * Loads review as backup from a file with the given name.
63        *
64        * @throws ResiIOException
65        *             If loading fails
66        */
67       public abstract void loadReviewBackup() throws ResiIOException;
68  
69       /**
70        * Stores Review data to a file with the given name.
71        *
72        * @param filePath
73        *            Path to file to store data to
74        * @throws ResiIOException
75        *             If storing fails
76        */
77       public abstract void storeReview(String filePath) throws ResiIOException;
78  
79       /**
80        * Stores Catalog data to a file with the given name.
81        *
82        * @param filePath
83        *            Path to file to store data to
84        * @throws ResiIOException
85        *             If storing fails
86        */
87       public abstract void storeCatalog(String filePath) throws ResiIOException;
88  
89       /**
90        * Stores Aspects data to a file with the given name.
91        *
92        * @param filePath
93        *            Path to file to store data to
94        * @throws ResiIOException
95        *             If storing fails
96        */
97       public abstract void storeAspects(String filePath) throws ResiIOException;
98  
99       /**
100        * Stores review as backup from a file with the given name.
101        *
102        * @throws ResiIOException
103        *             If storing fails
104        */
105       public abstract void storeReviewBackup() throws ResiIOException;
106  
107   }
SaveReviewWorker.java
19   public class SaveReviewWorker extends SwingWorker<Void, Void> {
20  
21       private String filePath = null;
22  
23       public SaveReviewWorker(String filePath) {
24           this.filePath = filePath;
25       }
26  
27       @Override
28       protected Void doInBackground() {
29           MainFrame mainframe = UI.getInstance().getMainFrame();
30  
31           mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
32                   "status.savingReview"), true);
33  
34           try {
35               Application.getInstance().getApplicationCtl().storeReview(filePath);
36  
37               mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
38                       "status.saveReviewSuccessful"), false);
39               
40               UI.getInstance().setStatus(UI.Status.DATA_SAVED);
41           } catch (Exception e) {
42               mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
43                       "status.saveReviewFailed"), false);
44  
45               JOptionPane.showMessageDialog(UI.getInstance().getMainFrame(),
46                       GUITools.getMessagePane(Data.getInstance().getLocaleStr(
47                               "message.saveReviewFailed")
48                               + "\n\n" + filePath + "\n\n" + e.getMessage()),
49                       Data.getInstance().getLocaleStr("error"),
50                       JOptionPane.ERROR_MESSAGE);
51           }
52  
53           return null;
54       }
55  
56   }
RestoreReviewWorker.java
19   public class RestoreReviewWorker extends SwingWorker<Void, Void> {
20  
21       @Override
22       protected Void doInBackground() throws Exception {
23           MainFrame mainframe = UI.getInstance().getMainFrame();
24  
25           mainframe.switchToProgressMode();
26  
27           mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
28                   "status.restoringBackup"), true);
29  
30           try {
31               Application.getInstance().getApplicationCtl().restoreReview();
32  
33               mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
34                       "status.restoreReviewSuccessful"), false);
35  
36               mainframe.switchToEditMode();
37           } catch (Exception e) {
38               mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
39                       "status.noReviewInProcess"), false);
40               
41               mainframe.switchToClearMode();
42  
43               JOptionPane.showMessageDialog(UI.getInstance().getMainFrame(),
44                       GUITools.getMessagePane(Data.getInstance().getLocaleStr(
45                       "message.restoreReviewFailed")
46                       + "\n\n" + e.getMessage()), Data.getInstance()
47                               .getLocaleStr("error"), JOptionPane.ERROR_MESSAGE);
48           }
49  
50           return null;
51       }
52  
53   }
NewReviewWorker.java
19   public class NewReviewWorker extends SwingWorker<Void, Void> {
20  
21       @Override
22       protected Void doInBackground() throws Exception {
23           boolean showAssistantDialog = UI.getInstance().getAssistantDialog()
24                   .isVisible();
25           MainFrame mainframe = UI.getInstance().getMainFrame();
26  
27           mainframe.switchToProgressMode();
28  
29           mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
30                   "status.creatingNewReview"), true);
31  
32           UI.getInstance().getAssistantDialog().setVisible(false);
33  
34           try {
35               Application.getInstance().getApplicationCtl().newReview();
36  
37               mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
38                       "status.createNewReviewSuccessful"), false);
39  
40               mainframe.switchToEditMode();
41               
42               UI.getInstance().setStatus(UI.Status.DATA_SAVED);
43           } catch (Exception e) {
44               mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
45                       "status.noReviewInProcess"), false);
46  
47               mainframe.switchToClearMode();
48  
49               JOptionPane.showMessageDialog(UI.getInstance().getMainFrame(),
50                       GUITools.getMessagePane(Data.getInstance().getLocaleStr(
51                               "message.createNewReviewFailed")
52                               + "\n\n" + e.getMessage()), Data.getInstance()
53                               .getLocaleStr("error"), JOptionPane.ERROR_MESSAGE);
54  
55               UI.getInstance().getAssistantDialog().setVisible(
56                       showAssistantDialog);
57           }
58  
59           return null;
60       }
61  
62   }
LoadReviewWorker.java
19   public class LoadReviewWorker extends SwingWorker<Void, Void> {
20  
21       private String filePath = null;
22  
23       public LoadReviewWorker(String filePath) {
24           this.filePath = filePath;
25       }
26  
27       @Override
28       protected Void doInBackground() {
29           boolean showAssistantDialog = UI.getInstance().getAssistantDialog()
30                   .isVisible();
31           MainFrame mainframe = UI.getInstance().getMainFrame();
32  
33           mainframe.switchToProgressMode();
34  
35           mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
36                   "status.loadingReview"), true);
37  
38           UI.getInstance().getAssistantDialog().setVisible(false);
39  
40           try {
41               Application.getInstance().getApplicationCtl().loadReview(filePath);
42  
43               mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
44                       "status.loadReviewSuccessful"), false);
45  
46               mainframe.switchToEditMode();
47               
48               UI.getInstance().setStatus(UI.Status.DATA_SAVED);
49           } catch (Exception e) {
50               mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
51                       "status.noReviewInProcess"), false);
52  
53               mainframe.switchToClearMode();
54  
55               JOptionPane.showMessageDialog(UI.getInstance().getMainFrame(),
56                       GUITools.getMessagePane(Data.getInstance().getLocaleStr(
57                               "message.loadReviewFailed")
58                               + "\n\n" + e.getMessage()), Data.getInstance()
59                               .getLocaleStr("error"), JOptionPane.ERROR_MESSAGE);
60  
61               UI.getInstance().getAssistantDialog().setVisible(
62                       showAssistantDialog);
63           }
64  
65           return null;
66       }
67  
68   }
LoadHelpWorker.java
16   public class LoadHelpWorker extends SwingWorker<Void, Void> {
17  
18       private static boolean running = false;
19  
20       private String helpChapter = null;
21  
22       private String helpChapterAnchor = null;
23  
24       public LoadHelpWorker() {
25           super();
26       }
27  
28       public LoadHelpWorker(String helpChapter, String helpChapterAnchor) {
29           this();
30           this.helpChapter = helpChapter;
31           this.helpChapterAnchor = helpChapterAnchor;
32       }
33  
34       public LoadHelpWorker(String helpChapter) {
35           this(helpChapter, null);
36       }
37  
38       @Override
39       protected Void doInBackground() throws Exception {
40           if (running == false) {
41               running = true;
42  
43               try {
44                   if (helpChapter != null && helpChapterAnchor != null) {
45                       UI.getInstance().getHelpBrowserFrame().showHelp(
46                               helpChapter, helpChapterAnchor);
47                   } else if (helpChapter != null && helpChapterAnchor == null) {
48                       UI.getInstance().getHelpBrowserFrame()
49                               .showHelp(helpChapter);
50                   } else {
51                       UI.getInstance().getHelpBrowserFrame().showHelp();
52                   }
53               } catch (Exception e) {
54                   JOptionPane.showMessageDialog(UI.getInstance().getMainFrame(),
55                           Data.getInstance().getLocaleStr("message.helpLoadError"), Data
56                                   .getInstance().getLocaleStr("errorOccurred"),
57                           JOptionPane.ERROR_MESSAGE);
58               }
59  
60               running = false;
61           }
62  
63           return null;
64       }
65   }
LoadEmbeddedHelpWorker.java
25   public class LoadEmbeddedHelpWorker extends SwingWorker<String, Void> {
26  
27       protected JPanel panelHelp = null;
28  
29       protected String helpChapter = null;
30  
31       protected String helpChapterAnchor = null;
32  
33       public LoadEmbeddedHelpWorker(JPanel panelHelp, String helpChapter,
34               String helpChapterAnchor) {
35           this.panelHelp = panelHelp;
36           this.helpChapter = helpChapter;
37           this.helpChapterAnchor = helpChapterAnchor;
38       }
39  
40       @Override
41       protected String doInBackground() throws Exception {
42           String htmlString = null;
43           JEditorPane helpPane = new JEditorPane();
44  
45           /*
46            * Preparations for displaying the help
47            */
48           String cssRules = "body { background-color:#fffee5; font-family: Verdana, Arial, sans-serif; font-size: 12pt; margin-left: 10px; margin-right: 10px; margin-bottom: 10px; } \n"
49                   + "h1 {font-size: 20pt; padding: 0; margin-top: 20px; margin-bottom: 0; }";
50  
51           helpPane.setEditable(false);
52           helpPane.setContentType("text/html");
53           helpPane.setBorder(null);
54  
55           ((HTMLDocument) helpPane.getDocument()).getStyleSheet().addRule(
56                   cssRules);
57           // ((HTMLDocument)
58           // helpPane.getDocument()).setBase(getClass().getResource(Data.getInstance().getResource("path.helpDocBase")));
59  
60           helpPane.addHyperlinkListener(new HyperlinkListener() {
61               public void hyperlinkUpdate(HyperlinkEvent ev) {
62                   if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
63                       JEditorPane src = (JEditorPane) ev.getSource();
64  
65                       if (ev.getDescription().startsWith("#")) {
66                           src.scrollToReference(ev.getDescription().substring(1));
67                       }
68                   }
69               }
70           });
71  
72           /*
73            * Load help content
74            */
75           try {
76               htmlString = "<h1>"
77                       + Data.getInstance().getHelpData().getChapterTitle(
78                               this.helpChapter) + "</h1>";
79               htmlString = htmlString
80                       + Data.getInstance().getHelpData().getChapterContent(
81                               this.helpChapter);
82           } catch (DataException exc) {
83               htmlString = "<h1>"
84                       + Data.getInstance().getLocaleStr("message.helpLoadFailed")
85                       + "</h1>";
86           }
87  
88           helpPane.setText(htmlString);
89  
90           /*
91            * Configure scroll pane
92            */
93           JScrollPane scrollPane = new JScrollPane();
94           scrollPane.setBorder(null);
95           scrollPane.getViewport().setView(helpPane);
96  
97           /*
98            * Some properties for the help pane
99            */
100           helpPane.setCaretPosition(0);
101  
102           panelHelp.removeAll();
103           panelHelp.add(scrollPane, BorderLayout.CENTER);
104  
105           panelHelp.revalidate();
106  
107           // TODO JOJO Scrollen funktioniert bei mehrmals Hilfe ein-/ausklappen
108           // noch nicht korrekt
109           if (helpChapterAnchor != null) {
110               helpPane.scrollRectToVisible(new Rectangle(50, 0));
111               helpPane.scrollToReference(helpChapterAnchor);
112               helpPane.revalidate();
113           }
114  
115           return htmlString;
116       }
117  
118   }
ExportCSVWorker.java
12   public class ExportCSVWorker extends SwingWorker<Object, Object> {
13       
14       
ExportCSVWorker.java
16       }
17  
18       /* (non-Javadoc)
19        * @see javax.swing.SwingWorker#doInBackground()
20        */
21       @Override
22       protected Object doInBackground() throws Exception {
23           // TODO Auto-generated method stub
24           return null;
25       }
26  
27   }
CreatePDFProtocolWorker.java
12   public class CreatePDFProtocolWorker extends SwingWorker<Object, Object> {
13       
14       
CreatePDFProtocolWorker.java
16       }
17  
18       /* (non-Javadoc)
19        * @see javax.swing.SwingWorker#doInBackground()
20        */
21       @Override
22       protected Object doInBackground() throws Exception {
23           // TODO Auto-generated method stub
24           return null;
25       }
26  
27   }
CreateInvitationsWorker.java
12   public class CreateInvitationsWorker extends SwingWorker<Object, Object> {
13       
14       
CreateInvitationsWorker.java
16       }
17  
18       /* (non-Javadoc)
19        * @see javax.swing.SwingWorker#doInBackground()
20        */
21       @Override
22       protected Object doInBackground() throws Exception {
23           // TODO Auto-generated method stub
24           return null;
25       }
26  
27   }
AutoSaveWorker.java
12   public class AutoSaveWorker extends SwingWorker<Object, Object> {
13  
14       /* (non-Javadoc)
15        * @see javax.swing.SwingWorker#doInBackground()
16        */
17       @Override
18       protected Object doInBackground() throws Exception {
19           // TODO Auto-generated method stub
20           return null;
21       }
22  
23   }
AutoBackupWorker.java
17   public class AutoBackupWorker extends SwingWorker<Void, Void> {
18  
19       /*
20        * (non-Javadoc)
21        *
22        * @see javax.swing.SwingWorker#doInBackground()
23        */
24       @Override
25       protected Void doInBackground() {
26           MainFrame mainframe = UI.getInstance().getMainFrame();
27  
28           long intervalInSeconds = Long.parseLong(Data.getInstance().getResource(
29                   "autoBackupIntervalInSec"));
30  
31           try {
32               while (true) {
33                   Thread.sleep(intervalInSeconds * 1000);
34  
35                   if (UI.getInstance().getStatus() == UI.Status.UNSAVED_CHANGES) {
36                       mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
37                               "status.doingAutoBackup"), true);
38  
39                       Application.getInstance().getApplicationCtl()
40                               .backupReview();
41  
42                       mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
43                               "status.autoBackupDone"), false);
44                   }
45               }
46           } catch (Exception e) {
47               mainframe.setStatusMessage(Data.getInstance().getLocaleStr(
48                       "status.autoBackupFailed"), false);
49           }
50  
51           return null;
52       }
53   }
SeverityTableModel.java
8   @SuppressWarnings("serial")
9   public class SeverityTableModel extends AbstractTableModel{
10  
11       @Override
12       public int getColumnCount() {
13           return 1;
14       }
15  
16       @Override
17       public int getRowCount() {
18           try{
19               return Application.getInstance().getSeverityMgmt().getNumberOfSeverities();
20           }catch(Exception e){
21               return 0;
22           }
23       }
24  
25       @Override
26       public Object getValueAt(int rowIndex, int columnIndex) {
27           try{
28               return Application.getInstance().getSeverityMgmt().getSeverities().get(rowIndex);
29           }catch(Exception e){
30               return 0;
31           }
32       }
33       
34       public void setValueAt(Object insertion, int row, int column) {
35           Application.getInstance().getSeverityMgmt().getSeverities().set(row, insertion.toString());
36           this.fireTableDataChanged();
37  
38       }
39  
40   public boolean isCellEditable( int rowIndex, int columnIndex )
41   {
42     return true;
43   }
44   }
ReviewerTableModel.java
12   @SuppressWarnings("serial")
13   public class ReviewerTableModel extends AbstractTableModel{
14       Attendee localAttendee;
15       List<Aspect> aspList;
16  
17       public ReviewerTableModel(Attendee att) {
18           localAttendee=att;
19           }
20  
21       @Override
22       public int getColumnCount() {
23           return 2;
24       }
25  
26       @Override
27       public int getRowCount() {
28           try{
29               return Application.getInstance().getAttendeeMgmt().getNumberOfAspects(localAttendee);
30           }catch(Exception e){return 0;}
31       }
32  
33       @Override
34       public Object getValueAt(int row, int column) {
35           if(column==0){
36               aspList=Application.getInstance().getAttendeeMgmt().getAspects(localAttendee);
37               
38               try{
39                   return aspList.get(row).getDirective();
40               }catch(Exception e){return row;}
41           }else
42               try{
43                   return aspList.get(row).getCategory();
44               }catch(Exception e){return row;}
45               }
46  
47   }
ReferenceTableModel.java
8   @SuppressWarnings("serial")
9   public class ReferenceTableModel extends AbstractTableModel {
10  
11       @Override
12       public int getColumnCount() {
13           return 1;
14       }
15  
16       @Override
17       public int getRowCount() {
18           return Application.getInstance().getReviewMgmt().getNumberOfProdRefs();
19       }
20  
21       @Override
22       public Object getValueAt(int rowIndex, int columnIndex) {
23           return Application.getInstance().getReviewMgmt().getProductReferences().get(rowIndex);
24       }
25  
26       public void setValueAt(Object insertion, int row, int column) {
27               String oldRef=this.getValueAt(row, 0).toString();
28               Application.getInstance().getReviewMgmt().editProductReference(oldRef, insertion.toString());
29               this.fireTableDataChanged();
30  
31           }
32       
33       public boolean isCellEditable( int rowIndex, int columnIndex )
34       {
35         return true;
36       }
37       
38  
39   }
InvitationsTableModel.java
9   @SuppressWarnings("serial")
10   public class InvitationsTableModel extends AbstractTableModel {
11  
12  
13  
14       @Override
15       public int getColumnCount() {
16           return 2;
17       }
18  
19       @Override
20       public int getRowCount() {
21            return Data.getInstance().getResiData().getReview().getAttendees().size();
22       }
23  
24       @Override
25       public Object getValueAt(int rowIndex, int columnIndex) {
26           if(columnIndex==0) return false;
27           else return Application.getInstance().getAttendeeMgmt().getAttendees().get(rowIndex).getName();    
28  
29       }
30  
31       public boolean isCellEditable(int row, int col) {
32           if (col == 0) {
33               return true;
34           } else {
35               return false;
36           }
37       }
38       
39  
40       public Class getColumnClass(int columnIndex){
41           if (columnIndex == 0)
42               return Boolean.class;
43           else return String.class;
44       }
45  
46  
47   }
AttendeeTableModel.java
7   @SuppressWarnings("serial")
8   public class AttendeeTableModel extends AbstractTableModel {
9  
10  
11  
12       @Override
13       public int getColumnCount() {
14           return 3;
15       }
16  
17       @Override
18       public int getRowCount() {
19            return Data.getInstance().getResiData().getReview().getAttendees().size();
20       }
21       
22  
23       public String getColumnName( int column){
24           if (column == 0)
25               return Data.getInstance().getLocaleStr("attendeeTM.name");
26           else if (column == 1)
27               return Data.getInstance().getLocaleStr("attendeeTM.role");
28           else
29               return Data.getInstance().getLocaleStr("attendeeTM.value");
30       
31       }
32  
33       @Override
34       public Object getValueAt(int rowIndex, int columnIndex) {
35           if (columnIndex == 0){
36               return Data.getInstance().getResiData().getReview().getAttendees().get(rowIndex).getName();}
37           else if (columnIndex == 1){
38               String roleString="role.".concat(Data.getInstance().getResiData().getReview().getAttendees().get(rowIndex).getRole().value());
39     
40               return Data.getInstance().getLocaleStr(roleString);}
41           else
42               try{
43                   return Data.getInstance().getResiData().getReview().getAttendees().get(rowIndex).getAspects().getAspectIds().size();
44               }catch(Exception e){
45                   return 0;
46               }
47       }
48       
49  
50  
51   }
AspectTableModel.java
14   @SuppressWarnings("serial")
15   public class AspectTableModel extends AbstractTableModel{
16       List<Attendee> allAttendeesList;
17       List<Aspect> allAssignedAspList;
18       public AspectTableModel() {
19           
20           allAttendeesList=Application.getInstance().getAttendeeMgmt().getAttendees();
21           allAssignedAspList=new ArrayList<Aspect>();
22           for(Attendee att:allAttendeesList){
23               if(att.getRole()==Role.REVIEWER){
24               List<Aspect>localAspList =Application.getInstance().getAttendeeMgmt().getAspects(att);
25               for(Aspect localAsp:localAspList){
26  
27                   if(!allAssignedAspList.contains(localAsp)){
28                       allAssignedAspList.add(localAsp);
29                   }
30                   
31               }
32               }
33           }
34       }
35  
36       @Override
37       public int getColumnCount() {
38           return 2;
39       }
40  
41       @Override
42       public int getRowCount() {
43               return allAssignedAspList.size();
44       }
45  
46       @Override
47       public Object getValueAt(int rowIndex, int columnIndex) {
48           List<Attendee> attList = Application.getInstance().getAttendeeMgmt().getAttendeesWithAspect(allAssignedAspList.get(rowIndex));
49           if(columnIndex==0)
50                   return allAssignedAspList.get(rowIndex).getDirective();
51           else
52               return getAttendeesString(attList);
53       }
54       
55       private String getAttendeesString(List<Attendee> attList){
56           String attString="";
57           int index=0;
58           for(Attendee att:attList){
59               attString=attString.concat(att.getName());
60               index++;
61               if(attList.size()!=index)
62                   attString=attString.concat(", ");
63           }
64           return attString;
65       }
66  
67   }
RemoveSeverityAction.java
11   @SuppressWarnings("serial")
12   public class RemoveSeverityAction extends AbstractAction{
13  
14       @Override
15       public void actionPerformed(ActionEvent arg0) {
16           try{
17               SeverityManagement sevMan=Application.getInstance().getSeverityMgmt();
18               int selectedRow=UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().getSelectedRow();
19               sevMan.removeSeverity(sevMan.getSeverities().get(selectedRow));
20               UI.getInstance().getManageSeveritiesDialog().getStm().fireTableDataChanged();
21           }catch(Exception e){}
22  
23       }
24  
25   }
PushSeverityUpAction.java
10   @SuppressWarnings("serial")
11   public class PushSeverityUpAction extends AbstractAction{
12  
13       @Override
14       public void actionPerformed(ActionEvent arg0) {
15           int selectedRow=UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().getSelectedRow();
16           if(selectedRow!=-1){
17               String localSev=Application.getInstance().getSeverityMgmt().getSeverities().get(selectedRow);
18               Application.getInstance().getSeverityMgmt().pushUpSeverity(localSev);
19               UI.getInstance().getManageSeveritiesDialog().getStm().fireTableDataChanged();
20               try{
21                   UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().setRowSelectionInterval(selectedRow-1, selectedRow-1);
22               }catch(Exception e){
23                   UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().setRowSelectionInterval(selectedRow, selectedRow);
24                   
25               }}
26       }
27  
28   }
PushSeverityTopAction.java
10   @SuppressWarnings("serial")
11   public class PushSeverityTopAction extends AbstractAction{
12  
13       @Override
14       public void actionPerformed(ActionEvent arg0) {
15           int selectedRow=UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().getSelectedRow();
16           if(selectedRow!=-1){
17               String localSev=Application.getInstance().getSeverityMgmt().getSeverities().get(selectedRow);
18               Application.getInstance().getSeverityMgmt().pushTopSeverity(localSev);
19               UI.getInstance().getManageSeveritiesDialog().getStm().fireTableDataChanged();
20               try{
21                   UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().setRowSelectionInterval(0,0);
22               }catch(Exception e){}
23           }
24       }
25  
26   }
PushSeverityDownAction.java
10   @SuppressWarnings("serial")
11   public class PushSeverityDownAction extends AbstractAction{
12  
13       @Override
14       public void actionPerformed(ActionEvent arg0) {
15           int selectedRow=UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().getSelectedRow();
16           String localSev=Application.getInstance().getSeverityMgmt().getSeverities().get(selectedRow);
17           if(selectedRow!=-1){
18               Application.getInstance().getSeverityMgmt().pushDownSeverity(localSev);
19               UI.getInstance().getManageSeveritiesDialog().getStm().fireTableDataChanged();
20               try{
21                   UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().setRowSelectionInterval(selectedRow+1, selectedRow+1);
22               }catch(Exception e){
23                   UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().setRowSelectionInterval(selectedRow, selectedRow);
24                   
25               }
26           }
27       }
28  
29   }
PushSeverityBottomAction.java
10   @SuppressWarnings("serial")
11   public class PushSeverityBottomAction extends AbstractAction{
12  
13       @Override
14       public void actionPerformed(ActionEvent arg0) {
15           int selectedRow=UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().getSelectedRow();
16           String localSev=Application.getInstance().getSeverityMgmt().getSeverities().get(selectedRow);
17           if(selectedRow!=-1){
18               Application.getInstance().getSeverityMgmt().pushBottomSeverity(localSev);
19               UI.getInstance().getManageSeveritiesDialog().getStm().fireTableDataChanged();
20               try{
21                   int numberOfSevs=Application.getInstance().getSeverityMgmt().getNumberOfSeverities();
22                   UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().setRowSelectionInterval(numberOfSevs-1,numberOfSevs-1);
23               }catch(Exception e){}
24           }
25       }
26  
27   }
EditSeverityAction.java
10   @SuppressWarnings("serial")
11   public class EditSeverityAction extends AbstractAction{
12           @Override
13           public void actionPerformed(ActionEvent arg0) {
14               
15               int selectedRow=UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().getSelectedRow();
16               
17               if(selectedRow!=-1){
18                   UI.getInstance().getManageSeveritiesDialog().getSeverityTbl().editCellAt(selectedRow, 0);
19                   
20               }
21           }
22       }
ConfirmSeverityAction.java
3   public class ConfirmSeverityAction {
4  
5   }
AddSeverityAction.java
11   @SuppressWarnings("serial")
12   public class AddSeverityAction extends AbstractAction{
13  
14       @Override
15       public void actionPerformed(ActionEvent arg0) {
16           String placeHolder=Data.getInstance().getLocaleStr("editProduct.placeHolder");
17           Application.getInstance().getSeverityMgmt().addSeverity(placeHolder);
18           UI.getInstance().getManageSeveritiesDialog().getStm().fireTableDataChanged();
19       }
20  
21   }
EditProtocolAction.java
3   public class EditProtocolAction {
4  
5   }
CommentProtocolAction.java
3   public class CommentProtocolAction {
4  
5   }
AddProtocolAction.java
3   public class AddProtocolAction {
4  
5   }
RemoveProductReferenceAction.java
11   @SuppressWarnings("serial")
12   public class RemoveProductReferenceAction extends AbstractAction {
13  
14       @Override
15       public void actionPerformed(ActionEvent arg0) {
16  
17           int selectedRow=UI.getInstance().getEditProductDialog().getReferenceTbl().getSelectedRow();
18           String localRef=Application.getInstance().getReviewMgmt().getProductReferences().get(selectedRow);
19           Application.getInstance().getReviewMgmt().removeProductReference(localRef);
20           UI.getInstance().getEditProductDialog().getRtm().fireTableDataChanged();
21           
22       }
23   }
EditProductReferenceAction.java
7   @SuppressWarnings("serial")
8   public class EditProductReferenceAction extends AbstractAction{
9           @Override
10           public void actionPerformed(ActionEvent arg0) {
11  
12               int selectedRow=UI.getInstance().getEditProductDialog().getReferenceTbl().getSelectedRow();
13               
14               if(selectedRow!=-1){
15                   UI.getInstance().getEditProductDialog().getReferenceTbl().editCellAt(selectedRow, 0);
16               
17           }        
18       }
19   }
EditProductAction.java
11   @SuppressWarnings("serial")
12   public class EditProductAction extends AbstractAction{
13  
14       @Override
15       public void actionPerformed(ActionEvent e) {
16           ReviewManagement reviewMgmt = Application.getInstance().getReviewMgmt();
17           reviewMgmt.setProductName(UI.getInstance().getEditProductDialog().getNameTxtFld().getText());
18           reviewMgmt.setProductVersion(UI.getInstance().getEditProductDialog().getVersionTxtFld().getText());
19       //    reviewMgmt.set(UI.getInstance().getEditProductDialog().getNameTxtFld().getText());
20           UI.getInstance().getEditProductDialog().setVisible(false);
21       }
22  
23   }
AddProductReferenceAction.java
11   @SuppressWarnings("serial")
12   public class AddProductReferenceAction extends AbstractAction{
13  
14       @Override
15       public void actionPerformed(ActionEvent arg0) {
16           String placeHolder=Data.getInstance().getLocaleStr("editProduct.placeHolder");
17           Application.getInstance().getReviewMgmt().addProductReference(placeHolder);
18           UI.getInstance().getEditProductDialog().getRtm().fireTableDataChanged();
19       }
20  
21   }
SelectMeetingAction.java
3   public class SelectMeetingAction {
4  
5   }
RemoveMeetingAction.java
10   @SuppressWarnings("serial")
11   public class RemoveMeetingAction extends AbstractAction {
12  
13       @Override
14       public void actionPerformed(ActionEvent arg0) {
15           
16           int i[]=UI.getInstance().getMainFrame().getMeetingsTree().getSelectionRows();
17           
18           try{
19           for(int index=0;index<i.length;index++){
20               
21                   Application.getInstance().getMeetingMgmt().removeMeeting(i[index]-1);
22               
23           }
24           }catch(Exception e){
25               System.out.println("No meeting selected.");
26           }
27       }
28  
29   }
EditMeetingAction.java
9   @SuppressWarnings("serial")
10   public class EditMeetingAction extends AbstractAction{
11  
12       @Override
13       public void actionPerformed(ActionEvent e) {
14           if(!UI.getInstance().getMainFrame().getMeetingsTree().isSelectionEmpty()){
15           UI.getInstance().getMeetingDialog().modeEdit=true;
16           UI.getInstance().getMeetingDialog().setMode();
17           UI.getInstance().getMeetingDialog().setVisible(true);
18           UI.getInstance().getMeetingDialog().modeEdit=false;
19       }
20       }
21  
22   }
ConfirmMeetingAction.java
16   @SuppressWarnings("serial")
17   public class ConfirmMeetingAction extends AbstractAction{
18       
19       
20       public Calendar dateString2Calendar(String s,DateFormat df) throws ParseException {
21               Calendar cal=Calendar.getInstance();
22               Date d1=df.parse(s);
23               cal.setTime(d1);
24               return cal;
25             }
26  
27       @Override
28       public void actionPerformed(ActionEvent arg0) {
29           DateFormat dateF = SimpleDateFormat.getDateInstance(DateFormat.LONG);
30           
31           if(UI.getInstance().getMeetingDialog().modeEdit==false){
32               
33                   
34  
35                   try {
36                       Meeting newMeeting= new Meeting();
37                       newMeeting.setPlannedDate(dateString2Calendar(UI.getInstance().getMeetingDialog().getDateTxtFld().getText(),dateF));
38                       newMeeting.setPlannedStart(UI.getInstance().getMeetingDialog().getBegin());
39                       newMeeting.setPlannedEnd(UI.getInstance().getMeetingDialog().getEnd());
40                       newMeeting.setPlannedLocation(UI.getInstance().getMeetingDialog().getLocationTxt());
41                       Application.getInstance().getMeetingMgmt().addMeeting(newMeeting);
42                       
43                   } catch (ParseException e) {
44                       // TODO Auto-generated catch block
45                       e.printStackTrace();
46                   }
47                   
48           
49               }else{
50                   int i[]=UI.getInstance().getMainFrame().getMeetingsTree().getSelectionRows();
51                   
52                   for(int index=0;index<i.length;index++){
53                       try{
54                           Application.getInstance().getMeetingMgmt().removeMeeting(i[index]-1);
55                       }catch(Exception e){}
56                   }
57                   try {
58                       Meeting newMeeting= new Meeting();
59                       newMeeting.setPlannedDate(dateString2Calendar(UI.getInstance().getMeetingDialog().getDateTxtFld().getText(),dateF));
60                       newMeeting.setPlannedStart(UI.getInstance().getMeetingDialog().getBegin());
61                       newMeeting.setPlannedEnd(UI.getInstance().getMeetingDialog().getEnd());
62                       newMeeting.setPlannedLocation(UI.getInstance().getMeetingDialog().getLocationTxt());
63                       newMeeting.setCanceled(UI.getInstance().getMeetingDialog().getCanceled());
64                       Application.getInstance().getMeetingMgmt().addMeeting(newMeeting);
65                       
66                   } catch (ParseException e) {
67                       // TODO Auto-generated catch block
68                       e.printStackTrace();
69                   }
70  
71           }
72  
73           
74           UI.getInstance().getMeetingDialog().setVisible(false);
75  
76  
77       }
78  
79   }
CommentMeetingAction.java
14   @SuppressWarnings("serial")
15   public class CommentMeetingAction extends AbstractAction{
16  
17       
18       @Override
19       public void actionPerformed(ActionEvent e) {
20           
21           List<Meeting> meetList=Application.getInstance().getMeetingMgmt().getMeetings();
22           int i[]=UI.getInstance().getMainFrame().getMeetingsTree().getSelectionRows();
23           
24           /*
25            *creating popup with the comment of the selected meeting
26            */
27           String comments="";
28           for(int index=0;index<i.length;index++){
29               try{
30                   comments=meetList.get(i[index]-1).getComments();
31               }catch(Exception ex){}
32           }
33           
34           TextPopupWindow popup = new TextPopupWindow(UI.getInstance()
35                   .getMainFrame(), Data.getInstance().getLocaleStr("popup.commentMeeting"),
36                   comments, true);
37  
38           popup.setVisible(true);
39           
40           /*
41            * saving comment of the selected meeting
42            */
43           if(popup.getButtonClicked().toString().equals("OK")){
44           
45               for(int index=0;index<i.length;index++){
46                   try{
47                       meetList.get(i[index]-1).setComments(popup.getInput());
48                   }catch(Exception ex){}
49               }
50           }
51       }
52   }
AddMeetingAction.java
9   @SuppressWarnings("serial")
10   public class AddMeetingAction extends AbstractAction{
11  
12       @Override
13       public void actionPerformed(ActionEvent e) {
14           UI.getInstance().getMeetingDialog().modeEdit=false;
15           UI.getInstance().getMeetingDialog().setMode();
16           UI.getInstance().getMeetingDialog().setVisible(true);
17       }
18  
19   }
RemoveFileFromInvitationsAction.java
3   public class RemoveFileFromInvitationsAction {
4  
5   }
OpenInvitationsDialogAction.java
9   @SuppressWarnings("serial")
10   public class OpenInvitationsDialogAction extends AbstractAction{
11  
12       @Override
13       public void actionPerformed(ActionEvent arg0) {
14           UI.getInstance().getCreateInvitationsDialog().clearInvitationsDialog();
15           UI.getInstance().getCreateInvitationsDialog().setVisible(true);
16       
17       }
18  
19   }
GenerateInvitationsAction.java
7   @SuppressWarnings("serial")
8   public class GenerateInvitationsAction extends AbstractAction{
9  
10       @Override
11       public void actionPerformed(ActionEvent arg0) {
12           // TODO Auto-generated method stub
13           
14       }
15  
16       
17   }
AddFileToInvitationsAction.java
3   public class AddFileToInvitationsAction {
4  
5   }
SearchAction.java
11   @SuppressWarnings("serial")
12   public class SearchAction extends AbstractAction{
13       public SearchAction() {super();}
14  
15       public static String getLocalString(String searchString,String chapterContent){
16           
17           String localString="";
18           
19               if(chapterContent.indexOf("<")>0){
20                   String local=chapterContent.substring(0, chapterContent.indexOf("<"));
21  
22                   String localLow=local.toLowerCase();
23                   String searchLow=searchString.toLowerCase();
24                   if(localLow.indexOf(searchLow)!=-1){
25                       String replacement="";
26                       replacement=local.substring(0,localLow.indexOf(searchLow));
27                       replacement=replacement.concat(Data.getInstance().getResource("helpHtmlMarkingBegin"));
28                       replacement=replacement.concat(local.substring(localLow.indexOf(searchLow),localLow.indexOf(searchLow)+searchString.length()));
29                       replacement=replacement.concat(Data.getInstance().getResource("helpHtmlMarkingEnd"));
30                       localString=localString.concat(replacement);
31                       chapterContent=chapterContent.substring(localLow.indexOf(searchLow)+searchString.length());
32                       }else {
33                           localString=localString.concat(local);
34                           chapterContent=chapterContent.substring(chapterContent.indexOf("<"));
35                       }
36               }
37               if(chapterContent.indexOf("<")==0){
38                   localString=localString.concat(chapterContent.substring(0, chapterContent.indexOf(">")+1));
39                   chapterContent=chapterContent.substring(chapterContent.indexOf(">")+1);
40               }
41               if(chapterContent.indexOf("<")!=-1){
42                   localString=localString.concat(getLocalString(searchString,chapterContent));
43                   }
44               
45               
46           return localString;
47       }
48       public void actionPerformed(ActionEvent SearchHelp) {
49           try {
50               
51               HelpBrowserFrame.getBodyPane().setText("<H1>" + Data.getInstance().getHelpData().getChapterTitle("start") + "</H1>" + Data.getInstance().getHelpData().getChapterContent("start"));
52               
53           } catch (DataException e) {
54               // TODO Auto-generated catch block
55               e.printStackTrace();
56           }
57           
58           String[] chapters=null;
59           String helpTitle=null;
60           String helpChapter=null;
61           String localString=null;
62  
63           try {
64               chapters = Data.getInstance().getHelpData().getChapters();
65           } catch (DataException e1) {
66               // TODO Auto-generated catch block
67               e1.printStackTrace();
68           }
69           String searchString=HelpBrowserFrame.getSrchTxtFld().getText();
70           
71           DefaultMutableTreeNode root = new DefaultMutableTreeNode(HelpBrowserFrame.getHelpStartTitle());
72           
73           //for-loop starting at 1 because 1-element is start.html
74           for (int nodeCnt = 1; nodeCnt < chapters.length; nodeCnt++) {
75               
76               boolean gefunden = false;
77                //Suche in Bezeichnung
78               
79               try {
80                       helpTitle = Data.getInstance().getHelpData().getChapterTitle(chapters[nodeCnt]);
81                       helpChapter = Data.getInstance().getHelpData().getChapterContent(chapters[nodeCnt]).toString();
82  
83                   } catch (DataException ChapterTitelError) {
84                       System.out.println("Error: can't read ChapterTitel in HelpBrowserFrame");
85                   }
86                  
87                   for(int index=0;index<(helpTitle.length()-searchString.length()+1);index++){
88                      
89                       if(searchString.equalsIgnoreCase(
90                          (helpTitle.substring(index,index+searchString.length())))
91                          &gefunden==false){
92                               DefaultMutableTreeNode dmtn = new DefaultMutableTreeNode(helpTitle);
93                             root.add(dmtn);
94                             gefunden=true;
95                          
96                       }
97  
98                   }
99                   if(true){
100                   for(int index=0;index<(helpChapter.length()-searchString.length()+1);index++){
101                       if(searchString.equalsIgnoreCase(helpChapter.substring(index,index+searchString.length()))&gefunden==false){
102                         DefaultMutableTreeNode dmtn = new DefaultMutableTreeNode(helpTitle);
103                         root.add(dmtn);
104                         gefunden=true;
105                         
106                  }
107                  }
108                  }
109                 
110                   
111                 }
112           if(localString!=null){
113                 System.out.println(localString);}
114           
115           
116  
117           HelpBrowserFrame.setTree(root);
118  
119  
120           for (int nodeCnt = 1; nodeCnt < chapters.length; nodeCnt++) {
121               try {
122                   helpTitle = Data.getInstance().getHelpData().getChapterTitle(chapters[nodeCnt]);
123               } catch (DataException ChapterTitelError) {
124                   System.out.println("Error: can't read ChapterTitel in HelpBrowserFrame");
125               }
126           }
127       }
128  
129   }
ResetAction.java
17   @SuppressWarnings("serial")
18   public class ResetAction extends AbstractAction {
19  
20       @Override
21       public void actionPerformed(ActionEvent ResetHelp) {
22           
23           HelpBrowserFrame.getTree().setModel(new DefaultTreeModel(HelpBrowserFrame.getStandardRoot()));
24           HelpBrowserFrame.getSrchTxtFld().setText("");
25           int selectedRows[]=HelpBrowserFrame.getTree().getSelectionRows();
26           HelpBrowserFrame.getTree().removeSelectionRows(selectedRows);
27           HelpBrowserFrame.getTree().setSelectionRow(0);
28           
29           try {
30               
31               HelpBrowserFrame.getBodyPane().setText("<H1>" + Data.getInstance().getHelpData().getChapterTitle("start") + "</H1>" + Data.getInstance().getHelpData().getChapterContent("start"));
32               
33           } catch (DataException e) {
34               // TODO Auto-generated catch block
35               e.printStackTrace();
36           }
37           
38       }
39   }
OpenHelpAction.java
9   @SuppressWarnings("serial")
10   public class OpenHelpAction extends AbstractAction {
11  
12       @Override
13       public void actionPerformed(ActionEvent arg0) {
14           new LoadHelpWorker().execute();
15       }
16  
17   }
SelectEmphasesAction.java
3   public class SelectEmphasesAction {
4  
5   }
SelectAttendeeAction.java
3   public class SelectAttendeeAction {
4  
5   }
RemoveAttendeeAction.java
10   @SuppressWarnings("serial")
11   public class RemoveAttendeeAction extends AbstractAction{
12  
13       @Override
14       public void actionPerformed(ActionEvent arg0) {
15           int selectedRow =UI.getInstance().getMainFrame().getAttendeesTable().getSelectedRow();
16           try{
17               Application.getInstance().getAttendeeMgmt().getAttendees().remove(selectedRow);
18           }catch(Exception e){System.out.println("No attendee selected");}
19           UI.getInstance().getMainFrame().getAttendeesTableModel().fireTableDataChanged();
20           UI.getInstance().getAttendeeDialog().setVisible(false);
21       }
22  
23   }
PushUpAspectAction.java
14   @SuppressWarnings("serial")
15   public class PushUpAspectAction extends AbstractAction{
16  
17       Attendee localAttendee;
18       ReviewerTableModel localRtm;
19       JTable localTable;
20       public PushUpAspectAction(Attendee att, ReviewerTableModel rtm, JTable aspectTbl) {
21       localAttendee=att;
22       localRtm=rtm;
23       localTable=aspectTbl;
24       }
25  
26       @Override
27       public void actionPerformed(ActionEvent e) {
28           int selectedRow=localTable.getSelectedRow();
29           Aspect localAsp=Application.getInstance().getAttendeeMgmt().getAspects(localAttendee).get(selectedRow);
30           Application.getInstance().getAttendeeMgmt().pushUpAspect(localAttendee, localAsp);
31           localRtm.fireTableDataChanged();
32           localTable.setRowSelectionInterval(selectedRow-1,selectedRow-1);
33       }
34  
35   }
PushDownAspectAction.java
15   @SuppressWarnings("serial")
16   public class PushDownAspectAction extends AbstractAction{
17  
18       Attendee localAttendee;
19       ReviewerTableModel localRtm;
20       JTable localTable;
21       public PushDownAspectAction(Attendee att, ReviewerTableModel rtm, JTable aspectTbl) {
22       localAttendee=att;
23       localRtm=rtm;
24       localTable=aspectTbl;
25       }
26  
27       @Override
28       public void actionPerformed(ActionEvent e) {
29           int selectedRow=localTable.getSelectedRow();
30           Aspect localAsp=Application.getInstance().getAttendeeMgmt().getAspects(localAttendee).get(selectedRow);
31           Application.getInstance().getAttendeeMgmt().pushDownAspect(localAttendee, localAsp);
32           localRtm.fireTableDataChanged();
33           localTable.setRowSelectionInterval(selectedRow+1,selectedRow+1);
34       }
35  
36   }
EditAttendeeAction.java
9   @SuppressWarnings("serial")
10   public class EditAttendeeAction extends AbstractAction {
11  
12       @Override
13       public void actionPerformed(ActionEvent e) {
14  
15           UI.getInstance().getAttendeeDialog().modeEdit=true;
16           UI.getInstance().getAttendeeDialog().setMode();
17           UI.getInstance().getAttendeeDialog().setVisible(true);
18           UI.getInstance().getAttendeeDialog().modeEdit=false;
19  
20       }
21  
22   }
ConfirmAttendeeAction.java
16   @SuppressWarnings("serial")
17   public class ConfirmAttendeeAction extends AbstractAction{
18       
19       private Role[] roles = Role.values();
20       
21       @Override
22       public void actionPerformed(ActionEvent arg0) {
23           
24           String attName=UI.getInstance().getAttendeeDialog().getNameTxtFld().getText();
25           String attContact=UI.getInstance().getAttendeeDialog().getContactTxtArea().getText();
26           
27           boolean nameMissing=false;
28           boolean strengthMissing=false;
29           boolean contactMissing=false;
30       
31           String message;
32           String messageForStrength="";
33           String role=UI.getInstance().getAttendeeDialog().getRoleBox().getSelectedItem().toString();
34           if(attName.trim().equals(""))
35               nameMissing=true;
36           
37           if(attContact.trim().equals(""))
38               contactMissing=true;
39           
40           int numberOfStrength=UI.getInstance().getAttendeeDialog().getStrengthTbl().getRowCount();
41           if(role.equals(Data.getInstance().getLocaleStr("role.reviewer"))&&numberOfStrength==0){
42               messageForStrength=Data.getInstance().getLocaleStr("attendeeDialog.message.noStrength");
43               strengthMissing=true;
44           }
45           if(nameMissing&&contactMissing){
46               message=Data.getInstance().getLocaleStr("attendeeDialog.message.noNameNoContact");
47               UI.getInstance().getAttendeeDialog().setMessage(message.concat(messageForStrength));
48           
49           }else if(nameMissing){
50               
51               message=Data.getInstance().getLocaleStr("attendeeDialog.message.noName");
52               UI.getInstance().getAttendeeDialog().setMessage(message.concat(messageForStrength));
53           
54           }else if(contactMissing){
55               message=Data.getInstance().getLocaleStr("attendeeDialog.message.noContact");
56               UI.getInstance().getAttendeeDialog().setMessage(message.concat(messageForStrength));
57           }else if(strengthMissing){
58               UI.getInstance().getAttendeeDialog().setMessage(messageForStrength);
59               
60           }else{
61           Attendee newAttendee;
62           try {
63               /*
64                *
65                */
66               AppAttendee localAtt = UI.getInstance().getAttendeeDialog().getSelectedAppAtt();
67               boolean contains=false;
68               
69               /*
70                * case database contains attendee(name&&contact)
71                */
72               for(AppAttendee att:Data.getInstance().getAppData().getAttendees()){
73                   
74                   if(att.getName().equals(attName)&&att.getContact().equals(attContact)){
75                       int length=UI.getInstance().getAttendeeDialog().getSelectedAppAtt().getStrengths().size();
76                       att.getStrengths().clear();
77                       for(int index=0;index<length;index++){
78                           String strength = UI.getInstance().getAttendeeDialog().getStm().getValueAt(index, 1).toString();
79                           att.addStrength(strength);
80                       }
81                       contains=true;
82                   }
83               }
84               
85               if(contains)Data.getInstance().getAppData().removeAttendee(localAtt);
86               
87               if(!contains){
88                   localAtt.setName(attName);
89                   localAtt.setContact(UI.getInstance().getAttendeeDialog().getContactTxtArea().getText());
90                   int length=UI.getInstance().getAttendeeDialog().getSelectedAppAtt().getStrengths().size();
91                   for(int index=0;index<length;index++){
92                       localAtt.addStrength(UI.getInstance().getAttendeeDialog().getStm().getValueAt(index, 1).toString());
93                   }
94               }
95               
96               
97               newAttendee=localAtt.getAsResiAttendee();
98               newAttendee.setName(attName);
99               newAttendee.setContact(attContact);
100               newAttendee.setRole(roles[UI.getInstance().getAttendeeDialog().getRoleBox().getSelectedIndex()]);
101               newAttendee.setAspects(null);
102               if (newAttendee.getRole()==Role.REVIEWER){
103                   newAttendee.setAspects(null);
104               }
105               
106  
107               if(UI.getInstance().getAttendeeDialog().modeEdit==false){
108                   
109                   Application.getInstance().getAttendeeMgmt().addAttendee(newAttendee);
110               
111               }else{
112                   int selectedRow=UI.getInstance().getMainFrame().getAttendeesTable().getSelectedRow();
113                   Attendee oldAttendee=Data.getInstance().getResiData().getReview().getAttendees().get(selectedRow);
114                   Application.getInstance().getAttendeeMgmt().editAttendee(oldAttendee, newAttendee);
115               }
116               UI.getInstance().getMainFrame().getAttendeesTableModel().fireTableDataChanged();
117               UI.getInstance().getAspectsManagerFrame().clearFrame();
118               UI.getInstance().getAttendeeDialog().setVisible(false);
119           
120           } catch (DataException e) {
121               // TODO Auto-generated catch block
122               e.printStackTrace();
123           }
124           //TODO Aspects,ID
125           }
126  
127   }}
AddAttendeeAction.java
9   @SuppressWarnings("serial")
10   public class AddAttendeeAction extends AbstractAction {
11  
12       @Override
13       public void actionPerformed(ActionEvent e) {
14  
15           UI.getInstance().getAttendeeDialog().modeEdit=false;
16           UI.getInstance().getAttendeeDialog().setMode();
17           UI.getInstance().getAttendeeDialog().setVisible(true);
18       }
19  
20   }
RemoveAspFromRevAction.java
15   @SuppressWarnings("serial")
16   public class RemoveAspFromRevAction extends AbstractAction{
17       JTable localTable;
18       Attendee localAttendee;
19       ReviewerTableModel localRtm;
20       
21       public RemoveAspFromRevAction(JTable aspectTbl, Attendee att, ReviewerTableModel rtm) {
22           localTable=aspectTbl;
23           localAttendee=att;
24           localRtm=rtm;
25       }
26  
27       @Override
28       public void actionPerformed(ActionEvent arg0) {
29           
30           int selectedRow=localTable.getSelectedRow();
31           Aspect localAspect=Application.getInstance().getAttendeeMgmt().getAspects(localAttendee).get(selectedRow);
32           Application.getInstance().getAttendeeMgmt().removeAspect(localAspect, localAttendee);
33           localRtm.fireTableDataChanged();
34           UI.getInstance().getMainFrame().getAttendeesTableModel().fireTableDataChanged();
35       }
36  
37   }
RemoveAction.java
7   @SuppressWarnings("serial")
8   public class RemoveAction extends AbstractAction{
9  
10       @Override
11       public void actionPerformed(ActionEvent arg0) {
12           // TODO Auto-generated method stub
13           
14       }
15  
16   }
OpenAspectsManagerAction.java
9   @SuppressWarnings("serial")
10   public class OpenAspectsManagerAction extends AbstractAction{
11  
12       @Override
13       public void actionPerformed(ActionEvent arg0) {
14           UI.getInstance().getAspectsManagerFrame().clearFrame();
15           UI.getInstance().getAspectsManagerFrame().setVisible(true);
16       }
17  
18   }
ImportCatalogAction.java
3   public class ImportCatalogAction {
4  
5   }
ExportCatalogAction.java
3   public class ExportCatalogAction {
4  
5   }
EditCatalogAction.java
3   public class EditCatalogAction {
4  
5   }
AutoDistributionAction.java
3   public class AutoDistributionAction {
4  
5   }
AddReviewerAction.java
3   public class AddReviewerAction {
4  
5   }
AddCatalogAction.java
3   public class AddCatalogAction {
4  
5   }
AddAspectToReviewerAction.java
24   @SuppressWarnings("serial")
25   public class AddAspectToReviewerAction extends AbstractAction{
26       Attendee localAttendee;
27       ReviewerTableModel lrtm;
28       public AddAspectToReviewerAction(Attendee att, ReviewerTableModel rtm) {
29           localAttendee=att;
30           lrtm=rtm;
31       }
32  
33  
34       @Override
35       public void actionPerformed(ActionEvent arg0) {
36           JTree aspectsTree=new JTree(UI.getInstance().getAspectsManagerFrame().getTree().getModel());
37           expandAll(aspectsTree,true);
38           for(int index=0;index<aspectsTree.getRowCount();index++){
39               CheckNode node=((CheckNode)aspectsTree.getPathForRow(index).getLastPathComponent());
40               if(node.isLeaf()&&node.isSelected()){
41                   
42                   try {
43                       Aspect asp = ((AppAspect)node.getUserObject()).getAsResiAspect();
44                       Application.getInstance().getAttendeeMgmt().addAspect(asp, localAttendee);
45                       
46                   } catch (DataException e) {
47                       // TODO Auto-generated catch block
48                       e.printStackTrace();
49                   }
50                   lrtm.fireTableDataChanged();
51               }
52           }
53           UI.getInstance().getMainFrame().getAttendeesTableModel().fireTableDataChanged();
54       }
55       
56       
57       // If expand is true, expands all nodes in the tree.
58       // Otherwise, collapses all nodes in the tree.
59       public void expandAll(JTree tree, boolean expand) {
60           CheckNode root = (CheckNode) tree.getModel().getRoot();
61           // Traverse tree from root
62           expandAll(tree, new TreePath(root), expand);
63       }
64       
65       private void expandAll(JTree tree, TreePath parent, boolean expand) {
66           // Traverse children
67           CheckNode node = (CheckNode) parent.getLastPathComponent();
68           if (node.getChildCount() >= 0) {
69               for (Enumeration e = node.children(); e.hasMoreElements();) {
70                   CheckNode n = (CheckNode) e.nextElement();
71                   TreePath path = parent.pathByAddingChild(n);
72                   expandAll(tree, path, expand);
73               }
74           }
75           // Expansion or collapse must be done bottom-up
76           if (expand) {
77               tree.expandPath(parent);
78           } else {
79               tree.collapsePath(parent);
80           }
81       }
82  
83   }
AddAspectAction.java
14   @SuppressWarnings("serial")
15   public class AddAspectAction extends AbstractAction{
16  
17       @Override
18       public void actionPerformed(ActionEvent e) {
19           NewAspectPopupWindow popup = new NewAspectPopupWindow(UI.getInstance()
20                   .getAspectsManagerFrame(), Data.getInstance().getLocaleStr("popup.newAspect.title"));
21  
22           popup.setVisible(true);
23  
24           if(popup.getButtonClicked().toString().equals("OK")){
25               String directive = popup.getDirective();
26               String catalog;
27               if(popup.getCatalogBx().isEnabled()){
28                   catalog = popup.getCatalogBx().getSelectedItem().toString();
29               }else{
30                   catalog = popup.getCatalogTxtFld().getText();
31               }
32               String category;
33               if(popup.getCategoryBx().isEnabled()){
34                   category = popup.getCategoryBx().getSelectedItem().toString();
35               }else{
36                   category = popup.getCategoryTxtFld().getText();
37               }
38               String description = popup.getDescriptionTxtArea().getText();
39               AppCatalog newCat;
40               try {
41                   newCat = Data.getInstance().getAppData().newCatalog(catalog);
42                   newCat.newAspect(directive, description, category);
43               } catch (DataException e1) {
44                   // TODO Auto-generated catch block
45                   e1.printStackTrace();
46               }
47               UI.getInstance().getAspectsManagerFrame().repaintTree(null);
48               }
49       }
50  
51   }
AddAspToSelectedRevsAction.java
20   @SuppressWarnings("serial")
21   public class AddAspToSelectedRevsAction extends AbstractAction{
22  
23       @Override
24       public void actionPerformed(ActionEvent arg0) {
25           JTree aspectsTree=new JTree(UI.getInstance().getAspectsManagerFrame().getTree().getModel());
26           expandAll(aspectsTree,true);
27           for(int index=0;index<aspectsTree.getRowCount();index++){
28               CheckNode node=((CheckNode)aspectsTree.getPathForRow(index).getLastPathComponent());
29               if(node.isLeaf()&&node.isSelected()){
30                   
31                   for(Attendee att:UI.getInstance().getAspectsManagerFrame().getSelectedReviewers()){
32                       try {
33                           Aspect asp = ((AppAspect)node.getUserObject()).getAsResiAspect();
34                           Application.getInstance().getAttendeeMgmt().addAspect(asp, att);
35                       } catch (DataException e) {
36                       // TODO Auto-generated catch block
37                       e.printStackTrace();
38                       }
39                   }
40                   for(ReviewerTableModel rtm:UI.getInstance().getAspectsManagerFrame().getAllRevTblMdlList())
41                       rtm.fireTableDataChanged();
42               }
43           }
44           UI.getInstance().getMainFrame().getAttendeesTableModel().fireTableDataChanged();
45       }
46       
47       
48       // If expand is true, expands all nodes in the tree.
49       // Otherwise, collapses all nodes in the tree.
50       public void expandAll(JTree tree, boolean expand) {
51           CheckNode root = (CheckNode) tree.getModel().getRoot();
52           // Traverse tree from root
53           expandAll(tree, new TreePath(root), expand);
54       }
55       
56       private void expandAll(JTree tree, TreePath parent, boolean expand) {
57           // Traverse children
58           CheckNode node = (CheckNode) parent.getLastPathComponent();
59           if (node.getChildCount() >= 0) {
60               for (Enumeration e = node.children(); e.hasMoreElements();) {
61                   CheckNode n = (CheckNode) e.nextElement();
62                   TreePath path = parent.pathByAddingChild(n);
63                   expandAll(tree, path, expand);
64               }
65           }
66           // Expansion or collapse must be done bottom-up
67           if (expand) {
68               tree.expandPath(parent);
69           } else {
70               tree.collapsePath(parent);
71           }
72       }
73  
74   }
AddAspToAllRevsAction.java
20   @SuppressWarnings("serial")
21   public class AddAspToAllRevsAction extends AbstractAction{
22  
23       @Override
24       public void actionPerformed(ActionEvent arg0) {
25           JTree aspectsTree=new JTree(UI.getInstance().getAspectsManagerFrame().getTree().getModel());
26           expandAll(aspectsTree,true);
27           for(int index=0;index<aspectsTree.getRowCount();index++){
28               CheckNode node=((CheckNode)aspectsTree.getPathForRow(index).getLastPathComponent());
29               if(node.isLeaf()&&node.isSelected()){
30                   
31                   AttendeeManagement attMgmt=Application.getInstance().getAttendeeMgmt();
32                   for(Attendee att:attMgmt.getAttendees()){
33                       try {
34                           Aspect asp = ((AppAspect)node.getUserObject()).getAsResiAspect();
35                           attMgmt.addAspect(asp, att);
36                       } catch (DataException e) {
37                       // TODO Auto-generated catch block
38                       e.printStackTrace();
39                       }
40                   }
41                   for(ReviewerTableModel rtm:UI.getInstance().getAspectsManagerFrame().getAllRevTblMdlList())
42                       rtm.fireTableDataChanged();
43               }
44           }
45           UI.getInstance().getMainFrame().getAttendeesTableModel().fireTableDataChanged();
46       }
47       
48       
49       // If expand is true, expands all nodes in the tree.
50       // Otherwise, collapses all nodes in the tree.
51       public void expandAll(JTree tree, boolean expand) {
52           CheckNode root = (CheckNode) tree.getModel().getRoot();
53           // Traverse tree from root
54           expandAll(tree, new TreePath(root), expand);
55       }
56       
57       private void expandAll(JTree tree, TreePath parent, boolean expand) {
58           // Traverse children
59           CheckNode node = (CheckNode) parent.getLastPathComponent();
60           if (node.getChildCount() >= 0) {
61               for (Enumeration e = node.children(); e.hasMoreElements();) {
62                   CheckNode n = (CheckNode) e.nextElement();
63                   TreePath path = parent.pathByAddingChild(n);
64                   expandAll(tree, path, expand);
65               }
66           }
67           // Expansion or collapse must be done bottom-up
68           if (expand) {
69               tree.expandPath(parent);
70           } else {
71               tree.collapsePath(parent);
72           }
73       }
74  
75   }
TextPopupWindowAction.java
17   @SuppressWarnings("serial")
18   public class TextPopupWindowAction extends AbstractAction {
19       
20       private TextPopupWindow popupWindow = null;
21       
22       private ButtonClicked buttonClick = null;
23       
24       public TextPopupWindowAction(TextPopupWindow popupWin, ButtonClicked buttonClk) {
25           this.popupWindow = popupWin;
26           this.buttonClick = buttonClk;
27       }
28  
29       /* (non-Javadoc)
30        * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
31        */
32       @Override
33       public void actionPerformed(ActionEvent e) {
34           popupWindow.setButtonClicked(buttonClick);
35           popupWindow.setVisible(false);
36       }
37  
38   }
SelectModeAction.java
16   @SuppressWarnings("serial")
17   public class SelectModeAction extends AbstractAction {
18  
19       @Override
20       public void actionPerformed(ActionEvent e) {
21           UI.getInstance().getAssistantDialog().setSelectMode();
22           UI.getInstance().getAssistantDialog().setVisible(true);
23       }
24  
25   }
SelectDirectoryAction.java
3   public class SelectDirectoryAction {
4  
5   }
SaveReviewAsAction.java
19   @SuppressWarnings("serial")
20   public class SaveReviewAsAction extends AbstractAction {
21  
22       @Override
23       public void actionPerformed(ActionEvent e) {
24           FileChooser fileChooser = UI.getInstance().getFileChooser();
25  
26           if (fileChooser.showDialog(UI.getInstance().getMainFrame(),
27                   FileChooser.MODE_SAVE_FILE, ResiFileFilter.TYPE_REVIEW) == FileChooser.SELECTED_APPROVE) {
28               String reviewPath = fileChooser.getFile().getAbsolutePath();
29  
30               new SaveReviewWorker(reviewPath).execute();
31           }
32       }
33  
34   }
SaveReviewAction.java
13   @SuppressWarnings("serial")
14   public class SaveReviewAction extends AbstractAction {
15  
16       @Override
17       public void actionPerformed(ActionEvent e) {
18           FileChooser fileChooser = UI.getInstance().getFileChooser();
19           String reviewPath = Data.getInstance().getResiData().getReviewPath();
20  
21           if (reviewPath == null) {
22               if (fileChooser.showDialog(UI.getInstance().getMainFrame(),
23                       FileChooser.MODE_SAVE_FILE, ResiFileFilter.TYPE_REVIEW) == FileChooser.SELECTED_APPROVE) {
24                   reviewPath = fileChooser.getFile().getAbsolutePath();
25               }
26           }
27  
28           if (reviewPath != null) {
29               new SaveReviewWorker(reviewPath).execute();
30           }
31       }
32  
33   }
OpenScribeModusAction.java
10   @SuppressWarnings("serial")
11   public class OpenScribeModusAction extends AbstractAction{
12  
13       @Override
14       public void actionPerformed(ActionEvent e) {
15  
16           Data.getInstance().setMode("scribe");
17           UI.getInstance().getAssistantDialog().setSelectReview();
18           }
19  
20   }
OpenModeratorModusAction.java
10   @SuppressWarnings("serial")
11   public class OpenModeratorModusAction extends AbstractAction{
12  
13       @Override
14       public void actionPerformed(ActionEvent e) {
15  
16           Data.getInstance().setMode("moderator");
17           UI.getInstance().getAssistantDialog().setSelectReview();
18       }
19  
20   }
NewReviewAction.java
13   @SuppressWarnings("serial")
14   public class NewReviewAction extends AbstractAction {
15  
16       @Override
17       public void actionPerformed(ActionEvent arg0) {
18           if (UI.getInstance().getStatus() == UI.Status.UNSAVED_CHANGES) {
19               int option = JOptionPane.showConfirmDialog(org.revager.gui.UI
20                       .getInstance().getMainFrame(), GUITools.getMessagePane(Data
21                       .getInstance().getLocaleStr("message.unsavedChanges")),
22                       Data.getInstance().getLocaleStr("question"),
23                       JOptionPane.YES_NO_CANCEL_OPTION,
24                       JOptionPane.QUESTION_MESSAGE);
25  
26               if (option == JOptionPane.YES_OPTION) {
27                   ActionRegistry.getInstance().get(
28                           SaveReviewAction.class.getName()).actionPerformed(null);
29               }
30  
31               if (option == JOptionPane.CANCEL_OPTION) {
32                   return;
33               }
34           }
35  
36           new NewReviewWorker().execute();
37       }
38  
39   }
ManageSeveritiesAction.java
9   @SuppressWarnings("serial")
10   public class ManageSeveritiesAction extends AbstractAction {
11  
12       @Override
13       public void actionPerformed(ActionEvent e) {
14           UI.getInstance().getManageSeveritiesDialog().setVisible(true);
15       }
16  
17   }
LoadReviewAction.java
16   @SuppressWarnings("serial")
17   public class LoadReviewAction extends AbstractAction {
18  
19       @Override
20       public void actionPerformed(ActionEvent arg0) {
21           FileChooser fileChooser = UI.getInstance().getFileChooser();
22  
23           if (fileChooser.showDialog(UI.getInstance().getMainFrame(),
24                   FileChooser.MODE_OPEN_FILE, ResiFileFilter.TYPE_REVIEW) == FileChooser.SELECTED_APPROVE) {
25               String reviewPath = fileChooser.getFile().getAbsolutePath();
26               
27               new LoadReviewWorker(reviewPath).execute();
28           }
29       }
30       
31   }
InitializeMainFrameAction.java
11   @SuppressWarnings("serial")
12   public class InitializeMainFrameAction extends AbstractAction {
13  
14       @Override
15       public void actionPerformed(ActionEvent e) {
16           AssistantDialog.Selection sel = UI.getInstance().getAssistantDialog().getSelected();
17           
18           if (sel == AssistantDialog.Selection.NEW_REVIEW) {
19               ActionRegistry.getInstance().get(NewReviewAction.class.getName())
20                       .actionPerformed(null);
21           } else if (sel == AssistantDialog.Selection.LOAD_REVIEW) {
22               new LoadReviewWorker(UI.getInstance().getAssistantDialog()
23                       .getPath()).execute();
24           } else if (sel == AssistantDialog.Selection.MANAGE_ASPECTS) {
25               UI.getInstance().getAssistantDialog().setVisible(false);
26               UI.getInstance().getAspectsManagerFrame().setVisible(true);
27               
28               UI.getInstance().setStatus(UI.Status.NO_FILE_LOADED);
29           }
30       }
31  
32   }
ExportCSVReviewAction.java
9   @SuppressWarnings("serial")
10   public class ExportCSVReviewAction extends AbstractAction {
11  
12       @Override
13       public void actionPerformed(ActionEvent arg0) {
14           //TODO muss noch impl. werden
15       }
16  
17       
18   }
ExportCSVMeetingAction.java
3   public class ExportCSVMeetingAction {
4  
5   }
ExitAction.java
17   @SuppressWarnings("serial")
18   public class ExitAction extends AbstractAction {
19  
20       public ExitAction() {
21           super();
22           putValue(Action.NAME, "Beenden");
23           putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_Q,
24                   ActionEvent.CTRL_MASK));
25           putValue(Action.SHORT_DESCRIPTION, "Programm beenden");
26       }
27  
28       @Override
29       public void actionPerformed(ActionEvent e) {
30           Status status = org.revager.gui.UI.getInstance().getStatus();
31           if (status == Status.UNSAVED_CHANGES) {
32               int option = JOptionPane.showConfirmDialog(org.revager.gui.UI
33                       .getInstance().getMainFrame(), GUITools.getMessagePane(Data
34                       .getInstance().getLocaleStr("message.unsavedChanges")),
35                       Data.getInstance().getLocaleStr("question"),
36                       JOptionPane.YES_NO_CANCEL_OPTION,
37                       JOptionPane.QUESTION_MESSAGE);
38               if (option == JOptionPane.YES_OPTION) {
39                   ActionRegistry.getInstance().get(
40                           SaveReviewAction.class.getName()).actionPerformed(e);
41               }
42  
43               if (option == JOptionPane.NO_OPTION) {
44                   exitApplication();
45               }
46  
47           } else {
48               exitApplication();
49           }
50       }
51  
52       /**
53        * This method shuts down the application by freeing all resources and
54        * returning an exit code to the operating system.
55        */
56       private void exitApplication() {
57           UI.getInstance().getMainFrame().dispose();
58           Application.getInstance().getApplicationCtl().clearReview();
59  
60           System.exit(0);
61       }
62  
63   }
EditAspectsAction.java
7   public class EditAspectsAction extends AbstractAction{
8  
9       @Override
10       public void actionPerformed(ActionEvent e) {
11           // TODO Auto-generated method stub
12           
13       }
14  
15   }
DatePickerAction.java
12   @SuppressWarnings("serial")
13   public class DatePickerAction extends AbstractAction{
14       public void actionPerformed(ActionEvent e) {
15               // instantiate the DatePicker
16               DatePicker dp = new DatePicker(UI.getInstance().getMeetingDialog(), UI.getInstance().getMeetingDialog().getDateTxtFld());
17               // previously selected date
18               Date selectedDate = dp.parseDate(UI.getInstance().getMeetingDialog().getDateTxtFld().getText());
19               dp.setSelectedDate(selectedDate);
20               dp.start(UI.getInstance().getMeetingDialog().getDateTxtFld());
21           };
22       
23  
24   }
CreatePDFReviewProtocolAction.java
3   public class CreatePDFReviewProtocolAction {
4  
5   }
CreatePDFMeetingProtocolAction.java
3   public class CreatePDFMeetingProtocolAction {
4  
5   }
CreateInvitationsAction.java
3   public class CreateInvitationsAction {
4  
5   }
ActionRegistry.java
43   public class ActionRegistry {
44  
45   private static ActionRegistry instance = null;
46       
47       public static ActionRegistry getInstance(){
48           if (instance == null) {
49               instance = new ActionRegistry();
50           }
51           return instance;
52       };
53       
54       private Map<String,Action> actions;
55       
56       public void register(Action action) {
57           getActions().put(action.getClass().getName(), action);
58       }
59       
60       private Map<String, Action> getActions() {
61           // The map for storing the actions is initialized on demand.
62           if (actions == null) {
63               actions = new HashMap<String, Action>();
64           }
65           return actions;
66       }
67       
68       public Action get(String className) {
69           return getActions().get(className);
70       }
71       
72       private ActionRegistry() {
73           super();
74           register(new ResetAction());
75           register(new SearchAction());
76           register(new OpenHelpAction());
77           register(new ExitAction());
78           register(new LoadReviewAction());
79           register(new SaveReviewAsAction());
80           register(new SaveReviewAction());
81           register(new ExportCSVReviewAction());
82           register(new OpenScribeModusAction());
83           register(new OpenModeratorModusAction());
84           register(new InitializeMainFrameAction());
85           register(new EditProductAction());
86           register(new ManageSeveritiesAction());
87           register(new EditMeetingAction());
88           register(new EditAttendeeAction());
89           register(new AddMeetingAction());
90           register(new AddAttendeeAction());
91           register(new DatePickerAction());
92           register(new ConfirmAttendeeAction());
93           register(new RemoveAttendeeAction());
94           register(new ConfirmMeetingAction());
95           register(new RemoveMeetingAction());
96           register(new NewReviewAction());
97           register(new AddProductReferenceAction());
98           register(new RemoveProductReferenceAction());
99           register(new EditProductReferenceAction());
100           register(new AddSeverityAction());
101           register(new RemoveSeverityAction());
102           register(new EditSeverityAction());
103           register(new PushSeverityUpAction());
104           register(new PushSeverityDownAction());
105           register(new PushSeverityTopAction());
106           register(new PushSeverityBottomAction());
107           register(new OpenInvitationsDialogAction());
108           register(new OpenAspectsManagerAction());
109           register(new CommentMeetingAction());
110           register(new SelectModeAction());
111           register(new AddAspectAction());
112           register(new AddAspToAllRevsAction());
113           register(new AddAspToSelectedRevsAction());
114           register(new SelectAttendeeOutOfDirAction());
115           register(new OpenProtocolModeAction());
116           register(new AddStrengthAction());
117           register(new EditStrengthAction());
118           register(new RemoveStrengthAction());
119       }
120   }
UI.java
24   public class UI implements Observer {
25  
26       public static final Color SEPARATOR_COLOR = new Color(170, 170, 170);
27  
28       public static final Color POPUP_BACKGROUND = new Color(220, 231, 255);
29  
30       public static final Border POPUP_BORDER = BorderFactory.createLineBorder(
31               Color.GRAY, 2);
32  
33       private MainFrame mainFrame;
34       private HelpBrowserFrame helpBrowserFrame;
35       private AssistantDialog assistantDialog;
36       private EditProductDialog editProductDialog;
37       private ManageSeveritiesDialog manageSeveritiesDialog;
38       private MeetingDialog meetingDialog;
39       private AttendeeDialog attendeeDialog;
40       private AspectsManagerFrame aspectsManagerFrame;
41       private EditProtocolDialog editProtocolDialog;
42       private ExportCSVDialog exportCSVDialog;
43       private CreatePDFProtocolDialog createPDFProtocolDialog;
44       private CreateInvitationsDialog createInvitationsDialog;
45       private SettingsDialog settingsDialog;
46       private SelectAspectsDialog selectAspectsDialog;
47       private FileChooser fileChooser;
48  
49       
UI.java
51       }
52  
53       
UI.java
55       }
56  
57       private Status status = Status.NO_FILE_LOADED;
58  
59       private Platform platform = Platform.OTHER;
60  
61       public Status getStatus() {
62           return status;
63       }
64  
65       public void setStatus(Status status) {
66           this.status = status;
67           
68           mainFrame.updateTitle();
69       }
70  
71       /**
72        * @return the platform
73        */
74       public Platform getPlatform() {
75           return platform;
76       }
77  
78       private static UI instance = new UI();
79  
80       public static UI getInstance() {
81           if (instance == null) {
82               instance = new UI();
83           }
84           return instance;
85       };
86  
87       public MainFrame getMainFrame() {
88           if (mainFrame == null) {
89               mainFrame = new MainFrame();
90               Data.getInstance().getResiData().addObserver(mainFrame);
91           }
92           return mainFrame;
93       };
94  
95       public HelpBrowserFrame getHelpBrowserFrame() {
96           if (helpBrowserFrame == null) {
97               helpBrowserFrame = new HelpBrowserFrame();
98           }
99           return helpBrowserFrame;
100       };
101  
102       public AssistantDialog getAssistantDialog() {
103           if (assistantDialog == null) {
104               assistantDialog = new AssistantDialog(UI.getInstance()
105                       .getMainFrame());
106           }
107           return assistantDialog;
108       };
109  
110       public EditProductDialog getEditProductDialog() {
111           if (editProductDialog == null) {
112               editProductDialog = new EditProductDialog(UI.getInstance()
113                       .getMainFrame());
114           }
115           return editProductDialog;
116       };
117  
118       public ManageSeveritiesDialog getManageSeveritiesDialog() {
119           if (manageSeveritiesDialog == null) {
120               manageSeveritiesDialog = new ManageSeveritiesDialog(UI
121                       .getInstance().getMainFrame());
122           }
123           return manageSeveritiesDialog;
124       };
125  
126       public MeetingDialog getMeetingDialog() {
127           if (meetingDialog == null) {
128               meetingDialog = new MeetingDialog(UI.getInstance().getMainFrame());
129           }
130           return meetingDialog;
131       };
132  
133       public AttendeeDialog getAttendeeDialog() {
134           if (attendeeDialog == null) {
135               attendeeDialog = new AttendeeDialog(UI.getInstance().getMainFrame());
136           }
137           return attendeeDialog;
138       };
139  
140       public AspectsManagerFrame getAspectsManagerFrame() {
141           if (aspectsManagerFrame == null) {
142               aspectsManagerFrame = new AspectsManagerFrame(UI.getInstance()
143                       .getMainFrame());
144           }
145           return aspectsManagerFrame;
146       };
147  
148       public EditProtocolDialog getEditProtocolDialog() {
149           if (editProtocolDialog == null) {
150               editProtocolDialog = new EditProtocolDialog();
151           }
152           return editProtocolDialog;
153       };
154  
155       public ExportCSVDialog getExportCSVDialog() {
156           if (exportCSVDialog == null) {
157               exportCSVDialog = new ExportCSVDialog();
158           }
159           return exportCSVDialog;
160       };
161  
162       public CreatePDFProtocolDialog getCreatePDFProtocolDialog() {
163           if (createPDFProtocolDialog == null) {
164               createPDFProtocolDialog = new CreatePDFProtocolDialog();
165           }
166           return createPDFProtocolDialog;
167       };
168  
169       public CreateInvitationsDialog getCreateInvitationsDialog() {
170           if (createInvitationsDialog == null) {
171               createInvitationsDialog = new CreateInvitationsDialog(UI
172                       .getInstance().getMainFrame());
173           }
174           return createInvitationsDialog;
175       };
176  
177       public SettingsDialog getSettingsDialog() {
178           if (settingsDialog == null) {
179               settingsDialog = new SettingsDialog();
180           }
181           return settingsDialog;
182       };
183  
184       public SelectAspectsDialog getSelectAspectsDialog() {
185           if (selectAspectsDialog == null) {
186               selectAspectsDialog = new SelectAspectsDialog();
187           }
188           return selectAspectsDialog;
189       };
190  
191       public FileChooser getFileChooser() {
192           if (fileChooser == null) {
193               fileChooser = new FileChooser();
194           }
195           return fileChooser;
196       }
197  
198       private UI() {
199           super();
200           
201           /*
202            * Add this class as observer to the data model
203            */
204           Data.getInstance().getResiData().addObserver(this);
205  
206           /*
207            * Determine on which platform the application is running
208            */
209           String osName = System.getProperty("os.name").toLowerCase();
210  
211           if (osName.contains("mac")) {
212               platform = Platform.MAC;
213           } else if (osName.contains("windows")) {
214               platform = Platform.WINDOWS;
215           } else {
216               platform = Platform.OTHER;
217           }
218  
219           /*
220            * Set some properties for Mac OS X
221            */
222           if (platform == Platform.MAC) {
223               System.setProperty("apple.laf.useScreenMenuBar", "true");
224  
225               System.setProperty(
226                       "com.apple.mrj.application.apple.menu.about.name", Data
227                               .getInstance().getResource("appName"));
228           }
229  
230           /*
231            * Set the GUI look-and-feel for the current platform
232            */
233           try {
234               if (platform == Platform.MAC || platform == Platform.WINDOWS) {
235                   UIManager.setLookAndFeel(UIManager
236                           .getSystemLookAndFeelClassName());
237               } else {
238                   UIManager
239                           .setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
240               }
241           } catch (Exception e) {
242               System.err.println(e.getMessage());
243           }
244       }
245  
246       public void run() {
247           /*
248            * Initialize the frames
249            */
250           getHelpBrowserFrame();
251           getAspectsManagerFrame();
252  
253           /*
254            * If a review backup is present, try to load it; otherwise show the
255            * assistant dialog
256            */
257           if (Application.getInstance().getApplicationCtl().isReviewRestorable()) {
258               getMainFrame().setVisible(true);
259  
260               Object[] options = {
261                       Data.getInstance().getLocaleStr("button.restore"),
262                       Data.getInstance().getLocaleStr("button.discard") };
263  
264               if (JOptionPane.showOptionDialog(mainFrame, GUITools
265                       .getMessagePane(Data.getInstance().getLocaleStr(
266                               "message.reviewRestorable")), Data.getInstance()
267                       .getLocaleStr("question"), JOptionPane.YES_NO_OPTION,
268                       JOptionPane.QUESTION_MESSAGE, null, options, options[0]) == JOptionPane.YES_OPTION) {
269                   new RestoreReviewWorker().execute();
270               } else {
271                   Application.getInstance().getApplicationCtl().clearReview();
272  
273                   getAssistantDialog().setVisible(true);
274               }
275           } else {
276               getAssistantDialog().setVisible(true);
277           }
278       }
279  
280       @Override
281       public void update(Observable o, Object arg) {
282           setStatus(Status.UNSAVED_CHANGES);
283       }
284  
285   }
TextPopupWindow.java
23   @SuppressWarnings("serial")
24   public class TextPopupWindow extends JDialog {
25  
26       
TextPopupWindow.java
28       };
29  
30       private ButtonClicked buttonClicked = null;
31  
32       private JTextComponent textInput = null;
33  
34       public TextPopupWindow(Window parent, String titleText, String inputText,
35               boolean multiLine) {
36           super(parent);
37  
38           setLayout(new BorderLayout());
39  
40           setUndecorated(true);
41  
42           setModal(true);
43  
44           JPanel panelBase = GUITools.newPopupBasePanel();
45  
46           JTextArea textTitle = new JTextArea();
47           textTitle.setEditable(false);
48           textTitle.setText(titleText);
49           textTitle.setBackground(UI.POPUP_BACKGROUND);
50           textTitle.setFont(textTitle.getFont().deriveFont(Font.BOLD));
51           textTitle.setMargin(new Insets(3, 3, 3, 3));
52           textTitle.setLineWrap(true);
53           textTitle.setWrapStyleWord(true);
54           textTitle.setFocusable(false);
55  
56           panelBase.add(textTitle, BorderLayout.NORTH);
57  
58           Dimension popupSize;
59  
60           if (multiLine == true) {
61               textInput = new JTextArea();
62               textInput.setMargin(new Insets(3, 3, 3, 3));
63               ((JTextArea) textInput).setLineWrap(true);
64               ((JTextArea) textInput).setWrapStyleWord(true);
65  
66               JScrollPane scrollPane = new JScrollPane(textInput);
67               // scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
68               scrollPane.setBorder(null);
69  
70               panelBase.add(scrollPane, BorderLayout.CENTER);
71  
72               popupSize = new Dimension(260, 200);
73           } else {
74               textInput = new JTextField();
75               textInput.setBorder(BorderFactory.createLineBorder(Color.WHITE, 3));
76  
77               panelBase.add(textInput, BorderLayout.CENTER);
78  
79               popupSize = new Dimension(260, 110);
80           }
81  
82           /*
83            * Text input general
84            */
85           textInput.setText(inputText);
86           textInput.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 14));
87  
88           /*
89            * The buttons to abort and confirm the input
90            */
91           JButton buttonAbort = GUITools.newImageButton();
92           buttonAbort.setIcon(Data.getInstance().getIcon(
93                   "buttonCancel_24x24_0.png"));
94           buttonAbort.setRolloverIcon(Data.getInstance().getIcon(
95                   "buttonCancel_24x24.png"));
96           buttonAbort.setToolTipText(Data.getInstance().getLocaleStr("abort"));
97           buttonAbort.addActionListener(new TextPopupWindowAction(this,
98                   ButtonClicked.ABORT));
99  
100           JButton buttonConfirm = GUITools.newImageButton();
101           buttonConfirm.setIcon(Data.getInstance()
102                   .getIcon("buttonOk_24x24_0.png"));
103           buttonConfirm.setRolloverIcon(Data.getInstance().getIcon(
104                   "buttonOk_24x24.png"));
105           buttonConfirm
106                   .setToolTipText(Data.getInstance().getLocaleStr("confirm"));
107           buttonConfirm.addActionListener(new TextPopupWindowAction(this,
108                   ButtonClicked.OK));
109  
110           JPanel panelButtons = new JPanel(new BorderLayout());
111           panelButtons.setBackground(UI.POPUP_BACKGROUND);
112           panelButtons.setBorder(BorderFactory.createLineBorder(panelButtons
113                   .getBackground(), 3));
114           panelButtons.add(buttonAbort, BorderLayout.WEST);
115           panelButtons.add(buttonConfirm, BorderLayout.EAST);
116  
117           /*
118            * Base panel
119            */
120           panelBase.add(panelButtons, BorderLayout.SOUTH);
121  
122           add(panelBase, BorderLayout.CENTER);
123  
124           pack();
125  
126           /*
127            * Set size and location
128            */
129           setMinimumSize(popupSize);
130           setSize(popupSize);
131  
132           int posX = (int) ((int) (parent.getSize().getWidth() / 2) - (this
133                   .getSize().getWidth() / 2));
134           int posY = (int) ((int) (parent.getSize().getHeight() / 2) - (this
135                   .getSize().getHeight() / 2));
136  
137           setLocation(posX, posY);
138       }
139  
140       /**
141        * @return the buttonClicked
142        */
143       public ButtonClicked getButtonClicked() {
144           return buttonClicked;
145       }
146  
147       /**
148        * @param buttonClicked
149        *            the buttonClicked to set
150        */
151       public void setButtonClicked(ButtonClicked buttonClicked) {
152           this.buttonClicked = buttonClicked;
153       }
154  
155       /**
156        * @return the input
157        */
158       public String getInput() {
159           return textInput.getText();
160       }
161  
162   }
SettingsDialog.java
3   public class SettingsDialog {
4  
5   }
SelectAspectsDialog.java
3   public class SelectAspectsDialog {
4  
5   }
NodeSelectionListener.java
26   class NodeSelectionListener implements MouseListener {
27       JTree tree;
28       int selectedRow;
29       TreePath  path;
30       AppAspect appAsp;
31       AppCatalog parentCatalog;
32       AppCatalog catalog;
33       AppAspect selectedAspect;
34       String category;
35  
36  
37       NodeSelectionListener(JTree tree) {
38         this.tree = tree;
39       }
40      
41       public void mouseClicked(MouseEvent e) {
42           
43       }
44  
45       @Override
46       public void mouseEntered(MouseEvent e) {
47       }
48  
49       @Override
50       public void mouseExited(MouseEvent e) {
51           // TODO Auto-generated method stub
52           
53       }
54  
55       @Override
56       public void mousePressed(MouseEvent e) {
57           if(e.getClickCount()==2)
58               setNodeBehaviour(true,e);
59           else setNodeBehaviour(false,e);
60       }
61  
62       @Override
63       public void mouseReleased(MouseEvent e) {
64           // TODO Auto-generated method stub
65           
66       }
67       private void deselectParent(TreePath path){
68           try{
69           CheckNode node1 = (CheckNode)path.getParentPath().getLastPathComponent();
70           boolean allChildsSelected=true;
71           for (int i=0;i<node1.getChildCount();i++){
72               if(((CheckNode) node1.getChildAt(i)).isSelected()==false)allChildsSelected=false;
73           }
74           if(!allChildsSelected){
75               node1.setSelected(false);
76               deselectParent(path.getParentPath());
77           }
78           UI.getInstance().getAspectsManagerFrame().getTree().repaint();
79           }catch(Exception e){}
80       }
81       
82       private void selectParent(TreePath path){
83           try{
84           CheckNode node1 = (CheckNode)path.getParentPath().getLastPathComponent();
85           boolean allChildsSelected=true;
86           for (int i=0;i<node1.getChildCount();i++){
87               if(((CheckNode) node1.getChildAt(i)).isSelected()==false)allChildsSelected=false;
88           }
89           if(allChildsSelected){
90               node1.setSelected(true);
91               selectParent(path.getParentPath());
92           }
93           UI.getInstance().getAspectsManagerFrame().getTree().repaint();
94           }catch(Exception e){}
95       }
96       
97       private void deselectChilds(TreePath path){
98           try{
99           CheckNode node1 = (CheckNode)path.getLastPathComponent();
100           node1.setSelected(false);
101           for (int i=0;i<node1.getChildCount();i++){
102               deselectChilds(path.pathByAddingChild(node1.getChildAt(i)));
103           }
104           UI.getInstance().getAspectsManagerFrame().getTree().repaint();
105           }catch(Exception e){}
106       }
107       
108       private void repaintCategoryBx(AppCatalog catalog, String category){
109           try {
110               
111               for(String cate:catalog.getCategories()){
112                   UI.getInstance().getAspectsManagerFrame().getCategoryBx().addItem(cate);
113                   }
114           } catch (DataException e) {
115               // TODO Auto-generated catch block
116               e.printStackTrace();
117           }
118             UI.getInstance().getAspectsManagerFrame().setCategoryBx(category);
119             
120       }
121       
122       
123       private void setNodeBehaviour(boolean selectable,MouseEvent e){
124  
125             int x = e.getX();
126             int y = e.getY();
127             int row = tree.getRowForLocation(x, y);
128             path = tree.getPathForRow(row);
129             try{
130                 tree.expandPath(path);
131             }catch(Exception exc){
132                 tree.collapsePath(path);
133             }
134             //TreePath  path = tree.getSelectionPath();
135             if (path != null) {
136                 CheckNode node = (CheckNode)path.getLastPathComponent();    
137                 if(selectable){
138                   boolean isSelected = ! (node.isSelected());
139                   node.setSelected(isSelected);                
140                      if ( isSelected) {
141                          tree.expandPath(path);
142                          selectParent(path);
143                      } else if(path.getPathCount()!=1){
144                          //tree.collapsePath(path);
145                          deselectParent(path);
146                          deselectChilds(path);
147                         
148                        }
149                      ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
150                    
151               }
152               if(path.getPathCount()==2)
153                   try {
154                       catalog=Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString());
155                   } catch (DataException e2) {
156                       // TODO Auto-generated catch block
157                       e2.printStackTrace();
158                   }
159               else if(path.getPathCount()==3)
160                   category=path.getPathComponent(2).toString();
161               if(path.getPathCount()==4){
162                   category=path.getPathComponent(2).toString();
163                   UI.getInstance().getAspectsManagerFrame().setSubPanelEnabled(true);
164                   selectedRow=tree.getRowForPath(path)-tree.getRowForPath(path.getParentPath())-1;
165                   UI.getInstance().getAspectsManagerFrame().getCategoryBx().removeAllItems();
166                   try{
167                       selectedAspect=Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString()).getAspects(path.getPathComponent(2).toString()).get(selectedRow);
168                       parentCatalog=Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString());
169                       String directive=selectedAspect.getDirective();
170                         String description=selectedAspect.getDescription();
171                         UI.getInstance().getAspectsManagerFrame().setDirective(directive);
172                         UI.getInstance().getAspectsManagerFrame().setDescription(description);
173                     
174                         
175                         appAsp=Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString()).getAspects(path.getPathComponent(2).toString()).get(selectedRow);
176                       
177                         if(UI.getInstance().getAspectsManagerFrame().getAcceptBttn().getListeners(ActionListener.class).length==0){
178                             UI.getInstance().getAspectsManagerFrame().getAcceptBttn().addActionListener(new ActionListener(){
179                             
180                             @Override
181                           public void actionPerformed(ActionEvent e) {
182                               try {
183                                   //appAsp=Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString()).getAspects(path.getPathComponent(2).toString()).get(selectedRow);
184                                   category = UI.getInstance().getAspectsManagerFrame().getCategory();
185                                   String directive=UI.getInstance().getAspectsManagerFrame().getDirective();
186                                   String description=UI.getInstance().getAspectsManagerFrame().getDescription();
187                                   parentCatalog.removeAspect(appAsp);
188                                     parentCatalog.newAspect(directive, description, category);
189                                   UI.getInstance().getAspectsManagerFrame().repaintTree(path);
190                                   UI.getInstance().getAspectsManagerFrame().setRootSelected(false);
191                                   UI.getInstance().getAspectsManagerFrame().setSubPanelEnabled(false);
192                                   
193                               } catch (DataException e1) {
194                                   // TODO Auto-generated catch block
195                                   e1.printStackTrace();
196                               }
197                               
198                           }});
199                         }
200                         repaintCategoryBx(parentCatalog, category);
201                       
202                                       
203                 }catch(Exception exc){}
204                 }else{
205                     UI.getInstance().getAspectsManagerFrame().setSubPanelEnabled(false);
206                 }
207  
208               // I need revalidate if node is root.  but why?
209               if (row == 0) {
210                 tree.revalidate();
211                 tree.repaint();
212               }
213             }
214            
215             /*
216              * PushTop
217              */
218  
219           if(UI.getInstance().getAspectsManagerFrame().getPushTopBttn().getListeners(ActionListener.class).length==0){
220               
221             UI.getInstance().getAspectsManagerFrame().getPushTopBttn().addActionListener(new ActionListener(){
222  
223                 @Override
224                 public void actionPerformed(ActionEvent arg0) {
225                     try {
226                         if(path.getPathCount()==2){
227                             catalog.pushTop();
228                           }else if(path.getPathCount()==3){
229                               Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString()).pushTopCategory(category);
230                           }else if(path.getPathCount()==4){
231                               appAsp.pushTop();
232                           }
233                               UI.getInstance().getAspectsManagerFrame().repaintTree(path);
234                           
235                       } catch (DataException e) {
236                           // TODO Auto-generated catch block
237                           e.printStackTrace();
238                       }
239                   }});
240           }
241           
242             /*
243              * PushUp
244              */
245  
246           if(UI.getInstance().getAspectsManagerFrame().getPushUpBttn().getListeners(ActionListener.class).length==0){
247               
248             UI.getInstance().getAspectsManagerFrame().getPushUpBttn().addActionListener(new ActionListener(){
249  
250                 @Override
251                 public void actionPerformed(ActionEvent arg0) {
252                     try {
253                         if(path.getPathCount()==2){
254                             catalog.pushUp();
255                           }else if(path.getPathCount()==3){
256                               Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString()).pushUpCategory(category);
257                           }else if(path.getPathCount()==4){
258                               appAsp.pushUp();
259                           }
260                               UI.getInstance().getAspectsManagerFrame().repaintTree(path);
261                           
262                       } catch (DataException e) {
263                           // TODO Auto-generated catch block
264                           e.printStackTrace();
265                       }
266                   }});
267           }
268           
269             /*
270              * PushDown
271              */
272  
273           if(UI.getInstance().getAspectsManagerFrame().getPushDownBttn().getListeners(ActionListener.class).length==0){    
274             UI.getInstance().getAspectsManagerFrame().getPushDownBttn().removeAll();
275             UI.getInstance().getAspectsManagerFrame().getPushDownBttn().addActionListener(new ActionListener(){
276  
277                 @Override
278                 public void actionPerformed(ActionEvent arg0) {
279                     try {
280                         if(path.getPathCount()==2){
281                             catalog.pushDown();
282                           }else if(path.getPathCount()==3){
283                               Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString()).pushDownCategory(category);
284                           }else if(path.getPathCount()==4){
285                               appAsp.pushDown();
286                           }
287                               UI.getInstance().getAspectsManagerFrame().repaintTree(path);
288                           
289                       } catch (DataException e) {
290                           // TODO Auto-generated catch block
291                           e.printStackTrace();
292                       }
293                   }});
294           }
295           
296             /*
297              * PushBottom
298              */
299           if(UI.getInstance().getAspectsManagerFrame().getPushBottomBttn().getListeners(ActionListener.class).length==0){    
300            
301             UI.getInstance().getAspectsManagerFrame().getPushBottomBttn().addActionListener(new ActionListener(){
302  
303                 @Override
304                 public void actionPerformed(ActionEvent arg0) {
305                     try {
306                         if(path.getPathCount()==2){
307                             catalog.pushBottom();
308                           }else if(path.getPathCount()==3){
309                               Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString()).pushBottomCategory(category);
310                           }else if(path.getPathCount()==4){
311                               appAsp.pushBottom();
312                           }
313                               UI.getInstance().getAspectsManagerFrame().repaintTree(path);
314                           
315                       } catch (DataException e) {
316                           // TODO Auto-generated catch block
317                           e.printStackTrace();
318                       }
319                   }});
320           }
321           
322           if(UI.getInstance().getAspectsManagerFrame().getRemoveBttn().getListeners(ActionListener.class).length==0){
323               
324                 UI.getInstance().getAspectsManagerFrame().getRemoveBttn().addActionListener(new ActionListener(){
325  
326                     @Override
327                     public void actionPerformed(ActionEvent arg0) {
328                         try {
329                             if(path.getPathCount()==2){
330                                 Data.getInstance().getAppData().removeCatalog(catalog);
331                               }else if(path.getPathCount()==3){
332                                   Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString()).removeCategory(category);
333                               }else if(path.getPathCount()==4){
334  
335                                   Data.getInstance().getAppData().getCatalog(path.getPathComponent(1).toString()).removeAspect(appAsp);
336                               }
337                                   UI.getInstance().getAspectsManagerFrame().repaintTree(path);
338                               
339                           } catch (DataException e) {
340                               // TODO Auto-generated catch block
341                               e.printStackTrace();
342                           }
343                       }});
344               }
345  
346       }
347     }
NewAspectPopupWindow.java
38   @SuppressWarnings("serial")
39   public class NewAspectPopupWindow extends JDialog {
40  
41       private JComboBox categoryBx;
42       private JComboBox catalogBx;
43       private JTextField directiveTxtFld;
44       private JTextField categoryTxtFld;
45       private GridBagLayout gbl = new GridBagLayout();
46       private JTextField catalogTxtFld;
47       private JRadioButton catalogRB;
48       private JRadioButton categoryRB;
49       private JTextArea descriptionTxtArea;
50       
51       public JTextArea getDescriptionTxtArea() {
52           return descriptionTxtArea;
53       }
54  
55  
56       public JComboBox getCategoryBx() {
57           return categoryBx;
58       }
59  
60       public JComboBox getCatalogBx() {
61           return catalogBx;
62       }
63  
64       public JTextField getCategoryTxtFld() {
65           return categoryTxtFld;
66       }
67  
68       public JTextField getCatalogTxtFld() {
69           return catalogTxtFld;
70       }
71  
72       
NewAspectPopupWindow.java
74       };
75  
76       private ButtonClicked buttonClicked = null;
77  
78  
79       public NewAspectPopupWindow(Window parent, String titleText) {
80           super(parent);
81  
82           setLayout(new BorderLayout());
83  
84           setUndecorated(true);
85  
86           setModal(true);
87  
88           JPanel panelBase = new JPanel(new BorderLayout());
89           panelBase.setBorder(UI.POPUP_BORDER);
90           panelBase.setBackground(UI.POPUP_BACKGROUND);
91  
92           JTextArea textTitle = new JTextArea();
93           textTitle.setEditable(false);
94           textTitle.setText(titleText);
95           textTitle.setBackground(UI.POPUP_BACKGROUND);
96           textTitle.setFont(textTitle.getFont().deriveFont(Font.BOLD));
97           textTitle.setMargin(new Insets(3, 3, 3, 3));
98           textTitle.setLineWrap(true);
99           textTitle.setWrapStyleWord(true);
100           textTitle.setFocusable(false);
101  
102           panelBase.add(textTitle, BorderLayout.NORTH);
103  
104           JPanel inputPanel = new JPanel(gbl);
105           inputPanel.setBackground(Color.WHITE);
106  
107           JLabel directiveLbl= new JLabel(Data.getInstance().getLocaleStr("popup.newAspect.directive"));
108           JLabel categoryLbl= new JLabel(Data.getInstance().getLocaleStr("popup.newAspect.category"));
109           JLabel catalogLbl= new JLabel(Data.getInstance().getLocaleStr("popup.newAspect.catalog"));
110           JLabel descriptionLbl = new JLabel(Data.getInstance().getLocaleStr("popup.newAspect.description"));
111           
112           directiveTxtFld = new JTextField();
113           categoryTxtFld = new JTextField();
114           categoryTxtFld.setEnabled(false);
115           catalogTxtFld = new JTextField();
116           catalogTxtFld.setEnabled(false);
117           descriptionTxtArea = new JTextArea();
118           
119           categoryBx = new JComboBox();
120           catalogBx = new JComboBox();
121           
122           
123           ButtonGroup buttonG = new ButtonGroup();
124           
125           catalogRB = new JRadioButton();
126           catalogRB.setSelected(true);
127           catalogRB.setBackground(Color.WHITE);
128           buttonG.add(catalogRB);
129           
130           JRadioButton newCatalogRB = new JRadioButton();
131           newCatalogRB.setBackground(Color.WHITE);
132           buttonG.add(newCatalogRB);
133           
134           catalogRB.addItemListener(new ItemListener(){
135  
136               @Override
137               public void itemStateChanged(ItemEvent e) {
138                   if(catalogRB.isSelected()){
139                       catalogTxtFld.setEnabled(false);
140                       catalogBx.setEnabled(true);
141                   }else{
142                       catalogTxtFld.setEnabled(true);
143                       catalogBx.setEnabled(false);
144                   }
145               }});
146           
147           
148           ButtonGroup buttonG1 = new ButtonGroup();
149           
150           categoryRB = new JRadioButton();
151           categoryRB.setSelected(true);
152           categoryRB.setBackground(Color.WHITE);
153           buttonG1.add(categoryRB);
154           
155           JRadioButton newCategoryRB = new JRadioButton();
156           newCategoryRB.setBackground(Color.WHITE);
157           buttonG1.add(newCategoryRB);
158           
159           categoryRB.addItemListener(new ItemListener(){
160  
161               @Override
162               public void itemStateChanged(ItemEvent e) {
163                   if(categoryRB.isSelected()){
164                       categoryTxtFld.setEnabled(false);
165                       categoryBx.setEnabled(true);
166                   }else{
167                       categoryTxtFld.setEnabled(true);
168                       categoryBx.setEnabled(false);
169                   }
170               }});
171           
172           
173           GUITools.addComponent(inputPanel, gbl,    directiveLbl, 0, 0, 2, 1, 1.0, 0, 15, 10,  0, 10, GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
174           GUITools.addComponent(inputPanel, gbl, directiveTxtFld, 0, 1, 2, 1, 1.0, 0,  5, 10,  0, 10, GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
175           
176           GUITools.addComponent(inputPanel, gbl,      catalogLbl, 0, 2, 2, 1, 1.0, 0, 10, 10,  0, 10, GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
177           
178           GUITools.addComponent(inputPanel, gbl,    newCatalogRB, 0, 3, 1, 1,   0, 0,  5, 10,  0,  0, GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
179           GUITools.addComponent(inputPanel, gbl,       catalogRB, 0, 4, 1, 1,   0, 0,  5, 10, 10,  0, GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
180           
181           GUITools.addComponent(inputPanel, gbl,   catalogTxtFld, 1, 3, 1, 1,   0, 0,  5,  0,  0, 10, GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
182           GUITools.addComponent(inputPanel, gbl,       catalogBx, 1, 4, 1, 1,   0, 0,  5,  0, 10, 10, GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
183           
184           GUITools.addComponent(inputPanel, gbl,     categoryLbl, 0, 5, 2, 1, 1.0, 0, 10, 10,  0, 10, GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
185           GUITools.addComponent(inputPanel, gbl,   newCategoryRB, 0, 6, 1, 1,   0, 0,  5, 10,  0,  0, GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
186           GUITools.addComponent(inputPanel, gbl,      categoryRB, 0, 7, 1, 1,   0, 0,  5, 10, 10,  0, GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
187           GUITools.addComponent(inputPanel, gbl,  categoryTxtFld, 1, 6, 1, 1,   0, 0,  5,  0,  0, 10, GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
188           GUITools.addComponent(inputPanel, gbl,      categoryBx, 1, 7, 1, 1,   0, 0,  5,  0, 10, 10, GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
189           
190           GUITools.addComponent(inputPanel, gbl,    descriptionLbl, 0, 8, 2, 1,   0,   0,  5, 10, 0, 10, GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
191           GUITools.addComponent(inputPanel, gbl,GUITools.setIntoScrllPn(descriptionTxtArea), 0, 9, 2, 2, 1.0, 1.0,  5, 10, 20, 10, GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
192           
193           try {
194               for(AppCatalog cat:Data.getInstance().getAppData().getCatalogs())
195                   catalogBx.addItem(cat);    
196           } catch (DataException e) {
197               // TODO Auto-generated catch block
198               e.printStackTrace();
199           }
200           
201           catalogBx.addItemListener(new ItemListener(){
202  
203               @Override
204               public void itemStateChanged(ItemEvent arg0) {
205                   
206                   categoryBx.removeAllItems();
207                   
208                   AppCatalog localCat=((AppCatalog)arg0.getItem());
209                   try {
210                       for(String category:localCat.getCategories())
211                           categoryBx.addItem(category);
212                   } catch (DataException e) {
213                       // TODO Auto-generated catch block
214                       e.printStackTrace();
215                   }
216                   
217               }});
218           catalogBx.setSelectedIndex(0);
219           AppCatalog localCat=((AppCatalog)catalogBx.getSelectedItem());
220           try {
221               for(String category:localCat.getCategories())
222                   categoryBx.addItem(category);
223           } catch (DataException e) {
224               // TODO Auto-generated catch block
225               e.printStackTrace();
226           }
227           
228           panelBase.add(inputPanel,BorderLayout.CENTER);
229           
230           Dimension popupSize;
231  
232           
233               popupSize = new Dimension(300, 400);
234           
235           /*
236            * The buttons to abort and confirm the input
237            */
238           JButton buttonAbort = GUITools.newImageButton();
239           buttonAbort.setIcon(Data.getInstance().getIcon(
240                   "buttonCancel_24x24_0.png"));
241           buttonAbort.setRolloverIcon(Data.getInstance().getIcon(
242                   "buttonCancel_24x24.png"));
243           buttonAbort.setToolTipText(Data.getInstance().getLocaleStr("abort"));
244           buttonAbort.addActionListener(new NewAspectPopupWindowAction(this,
245                   ButtonClicked.ABORT));
246  
247           JButton buttonConfirm = GUITools.newImageButton();
248           buttonConfirm.setIcon(Data.getInstance()
249                   .getIcon("buttonOk_24x24_0.png"));
250           buttonConfirm.setRolloverIcon(Data.getInstance().getIcon(
251                   "buttonOk_24x24.png"));
252           buttonConfirm
253                   .setToolTipText(Data.getInstance().getLocaleStr("confirm"));
254           buttonConfirm.addActionListener(new NewAspectPopupWindowAction(this,
255                   ButtonClicked.OK));
256  
257           JPanel panelButtons = new JPanel(new BorderLayout());
258           panelButtons.setBackground(UI.POPUP_BACKGROUND);
259           panelButtons.setBorder(BorderFactory.createLineBorder(panelButtons
260                   .getBackground(), 3));
261           panelButtons.add(buttonAbort, BorderLayout.WEST);
262           panelButtons.add(buttonConfirm, BorderLayout.EAST);
263  
264           /*
265            * Base panel
266            */
267           panelBase.add(panelButtons, BorderLayout.SOUTH);
268  
269           add(panelBase, BorderLayout.CENTER);
270  
271           pack();
272  
273           /*
274            * Set size and location
275            */
276           setMinimumSize(popupSize);
277           setSize(popupSize);
278  
279           int posX = (int) ((int) (parent.getSize().getWidth() / 2) - (this
280                   .getSize().getWidth() / 2));
281           int posY = (int) ((int) (parent.getSize().getHeight() / 2) - (this
282                   .getSize().getHeight() / 2));
283  
284           setLocation(posX, posY);
285       }
286  
287       /**
288        * @return the buttonClicked
289        */
290       public ButtonClicked getButtonClicked() {
291           return buttonClicked;
292       }
293  
294       /**
295        * @param buttonClicked
296        *            the buttonClicked to set
297        */
298       public void setButtonClicked(ButtonClicked buttonClicked) {
299           this.buttonClicked = buttonClicked;
300       }
301  
302       /**
303        * @return the input
304        */
305       public String getDirective() {
306           return directiveTxtFld.getText();
307       }
308       
309  
310   }
MeetingDialog.java
47   @SuppressWarnings("serial")
48   public class MeetingDialog extends AbstractDialog{
49  
50       public boolean modeEdit=false;
51       private ObservingTextField dateTxtFld;
52       private JSpinner beginMSpinner=new JSpinner(new RotateSpinnerNumberModel(00,00,45,15));
53       private JSpinner beginHSpinner=new JSpinner(new RotateSpinnerNumberModel(00,00,23,1));
54       private JSpinner endMSpinner=new JSpinner(new RotateSpinnerNumberModel(00,00,45,15));
55       private JSpinner endHSpinner=new JSpinner(new RotateSpinnerNumberModel(00,00,23,1));
56       private JTextField locationTxtFld;
57       private JCheckBox canceled;
58       
59       final JTextArea CANCELED_TXT_AREA;
60  
61       public Calendar getBegin(){
62           Calendar cal=Calendar.getInstance();
63           cal.set(Calendar.MINUTE,Integer.parseInt(beginMSpinner.getValue().toString()));
64           cal.set(Calendar.HOUR_OF_DAY,Integer.parseInt(beginHSpinner.getValue().toString()));
65           return     cal;
66       }
67       
68       public Calendar getEnd(){
69           Calendar cal=Calendar.getInstance();
70           cal.set(Calendar.MINUTE,Integer.parseInt(endMSpinner.getValue().toString()));
71           cal.set(Calendar.HOUR_OF_DAY,Integer.parseInt(endHSpinner.getValue().toString()));
72           return     cal;
73       }
74       
75       public int getHBegin(){
76           return Integer.parseInt(beginMSpinner.getValue().toString());    
77       }
78       
79       public int getMEnd(){
80           return Integer.parseInt(beginMSpinner.getValue().toString());    
81       }
82       
83       public int getHEnd(){
84           return Integer.parseInt(beginMSpinner.getValue().toString());    
85       }
86       
87       public String getCanceled() {
88           return CANCELED_TXT_AREA.getText();
89       }
90  
91       public void setCanceled(String canceled) {
92           CANCELED_TXT_AREA.setText(canceled);
93       }
94  
95       public String getLocationTxt() {
96           return locationTxtFld.getText();
97       }
98  
99       public void setLocationTxt(String locationTxt) {
100           this.locationTxtFld.setText(locationTxt);
101       }
102  
103  
104       public ObservingTextField getDateTxtFld() {
105           return dateTxtFld;
106       }
107  
108       public void setDateTxtFld(ObservingTextField dateTxtFld) {
109           this.dateTxtFld = dateTxtFld;
110       }
111  
112       @SuppressWarnings("deprecation")
113       public void setMode(){
114           
115           if(modeEdit==false){
116               
117               setTitle(Data.getInstance().getLocaleStr("addMeeting.title"));
118               setDescription(Data.getInstance().getLocaleStr("addMeeting.description"));
119               setIcon(Data.getInstance().getIcon("addMeeting_50x50.png"));
120               
121               DateFormat dateF = SimpleDateFormat.getDateInstance(DateFormat.LONG);
122               Calendar cal = Calendar.getInstance();
123               cal.add(Calendar.DAY_OF_WEEK,7);
124               Date startDate = cal.getTime();
125               cal.add(Calendar.HOUR,0);
126  
127               dateTxtFld.setText(dateF.format(startDate));
128               beginMSpinner.setValue(0);
129               beginHSpinner.setValue(cal.get(Calendar.HOUR_OF_DAY));
130               endMSpinner.setValue(0);
131               cal.add(Calendar.HOUR,2);
132               endHSpinner.setValue(cal.get(Calendar.HOUR_OF_DAY));
133               locationTxtFld.setText("");
134               canceled.setEnabled(false);
135               canceled.setSelected(false);
136               CANCELED_TXT_AREA.setText(Data.getInstance().getLocaleStr("editMeeting.cause"));
137               
138           }else{
139               
140               setTitle(Data.getInstance().getLocaleStr("editMeeting.title"));
141               setDescription(Data.getInstance().getLocaleStr("editMeeting.description"));
142               setIcon(Data.getInstance().getIcon("editMeeting_50x50.png"));
143               canceled.setEnabled(true);
144               
145               Meeting editMeet=null;
146               int i[]=UI.getInstance().getMainFrame().getMeetingsTree().getSelectionRows();
147               
148                   for(int index=0;index<i.length;index++){
149                       
150                       editMeet=Application.getInstance().getMeetingMgmt().getMeetings().get(i[index]-1);
151                   
152                   }
153                   DateFormat dateF = SimpleDateFormat.getDateInstance(DateFormat.LONG);
154                   
155                   dateTxtFld.setText(dateF.format(editMeet.getPlannedDate().getTime()));
156                   beginMSpinner.setValue(editMeet.getPlannedStart().get(Calendar.MINUTE));
157                   beginHSpinner.setValue(editMeet.getPlannedStart().get(Calendar.HOUR_OF_DAY));
158                   endMSpinner.setValue(editMeet.getPlannedEnd().get(Calendar.MINUTE));
159                   endHSpinner.setValue(editMeet.getPlannedEnd().get(Calendar.HOUR_OF_DAY));
160                   locationTxtFld.setText(editMeet.getPlannedLocation());
161                   try{
162                   if(!editMeet.getCanceled().equals(Data.getInstance().getLocaleStr("editMeeting.cause"))){
163                       canceled.setSelected(true);
164                       CANCELED_TXT_AREA.setText(editMeet.getCanceled());}
165                   }catch(Exception e){
166                       canceled.setSelected(false);
167                       CANCELED_TXT_AREA.setText(Data.getInstance().getLocaleStr("editMeeting.cause"));
168                   }
169                   
170                   
171               
172           }
173       }
174  
175       public MeetingDialog(Frame parent) {
176           super(parent);
177           
178           setTitle(Data.getInstance().getLocaleStr("editMeeting.title"));
179           setDescription(Data.getInstance().getLocaleStr("editMeeting.description"));
180           setIcon(Data.getInstance().getIcon("editMeeting_64x64.png"));
181           
182           GridBagLayout gbl = new GridBagLayout();
183           Container c = getContentPane();
184           c.setLayout( gbl);
185          
186           GUITools.formatSpinner(endHSpinner);
187           GUITools.formatSpinner(endMSpinner);
188           GUITools.formatSpinner(beginHSpinner);
189           GUITools.formatSpinner(beginMSpinner);
190  
191           JLabel dateLbl = new JLabel(Data.getInstance().getLocaleStr("editMeeting.date"));
192           dateTxtFld = new ObservingTextField();
193           dateTxtFld.setEditable(false);
194  
195          
196           JButton datePicker = GUITools.newImageButton();
197           datePicker.setIcon(Data.getInstance().getIcon("datePicker_25x25_0.png"));
198           datePicker.setRolloverIcon(Data.getInstance().getIcon("datePicker_25x25.png"));
199           datePicker.addActionListener(ActionRegistry.getInstance().get(DatePickerAction.class.getName()));
200          
201           JLabel beginLbl = new JLabel(Data.getInstance().getLocaleStr("editMeeting.period"));
202      
203           JPanel spinnerPanel=new JPanel(gbl);
204           JLabel tillLabel=new JLabel(Data.getInstance().getLocaleStr("editMeeting.period.till"));
205           JLabel clockLabel=new JLabel(Data.getInstance().getLocaleStr("editMeeting.period.clock"));
206          
207           GUITools.addComponent(spinnerPanel, gbl,       beginHSpinner,0,0,1,1,  0,  0,0,0,0,0,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
208           GUITools.addComponent(spinnerPanel, gbl,     new JLabel(":"),1,0,1,1,  0,  0,0,5,0,0,GridBagConstraints.NONE,GridBagConstraints.CENTER); 
209           GUITools.addComponent(spinnerPanel, gbl,      beginMSpinner,2,0,1,1,  0,  0,0,5,0,0,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
210           GUITools.addComponent(spinnerPanel, gbl,          tillLabel,3,0,1,1,1.0,  0,0,20,0,20,GridBagConstraints.NONE,GridBagConstraints.CENTER);
211           GUITools.addComponent(spinnerPanel, gbl,        endHSpinner,4,0,1,1,  0,  0,0,0,0,0,GridBagConstraints.NONE,GridBagConstraints.NORTHEAST);
212           GUITools.addComponent(spinnerPanel, gbl,     new JLabel(":"),5,0,1,1,  0,  0,0,5,0,0,GridBagConstraints.NONE,GridBagConstraints.CENTER); 
213           GUITools.addComponent(spinnerPanel, gbl,          endMSpinner,6,0,1,1,  0,  0,0,5,0,0,GridBagConstraints.NONE,GridBagConstraints.NORTHEAST);
214           GUITools.addComponent(spinnerPanel, gbl,         clockLabel,7,0,1,1,1.0,  0,0,20,0,0,GridBagConstraints.NONE,GridBagConstraints.CENTER);
215          
216           JLabel locationLbl = new JLabel(Data.getInstance().getLocaleStr("editMeeting.location"));
217           locationTxtFld = new JTextField();
218          
219           CANCELED_TXT_AREA = new JTextArea(Data.getInstance().getLocaleStr("editMeeting.cause"));
220           CANCELED_TXT_AREA.setEnabled(false);
221          
222           JScrollPane canceledScrllPn=GUITools.setIntoScrllPn(CANCELED_TXT_AREA);
223           canceled = new JCheckBox(Data.getInstance().getLocaleStr("editMeeting.canceled"));
224           canceled.setHorizontalTextPosition(SwingConstants.LEADING);
225           canceled.addItemListener(new ItemListener(){
226  
227               @Override
228               public void itemStateChanged(ItemEvent e) {
229                       if (e.getStateChange() == ItemEvent.SELECTED){
230                           CANCELED_TXT_AREA.setEnabled(true);
231                           }else{
232                           CANCELED_TXT_AREA.setEnabled(false);
233                           }
234                   }});
235          
236         
237          
238          
239           GUITools.addComponent(c, gbl,        dateLbl,0,0,1,1,  0,  0,10,5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
240           GUITools.addComponent(c, gbl,     dateTxtFld,1,0,1,1,1.0,  0,10,5,0,5,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
241           GUITools.addComponent(c, gbl,     datePicker,2,0,1,1,  0,  0,10,5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
242           GUITools.addComponent(c, gbl,       beginLbl,0,1,1,1,  0,  0,10,5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
243           GUITools.addComponent(c, gbl,       spinnerPanel,1,1,2,1,1.0,  0,10,5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
244           GUITools.addComponent(c, gbl,     locationLbl,0,2,1,1,  0,  0,10,5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
245           GUITools.addComponent(c, gbl,           canceled,0,3,1,1,  0,  0,10,5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
246           GUITools.addComponent(c, gbl,  locationTxtFld,1,2,2,2,1.0,  0,10,5,0,5,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
247           GUITools.addComponent(c, gbl, canceledScrllPn,1,3,2,2,1.0,1.0,10,5,0,5,GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
248          
249          
250           JButton cancel = new JButton(Data.getInstance().getLocaleStr(
251           "abort"));
252           cancel.addActionListener(new ActionListener(){
253  
254               @Override
255               public void actionPerformed(ActionEvent e) {
256                   setVisible(false);
257               }});
258          
259           addButton(cancel);
260           
261           JButton accept = new JButton(Data.getInstance().getLocaleStr(
262           "accept"));
263           accept.addActionListener(ActionRegistry.getInstance().get(ConfirmMeetingAction.class.getName()));
264           addButton(accept);
265  
266           // saving screenSize
267           Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
268           
269           // calculating Position of HelpBrowserFrame
270           int top = ((screenSize.height - getHeight())/2);
271           int left = ((screenSize.width - getWidth()) / 2);
272           
273           
274           // setting Position of HelpBrowserFrame
275           setLocation(left, top);
276           
277           setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
278           addWindowListener(new WindowAdapter() {
279               @Override
280               public void windowClosing(WindowEvent e) {
281                   // buttonClicked = ButtonClicked.CANCEL;
282                   setVisible(false);
283               }
284           });
285  
286          
287       }
288  
289   }
ManageSeveritiesDialog.java
33   @SuppressWarnings("serial")
34   public class ManageSeveritiesDialog extends AbstractDialog {
35  
36       SeverityTableModel stm = new SeverityTableModel();
37       GridBagLayout gbl = new GridBagLayout();
38       Container c = getContentPane();
39       JTable severityTbl = new JTable(stm);
40       
41       public SeverityTableModel getStm() {
42           return stm;
43       }
44       public JTable getSeverityTbl() {
45           return severityTbl;
46       }
47  
48      
49       public void clearSeveritiesDialog() {
50           c.removeAll();
51           JLabel nameLbl = new JLabel(Data.getInstance().getLocaleStr("manageSeverities.label"));
52          
53           JPanel buttonPanel = new JPanel(new GridLayout(7,1));
54         
55           JButton addSeverity = GUITools.newImageButton();
56           addSeverity.setIcon(Data.getInstance().getIcon("add_25x25_0.png"));
57           addSeverity.setRolloverIcon(Data.getInstance().getIcon("add_25x25.png"));
58           addSeverity.setToolTipText(Data.getInstance().getLocaleStr("manageSeverities.add"));
59           addSeverity.addActionListener(ActionRegistry.getInstance().get(AddSeverityAction.class.getName()));
60           buttonPanel.add(addSeverity);
61          
62           JButton removeSeverity = GUITools.newImageButton();
63           removeSeverity.setIcon(Data.getInstance().getIcon("remove_25x25_0.png"));
64           removeSeverity.setRolloverIcon(Data.getInstance().getIcon("remove_25x25.png"));
65           removeSeverity.setToolTipText(Data.getInstance().getLocaleStr("manageSeverities.remove"));
66           removeSeverity.addActionListener(ActionRegistry.getInstance().get(RemoveSeverityAction.class.getName()));
67           buttonPanel.add(removeSeverity);
68         
69           JButton editSeverity = GUITools.newImageButton();
70           editSeverity.setIcon(Data.getInstance().getIcon("edit_25x25_0.png"));
71           editSeverity.setRolloverIcon(Data.getInstance().getIcon("edit_25x25.png"));
72           editSeverity.setToolTipText(Data.getInstance().getLocaleStr("manageSeverities.edit"));
73           editSeverity.addActionListener(ActionRegistry.getInstance().get(EditSeverityAction.class.getName()));
74           buttonPanel.add(editSeverity);
75          
76           JButton severityTop = GUITools.newImageButton();
77           severityTop.setIcon(Data.getInstance().getIcon("pushTop_25x25_0.png"));
78           severityTop.setRolloverIcon(Data.getInstance().getIcon("pushTop_25x25.png"));
79           severityTop.setToolTipText(Data.getInstance().getLocaleStr("manageSeverities.up"));
80           severityTop.addActionListener(ActionRegistry.getInstance().get(PushSeverityTopAction.class.getName()));
81           buttonPanel.add(severityTop);
82          
83           JButton severityUp = GUITools.newImageButton();
84           severityUp.setIcon(Data.getInstance().getIcon("upArrow_25x25_0.png"));
85           severityUp.setRolloverIcon(Data.getInstance().getIcon("upArrow_25x25.png"));
86           severityUp.setToolTipText(Data.getInstance().getLocaleStr("manageSeverities.up"));
87           severityUp.addActionListener(ActionRegistry.getInstance().get(PushSeverityUpAction.class.getName()));
88           buttonPanel.add(severityUp);
89          
90           JButton severityDown = GUITools.newImageButton();
91           severityDown.setIcon(Data.getInstance().getIcon("downArrow_25x25_0.png"));
92           severityDown.setRolloverIcon(Data.getInstance().getIcon("downArrow_25x25.png"));
93           severityDown.setToolTipText(Data.getInstance().getLocaleStr("manageSeverities.down"));
94           severityDown.addActionListener(ActionRegistry.getInstance().get(PushSeverityDownAction.class.getName()));
95           buttonPanel.add(severityDown);
96         
97           JButton severityBottom = GUITools.newImageButton();
98           severityBottom.setIcon(Data.getInstance().getIcon("pushBottom_25x25_0.png"));
99           severityBottom.setRolloverIcon(Data.getInstance().getIcon("pushBottom_25x25.png"));
100           severityBottom.setToolTipText(Data.getInstance().getLocaleStr("manageSeverities.up"));
101           severityBottom.addActionListener(ActionRegistry.getInstance().get(PushSeverityBottomAction.class.getName()));
102           buttonPanel.add(severityBottom);
103          
104           GUITools.addComponent(c, gbl,      nameLbl,0,0,1,1,  0,  0, 0,5,0,5,GridBagConstraints.NONE,GridBagConstraints.WEST);
105           GUITools.addComponent(c, gbl, severityTbl,0,1,2,2,1.0,1.0,10,5,0,5,GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
106           GUITools.addComponent(c, gbl,  buttonPanel,2,1,2,1,  0,  0,10,5,0,5,GridBagConstraints.VERTICAL,GridBagConstraints.NORTH);
107  
108       }
109  
110       public ManageSeveritiesDialog(Frame parent) {
111           super(parent);
112           
113           setTitle(Data.getInstance().getLocaleStr("manageSeverities.title"));
114           setDescription(Data.getInstance().getLocaleStr("manageSeverities.description"));
115           setIcon(Data.getInstance().getIcon("severities_50x50.png"));
116           
117           c.setLayout( gbl);
118                
119           clearSeveritiesDialog();
120           
121           JButton cancel = new JButton(Data.getInstance().getLocaleStr(
122           "abort"));
123           cancel.addActionListener(new ActionListener(){
124  
125               @Override
126               public void actionPerformed(ActionEvent e) {
127                   setVisible(false);
128               }});
129          
130           addButton(cancel);
131           
132           /*JButton accept = new JButton(Data.getInstance().getLocaleStr(
133           "accept"));
134           accept.addActionListener(null);
135           addButton(accept);
136           */
137           // saving screenSize
138           Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
139           
140           // calculating Position of HelpBrowserFrame
141           int top = ((screenSize.height - getHeight())/2);
142           int left = ((screenSize.width - getWidth()) / 2);
143           
144           
145           // setting Position of HelpBrowserFrame
146           setLocation(left, top);
147           
148           setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
149           addWindowListener(new WindowAdapter() {
150               @Override
151               public void windowClosing(WindowEvent e) {
152                   // buttonClicked = ButtonClicked.CANCEL;
153                   setVisible(false);
154               }
155           });
156  
157  
158       }
159  
160   }
MainFrame.java
72   @SuppressWarnings("serial")
73   public class MainFrame extends AbstractFrame implements Observer {
74  
75       private ReviewManagement revMgmt = Application.getInstance()
76               .getReviewMgmt();
77  
78       private JPanel splitPanel = new JPanel(new GridLayout(1, 2));
79       private GridBagLayout gbl = new GridBagLayout();
80  
81       private AttendeeTableModel attendeesTableModel = new AttendeeTableModel();
82       private JTable attendeesTable;
83  
84       private JButton removeAttendee;
85       private JButton editAttendee;
86  
87       private DefaultMutableTreeNode nodeMeetingRoot = new DefaultMutableTreeNode(
88               Data.getInstance().getLocaleStr("mainFrame.meetings.tree.node"));
89       private DefaultTreeModel meetingsTreeModel = new DefaultTreeModel(
90               nodeMeetingRoot);
91       private JTree meetingsTree;
92  
93       private JPanel panelToolBar = new JPanel();
94  
95       private String mode = Data.getInstance().getMode();
96       private UI.Status status = UI.getInstance().getStatus();
97  
98       private Border labelBorder = new MatteBorder(15, 0, 0, 0, getContentPane()
99               .getBackground());
100       private int padding = 30;
101  
102       /*
103        * menu items
104        */
105       private JMenu menuFile = new JMenu();
106       private JMenuItem fileSelectModeItem;
107       private JMenuItem closeApplicationItem;
108       private JMenuItem fileNewReviewItem;
109       private JMenuItem fileOpenReviewItem;
110       private JMenuItem fileSaveReviewItem;
111       private JMenuItem fileSaveReviewAsItem;
112  
113       private JMenu menuEdit = new JMenu();
114       private JMenuItem manageSeveritiesItem;
115       private JMenuItem newMeetingItem;
116       private JMenuItem aspectsManagerItem;
117       private JMenuItem createInvitationsItem;
118       private JMenuItem newAttendeeItem;
119       private JMenuItem protocolModeItem;
120       private JMenuItem pdfExportItem;
121       private JMenuItem csvExportItem;
122  
123       private JMenu menuXtras;
124  
125       private JMenu menuHelp;
126       private JMenuItem openHelp;
127       private JMenuItem infoHelp;
128  
129       /*
130        * Toolbar items
131        */
132       private JButton tbManageSeverities;
133       private JButton tbAspectsManager;
134       private JButton tbCreateInvitations;
135       private JButton tbNewAttendee;
136       private JButton tbProtocolMode;
137       private JButton tbPdfExport;
138       private JButton tbCsvExport;
139       private JButton tbNewMeeting;
140       private JButton tbShowAssistant;
141       private JButton tbShowHelp;
142       private JButton tbBlank;
143  
144       /*
145        * Hint items
146        */
147       private HintItem hintProduct;
148       private HintItem hintRevName;
149       private HintItem hintRevDesc;
150       private HintItem hintRevComm;
151       private HintItem hintOk;
152       private HintItem hintInfoNewMeeting;
153  
154       /*
155        * Content panes
156        */
157       private JTextField textProduct = new JTextField();
158       private JTextField textRevName = new JTextField();
159       private JTextArea textRevDesc = new JTextArea();
160       private JTextArea textRevComm = new JTextArea();
161  
162       public String getTextRevName() {
163           return textRevName.getText();
164       }
165  
166       public String getTextRevDesc() {
167           return textRevDesc.getText();
168       }
169  
170       public String getTextRevComm() {
171           return textRevComm.getText();
172       }
173  
174       public DefaultMutableTreeNode getNodeMeetingRoot() {
175           return nodeMeetingRoot;
176       }
177  
178       public DefaultTreeModel getDTM() {
179           return meetingsTreeModel;
180       }
181  
182       public JButton getEditAttendee() {
183           return editAttendee;
184       }
185  
186       public JButton getRemoveAttendee() {
187           return removeAttendee;
188       }
189  
190       public AttendeeTableModel getAttendeesTableModel() {
191           return attendeesTableModel;
192       }
193  
194       public JTree getMeetingsTree() {
195           return meetingsTree;
196       }
197  
198       public void setMeetingsTree(JTree meetingsTree) {
199           this.meetingsTree = meetingsTree;
200       }
201  
202       public JTable getAttendeesTable() {
203           return attendeesTable;
204       }
205  
206       public void setAttendeesTable(JTable attendeeTable) {
207           this.attendeesTable = attendeeTable;
208       }
209  
210       private void createLeftPane() {
211           /*
212            * creating the left panel
213            */
214           JPanel leftPanel = new JPanel(gbl);
215           splitPanel.add(leftPanel);
216  
217           JLabel product = new JLabel(Data.getInstance().getLocaleStr(
218                   "mainFrame.product"));
219  
220           textProduct.setFocusable(false);
221           textProduct.setCursor(new Cursor(Cursor.HAND_CURSOR));
222  
223           JLabel reviewName = new JLabel(Data.getInstance().getLocaleStr(
224                   "mainFrame.review.name"));
225           reviewName.setBorder(labelBorder);
226           textRevName.addFocusListener(new FocusListener() {
227               @Override
228               public void focusGained(FocusEvent e) {
229               }
230  
231               @Override
232               public void focusLost(FocusEvent e) {
233                   Application.getInstance().getReviewMgmt().setReviewName(
234                           UI.getInstance().getMainFrame().getTextRevName());
235               }
236           });
237  
238           JLabel reviewDescription = new JLabel(Data.getInstance().getLocaleStr(
239                   "mainFrame.review.description"));
240           reviewDescription.setBorder(labelBorder);
241           textRevDesc.setRows(5);
242           textRevDesc.addFocusListener(new FocusListener() {
243               @Override
244               public void focusGained(FocusEvent e) {
245               }
246  
247               @Override
248               public void focusLost(FocusEvent e) {
249                   Application.getInstance().getReviewMgmt().setReviewDescription(
250                           UI.getInstance().getMainFrame().getTextRevDesc());
251               }
252           });
253  
254           JLabel reviewComment = new JLabel(Data.getInstance().getLocaleStr(
255                   "mainFrame.review.comments"));
256           reviewComment.setBorder(labelBorder);
257           textRevComm.setRows(5);
258           textRevComm.addFocusListener(new FocusListener() {
259               @Override
260               public void focusGained(FocusEvent e) {
261               }
262  
263               @Override
264               public void focusLost(FocusEvent e) {
265                   Application.getInstance().getReviewMgmt().setReviewComments(
266                           UI.getInstance().getMainFrame().getTextRevComm());
267               }
268           });
269  
270           GUITools.addComponent(leftPanel, gbl, product, 0, 0, 2, 1, 1.0, 0, 10,
271                   20, 0, padding, GridBagConstraints.NONE,
272                   GridBagConstraints.NORTHWEST);
273           GUITools.addComponent(leftPanel, gbl, textProduct, 0, 1, 2, 1, 1.0, 0,
274                   10, 20, 0, padding, GridBagConstraints.HORIZONTAL,
275                   GridBagConstraints.NORTH);
276           GUITools.addComponent(leftPanel, gbl, reviewName, 0, 2, 2, 1, 1.0, 0,
277                   10, 20, 0, padding, GridBagConstraints.NONE,
278                   GridBagConstraints.NORTHWEST);
279           GUITools.addComponent(leftPanel, gbl, textRevName, 0, 3, 2, 1, 1.0, 0,
280                   10, 20, 0, padding, GridBagConstraints.BOTH,
281                   GridBagConstraints.NORTH);
282           GUITools.addComponent(leftPanel, gbl, reviewDescription, 0, 4, 2, 1,
283                   1.0, 0, 10, 20, 0, padding, GridBagConstraints.NONE,
284                   GridBagConstraints.NORTHWEST);
285           GUITools.addComponent(leftPanel, gbl, reviewComment, 0, 7, 2, 1, 1.0,
286                   0, 10, 20, 0, padding, GridBagConstraints.NONE,
287                   GridBagConstraints.NORTHWEST);
288           GUITools.addComponent(leftPanel, gbl, GUITools
289                   .setIntoScrllPn(textRevComm), 0, 8, 2, 2, 1.0, 1.0, 10, 20, 0,
290                   padding, GridBagConstraints.BOTH, GridBagConstraints.NORTH);
291           GUITools.addComponent(leftPanel, gbl, GUITools
292                   .setIntoScrllPn(textRevDesc), 0, 5, 2, 2, 1.0, 1.0, 10, 20, 0,
293                   padding, GridBagConstraints.BOTH, GridBagConstraints.NORTH);
294  
295           if (Data.getInstance().getModeParam("ableToEditProduct")) {
296               textProduct.addMouseListener(new MouseListener() {
297                   @Override
298                   public void mouseClicked(MouseEvent e) {
299                       UI.getInstance().getEditProductDialog()
300                               .clearProductDialog();
301                       UI.getInstance().getEditProductDialog().setVisible(true);
302                   }
303  
304                   @Override
305                   public void mouseEntered(MouseEvent e) {
306                   }
307  
308                   @Override
309                   public void mouseExited(MouseEvent e) {
310                   }
311  
312                   @Override
313                   public void mousePressed(MouseEvent e) {
314                   }
315  
316                   @Override
317                   public void mouseReleased(MouseEvent e) {
318                   }
319               });
320           }
321  
322           reviewName.setEnabled(Data.getInstance().getModeParam(
323                   "ableToEditReviewName"));
324           textRevName.setEnabled(Data.getInstance().getModeParam(
325                   "ableToEditReviewName"));
326  
327           product.setEnabled(Data.getInstance().getModeParam(
328                   "ableToEditReviewName"));
329           textProduct.setEnabled(Data.getInstance().getModeParam(
330                   "ableToEditReviewName"));
331  
332           reviewDescription.setEnabled(Data.getInstance().getModeParam(
333                   "ableToEditReviewName"));
334           textRevDesc.setEnabled(Data.getInstance().getModeParam(
335                   "ableToEditReviewName"));
336  
337           reviewComment.setEnabled(Data.getInstance().getModeParam(
338                   "ableToEditReviewName"));
339           textRevComm.setEnabled(Data.getInstance().getModeParam(
340                   "ableToEditReviewName"));
341       }
342  
343       private void createRightPane() {
344           /*
345            * creating the right panel
346            */
347           JPanel rightPanel = new JPanel(gbl);
348           splitPanel.add(rightPanel);
349  
350           rightPanel.setBorder(new MatteBorder(0, 1, 0, 0, UI.SEPARATOR_COLOR));
351  
352           JLabel meetings = new JLabel(Data.getInstance().getLocaleStr(
353                   "mainFrame.meetings"));
354  
355           meetingsTree = new JTree(meetingsTreeModel);
356           DefaultTreeCellRenderer renderer = new DefaultTreeCellRenderer();
357           renderer.setLeafIcon(null);
358           renderer.setOpenIcon(null);
359           renderer.setClosedIcon(null);
360           meetingsTree.setCellRenderer(renderer);
361  
362           meetingsTree.getSelectionModel().setSelectionMode(
363                   TreeSelectionModel.SINGLE_TREE_SELECTION);
364           JScrollPane treeScrollPane = new JScrollPane(meetingsTree);
365  
366           /*
367            * creating add/edit/remove/comment meeting buttons and adding them to a
368            * separate panel
369            */
370           JPanel meetingButtons = new JPanel(new GridLayout(4, 1));
371  
372           JButton addMeeting = GUITools.newImageButton();
373           addMeeting.setIcon(Data.getInstance().getIcon("add_25x25_0.png"));
374           addMeeting.setRolloverIcon(Data.getInstance().getIcon("add_25x25.png"));
375           addMeeting.setToolTipText(Data.getInstance()
376                   .getLocaleStr("meeting.add"));
377           addMeeting.addActionListener(ActionRegistry.getInstance().get(
378                   AddMeetingAction.class.getName()));
379           meetingButtons.add(addMeeting);
380  
381           JButton removeMeeting = GUITools.newImageButton();
382           removeMeeting.setIcon(Data.getInstance().getIcon("remove_25x25_0.png"));
383           removeMeeting.setRolloverIcon(Data.getInstance().getIcon(
384                   "remove_25x25.png"));
385           removeMeeting.setToolTipText(Data.getInstance().getLocaleStr(
386                   "meeting.remove"));
387           removeMeeting.addActionListener(ActionRegistry.getInstance().get(
388                   RemoveMeetingAction.class.getName()));
389           meetingButtons.add(removeMeeting);
390  
391           JButton editMeeting = GUITools.newImageButton();
392           editMeeting.setIcon(Data.getInstance().getIcon("edit_25x25_0.png"));
393           editMeeting.setRolloverIcon(Data.getInstance()
394                   .getIcon("edit_25x25.png"));
395           editMeeting.setToolTipText(Data.getInstance().getLocaleStr(
396                   "meeting.edit"));
397           editMeeting.addActionListener(ActionRegistry.getInstance().get(
398                   EditMeetingAction.class.getName()));
399           meetingButtons.add(editMeeting);
400  
401           JButton commentMeeting = GUITools.newImageButton();
402           commentMeeting.setIcon(Data.getInstance()
403                   .getIcon("comment_25x25_0.png"));
404           commentMeeting.setRolloverIcon(Data.getInstance().getIcon(
405                   "comment_25x25.png"));
406           commentMeeting.setToolTipText(Data.getInstance().getLocaleStr(
407                   "meeting.comment"));
408           commentMeeting.addActionListener(ActionRegistry.getInstance().get(
409                   CommentMeetingAction.class.getName()));
410           meetingButtons.add(commentMeeting);
411  
412           GUITools.addComponent(rightPanel, gbl, meetings, 0, 0, 1, 1, 0, 0, 10,
413                   padding, 0, 20, GridBagConstraints.NONE,
414                   GridBagConstraints.NORTHWEST);
415           GUITools.addComponent(rightPanel, gbl, treeScrollPane, 0, 1, 2, 2, 1.0,
416                   1.0, 10, padding, 0, 20, GridBagConstraints.BOTH,
417                   GridBagConstraints.NORTH);
418           GUITools.addComponent(rightPanel, gbl, meetingButtons, 2, 1, 1, 2, 0,
419                   1.0, 10, 0, 0, padding / 2, GridBagConstraints.NONE,
420                   GridBagConstraints.NORTH);
421  
422           if (Data.getInstance().getModeParam("ableToManageAttendees")) {
423               JLabel attendees = new JLabel(Data.getInstance().getLocaleStr(
424                       "mainFrame.meetings.attendees"));
425               attendees.setBorder(labelBorder);
426               attendeesTable = new JTable();
427               attendeesTable.setModel(attendeesTableModel);
428               JScrollPane tableScrollBar = new JScrollPane(attendeesTable);
429  
430               /*
431                * creating add/edit/remove/comment meeting buttons and adding them
432                * to a separate panel
433                */
434               GridLayout grid = new GridLayout(3, 1);
435               grid.setVgap(4);
436  
437               JPanel attendeeButtons = new JPanel(grid);
438  
439               JButton addAttendee = GUITools.newImageButton();
440               addAttendee.setIcon(Data.getInstance().getIcon(
441                       "addAttendee_25x25_0.png"));
442               addAttendee.setRolloverIcon(Data.getInstance().getIcon(
443                       "addAttendee_25x25.png"));
444               addAttendee.setToolTipText(Data.getInstance().getLocaleStr(
445                       "attendee.add"));
446               addAttendee.addActionListener(ActionRegistry.getInstance().get(
447                       AddAttendeeAction.class.getName()));
448               attendeeButtons.add(addAttendee);
449  
450               removeAttendee = GUITools.newImageButton();
451               removeAttendee.setIcon(Data.getInstance().getIcon(
452                       "removeAttendee_25x25_0.png"));
453               removeAttendee.setRolloverIcon(Data.getInstance().getIcon(
454                       "removeAttendee_25x25.png"));
455               removeAttendee.setToolTipText(Data.getInstance().getLocaleStr(
456                       "attendee.remove"));
457               removeAttendee.addActionListener(ActionRegistry.getInstance().get(
458                       RemoveAttendeeAction.class.getName()));
459               attendeeButtons.add(removeAttendee);
460  
461               editAttendee = GUITools.newImageButton();
462               editAttendee.setIcon(Data.getInstance().getIcon(
463                       "editAttendee_25x25_0.png"));
464               editAttendee.setRolloverIcon(Data.getInstance().getIcon(
465                       "editAttendee_25x25.png"));
466               editAttendee.setToolTipText(Data.getInstance().getLocaleStr(
467                       "attendee.edit"));
468               editAttendee.addActionListener(ActionRegistry.getInstance().get(
469                       EditAttendeeAction.class.getName()));
470               attendeeButtons.add(editAttendee);
471  
472               JButton editAspects = new JButton(Data.getInstance().getLocaleStr(
473                       "attendee.manageAspects"));
474               editAspects.addActionListener(ActionRegistry.getInstance().get(
475                       OpenAspectsManagerAction.class.getName()));
476  
477               GUITools.addComponent(rightPanel, gbl, attendees, 0, 3, 1, 1, 0, 0,
478                       10, padding, 0, 20, GridBagConstraints.NONE,
479                       GridBagConstraints.NORTHWEST);
480               GUITools.addComponent(rightPanel, gbl, tableScrollBar, 0, 4, 2, 2,
481                       1.0, 1.0, 10, padding, 0, 20, GridBagConstraints.BOTH,
482                       GridBagConstraints.NORTH);
483               GUITools.addComponent(rightPanel, gbl, attendeeButtons, 2, 4, 1, 2,
484                       0, 1.0, 10, 0, 0, padding / 2, GridBagConstraints.NONE,
485                       GridBagConstraints.NORTH);
486               GUITools.addComponent(rightPanel, gbl, editAspects, 1, 6, 1, 2, 0,
487                       0, 10, 0, 0, 20, GridBagConstraints.NONE,
488                       GridBagConstraints.NORTHEAST);
489           }
490  
491           if (Data.getInstance().getModeParam("ableToEditImpression")) {
492               JLabel generalImpression = new JLabel(Data.getInstance()
493                       .getLocaleStr("mainFrame.impression"));
494               generalImpression.setBorder(labelBorder);
495               JTextArea impressionTxtArea = new JTextArea();
496               impressionTxtArea.setRows(5);
497               GUITools.addComponent(rightPanel, gbl, generalImpression, 0, 4, 1,
498                       1, 0, 0, 10, padding, 0, 20, GridBagConstraints.NONE,
499                       GridBagConstraints.NORTHWEST);
500               GUITools.addComponent(rightPanel, gbl, GUITools
501                       .setIntoScrllPn(impressionTxtArea), 0, 5, 2, 2, 1.0, 1.0,
502                       10, padding, 0, 20, GridBagConstraints.BOTH,
503                       GridBagConstraints.NORTH);
504  
505               impressionTxtArea.setText(Application.getInstance().getReviewMgmt()
506                       .getImpression());
507           }
508  
509           if (Data.getInstance().getModeParam("ableToUseProtocolMode")) {
510               JButton protocolMode = new JButton(Data.getInstance().getLocaleStr(
511                       "mainFrame.protocolMode"));
512               GUITools.addComponent(rightPanel, gbl, protocolMode, 0, 3, 1, 1, 0,
513                       0, 10, padding, 0, 20, GridBagConstraints.NONE,
514                       GridBagConstraints.EAST);
515               protocolMode.addActionListener(ActionRegistry.getInstance().get(
516                       OpenProtocolModeAction.class.getName()));
517           }
518  
519           if (Data.getInstance().getModeParam("ableToEditRecommendation")) {
520               JLabel recommendation = new JLabel(Data.getInstance().getLocaleStr(
521                       "mainFrame.recommendation"));
522               recommendation.setBorder(labelBorder);
523               JComboBox recommendationBx = new JComboBox();
524               GUITools.addComponent(rightPanel, gbl, recommendation, 0, 7, 1, 1,
525                       0, 0, 10, padding, 0, 20, GridBagConstraints.NONE,
526                       GridBagConstraints.NORTHWEST);
527               GUITools.addComponent(rightPanel, gbl, recommendationBx, 0, 8, 1,
528                       1, 1.0, 0, 10, padding, 0, 20,
529                       GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH);
530  
531               recommendationBx.setSelectedItem(Application.getInstance()
532                       .getReviewMgmt().getRecommendation());
533  
534           }
535  
536       }
537  
538       private void createToolBar() {
539           /*
540            * Create the toolbar and its components
541            */
542           FlowLayout flow = new FlowLayout(FlowLayout.LEFT);
543           panelToolBar.setLayout(flow);
544           panelToolBar.setBackground(Color.WHITE);
545  
546           if (UI.getInstance().getPlatform() != UI.Platform.MAC) {
547               flow.setVgap(6);
548               flow.setHgap(14);
549           }
550  
551           tbShowAssistant = GUITools.newImageButton(Data.getInstance().getIcon(
552                   "tbShowAssistant_50x50_0.png"), Data.getInstance().getIcon(
553                   "tbShowAssistant_50x50.png"));
554           tbShowAssistant.setToolTipText(Data.getInstance().getLocaleStr(
555                   "menu.showAssistant"));
556           tbShowAssistant.addActionListener(ActionRegistry.getInstance().get(
557                   SelectModeAction.class.getName()));
558  
559           panelToolBar.add(tbShowAssistant);
560  
561           tbShowHelp = GUITools.newImageButton(Data.getInstance().getIcon(
562                   "tbShowHelp_50x50_0.png"), Data.getInstance().getIcon(
563                   "tbShowHelp_50x50.png"));
564           tbShowHelp.setToolTipText(Data.getInstance().getLocaleStr(
565                   "menu.showHelp"));
566           tbShowHelp.addActionListener(ActionRegistry.getInstance().get(
567                   OpenHelpAction.class.getName()));
568  
569           panelToolBar.add(tbShowHelp);
570  
571           tbManageSeverities = GUITools.newImageButton(Data.getInstance()
572                   .getIcon("severities_50x50_0.png"), Data.getInstance().getIcon(
573                   "severities_50x50.png"));
574           tbManageSeverities.setToolTipText(Data.getInstance().getLocaleStr(
575                   "menu.manageSeverities"));
576           tbManageSeverities.addActionListener(ActionRegistry.getInstance().get(
577                   ManageSeveritiesAction.class.getName()));
578  
579           panelToolBar.add(tbManageSeverities);
580  
581           tbAspectsManager = GUITools.newImageButton(Data.getInstance().getIcon(
582                   "aspectsManager_50x50_0.png"), Data.getInstance().getIcon(
583                   "aspectsManager_50x50.png"));
584           tbAspectsManager.setToolTipText(Data.getInstance().getLocaleStr(
585                   "menu.aspectsManager"));
586           tbAspectsManager.addActionListener(ActionRegistry.getInstance().get(
587                   OpenAspectsManagerAction.class.getName()));
588  
589           panelToolBar.add(tbAspectsManager);
590  
591           tbCreateInvitations = GUITools.newImageButton(Data.getInstance()
592                   .getIcon("createInvitations_50x50_0.png"), Data.getInstance()
593                   .getIcon("createInvitations_50x50.png"));
594           tbCreateInvitations.setToolTipText(Data.getInstance().getLocaleStr(
595                   "menu.createInvitations"));
596           tbCreateInvitations.addActionListener(ActionRegistry.getInstance().get(
597                   OpenInvitationsDialogAction.class.getName()));
598  
599           panelToolBar.add(tbCreateInvitations);
600  
601           tbNewAttendee = GUITools.newImageButton(Data.getInstance().getIcon(
602                   "addAttendee_50x50_0.png"), Data.getInstance().getIcon(
603                   "addAttendee_50x50.png"));
604           tbNewAttendee.setToolTipText(Data.getInstance().getLocaleStr(
605                   "menu.newAttendee"));
606           tbNewAttendee.addActionListener(ActionRegistry.getInstance().get(
607                   AddAttendeeAction.class.getName()));
608  
609           panelToolBar.add(tbNewAttendee);
610  
611           tbProtocolMode = GUITools.newImageButton(Data.getInstance().getIcon(
612                   "protocolMode_50x50_0.png"), Data.getInstance().getIcon(
613                   "protocolMode_50x50.png"));
614           tbProtocolMode.setToolTipText(Data.getInstance().getLocaleStr(
615                   "menu.protocolMode"));
616           tbProtocolMode.addActionListener(ActionRegistry.getInstance().get(
617                   OpenProtocolModeAction.class.getName()));
618  
619           panelToolBar.add(tbProtocolMode);
620  
621           tbPdfExport = GUITools.newImageButton(Data.getInstance().getIcon(
622                   "PDFExport_50x50_0.png"), Data.getInstance().getIcon(
623                   "PDFExport_50x50.png"));
624           tbPdfExport.setToolTipText(Data.getInstance().getLocaleStr(
625                   "menu.pdfExport"));
626  
627           panelToolBar.add(tbPdfExport);
628  
629           tbCsvExport = GUITools.newImageButton(Data.getInstance().getIcon(
630                   "CSVExport_50x50_0.png"), Data.getInstance().getIcon(
631                   "CSVExport_50x50.png"));
632           tbCsvExport.setToolTipText(Data.getInstance().getLocaleStr(
633                   "menu.csvExport"));
634  
635           panelToolBar.add(tbCsvExport);
636  
637           tbNewMeeting = GUITools.newImageButton(Data.getInstance().getIcon(
638                   "addMeeting_50x50_0.png"), Data.getInstance().getIcon(
639                   "addMeeting_50x50.png"));
640           tbNewMeeting.setToolTipText(Data.getInstance().getLocaleStr(
641                   "menu.newMeeting"));
642           tbNewMeeting.addActionListener(ActionRegistry.getInstance().get(
643                   AddMeetingAction.class.getName()));
644  
645           panelToolBar.add(tbNewMeeting);
646  
647           tbBlank = GUITools.newImageButton(Data.getInstance().getIcon(
648                   "blank_50x50.png"), Data.getInstance().getIcon(
649                   "blank_50x50.png"));
650           tbBlank.setEnabled(false);
651  
652           panelToolBar.add(tbBlank);
653  
654           addTopComponent(panelToolBar);
655       }
656  
657       private void updateToolBar() {
658           /*
659            * Enable and disable toolbar items by mode parameters
660            */
661           if (Data.getInstance().getMode().equals("default")) {
662               tbShowAssistant.setVisible(true);
663               tbShowHelp.setVisible(true);
664  
665               tbManageSeverities.setVisible(false);
666               tbAspectsManager.setVisible(false);
667               tbCreateInvitations.setVisible(false);
668               tbNewAttendee.setVisible(false);
669               tbProtocolMode.setVisible(false);
670               tbPdfExport.setVisible(false);
671               tbCsvExport.setVisible(false);
672               tbNewMeeting.setVisible(false);
673           } else {
674               tbShowAssistant.setVisible(false);
675               tbShowHelp.setVisible(false);
676  
677               tbManageSeverities.setVisible(Data.getInstance().getModeParam(
678                       "ableToUseAspectsManager"));
679               tbAspectsManager.setVisible(Data.getInstance().getModeParam(
680                       "ableToUseAspectsManager"));
681               tbCreateInvitations.setVisible(Data.getInstance().getModeParam(
682                       "ableToCreateInvitations"));
683               tbNewAttendee.setVisible(Data.getInstance().getModeParam(
684                       "ableToManageAttendees"));
685               tbProtocolMode.setVisible(Data.getInstance().getModeParam(
686                       "ableToUseProtocolMode"));
687               tbPdfExport.setVisible(Data.getInstance().getModeParam(
688                       "ableToExportProtocolPDF"));
689               tbCsvExport.setVisible(Data.getInstance().getModeParam(
690                       "ableToExportFindingsCSV"));
691               tbNewMeeting.setVisible(Data.getInstance().getModeParam(
692                       "ableToManageMeetings"));
693           }
694       }
695  
696       private void createMenu() {
697           /*
698            * Create the menu within its components
699            */
700           JMenuBar menuBar = new JMenuBar();
701  
702           /*
703            * File menu
704            */
705           menuFile = new JMenu();
706           menuFile.setText(Data.getInstance().getLocaleStr("menu.file"));
707  
708           fileSelectModeItem = new JMenuItem();
709           fileSelectModeItem.setText(Data.getInstance().getLocaleStr(
710                   "menu.showAssistant"));
711           fileSelectModeItem.addActionListener(ActionRegistry.getInstance().get(
712                   SelectModeAction.class.getName()));
713  
714           menuFile.add(fileSelectModeItem);
715  
716           fileNewReviewItem = new JMenuItem();
717           fileNewReviewItem.addActionListener(ActionRegistry.getInstance().get(
718                   NewReviewAction.class.getName()));
719           fileNewReviewItem.setText(Data.getInstance().getLocaleStr("new"));
720  
721           menuFile.add(fileNewReviewItem);
722  
723           fileOpenReviewItem = new JMenuItem();
724           fileOpenReviewItem.setText(Data.getInstance().getLocaleStr("open"));
725           fileOpenReviewItem.addActionListener(ActionRegistry.getInstance().get(
726                   LoadReviewAction.class.getName()));
727  
728           menuFile.add(fileOpenReviewItem);
729  
730           fileSaveReviewItem = new JMenuItem();
731           fileSaveReviewItem.setText(Data.getInstance().getLocaleStr("save"));
732           fileSaveReviewItem.addActionListener(ActionRegistry.getInstance().get(
733                   SaveReviewAction.class.getName()));
734  
735           menuFile.add(fileSaveReviewItem);
736  
737           fileSaveReviewAsItem = new JMenuItem();
738           fileSaveReviewAsItem.addActionListener(ActionRegistry.getInstance()
739                   .get(SaveReviewAsAction.class.getName()));
740           fileSaveReviewAsItem.setText(Data.getInstance().getLocaleStr("saveAs"));
741  
742           menuFile.add(fileSaveReviewAsItem);
743  
744           closeApplicationItem = new JMenuItem();
745           closeApplicationItem.setText(Data.getInstance().getLocaleStr(
746                   "closeApplication"));
747           closeApplicationItem.addActionListener(ActionRegistry.getInstance()
748                   .get(ExitAction.class.getName()));
749  
750           menuFile.add(closeApplicationItem);
751  
752           menuBar.add(menuFile);
753  
754           /*
755            * Edit menu
756            */
757           menuEdit = new JMenu();
758           menuEdit.setText(Data.getInstance().getLocaleStr("menu.edit"));
759  
760           manageSeveritiesItem = new JMenuItem();
761           manageSeveritiesItem.setText(Data.getInstance().getLocaleStr(
762                   "menu.manageSeverities"));
763           manageSeveritiesItem.addActionListener(ActionRegistry.getInstance()
764                   .get(ManageSeveritiesAction.class.getName()));
765  
766           menuEdit.add(manageSeveritiesItem);
767  
768           newMeetingItem = new JMenuItem();
769           newMeetingItem.setText(Data.getInstance().getLocaleStr(
770                   "menu.newMeeting"));
771           newMeetingItem.addActionListener(ActionRegistry.getInstance().get(
772                   AddMeetingAction.class.getName()));
773  
774           menuEdit.add(newMeetingItem);
775  
776           aspectsManagerItem = new JMenuItem();
777           aspectsManagerItem.addActionListener(ActionRegistry.getInstance().get(
778                   OpenAspectsManagerAction.class.getName()));
779           aspectsManagerItem.setText(Data.getInstance().getLocaleStr(
780                   "menu.aspectsManager"));
781  
782           menuEdit.add(aspectsManagerItem);
783  
784           createInvitationsItem = new JMenuItem();
785           createInvitationsItem.setText(Data.getInstance().getLocaleStr(
786                   "menu.createInvitations"));
787           createInvitationsItem.addActionListener(ActionRegistry.getInstance()
788                   .get(OpenInvitationsDialogAction.class.getName()));
789  
790           menuEdit.add(createInvitationsItem);
791  
792           newAttendeeItem = new JMenuItem();
793           newAttendeeItem.setText(Data.getInstance().getLocaleStr(
794                   "menu.newAttendee"));
795           newAttendeeItem.addActionListener(ActionRegistry.getInstance().get(
796                   AddAttendeeAction.class.getName()));
797  
798           menuEdit.add(newAttendeeItem);
799  
800           protocolModeItem = new JMenuItem();
801           protocolModeItem.setText(Data.getInstance().getLocaleStr(
802                   "menu.protocolMode"));
803           protocolModeItem.addActionListener(ActionRegistry.getInstance().get(
804                   OpenProtocolModeAction.class.getName()));
805           menuEdit.add(protocolModeItem);
806  
807           pdfExportItem = new JMenuItem();
808           pdfExportItem
809                   .setText(Data.getInstance().getLocaleStr("menu.pdfExport"));
810  
811           menuEdit.add(pdfExportItem);
812  
813           csvExportItem = new JMenuItem();
814           csvExportItem
815                   .setText(Data.getInstance().getLocaleStr("menu.csvExport"));
816  
817           menuEdit.add(csvExportItem);
818  
819           menuBar.add(menuEdit);
820  
821           /*
822            * Extras menu
823            */
824           menuXtras = new JMenu();
825           menuXtras.setText(Data.getInstance().getLocaleStr("menu.extras"));
826  
827           menuBar.add(menuXtras);
828  
829           /*
830            * Help menu
831            */
832           menuHelp = new JMenu();
833           menuHelp.setText(Data.getInstance().getLocaleStr("menu.help"));
834  
835           openHelp = new JMenuItem();
836           openHelp.setText(Data.getInstance().getLocaleStr("menu.help.openHelp"));
837           openHelp.addActionListener(ActionRegistry.getInstance().get(
838                   OpenHelpAction.class.getName()));
839  
840           menuHelp.add(openHelp);
841  
842           infoHelp = new JMenuItem();
843           infoHelp.setText(Data.getInstance().getLocaleStr("menu.help.infoHelp"));
844  
845           menuHelp.add(infoHelp);
846  
847           menuBar.add(menuHelp);
848  
849           setJMenuBar(menuBar);
850       }
851  
852       private void updateMenu() {
853           boolean itemVisible;
854  
855           if (Data.getInstance().getMode().equals("default")) {
856               itemVisible = false;
857           } else {
858               itemVisible = true;
859           }
860  
861           /*
862            * If no mode is selected, disable the following menu items
863            */
864           fileNewReviewItem.setVisible(itemVisible);
865           fileOpenReviewItem.setVisible(itemVisible);
866           fileSaveReviewItem.setVisible(itemVisible);
867           fileSaveReviewAsItem.setVisible(itemVisible);
868  
869           menuEdit.setVisible(itemVisible);
870           menuXtras.setVisible(itemVisible);
871  
872           /*
873            * Enable and disable menu items by mode parameters
874            */
875           if (!Data.getInstance().getMode().equals("default")) {
876               fileSelectModeItem.setVisible(Data.getInstance().getModeParam(
877                       "ableToSelectMode"));
878               fileNewReviewItem.setVisible(Data.getInstance().getModeParam(
879                       "ableToCreateNewReview"));
880               aspectsManagerItem.setVisible(Data.getInstance().getModeParam(
881                       "ableToUseAspectsManager"));
882               createInvitationsItem.setVisible(Data.getInstance().getModeParam(
883                       "ableToCreateInvitations"));
884               newAttendeeItem.setVisible(Data.getInstance().getModeParam(
885                       "ableToManageAttendees"));
886               protocolModeItem.setVisible(Data.getInstance().getModeParam(
887                       "ableToUseProtocolMode"));
888               pdfExportItem.setVisible(Data.getInstance().getModeParam(
889                       "ableToExportProtocolPDF"));
890               csvExportItem.setVisible(Data.getInstance().getModeParam(
891                       "ableToExportFindingsCSV"));
892           }
893       }
894  
895       private void createMeetingsTree() {
896           MeetingManagement meetingMgmt = Application.getInstance()
897                   .getMeetingMgmt();
898           ReviewManagement revMgmt = Application.getInstance().getReviewMgmt();
899  
900           try {
901               nodeMeetingRoot.removeAllChildren();
902           } catch (Exception e) {
903               // TODO Exception behandeln!!!
904           }
905  
906           for (int nodeCnt = 0; nodeCnt < revMgmt.getNumberOfMeetings(); nodeCnt++) {
907               TreeMeeting treeMeet = new TreeMeeting();
908               treeMeet.setMeeting(meetingMgmt.getMeetings().get(nodeCnt));
909               DefaultMutableTreeNode dmtn = new DefaultMutableTreeNode(treeMeet);
910               nodeMeetingRoot.add(dmtn);
911  
912               if (treeMeet.getMeeting().getProtocol() != null) {
913                   String date = SimpleDateFormat.getDateInstance(DateFormat.LONG)
914                           .format(
915                                   treeMeet.getMeeting().getProtocol().getDate()
916                                           .getTime());
917                   String start = SimpleDateFormat.getTimeInstance(
918                           DateFormat.SHORT).format(
919                           treeMeet.getMeeting().getProtocol().getStart()
920                                   .getTime());
921                   String end = SimpleDateFormat.getTimeInstance(DateFormat.SHORT)
922                           .format(
923                                   treeMeet.getMeeting().getProtocol().getEnd()
924                                           .getTime());
925                   String location = treeMeet.getMeeting().getProtocol()
926                           .getLocation();
927  
928                   String protocolName = "Protocol vom " + date + ", " + start
929                           + "-" + end + " Uhr, " + location;
930  
931                   DefaultMutableTreeNode protocolNode = new DefaultMutableTreeNode(
932                           protocolName);
933  
934                   dmtn.add(protocolNode);
935               }
936           }
937  
938           meetingsTreeModel.setRoot(nodeMeetingRoot);
939       }
940  
941       private void updateContentPane() {
942           String productName = Application.getInstance().getReviewMgmt()
943                   .getProductName();
944           String productVersion = Application.getInstance().getReviewMgmt()
945                   .getProductVersion();
946  
947           if (!productName.equals("")) {
948               textProduct.setText(productName + " (Version: " + productVersion
949                       + ")");
950           }
951  
952           textRevName.setText(Application.getInstance().getReviewMgmt()
953                   .getReviewName());
954           textRevDesc.setText(Application.getInstance().getReviewMgmt()
955                   .getReviewDescription());
956           textRevComm.setText(Application.getInstance().getReviewMgmt()
957                   .getReviewComments());
958       }
959  
960       private void createHints() {
961           hintProduct = new HintItem(Data.getInstance().getLocaleStr(
962                   "mainFrame.hintProduct"), HintItem.WARNING);
963  
964           hintOk = new HintItem(Data.getInstance().getLocaleStr(
965                   "mainFrame.hintOk"), HintItem.OK);
966  
967           hintInfoNewMeeting = new HintItem(Data.getInstance().getLocaleStr(
968                   "mainFrame.hintInfoNewMeeting"), HintItem.INFO, "start");
969       }
970  
971       private void updateHints() {
972           boolean warningErrorHints = false;
973           List<HintItem> hints = new ArrayList<HintItem>();
974  
975           if (revMgmt.getProductName().equals("")) {
976               hints.add(hintProduct);
977               warningErrorHints = true;
978           }
979  
980           if (!warningErrorHints) {
981               hints.add(hintOk);
982           }
983  
984           hints.add(hintInfoNewMeeting);
985  
986           setHints(hints);
987       }
988  
989       public MainFrame() {
990           super();
991  
992           getContentPane().setLayout(new BorderLayout());
993  
994           setIcon(Data.getInstance().getIcon("RevAger_300x50.png"));
995  
996           createMenu();
997           updateMenu();
998  
999           createToolBar();
1000           updateToolBar();
1001  
1002           createHints();
1003  
1004           update(null, null);
1005  
1006           splitPanel.setBorder(new MatteBorder(0, 0, padding / 2, 0,
1007                   getContentPane().getBackground()));
1008           add(splitPanel, BorderLayout.CENTER);
1009  
1010           addWindowListener(new WindowListener() {
1011               @Override
1012               public void windowActivated(WindowEvent arg0) {
1013               }
1014  
1015               @Override
1016               public void windowClosed(WindowEvent arg0) {
1017               }
1018  
1019               @Override
1020               public void windowClosing(WindowEvent arg0) {
1021                   ActionRegistry.getInstance().get(ExitAction.class.getName())
1022                           .actionPerformed(null);
1023               }
1024  
1025               @Override
1026               public void windowDeactivated(WindowEvent arg0) {
1027               }
1028  
1029               @Override
1030               public void windowDeiconified(WindowEvent arg0) {
1031               }
1032  
1033               @Override
1034               public void windowIconified(WindowEvent arg0) {
1035               }
1036  
1037               @Override
1038               public void windowOpened(WindowEvent arg0) {
1039               }
1040           });
1041  
1042           setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
1043  
1044           pack();
1045  
1046           setLocationToCenter();
1047  
1048           setExtendedState(Frame.MAXIMIZED_BOTH);
1049  
1050           setVisible(true);
1051       }
1052  
1053       @Override
1054       public void update(Observable obs, Object obj) {
1055           if (Data.getInstance().getResiData().getReview() != null) {
1056               if (!mode.equals(Data.getInstance().getMode())) {
1057                   mode = Data.getInstance().getMode();
1058  
1059                   updateMenu();
1060                   updateToolBar();
1061  
1062                   splitPanel.removeAll();
1063  
1064                   createLeftPane();
1065                   createRightPane();
1066  
1067                   splitPanel.revalidate();
1068               }
1069  
1070               createMeetingsTree();
1071  
1072               updateContentPane();
1073  
1074               updateHints();
1075           }
1076  
1077           updateTitle();
1078       }
1079  
1080       /**
1081        * Update the title of the main frame
1082        */
1083       public void updateTitle() {
1084           String title;
1085  
1086           if (Data.getInstance().getMode().equals("default")) {
1087               title = Data.getInstance().getResource("appName");
1088           } else {
1089               String revName = Data.getInstance().getResiData().getReview()
1090                       .getName();
1091  
1092               if (revName != null) {
1093                   if (revName.equals("")) {
1094                       title = Data.getInstance().getLocaleStr("unnamedReview");
1095                   } else {
1096                       title = revName;
1097                   }
1098               } else {
1099                   title = Data.getInstance().getLocaleStr("newReview");
1100               }
1101  
1102               title += " - "
1103                       + Data.getInstance().getResource("appName")
1104                       + " ("
1105                       + Data.getInstance().getLocaleStr(
1106                               "mode.".concat(Data.getInstance().getMode()
1107                                       .toString().toLowerCase())) + ")";
1108           }
1109  
1110           if (status != UI.Status.UNSAVED_CHANGES
1111                   && UI.getInstance().getStatus() == UI.Status.UNSAVED_CHANGES) {
1112               title += " *";
1113           }
1114  
1115           setTitle(title);
1116       }
1117  
1118       @Override
1119       public void switchToProgressMode() {
1120           super.switchToProgressMode();
1121  
1122           for (Component c : panelToolBar.getComponents()) {
1123               c.setEnabled(false);
1124           }
1125       }
1126  
1127       @Override
1128       public void switchToEditMode() {
1129           super.switchToEditMode();
1130  
1131           for (Component c : panelToolBar.getComponents()) {
1132               c.setEnabled(true);
1133           }
1134       }
1135  
1136       @Override
1137       public void switchToClearMode() {
1138           super.switchToClearMode();
1139  
1140           for (Component c : panelToolBar.getComponents()) {
1141               c.setEnabled(true);
1142           }
1143       }
1144  
1145   }
HintItem.java
10   public class HintItem {
11       
12       public static final int ERROR = 1;
13       public static final int WARNING = 2;
14       public static final int OK = 3;
15       public static final int INFO = 4;
16  
17       private int type = 4;
18  
19       private String text = null;
20  
21       private String helpChapter = null;
22  
23       private String helpChapterAnchor = null;
24  
25       public HintItem(String text, int type, String helpChapter,
26               String helpChapterAnchor) {
27           super();
28  
29           this.text = text;
30           this.type = type;
31           this.helpChapter = helpChapter;
32           this.helpChapterAnchor = helpChapterAnchor;
33       }
34  
35       public HintItem(String text, int type, String helpChapter) {
36           this(text, type, helpChapter, null);
37       }
38  
39       public HintItem(String text, int type) {
40           this(text, type, null, null);
41       }
42  
43       /**
44        * @return the type
45        */
46       public int getType() {
47           return type;
48       }
49  
50       /**
51        * @param type
52        *            the type to set
53        */
54       public void setType(int type) {
55           this.type = type;
56       }
57  
58       /**
59        * @return the text
60        */
61       public String getText() {
62           return text;
63       }
64  
65       /**
66        * @param text
67        *            the text to set
68        */
69       public void setText(String text) {
70           this.text = text;
71       }
72  
73       /**
74        * @return the helpChapter
75        */
76       public String getHelpChapter() {
77           return helpChapter;
78       }
79  
80       /**
81        * @param helpChapter
82        *            the helpChapter to set
83        */
84       public void setHelpChapter(String helpChapter) {
85           this.helpChapter = helpChapter;
86       }
87  
88       /**
89        * @return the helpChapterAnchor
90        */
91       public String getHelpChapterAnchor() {
92           return helpChapterAnchor;
93       }
94  
95       /**
96        * @param helpChapterAnchor
97        *            the helpChapterAnchor to set
98        */
99       public void setHelpChapterAnchor(String helpChapterAnchor) {
100           this.helpChapterAnchor = helpChapterAnchor;
101       }
102  
103   }
HelpBrowserFrame.java
46   @SuppressWarnings("serial")
47   public class HelpBrowserFrame extends AbstractFrame {
48       
49       private static JEditorPane bodyPane=null;
50       private static JTextField srchTxtFld=null;
51       private static JTree tree=null;
52       private static String helpStartTitle=null;
53       private static String helpStartContent=null;
54       private static JScrollPane scrollP = null;
55       private static JScrollPane scrollPPanel=new JScrollPane();
56       private static JSplitPane horizontalSplit=null;
57       
58       /* CSS rules */
59       private String cssRule = "body { font-family: Verdana, Arial, sans-serif; font-size: 12pt; margin-left: 20px; margin-right: 20px; margin-bottom: 20px; } \n" +
60           "h1 {font-size: 20pt; padding: 0; margin-top: 35px; margin-bottom: 0; }";
61       
62       
63       public HelpBrowserFrame() {
64           super();
65           
66           setIcon(Data.getInstance().getIcon("helpBrowser_50x50.png"));
67           
68           setStatusBarVisible(false);
69  
70           setTitle(Data.getInstance().getLocaleStr("help.title"));
71           
72           getContentPane().setLayout(new BorderLayout());
73           
74           GridBagLayout gblTop = new GridBagLayout();
75           JPanel panelTop = new JPanel(gblTop);
76           panelTop.setBackground(Color.WHITE);
77           panelTop.setBorder(new MatteBorder(10, 7, 10, 7, Color.WHITE));
78           
79           srchTxtFld = new JTextField();
80           srchTxtFld.addKeyListener(new KeyListener(){
81               @Override
82               public void keyTyped(KeyEvent arg0) {
83               }
84  
85               @Override
86               public void keyPressed(KeyEvent arg0) {
87               }
88  
89               @Override
90               public void keyReleased(KeyEvent arg0) {
91                   ActionRegistry.getInstance().get(SearchAction.class.getName()).actionPerformed(null);
92               }});
93           srchTxtFld.setToolTipText(Data.getInstance().getLocaleStr("help.searchField"));
94           srchTxtFld.setColumns(30);
95           srchTxtFld.setBorder(BorderFactory.createLineBorder(Color.GRAY, 1));
96           srchTxtFld.setBackground(new Color(254,255,193));
97           
98           JButton reset = GUITools.newImageButton();
99           reset.setIcon(Data.getInstance().getIcon("undo_22x22_0.png"));
100           reset.setRolloverIcon(Data.getInstance().getIcon("undo_22x22.png"));
101           reset.setToolTipText(Data.getInstance().getLocaleStr("help.resetButton"));
102           reset.addActionListener(ActionRegistry.getInstance().get(ResetAction.class.getName()));
103           
104           JTextArea descText = new JTextArea(Data.getInstance().getLocaleStr("help.description"));
105           descText.setEditable(false);
106           descText.setFont(FONT_TEXT);
107           descText.setForeground(Color.DARK_GRAY);
108           descText.setSelectionColor(Color.WHITE);
109           
110           GUITools.addComponent(panelTop, gblTop,  descText,0,0,1,1,1.0,  0,0,3,8,3,GridBagConstraints.BOTH,GridBagConstraints.WEST);
111           GUITools.addComponent(panelTop, gblTop,srchTxtFld,0,1,1,1,1.0,  0,0,3,0,6,GridBagConstraints.BOTH,GridBagConstraints.WEST);
112           GUITools.addComponent(panelTop, gblTop,        reset,1,1,1,1,  0,  0,0,0,0,0,GridBagConstraints.BOTH,GridBagConstraints.WEST);
113             
114           addTopComponent(panelTop);
115  
116           
117           try {
118               helpStartTitle = Data.getInstance().getHelpData().getChapterTitle("start");
119               helpStartContent = Data.getInstance().getHelpData().getChapterContent("start");
120           } catch (DataException startMissingError) {
121               JOptionPane.showMessageDialog(UI.getInstance().getMainFrame(),
122                       Data.getInstance().getLocaleStr("message.helpStartMissing"), Data
123                               .getInstance().getLocaleStr("errorOccurred"),
124                       JOptionPane.ERROR_MESSAGE);
125           }
126           
127  
128           tree = new JTree(getStandardRoot());
129           tree.setModel(new DefaultTreeModel(getStandardRoot()));
130           tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
131           tree.setBorder(null);
132           
133           /* Disallow collapsing the tree */
134           tree.addTreeWillExpandListener(new TreeWillExpandListener() {
135               public void treeWillExpand(TreeExpansionEvent e) { }
136               public void treeWillCollapse(TreeExpansionEvent e) throws ExpandVetoException {
137                   throw new ExpandVetoException(e, "you can't collapse this tree");
138                 }
139             });
140           
141           JPanel panel = new JPanel(new BorderLayout());
142           
143           //initializing start site of the online help
144           resetBodyPane();
145           
146           scrollP = new JScrollPane(tree);
147           
148           scrollP.setMinimumSize(new Dimension(0, 500));
149           scrollP.setPreferredSize(new Dimension(150, 500));
150           scrollPPanel.setMinimumSize(new Dimension(0, 500));
151           scrollPPanel.setPreferredSize(new Dimension(300, 500));
152           panel.add(scrollPPanel, BorderLayout.CENTER);
153           
154           
155           horizontalSplit = new JSplitPane(1,true,scrollP,panel);
156           horizontalSplit.setDividerSize(7);
157           horizontalSplit.setDividerLocation(220);
158           horizontalSplit.setOneTouchExpandable(true);
159           horizontalSplit.setBorder(null);
160           
161           getContentPane().setLayout(new BorderLayout());
162           add(horizontalSplit, BorderLayout.CENTER);
163  
164           pack();
165  
166           /*
167            * choosing one chapter or sub-chapter will activate following TreeSelectionListener, which
168            * attributes the content to the title of this chapter.
169            */
170           TreeSelectionListener treeSelected = new TreeSelectionListener(){
171               @Override
172               public void valueChanged(TreeSelectionEvent arg0) {
173                   String path;
174                   if (arg0.getNewLeadSelectionPath() != null) {
175                       path = arg0.getNewLeadSelectionPath().getLastPathComponent().toString();
176                   } else {
177                       path = helpStartTitle;
178                   }
179                   
180                   String titleHtml = "<H1>" + path + "</H1>";
181                   
182                   String[] helpChapters = Data.getInstance().getResource("helpChapters").split(",");
183                   
184                   
185                   for (int nodeCnt = 0; nodeCnt < helpChapters.length; nodeCnt++) {
186                       try {
187                           if (path.equals(Data.getInstance().getHelpData().getChapterTitle(helpChapters[nodeCnt]))){
188                               if(!srchTxtFld.getText().trim().equals("")&nodeCnt!=0){
189                                   String searchString=HelpBrowserFrame.getSrchTxtFld().getText();
190                                   bodyPane.setText(SearchAction.getLocalString(searchString, titleHtml + Data.getInstance().getHelpData().getChapterContent(helpChapters[nodeCnt])));
191                               }else{
192                                   bodyPane.setText(titleHtml + Data.getInstance().getHelpData().getChapterContent(helpChapters[nodeCnt]));
193                               }
194                               } else {
195                                   if (path.equals("helpTitle")){
196                                       bodyPane.setText(titleHtml + Data.getInstance().getHelpData().getChapterContent("start"));
197                                   }
198                               }
199                           } catch (DataException ChapterContentError) {
200                                   System.out.println("Error: can't read chapterContent in HelpBrowserFrame");
201                           }
202                           
203                   }
204                   
205                   scrollPPanel.getViewport().setViewPosition(new Point(0,0));
206                   bodyPane.setCaretPosition(0);
207               }
208               
209           };
210               
211               
212               
213           tree.getSelectionModel().addTreeSelectionListener(treeSelected);
214           
215           Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
216           
217           setSize(screenSize.width/2,screenSize.height-150);
218  
219           setLocationToCenter();
220  
221           setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
222  
223       }
224       
225       @Override
226       public void setVisible(boolean b) {
227           super.setVisible(b);
228           
229           srchTxtFld.requestFocus();
230       }
231       
232       private void resetBodyPane() {
233           bodyPane = new JEditorPane();
234  
235           /*
236            * Set properties of EditorPane
237            */
238           bodyPane.setEditable(false);
239           bodyPane.setBorder(null);
240           bodyPane.setContentType("text/html");
241  
242           ((HTMLDocument) bodyPane.getDocument()).getStyleSheet().addRule(cssRule);
243           
244           // base definition is not functional for images in a jar file
245           //((HTMLDocument) bodyPane.getDocument()).setBase(getClass().getResource(Data.getInstance().getResource("path.helpDocBase")));
246           
247           /* Handle links */
248           bodyPane.addHyperlinkListener(new HyperlinkListener() {
249               public void hyperlinkUpdate(HyperlinkEvent ev) {
250                   if (ev.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
251                       JEditorPane src = (JEditorPane) ev.getSource();
252                       
253                       if (ev.getDescription().startsWith("#")) {
254                           src.scrollToReference(ev.getDescription().substring(1));
255                       } else if (ev.getDescription().startsWith("?")) {
256                           String[] link = ev.getDescription().substring(1).split("#");
257                               
258                           setHelpChapter(link[0]);
259                               
260                           if (link.length > 1) {
261                               // TODO JOJO Funktioniert leider nicht :-(
262                               //resetBodyPane();
263                               //setHelpChapter(link[0]);
264                               setHelpChapterAnchor(link[1]);
265                               //new LoadHelpWorker(link[0], link[1]).execute();
266                           }
267                       }
268                   }
269               }
270           });
271  
272           //initializing start site of the online help
273           setHelpChapter("start");
274  
275           scrollPPanel.setViewportView(bodyPane);
276  
277           scrollPPanel.repaint();
278           scrollPPanel.revalidate();
279       }
280       
281       private void setErrorPage() {
282           bodyPane.setText("<H1>" + Data.getInstance().getLocaleStr("help.error") + "</H1>" + "<P>" + Data.getInstance().getLocaleStr("help.errorMessage") + "</P>");
283       }
284       
285       private void setHelpChapter(String helpChapter) {
286           //TODO
287           //updateBodyPane();
288           ActionRegistry.getInstance().get(ResetAction.class.getName()).actionPerformed(null);
289           
290           try {
291               tree.setSelectionRow(Data.getInstance().getHelpData().getChapterNumber(helpChapter));
292           } catch (DataException e) {
293               tree.setSelectionRow(-1);
294               setErrorPage();
295           }
296  
297           bodyPane.repaint();
298           bodyPane.revalidate();
299  
300           bodyPane.setCaretPosition(0);
301       }
302       
303       private void setHelpChapterAnchor(String helpChapterAnchor) {
304           //bodyPane.setCaretPosition(0);
305           bodyPane.scrollRectToVisible(new Rectangle(0, 0));
306           bodyPane.scrollToReference(helpChapterAnchor);
307  
308           bodyPane.repaint();
309           bodyPane.revalidate();
310       }
311       
312       synchronized public void showHelp() {
313           setVisible(true);
314       }
315       
316       synchronized public void showHelp(String chapter) {
317           setVisible(true);
318           setHelpChapter(chapter);
319       }
320       
321       synchronized public void showHelp(String chapter, String anchor) {
322           setVisible(true);
323           setHelpChapter(chapter);
324           
325           try {
326               setHelpChapterAnchor(anchor);
327           } catch (Exception e) {
328               resetBodyPane();
329               showHelp(chapter, anchor);
330           }
331       }
332       
333       public static JTextField getSrchTxtFld() {
334           return srchTxtFld;
335       }
336       public static JEditorPane getBodyPane() {
337           return bodyPane;
338       }
339       synchronized public static void setTree(DefaultMutableTreeNode root){
340           tree.setModel(new DefaultTreeModel(root));
341       }
342       public static JTree getTree() {
343           return tree;
344       }
345       public static String getHelpStartTitle() {
346           return helpStartTitle;
347       }
348       public static String getHelpStartContent() {
349           return helpStartContent;
350       }
351       public HelpBrowserFrame getHBF() {
352           return this;
353       }
354       
355       
356       public static DefaultMutableTreeNode getStandardRoot(){
357       
358           DefaultMutableTreeNode root = new DefaultMutableTreeNode(helpStartTitle);
359           String[] chapters = null;
360           String helpTitle = null;
361           try {
362               chapters = Data.getInstance().getHelpData().getChapters();        
363               } catch (DataException loadChaptersError) {        
364                   System.out.println("Error: no Chapters availabel in HelpBrowserFrame");
365                   
366               }
367       
368               //for-loop starting at 1 because 1-element is start.html
369       
370               for (int nodeCnt = 1; nodeCnt < chapters.length; nodeCnt++) {
371                   try {
372                       helpTitle = Data.getInstance().getHelpData().getChapterTitle(chapters[nodeCnt]);
373                   } catch (DataException ChapterTitelError) {
374                       System.out.println("Error: can't read ChapterTitel in HelpBrowserFrame");
375                   }
376  
377                   DefaultMutableTreeNode dmtn = new DefaultMutableTreeNode(helpTitle);
378                   root.add(dmtn);
379                   
380               }
381           return root;
382       }
383       
384       
385  
386   }
FileChooser.java
17   public class FileChooser {
18  
19       public static final int MODE_OPEN_FILE = 1;
20       public static final int MODE_SAVE_FILE = 2;
21       public static final int MODE_SELECT_DIRECTORY = 3;
22  
23       public static final int SELECTED_APPROVE = 101;
24       public static final int SELECTED_CANCEL = 102;
25       public static final int SELECTED_ERROR = 103;
26  
27       private File dir = null;
28       private File file = null;
29  
30       /**
31        * @return the dir
32        */
33       public File getDir() {
34           return dir;
35       }
36  
37       /**
38        * @param dir
39        *            the dir to set
40        */
41       public void setDir(File dir) {
42           if (dir == null) {
43               resetDir();
44           } else {
45               this.dir = dir;
46           }
47       }
48  
49       /**
50        *
51        */
52       public void resetDir() {
53           this.dir = new File(System.getProperty("user.home"));
54       }
55  
56       /**
57        * @return the file
58        */
59       public File getFile() {
60           return file;
61       }
62  
63       /**
64        * @param file
65        *            the file to set
66        */
67       public void setFile(File file) {
68           if (file != null) {
69               int index = file.getAbsolutePath().lastIndexOf("/");
70  
71               if (index < file.getAbsolutePath().lastIndexOf("\\")) {
72                   index = file.getAbsolutePath().lastIndexOf("\\");
73               }
74  
75               File directory = new File(file.getAbsolutePath()
76                       .substring(0, index));
77  
78               setDir(directory);
79           }
80  
81           this.file = file;
82       }
83  
84       /**
85        *
86        */
87       public void clearFile() {
88           this.file = null;
89       }
90  
91       public FileChooser() {
92           super();
93  
94           resetDir();
95       }
96  
97       @SuppressWarnings("serial")
98       public int showDialog(Window parent, int chooserMode, int resiFileFilterType) {
99           int selected = SELECTED_APPROVE;
100  
101           final ResiFileFilter filter = new ResiFileFilter(resiFileFilterType);
102  
103           /*
104            * For the Apple Mac platform use the native file chooser (AWT
105            * FileDialog); otherwise use the Swing standard file chooser
106            * (JFileChooser).
107            */
108           if (UI.getInstance().getPlatform() == UI.Platform.MAC) {
109               final FileDialog dialog;
110  
111               if (parent instanceof Frame) {
112                   dialog = new FileDialog((Frame) parent);
113               } else if (parent instanceof Dialog) {
114                   dialog = new FileDialog((Dialog) parent);
115               } else {
116                   dialog = new FileDialog(UI.getInstance().getMainFrame());
117               }
118  
119               dialog.setModal(true);
120  
121               dialog.setFilenameFilter(filter);
122  
123               switch (chooserMode) {
124               case MODE_OPEN_FILE:
125                   dialog.setTitle(Data.getInstance().getLocaleStr(
126                           "fileChooser.titleOpen"));
127  
128                   dialog.setDirectory(this.dir.getAbsolutePath());
129                   if (this.file != null) {
130                       dialog.setFile(this.file.getName());
131                   }
132  
133                   dialog.setMode(FileDialog.LOAD);
134                   dialog.setVisible(true);
135  
136                   if (dialog.getFile() != null) {
137                       setFile(new File(dialog.getDirectory() + dialog.getFile()));
138                       selected = SELECTED_APPROVE;
139                   } else {
140                       selected = SELECTED_CANCEL;
141                   }
142                   break;
143  
144               case MODE_SAVE_FILE:
145                   dialog.setTitle(Data.getInstance().getLocaleStr(
146                           "fileChooser.titleSave"));
147  
148                   dialog.setDirectory(this.dir.getAbsolutePath());
149                   if (this.file != null) {
150                       dialog.setFile(this.file.getName());
151                   }
152  
153                   dialog.setMode(FileDialog.SAVE);
154                   dialog.setVisible(true);
155  
156                   if (dialog.getFile() != null) {
157                       setFile(new File(dialog.getDirectory() + dialog.getFile()));
158  
159                       if (!filter.accept(this.file)) {
160                           String errMsg = Data.getInstance().getLocaleStr(
161                                   "fileChooser.invalidFileName")
162                                   + "\n\n" + filter.getDescription();
163  
164                           JOptionPane.showMessageDialog(dialog.getParent(),
165                                   GUITools.getMessagePane(errMsg), Data
166                                           .getInstance().getLocaleStr("error"),
167                                   JOptionPane.ERROR_MESSAGE);
168  
169                           return showDialog(parent, chooserMode,
170                                   resiFileFilterType);
171                       }
172  
173                       selected = SELECTED_APPROVE;
174                   } else {
175                       selected = SELECTED_CANCEL;
176                   }
177                   break;
178  
179               case MODE_SELECT_DIRECTORY:
180                   dialog.setTitle(Data.getInstance().getLocaleStr(
181                           "fileChooser.titleSelectDir"));
182  
183                   dialog.setFilenameFilter(new ResiFileFilter(
184                           ResiFileFilter.TYPE_DIRECTORY));
185  
186                   dialog.setMode(FileDialog.LOAD);
187  
188                   System
189                           .setProperty("apple.awt.fileDialogForDirectories",
190                                   "true");
191                   dialog.setVisible(true);
192                   System.setProperty("apple.awt.fileDialogForDirectories",
193                           "false");
194  
195                   if (dialog.getDirectory() != null) {
196                       setFile(null);
197                       setDir(new File(dialog.getDirectory() + dialog.getFile()));
198  
199                       selected = SELECTED_APPROVE;
200                   } else {
201                       selected = SELECTED_CANCEL;
202                   }
203                   break;
204  
205               default:
206                   break;
207               }
208           } else {
209               JFileChooser dialog = new JFileChooser() {
210                   @Override
211                   public void approveSelection() {
212                       File f = getSelectedFile();
213  
214                       /*
215                        * Show error if selected file does not exist
216                        */
217                       if (getDialogType() == OPEN_DIALOG) {
218                           if (!f.exists()) {
219                               String errMsg = Data.getInstance().getLocaleStr(
220                                       "fileChooser.fileNotFound");
221  
222                               JOptionPane.showMessageDialog(
223                                       getTopLevelAncestor(), GUITools
224                                               .getMessagePane(errMsg), Data
225                                               .getInstance()
226                                               .getLocaleStr("error"),
227                                       JOptionPane.ERROR_MESSAGE);
228  
229                               return;
230                           }
231                       }
232  
233                       /*
234                        * Show error if file name is invalid
235                        */
236                       if (getDialogType() == SAVE_DIALOG) {
237                           if (!filter.accept(f)) {
238                               String errMsg = Data.getInstance().getLocaleStr(
239                                       "fileChooser.invalidFileName")
240                                       + "\n\n" + filter.getDescription();
241  
242                               JOptionPane.showMessageDialog(
243                                       getTopLevelAncestor(), GUITools
244                                               .getMessagePane(errMsg), Data
245                                               .getInstance()
246                                               .getLocaleStr("error"),
247                                       JOptionPane.ERROR_MESSAGE);
248  
249                               return;
250                           }
251  
252                           /*
253                            * Show warning if file exists
254                            */
255                           if (f.exists()) {
256                               String questMsg = Data.getInstance().getLocaleStr(
257                                       "fileChooser.warningFileExists")
258                                       + "\n\n"
259                                       + this.getSelectedFile().getAbsolutePath();
260  
261                               int result = JOptionPane.showConfirmDialog(
262                                       getTopLevelAncestor(), GUITools
263                                               .getMessagePane(questMsg), Data
264                                               .getInstance().getLocaleStr(
265                                                       "question"),
266                                       JOptionPane.YES_NO_OPTION,
267                                       JOptionPane.QUESTION_MESSAGE);
268                               switch (result) {
269                               case JOptionPane.YES_OPTION:
270                                   super.approveSelection();
271                                   return;
272                               case JOptionPane.NO_OPTION:
273                                   return;
274                               }
275                           }
276                       }
277  
278                       super.approveSelection();
279                   }
280               };
281  
282               dialog.setMultiSelectionEnabled(false);
283  
284               dialog.setCurrentDirectory(this.dir);
285               dialog.setSelectedFile(this.file);
286  
287               /*
288                * Remove standard file filters
289                */
290               FileFilter[] filters = dialog.getChoosableFileFilters();
291               for (int i = 0; i < filters.length; i++) {
292                   dialog.removeChoosableFileFilter(filters[i]);
293               }
294  
295               switch (chooserMode) {
296               case MODE_OPEN_FILE:
297                   dialog.setDialogTitle(Data.getInstance().getLocaleStr(
298                           "fileChooser.titleOpen"));
299  
300                   dialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
301  
302                   /*
303                    * Add choosable file filter to show all files
304                    */
305                   dialog.addChoosableFileFilter(new ResiFileFilter(
306                           ResiFileFilter.TYPE_ALL));
307  
308                   dialog.setFileFilter(filter);
309  
310                   selected = dialog.showOpenDialog(parent);
311                   break;
312  
313               case MODE_SAVE_FILE:
314                   dialog.setDialogTitle(Data.getInstance().getLocaleStr(
315                           "fileChooser.titleSave"));
316  
317                   dialog.setFileSelectionMode(JFileChooser.FILES_ONLY);
318                   dialog.setFileFilter(filter);
319  
320                   selected = dialog.showSaveDialog(parent);
321                   break;
322  
323               case MODE_SELECT_DIRECTORY:
324                   dialog.setDialogTitle(Data.getInstance().getLocaleStr(
325                           "fileChooser.titleSelectDir"));
326                   dialog.setApproveButtonText(Data.getInstance().getLocaleStr(
327                           "select"));
328  
329                   dialog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
330                   dialog.setFileFilter(new ResiFileFilter(
331                           ResiFileFilter.TYPE_DIRECTORY));
332  
333                   selected = dialog.showOpenDialog(parent);
334                   break;
335  
336               default:
337                   break;
338               }
339  
340               if (selected == JFileChooser.APPROVE_OPTION) {
341                   if (chooserMode == MODE_SELECT_DIRECTORY) {
342                       setFile(null);
343                       setDir(dialog.getSelectedFile());
344                   } else {
345                       setFile(dialog.getSelectedFile());
346                       setDir(dialog.getCurrentDirectory());
347                   }
348  
349                   selected = SELECTED_APPROVE;
350               } else if (selected == JFileChooser.ERROR_OPTION) {
351                   JOptionPane.showMessageDialog(parent, GUITools
352                           .getMessagePane(Data.getInstance().getLocaleStr(
353                                   "fileChooser.error")), Data.getInstance()
354                           .getResource("appName"), JOptionPane.ERROR_MESSAGE);
355  
356                   selected = SELECTED_ERROR;
357               } else {
358                   selected = SELECTED_CANCEL;
359               }
360           }
361  
362           return selected;
363       }
364  
365   }
ExportCSVDialog.java
3   public class ExportCSVDialog {
4  
5   }
EditProtocolDialog.java
28   @SuppressWarnings("serial")
29   public class EditProtocolDialog extends AbstractFrame{
30  
31       private GridBagLayout gbl = new GridBagLayout();
32       private JPanel orgPanel = new JPanel(gbl);
33       
34       private void creatingBody(){
35           JTabbedPane tabbedPane = new JTabbedPane();
36           creatingOrgTab();
37           /*
38           tabbedPane.add("organisation",openOrgTab);
39           tabbedPane.add("protocol",openProTab);
40           tabbedPane.add("rating",openRatTab);
41           tabbedPane.add("statistics",openStaTab);
42           tabbedPane.add("comments",openComTab);
43           */
44           add(tabbedPane);
45       }
46  
47       private void creatingOrgTab() {
48           Container c = getContentPane();
49           c.setLayout( gbl);
50          
51           JLabel presentAttLbl = new JLabel("present Attendees");
52           JLabel locationLbl = new JLabel("Location:");
53           JLabel dateLbl = new JLabel("Date:");
54           JLabel beginLbl = new JLabel("Begin:");
55           
56  
57           ObservingTextField dateTxtFld = new ObservingTextField();
58           dateTxtFld.setEditable(false);
59          
60           JSpinner beginMSpinner=new JSpinner(new RotateSpinnerNumberModel(00,00,45,15));
61           JSpinner beginHSpinner=new JSpinner(new RotateSpinnerNumberModel(00,00,23,1));
62           JSpinner endMSpinner=new JSpinner(new RotateSpinnerNumberModel(00,00,45,15));
63           JSpinner endHSpinner=new JSpinner(new RotateSpinnerNumberModel(00,00,23,1));
64           JTextField locationTxtFld=new JTextField();
65       
66           GUITools.formatSpinner(endHSpinner);
67           GUITools.formatSpinner(endMSpinner);
68           GUITools.formatSpinner(beginHSpinner);
69           GUITools.formatSpinner(beginMSpinner);
70           
71           Meeting editMeet=null;
72           int i[]=UI.getInstance().getMainFrame().getMeetingsTree().getSelectionRows();
73           
74               for(int index=0;index<i.length;index++){
75                   
76                   editMeet=Application.getInstance().getMeetingMgmt().getMeetings().get(i[index]-1);
77               
78               }
79               DateFormat dateF = SimpleDateFormat.getDateInstance(DateFormat.LONG);
80               
81               dateTxtFld.setText(dateF.format(editMeet.getPlannedDate().getTime()));
82               beginMSpinner.setValue(editMeet.getPlannedStart().get(Calendar.MINUTE));
83               beginHSpinner.setValue(editMeet.getPlannedStart().get(Calendar.HOUR_OF_DAY));
84               endMSpinner.setValue(editMeet.getPlannedEnd().get(Calendar.MINUTE));
85               endHSpinner.setValue(editMeet.getPlannedEnd().get(Calendar.HOUR_OF_DAY));
86               locationTxtFld.setText(editMeet.getPlannedLocation());
87       
88               JPanel spinnerPanel=new JPanel(gbl);
89               JLabel tillLabel=new JLabel(Data.getInstance().getLocaleStr("editMeeting.period.till"));
90               JLabel clockLabel=new JLabel(Data.getInstance().getLocaleStr("editMeeting.period.clock"));
91              
92               GUITools.addComponent(spinnerPanel, gbl,       beginHSpinner,0,0,1,1,  0,  0,0,0,0,0,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
93               GUITools.addComponent(spinnerPanel, gbl,     new JLabel(":"),1,0,1,1,  0,  0,0,5,0,0,GridBagConstraints.NONE,GridBagConstraints.CENTER); 
94               GUITools.addComponent(spinnerPanel, gbl,      beginMSpinner,2,0,1,1,  0,  0,0,5,0,0,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
95               GUITools.addComponent(spinnerPanel, gbl,          tillLabel,3,0,1,1,1.0,  0,0,20,0,20,GridBagConstraints.NONE,GridBagConstraints.CENTER);
96               GUITools.addComponent(spinnerPanel, gbl,        endHSpinner,4,0,1,1,  0,  0,0,0,0,0,GridBagConstraints.NONE,GridBagConstraints.NORTHEAST);
97               GUITools.addComponent(spinnerPanel, gbl,     new JLabel(":"),5,0,1,1,  0,  0,0,5,0,0,GridBagConstraints.NONE,GridBagConstraints.CENTER); 
98               GUITools.addComponent(spinnerPanel, gbl,          endMSpinner,6,0,1,1,  0,  0,0,5,0,0,GridBagConstraints.NONE,GridBagConstraints.NORTHEAST);
99               GUITools.addComponent(spinnerPanel, gbl,         clockLabel,7,0,1,1,1.0,  0,0,20,0,0,GridBagConstraints.NONE,GridBagConstraints.CENTER);
100              
101       }
102  
103       public EditProtocolDialog(){
104           super();
105           setIcon(Data.getInstance().getIcon("RevAger_300x50.png"));
106           setTitle("Protocol-Mode");
107           getContentPane().setLayout(new BorderLayout());
108           
109           setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
110           
111           creatingBody();
112           
113           pack();
114  
115           setLocationToCenter();
116  
117           //setExtendedState(Frame.MAXIMIZED_BOTH);
118  
119           setVisible(true);
120  
121       }
122   }
EditProductDialog.java
39   @SuppressWarnings("serial")
40   public class EditProductDialog extends AbstractDialog{
41       GridBagLayout gbl = new GridBagLayout();
42       Container c = getContentPane();
43       JTextField nameTxtFld;
44       JTextField versionTxtFld;
45       JTable referenceTbl;
46       JTable dataTbl;
47       ReferenceTableModel rtm=new ReferenceTableModel();
48      
49       public JTable getReferenceTbl() {
50           return referenceTbl;
51       }
52      
53       public ReferenceTableModel getRtm() {
54           return rtm;
55       }
56  
57       public JTextField getNameTxtFld() {
58           return nameTxtFld;
59       }
60  
61       public JTextField getVersionTxtFld() {
62           return versionTxtFld;
63       }
64  
65       public void clearProductDialog(){
66           c.removeAll();
67  
68           JLabel nameLbl = new JLabel(Data.getInstance().getLocaleStr("editProduct.name"));
69           nameTxtFld = new JTextField();
70           JLabel versionLbl = new JLabel(Data.getInstance().getLocaleStr("editProduct.version"));
71           versionTxtFld = new JTextField();
72           JLabel referenceLbl = new JLabel(Data.getInstance().getLocaleStr("editProduct.reference"));
73       
74           ReviewManagement reviewMgmt = Application.getInstance().getReviewMgmt();
75          
76           try{
77               nameTxtFld.setText(reviewMgmt.getProductName());
78               versionTxtFld.setText(reviewMgmt.getProductVersion());
79               
80           }catch(Exception e){}
81          
82           referenceTbl = new JTable(rtm);
83           referenceTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
84          
85           JPanel buttonPanel = new JPanel(new GridLayout(4,1));
86         
87           JButton addReference = GUITools.newImageButton();
88           addReference.setIcon(Data.getInstance().getIcon("add_25x25_0.png"));
89           addReference.setRolloverIcon(Data.getInstance().getIcon("add_25x25.png"));
90           addReference.setToolTipText(Data.getInstance().getLocaleStr("editProduct.addReference"));
91           addReference.addActionListener(ActionRegistry.getInstance().get(AddProductReferenceAction.class.getName()));
92           buttonPanel.add(addReference);
93          
94           JButton removeReference = GUITools.newImageButton();
95           removeReference.setIcon(Data.getInstance().getIcon("remove_25x25_0.png"));
96           removeReference.setRolloverIcon(Data.getInstance().getIcon("remove_25x25.png"));
97           removeReference.setToolTipText(Data.getInstance().getLocaleStr("editProduct.removeReference"));
98           removeReference.addActionListener(ActionRegistry.getInstance().get(RemoveProductReferenceAction.class.getName()));
99           buttonPanel.add(removeReference);
100          
101           JButton editReference = GUITools.newImageButton();
102           editReference.setIcon(Data.getInstance().getIcon("edit_25x25_0.png"));
103           editReference.setRolloverIcon(Data.getInstance().getIcon("edit_25x25.png"));
104           editReference.setToolTipText(Data.getInstance().getLocaleStr("editProduct.editReference"));
105           editReference.addActionListener(ActionRegistry.getInstance().get(EditProductReferenceAction.class.getName()));
106           buttonPanel.add(editReference);
107       
108           JLabel dataLbl = new JLabel(Data.getInstance().getLocaleStr("editProduct.data"));
109           
110           dataTbl = new JTable();
111           dataTbl.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
112          
113           JPanel buttonPanelD = new JPanel(new GridLayout(4,1));
114         
115           JButton addData = GUITools.newImageButton();
116           addData.setIcon(Data.getInstance().getIcon("add_25x25_0.png"));
117           addData.setRolloverIcon(Data.getInstance().getIcon("add_25x25.png"));
118           addData.setToolTipText(Data.getInstance().getLocaleStr("editProduct.addReference"));
119           //addData.addActionListener(ActionRegistry.getInstance().get(AddProductDataAction.class.getName()));
120           buttonPanelD.add(addData);
121          
122           JButton removeData = GUITools.newImageButton();
123           removeData.setIcon(Data.getInstance().getIcon("remove_25x25_0.png"));
124           removeData.setRolloverIcon(Data.getInstance().getIcon("remove_25x25.png"));
125           removeData.setToolTipText(Data.getInstance().getLocaleStr("editProduct.removeReference"));
126           //removeData.addActionListener(ActionRegistry.getInstance().get(RemoveProductDataAction.class.getName()));
127           buttonPanelD.add(removeData);
128          
129           JButton editData = GUITools.newImageButton();
130           editData.setIcon(Data.getInstance().getIcon("edit_25x25_0.png"));
131           editData.setRolloverIcon(Data.getInstance().getIcon("edit_25x25.png"));
132           editData.setToolTipText(Data.getInstance().getLocaleStr("editProduct.editReference"));
133           //editData.addActionListener(ActionRegistry.getInstance().get(EditProductDataAction.class.getName()));
134           buttonPanelD.add(editData);
135          
136           GUITools.addComponent(c, gbl,      nameLbl,0,0,1,1,  0,  0,0,5,0,5,GridBagConstraints.NONE,GridBagConstraints.WEST);
137           GUITools.addComponent(c, gbl,   nameTxtFld,1,0,7,1,1.0,  0,0,5,0,5,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
138           GUITools.addComponent(c, gbl,   versionLbl,0,1,1,1,  0,  0,10,5,0,5,GridBagConstraints.NONE,GridBagConstraints.WEST);
139           GUITools.addComponent(c, gbl,versionTxtFld,1,1,7,1,1.0,  0,10,5,0,5,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
140           GUITools.addComponent(c, gbl, referenceLbl,0,2,1,1,  0,  0,20,5,0,5,GridBagConstraints.NONE,GridBagConstraints.WEST);
141           GUITools.addComponent(c, gbl, referenceTbl,0,3,2,2,1.0,1.0,10,5,0,5,GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
142           GUITools.addComponent(c, gbl,  buttonPanel,3,3,1,2,  0,  0,0,5,0,5,GridBagConstraints.VERTICAL,GridBagConstraints.NORTH);
143           GUITools.addComponent(c, gbl,      dataLbl,4,2,1,1,  0,  0,20,5,0,5,GridBagConstraints.NONE,GridBagConstraints.WEST);
144           GUITools.addComponent(c, gbl,      dataTbl,4,3,2,2,1.0,1.0,10,5,0,5,GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
145           GUITools.addComponent(c, gbl, buttonPanelD,6,3,1,2,  0,  0,0,5,0,5,GridBagConstraints.VERTICAL,GridBagConstraints.NORTH);
146         
147           
148           pack();
149           
150       }
151       
152       public EditProductDialog(Frame parent) {
153           super(parent);
154  
155           setTitle(Data.getInstance().getLocaleStr("editProduct.title"));
156           setDescription(Data.getInstance().getLocaleStr("editProduct.description"));
157           setIcon(Data.getInstance().getIcon("edit_64x64.png"));
158           
159           c.setLayout( gbl);
160           
161           clearProductDialog();
162           
163           
164           JButton cancel = new JButton(Data.getInstance().getLocaleStr(
165           "abort"));
166           cancel.addActionListener(new ActionListener(){
167  
168               @Override
169               public void actionPerformed(ActionEvent e) {
170                   setVisible(false);
171               }});
172          
173           addButton(cancel);
174           
175           JButton accept = new JButton(Data.getInstance().getLocaleStr(
176           "accept"));
177           accept.addActionListener(ActionRegistry.getInstance().get(EditProductAction.class.getName()));
178           addButton(accept);
179          
180           
181           // saving screenSize
182           Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
183           
184           // calculating Position of HelpBrowserFrame
185           int top = ((screenSize.height - getHeight())/2);
186           int left = ((screenSize.width - getWidth()) / 2);
187           
188           
189           // setting Position of HelpBrowserFrame
190           setLocation(left, top);
191           
192           setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
193           addWindowListener(new WindowAdapter() {
194               @Override
195               public void windowClosing(WindowEvent e) {
196                   // buttonClicked = ButtonClicked.CANCEL;
197                   setVisible(false);
198               }
199           });
200  
201       }
202  
203   }
DatePicker.java
55   public class DatePicker extends Observable implements Runnable,
56           WindowFocusListener {
57  
58       /**
59        * Internally used font with plain style
60        */
61       protected static final Font FONT_PLAIN = new Font(Font.SANS_SERIF,
62               Font.PLAIN, 12);
63  
64       /**
65        * Internally used font with bold style
66        */
67       protected static final Font FONT_BOLD = new Font(Font.SANS_SERIF,
68               Font.BOLD, 12);
69  
70       /**
71        * This sub-class represents a label for a single day.
72        */
73       
DatePicker.java
143       }
144  
145       /**
146        * This sub-class represents the field of day labels for the currently
147        * displayed month.
148        */
149       
DatePicker.java
231       }
232  
233       /**
234        * This sub-class represents the navigation to navigate in the Date Picker
235        * throug the months and years.
236        */
237       
DatePicker.java
443       }
444  
445       /**
446        * This sub-class handles the close action.
447        */
448       
DatePicker.java
462       }
463  
464       /*
465        * Attributes for the internally used panels and Calendar objects.
466        */
467       private MonthPanel monthPanel;
468  
469       private NavigatePanel navPanel;
470  
471       protected Calendar calendar;
472  
473       private Calendar selectedDate;
474  
475       private boolean closeOnSelect = true;
476  
477       private DateFormat sdf;
478  
479       private JDialog screen;
480  
481       private JPanel panelBase;
482  
483       /**
484        * Constructor to create a new Date Picker.
485        *
486        * @param parent the modal window for this picker
487        * @param observer
488        */
489       public DatePicker(Window parent, Observer observer) {
490           this(parent, observer, new Date());
491       }
492  
493       /**
494        * Constructor to create a new Date Picker.
495        *
496        * @param parent the modal window for this picker
497        * @param observer observing textfield for this picker
498        * @param selDate date to be selected
499        */
500       public DatePicker(Window parent, Observer observer, Date selDate) {
501           super();
502  
503           register(observer);
504  
505           panelBase = GUITools.newPopupBasePanel();
506  
507           screen = new JDialog(parent);
508           screen.addWindowFocusListener(this);
509           screen.setSize(200, 200);
510           screen.setResizable(false);
511           screen.setModal(true);
512           screen.setUndecorated(true);
513  
514           screen.getContentPane().setLayout(new BorderLayout());
515           screen.getContentPane().add(panelBase, BorderLayout.CENTER);
516           
517           calendar = new GregorianCalendar();
518           setSelectedDate(selDate);
519           Calendar c = calendar;
520  
521           if (selectedDate != null) {
522               c = selectedDate;
523           }
524  
525           updateScreen(c);
526  
527           panelBase.add(navPanel, BorderLayout.NORTH);
528  
529           /*
530            * Close button
531            */
532           JPanel panelBottom = new JPanel(new BorderLayout());
533  
534           JButton buttonClose = GUITools.newImageButton();
535           buttonClose.setIcon(Data.getInstance().getIcon(
536                   "datePickerClose_18x18_0.png"));
537           buttonClose.setRolloverIcon(Data.getInstance().getIcon(
538                   "datePickerClose_18x18.png"));
539           buttonClose.setToolTipText(Data.getInstance().getLocaleStr("datePicker.close"));
540           buttonClose.setBorder(BorderFactory.createLineBorder(screen.getContentPane()
541                   .getBackground(), 4));
542           buttonClose.addActionListener(new DatePickerCloseAction(screen));
543  
544           /*
545            * Hint for the user that he/she schould pick a date
546            */
547           JTextField hint = new JTextField();
548           hint.setBorder(BorderFactory.createLineBorder(UI.POPUP_BACKGROUND, 5));
549           hint.setText(Data.getInstance().getLocaleStr("datePicker.hint"));
550           hint.setFont(FONT_PLAIN.deriveFont(Font.BOLD));
551           hint.setFocusable(false);
552           hint.setEditable(false);
553           hint.setSelectionColor(UI.POPUP_BACKGROUND);
554           hint.setBackground(UI.POPUP_BACKGROUND);
555  
556           /*
557            * Add close button and hint to the bottom of the picker
558            */
559           panelBottom.add(buttonClose, BorderLayout.EAST);
560           panelBottom.add(hint, BorderLayout.WEST);
561           panelBottom.setBackground(UI.POPUP_BACKGROUND);
562           
563           panelBase.add(panelBottom, BorderLayout.SOUTH);
564       }
565  
566       /**
567        * Initializes the Date Picker.
568        *
569        * @param comp Swing Component object
570        */
571       public void start(Component comp) {
572           if (comp != null) {
573               Component p = comp.getParent();
574  
575               int x = comp.getX() + comp.getWidth(), y = comp.getY() + comp.getHeight();
576  
577               while (p != null) {
578                   x += p.getX();
579                   y += p.getY();
580                   p = p.getParent();
581               }
582  
583               screen.setLocation(x, y);
584           } else {
585               Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
586  
587               screen.setLocation((int) (dim.getWidth() - screen.getWidth()) / 2,
588                       (int) (dim.getHeight() - screen.getHeight()) / 2);
589           }
590  
591           SwingUtilities.invokeLater(this);
592       }
593  
594       /**
595        * Displays the Date Picker.
596        */
597       @Override
598       public void run() {
599           screen.pack();
600           screen.setVisible(true);
601       }
602  
603       /**
604        * Parses the given string and returns a Date object.
605        *
606        * @param date string to parse
607        * @return Date object
608        */
609       public Date parseDate(String date) {
610           if (sdf == null) {
611               sdf = SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG);
612           }
613  
614           try {
615               return sdf.parse(date);
616           } catch (Exception e) {
617               return null;
618           }
619       }
620  
621       /**
622        * Formats the given Date object and returns a string.
623        *
624        * @param date Date object to format
625        * @return string
626        */
627       public String formatDate(Date date) {
628           if (date == null) {
629               return "";
630           }
631  
632           if (sdf == null) {
633               sdf = SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG);
634           }
635  
636           return sdf.format(date);
637       }
638  
639       /**
640        *
641        * @param date
642        * @param pattern
643        * @return
644        */
645       public String formatDate(Date date, String pattern) {
646           if (date == null) {
647               return "";
648           }
649  
650           return new SimpleDateFormat(pattern).format(date);
651       }
652  
653       /**
654        *
655        * @param date
656        * @return
657        */
658       public String formatDate(Calendar date) {
659           if (date == null) {
660               return "";
661           }
662  
663           return formatDate(date.getTime());
664       }
665  
666       /**
667        *
668        * @param date
669        * @param pattern
670        * @return
671        */
672       public String formatDate(Calendar date, String pattern) {
673           if (date == null) {
674               return "";
675           }
676  
677           return new SimpleDateFormat(pattern).format(date.getTime());
678       }
679  
680       /**
681        *
682        * @param observer
683        */
684       public void register(Observer observer) {
685           if (observer != null) {
686               this.addObserver(observer);
687           }
688       }
689  
690       /**
691        *
692        * @param observer
693        */
694       public void unregister(Observer observer) {
695           if (observer != null) {
696               this.deleteObserver(observer);
697           }
698       }
699  
700       /**
701        *
702        * @return
703        */
704       public Calendar getCalendar() {
705           return calendar;
706       }
707  
708       /**
709        *
710        * @param d
711        */
712       public void setSelectedDate(Date d) {
713           if (d != null) {
714               if (selectedDate == null) {
715                   selectedDate = new GregorianCalendar();
716               }
717  
718               this.selectedDate.setTime(d);
719  
720               updateScreen(selectedDate);
721           }
722       }
723  
724       /**
725        *
726        * @param c
727        */
728       protected void updateScreen(Calendar c) {
729           if (navPanel == null) {
730               navPanel = new NavigatePanel(this);
731           }
732  
733           navPanel.setCurrentMonth(c);
734  
735           setMonthPanel(c);
736  
737           screen.pack();
738       }
739  
740       /**
741        *
742        * @param calendar
743        */
744       protected void setMonthPanel(Calendar calendar) {
745           if (calendar != null) {
746               this.calendar.setTime(calendar.getTime());
747           }
748  
749           if (monthPanel != null) {
750               panelBase.remove(monthPanel);
751           }
752  
753           monthPanel = new MonthPanel(this, calendar);
754  
755           panelBase.add(monthPanel, BorderLayout.CENTER);
756       }
757  
758       /**
759        *
760        * @param day
761        */
762       protected void dayPicked(int day) {
763           calendar.set(Calendar.DAY_OF_MONTH, day);
764           setSelectedDate(calendar.getTime());
765  
766           this.setChanged();
767           this.notifyObservers(selectedDate);
768  
769           if (closeOnSelect) {
770               screen.dispose();
771               screen.setVisible(false);
772           }
773       }
774  
775       /**
776        *
777        * @param key
778        * @return
779        */
780       public String getString(String key) {
781           return Data.getInstance().getLocaleStr("datePicker." + key);
782       }
783  
784       /**
785        *
786        * @return
787        */
788       public boolean isCloseOnSelect() {
789           return closeOnSelect;
790       }
791  
792       /**
793        *
794        */
795       @Override
796       public void windowGainedFocus(WindowEvent e) {
797       }
798  
799       /**
800        *
801        */
802       @Override
803       public void windowLostFocus(WindowEvent e) {
804           screen.toFront();
805       }
806  
807       /**
808        *
809        * @return
810        */
811       public JDialog getScreen() {
812           return this.screen;
813       }
814  
815       /**
816        *
817        * @param closeOnSelect
818        */
819       public void setCloseOnSelect(boolean closeOnSelect) {
820           this.closeOnSelect = closeOnSelect;
821       }
822   }
CreatePDFProtocolDialog.java
3   public class CreatePDFProtocolDialog {
4  
5   }
CreateInvitationsDialog.java
47   @SuppressWarnings("serial")
48   public class CreateInvitationsDialog extends AbstractDialog{
49       GridBagLayout gbl = new GridBagLayout();
50       Container c = getContentPane();
51       List<Attendee> selectedAttendees = new ArrayList<Attendee>();
52       List<JCheckBox> allAttendeesBx = new ArrayList<JCheckBox>();
53       List<JCheckBox> selectedBx = new ArrayList<JCheckBox>();
54       AttendeeManagement attMgmt=Application.getInstance().getAttendeeMgmt();
55       GridLayout gl;
56       JToggleButton selectAll;
57       JTextField path;
58       //int indexL;
59       
60      
61       public void clearInvitationsDialog(){
62  
63           c.removeAll();
64           selectedAttendees.clear();
65           selectedBx.clear();
66           allAttendeesBx.clear();
67           JPanel attPanel = new JPanel();
68           attPanel.setLayout(new GridLayout(attMgmt.getNumberOfAttendees(),1));
69          
70           for(int index=0;index<attMgmt.getNumberOfAttendees();index++){
71               final int indexL=index;
72               JCheckBox attendee=new JCheckBox();
73               allAttendeesBx.add(attendee);
74               String roleString="role.".concat(attMgmt.getAttendees().get(index).getRole().value());
75                 
76              
77               attendee.setText(attMgmt.getAttendees().get(index).getName()+", "+
78                       Data.getInstance().getLocaleStr(roleString));
79               attendee.addItemListener(new ItemListener(){
80                   @Override
81                   public void itemStateChanged(ItemEvent e) {
82                       if (e.getStateChange() == ItemEvent.SELECTED&&!selectedAttendees.contains(attMgmt.getAttendees().get(indexL))) {
83                           
84                           selectedAttendees.add(attMgmt.getAttendees().get(indexL));
85                           selectedBx.add(allAttendeesBx.get(indexL));    
86                       
87                       } else {
88                           
89                           selectedAttendees.remove(attMgmt.getAttendees().get(indexL));
90                           selectedBx.remove(allAttendeesBx.get(indexL));    
91                       
92                       }
93                       if(selectedBx.size()==allAttendeesBx.size()){
94                           selectAll.setSelected(true);
95                           selectAll.repaint();
96                       }else if(selectedBx.size()==0){
97                           selectAll.setSelected(false);
98                           selectAll.repaint();
99                       
100                       }
101                       
102                   }});
103  
104               attPanel.add(attendee);
105           }
106          
107           JLabel meetingLbl = new JLabel(Data.getInstance().getLocaleStr("invitationsDialog.meeting"));
108          
109           JComboBox meetingsBx = new JComboBox();
110           for(Meeting meet:Application.getInstance().getMeetingMgmt().getMeetings()){
111               TreeMeeting treeMeet = new TreeMeeting();
112               treeMeet.setMeeting(meet);
113           
114               meetingsBx.addItem(treeMeet);
115           }
116          
117           JCheckBox productBx = new JCheckBox();
118           productBx.setText("Prüfling zum Paket hinzufügen");
119          
120          
121           JPanel rbPanel=new JPanel(new GridLayout(6,1));
122          
123           ButtonGroup buttonG = new ButtonGroup();
124           JRadioButton pdfRB = new JRadioButton("Paket als PDF",true);
125           rbPanel.add(pdfRB);
126           buttonG.add(pdfRB);
127          
128           JRadioButton zipRB = new JRadioButton("Paket als ZIP");
129           rbPanel.add(zipRB);
130           buttonG.add(zipRB);
131          
132           JRadioButton dirRB = new JRadioButton("Paket als Unterverzeichnis");
133           rbPanel.add(dirRB);
134           buttonG.add(dirRB);
135          
136          
137          
138           JScrollPane scrllPn = new JScrollPane(attPanel);
139           scrllPn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
140          
141  
142           JLabel attendeeLbl = new JLabel(Data.getInstance().getLocaleStr("invitationsDialog.attendees"));
143          
144           selectAll = new JToggleButton(Data.getInstance().getLocaleStr("invitationsDialog.selectNothing"));
145           selectAll.setFocusable(false);
146           selectAll.addItemListener(new ItemListener(){
147  
148               @Override
149               public void itemStateChanged(ItemEvent e) {
150                   if (e.getStateChange() == ItemEvent.SELECTED) {
151                       
152                       for(JCheckBox bx:allAttendeesBx)bx.setSelected(true);
153                       
154                       selectAll.setText(Data.getInstance().getLocaleStr("invitationsDialog.selectAll"));
155                       selectedAttendees.clear();
156                       selectedBx.clear();
157                       
158                       for(int index=0;index<attMgmt.getNumberOfAttendees();index++){
159                           selectedAttendees.add(attMgmt.getAttendees().get(index));
160                           selectedBx.add(allAttendeesBx.get(index));    
161                       }
162                   }else{
163                       for(JCheckBox bx:allAttendeesBx)bx.setSelected(false);
164                       selectAll.setText(Data.getInstance().getLocaleStr("invitationsDialog.selectNothing"));
165               
166                       selectedAttendees.clear();
167                       selectedBx.clear();
168                   }
169               }});
170          
171           JLabel directory = new JLabel(Data.getInstance().getLocaleStr("invitationsDialog.directory"));
172           path = new JTextField();
173           JButton browse = GUITools.newImageButton(Data.getInstance().getIcon("buttonBrowse_22x22_0.png"),Data.getInstance().getIcon("buttonBrowse_22x22.png"));
174           browse.setMargin(new Insets(1, 1, 1, 1));
175           browse.addActionListener(new ActionListener() {
176  
177               @Override
178               public void actionPerformed(ActionEvent e) {
179                   FileChooser fileChooser = UI.getInstance().getFileChooser();
180               
181                   if (fileChooser.showDialog(UI.getInstance().getMainFrame(),
182                           FileChooser.MODE_SELECT_DIRECTORY, ResiFileFilter.TYPE_DIRECTORY) == FileChooser.SELECTED_APPROVE) {
183                       String dirPath = fileChooser.getDir().getAbsolutePath();
184                           
185                       path.setText(dirPath);
186                   }
187               }
188           });
189           
190           GUITools.addComponent(c, gbl,                  meetingLbl,0,0,1,1,  0,  0,20, 5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
191           GUITools.addComponent(c, gbl,                  meetingsBx,0,1,3,1,1.0,  0, 5, 5,0,5,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
192           GUITools.addComponent(c, gbl,                 attendeeLbl,0,2,1,1,  0,  0,20, 5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
193           GUITools.addComponent(c, gbl,                   selectAll,0,3,1,1,  0,  0, 0, 5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
194           GUITools.addComponent(c, gbl,                     scrllPn,0,4,1,2,1.0,1.0, 5, 5,0,5,GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
195           GUITools.addComponent(c, gbl,                   productBx,1,2,1,1,  0,  0,20,20,0,5,GridBagConstraints.NONE,GridBagConstraints.CENTER);
196           GUITools.addComponent(c, gbl,                     rbPanel,1,4,1,1,  0,  0,10,20,0,5,GridBagConstraints.NONE,GridBagConstraints.CENTER);
197           GUITools.addComponent(c, gbl,                   directory,0,6,1,1,  0,  0,10, 5,0,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
198           GUITools.addComponent(c, gbl,                        path,0,7,2,1,1.0,  0, 0, 5,20,5,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
199           GUITools.addComponent(c, gbl,                      browse,2,7,1,1,  0,  0, 0, 5,20,5,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
200          
201       }
202  
203       public CreateInvitationsDialog(Frame parent) {
204           super(parent);
205  
206           setMinimumSize(new Dimension(500,550));
207           setTitle(Data.getInstance().getLocaleStr("invitationsDialog.title"));
208           setDescription(Data.getInstance().getLocaleStr("invitationsDialog.description"));
209           setIcon(Data.getInstance().getIcon("createInvitations_64x64.png"));
210           
211           c.setLayout( gbl);
212           clearInvitationsDialog();
213           
214           
215           JButton cancel = new JButton(Data.getInstance().getLocaleStr(
216           "abort"));
217           cancel.addActionListener(new ActionListener(){
218  
219               @Override
220               public void actionPerformed(ActionEvent e) {
221                   setVisible(false);
222                   for(Attendee att:selectedAttendees)
223                       System.out.println(att.getName());
224               }});
225          
226           addButton(cancel);
227           
228           JButton accept = new JButton(Data.getInstance().getLocaleStr(
229           "accept"));
230           //accept.addActionListener(ActionRegistry.getInstance().get(EditProductAction.class.getName()));
231           addButton(accept);
232          
233           
234           // saving screenSize
235           Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
236           
237           // calculating Position of HelpBrowserFrame
238           int top = ((screenSize.height - getHeight())/2);
239           int left = ((screenSize.width - getWidth()) / 2);
240           
241           
242           // setting Position of HelpBrowserFrame
243           setLocation(left, top);
244           
245           setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
246           addWindowListener(new WindowAdapter() {
247               @Override
248               public void windowClosing(WindowEvent e) {
249                   // buttonClicked = ButtonClicked.CANCEL;
250                   setVisible(false);
251               }
252           });
253  
254   }
255  
256   }
CheckRenderer.java
17   public class CheckRenderer extends JPanel implements TreeCellRenderer {
18         protected JCheckBox check;
19  
20         protected TreeLabel label;
21  
22         public CheckRenderer() {
23           setLayout(null);
24           check = new JCheckBox();
25           add(check);
26           label = new TreeLabel();
27           add(label);
28           check.setBackground(UIManager.getColor("Tree.textBackground"));
29           label.setForeground(UIManager.getColor("Tree.textForeground"));
30         }
31  
32         public Component getTreeCellRendererComponent(JTree tree, Object value,
33             boolean isSelected, boolean expanded, boolean leaf, int row,
34             boolean hasFocus) {
35           String stringValue = tree.convertValueToText(value, isSelected,
36               expanded, leaf, row, hasFocus);
37           setEnabled(tree.isEnabled());
38           check.setSelected(((CheckNode) value).isSelected());
39           label.setFont(tree.getFont());
40           label.setText(stringValue);
41           label.setSelected(isSelected);
42           label.setFocus(hasFocus);
43           if (leaf) {
44             label.setIcon(UIManager.getIcon("Tree.leafIcon"));
45           } else if (expanded) {
46             label.setIcon(UIManager.getIcon("Tree.openIcon"));
47           } else {
48             label.setIcon(UIManager.getIcon("Tree.closedIcon"));
49           }
50           return this;
51         }
52  
53         public Dimension getPreferredSize() {
54           Dimension d_check = check.getPreferredSize();
55           Dimension d_label = label.getPreferredSize();
56           return new Dimension(d_check.width + d_label.width,
57               (d_check.height < d_label.height ? d_label.height
58                   : d_check.height));
59         }
60  
61         public void doLayout() {
62           Dimension d_check = check.getPreferredSize();
63           Dimension d_label = label.getPreferredSize();
64           int y_check = 0;
65           int y_label = 0;
66           if (d_check.height < d_label.height) {
67             y_check = (d_label.height - d_check.height) / 2;
68           } else {
69             y_label = (d_check.height - d_label.height) / 2;
70           }
71           check.setLocation(0, y_check);
72           check.setBounds(0, y_check, d_check.width, d_check.height);
73           label.setLocation(d_check.width, y_label);
74           label.setBounds(d_check.width, y_label, d_label.width, d_label.height);
75         }
76  
77         public void setBackground(Color color) {
78           if (color instanceof ColorUIResource)
79             color = null;
80           super.setBackground(color);
81         }
82  
83        
CheckRenderer.java
143         }
144       }
CheckNode.java
7   public class CheckNode extends DefaultMutableTreeNode {
8  
9         protected boolean isSelected;
10  
11         public CheckNode() {
12           this(null);
13         }
14  
15         public CheckNode(Object userObject) {
16           this(userObject, true, false);
17         }
18  
19         public CheckNode(Object userObject, boolean allowsChildren,
20             boolean isSelected) {
21           super(userObject, allowsChildren);
22           this.isSelected = isSelected;
23         }
24  
25         public void setSelected(boolean isSelected) {
26           this.isSelected = isSelected;
27           if(isSelected){
28           if (children != null) {
29             Enumeration<Object> e = children.elements();
30             //Iterator<Object> e1 = children.iterator();
31             while (e.hasMoreElements()) {
32               CheckNode node = (CheckNode) e.nextElement();
33               node.setSelected(isSelected);
34             }
35           }else{}
36           }
37         }
38  
39         public boolean isSelected() {
40           return isSelected;
41         }
42  
43         // If you want to change "isSelected" by CellEditor,
44         /*
45          public void setUserObject(Object obj) { if (obj instanceof Boolean) {
46          setSelected(((Boolean)obj).booleanValue()); } else {
47          super.setUserObject(obj); } }
48         */
49  
50       }
AttendeeDialog.java
42   @SuppressWarnings("serial")
43   public class AttendeeDialog extends AbstractDialog{
44       private JTextField nameTxtFld;
45       private JTextArea contactTxtArea;
46       private JComboBox roleBox;
47       private AppAttendee selectedAppAtt;
48       private StrengthTableModel stm;
49       private JTable strengthTbl;
50       private JButton addStrength;
51       private JButton editStrength;
52       private JButton removeStrength;
53       
54       
55       public AppAttendee getSelectedAppAtt() {
56           return selectedAppAtt;
57       }
58  
59       public StrengthTableModel getStm() {
60           return stm;
61       }
62       public JTable getStrengthTbl() {
63           return strengthTbl;
64       }
65  
66       public JTextField getNameTxtFld() {
67           return nameTxtFld;
68       }
69  
70       public JTextArea getContactTxtArea() {
71           return contactTxtArea;
72       }
73  
74       
75       public JComboBox getRoleBox() {
76           return roleBox;
77       }
78  
79       public static boolean EDIT=false;
80       
81   public boolean modeEdit=false;
82       
83       public void setMode(){
84           
85           if(modeEdit==false){
86               setTitle(Data.getInstance().getLocaleStr("addAttendee.title"));
87               setDescription(Data.getInstance().getLocaleStr("addAttendee.description"));
88               setIcon(Data.getInstance().getIcon("addAttendee_50x50.png"));
89               nameTxtFld.setText(null);
90               contactTxtArea.setText(null);
91               roleBox.setSelectedIndex(0);
92               
93               addStrength.setEnabled(false);
94               editStrength.setEnabled(false);
95               removeStrength.setEnabled(false);
96               strengthTbl.setEnabled(false);
97               
98               try {
99                   selectedAppAtt=AppAttendee.newInstance("Test","Test");
100               } catch (DataException e) {
101                   // TODO Auto-generated catch block
102                   e.printStackTrace();
103               }
104           }else{
105               setTitle(Data.getInstance().getLocaleStr("editAttendee.title"));
106               setDescription(Data.getInstance().getLocaleStr("editAttendee.description"));
107               setIcon(Data.getInstance().getIcon("editAttendee_50x50.png"));
108               
109               int selectedRow=UI.getInstance().getMainFrame().getAttendeesTable().getSelectedRow();
110               
111               Attendee selectedAttendee = null;
112               selectedAttendee =Data.getInstance().getResiData().getReview().getAttendees().get(selectedRow);
113               
114               nameTxtFld.setText(selectedAttendee.getName());
115               contactTxtArea.setText(selectedAttendee.getContact());
116               roleBox.setSelectedItem(Data.getInstance().getLocaleStr("role.".concat(selectedAttendee.getRole().value())));
117               if(roleBox.getSelectedItem()==Data.getInstance().getLocaleStr("role.reviewer")){
118                   addStrength.setEnabled(true);
119                   editStrength.setEnabled(true);
120                   removeStrength.setEnabled(true);
121                   strengthTbl.setEnabled(true);
122               }
123               try {
124                   selectedAppAtt=Data.getInstance().getAppData().getAttendee(selectedAttendee.getName(),selectedAttendee.getContact());    
125               } catch (DataException e) {
126                   // TODO Auto-generated catch block
127                   e.printStackTrace();
128               }
129               
130               
131           }
132           stm=new StrengthTableModel();
133           strengthTbl.setModel(stm);
134           stm.fireTableDataChanged();
135          
136       }
137  
138       public AttendeeDialog(Frame parent) {
139           super(parent);
140           
141           GridBagLayout gbl = new GridBagLayout();
142           Container c = getContentPane();
143           c.setLayout( gbl);
144          
145          
146           JLabel name = new JLabel(Data.getInstance().getLocaleStr("attendee.name"));
147           nameTxtFld = new JTextField();
148          
149           JButton directory = GUITools.newImageButton();
150           directory.setIcon(Data.getInstance().getIcon("directory_25x25_0.png"));
151           directory.setRolloverIcon(Data.getInstance().getIcon("directory_25x25.png"));
152           directory.setToolTipText(Data.getInstance().getLocaleStr("attendee.directory"));
153           directory.addActionListener(ActionRegistry.getInstance().get(SelectAttendeeOutOfDirAction.class.getName()));
154           JLabel contact = new JLabel(Data.getInstance().getLocaleStr("attendee.contact"));
155           contactTxtArea = new JTextArea();
156           JScrollPane contactScrllPn =GUITools.setIntoScrllPn(contactTxtArea);
157           JLabel role = new JLabel(Data.getInstance().getLocaleStr("attendee.role"));
158           roleBox = new JComboBox();
159           for (Role x: Role.values()) {
160               String roleString="role.".concat(x.value());
161               roleBox.addItem(Data.getInstance().getLocaleStr(roleString));
162           }
163           roleBox.addItemListener(new ItemListener(){
164  
165               @Override
166               public void itemStateChanged(ItemEvent arg0) {
167                   if(arg0.getItem().toString()==Data.getInstance().getLocaleStr("role.reviewer")){
168                       addStrength.setEnabled(true);
169                       editStrength.setEnabled(true);
170                       removeStrength.setEnabled(true);
171                       strengthTbl.setEnabled(true);
172                   }else{
173                       addStrength.setEnabled(false);
174                       editStrength.setEnabled(false);
175                       removeStrength.setEnabled(false);
176                       strengthTbl.setEnabled(false);
177                   }
178               }});
179  
180          
181           JLabel strength = new JLabel(Data.getInstance().getLocaleStr("attendee.priorities"));
182          
183           JButton manageAspects = new JButton(Data.getInstance().getLocaleStr("attendee.manageAspects"));
184           manageAspects.addActionListener(ActionRegistry.getInstance().get(OpenAspectsManagerAction.class.getName()));
185          
186           JPanel buttonPanel = new JPanel(new GridLayout(3,1));
187           strengthTbl = new JTable();
188          
189           addStrength = GUITools.newImageButton();
190           addStrength.setIcon(Data.getInstance().getIcon("add_25x25_0.png"));
191           addStrength.setRolloverIcon(Data.getInstance().getIcon("add_25x25.png"));
192           addStrength.setToolTipText(Data.getInstance().getLocaleStr("attendeeDialog.addStrength"));
193           addStrength.addActionListener(ActionRegistry.getInstance().get(AddStrengthAction.class.getName()));
194           buttonPanel.add(addStrength);
195          
196           removeStrength = GUITools.newImageButton();
197           removeStrength.setIcon(Data.getInstance().getIcon("remove_25x25_0.png"));
198           removeStrength.setRolloverIcon(Data.getInstance().getIcon("remove_25x25.png"));
199           removeStrength.setToolTipText(Data.getInstance().getLocaleStr("attendeeDialog.removeStrength"));
200           removeStrength.addActionListener(ActionRegistry.getInstance().get(RemoveStrengthAction.class.getName()));
201           buttonPanel.add(removeStrength);
202          
203           editStrength = GUITools.newImageButton();
204           editStrength.setIcon(Data.getInstance().getIcon("edit_25x25_0.png"));
205           editStrength.setRolloverIcon(Data.getInstance().getIcon("edit_25x25.png"));
206           editStrength.setToolTipText(Data.getInstance().getLocaleStr("attendeeDialog.editStrength"));
207           editStrength.addActionListener(ActionRegistry.getInstance().get(EditStrengthAction.class.getName()));
208           buttonPanel.add(editStrength);
209       
210           GUITools.addComponent(c, gbl,             name,0,0,1,1,  0,  0, 0,20,0,20,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
211           GUITools.addComponent(c, gbl,       nameTxtFld,1,0,3,1,1.0,  0, 0,20,0,0,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
212           GUITools.addComponent(c, gbl,        directory,4,0,1,1,  0,  0, 0,5,0,20,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
213           GUITools.addComponent(c, gbl,          contact,0,1,1,1,  0,  0, 0,20,0,20,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
214           GUITools.addComponent(c, gbl,   contactScrllPn,1,1,3,3,1.0,0.5, 0,20,0,0,GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
215           GUITools.addComponent(c, gbl,             role,0,4,1,1,  0,  0, 5,20,0,20,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
216           GUITools.addComponent(c, gbl,          roleBox,1,4,3,1,1.0,  0, 5,20,0, 0,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
217           GUITools.addComponent(c, gbl,         strength,0,5,1,1,  0,  0, 5,20,0,20,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
218           GUITools.addComponent(c, gbl,      strengthTbl,1,5,3,2,1.0,0.5,10,20,0, 0,GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
219           GUITools.addComponent(c, gbl,      buttonPanel,4,5,1,2,  0,  0,10, 5,0, 0,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
220           GUITools.addComponent(c, gbl,    manageAspects,2,7,2,1,  0,  0, 5,20,0, 0,GridBagConstraints.NONE,GridBagConstraints.NORTHEAST);
221          
222          
223           JButton cancel = new JButton(Data.getInstance().getLocaleStr(
224           "abort"));
225           cancel.addActionListener(new ActionListener(){
226  
227               @Override
228               public void actionPerformed(ActionEvent e) {
229                   
230                   try {
231                       Data.getInstance().getAppData().removeAttendee(selectedAppAtt);
232                   } catch (DataException e1) {
233                       // TODO Auto-generated catch block
234                       e1.printStackTrace();
235                   }
236                   stm.fireTableDataChanged();
237                   setVisible(false);
238               }});
239          
240           addButton(cancel);
241           
242           JButton accept = new JButton(Data.getInstance().getLocaleStr(
243           "accept"));
244           accept.addActionListener(ActionRegistry.getInstance().get(ConfirmAttendeeAction.class.getName()));
245           addButton(accept);
246           
247           setMinimumSize(new Dimension(500,550));
248           pack();
249           // saving screenSize
250           Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
251           
252           // calculating Position of HelpBrowserFrame
253           int top = ((screenSize.height - getHeight())/2);
254           int left = ((screenSize.width - getWidth()) / 2);
255           
256           
257           // setting Position of HelpBrowserFrame
258           setLocation(left, top);
259           
260           setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
261           addWindowListener(new WindowAdapter() {
262               @Override
263               public void windowClosing(WindowEvent e) {
264                   try {
265                       Data.getInstance().getAppData().removeAttendee(selectedAppAtt);
266                       stm.fireTableDataChanged();
267                   } catch (DataException e1) {
268                       // TODO Auto-generated catch block
269                       e1.printStackTrace();
270                   }
271                   setVisible(false);
272               }
273           });
274       }
275  
276   }
AssistantDialog.java
34   @SuppressWarnings("serial")
35   public class AssistantDialog extends AbstractDialog {
36  
37       
AssistantDialog.java
39       }
40  
41       private Selection selected = Selection.NEW_REVIEW;
42  
43       public Selection getSelected() {
44           return selected;
45       }
46  
47       private GridBagLayout gbl = new GridBagLayout();
48       private Container cont = getContentPane();
49  
50       private JButton buttonExit = new JButton(Data.getInstance().getLocaleStr(
51               "closeApplication"));;
52       private JButton buttonBack = new JButton(Data.getInstance().getLocaleStr(
53               "back"));
54       private JButton buttonConfirm = new JButton(Data.getInstance()
55               .getLocaleStr("confirm"));
56  
57       private JTextField textPath = new JTextField();
58  
59       private final ImageIcon ICON_BROWSE = Data.getInstance().getIcon(
60               "buttonBrowse_22x22_0.png");
61       private final ImageIcon ICON_BROWSE_ROLLOVER = Data.getInstance().getIcon(
62               "buttonBrowse_22x22.png");
63       private JButton buttonBrowse = GUITools.newImageButton(ICON_BROWSE,
64               ICON_BROWSE_ROLLOVER);
65  
66       private JTable tableLastReviews = new JTable();
67  
68       public String getPath() {
69           return textPath.getText();
70       }
71  
72       public void setPath(String path) {
73           textPath.setText(path);
74       }
75  
76       public void setSelectMode() {
77           setDescription(Data.getInstance().getLocaleStr(
78                   "assistantDialog.selectModeDescription"));
79  
80           cont.removeAll();
81           cont.repaint();
82  
83           cont.setLayout(gbl);
84  
85           buttonConfirm.setEnabled(false);
86           buttonBack.setEnabled(false);
87  
88           JButton moderator = GUITools.newImageButton();
89           moderator
90                   .setIcon(Data.getInstance().getIcon("moderator_128x128_0.png"));
91           moderator.setRolloverIcon(Data.getInstance().getIcon(
92                   "moderator_128x128.png"));
93           moderator.addActionListener(ActionRegistry.getInstance().get(
94                   OpenModeratorModusAction.class.getName()));
95  
96           JButton scribe = GUITools.newImageButton();
97           scribe.setIcon(Data.getInstance().getIcon("scribe_128x128_0.png"));
98           scribe
99                   .setRolloverIcon(Data.getInstance().getIcon(
100                           "scribe_128x128.png"));
101           scribe.addActionListener(ActionRegistry.getInstance().get(
102                   OpenScribeModusAction.class.getName()));
103  
104           JLabel scribeLabel = new JLabel(Data.getInstance().getLocaleStr(
105                   "mode.scribe"));
106           JLabel moderatorLabel = new JLabel(Data.getInstance().getLocaleStr(
107                   "mode.moderator"));
108  
109           buttonExit.addActionListener(ActionRegistry.getInstance().get(
110                   ExitAction.class.getName()));
111  
112           GUITools.addComponent(cont, gbl, moderator, 0, 0, 1, 1, 1.0, 1.0, 0,
113                   20, 0, 20, GridBagConstraints.NONE, GridBagConstraints.SOUTH);
114           GUITools
115                   .addComponent(cont, gbl, moderatorLabel, 0, 1, 1, 1, 1.0, 1.0,
116                           0, 20, 0, 20, GridBagConstraints.NONE,
117                           GridBagConstraints.NORTH);
118           GUITools.addComponent(cont, gbl, scribe, 1, 0, 1, 1, 1.0, 1.0, 0, 20,
119                   0, 20, GridBagConstraints.NONE, GridBagConstraints.SOUTH);
120           GUITools.addComponent(cont, gbl, scribeLabel, 1, 1, 1, 1, 1.0, 1.0, 0,
121                   20, 0, 20, GridBagConstraints.NONE, GridBagConstraints.NORTH);
122  
123           buttonConfirm.requestFocusInWindow();
124  
125           pack();
126       }
127  
128       public void setSelectReview() {
129           setDescription(Data.getInstance().getLocaleStr(
130                   "assistantDialog.selectReviewDescription"));
131  
132           cont.removeAll();
133           cont.repaint();
134  
135           buttonBack.setEnabled(true);
136           buttonConfirm.setEnabled(true);
137  
138           final JLabel labelSelectReview = new JLabel(Data.getInstance()
139                   .getLocaleStr("assistantDialog.selectReview")
140                   + ":");
141           final JLabel labelLastReviews = new JLabel(Data.getInstance()
142                   .getLocaleStr("assistantDialog.lastReviews")
143                   + ":");
144  
145           ButtonGroup choice = new ButtonGroup();
146  
147           JRadioButton newReview = new JRadioButton(Data.getInstance()
148                   .getLocaleStr("menu.file.newReview"), true);
149           choice.add(newReview);
150  
151           JRadioButton openReview = new JRadioButton(Data.getInstance()
152                   .getLocaleStr("menu.file.openReview"));
153           choice.add(openReview);
154  
155           JRadioButton manageAspects = new JRadioButton(Data.getInstance()
156                   .getLocaleStr("assistantDialog.manageCatalogs"));
157           choice.add(manageAspects);
158  
159           buttonConfirm.addActionListener(new ActionListener() {
160  
161               @Override
162               public void actionPerformed(ActionEvent e) {
163                   if (UI.getInstance().getAssistantDialog().getSelected() == AssistantDialog.Selection.LOAD_REVIEW
164                           && UI.getInstance().getAssistantDialog().getPath()
165                                   .equals("")) {
166                       JOptionPane.showMessageDialog(UI.getInstance()
167                               .getAssistantDialog(), GUITools.getMessagePane(Data
168                               .getInstance().getLocaleStr(
169                                       "message.selectReviewToLoad")), Data
170                               .getInstance().getLocaleStr("error"),
171                               JOptionPane.ERROR_MESSAGE);
172  
173                       return;
174                   }
175  
176                   ActionRegistry.getInstance().get(
177                           InitializeMainFrameAction.class.getName())
178                           .actionPerformed(e);
179               }
180  
181           });
182  
183           openReview.setEnabled(Data.getInstance().getModeParam(
184                   "ableToOpenReview"));
185           openReview.addItemListener(new ItemListener() {
186               @Override
187               public void itemStateChanged(ItemEvent e) {
188                   if (e.getStateChange() == ItemEvent.SELECTED) {
189                       textPath.setEnabled(true);
190                       buttonBrowse.setEnabled(true);
191                       tableLastReviews.setEnabled(true);
192                       selected = Selection.LOAD_REVIEW;
193                       labelSelectReview.setEnabled(true);
194                       labelLastReviews.setEnabled(true);
195                   }
196               }
197           });
198  
199           newReview.setEnabled(Data.getInstance().getModeParam(
200                   "ableToCreateNewReview"));
201           newReview.addItemListener(new ItemListener() {
202               @Override
203               public void itemStateChanged(ItemEvent e) {
204                   if (e.getStateChange() == ItemEvent.SELECTED) {
205                       textPath.setEnabled(false);
206                       buttonBrowse.setEnabled(false);
207                       tableLastReviews.setEnabled(false);
208                       selected = Selection.NEW_REVIEW;
209                       labelSelectReview.setEnabled(false);
210                       labelLastReviews.setEnabled(false);
211                   }
212               }
213           });
214  
215           manageAspects.setEnabled(Data.getInstance().getModeParam(
216                   "ableToUseAspectsManager"));
217           manageAspects.addItemListener(new ItemListener() {
218               @Override
219               public void itemStateChanged(ItemEvent e) {
220                   if (e.getStateChange() == ItemEvent.SELECTED) {
221                       textPath.setEnabled(false);
222                       buttonBrowse.setEnabled(false);
223                       tableLastReviews.setEnabled(false);
224                       selected = Selection.MANAGE_ASPECTS;
225                       labelSelectReview.setEnabled(false);
226                       labelLastReviews.setEnabled(false);
227                   }
228               }
229           });
230  
231           if (Data.getInstance().getModeParam("ableToCreateNewReview")) {
232               newReview.setSelected(Data.getInstance().getModeParam(
233                       "ableToCreateNewReview"));
234           } else {
235               openReview.setSelected(Data.getInstance().getModeParam(
236                       "ableToOpenReview"));
237           }
238  
239           /*
240            * Set start selection
241            */
242           boolean openReviewSelected = false;
243           if (openReview.isSelected()) {
244               openReviewSelected = true;
245           }
246           textPath.setEnabled(openReviewSelected);
247           buttonBrowse.setEnabled(openReviewSelected);
248           tableLastReviews.setEnabled(openReviewSelected);
249           labelSelectReview.setEnabled(openReviewSelected);
250           labelLastReviews.setEnabled(openReviewSelected);
251  
252           // container,layout, component,gx,gy,gwidth,gheight,weightx,weighty, t,
253           // l, b, r, a, i
254           GUITools.addComponent(cont, gbl, manageAspects, 0, 0, 1, 1, 0, 0, 0, 0,
255                   0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
256           GUITools.addComponent(cont, gbl, newReview, 0, 1, 1, 1, 0, 0, 10, 0, 0,
257                   0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
258           GUITools.addComponent(cont, gbl, openReview, 0, 2, 1, 1, 0, 0, 10, 0,
259                   0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
260           GUITools.addComponent(cont, gbl, labelSelectReview, 0, 3, 1, 1, 0, 0,
261                   0, 20, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
262           GUITools.addComponent(cont, gbl, textPath, 1, 3, 2, 1, 1.0, 1.0, 0, 0,
263                   0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
264           GUITools.addComponent(cont, gbl, buttonBrowse, 3, 3, 1, 1, 0, 0, 0, 0,
265                   0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
266           GUITools.addComponent(cont, gbl, labelLastReviews, 0, 4, 1, 1, 0, 0, 0,
267                   20, 0, 0, GridBagConstraints.NONE, GridBagConstraints.WEST);
268           GUITools.addComponent(cont, gbl, tableLastReviews, 2, 4, 2, 2, 1.0,
269                   1.0, 0, 0, 0, 0, GridBagConstraints.BOTH,
270                   GridBagConstraints.NORTHWEST);
271  
272           buttonConfirm.requestFocusInWindow();
273  
274           pack();
275       }
276  
277       public AssistantDialog(Frame parent) {
278           super(parent);
279  
280           setTitle(Data.getInstance().getLocaleStr("assistantDialog.title"));
281           setIcon(Data.getInstance().getIcon("assistantDialog_64x64.png"));
282  
283           addButton(buttonExit);
284           addButton(buttonBack);
285           addButton(buttonConfirm);
286  
287           textPath.setColumns(13);
288           textPath.setText("");
289  
290           MatteBorder padding = new MatteBorder(0, 10, 0, 0, getContentPane()
291                   .getBackground());
292           buttonBrowse.setBorder(padding);
293  
294           buttonExit.setIcon(Data.getInstance().getIcon("buttonExit_16x16.png"));
295           buttonBack.setIcon(Data.getInstance().getIcon("buttonBack_16x16.png"));
296           buttonConfirm.setIcon(Data.getInstance().getIcon("buttonOk_16x16.png"));
297  
298           buttonBrowse.addActionListener(new ActionListener() {
299  
300               @Override
301               public void actionPerformed(ActionEvent e) {
302                   FileChooser fileChooser = UI.getInstance().getFileChooser();
303  
304                   if (fileChooser.showDialog(UI.getInstance().getMainFrame(),
305                           FileChooser.MODE_OPEN_FILE, ResiFileFilter.TYPE_REVIEW) == FileChooser.SELECTED_APPROVE) {
306                       String reviewPath = fileChooser.getFile().getAbsolutePath();
307  
308                       UI.getInstance().getAssistantDialog().setPath(reviewPath);
309                   }
310               }
311           });
312  
313           buttonBack.addActionListener(new ActionListener() {
314  
315               @Override
316               public void actionPerformed(ActionEvent arg0) {
317                   UI.getInstance().getAssistantDialog().setSelectMode();
318               }
319  
320           });
321  
322           setLocationToCenter();
323  
324           setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
325  
326           setSelectMode();
327  
328           pack();
329  
330           addWindowListener(new WindowAdapter() {
331               @Override
332               public void windowClosing(WindowEvent e) {
333                   UI.getInstance().getAssistantDialog().setVisible(false);
334               }
335           });
336       }
337  
338   }
AspectsManagerFrame.java
59   @SuppressWarnings("serial")
60   public class AspectsManagerFrame extends AbstractFrame{
61       
62       private GridBagLayout gbl = new GridBagLayout();
63       private JPanel splitPanel = new JPanel(gbl);
64       private CheckNode root=new CheckNode( Data.getInstance().getLocaleStr("aspectsManager.allCatalogs"));
65       private DefaultTreeModel dtm=new DefaultTreeModel(root);
66       private JTextField directiveTxtFld;
67       private JTextArea descriptionTxtArea;
68       private JComboBox categoryBx;
69       private JTree tree;
70       private ApplicationData appData = Data.getInstance().getAppData();
71       private AttendeeManagement attMgmt=Application.getInstance().getAttendeeMgmt();
72       private List<Attendee> selectedReviewers = new ArrayList<Attendee>();
73       private List<ReviewerTableModel> allRevTblMdlList= new ArrayList<ReviewerTableModel>();
74       //private AspectTableModel atm = new AspectTableModel();
75      
76       public List<ReviewerTableModel> getAllRevTblMdlList() {
77           return allRevTblMdlList;
78       }
79  
80  
81       private JPanel leftPanel;
82       private JPanel rightPanel;
83       private JPanel rightTopPanel;
84       private JPanel rightBottomPanel;
85       private JPanel rightBottomPanelREV;
86       private JPanel rightBottomPanelASP;
87       private JPanel allReviewersPnl;
88       
89       private JButton accept;
90       private JButton pushTop;
91       private JButton pushUp;
92       private JButton pushDown;
93       private JButton pushBottom;
94       private JButton newAttendee;
95       private JButton remove;
96       
97       private JLabel directive;
98       private JLabel description;
99       private JLabel category;
100       
101       private JRadioButton attendeeViewRB;
102       private JRadioButton aspectViewRB;
103       
104       private JScrollPane reviewerScrllPn=new JScrollPane(allReviewersPnl);
105       
106       public JButton getRemoveBttn() {
107           return remove;
108       }
109  
110       public List<Attendee> getSelectedReviewers() {
111           return selectedReviewers;
112       }
113       
114       public JButton getPushBottomBttn() {
115           return pushBottom;
116       }
117  
118  
119       public JButton getPushDownBttn() {
120           return pushDown;
121       }
122  
123  
124       public JButton getPushUpBttn() {
125           return pushUp;
126       }
127  
128  
129       public JButton getPushTopBttn() {
130           return pushTop;
131       }
132  
133  
134       public void setRootSelected(boolean selected) {
135           root.setSelected(selected);
136       }
137  
138  
139       public JButton getAcceptBttn() {
140           return accept;
141       }
142       
143       public void setAcceptBttn(JButton bttn) {
144           accept=bttn;
145       }
146  
147       public JTree getTree() {
148           return tree;
149       }
150  
151       public void setTree(JTree tree) {
152           this.tree = tree;
153       }
154  
155       
156       public JTextArea getDescriptionTxtArea() {
157           return descriptionTxtArea;
158       }
159  
160       public void setDescriptionTxtArea(JTextArea descriptionTxtArea) {
161           this.descriptionTxtArea = descriptionTxtArea;
162       }
163  
164       public JTextField getDirectiveTxtFld() {
165           return directiveTxtFld;
166       }
167  
168       public void setDirectiveTxtFld(JTextField directiveTxtFld) {
169           this.directiveTxtFld = directiveTxtFld;
170       }
171  
172       public JComboBox getCategoryBx() {
173           return categoryBx;
174       }
175  
176       public void setCategoryBx(JComboBox categoryBx) {
177           this.categoryBx = categoryBx;
178       }
179  
180  
181       private JPanel leftSubBottomPnl;
182       
183       public JPanel getLeftBottomPnl() {
184           return leftSubBottomPnl;
185       }
186  
187       public void setLeftBottomPnl(JPanel leftBottomPnl) {
188           this.leftSubBottomPnl = leftBottomPnl;
189       }
190  
191       public String getCategory(){
192           return categoryBx.getSelectedItem().toString();
193       }
194       
195       public void setCategoryBx(String cat){
196           categoryBx.setSelectedItem(cat);
197       }
198       public String getDescription(){
199           return descriptionTxtArea.getText();
200       }
201       
202       public void setDescription(String desc){
203           descriptionTxtArea.setText(desc);
204       }
205       
206       public String getDirective() {
207           return directiveTxtFld.getText();
208       }
209  
210       public void setDirective(String directive) {
211           directiveTxtFld.setText(directive);
212       }
213  
214       public void clearFrame(){
215           splitPanel.removeAll();
216           splitPanel.validate();
217           createLeftPanel();
218           createRightPanel();
219           splitPanel.validate();
220           splitPanel.repaint();
221       }
222  
223       private void createToolBar(){
224           /*
225            * creating the JToolBar within its components
226            */
227           JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT));
228           panel.setBackground(Color.WHITE);
229           /*
230           JButton addCatalog = GUITools.newImageButton();
231           addCatalog.setIcon(Data.getInstance().getIcon("addCatalog_50x50_0.png"));
232           addCatalog.setRolloverIcon(Data.getInstance().getIcon("addCatalog_50x50.png"));
233           addCatalog.setToolTipText(Data.getInstance().getLocaleStr("menu.addCatalog"));
234           //addCatalog.addActionListener(ActionRegistry.getInstance().get(addCatalogAction.class.getName()));
235           
236           panel.add(addCatalog);
237           
238           JButton addCategory = GUITools.newImageButton();
239           addCategory.setIcon(Data.getInstance().getIcon("addCategory_50x50_0.png"));
240           addCategory.setRolloverIcon(Data.getInstance().getIcon("addCategory_50x50.png"));
241           addCategory.setToolTipText(Data.getInstance().getLocaleStr("menu.addCategory"));
242           //    addCategory.addActionListener(ActionRegistry.getInstance().get(AddCategoryAction.class.getName()));
243           panel.add(addCategory);
244           */
245           JButton addAspect = GUITools.newImageButton();
246           addAspect.setIcon(Data.getInstance().getIcon("addAspect_50x50_0.png"));
247           addAspect.setRolloverIcon(Data.getInstance().getIcon("addAspect_50x50.png"));
248           addAspect.setToolTipText(Data.getInstance().getLocaleStr("menu.addAspect"));
249           addAspect.addActionListener(ActionRegistry.getInstance().get(AddAspectAction.class.getName()));
250           panel.add(addAspect);
251           
252           newAttendee = GUITools.newImageButton(Data.getInstance().getIcon(
253           "addAttendee_50x50_0.png"), Data.getInstance().getIcon(
254           "addAttendee_50x50.png"));
255           newAttendee.setToolTipText(Data.getInstance().getLocaleStr(
256           "menu.newAttendee"));
257           newAttendee.addActionListener(ActionRegistry.getInstance().get(
258           AddAttendeeAction.class.getName()));
259  
260           panel.add(newAttendee);
261  
262           remove = GUITools.newImageButton();
263           remove.setIcon(Data.getInstance().getIcon("remove_50x50_0.png"));
264           remove.setRolloverIcon(Data.getInstance().getIcon("remove_50x50.png"));
265           remove.setToolTipText(Data.getInstance().getLocaleStr("menu.removeTreeElement"));
266           panel.add(remove);
267  
268           
269           JButton autoAllocation = GUITools.newImageButton();
270           autoAllocation.setIcon(Data.getInstance().getIcon("autoAllocation_50x50_0.png"));
271           autoAllocation.setRolloverIcon(Data.getInstance().getIcon("autoAllocation_50x50.png"));
272           autoAllocation.setToolTipText(Data.getInstance().getLocaleStr("menu.autoAllocation"));
273           //autoAllocation.addActionListener(ActionRegistry.getInstance().get(AutoAllocationAction.class.getName()));
274           
275           panel.add(autoAllocation);
276       
277           addTopComponent(panel);
278       }
279  
280       private void createLeftPanel(){
281           leftPanel = new JPanel(new GridLayout(2,1));
282           
283           GUITools.addComponent(splitPanel, gbl, leftPanel, 0, 0, 1, 1,0.3,0.3, 0, 0, 0, 0, GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
284           root.removeAllChildren();
285           root.setSelected(false);
286           tree = new JTree( dtm );
287           /*
288            *
289            */
290           /*        try {
291               for(AppCatalog cata:Data.getInstance().getAppData().getCatalogs()){
292                   for(String cate:cata.getCategories()){
293                       for(AppAspect asp :cata.getAspects(cate)){
294                           cata.removeAspect(asp);
295                       }
296                   }
297                   Data.getInstance().getAppData().removeCatalog(cata);
298               }
299               
300               
301               appData.initialize();
302          
303                  
304               AppCatalog catalog = appData.newCatalog("Testkatalog 1");
305               
306               catalog.newAspect("Direktive", "Beschr-", "TestKategore");
307               catalog.newAspect("Direktive1", "Beschr-1", "TestKategore1");
308               catalog.newAspect("Direktive2", "Beschr-2", "TestKategore2");
309               catalog.newAspect("Direktive3", "Beschr-3", "TestKategore3");
310               
311               AppCatalog catalog1 = appData.newCatalog("Testkatalog 2");
312               
313               catalog1.newAspect("Direktive", "Beschr-", "TestKategorie");
314               catalog1.newAspect("Direktive1", "Beschr-1", "TestKategorie1");
315               catalog1.newAspect("Direktive2", "Beschr-2", "TestKategorie2");
316               catalog1.newAspect("Direktive3", "Beschr-3", "TestKategorie3");
317               
318               AppCatalog catalog2 = appData.newCatalog("Testkatalog 3");
319               
320               catalog2.newAspect("Dir", "Bes", "TestKat");
321               catalog2.newAspect("Dir1", "Bes1", "TestKat");
322               catalog2.newAspect("Dir2", "Bes2", "TestKat");
323               catalog2.newAspect("Dir3", "Bes3", "TestKat");
324               
325               
326           } catch (Exception e) {
327               e.printStackTrace();
328           }*/
329           try{
330               for (AppCatalog ac : appData.getCatalogs()) {
331                   CheckNode catalog = new CheckNode(ac);
332                   
333                   root.add(catalog);
334                   
335                   for (String cat : ac.getCategories()) {
336                       CheckNode category = new CheckNode(cat);
337                       
338                       catalog.add(category);
339                       
340                       for (AppAspect asp : ac.getAspects(cat)) {
341                           CheckNode aspect = new CheckNode(asp);
342                           
343                           category.add(aspect);
344                       }
345                   }
346               }}catch(Exception e){}
347  
348  
349          
350           /*
351            *
352            */
353           tree.setCellRenderer(new CheckRenderer());
354           tree.getSelectionModel().setSelectionMode(
355             TreeSelectionModel.SINGLE_TREE_SELECTION
356           );
357           tree.addMouseListener(new NodeSelectionListener(tree));
358           tree.expandRow(0);
359           JScrollPane sp = new JScrollPane(tree);
360            
361           leftPanel.add(sp);
362           JPanel leftBottomPanel = new JPanel(new BorderLayout());
363          
364           leftSubBottomPnl = new JPanel(gbl);
365           
366           JPanel buttonPanel = new JPanel(new GridLayout(1,4));
367           
368           pushTop = GUITools.newImageButton(Data.getInstance().getIcon("pushTop_25x25_0.png"),
369                   Data.getInstance().getIcon("pushTop_25x25.png"));
370           pushTop.setToolTipText(Data.getInstance().getLocaleStr("aspectsManager.pushTop"));
371           buttonPanel.add(pushTop);
372           
373           pushUp = GUITools.newImageButton(Data.getInstance().getIcon("upArrow_25x25_0.png")
374                   ,Data.getInstance().getIcon("upArrow_25x25.png"));
375           pushUp.setToolTipText(Data.getInstance().getLocaleStr("aspectsManager.pushUp"));
376           buttonPanel.add(pushUp);
377           
378           pushDown = GUITools.newImageButton(Data.getInstance().getIcon("downArrow_25x25_0.png")
379                   ,Data.getInstance().getIcon("downArrow_25x25.png"));
380           pushDown.setToolTipText(Data.getInstance().getLocaleStr("aspectsManager.pushDown"));
381           buttonPanel.add(pushDown);
382           
383           pushBottom = GUITools.newImageButton(Data.getInstance().getIcon("pushBottom_25x25_0.png")
384                   ,Data.getInstance().getIcon("pushBottom_25x25.png"));
385           pushBottom.setToolTipText(Data.getInstance().getLocaleStr("aspectsManager.pushBottom"));
386           buttonPanel.add(pushBottom);
387           
388           leftBottomPanel.add(buttonPanel,BorderLayout.NORTH);
389           
390           directive = new JLabel(Data.getInstance().getLocaleStr("aspectsManager.directive"));
391           description = new JLabel(Data.getInstance().getLocaleStr("aspectsManager.description"));
392           category= new JLabel(Data.getInstance().getLocaleStr("aspectsManager.category"));
393           
394           directiveTxtFld = new JTextField();
395           descriptionTxtArea = new JTextArea();
396           categoryBx = new JComboBox();
397           accept = new JButton("Accept");
398           setSubPanelEnabled(false);
399           
400           //GUITools.addComponent(leftSubBottomPnl, gbl,                                buttonPanel, 0, 0, 1, 1, 1.0, 0,10,20,0,20,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
401           GUITools.addComponent(leftSubBottomPnl, gbl,                                  directive, 0, 1, 1, 1,   0, 0,10,20,0,20,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
402           GUITools.addComponent(leftSubBottomPnl, gbl,                            directiveTxtFld, 0, 2, 1, 1, 1.0, 0,10,20,0,20,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
403           GUITools.addComponent(leftSubBottomPnl, gbl,                                description, 0, 3, 1, 1,   0, 0,10,20,0,20,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
404           GUITools.addComponent(leftSubBottomPnl, gbl,GUITools.setIntoScrllPn(descriptionTxtArea), 0, 4, 1, 2, 1.0, 0,10,20,0,20,GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
405           GUITools.addComponent(leftSubBottomPnl, gbl,                                   category, 0, 6, 1, 1,   0, 0,10,20,0,20,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST);
406           GUITools.addComponent(leftSubBottomPnl, gbl,                                 categoryBx, 0, 7, 1, 1, 1.0, 0,10,20,0,20,GridBagConstraints.HORIZONTAL,GridBagConstraints.NORTHWEST);
407           GUITools.addComponent(leftSubBottomPnl, gbl,                                     accept, 0, 8, 1, 1,   0, 0,10,20,0,20,GridBagConstraints.NONE,GridBagConstraints.NORTHEAST);
408           
409           leftBottomPanel.add(leftSubBottomPnl,BorderLayout.CENTER);
410           leftPanel.add(leftBottomPanel);
411       }
412       
413       private void createRightPanel(){
414           selectedReviewers.clear();
415           allReviewersPnl=new JPanel(new GridLayout(selectedReviewers.size(),1));
416           reviewerScrllPn=new JScrollPane(allReviewersPnl);
417           reviewerScrllPn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
418           reviewerScrllPn.setBorder(null);
419          
420           rightPanel = new JPanel(new BorderLayout());
421           GUITools.addComponent(splitPanel, gbl, rightPanel, 1, 0, 1, 1, 0.7, 0.7, 0, 0, 0, 0, GridBagConstraints.BOTH,GridBagConstraints.NORTHWEST);
422           
423           /*
424            * creating the right top sub panel for changing the view
425            */
426           rightTopPanel = new JPanel(gbl);
427           ButtonGroup bttnGrp= new ButtonGroup();
428           attendeeViewRB = new JRadioButton(Data.getInstance().getLocaleStr("aspectsManager.attendeeView"),true);
429           bttnGrp.add(attendeeViewRB);
430           
431           aspectViewRB = new JRadioButton(Data.getInstance().getLocaleStr("aspectsManager.aspectView"));
432           bttnGrp.add(aspectViewRB);
433           
434           
435           GUITools.addComponent(rightTopPanel, gbl,  attendeeViewRB, 0, 0, 1, 1, 1.0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHEAST);
436           GUITools.addComponent(rightTopPanel, gbl,    aspectViewRB, 1, 0, 1, 1, 1.0, 0, 0, 0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
437           GUITools.addComponent(rightTopPanel, gbl,new JSeparator(), 0, 1, 2, 1, 1.0, 0, 0,15, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
438           
439           rightPanel.add(rightTopPanel,BorderLayout.NORTH);
440           
441           
442           /*
443            * creating the right bottom panel for reviewers view
444            */
445           rightBottomPanelREV=new JPanel(gbl);
446           JPanel attPanel = new JPanel();
447          
448           attPanel.setLayout(new GridLayout(attMgmt.getNumberOfAttendees(),1));
449           
450           for(int index=0;index<attMgmt.getNumberOfAttendees();index++){
451               if(attMgmt.getAttendees().get(index).getRole()==Role.REVIEWER){
452                   final int indexL=index;
453                   JCheckBox attendee=new JCheckBox();
454                   String roleString="role.".concat(attMgmt.getAttendees().get(index).getRole().value());
455                 
456              
457                   attendee.setText(attMgmt.getAttendees().get(index).getName()+", "+
458                           Data.getInstance().getLocaleStr(roleString));
459                   attendee.addItemListener(new ItemListener(){
460                       @Override
461                       public void itemStateChanged(ItemEvent e) {
462                           if (e.getStateChange() == ItemEvent.SELECTED&&!selectedReviewers.contains(attMgmt.getAttendees().get(indexL))) {
463                           
464                               selectedReviewers.add(attMgmt.getAttendees().get(indexL));
465                               
466                           } else {
467                           
468                               selectedReviewers.remove(attMgmt.getAttendees().get(indexL));
469                               
470                           }
471                           createReviewerPanel();
472                           allReviewersPnl.repaint();
473                       }});
474  
475                   attPanel.add(attendee);
476               }
477           }
478           JScrollPane scrllPn = new JScrollPane(attPanel);
479           scrllPn.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
480           JPanel gridBagAttendeePanel = new JPanel(gbl);
481          
482  
483           JPanel buttonPanel=new JPanel(new GridLayout(4,1));
484           JButton aspToAllBttn = GUITools.newImageButton(Data.getInstance().getIcon("pushRight_25x25_0.png"),
485                   Data.getInstance().getIcon("pushRight_25x25.png"));
486           aspToAllBttn.addActionListener(ActionRegistry.getInstance().get(AddAspToAllRevsAction.class.getName()));
487          aspToAllBttn.setToolTipText(Data.getInstance().getLocaleStr("aspectsManager.addAspToAllRev"));
488           buttonPanel.add(aspToAllBttn);
489          
490           JButton aspToSelectedBttn = GUITools.newImageButton(Data.getInstance().getIcon("rightArrow_25x25_0.png"),
491                   Data.getInstance().getIcon("rightArrow_25x25.png"));
492           aspToSelectedBttn.setToolTipText(Data.getInstance().getLocaleStr("aspectsManager.addAspToSelRev"));
493          
494           aspToSelectedBttn.addActionListener(ActionRegistry.getInstance().get(AddAspToSelectedRevsAction.class.getName()));
495           buttonPanel.add(aspToSelectedBttn);
496          
497           GUITools.addComponent(gridBagAttendeePanel, gbl, buttonPanel, 0, 0, 1, 1,   0, 0, 10, 15, 0, 0, GridBagConstraints.NONE, GridBagConstraints.CENTER);
498           GUITools.addComponent(gridBagAttendeePanel, gbl,     scrllPn, 1, 0, 1, 1, 1.0, 0, 10, 15, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.CENTER);
499          
500           GUITools.addComponent(rightBottomPanelREV, gbl,gridBagAttendeePanel, 0, 0, 1, 1, 1.0,   0,  0,  0, 0, 0, GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTHWEST);
501           GUITools.addComponent(rightBottomPanelREV, gbl,     reviewerScrllPn, 0, 1, 1, 1, 1.0, 1.0, 10, 15, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
502           
503          
504          
505          
506           attendeeViewRB.addItemListener(new ItemListener(){
507  
508               @Override
509               public void itemStateChanged(ItemEvent e) {
510                   rightPanel.removeAll();
511                   rightPanel.validate();
512                   rightPanel.add(rightTopPanel,BorderLayout.NORTH);
513                   if(attendeeViewRB.isSelected()){
514                       rightPanel.add(rightBottomPanelREV,BorderLayout.CENTER);
515                       }
516                   else {
517                       /*
518                        * creating right panel for aspect view
519                        */
520                       rightBottomPanelASP=new JPanel(gbl);
521                       AspectTableModel atm = new AspectTableModel();
522                       JTable allAspTable = new JTable(atm);
523                       GUITools.addComponent(rightBottomPanelASP, gbl, allAspTable, 0, 0, 1, 1, 1.0, 1.0, 20, 15, 20, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
524                       rightPanel.add(rightBottomPanelASP,BorderLayout.CENTER);
525                   }
526                   rightPanel.validate();
527                   rightPanel.repaint();
528                   
529               }});
530           rightBottomPanel=rightBottomPanelREV;
531           rightPanel.add(rightBottomPanel,BorderLayout.CENTER);
532          
533           
534       }
535       
536       private void createReviewerPanel(){
537           
538           /*
539            * creating dynamically the reviewer panels
540            */
541           allReviewersPnl.removeAll();
542           allReviewersPnl.validate();
543           
544           for(Attendee att:selectedReviewers){
545  
546               ReviewerTableModel rtm=new ReviewerTableModel(att);
547               allRevTblMdlList.add(rtm);
548               JTable aspectTbl = new JTable(rtm);
549               JPanel reviewerPnl = new JPanel(gbl);
550               JLabel reviewerNameLbl= new JLabel(att.getName());
551  
552               JButton addAspectBttn = GUITools.newImageButton(Data.getInstance().getIcon("rightArrow_25x25_0.png"),
553                       Data.getInstance().getIcon("rightArrow_25x25.png"));
554               
555               addAspectBttn.addActionListener(new AddAspectToReviewerAction(att,rtm));
556               
557               JPanel buttonPnl2=new JPanel(new GridLayout(3,1));
558               
559               JButton pushUpBttn= GUITools.newImageButton(Data.getInstance().getIcon("upArrow_25x25_0.png"),
560                       Data.getInstance().getIcon("upArrow_25x25.png"));
561               pushUpBttn.addActionListener(new PushUpAspectAction(att,rtm,aspectTbl));
562               pushUpBttn.setToolTipText(Data.getInstance().getLocaleStr("aspectsManager.pushUp"));
563               buttonPnl2.add(pushUpBttn);
564               
565               JButton pushDownBttn= GUITools.newImageButton(Data.getInstance().getIcon("downArrow_25x25_0.png"),
566                       Data.getInstance().getIcon("downArrow_25x25.png"));
567               pushDownBttn.addActionListener(new PushDownAspectAction(att,rtm,aspectTbl));
568               pushDownBttn.setToolTipText(Data.getInstance().getLocaleStr("aspectsManager.pushDown"));
569               buttonPnl2.add(pushDownBttn);
570               
571               JButton removeBttn= GUITools.newImageButton(Data.getInstance().getIcon("remove_25x25_0.png"),
572                       Data.getInstance().getIcon("remove_25x25.png"));
573               removeBttn.addActionListener(new RemoveAspFromRevAction(aspectTbl,att,rtm));
574               removeBttn.setToolTipText(Data.getInstance().getLocaleStr("menu.remove"));
575               buttonPnl2.add(removeBttn);
576               
577               
578               GUITools.addComponent(reviewerPnl, gbl,    addAspectBttn, 0, 0, 1, 1,   0,   0,10,  0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
579               GUITools.addComponent(reviewerPnl, gbl,  reviewerNameLbl, 1, 0, 1, 1,   0,   0,10, 15, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
580               GUITools.addComponent(reviewerPnl, gbl,        aspectTbl, 1, 1, 2, 2, 1.0, 1.0, 0, 15, 0, 0, GridBagConstraints.BOTH, GridBagConstraints.NORTHWEST);
581               GUITools.addComponent(reviewerPnl, gbl,       buttonPnl2, 3, 1, 1, 2,   0,   0, 0,  0, 0, 0, GridBagConstraints.NONE, GridBagConstraints.NORTHWEST);
582               
583               allReviewersPnl.add(reviewerPnl);
584  
585           }
586           rightBottomPanelREV.validate();
587           rightBottomPanelREV.repaint();
588       }
589       
590       
591       public AspectsManagerFrame(Frame parent) {
592           
593           // saving screenSize
594           Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
595           setTitle(Data.getInstance().getLocaleStr("menu.aspectsManager"));
596           //setIcon(Data.getInstance().getIcon("aspectsManager_50x50.png"));
597           setIcon(Data.getInstance().getIcon("RevAger_300x50.png"));
598           getContentPane().setLayout(new BorderLayout());
599           
600           setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
601           
602           
603           createToolBar();
604           pack();
605           
606           /*
607            *
608            * TODO MUSS NOCH MODAL GESETZT WERDEN
609            *
610            */
611  
612           // calculating Position of HelpBrowserFrame
613           int top = ((screenSize.height - getHeight()) / 2);
614           int left = ((screenSize.width - getWidth()) / 2);
615           
616           
617           // setting Position of HelpBrowserFrame
618           setLocation(left, top);
619           
620           
621           //setVisible(true);
622  
623           setLayout(new BorderLayout());
624           
625  
626           add(splitPanel,BorderLayout.CENTER);
627       
628       }
629       
630       public void repaintTree(TreePath path){
631           //TreePath localPath =path;
632           try {
633               root.removeAllChildren();
634               for (AppCatalog ac : appData.getCatalogs()) {
635                   CheckNode catalog = new CheckNode(ac);
636                   
637                   root.add(catalog);
638                   
639                   for (String cat : ac.getCategories()) {
640                       CheckNode category = new CheckNode(cat);
641                       
642                       for (AppAspect asp : ac.getAspects(cat)) {
643                           CheckNode aspect = new CheckNode(asp);
644                           
645                           category.add(aspect);
646                       }
647                       if(!category.isLeaf())catalog.add(category);
648                       
649                   }
650               }
651               dtm.setRoot(root);
652               tree.setModel(dtm);
653               //System.out.println(path);
654               for(int i=0;i<tree.getRowCount();i++){
655                   String newPath=tree.getPathForRow(i).pathByAddingChild(path.getPathComponent(2)).pathByAddingChild(path.getLastPathComponent()).toString();
656                   String oldPath=path.toString();
657                   if(newPath.equals(oldPath)){
658                       tree.addSelectionPath(tree.getPathForRow(i).pathByAddingChild(path.getPathComponent(2)).pathByAddingChild(path.getLastPathComponent()));
659                       tree.setExpandsSelectedPaths(true);
660                       }}
661               //tree.setSelectionRow(tree.getRowForPath(path));
662               //tree.setExpandsSelectedPaths(true);
663              
664           } catch (Exception e) {
665               // TODO JoptionPane Fehlermeldung    
666           }
667  
668       }
669       
670       public void setSubPanelEnabled(boolean enabled){
671           directive.setEnabled(enabled);
672           description.setEnabled(enabled);
673           category.setEnabled(enabled);
674           directiveTxtFld.setEnabled(enabled);
675           directiveTxtFld.setText(null);
676           descriptionTxtArea.setEnabled(enabled);
677           descriptionTxtArea.setText(null);
678           categoryBx.setEnabled(enabled);
679           categoryBx.setSelectedItem(null);
680           accept.setEnabled(enabled);
681       }
682       
683  
684  
685   }
AbstractFrame.java
41   @SuppressWarnings("serial")
42   public class AbstractFrame extends JFrame {
43  
44       private final Image ICON_FRAME = Data.getInstance().getIcon(
45               "frameIcon_128x128.png").getImage();
46  
47       private final int NUMBER_OF_HINTS = 3;
48       private final Color HINTS_BACKGROUND = new Color(220, 231, 255);
49  
50       public final Font FONT_TEXT = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
51  
52       private final ImageIcon ICON_HELP = Data.getInstance().getIcon(
53               "hintHelp_22x22_0.png");
54       private final ImageIcon ICON_HELP_ROLLOVER = Data.getInstance().getIcon(
55               "hintHelp_22x22.png");
56       private final ImageIcon ICON_OPEN_HINTS = Data.getInstance().getIcon(
57               "openHints_16x16_0.png");
58       private final ImageIcon ICON_CLOSE_HINTS = Data.getInstance().getIcon(
59               "closeHints_16x16_0.png");
60       private final ImageIcon ICON_OPEN_HINTS_ROLLOVER = Data.getInstance()
61               .getIcon("openHints_16x16.png");
62       private final ImageIcon ICON_CLOSE_HINTS_ROLLOVER = Data.getInstance()
63               .getIcon("closeHints_16x16.png");
64       private final ImageIcon ICON_WAIT = Data.getInstance().getIcon(
65               "wait_32x32.gif");
66       private final ImageIcon ICON_WAIT_SMALL = Data.getInstance().getIcon(
67               "wait_16x16.gif");
68       private final ImageIcon ICON_BLANK = Data.getInstance().getIcon(
69               "blank_16x16.png");
70  
71       private JPanel panelBase = new JPanel();
72  
73       private JPanel panelTop = new JPanel();
74       private JPanel panelContent = new JPanel();
75       private JPanel panelBottom = new JPanel();
76  
77       private JPanel panelToolBar = new JPanel();
78       private JPanel panelGridContent = new JPanel();
79       private JPanel panelProgress = new JPanel();
80       private JPanel panelBorderHints = new JPanel();
81       private JPanel panelHints;
82       private JPanel panelBorderStrut = new JPanel();
83  
84       private JToggleButton buttonHints = new JToggleButton(ICON_CLOSE_HINTS);
85  
86       private JLabel labelIcon = new JLabel();
87       private JLabel statusMessage = new JLabel();
88       private JLabel statusInProgress = new JLabel(ICON_BLANK);
89       private DateFormat formatTime = new SimpleDateFormat(Data.getInstance()
90               .getLocaleStr("format.time"));
91  
92       private List<HintItem> currentHints = null;
93       private boolean hintsOpened = false;
94  
95       @Override
96       public Container getContentPane() {
97           return panelContent;
98       }
99  
100       public void setIcon(ImageIcon icon) {
101           this.labelIcon.setIcon(icon);
102       }
103  
104       @Override
105       public Component add(Component comp) {
106           return this.panelContent.add(comp);
107       }
108  
109       public void addTopComponent(JComponent component) {
110           this.panelToolBar.add(component);
111           this.panelToolBar.revalidate();
112       }
113  
114       public void clearTopComponents() {
115           this.panelToolBar.removeAll();
116           this.panelToolBar.revalidate();
117       }
118  
119       public void setTopComponentsVisible(boolean visible) {
120           this.panelToolBar.setVisible(visible);
121       }
122  
123       public void setHintsOpened(boolean hintsOpened) {
124           this.hintsOpened = hintsOpened;
125       }
126  
127       synchronized public void setStatusMessage(String message, boolean inProgress) {
128           this.statusMessage.setText(formatTime.format(new Date().getTime())
129                   + " | " + message);
130  
131           if (inProgress == true) {
132               this.statusInProgress.setIcon(ICON_WAIT_SMALL);
133           } else {
134               this.statusInProgress.setIcon(ICON_BLANK);
135           }
136       }
137  
138       public void setStatusBarVisible(boolean statusBar) {
139           this.panelBottom.setVisible(statusBar);
140       }
141  
142       public void setLocationToCenter() {
143           Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
144  
145           int posX = (int) ((int) (screenSize.getWidth() / 2) - (this.getSize()
146                   .getWidth() / 2));
147           int posY = (int) ((int) (screenSize.getHeight() / 2) - (this.getSize()
148                   .getHeight() / 2));
149  
150           setLocation(posX, posY);
151       }
152  
153       /**
154        * Helper method to add a component to a GridBagLayout
155        *
156        * @param gbl
157        *            the layout to add the component
158        * @param container
159        *            the container object in which the layout is
160        * @param component
161        *            the component to add
162        * @param posx
163        *            the vertical position
164        * @param posy
165        *            the horizontal position
166        * @param width
167        *            the width of the component
168        * @param height
169        *            the height of the component
170        * @param insets
171        *            the padding of the component
172        * @param weightx
173        *            the vertical weight
174        * @param weighty
175        *            the horizontal weight
176        */
177       protected void gblAdd(GridBagLayout gbl, Container container,
178               Component component, int posx, int posy, int width, int height,
179               Insets insets, int fill, int anchor, double weightx, double weighty) {
180           GridBagConstraints gbc = new GridBagConstraints();
181           gbc.gridx = posx;
182           gbc.gridy = posy;
183           gbc.gridwidth = width;
184           gbc.gridheight = height;
185           gbc.weightx = weightx;
186           gbc.weighty = weighty;
187           gbc.insets = insets;
188           gbc.fill = fill;
189           gbc.anchor = anchor;
190           gbl.setConstraints(component, gbc);
191           container.add(component);
192       }
193  
194       protected void gblAdd(GridBagLayout gbl, Container container,
195               Component component, int posx, int posy, int width, int height,
196               Insets insets, double weightx, double weighty) {
197           gblAdd(gbl, container, component, posx, posy, width, height, insets,
198                   GridBagConstraints.BOTH, GridBagConstraints.BASELINE, weightx,
199                   weighty);
200       }
201  
202       public AbstractFrame() {
203           super();
204  
205           setLayout(new BorderLayout());
206  
207           setIconImage(ICON_FRAME);
208  
209           panelBase.setLayout(new BorderLayout());
210           panelTop.setLayout(new BorderLayout());
211           
212           panelBorderHints.setLayout(new BorderLayout());
213           panelBorderStrut = new JPanel();
214           panelBorderStrut.setBackground(HINTS_BACKGROUND);
215           
216           /*
217            * Build the top panel
218            */
219           panelToolBar.setLayout(new FlowLayout());
220           panelToolBar.setBackground(Color.WHITE);
221  
222           JPanel panelBorderTop = new JPanel();
223           panelBorderTop.setLayout(new BorderLayout());
224           panelBorderTop.setBackground(Color.WHITE);
225  
226           panelBorderTop.add(panelToolBar, BorderLayout.WEST);
227           panelBorderTop.add(labelIcon, BorderLayout.EAST);
228  
229           labelIcon.setBorder(new MatteBorder(7, 7, 7, 7, Color.WHITE));
230  
231           GridBagLayout gblTop = new GridBagLayout();
232           JPanel panelGridTop = new JPanel();
233           panelGridTop.setLayout(gblTop);
234           panelGridTop.setBackground(Color.WHITE);
235           gblAdd(gblTop, panelGridTop, panelBorderTop, 0, 0, 1, 1, new Insets(0,
236                   0, 0, 10), 1.0, 1.0);
237  
238           panelTop.add(panelGridTop, BorderLayout.CENTER);
239           panelTop.setBorder(new MatteBorder(0, 0, 1, 0, UI.SEPARATOR_COLOR));
240  
241           /*
242            * Construct the button to toggle the hints
243            */
244           buttonHints
245                   .setToolTipText(Data.getInstance().getLocaleStr("showHints"));
246           buttonHints.setBorder(null);
247           buttonHints.setBorderPainted(false);
248           buttonHints.setOpaque(false);
249           buttonHints.setContentAreaFilled(false);
250           buttonHints.setRolloverIcon(ICON_CLOSE_HINTS_ROLLOVER);
251           buttonHints.setRolloverSelectedIcon(ICON_OPEN_HINTS_ROLLOVER);
252           buttonHints.setCursor(new Cursor(Cursor.HAND_CURSOR));
253           buttonHints
254                   .setToolTipText(Data.getInstance().getLocaleStr("showHints"));
255           buttonHints.setFocusable(false);
256  
257           buttonHints.addActionListener(new ActionListener() {
258               @Override
259               public void actionPerformed(ActionEvent e) {
260                   toggleHints();
261               }
262           });
263  
264           /*
265            * Build the bottom panel
266            */
267           statusMessage.setFont(FONT_TEXT);
268           statusMessage.setForeground(Color.DARK_GRAY);
269           setStatusMessage(Data.getInstance().getLocaleStr(
270                   "status.noReviewInProcess"), false);
271  
272           GridBagLayout gblBottom = new GridBagLayout();
273           panelBottom.setLayout(gblBottom);
274  
275           panelBottom.setBorder(new MatteBorder(1, 0, 0, 0, UI.SEPARATOR_COLOR));
276  
277           /*
278            * Minor margin for Mac
279            */
280           int ins = 6;
281           if (UI.getInstance().getPlatform() == UI.Platform.MAC) {
282               ins = 0;
283           }
284  
285           gblAdd(gblBottom, panelBottom, panelBorderHints, 0, 0, 3, 1,
286                   new Insets(0, 0, 0, 0), 1.0, 1.0);
287           gblAdd(gblBottom, panelBottom, statusMessage, 0, 1, 1, 1, new Insets(0,
288                   7, 0, 7), GridBagConstraints.WEST, GridBagConstraints.WEST,
289                   0.0, 1.0);
290           gblAdd(gblBottom, panelBottom, statusInProgress, 1, 1, 1, 1,
291                   new Insets(6, 6, 6, 6), GridBagConstraints.WEST,
292                   GridBagConstraints.WEST, 1.0, 1.0);
293           gblAdd(gblBottom, panelBottom, buttonHints, 2, 1, 1, 1, new Insets(ins,
294                   ins, ins, ins), GridBagConstraints.EAST,
295                   GridBagConstraints.EAST, 1.0, 1.0);
296  
297           /*
298            * Build content pane with padding
299            */
300           GridBagLayout gblContent = new GridBagLayout();
301  
302           panelGridContent.setLayout(gblContent);
303  
304           gblAdd(gblContent, panelGridContent, panelContent, 0, 0, 1, 1,
305                   new Insets(15, 15, 15, 15), 1.0, 1.0);
306  
307           panelContent.setLayout(null);
308  
309           /*
310            * Construct the progress panel
311            */
312           panelProgress.setLayout(new BorderLayout());
313  
314           JLabel wait = new JLabel(Data.getInstance().getLocaleStr(
315                   "message.inProgress"), ICON_WAIT, SwingConstants.CENTER);
316  
317           panelProgress.add(wait, BorderLayout.CENTER);
318  
319           /*
320            * Construct the dialog
321            */
322           panelBase.add(panelTop, BorderLayout.NORTH);
323           panelBase.add(panelGridContent, BorderLayout.CENTER);
324           panelBase.add(panelBottom, BorderLayout.SOUTH);
325  
326           /*
327            * General properties for the window
328            */
329           setContentPane(panelBase);
330  
331           setHints(null);
332  
333           pack();
334  
335           setMinimumSize(new Dimension(800, 650));
336  
337           /*
338            * Behaviour when closing this dialog.
339            */
340           setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
341           /*
342            * addWindowListener(new WindowAdapter() {
343            *
344            * @Override public void windowClosing(WindowEvent e) { // buttonClicked
345            * = ButtonClicked.CANCEL; setVisible(false); } });
346            */
347  
348       }
349  
350       public void setHints(List<HintItem> hints) {
351           if (hints != null) {
352               if (hints.isEmpty()) {
353                   hints = null;
354               }
355           }
356  
357           if (hints == null) {
358               buttonHints.setIcon(ICON_BLANK);
359               buttonHints.setSelectedIcon(ICON_BLANK);
360               buttonHints.setEnabled(false);
361  
362               if (hintsOpened == true) {
363                   toggleHints();
364               }
365           } else {
366               buttonHints.setIcon(ICON_CLOSE_HINTS);
367               buttonHints.setSelectedIcon(ICON_OPEN_HINTS);
368               buttonHints.setEnabled(true);
369  
370               GridBagLayout gblHints = new GridBagLayout();
371  
372               panelHints = new JPanel();
373               panelHints.setLayout(gblHints);
374               panelHints.setBackground(HINTS_BACKGROUND);
375  
376               /*
377                * Add vertical strut
378                */
379               gblAdd(gblHints, panelHints, new JLabel(), 0, 0, 1, 1, new Insets(
380                       10, 0, 0, 0), 0.0, 1.0);
381  
382               Iterator<HintItem> iter = hints.iterator();
383               int i = 1;
384  
385               while (iter.hasNext() && i <= NUMBER_OF_HINTS) {
386                   String icon;
387  
388                   final HintItem HINT = iter.next();
389  
390                   switch (HINT.getType()) {
391                   case HintItem.ERROR:
392                       icon = "hintError_22x22.png";
393                       break;
394  
395                   case HintItem.WARNING:
396                       icon = "hintWarning_22x22.png";
397                       break;
398  
399                   case HintItem.OK:
400                       icon = "hintOk_22x22.png";
401                       break;
402  
403                   case HintItem.INFO:
404                       icon = "hintInfo_22x22.png";
405                       break;
406  
407                   default:
408                       icon = "hintInfo_22x22.png";
409                       break;
410                   }
411  
412                   JLabel labelIcon = new JLabel(Data.getInstance().getIcon(icon));
413  
414                   JTextArea text = new JTextArea(HINT.getText());
415                   text.setFont(FONT_TEXT);
416                   text.setRows(2);
417                   text.setEditable(false);
418                   text.setLineWrap(true);
419                   text.setWrapStyleWord(true);
420                   text.setBackground(HINTS_BACKGROUND);
421                   text.setSelectionColor(HINTS_BACKGROUND);
422  
423                   gblAdd(gblHints, panelHints, labelIcon, 0, 2 * i, 1, 1,
424                           new Insets(0, 15, 5, 0), GridBagConstraints.WEST,
425                           GridBagConstraints.WEST, 0.0, 1.0);
426                   gblAdd(gblHints, panelHints, text, 1, 2 * i, 1, 1, new Insets(
427                           10, 15, 5, 15), GridBagConstraints.BOTH,
428                           GridBagConstraints.WEST, 1.0, 1.0);
429  
430                   if (HINT.getHelpChapter() != null) {
431                       JButton helpButton = GUITools.newImageButton();
432                       helpButton.setIcon(ICON_HELP);
433                       helpButton.setRolloverIcon(ICON_HELP_ROLLOVER);
434                       helpButton.setBackground(Color.WHITE);
435                       helpButton.setFocusable(false);
436  
437                       helpButton.addActionListener(new ActionListener() {
438  
439                           @Override
440                           public void actionPerformed(ActionEvent e) {
441                               new LoadHelpWorker(HINT.getHelpChapter(), HINT
442                                       .getHelpChapterAnchor()).execute();
443                           }
444  
445                       });
446  
447                       try {
448                           helpButton
449                                   .setToolTipText(Data.getInstance()
450                                           .getLocaleStr("showHelpChapter")
451                                           + " "
452                                           + Data.getInstance().getHelpData()
453                                                   .getChapterTitle(
454                                                           HINT.getHelpChapter()));
455                       } catch (DataException e) {
456                           helpButton.setVisible(false);
457                       }
458  
459                       /*
460                        * Minor margin for Mac
461                        */
462                       int ins = 15;
463                       if (UI.getInstance().getPlatform() == UI.Platform.MAC) {
464                           ins = 5;
465                       }
466  
467                       gblAdd(gblHints, panelHints, helpButton, 2, 2 * i, 1, 1,
468                               new Insets(ins / 2, 0, ins, 8),
469                               GridBagConstraints.EAST, GridBagConstraints.EAST,
470                               0.0, 1.0);
471                   }
472  
473                   i++;
474               }
475  
476               /*
477                * Show hints
478                */
479               if (!hintsOpened && currentHints == null) {
480                   toggleHints();
481               }
482  
483               /*
484                * Refresh hints view
485                */
486               if (hintsOpened) {
487                   panelBorderHints.removeAll();
488                   panelBorderHints.add(panelHints, BorderLayout.CENTER);
489                   panelBorderHints.add(panelBorderStrut, BorderLayout.SOUTH);
490                   panelBorderHints.revalidate();
491               }
492           }
493  
494           /*
495            * Save the new hints as current hints
496            */
497           currentHints = hints;
498       }
499  
500       public void switchToEditMode() {
501           panelBase.remove(panelProgress);
502           panelBase.add(panelGridContent, BorderLayout.CENTER);
503  
504           panelBase.revalidate();
505           panelBase.repaint();
506       }
507  
508       public void switchToProgressMode() {
509           panelBase.remove(panelGridContent);
510           panelBase.add(panelProgress, BorderLayout.CENTER);
511  
512           panelBase.revalidate();
513           panelBase.repaint();
514       }
515  
516       public void switchToClearMode() {
517           panelBase.remove(panelGridContent);
518           panelBase.remove(panelProgress);
519  
520           panelBase.revalidate();
521           panelBase.repaint();
522       }
523  
524       public void toggleHints() {
525           if (panelHints != null) {
526               if (buttonHints.isSelected()) {
527                   buttonHints.setPressedIcon(ICON_OPEN_HINTS);
528                   buttonHints.setSelected(true);
529               } else {
530                   buttonHints.setPressedIcon(ICON_CLOSE_HINTS);
531                   buttonHints.setSelected(false);
532               }
533  
534               if (hintsOpened == false) {
535                   hintsOpened = true;
536  
537                   panelBorderHints.setBorder(new MatteBorder(0, 0, 1, 0,
538                           UI.SEPARATOR_COLOR));
539                   panelBorderHints.add(panelHints, BorderLayout.CENTER);
540                   panelBorderHints.add(panelBorderStrut, BorderLayout.SOUTH);
541                   panelBorderHints.revalidate();
542               } else {
543                   hintsOpened = false;
544  
545                   panelBorderHints.setBorder(null);
546                   panelBorderHints.removeAll();
547                   panelBorderHints.revalidate();
548               }
549           }
550       }
551   }
AbstractDialog.java
43   @SuppressWarnings("serial")
44   public abstract class AbstractDialog extends JDialog {
45       
46       private final ImageIcon ICON_OPEN_HELP = Data.getInstance().getIcon(
47               "help_26x26.png");
48       private final ImageIcon ICON_CLOSE_HELP = Data.getInstance().getIcon(
49               "closeHelp_26x26.png");
50       private final ImageIcon ICON_OPEN_HELP_ROLLOVER = Data.getInstance()
51               .getIcon("helpRollover_26x26.png");
52       private final ImageIcon ICON_CLOSE_HELP_ROLLOVER = Data.getInstance()
53               .getIcon("closeHelpRollover_26x26.png");
54       private final ImageIcon ICON_WAIT = Data.getInstance().getIcon(
55               "wait_32x32.gif");
56  
57       private Frame parent;
58  
59       private JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
60  
61       private JPanel panelBase = new JPanel();
62  
63       private JPanel panelTop = new JPanel();
64       private JPanel panelContent = new JPanel();
65       private JPanel panelBottom = new JPanel();
66  
67       private JPanel panelGridContent = new JPanel();
68       private JPanel panelProgress = new JPanel();
69  
70       private JPanel panelButtons = new JPanel();
71       private JPanel panelHelpButton = new JPanel();
72       private JPanel panelHelp = new JPanel();
73       
74       private JPanel panelToolBar = new JPanel();
75       private JPanel panelDescTB = new JPanel(new BorderLayout());
76  
77       private JLabel labelTitle = new JLabel();
78       private JLabel labelIcon = new JLabel();
79  
80       private JTextArea textDescription = new JTextArea();
81  
82       private String description = null;
83  
84       private String helpChapter = null;
85       private String helpChapterAnchor = null;
86  
87       private boolean helpOpened = false;
88  
89       private int originalWidth;
90       
91       @Override
92       public Container getContentPane() {
93           return panelContent;
94       }
95  
96       @Override
97       public void setTitle(String title) {
98           super.setTitle(title);
99  
100           this.labelTitle.setText(title);
101       }
102  
103       public void setDescription(String description) {
104           this.description = description;
105  
106           this.textDescription.setForeground(Color.BLACK);
107           this.textDescription.setText(description);
108           
109           panelDescTB.add(textDescription);
110       }
111       
112       public void addTopComponent(JComponent component) {
113           this.panelToolBar.add(component);
114           this.panelToolBar.revalidate();
115           
116           panelDescTB.add(panelToolBar);
117       }
118  
119       public void clearTopComponents() {
120           this.panelGridContent.removeAll();
121           this.panelGridContent.revalidate();
122       }
123       
124       public void setHint(String hint) {
125           if (hint == null) {
126               setDescription(this.description);
127           } else {
128               this.textDescription.setForeground(Color.RED);
129               this.textDescription.setText(hint);
130           }
131       }
132  
133       public void setMessage(String message) {
134           if (message == null) {
135               setDescription(this.description);
136           } else {
137               this.textDescription.setForeground(new Color(0, 125, 15));
138               this.textDescription.setText(message);
139           }
140       }
141  
142       public void setIcon(ImageIcon icon) {
143           this.labelIcon.setIcon(icon);
144       }
145  
146       @Override
147       public void setMinimumSize(Dimension minimumSize) {
148           super.setMinimumSize(minimumSize);
149  
150           panelBase.setMinimumSize(new Dimension(
151                   (int) minimumSize.getWidth() - 20, (int) minimumSize
152                           .getHeight()));
153       }
154  
155       @Override
156       public Component add(Component comp) {
157           return this.panelContent.add(comp);
158       }
159  
160       public void addButton(JButton button) {
161           this.panelButtons.add(button);
162       }
163  
164       private void disableButtons() {
165           for (Component comp : panelButtons.getComponents()) {
166               comp.setEnabled(false);
167           }
168       }
169  
170       private void enableButtons() {
171           for (Component comp : panelButtons.getComponents()) {
172               comp.setEnabled(true);
173           }
174       }
175  
176       public void setLocationToCenter() {
177           int posX = (int) ((int) (this.parent.getSize().getWidth() / 2) - (this
178                   .getSize().getWidth() / 2));
179           int posY = (int) ((int) (this.parent.getSize().getHeight() / 2) - (this
180                   .getSize().getHeight() / 2));
181  
182           setLocation(posX, posY);
183       }
184  
185       public void setHelpChapter(String chapter) {
186           setHelpChapter(chapter, null);
187       }
188  
189       public void setHelpChapter(String chapter, String anchor) {
190           this.helpChapter = chapter;
191           this.helpChapterAnchor = anchor;
192  
193           panelHelpButton.setVisible(true);
194       }
195  
196       /**
197        * Helper method to add a component to a GridBagLayout
198        *
199        * @param gbl
200        *            the layout to add the component
201        * @param container
202        *            the container object in which the layout is
203        * @param component
204        *            the component to add
205        * @param posx
206        *            the vertical position
207        * @param posy
208        *            the horizontal position
209        * @param width
210        *            the width of the component
211        * @param height
212        *            the height of the component
213        * @param insets
214        *            the padding of the component
215        * @param weightx
216        *            the vertical weight
217        * @param weighty
218        *            the horizontal weight
219        */
220       protected void gblAdd(GridBagLayout gbl, Container container,
221               Component component, int posx, int posy, int width, int height,
222               Insets insets, double weightx, double weighty) {
223           GridBagConstraints gbc = new GridBagConstraints();
224           gbc.gridx = posx;
225           gbc.gridy = posy;
226           gbc.gridwidth = width;
227           gbc.gridheight = height;
228           gbc.weightx = weightx;
229           gbc.weighty = weighty;
230           gbc.insets = insets;
231           gbc.fill = GridBagConstraints.BOTH;
232           gbl.setConstraints(component, gbc);
233           container.add(component);
234       }
235  
236       /**
237        *
238        * @param parent
239        */
240       public AbstractDialog(Frame parent) {
241           super(parent);
242           this.parent = parent;
243  
244           setModal(true);
245  
246           panelBase.setLayout(new BorderLayout());
247           panelTop.setLayout(new BorderLayout());
248  
249           /*
250            * Build the top panel
251            */
252           Font fontTitle = new Font(Font.SANS_SERIF, Font.BOLD, 13);
253           Font fontText = new Font(Font.SANS_SERIF, Font.PLAIN, 12);
254           
255           GridBagLayout gblTop = new GridBagLayout();
256           JPanel panelGridTop = new JPanel();
257           panelGridTop.setLayout(gblTop);
258           panelGridTop.setBackground(Color.WHITE);
259  
260           labelTitle.setFont(fontTitle);
261  
262           textDescription.setRows(3);
263           textDescription.setFont(fontText);
264           textDescription.setEditable(false);
265           textDescription.setLineWrap(true);
266           textDescription.setWrapStyleWord(true);
267           textDescription.setSelectionColor(Color.WHITE);
268  
269           gblAdd(gblTop, panelGridTop, labelTitle, 0, 0, 1, 1, new Insets(10, 10, 10,
270                   10), 0.0, 0.0);
271           gblAdd(gblTop, panelGridTop, labelIcon, 1, 0, 1, 2, new Insets(10, 20, 10,
272                   20), 0.0, 0.0);
273           gblAdd(gblTop, panelGridTop, panelDescTB, 0, 1, 1, 1, new Insets(0, 10,
274                   10, 10), 1.0, 1.0);
275           
276           panelTop.add(panelGridTop, BorderLayout.CENTER);
277           panelTop.setBorder(new MatteBorder(0, 0, 1, 0, UI.SEPARATOR_COLOR));
278  
279           /*
280            * Build the buttons panel and help button
281            */
282           FlowLayout buttonLayout = new FlowLayout();
283           buttonLayout.setAlignment(FlowLayout.RIGHT);
284           buttonLayout.setHgap(10);
285           buttonLayout.setVgap(10);
286  
287           panelButtons.setLayout(buttonLayout);
288  
289           FlowLayout helpButtonLayout = new FlowLayout();
290           helpButtonLayout.setAlignment(FlowLayout.LEFT);
291           helpButtonLayout.setHgap(10);
292           helpButtonLayout.setVgap(10);
293  
294           JToggleButton buttonHelp = new JToggleButton(ICON_OPEN_HELP);
295           buttonHelp.setToolTipText(Data.getInstance().getLocaleStr("showHelp"));
296           buttonHelp.setBorder(null);
297           buttonHelp.setOpaque(false);
298           buttonHelp.setContentAreaFilled(false);
299           buttonHelp.setSelectedIcon(ICON_CLOSE_HELP);
300           buttonHelp.setRolloverIcon(ICON_OPEN_HELP_ROLLOVER);
301           buttonHelp.setRolloverSelectedIcon(ICON_CLOSE_HELP_ROLLOVER);
302           buttonHelp.setCursor(new Cursor(Cursor.HAND_CURSOR));
303  
304           buttonHelp.addActionListener(new ActionListener() {
305  
306               @Override
307               public void actionPerformed(ActionEvent e) {
308                   toggleHelp();
309               }
310  
311           });
312  
313           panelHelpButton.setLayout(helpButtonLayout);
314           panelHelpButton.add(buttonHelp);
315           panelHelpButton.setVisible(false);
316  
317           /*
318            * Build the bottom panel
319            */
320           GridBagLayout gblBottom = new GridBagLayout();
321           panelBottom.setLayout(gblBottom);
322           
323           panelBottom.setBorder(new MatteBorder(1, 0, 0, 0, UI.SEPARATOR_COLOR));
324  
325           gblAdd(gblBottom, panelBottom, panelHelpButton, 0, 0, 1, 1, new Insets(
326                   5, 5, 5, 5), 1.0, 1.0);
327           gblAdd(gblBottom, panelBottom, panelButtons, 1, 0, 1, 1, new Insets(5,
328                   5, 5, 5), 1.0, 1.0);
329  
330           /*
331            * Build content pane with padding
332            */
333           GridBagLayout gblContent = new GridBagLayout();
334  
335           panelGridContent.setLayout(gblContent);
336  
337           gblAdd(gblContent, panelGridContent, panelContent, 0, 0, 1, 1,
338                   new Insets(25, 15, 30, 15), 1.0, 1.0);
339  
340           panelContent.setLayout(null);
341  
342           /*
343            * Construct the progress panel
344            */
345           panelProgress.setLayout(new BorderLayout());
346  
347           JLabel wait = new JLabel(Data.getInstance().getLocaleStr(
348                   "message.inProgress"), ICON_WAIT, SwingConstants.CENTER);
349  
350           panelProgress.add(wait, BorderLayout.CENTER);
351  
352           /*
353            * Construct the dialog
354            */
355           panelBase.add(panelTop, BorderLayout.NORTH);
356           panelBase.add(panelGridContent, BorderLayout.CENTER);
357           panelBase.add(panelBottom, BorderLayout.SOUTH);
358  
359           setContentPane(panelBase);
360  
361           pack();
362  
363           setMinimumSize(new Dimension(450, 450));
364           setMaximumSize(new Dimension(650, 600));
365  
366           /*
367            * Behaviour when closing this dialog.
368            */
369           setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
370           addWindowListener(new WindowAdapter() {
371               @Override
372               public void windowClosing(WindowEvent e) {
373                   // buttonClicked = ButtonClicked.CANCEL;
374                   setVisible(false);
375               }
376           });
377       }
378  
379       public void switchToEditMode() {
380           enableButtons();
381  
382           panelBase.remove(panelProgress);
383           panelBase.add(panelGridContent, BorderLayout.CENTER);
384  
385           panelBase.revalidate();
386       }
387  
388       public void switchToProgressMode() {
389           disableButtons();
390  
391           panelBase.remove(panelGridContent);
392           panelBase.add(panelProgress, BorderLayout.CENTER);
393  
394           panelBase.revalidate();
395       }
396  
397       public void toggleHelp() {
398           if (helpOpened == false) {
399               helpOpened = true;
400  
401               originalWidth = (int) this.getSize().getWidth();
402  
403               /*
404                * Show "wait..." as label
405                */
406               JLabel wait = new JLabel(Data.getInstance().getLocaleStr(
407                       "message.helpIsLoading"), ICON_WAIT, SwingConstants.CENTER);
408  
409               panelHelp.setLayout(new BorderLayout());
410               panelHelp.add(wait, BorderLayout.CENTER);
411  
412               /*
413                * Configure split pane
414                */
415               splitPane.setRightComponent(panelHelp);
416               splitPane.setLeftComponent(panelBase);
417               splitPane.setDividerSize(8);
418               splitPane.setEnabled(true);
419               splitPane.setBorder(null);
420               splitPane.setContinuousLayout(true);
421  
422               int expandArea = 400;
423               int screenWidth = (int) Toolkit.getDefaultToolkit().getScreenSize()
424                       .getWidth();
425               int dialogWidth = originalWidth + expandArea;
426  
427               if (this.getX() + dialogWidth > screenWidth) {
428                   dialogWidth = screenWidth - this.getX();
429               }
430  
431               setSize(new Dimension(dialogWidth, (int) this.getSize().getHeight()));
432  
433               setContentPane(splitPane);
434  
435               /*
436                * Load help content
437                */
438               LoadEmbeddedHelpWorker worker = new LoadEmbeddedHelpWorker(
439                       panelHelp, helpChapter, helpChapterAnchor);
440  
441               worker.execute();
442           } else {
443               helpOpened = false;
444  
445               setSize(new Dimension(originalWidth, (int) this.getSize()
446                       .getHeight()));
447  
448               setContentPane(panelBase);
449           }
450       }
451  
452   }
ReviewProtocolPDFExporter.java
25   public class ReviewProtocolPDFExporter extends ProtocolPDFExporter {
26  
27       private static ApplicationData appData = Data.getInstance().getAppData();
28       private static Review review = Data.getInstance().getResiData().getReview();
29  
30       private boolean showSignFields = false;
31       private boolean attachProdExtRefs = true;
32       private boolean attachFindExtRefs = true;
33  
34       public ReviewProtocolPDFExporter(String filePath, boolean showSignFields,
35               boolean attachProdExtRefs, boolean attachFindExtRefs)
36               throws ExportException, DataException {
37           super(filePath, Data.getInstance().getLocaleStr(
38                   "export.reviewProtocolTitle")
39                   + " · " + review.getName(), appData
40                   .getSetting(AppSettingKey.PDF_PROTOCOL_LOGO), appData
41                   .getSetting(AppSettingKey.PDF_PROTOCOL_FOOT_TEXT));
42  
43           this.showSignFields = showSignFields;
44           this.attachProdExtRefs = attachProdExtRefs;
45           this.attachFindExtRefs = attachFindExtRefs;
46       }
47  
48       @Override
49       protected void writeContent() throws ExportException {
50           try {
51               /*
52                * Write the title page of the protocol
53                */
54               writeTitlePage(review.getMeetings(), attachProdExtRefs);
55  
56               /*
57                * Write attendees of the whole review
58                */
59               if (showSignFields == true) {
60                   Font introFont = new Font(BaseFont.createFont(
61                           BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252,
62                           BaseFont.EMBEDDED), 10);
63  
64                   pdfDoc.newPage();
65  
66                   PdfPTable table = new PdfPTable(1);
67                   table.setWidthPercentage(100);
68  
69                   PdfPCell cellSignIntro = new PdfPCell(new Phrase(Data
70                           .getInstance().getLocaleStr(
71                                   "export.reviewAttendeesIntro"), introFont));
72                   cellSignIntro.setBorderWidth(0);
73                   cellSignIntro.setPadding(padding);
74                   cellSignIntro.setPaddingBottom(PDFTools.cmToPt(0.8f));
75  
76                   table.addCell(cellSignIntro);
77  
78                   pdfDoc.add(table);
79  
80                   writeAttendees(null, false, false, true);
81               }
82  
83               /*
84                * Write the meetings of this review
85                */
86               for (Meeting m : review.getMeetings()) {
87  
88                   Protocol prot = m.getProtocol();
89  
90                   if (prot != null) {
91                       pdfDoc.newPage();
92  
93                       writeMeeting(m, attachFindExtRefs, false);
94                   }
95               }
96           } catch (Exception e) {
97               /*
98                * Not part of unit testing because this exception is only thrown if
99                * an internal error occurs.
100                */
101               throw new ExportException(Data.getInstance().getLocaleStr(
102                       "message.pdfWriteProtocolFailed"));
103           }
104       }
105  
106   }
ProtocolPDFExporter.java
42   public abstract class ProtocolPDFExporter extends PDFExporter {
43  
44       private FindingManagement findMgmt = Application.getInstance()
45               .getFindingMgmt();
46       private ProtocolManagement protMgmt = Application.getInstance()
47               .getProtocolMgmt();
48       private AttendeeManagement attMgmt = Application.getInstance()
49               .getAttendeeMgmt();
50  
51       protected DateFormat sdfDate = SimpleDateFormat
52               .getDateInstance(SimpleDateFormat.LONG);
53       protected DateFormat sdfTime = new SimpleDateFormat(Data.getInstance()
54               .getLocaleStr("format.time"));
55  
56       protected Color cellBackground = new Color(235, 235, 235);
57       protected Color bgColorTitle = new Color(100, 100, 100);
58       protected float padding = PDFTools.cmToPt(0.2f);
59       protected float leading = PDFTools.cmToPt(0.45f);
60       protected float verticalBorderWidth = 1.2f;
61       protected Color verticalBorderColor = Color.GRAY;
62  
63       protected ProtocolPDFExporter(String filePath, String headTitle,
64               String headLogoPath, String footText) throws ExportException {
65           super(filePath, headTitle, headLogoPath, footText);
66       }
67  
68       protected void writeTitlePage(Meeting meeting, boolean attachProdExtRefs)
69               throws ExportException {
70           List<Meeting> meetings = new ArrayList<Meeting>();
71  
72           meetings.add(meeting);
73  
74           writeTitlePage(meetings, attachProdExtRefs);
75       }
76  
77       protected void writeTitlePage(List<Meeting> meetings,
78               boolean attachProdExtRefs) throws ExportException {
79           try {
80               Font plainFont = new Font(BaseFont.createFont(BaseFont.HELVETICA,
81                       BaseFont.CP1252, BaseFont.EMBEDDED), 10);
82  
83               Font plainFontSmall = new Font(BaseFont.createFont(
84                       BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 8);
85  
86               Font boldFont = new Font(BaseFont
87                       .createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
88                               BaseFont.EMBEDDED), 11);
89  
90               Font italicFont = new Font(BaseFont.createFont(
91                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
92                       BaseFont.EMBEDDED), 10);
93  
94               Font italicFontSmall = new Font(BaseFont.createFont(
95                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
96                       BaseFont.EMBEDDED), 8);
97  
98               Font boldItalicFont = new Font(BaseFont.createFont(
99                       BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252,
100                       BaseFont.EMBEDDED), 11);
101  
102               Font boldItalicFontSmall = new Font(BaseFont.createFont(
103                       BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252,
104                       BaseFont.EMBEDDED), 8);
105  
106               Font protocolFontTitle = new Font(BaseFont
107                       .createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
108                               BaseFont.EMBEDDED), 20);
109  
110               Font reviewFontTitle = new Font(BaseFont.createFont(
111                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
112                       BaseFont.EMBEDDED), 15);
113  
114               Font meetingFontTitle = new Font(BaseFont.createFont(
115                       BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 13);
116  
117               /*
118                * Title of the protocol
119                */
120               PdfPTable tableTitlePage = new PdfPTable(new float[] { 0.6f, 0.4f });
121               tableTitlePage.setWidthPercentage(100);
122               tableTitlePage.setSplitRows(false);
123               tableTitlePage.getDefaultCell().setBorder(0);
124               tableTitlePage.getDefaultCell().setPadding(0);
125  
126               String protocolTitle = Data.getInstance().getLocaleStr(
127                       "export.reviewProtocol");
128  
129               if (meetings.size() == 1) {
130                   protocolTitle = Data.getInstance().getLocaleStr(
131                           "export.meetingProtocol");
132               }
133  
134               PdfPCell cellProtocol = new PdfPCell(new Phrase(protocolTitle,
135                       protocolFontTitle));
136               cellProtocol.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
137               cellProtocol.setColspan(2);
138               cellProtocol.setBorderWidth(0);
139               cellProtocol.setPaddingTop(PDFTools.cmToPt(0.4f));
140               cellProtocol.setPaddingBottom(PDFTools.cmToPt(0.2f));
141  
142               tableTitlePage.addCell(cellProtocol);
143  
144               /*
145                * Name of the review
146                */
147               PdfPCell cellRevName = new PdfPCell(new Phrase(Application
148                       .getInstance().getReviewMgmt().getReviewName(),
149                       reviewFontTitle));
150               cellRevName.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
151               cellRevName.setColspan(2);
152               cellRevName.setBorderWidth(0);
153               cellRevName.setPaddingBottom(PDFTools.cmToPt(1.6f));
154  
155               tableTitlePage.addCell(cellRevName);
156  
157               /*
158                * Review meeting date and location
159                */
160               if (meetings.size() == 1) {
161                   String meetingDate = sdfDate.format(meetings.get(0)
162                           .getProtocol().getDate().getTime());
163  
164                   String meetingTime = sdfTime.format(meetings.get(0)
165                           .getProtocol().getStart().getTime())
166                           + " - "
167                           + sdfTime.format(meetings.get(0).getProtocol().getEnd()
168                                   .getTime());
169  
170                   Phrase phraseMeeting = new Phrase(
171                           meetingDate
172                                   + " ("
173                                   + meetingTime
174                                   + " "
175                                   + Data.getInstance().getLocaleStr(
176                                           "export.clock") + ")", meetingFontTitle);
177  
178                   PdfPCell cellMeeting = new PdfPCell(phraseMeeting);
179                   cellMeeting.setColspan(2);
180                   cellMeeting.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
181                   cellMeeting.setPadding(0);
182                   cellMeeting.setBorderWidth(0);
183  
184                   tableTitlePage.addCell(cellMeeting);
185  
186                   cellMeeting = new PdfPCell(new Phrase(Data.getInstance()
187                           .getLocaleStr("export.location")
188                           + ": " + meetings.get(0).getProtocol().getLocation(),
189                           meetingFontTitle));
190                   cellMeeting.setColspan(2);
191                   cellMeeting.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
192                   cellMeeting.setPadding(0);
193                   cellMeeting.setBorderWidth(0);
194                   cellMeeting.setPaddingTop(PDFTools.cmToPt(0.15f));
195                   cellMeeting.setPaddingBottom(PDFTools.cmToPt(1.9f));
196  
197                   tableTitlePage.addCell(cellMeeting);
198               }
199  
200               /*
201                * Review description and comments
202                */
203               PdfPCell cellRevDesc = new PdfPCell(new Phrase(Data.getInstance()
204                       .getLocaleStr("export.reviewDescription"), boldItalicFont));
205               cellRevDesc.setBorderWidth(0);
206               cellRevDesc.setPadding(padding);
207  
208               tableTitlePage.addCell(cellRevDesc);
209  
210               cellRevDesc = new PdfPCell(new Phrase(Data.getInstance()
211                       .getLocaleStr("export.reviewComments"), boldFont));
212               cellRevDesc.setBorderWidth(0);
213               cellRevDesc.setPadding(padding);
214               cellRevDesc.setBackgroundColor(cellBackground);
215  
216               tableTitlePage.addCell(cellRevDesc);
217  
218               String revDesc = Application.getInstance().getReviewMgmt()
219                       .getReviewDescription();
220               if (revDesc.trim().equals("")) {
221                   revDesc = "--";
222               }
223  
224               Phrase phrDesc = new Phrase(revDesc, plainFont);
225               phrDesc.setLeading(leading);
226               cellRevDesc = new PdfPCell();
227               cellRevDesc.addElement(phrDesc);
228               cellRevDesc.setBorderWidth(0);
229               cellRevDesc.setPadding(padding);
230               cellRevDesc.setPaddingBottom(padding * 1.8f);
231  
232               tableTitlePage.addCell(cellRevDesc);
233  
234               String revComm = Application.getInstance().getReviewMgmt()
235                       .getReviewComments();
236               if (revComm.trim().equals("")) {
237                   revComm = "--";
238               }
239  
240               Phrase phrComm = new Phrase(revComm, italicFont);
241               phrComm.setLeading(leading);
242               cellRevDesc = new PdfPCell();
243               cellRevDesc.addElement(phrComm);
244               cellRevDesc.setBorderWidth(0);
245               cellRevDesc.setPadding(padding);
246               cellRevDesc.setPaddingBottom(padding * 1.8f);
247               cellRevDesc.setBackgroundColor(cellBackground);
248  
249               tableTitlePage.addCell(cellRevDesc);
250  
251               tableTitlePage
252                       .addCell(createVerticalStrut(PDFTools.cmToPt(1.0f), 2));
253  
254               /*
255                * Product title
256                */
257               PdfPTable tableProduct = new PdfPTable(new float[] { 0.07f, 0.93f });
258               tableProduct.setWidthPercentage(100);
259               tableProduct.setSplitRows(false);
260               tableProduct.getDefaultCell().setBorderWidth(0);
261               tableProduct.getDefaultCell().setPadding(0);
262  
263               PdfPCell cellProdTitle = new PdfPCell(new Phrase(Data.getInstance()
264                       .getLocaleStr("export.reviewProduct"), boldItalicFont));
265               cellProdTitle.setColspan(2);
266               cellProdTitle.setPadding(padding);
267               cellProdTitle.setBorder(0);
268  
269               tableProduct.addCell(cellProdTitle);
270  
271               /*
272                * List point used for lists
273                */
274               Phrase phraseListPoint = new Phrase("»", boldFont);
275               phraseListPoint.setLeading(leading);
276  
277               PdfPCell cellListPoint = new PdfPCell();
278               cellListPoint.addElement(phraseListPoint);
279               cellListPoint.setBorderWidth(0);
280               cellListPoint.setPadding(padding);
281               cellListPoint.setPaddingLeft(padding * 2);
282               cellListPoint.setPaddingBottom(0);
283  
284               /*
285                * Write name and version of the reviewed product
286                */
287               Phrase phrName = new Phrase(Data.getInstance().getLocaleStr(
288                       "export.productName")
289                       + ": "
290                       + Data.getInstance().getResiData().getReview().getProduct()
291                               .getName(), plainFont);
292               phrName.setLeading(leading);
293  
294               PdfPCell cellName = new PdfPCell();
295               cellName.addElement(phrName);
296               cellName.setBorderWidth(0);
297               cellName.setPadding(padding);
298               cellName.setPaddingBottom(0);
299  
300               tableProduct.addCell(cellListPoint);
301  
302               tableProduct.addCell(cellName);
303  
304               Phrase phrVersion = new Phrase(Data.getInstance().getLocaleStr(
305                       "export.productVersion")
306                       + ": "
307                       + Data.getInstance().getResiData().getReview().getProduct()
308                               .getVersion(), plainFont);
309               phrVersion.setLeading(leading);
310  
311               PdfPCell cellVersion = new PdfPCell();
312               cellVersion.addElement(phrVersion);
313               cellVersion.setBorderWidth(0);
314               cellVersion.setPadding(padding);
315               cellVersion.setPaddingBottom(0);
316  
317               tableProduct.addCell(cellListPoint);
318  
319               tableProduct.addCell(cellVersion);
320  
321               /*
322                * Table of product references
323                */
324               PdfPCell cellRefTitle = new PdfPCell(new Phrase(Data.getInstance()
325                       .getLocaleStr("export.productReferences"), boldItalicFont));
326               cellRefTitle.setBorderWidth(0);
327               cellRefTitle.setPadding(padding);
328               cellRefTitle.setPaddingTop(padding * 4);
329               cellRefTitle.setColspan(2);
330  
331               tableProduct.addCell(cellRefTitle);
332  
333               /*
334                * Textual references
335                */
336               for (String ref : Application.getInstance().getReviewMgmt()
337                       .getProductReferences()) {
338                   Phrase phraseRef = new Phrase(ref, plainFont);
339                   phraseRef.setLeading(leading);
340  
341                   PdfPCell cellRef = new PdfPCell();
342                   cellRef.addElement(phraseRef);
343                   cellRef.setBorderWidth(0);
344                   cellRef.setPadding(padding);
345                   cellRef.setPaddingBottom(0);
346  
347                   tableProduct.addCell(cellListPoint);
348  
349                   tableProduct.addCell(cellRef);
350               }
351  
352               /*
353                * External file references
354                */
355               for (File ref : Application.getInstance().getReviewMgmt()
356                       .getExtProdReferences()) {
357                   Phrase phraseRef = new Phrase();
358                   phraseRef.add(new Chunk(ref.getName(), plainFont));
359                   phraseRef.add(new Chunk(" ("
360                           + Data.getInstance().getLocaleStr(
361                                   "export.fileAttachment") + ")", italicFont));
362                   phraseRef.setFont(plainFont);
363                   phraseRef.setLeading(leading);
364  
365                   PdfPCell cellRef = new PdfPCell();
366                   cellRef.addElement(phraseRef);
367                   cellRef.setBorderWidth(0);
368                   cellRef.setPadding(padding);
369                   cellRef.setPaddingBottom(0);
370  
371                   tableProduct.addCell(cellListPoint);
372  
373                   if (attachProdExtRefs) {
374                       cellRef
375                               .setCellEvent(new PDFCellEventExtRef(pdfWriter, ref));
376                   }
377  
378                   tableProduct.addCell(cellRef);
379               }
380  
381               /*
382                * Add the product table to the base table
383                */
384               PdfPCell cellProduct = new PdfPCell(tableProduct);
385               cellProduct.setBorder(0);
386               cellProduct.setPadding(0);
387  
388               tableTitlePage.addCell(cellProduct);
389  
390               /*
391                * List the meetings of this review
392                */
393               PdfPCell cellInfos = new PdfPCell();
394               cellInfos.setBorder(0);
395               cellInfos.setPadding(0);
396  
397               /*
398                * meeting list title or meeting info title
399                */
400               PdfPTable tableInfos = new PdfPTable(new float[] { 0.09f, 0.91f });
401               tableInfos.setWidthPercentage(100);
402               tableInfos.setSplitRows(false);
403               tableInfos.getDefaultCell().setBorderWidth(0);
404               tableInfos.getDefaultCell().setPadding(0);
405  
406               String title = Data.getInstance().getLocaleStr(
407                       "export.meetingInfos");
408  
409               if (meetings.size() > 1) {
410                   title = Data.getInstance().getLocaleStr(
411                           "export.protocolReviewMeetings");
412               }
413  
414               PdfPCell cellInfosTitle = new PdfPCell(new Phrase(title, boldFont));
415               cellInfosTitle.setColspan(2);
416               cellInfosTitle.setPadding(padding);
417               cellInfosTitle.setBorder(0);
418  
419               tableInfos.addCell(cellInfosTitle);
420  
421               if (meetings.size() > 1) {
422                   /*
423                    * list the meetings of this review (for review protocols)
424                    */
425                   for (Meeting m : meetings) {
426                       int i = 0;
427  
428                       Protocol protocol = m.getProtocol();
429  
430                       if (protocol != null) {
431                           String meetingDate = sdfDate.format(protocol.getDate()
432                                   .getTime());
433  
434                           String meetingTime = sdfTime.format(protocol.getStart()
435                                   .getTime())
436                                   + " - "
437                                   + sdfTime.format(protocol.getEnd().getTime());
438  
439                           Phrase phraseMeet = new Phrase(Data.getInstance()
440                                   .getLocaleStr("export.date")
441                                   + ": "
442                                   + meetingDate
443                                   + "\n"
444                                   + Data.getInstance()
445                                           .getLocaleStr("export.time")
446                                   + ": "
447                                   + meetingTime
448                                   + " "
449                                   + Data.getInstance().getLocaleStr(
450                                           "export.clock")
451                                   + "\n"
452                                   + Data.getInstance().getLocaleStr(
453                                           "export.location")
454                                   + ": "
455                                   + protocol.getLocation(), italicFont);
456  
457                           Paragraph paraMeet = new Paragraph();
458                           paraMeet.setLeading(leading);
459  
460                           Anchor anchor = new Anchor(phraseMeet);
461                           anchor.setReference("#"
462                                   + Long
463                                           .toString(protocol.getDate()
464                                                   .getTimeInMillis()
465                                                   + protocol.getStart()
466                                                           .getTimeInMillis()));
467  
468                           paraMeet.add(anchor);
469  
470                           PdfPCell cellMeet = new PdfPCell();
471                           cellMeet.addElement(paraMeet);
472                           cellMeet.setBorderWidth(0);
473                           cellMeet.setPadding(padding);
474  
475                           tableInfos.addCell(cellListPoint);
476  
477                           tableInfos.addCell(cellMeet);
478                       }
479  
480                       i++;
481                   }
482               } else {
483                   /*
484                    * list information of the meeting (for meeting protocols)
485                    */
486                   Protocol prot = meetings.get(0).getProtocol();
487  
488                   /*
489                    * meeting duration
490                    */
491                   Duration meetDur = DatatypeFactory.newInstance().newDuration(
492                           prot.getEnd().getTimeInMillis()
493                                   - prot.getStart().getTimeInMillis());
494  
495                   Phrase phraseMeetInfo = new Phrase(Data.getInstance()
496                           .getLocaleStr("export.meetingDuration")
497                           + ":\n"
498                           + meetDur.getHours()
499                           + " "
500                           + Data.getInstance().getLocaleStr("export.hours")
501                           + ", "
502                           + meetDur.getMinutes()
503                           + " "
504                           + Data.getInstance().getLocaleStr("export.minutes"),
505                           italicFont);
506                   phraseMeetInfo.setLeading(leading);
507  
508                   PdfPCell cellMeetInfo = new PdfPCell();
509                   cellMeetInfo.addElement(phraseMeetInfo);
510                   cellMeetInfo.setBorderWidth(0);
511                   cellMeetInfo.setPadding(padding);
512  
513                   tableInfos.addCell(cellListPoint);
514  
515                   tableInfos.addCell(cellMeetInfo);
516  
517                   /*
518                    * meeting number of findings
519                    */
520                   phraseMeetInfo = new Phrase(Data.getInstance().getLocaleStr(
521                           "export.meetingNumberOfFindings")
522                           + ": " + prot.getFindings().size(), italicFont);
523                   phraseMeetInfo.setLeading(leading);
524  
525                   cellMeetInfo = new PdfPCell();
526                   cellMeetInfo.addElement(phraseMeetInfo);
527                   cellMeetInfo.setBorderWidth(0);
528                   cellMeetInfo.setPadding(padding);
529  
530                   tableInfos.addCell(cellListPoint);
531  
532                   tableInfos.addCell(cellMeetInfo);
533  
534                   /*
535                    * meeting number of attendees
536                    */
537                   phraseMeetInfo = new Phrase(Data.getInstance().getLocaleStr(
538                           "export.meetingNumberOfAttendees")
539                           + ": " + prot.getAttendeeReferences().size(),
540                           italicFont);
541                   phraseMeetInfo.setLeading(leading);
542  
543                   cellMeetInfo = new PdfPCell();
544                   cellMeetInfo.addElement(phraseMeetInfo);
545                   cellMeetInfo.setBorderWidth(0);
546                   cellMeetInfo.setPadding(padding);
547  
548                   tableInfos.addCell(cellListPoint);
549  
550                   tableInfos.addCell(cellMeetInfo);
551               }
552  
553               cellInfos.addElement(tableInfos);
554               cellInfos.setBackgroundColor(cellBackground);
555               cellInfos.setPaddingBottom(padding);
556  
557               tableTitlePage.addCell(cellInfos);
558  
559               /*
560                * Insert vertical strut
561                */
562               tableTitlePage
563                       .addCell(createVerticalStrut(PDFTools.cmToPt(1.0f), 2));
564  
565               /*
566                * Write general impression and recommendation
567                */
568               PdfPTable tableRevInfo = new PdfPTable(new float[] { 0.5f, 0.5f });
569               tableRevInfo.setWidthPercentage(100);
570               tableRevInfo.setSplitRows(false);
571               tableRevInfo.getDefaultCell().setBorderWidth(0);
572               tableRevInfo.getDefaultCell().setPadding(0);
573  
574               /*
575                * Insert vertical strut
576                */
577               tableRevInfo.addCell(createVerticalStrut(PDFTools.cmToPt(0.5f), 2));
578  
579               PdfPCell cellImpr = new PdfPCell(new Phrase(Data.getInstance()
580                       .getLocaleStr("export.impression"), boldFont));
581               cellImpr.setBorderWidth(0);
582               cellImpr.setPadding(padding);
583               cellImpr.setBorderColor(verticalBorderColor);
584               cellImpr.setBorderWidthLeft(verticalBorderWidth);
585  
586               tableRevInfo.addCell(cellImpr);
587  
588               PdfPCell cellReco = new PdfPCell(new Phrase(Data.getInstance()
589                       .getLocaleStr("export.recommendation"), boldFont));
590               cellReco.setBorderWidth(0);
591               cellReco.setPadding(padding);
592               cellReco.setBorderColor(verticalBorderColor);
593               cellReco.setBorderWidthLeft(verticalBorderWidth);
594  
595               tableRevInfo.addCell(cellReco);
596  
597               String impression = Application.getInstance().getReviewMgmt()
598                       .getImpression();
599               if (impression.trim().equals("")) {
600                   impression = "--";
601               }
602  
603               Phrase phrImpr = new Phrase(impression, italicFont);
604               phrImpr.setLeading(leading);
605               cellImpr = new PdfPCell();
606               cellImpr.addElement(phrImpr);
607               cellImpr.setBorderWidth(0);
608               cellImpr.setPadding(padding);
609               cellImpr.setPaddingBottom(padding * 1.8f);
610               cellImpr.setBorderColor(verticalBorderColor);
611               cellImpr.setBorderWidthLeft(verticalBorderWidth);
612  
613               tableRevInfo.addCell(cellImpr);
614  
615               String recommendation = Application.getInstance().getReviewMgmt()
616                       .getRecommendation();
617               if (recommendation.trim().equals("")) {
618                   recommendation = "--";
619               }
620  
621               Phrase phrReco = new Phrase(recommendation, italicFont);
622               phrReco.setLeading(leading);
623               cellReco = new PdfPCell();
624               cellReco.addElement(phrReco);
625               cellReco.setBorderWidth(0);
626               cellReco.setPadding(padding);
627               cellReco.setPaddingBottom(padding * 1.8f);
628               cellReco.setBorderColor(verticalBorderColor);
629               cellReco.setBorderWidthLeft(verticalBorderWidth);
630  
631               tableRevInfo.addCell(cellReco);
632  
633               /*
634                * Add vertical strut
635                */
636               tableRevInfo.addCell(createVerticalStrut(PDFTools.cmToPt(0.8f), 2));
637  
638               /*
639                * Write possible severities for this review
640                */
641               String severities = "";
642               String separator = "";
643               for (String sev : Application.getInstance().getSeverityMgmt()
644                       .getSeverities()) {
645                   severities = severities + separator + sev;
646                   separator = "; ";
647               }
648  
649               Phrase phrSeverities = new Phrase();
650               phrSeverities.add(new Chunk(Data.getInstance().getLocaleStr(
651                       "export.possibleSeverities"), italicFontSmall));
652               phrSeverities.add(new Chunk(" " + severities, boldItalicFontSmall));
653               phrSeverities.setLeading(leading);
654               PdfPCell cellSevs = new PdfPCell();
655               cellSevs.setColspan(2);
656               cellSevs.addElement(phrSeverities);
657               cellSevs.setBorderWidth(0);
658               cellSevs.setPadding(padding);
659  
660               tableRevInfo.addCell(cellSevs);
661  
662               /*
663                * Short review statistics
664                */
665               if (meetings.size() > 1) {
666                   Phrase phrRevStat = new Phrase(Data.getInstance().getLocaleStr(
667                           "export.reviewInNumbers")
668                           + ": "
669                           + Application.getInstance().getReviewMgmt()
670                                   .getNumberOfAttendees()
671                           + " "
672                           + Data.getInstance().getLocaleStr("export.attendees")
673                           + ", "
674                           + Application.getInstance().getReviewMgmt()
675                                   .getNumberOfFindings()
676                           + " "
677                           + Data.getInstance().getLocaleStr("export.findings")
678                           + ", "
679                           + Application.getInstance().getReviewMgmt()
680                                   .getNumberOfMeetings()
681                           + " "
682                           + Data.getInstance().getLocaleStr("export.meetings")
683                           + ", "
684                           + Application.getInstance().getReviewMgmt()
685                                   .getNumberOfAspects()
686                           + " "
687                           + Data.getInstance().getLocaleStr(
688                                   "export.reviewAspects"), italicFontSmall);
689                   phrRevStat.setLeading(leading);
690                   PdfPCell cellRevStat = new PdfPCell();
691                   cellRevStat.setColspan(2);
692                   cellRevStat.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
693                   cellRevStat.addElement(phrRevStat);
694                   cellRevStat.setBorderWidth(0);
695                   cellRevStat.setPadding(padding);
696                   cellRevStat.setPaddingTop(0);
697  
698                   tableRevInfo.addCell(cellRevStat);
699               }
700  
701               /*
702                * Write the date of creation
703                */
704               String creationDate = sdfDate.format(new Date().getTime()) + " ("
705                       + sdfTime.format(new Date().getTime()) + " "
706                       + Data.getInstance().getLocaleStr("export.clock") + ")";
707  
708               Phrase phrCreationDate = new Phrase(Data.getInstance()
709                       .getLocaleStr("export.protocolCreated")
710                       + " " + creationDate, plainFontSmall);
711               phrCreationDate.setLeading(leading);
712               PdfPCell cellCrDate = new PdfPCell();
713               cellCrDate.setColspan(2);
714               cellCrDate.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
715               cellCrDate.addElement(phrCreationDate);
716               cellCrDate.setBorderWidth(0);
717               cellCrDate.setPadding(0);
718               cellCrDate.setPaddingLeft(padding);
719               cellCrDate.setPaddingRight(padding);
720  
721               tableRevInfo.addCell(cellCrDate);
722  
723               /*
724                * Add content to the base table
725                */
726               PdfPCell cellRevInfo = new PdfPCell();
727               cellRevInfo.setColspan(2);
728               cellRevInfo.setBorder(0);
729               cellRevInfo.setPadding(0);
730               cellRevInfo.addElement(tableRevInfo);
731  
732               tableTitlePage.addCell(cellRevInfo);
733  
734               pdfDoc.add(tableTitlePage);
735           } catch (Exception e) {
736               /*
737                * Not part of unit testing because this exception is only thrown if
738                * an internal error occurs.
739                */
740               throw new ExportException(Data.getInstance().getLocaleStr(
741                       "message.pdfCreateTitlePageFailed"));
742           }
743       }
744  
745       protected void writeMeeting(Meeting meeting, boolean attachExtRefs,
746               boolean showSignatureFields) throws ExportException {
747           Protocol protocol = meeting.getProtocol();
748  
749           if (protocol != null) {
750               try {
751                   Font plainFont = new Font(
752                           BaseFont.createFont(BaseFont.HELVETICA,
753                                   BaseFont.CP1252, BaseFont.EMBEDDED), 10);
754  
755                   Font boldFont = new Font(BaseFont.createFont(
756                           BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
757                           BaseFont.EMBEDDED), 10);
758  
759                   Font italicFont = new Font(BaseFont.createFont(
760                           BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
761                           BaseFont.EMBEDDED), 10);
762  
763                   Font boldItalicFont = new Font(BaseFont.createFont(
764                           BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252,
765                           BaseFont.EMBEDDED), 10);
766  
767                   Font boldFontTitle = new Font(BaseFont.createFont(
768                           BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
769                           BaseFont.EMBEDDED), 17);
770  
771                   Font italicFontTitle = new Font(BaseFont.createFont(
772                           BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
773                           BaseFont.EMBEDDED), 13);
774  
775                   /*
776                    * Base table for the meeting properties
777                    */
778                   PdfPTable tableMeeting = new PdfPTable(2);
779                   tableMeeting.setWidthPercentage(100);
780                   tableMeeting.setSplitRows(false);
781                   tableMeeting.getDefaultCell().setBorderWidth(0);
782                   tableMeeting.getDefaultCell().setPadding(0);
783  
784                   /*
785                    * Write date, time and location of the meeting
786                    */
787                   String meetingDate = sdfDate.format(protocol.getDate()
788                           .getTime());
789  
790                   String meetingTime = sdfTime.format(protocol.getStart()
791                           .getTime())
792                           + " - " + sdfTime.format(protocol.getEnd().getTime());
793  
794                   Anchor anchorTitle = new Anchor(
795                           Data.getInstance().getLocaleStr(
796                                   "export.reviewMeetingAt")
797                                   + " "
798                                   + meetingDate
799                                   + " ("
800                                   + meetingTime
801                                   + " "
802                                   + Data.getInstance().getLocaleStr(
803                                           "export.clock") + ")", boldFontTitle);
804                   anchorTitle.setName(Long.toString(protocol.getDate()
805                           .getTimeInMillis()
806                           + protocol.getStart().getTimeInMillis()));
807  
808                   PdfPCell cellTitle = new PdfPCell(anchorTitle);
809                   cellTitle.setColspan(2);
810                   cellTitle.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
811                   cellTitle.setPadding(0);
812                   cellTitle.setBorderWidth(0);
813                   cellTitle.setPaddingTop(PDFTools.cmToPt(0.6f));
814                   cellTitle.setPaddingBottom(padding * 2);
815  
816                   tableMeeting.addCell(cellTitle);
817  
818                   PdfPCell cellLocation = new PdfPCell(new Phrase(Data
819                           .getInstance().getLocaleStr("export.location")
820                           + ": " + protocol.getLocation(), italicFontTitle));
821                   cellLocation.setColspan(2);
822                   cellLocation.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
823                   cellLocation.setPadding(0);
824                   cellLocation.setBorderWidth(0);
825                   cellLocation.setPaddingBottom(PDFTools.cmToPt(1.5f));
826  
827                   tableMeeting.addCell(cellLocation);
828  
829                   /*
830                    * Compare with planned meeting
831                    */
832                   PdfPCell cellPlanned;
833  
834                   if (meeting.getPlannedDate().equals(protocol.getDate())
835                           && meeting.getPlannedStart()
836                                   .equals(protocol.getStart())
837                           && meeting.getPlannedEnd().equals(protocol.getEnd())
838                           && meeting.getPlannedLocation().equals(
839                                   protocol.getLocation())) {
840                       cellPlanned = new PdfPCell(
841                               new Phrase(Data.getInstance().getLocaleStr(
842                                       "export.meetingAsPlanned"), plainFont));
843  
844                       tableMeeting.addCell(cellPlanned);
845                   } else {
846                       cellPlanned = new PdfPCell();
847  
848                       cellPlanned.addElement(new Phrase(Data.getInstance()
849                               .getLocaleStr("export.plannedMeeting"), plainFont));
850  
851                       /*
852                        * Planned date, time and location
853                        */
854                       String plannedDate = sdfDate.format(meeting
855                               .getPlannedDate().getTime());
856  
857                       String plannedTime = sdfTime.format(meeting
858                               .getPlannedStart().getTime())
859                               + " - "
860                               + sdfTime.format(meeting.getPlannedEnd().getTime());
861  
862                       Phrase phrasePlanned = new Phrase(plannedDate
863                               + " ("
864                               + plannedTime
865                               + " "
866                               + Data.getInstance().getLocaleStr("export.clock")
867                               + "); "
868                               + Data.getInstance()
869                                       .getLocaleStr("export.location") + ": "
870                               + meeting.getPlannedLocation(), italicFont);
871  
872                       cellPlanned.addElement(phrasePlanned);
873                   }
874  
875                   cellPlanned.setColspan(2);
876                   cellPlanned.setBorderWidth(0);
877                   cellPlanned.setPadding(padding);
878                   cellPlanned.setPaddingBottom(PDFTools.cmToPt(1.5f));
879  
880                   tableMeeting.addCell(cellPlanned);
881  
882                   /*
883                    * Comments of the meeting and protocol
884                    */
885                   Phrase phraseComments = new Phrase(Data.getInstance()
886                           .getLocaleStr("export.meetingComments"), boldFont);
887                   PdfPCell cellComments = new PdfPCell(phraseComments);
888                   cellComments.setBorderWidth(0);
889                   cellComments.setPadding(padding);
890                   cellComments.setBorderColor(verticalBorderColor);
891                   cellComments.setBorderWidthLeft(verticalBorderWidth);
892  
893                   tableMeeting.addCell(cellComments);
894  
895                   phraseComments = new Phrase(Data.getInstance().getLocaleStr(
896                           "export.protocolComments"), boldFont);
897                   cellComments = new PdfPCell(phraseComments);
898                   cellComments.setBorderWidth(0);
899                   cellComments.setPadding(padding);
900                   cellComments.setBorderColor(verticalBorderColor);
901                   cellComments.setBorderWidthLeft(verticalBorderWidth);
902  
903                   tableMeeting.addCell(cellComments);
904  
905                   String meetingComments = meeting.getComments();
906                   if (meetingComments.trim().equals("")) {
907                       meetingComments = "--";
908                   }
909  
910                   phraseComments = new Phrase(meetingComments, italicFont);
911                   phraseComments.setLeading(leading);
912                   cellComments = new PdfPCell();
913                   cellComments.addElement(phraseComments);
914                   cellComments.setBorderWidth(0);
915                   cellComments.setPadding(padding);
916                   cellComments.setPaddingBottom(padding * 1.8f);
917                   cellComments.setBorderColor(verticalBorderColor);
918                   cellComments.setBorderWidthLeft(verticalBorderWidth);
919  
920                   tableMeeting.addCell(cellComments);
921  
922                   String protocolComments = protocol.getComments();
923                   if (protocolComments.trim().equals("")) {
924                       protocolComments = "--";
925                   }
926  
927                   phraseComments = new Phrase(protocolComments, italicFont);
928                   phraseComments.setLeading(leading);
929                   cellComments = new PdfPCell();
930                   cellComments.addElement(phraseComments);
931                   cellComments.setBorderWidth(0);
932                   cellComments.setPadding(padding);
933                   cellComments.setPaddingBottom(padding * 1.8f);
934                   cellComments.setBorderColor(verticalBorderColor);
935                   cellComments.setBorderWidthLeft(verticalBorderWidth);
936  
937                   tableMeeting.addCell(cellComments);
938  
939                   /*
940                    * Strut cell
941                    */
942                   tableMeeting.addCell(createVerticalStrut(PDFTools.cmToPt(1.3f),
943                           2));
944  
945                   /*
946                    * Write attendees
947                    */
948                   PdfPCell cellAtt = new PdfPCell(new Phrase(Data.getInstance()
949                           .getLocaleStr("export.presentAttendees")
950                           + " ("
951                           + protocol.getAttendeeReferences().size()
952                           + " "
953                           + Data.getInstance().getLocaleStr("export.attendees")
954                           + "):", boldItalicFont));
955                   cellAtt.setColspan(2);
956                   cellAtt.setPadding(0);
957                   cellAtt.setBorderWidth(0);
958                   cellAtt.setPadding(padding);
959                   cellAtt.setPaddingBottom(PDFTools.cmToPt(0.8f));
960  
961                   tableMeeting.addCell(cellAtt);
962  
963                   pdfDoc.add(tableMeeting);
964  
965                   writeAttendees(protocol, true, true, showSignatureFields);
966  
967                   /*
968                    * Write findings
969                    */
970                   pdfDoc.newPage();
971  
972                   PdfPTable tableFindIntro = new PdfPTable(1);
973                   tableFindIntro.setWidthPercentage(100);
974  
975                   Phrase phraseFindIntro = new Phrase(Data.getInstance()
976                           .getLocaleStr("export.findingsIntro")
977                           + " ("
978                           + protocol.getFindings().size()
979                           + " "
980                           + Data.getInstance().getLocaleStr("export.findings")
981                           + "): ", boldItalicFont);
982                   phraseFindIntro.setLeading(leading);
983  
984                   PdfPCell cellFindIntro = new PdfPCell();
985                   cellFindIntro.addElement(phraseFindIntro);
986                   cellFindIntro.setBorderWidth(0);
987                   cellFindIntro.setPadding(0);
988                   cellFindIntro.setPaddingBottom(PDFTools.cmToPt(0.1f));
989  
990                   tableFindIntro.addCell(cellFindIntro);
991  
992                   pdfDoc.add(tableFindIntro);
993  
994                   writeFindings(protocol, attachExtRefs);
995               } catch (Exception e) {
996                   /*
997                    * Not part of unit testing because this exception is only
998                    * thrown if an internal error occurs.
999                    */
1000                   throw new ExportException(Data.getInstance().getLocaleStr(
1001                           "message.pdfWriteMeetingFailed"));
1002               }
1003           }
1004       }
1005  
1006       protected void writeAttendees(Protocol protocol,
1007               boolean showAttendeesAspects, boolean showAttendeesPrepTime,
1008               boolean showSignatureFields) throws ExportException {
1009           List<Attendee> atts;
1010  
1011           if (protocol != null) {
1012               atts = protMgmt.getAttendees(protocol);
1013           } else {
1014               atts = Application.getInstance().getAttendeeMgmt().getAttendees();
1015           }
1016  
1017           /*
1018            * Sort the attendees by their role into different lists
1019            */
1020           List<Attendee> reviewers = new ArrayList<Attendee>();
1021           List<Attendee> moderators = new ArrayList<Attendee>();
1022           List<Attendee> scribes = new ArrayList<Attendee>();
1023           List<Attendee> authors = new ArrayList<Attendee>();
1024           List<Attendee> customers = new ArrayList<Attendee>();
1025           List<Attendee> others = new ArrayList<Attendee>();
1026  
1027           for (Attendee att : atts) {
1028               switch (att.getRole()) {
1029               case AUTHOR:
1030                   authors.add(att);
1031                   break;
1032               case CUSTOMER:
1033                   customers.add(att);
1034                   break;
1035               case MODERATOR:
1036                   moderators.add(att);
1037                   break;
1038               case REVIEWER:
1039                   reviewers.add(att);
1040                   break;
1041               case SCRIBE:
1042                   scribes.add(att);
1043                   break;
1044               default:
1045                   others.add(att);
1046                   break;
1047               }
1048           }
1049  
1050           List<List<Attendee>> attendees = new ArrayList<List<Attendee>>();
1051           attendees.add(moderators);
1052           attendees.add(scribes);
1053           attendees.add(authors);
1054           attendees.add(customers);
1055           attendees.add(reviewers);
1056           attendees.add(others);
1057  
1058           /*
1059            * Write attendees
1060            */
1061           try {
1062               Font contactFont = new Font(BaseFont.createFont(BaseFont.HELVETICA,
1063                       BaseFont.CP1252, BaseFont.EMBEDDED), 10);
1064  
1065               Font nameFont = new Font(BaseFont
1066                       .createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
1067                               BaseFont.EMBEDDED), 10);
1068  
1069               Font roleFont = new Font(BaseFont.createFont(
1070                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
1071                       BaseFont.EMBEDDED), 10);
1072  
1073               Font aspectsFont = new Font(BaseFont.createFont(
1074                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
1075                       BaseFont.EMBEDDED), 8);
1076  
1077               Font aspectsTitleFont = new Font(BaseFont.createFont(
1078                       BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252,
1079                       BaseFont.EMBEDDED), 8);
1080  
1081               /*
1082                * Build base table for all attendees
1083                */
1084               PdfPTable tableAttendees = new PdfPTable(1);
1085               tableAttendees.setWidthPercentage(100);
1086               tableAttendees.setSplitRows(false);
1087               tableAttendees.getDefaultCell().setBorderWidth(0);
1088               tableAttendees.getDefaultCell().setPadding(0);
1089  
1090               boolean grayBackground = true;
1091  
1092               for (List<Attendee> attList : attendees) {
1093                   for (Attendee att : attList) {
1094                       /*
1095                        * Build table for one attendee
1096                        */
1097                       PdfPTable tableAttendee = new PdfPTable(new float[] {
1098                               0.80f, 0.20f });
1099                       tableAttendee.setWidthPercentage(100);
1100                       tableAttendee.getDefaultCell().setBorderWidth(0);
1101                       tableAttendee.getDefaultCell().setPadding(0);
1102  
1103                       PdfPCell cellAttendee = new PdfPCell();
1104                       cellAttendee.setPadding(0);
1105                       cellAttendee.setBorder(0);
1106  
1107                       /*
1108                        * Name of the attendee
1109                        */
1110                       PdfPCell cell = new PdfPCell();
1111                       cell.setBorderWidth(0);
1112                       cell.setPadding(padding * 0.4f);
1113                       cell.setPaddingBottom(padding * 1.5f);
1114                       cell.addElement(new Phrase(att.getName(), nameFont));
1115                       cell.addElement(new Phrase(att.getContact(), contactFont));
1116  
1117                       Phrase phraseStrut = new Phrase(" ");
1118                       phraseStrut.setLeading(leading * 0.6f);
1119  
1120                       /*
1121                        * Aspects of this attendee
1122                        */
1123                       if (!attMgmt.getAspects(att).isEmpty()
1124                               && showAttendeesAspects) {
1125                           String separator = "";
1126  
1127                           cell.addElement(phraseStrut);
1128  
1129                           cell.addElement(new Phrase(Data.getInstance()
1130                                   .getLocaleStr("export.attendeeAspects")
1131                                   + ": ", aspectsTitleFont));
1132  
1133                           Phrase phraseAspects = new Phrase();
1134                           phraseAspects.setLeading(leading);
1135                           phraseAspects.setFont(aspectsFont);
1136  
1137                           for (Aspect asp : attMgmt.getAspects(att)) {
1138                               phraseAspects.add(new Chunk(separator
1139                                       + asp.getDirective() + " ("
1140                                       + asp.getCategory() + ")", aspectsFont));
1141  
1142                               separator = "  ·  ";
1143                           }
1144  
1145                           cell.addElement(phraseAspects);
1146                       }
1147  
1148                       /*
1149                        * Preparation time of the attendee
1150                        */
1151                       Duration prepTime;
1152                       if (protocol != null) {
1153                           prepTime = protMgmt.getAttendeePrepTime(att, protocol);
1154                       } else {
1155                           prepTime = null;
1156                       }
1157  
1158                       if (prepTime != null && showAttendeesPrepTime) {
1159                           cell.addElement(phraseStrut);
1160  
1161                           cell.addElement(new Phrase(Data.getInstance()
1162                                   .getLocaleStr("export.attendeePrepTime")
1163                                   + ": ", aspectsTitleFont));
1164  
1165                           Phrase phrasePrepTime = new Phrase();
1166                           phrasePrepTime.setLeading(leading);
1167                           phrasePrepTime.setFont(aspectsFont);
1168  
1169                           String prep = "";
1170                           String separator = "";
1171  
1172                           if (prepTime.getDays() > 0) {
1173                               prep = prep
1174                                       + prepTime.getDays()
1175                                       + " "
1176                                       + Data.getInstance().getLocaleStr(
1177                                               "export.days");
1178  
1179                               separator = ", ";
1180                           }
1181  
1182                           if (prepTime.getHours() > 0) {
1183                               prep = prep
1184                                       + separator
1185                                       + prepTime.getHours()
1186                                       + " "
1187                                       + Data.getInstance().getLocaleStr(
1188                                               "export.hours");
1189  
1190                               separator = ", ";
1191                           }
1192  
1193                           if (prepTime.getMinutes() > 0) {
1194                               prep = prep
1195                                       + separator
1196                                       + prepTime.getMinutes()
1197                                       + " "
1198                                       + Data.getInstance().getLocaleStr(
1199                                               "export.minutes");
1200  
1201                               separator = ", ";
1202                           }
1203  
1204                           phrasePrepTime.add(new Chunk(prep, aspectsFont));
1205  
1206                           cell.addElement(phrasePrepTime);
1207                       }
1208  
1209                       /*
1210                        * Signature field for the attendee
1211                        */
1212                       if (showSignatureFields) {
1213                           cell.addElement(phraseStrut);
1214                           cell.addElement(phraseStrut);
1215                           cell.addElement(phraseStrut);
1216                           cell.addElement(phraseStrut);
1217  
1218                           cell.addElement(new Phrase(
1219                                   "________________________________________",
1220                                   aspectsFont));
1221  
1222                           cell.addElement(new Phrase(Data.getInstance()
1223                                   .getLocaleStr("export.attendeeSignature")
1224                                   + " (" + att.getName() + ")", aspectsFont));
1225                       }
1226  
1227                       tableAttendee.addCell(cell);
1228  
1229                       /*
1230                        * role of the attendee
1231                        */
1232                       cell = new PdfPCell(new Phrase(Data.getInstance()
1233                               .getLocaleStr(
1234                                       "role."
1235                                               + att.getRole().toString()
1236                                                       .toLowerCase()), roleFont));
1237                       cell.setBorderWidth(0);
1238                       cell.setPadding(padding * 0.4f);
1239                       cell.setPaddingTop(padding * 1.1f);
1240                       cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
1241  
1242                       tableAttendee.addCell(cell);
1243  
1244                       cellAttendee.addElement(tableAttendee);
1245                       cellAttendee.setPadding(0);
1246                       cellAttendee.setPaddingLeft(padding);
1247                       cellAttendee.setPaddingRight(padding);
1248  
1249                       if (grayBackground == true) {
1250                           grayBackground = false;
1251                           cellAttendee.setBackgroundColor(cellBackground);
1252                       } else {
1253                           grayBackground = true;
1254                       }
1255  
1256                       /*
1257                        * Add attendee to the list
1258                        */
1259                       tableAttendees.addCell(cellAttendee);
1260                   }
1261               }
1262  
1263               PdfPCell cellBottomLine = new PdfPCell();
1264               cellBottomLine.setPadding(0);
1265               cellBottomLine.setBorderWidth(0);
1266               cellBottomLine.setBorderWidthBottom(1);
1267               cellBottomLine.setBorderColor(cellBackground);
1268  
1269               tableAttendees.addCell(cellBottomLine);
1270  
1271               /*
1272                * Add the attendee base table to the document
1273                */
1274               pdfDoc.add(tableAttendees);
1275           } catch (Exception e) {
1276               /*
1277                * Not part of unit testing because this exception is only thrown if
1278                * an internal error occurs.
1279                */
1280               throw new ExportException(Data.getInstance().getLocaleStr(
1281                       "message.pdfWriteAttendeesFailed"));
1282           }
1283       }
1284  
1285       protected void writeFindings(Protocol protocol, boolean attachExtRefs)
1286               throws ExportException {
1287           try {
1288               Font plainFontTitle = new Font(BaseFont.createFont(
1289                       BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 9,
1290                       Font.NORMAL, Color.WHITE);
1291  
1292               Font boldFontTitle = new Font(BaseFont
1293                       .createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
1294                               BaseFont.EMBEDDED), 10, Font.NORMAL, Color.WHITE);
1295  
1296               Font plainFont = new Font(BaseFont.createFont(BaseFont.HELVETICA,
1297                       BaseFont.CP1252, BaseFont.EMBEDDED), 10);
1298  
1299               Font boldFont = new Font(BaseFont
1300                       .createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
1301                               BaseFont.EMBEDDED), 10);
1302  
1303               Font italicFont = new Font(BaseFont.createFont(
1304                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
1305                       BaseFont.EMBEDDED), 10);
1306  
1307               Font boldItalicFont = new Font(BaseFont.createFont(
1308                       BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252,
1309                       BaseFont.EMBEDDED), 10);
1310  
1311               PdfPTable tableBase = new PdfPTable(1);
1312               tableBase.setWidthPercentage(100);
1313               tableBase.setSplitRows(false);
1314               tableBase.getDefaultCell().setBorderWidth(0);
1315               tableBase.getDefaultCell().setPadding(0);
1316  
1317               for (Finding f : protocol.getFindings()) {
1318                   tableBase
1319                           .addCell(createVerticalStrut(PDFTools.cmToPt(0.7f), 1));
1320                   PdfPCell cellFinding = new PdfPCell();
1321                   cellFinding.setBorderColor(Color.GRAY);
1322                   cellFinding.setBorderWidth(0.5f);
1323  
1324                   PdfPTable tableTitle = new PdfPTable(3);
1325                   tableTitle.setWidthPercentage(100);
1326  
1327                   /*
1328                    * Print title of the finding
1329                    */
1330                   Phrase phraseTitle = new Phrase(Data.getInstance()
1331                           .getLocaleStr("export.finding")
1332                           + " " + f.getId(), boldFontTitle);
1333  
1334                   PdfPCell cellTitle = new PdfPCell(phraseTitle);
1335                   cellTitle.setBackgroundColor(bgColorTitle);
1336                   cellTitle.setBorderWidth(0);
1337                   cellTitle.setPadding(padding);
1338                   cellTitle.setPaddingBottom(padding * 1.5f);
1339                   cellTitle.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
1340  
1341                   tableTitle.addCell(cellTitle);
1342  
1343                   /*
1344                    * Print severity of the finding
1345                    */
1346                   Phrase phraseSeverity = new Phrase(Data.getInstance()
1347                           .getLocaleStr("export.severity")
1348                           + ": " + f.getSeverity(), plainFontTitle);
1349  
1350                   PdfPCell cellSeverity = new PdfPCell(phraseSeverity);
1351                   cellSeverity.setBackgroundColor(bgColorTitle);
1352                   cellSeverity.setBorderWidth(0);
1353                   cellSeverity.setPadding(padding);
1354                   cellSeverity.setPaddingTop(padding * 1.1f);
1355                   cellSeverity.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
1356  
1357                   tableTitle.addCell(cellSeverity);
1358  
1359                   /*
1360                    * Print the meeting date and time of the finding
1361                    */
1362                   String meetingDate = sdfDate.format(protocol.getDate()
1363                           .getTime());
1364  
1365                   String meetingTime = sdfTime.format(protocol.getStart()
1366                           .getTime())
1367                           + " - " + sdfTime.format(protocol.getEnd().getTime());
1368  
1369                   PdfPCell cellMeeting = new PdfPCell(new Phrase(meetingDate
1370                           + "  |  " + meetingTime, plainFontTitle));
1371                   cellMeeting.setBackgroundColor(bgColorTitle);
1372                   cellMeeting.setBorderWidth(0);
1373                   cellMeeting.setPadding(padding);
1374                   cellMeeting.setPaddingTop(padding * 1.1f);
1375                   cellMeeting.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
1376  
1377                   tableTitle.addCell(cellMeeting);
1378  
1379                   /*
1380                    * Description
1381                    */
1382                   Phrase phraseDesc = new Phrase(f.getDescription(), plainFont);
1383                   phraseDesc.setLeading(leading);
1384  
1385                   PdfPCell cellDesc = new PdfPCell();
1386                   cellDesc.addElement(phraseDesc);
1387                   cellDesc.setBorderWidth(0);
1388                   cellDesc.setPadding(padding);
1389                   cellDesc.setColspan(3);
1390  
1391                   tableTitle.addCell(cellDesc);
1392  
1393                   cellFinding.addElement(tableTitle);
1394  
1395                   /*
1396                    * List point used for lists
1397                    */
1398                   Phrase phraseListPoint = new Phrase("»", boldFont);
1399                   phraseListPoint.setLeading(leading * 0.93f);
1400  
1401                   PdfPCell cellListPoint = new PdfPCell();
1402                   cellListPoint.addElement(phraseListPoint);
1403                   cellListPoint.setBorderWidth(0);
1404                   cellListPoint.setPadding(padding);
1405                   cellListPoint.setPaddingLeft(padding * 2);
1406  
1407                   /*
1408                    * Table of references
1409                    */
1410                   if (f.getReferences().size() > 0
1411                           || (f.getExternalReferences().size() > 0 && attachExtRefs == true)) {
1412                       PdfPTable tableRefs = new PdfPTable(new float[] { 0.04f,
1413                               0.96f });
1414                       tableRefs.setWidthPercentage(100);
1415  
1416                       PdfPCell cellRefTitle = new PdfPCell(new Phrase(Data
1417                               .getInstance().getLocaleStr("export.references")
1418                               + ":", boldItalicFont));
1419                       cellRefTitle.setBorderWidth(0);
1420                       cellRefTitle.setPadding(padding);
1421                       cellRefTitle.setPaddingTop(padding * 3);
1422                       cellRefTitle.setPaddingBottom(0);
1423                       cellRefTitle.setColspan(2);
1424  
1425                       tableRefs.addCell(cellRefTitle);
1426  
1427                       /*
1428                        * Textual references
1429                        */
1430                       for (String ref : f.getReferences()) {
1431                           Phrase phraseRef = new Phrase(ref, plainFont);
1432                           phraseRef.setLeading(leading);
1433  
1434                           PdfPCell cellRef = new PdfPCell();
1435                           cellRef.addElement(phraseRef);
1436                           cellRef.setBorderWidth(0);
1437                           cellRef.setPadding(padding);
1438  
1439                           tableRefs.addCell(cellListPoint);
1440  
1441                           tableRefs.addCell(cellRef);
1442                       }
1443  
1444                       /*
1445                        * External file references
1446                        */
1447                       if (attachExtRefs == true) {
1448                           for (File ref : findMgmt.getExtReferences(f)) {
1449                               Phrase phraseRef = new Phrase();
1450                               phraseRef.add(new Chunk(ref.getName(), plainFont));
1451                               phraseRef.add(new Chunk(" ("
1452                                       + Data.getInstance().getLocaleStr(
1453                                               "export.fileAttachment") + ")",
1454                                       italicFont));
1455                               phraseRef.setFont(plainFont);
1456                               phraseRef.setLeading(leading);
1457  
1458                               PdfPCell cellRef = new PdfPCell();
1459                               cellRef.addElement(phraseRef);
1460                               cellRef.setBorderWidth(0);
1461                               cellRef.setPadding(padding);
1462  
1463                               tableRefs.addCell(cellListPoint);
1464  
1465                               cellRef.setCellEvent(new PDFCellEventExtRef(
1466                                       pdfWriter, ref));
1467  
1468                               tableRefs.addCell(cellRef);
1469                           }
1470                       }
1471  
1472                       cellFinding.addElement(tableRefs);
1473                   }
1474  
1475                   /*
1476                    * Table of aspects
1477                    */
1478                   if (f.getAspects().size() > 0) {
1479                       PdfPTable tableAspects = new PdfPTable(new float[] { 0.04f,
1480                               0.96f });
1481                       tableAspects.setWidthPercentage(100);
1482  
1483                       PdfPCell cellAspTitle = new PdfPCell(new Phrase(Data
1484                               .getInstance().getLocaleStr("export.aspects")
1485                               + ":", boldItalicFont));
1486                       cellAspTitle.setBorderWidth(0);
1487                       cellAspTitle.setPadding(padding);
1488                       cellAspTitle.setPaddingTop(padding * 3);
1489                       cellAspTitle.setPaddingBottom(0);
1490                       cellAspTitle.setColspan(2);
1491  
1492                       tableAspects.addCell(cellAspTitle);
1493  
1494                       for (String asp : f.getAspects()) {
1495                           Phrase phraseAsp = new Phrase(asp, plainFont);
1496                           phraseAsp.setLeading(leading);
1497  
1498                           PdfPCell cellAsp = new PdfPCell();
1499                           cellAsp.addElement(phraseAsp);
1500                           cellAsp.setBorderWidth(0);
1501                           cellAsp.setPadding(padding);
1502  
1503                           tableAspects.addCell(cellListPoint);
1504  
1505                           tableAspects.addCell(cellAsp);
1506                       }
1507  
1508                       cellFinding.addElement(tableAspects);
1509                   }
1510  
1511                   /*
1512                    * Vertical strut at the end of the table
1513                    */
1514                   PdfPTable tableStrut = new PdfPTable(1);
1515                   tableStrut.setWidthPercentage(100);
1516                   tableStrut.addCell(createVerticalStrut(padding, 1));
1517  
1518                   cellFinding.addElement(tableStrut);
1519  
1520                   tableBase.addCell(cellFinding);
1521               }
1522  
1523               pdfDoc.add(tableBase);
1524           } catch (Exception e) {
1525               /*
1526                * Not part of unit testing because this exception is only thrown if
1527                * an internal error occurs.
1528                */
1529               throw new ExportException(Data.getInstance().getLocaleStr(
1530                       "message.pdfWriteFindingsFailed"));
1531           }
1532       }
1533   }
PDFPageEventHelper.java
27   public class PDFPageEventHelper extends PdfPageEventHelper {
28  
29       private String headTitle = null;
30  
31       private String headLogoPath = null;
32  
33       private String footText = null;
34  
35       private PdfTemplate template = null;
36  
37       private BaseFont headBaseFont = null;
38       private BaseFont footBaseFont = null;
39  
40       private float headFontSize = 11;
41       private float footFontSize = 9;
42  
43       public PDFPageEventHelper(String headTitle, String headLogoPath,
44               String footText) {
45           if (headLogoPath == null || headLogoPath.equals("")) {
46               headLogoPath = null;
47           }
48  
49           if (footText == null || footText.equals("")) {
50               footText = null;
51           }
52  
53           this.headTitle = headTitle;
54           this.headLogoPath = headLogoPath;
55           this.footText = footText;
56       }
57  
58       private void setMarks(PdfWriter writer, Document document) {
59           PdfContentByte cb = writer.getDirectContent();
60           float height = PDFTools.ptToCm(document.getPageSize().getHeight());
61  
62           cb.setLineWidth(0.0f);
63  
64           cb.moveTo(0.0f, PDFTools.cmToPt(height / 2.0f));
65           cb.lineTo(PDFTools.cmToPt(0.3f), PDFTools.cmToPt(height / 2.0f));
66  
67           cb.moveTo(0.0f, PDFTools.cmToPt(height * 0.33f));
68           cb.lineTo(PDFTools.cmToPt(0.3f), PDFTools.cmToPt(height * 0.33f));
69  
70           cb.moveTo(0.0f, PDFTools.cmToPt(height * 0.66f));
71           cb.lineTo(PDFTools.cmToPt(0.3f), PDFTools.cmToPt(height * 0.66f));
72  
73           cb.stroke();
74       }
75  
76       @Override
77       public void onOpenDocument(PdfWriter writer, Document document) {
78           template = writer.getDirectContent().createTemplate(100, 100);
79       }
80  
81       @Override
82       public void onCloseDocument(PdfWriter writer, Document document) {
83           template.beginText();
84           template.setFontAndSize(footBaseFont, footFontSize);
85           template.setTextMatrix(0, 0);
86           template.showText(Integer.toString(writer.getPageNumber() - 1));
87           template.endText();
88       }
89  
90       @Override
91       public void onEndPage(PdfWriter writer, Document document) {
92           int columnNumber;
93  
94           try {
95               Rectangle page = document.getPageSize();
96               float pageWidth = page.getWidth() - document.leftMargin()
97                       - document.rightMargin();
98  
99               /*
100                * Write marks
101                */
102               setMarks(writer, document);
103  
104               /*
105                * Define fonts
106                */
107               headBaseFont = BaseFont.createFont(BaseFont.HELVETICA,
108                       BaseFont.CP1252, BaseFont.EMBEDDED);
109               Font headFont = new Font(headBaseFont, headFontSize);
110  
111               footBaseFont = BaseFont.createFont(BaseFont.HELVETICA_OBLIQUE,
112                       BaseFont.CP1252, BaseFont.EMBEDDED);
113               Font footFont = new Font(footBaseFont, footFontSize);
114  
115               /*
116                * Cell fill for space between head/foot and content
117                */
118               PdfPCell cellFill = new PdfPCell();
119               cellFill.setMinimumHeight(PDFTools.cmToPt(0.8f));
120               cellFill.setBorderWidth(0);
121  
122               /*
123                * Write head
124                */
125               if (headLogoPath != null) {
126                   columnNumber = 2;
127               } else {
128                   columnNumber = 1;
129               }
130  
131               PdfPTable head = new PdfPTable(columnNumber);
132  
133               Phrase phraseTitle = new Phrase(headTitle, headFont);
134  
135               PdfPCell cellTitle = new PdfPCell(phraseTitle);
136               cellTitle.setHorizontalAlignment(PdfPCell.ALIGN_LEFT);
137               cellTitle.setVerticalAlignment(PdfPCell.ALIGN_BOTTOM);
138               cellTitle.setPaddingTop(0);
139               cellTitle.setPaddingBottom(PDFTools.cmToPt(0.2f));
140               cellTitle.setPaddingLeft(0);
141               cellTitle.setPaddingRight(0);
142               cellTitle.setBorderWidthTop(0);
143               cellTitle.setBorderWidthBottom(0.5f);
144               cellTitle.setBorderWidthLeft(0);
145               cellTitle.setBorderWidthRight(0);
146  
147               head.addCell(cellTitle);
148  
149               if (headLogoPath != null) {
150                   Image headLogo = Image.getInstance(headLogoPath);
151                   headLogo.scaleToFit(PDFTools.cmToPt(5.0f), PDFTools
152                           .cmToPt(1.1f));
153  
154                   PdfPCell cellLogo = new PdfPCell(headLogo);
155                   cellLogo.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
156                   cellLogo.setVerticalAlignment(PdfPCell.ALIGN_BOTTOM);
157                   cellLogo.setPaddingTop(0);
158                   cellLogo.setPaddingBottom(PDFTools.cmToPt(0.15f));
159                   cellLogo.setPaddingLeft(0);
160                   cellLogo.setPaddingRight(0);
161                   cellLogo.setBorderWidthTop(0);
162                   cellLogo.setBorderWidthBottom(0.5f);
163                   cellLogo.setBorderWidthLeft(0);
164                   cellLogo.setBorderWidthRight(0);
165  
166                   head.addCell(cellLogo);
167  
168                   head.addCell(cellFill);
169               }
170  
171               head.addCell(cellFill);
172  
173               head.setTotalWidth(pageWidth);
174               head.writeSelectedRows(0, -1, document.leftMargin(), page
175                       .getHeight()
176                       - document.topMargin() + head.getTotalHeight(), writer
177                       .getDirectContent());
178  
179               /*
180                * Write foot
181                */
182               if (footText == null) {
183                   footText = " ";
184               }
185  
186               PdfPTable foot = new PdfPTable(1);
187  
188               foot.addCell(cellFill);
189  
190               PdfPCell cellFootText = new PdfPCell(new Phrase(footText, footFont));
191               cellFootText.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
192               cellFootText.setVerticalAlignment(PdfPCell.ALIGN_TOP);
193               cellFootText.setPaddingTop(PDFTools.cmToPt(0.15f));
194               cellFootText.setPaddingBottom(0);
195               cellFootText.setPaddingLeft(0);
196               cellFootText.setPaddingRight(0);
197               cellFootText.setBorderWidthTop(0.5f);
198               cellFootText.setBorderWidthBottom(0);
199               cellFootText.setBorderWidthLeft(0);
200               cellFootText.setBorderWidthRight(0);
201  
202               foot.addCell(cellFootText);
203  
204               /*
205                * Print page numbers
206                */
207               PdfContentByte contentByte = writer.getDirectContent();
208               contentByte.saveState();
209               String text = Data.getInstance().getLocaleStr("export.page") + " "
210                       + writer.getPageNumber() + " "
211                       + Data.getInstance().getLocaleStr("export.ofPages") + " ";
212               float textSize = footBaseFont.getWidthPoint(text, footFontSize);
213               float textBase = document.bottom() - PDFTools.cmToPt(1.26f);
214               contentByte.beginText();
215               contentByte.setFontAndSize(footBaseFont, footFontSize);
216  
217               float adjust;
218               if (footText.trim().equals("")) {
219                   adjust = (pageWidth / 2) - (textSize / 2)
220                           - footBaseFont.getWidthPoint("0", footFontSize);
221               } else {
222                   adjust = 0;
223               }
224  
225               contentByte.setTextMatrix(document.left() + adjust, textBase);
226               contentByte.showText(text);
227               contentByte.endText();
228               contentByte.addTemplate(template, document.left() + adjust
229                       + textSize, textBase);
230  
231               contentByte.stroke();
232               contentByte.restoreState();
233  
234               foot.setTotalWidth(pageWidth);
235               foot.writeSelectedRows(0, -1, document.leftMargin(), document
236                       .bottomMargin(), writer.getDirectContent());
237           } catch (Exception e) {
238               /*
239                * Not part of unit testing because this exception is only thrown if
240                * an internal error occurs.
241                */
242               throw new ExceptionConverter(e);
243           }
244       }
245   }
PDFExporter.java
22   public abstract class PDFExporter {
23  
24       protected PdfWriter pdfWriter = null;
25  
26       protected Document pdfDoc = null;
27  
28       protected float pageWidth;
29       protected float pageHeight;
30  
31       protected PDFExporter(String filePath, String headTitle,
32               String headLogoPath, String footText) throws ExportException {
33           pdfDoc = new Document(PageSize.A4, PDFTools.cmToPt(2), PDFTools
34                   .cmToPt(2), PDFTools.cmToPt(3.5f), PDFTools.cmToPt(3.2f));
35  
36           try {
37               pdfWriter = PdfWriter.getInstance(pdfDoc, new FileOutputStream(
38                       filePath));
39           } catch (Exception e) {
40               /*
41                * Not part of unit testing because this exception is only thrown if
42                * an internal error occurs.
43                */
44               throw new ExportException(Data.getInstance().getLocaleStr(
45                       "message.pdfWriteToFileFailed"));
46           }
47  
48           pdfWriter.setPageEvent(new PDFPageEventHelper(headTitle,
49                   headLogoPath, footText));
50  
51           pdfDoc.addAuthor(Data.getInstance().getResource("appName"));
52           pdfDoc.addCreator(Data.getInstance().getResource("appName"));
53           pdfDoc.addCreationDate();
54  
55           pdfDoc.addTitle(headTitle);
56           pdfDoc.addSubject(headTitle);
57  
58           Rectangle page = pdfDoc.getPageSize();
59           pageWidth = page.getWidth() - pdfDoc.leftMargin()
60                   - pdfDoc.rightMargin();
61           pageHeight = page.getHeight() - pdfDoc.topMargin()
62                   - pdfDoc.bottomMargin();
63       }
64  
65       /**
66        * Creates an empty PdfPTable cell with a defined height.
67        *
68        * @param height
69        *            of the created cell
70        * @return Empty cell with defined minimum height
71        */
72       protected PdfPCell createVerticalStrut(float height, int colspan) {
73           PdfPCell fill = new PdfPCell();
74  
75           fill.setColspan(colspan);
76           fill.setMinimumHeight(height);
77           fill.disableBorderSide(Table.LEFT | Table.RIGHT | Table.TOP
78                   | Table.BOTTOM);
79  
80           return fill;
81       }
82  
83       protected abstract void writeContent() throws ExportException;
84  
85       public void writeToFile() throws ExportException {
86           pdfDoc.open();
87  
88           writeContent();
89  
90           pdfDoc.close();
91       }
92  
93   }
PDFCellEventExtRef.java
23   public class PDFCellEventExtRef implements PdfPCellEvent {
24  
25       private PdfWriter writer = null;
26       private File file = null;
27  
28       public PDFCellEventExtRef(PdfWriter writer, File file) {
29           this.writer = writer;
30           this.file = file;
31       }
32  
33       @Override
34       public void cellLayout(PdfPCell cell, Rectangle rect,
35               PdfContentByte[] canvas) {
36           PdfContentByte cb = canvas[PdfPTable.LINECANVAS];
37  
38           // cb.reset();
39  
40           Rectangle attachmentRect = new Rectangle(rect.getLeft() - 25, rect
41                   .getTop() - 25, rect.getRight() - rect.getWidth() - 40, rect
42                   .getTop() - 10);
43  
44           String fileDesc = file.getName() + " ("
45                   + Data.getInstance().getLocaleStr("export.fileAttachment")
46                   + ")";
47  
48           try {
49               PdfAnnotation attachment = PdfAnnotation.createFileAttachment(
50                       writer, attachmentRect, fileDesc, null, file
51                               .getAbsolutePath(), file.getName());
52               writer.addAnnotation(attachment);
53           } catch (IOException e) {
54               /*
55                * just do not add a reference if the file was not found or another
56                * error occured.
57                */
58           }
59  
60           // cb.setColorStroke(new GrayColor(0.8f));
61           // cb.roundRectangle(rect.getLeft() + 4, rect.getBottom(),
62           // rect.getWidth() - 8, rect.getHeight() - 4, 4);
63  
64           cb.stroke();
65       }
66  
67   }
MeetingProtocolPDFExporter.java
17   public class MeetingProtocolPDFExporter extends ProtocolPDFExporter {
18  
19       private static ApplicationData appData = Data.getInstance().getAppData();
20       private static Review review = Data.getInstance().getResiData().getReview();
21  
22       private Meeting meeting = null;
23       private boolean showSignFields = false;
24       private boolean attachProdExtRefs = true;
25       private boolean attachFindExtRefs = true;
26  
27       public MeetingProtocolPDFExporter(String filePath, Meeting meeting,
28               boolean showSignFields, boolean attachProdExtRefs,
29               boolean attachFindExtRefs) throws ExportException, DataException {
30           super(filePath, Data.getInstance().getLocaleStr(
31                   "export.reviewProtocolTitle")
32                   + " · " + review.getName(), appData
33                   .getSetting(AppSettingKey.PDF_PROTOCOL_LOGO), appData
34                   .getSetting(AppSettingKey.PDF_PROTOCOL_FOOT_TEXT));
35  
36           this.meeting = meeting;
37           this.showSignFields = showSignFields;
38           this.attachProdExtRefs = attachProdExtRefs;
39           this.attachFindExtRefs = attachFindExtRefs;
40       }
41  
42       @Override
43       protected void writeContent() throws ExportException {
44           try {
45               /*
46                * Write the title page of the protocol
47                */
48               writeTitlePage(meeting, attachProdExtRefs);
49  
50               pdfDoc.newPage();
51  
52               /*
53                * Write the meeting
54                */
55               writeMeeting(meeting, attachFindExtRefs, showSignFields);
56           } catch (Exception e) {
57               /*
58                * Not part of unit testing because this exception is only thrown if
59                * an internal error occurs.
60                */
61               throw new ExportException(Data.getInstance().getLocaleStr(
62                       "message.pdfWriteProtocolFailed"));
63           }
64       }
65  
66   }
InvitationZIPExporter.java
23   public class InvitationZIPExporter {
24  
25       private ReviewManagement revMgmt = Application.getInstance()
26               .getReviewMgmt();
27  
28       private static final File WORK_DIRECTORY = new File(Data.getInstance()
29               .getAppData().getAppDataPath()
30               + Data.getInstance().getResource("workDirectoryName"));
31  
32       private static final File REVIEW_INFO_DOC = new File(WORK_DIRECTORY, Data
33               .getInstance().getLocaleStr("export.reviewInfoDocumentName"));
34  
35       private Meeting meeting = null;
36       private Attendee attendee = null;
37       private String filePath = null;
38       private List<File> files = new ArrayList<File>();
39  
40       public InvitationZIPExporter(String filePath, Meeting meeting,
41               Attendee attendee, boolean attachProdExtRefs) {
42           super();
43  
44           this.meeting = meeting;
45           this.attendee = attendee;
46           this.filePath = filePath;
47  
48           /*
49            * Recreate the work directory
50            */
51           if (WORK_DIRECTORY.exists()) {
52               FileTools.deleteDirectory(WORK_DIRECTORY);
53           }
54  
55           WORK_DIRECTORY.mkdir();
56  
57           /*
58            * List of external product references
59            */
60           if (attachProdExtRefs) {
61               for (File ref : revMgmt.getExtProdReferences()) {
62                   files.add(ref);
63               }
64           }
65       }
66  
67       public void writeToFile() throws ExportException, DataException {
68           new InvitationPDFExporter(REVIEW_INFO_DOC.getAbsolutePath(), meeting,
69                   attendee, false).writeToFile();
70  
71           files.add(new File(REVIEW_INFO_DOC.getAbsolutePath()));
72  
73           try {
74               FileTools.writeToZip(files, new File(filePath), false, true);
75           } catch (IOException e) {
76               /*
77                * Not part of unit testing because this exception is only thrown if
78                * an internal error occurs.
79                */
80               throw new ExportException(Data.getInstance().getLocaleStr(
81                       "message.invitationZipFileWriteFailed"));
82           }
83       }
84   }
InvitationPDFExporter.java
39   public class InvitationPDFExporter extends PDFExporter {
40  
41       private static ApplicationData appData = Data.getInstance().getAppData();
42       private static ResiData resiData = Data.getInstance().getResiData();
43       private static AttendeeManagement attMgmt = Application.getInstance()
44               .getAttendeeMgmt();
45       private static MeetingManagement meetMgmt = Application.getInstance()
46               .getMeetingMgmt();
47  
48       private float padding = PDFTools.cmToPt(0.2f);
49       private float leading = PDFTools.cmToPt(0.45f);
50       private Color cellBackground = new Color(235, 235, 235);
51  
52       private DateFormat sdfDate = SimpleDateFormat
53               .getDateInstance(SimpleDateFormat.LONG);
54       private DateFormat sdfTime = new SimpleDateFormat(Data.getInstance()
55               .getLocaleStr("format.time"));
56  
57       private Meeting meeting = null;
58       private Attendee attendee = null;
59       private boolean attachProdExtRefs = true;
60  
61       public InvitationPDFExporter(String filePath, Meeting meeting,
62               Attendee attendee, boolean attachProdExtRefs)
63               throws ExportException, DataException {
64           super(filePath, Data.getInstance().getLocaleStr(
65                   "export.reviewInvitationTitle")
66                   + " · " + resiData.getReview().getName(), appData
67                   .getSetting(AppSettingKey.PDF_INVITATION_LOGO), appData
68                   .getSetting(AppSettingKey.PDF_INVITATION_FOOT_TEXT));
69  
70           this.meeting = meeting;
71           this.attendee = attendee;
72           this.attachProdExtRefs = attachProdExtRefs;
73       }
74  
75       private void writeTitlePage() throws ExportException {
76           try {
77               Font plainFontTitle = new Font(BaseFont.createFont(
78                       BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 12);
79  
80               Font boldFontTitle = new Font(BaseFont
81                       .createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
82                               BaseFont.EMBEDDED), 12);
83  
84               Font boldItalicFontTitle = new Font(BaseFont.createFont(
85                       BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252,
86                       BaseFont.EMBEDDED), 12);
87  
88               Font plainFont = new Font(BaseFont.createFont(BaseFont.HELVETICA,
89                       BaseFont.CP1252, BaseFont.EMBEDDED), 10);
90  
91               Font boldFont = new Font(BaseFont
92                       .createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
93                               BaseFont.EMBEDDED), 10);
94  
95               Font boldItalicFont = new Font(BaseFont.createFont(
96                       BaseFont.HELVETICA_BOLDOBLIQUE, BaseFont.CP1252,
97                       BaseFont.EMBEDDED), 10);
98  
99               Font italicFont = new Font(BaseFont.createFont(
100                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
101                       BaseFont.EMBEDDED), 10);
102  
103               Font italicFontSmall = new Font(BaseFont.createFont(
104                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
105                       BaseFont.EMBEDDED), 9);
106  
107               Phrase phraseStrut = new Phrase(" ");
108               phraseStrut.setLeading(leading);
109  
110               /*
111                * date and time of the meeting
112                */
113               String meetingDate = sdfDate.format(meeting.getPlannedDate()
114                       .getTime());
115  
116               String meetingTime = sdfTime.format(meeting.getPlannedStart()
117                       .getTime())
118                       + " - " + sdfTime.format(meeting.getPlannedEnd().getTime());
119  
120               /*
121                * Base table
122                */
123               PdfPTable table = new PdfPTable(new float[] { 0.04f, 0.96f });
124               table.setWidthPercentage(100);
125               table.setSplitRows(false);
126               table.getDefaultCell().setBorderWidth(0);
127               table.getDefaultCell().setPadding(0);
128  
129               /*
130                * recipient of the invitation
131                */
132               PdfPCell cell = new PdfPCell();
133               cell.setBorder(0);
134               cell.setColspan(2);
135               cell.setPadding(padding);
136  
137               cell.addElement(phraseStrut);
138  
139               PdfPTable tableRecipient = new PdfPTable(2);
140               tableRecipient.setWidthPercentage(100);
141               tableRecipient.setSplitRows(false);
142               tableRecipient.getDefaultCell().setBorderWidth(0);
143               tableRecipient.getDefaultCell().setPadding(0);
144  
145               PdfPCell cellRecipient = new PdfPCell();
146               cellRecipient.setBorder(0);
147               cellRecipient.setPadding(0);
148               cellRecipient.addElement(new Phrase(Data.getInstance()
149                       .getLocaleStr("export.toRecipient"), plainFontTitle));
150               cellRecipient.addElement(new Phrase(attendee.getName(),
151                       boldFontTitle));
152  
153               tableRecipient.addCell(cellRecipient);
154  
155               PdfPCell cellDate = new PdfPCell(new Phrase(sdfDate
156                       .format(new Date().getTime()), plainFont));
157               cellDate.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
158               cellDate.setBorder(0);
159               cellDate.setPadding(0);
160               cellDate.setPaddingTop(7);
161  
162               tableRecipient.addCell(cellDate);
163  
164               cell.addElement(tableRecipient);
165  
166               cell.addElement(phraseStrut);
167               cell.addElement(phraseStrut);
168               cell.addElement(phraseStrut);
169  
170               /*
171                * subject
172                */
173               cell.addElement(new Phrase(Data.getInstance().getLocaleStr(
174                       "export.invitationSubject")
175                       + " " + meetingDate, boldItalicFontTitle));
176  
177               cell.addElement(phraseStrut);
178  
179               /*
180                * invitation text
181                */
182               Phrase phrase = new Phrase(Data.getInstance().getAppData()
183                       .getSetting(AppSettingKey.PDF_INVITATION_TEXT), plainFont);
184               phrase.setLeading(leading);
185  
186               cell.addElement(phrase);
187  
188               cell.addElement(phraseStrut);
189  
190               table.addCell(cell);
191  
192               /*
193                * meeting date, time and location
194                */
195               cell = new PdfPCell(new Phrase(meetingDate, boldItalicFont));
196               cell.setBorder(0);
197               cell.setColspan(2);
198               cell.setPadding(padding);
199               cell.setPaddingBottom(0);
200               cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
201  
202               table.addCell(cell);
203  
204               cell = new PdfPCell(new Phrase(meetingTime + " "
205                       + Data.getInstance().getLocaleStr("export.clock"),
206                       italicFont));
207               cell.setBorder(0);
208               cell.setColspan(2);
209               cell.setPadding(padding);
210               cell.setPaddingBottom(0);
211               cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
212  
213               table.addCell(cell);
214  
215               cell = new PdfPCell(new Phrase(Data.getInstance().getLocaleStr(
216                       "export.location")
217                       + ": " + meeting.getPlannedLocation(), italicFont));
218               cell.setBorder(0);
219               cell.setColspan(2);
220               cell.setPadding(padding);
221               cell.setPaddingBottom(0);
222               cell.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
223  
224               table.addCell(cell);
225  
226               /*
227                * role; review title and description
228                */
229               cell = new PdfPCell();
230               cell.setBorder(0);
231               cell.setColspan(2);
232               cell.setPadding(padding);
233  
234               cell.addElement(phraseStrut);
235               cell.addElement(phraseStrut);
236  
237               phrase = new Phrase();
238               phrase.setLeading(leading);
239               phrase.add(new Chunk(Data.getInstance().getLocaleStr(
240                       "export.invitationSubText1")
241                       + " ", plainFont));
242               phrase.add(new Chunk(Data.getInstance().getLocaleStr(
243                       "role." + attendee.getRole().toString().toLowerCase()),
244                       boldFont));
245               phrase.add(new Chunk(" "
246                       + Data.getInstance().getLocaleStr(
247                               "export.invitationSubText2") + " ", plainFont));
248               phrase.add(new Chunk(resiData.getReview().getName(), boldFont));
249               phrase.add(new Chunk(" "
250                       + Data.getInstance().getLocaleStr(
251                               "export.invitationSubText3"), plainFont));
252  
253               cell.addElement(phrase);
254  
255               cell.addElement(phraseStrut);
256  
257               cell.addElement(new Phrase(resiData.getReview().getDescription(),
258                       italicFont));
259  
260               cell.addElement(phraseStrut);
261  
262               /*
263                * Predecessor meeting
264                */
265               if (meetMgmt.getPredecessorMeeting(meeting) != null) {
266                   String preMeetingDate = sdfDate.format(meetMgmt
267                           .getPredecessorMeeting(meeting).getProtocol().getDate()
268                           .getTime());
269  
270                   cell.addElement(new Phrase(Data.getInstance().getLocaleStr(
271                           "export.successorMeetingText1")
272                           + " "
273                           + preMeetingDate
274                           + " "
275                           + Data.getInstance().getLocaleStr(
276                                   "export.successorMeetingText2"), plainFont));
277  
278                   cell.addElement(phraseStrut);
279               }
280  
281               /*
282                * the product of this review
283                */
284               cell.addElement(new Phrase(Data.getInstance().getLocaleStr(
285                       "export.invitationProduct"), plainFont));
286               cell.addElement(phraseStrut);
287  
288               table.addCell(cell);
289  
290               /*
291                * Write name and version of the reviewed product
292                */
293               Phrase phrName = new Phrase(Data.getInstance().getResiData()
294                       .getReview().getProduct().getName(), boldItalicFont);
295               phrName.setLeading(leading);
296  
297               PdfPCell cellName = new PdfPCell(phrName);
298               cellName.setColspan(2);
299               cellName.setBorderWidth(0);
300               cellName.setPadding(padding);
301               cellName.setPaddingBottom(0);
302               cellName.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
303  
304               table.addCell(cellName);
305  
306               Phrase phrVersion = new Phrase(Data.getInstance().getLocaleStr(
307                       "export.productVersion")
308                       + ": "
309                       + Data.getInstance().getResiData().getReview().getProduct()
310                               .getVersion(), italicFont);
311               phrVersion.setLeading(leading);
312  
313               PdfPCell cellVersion = new PdfPCell(phrVersion);
314               cellVersion.setColspan(2);
315               cellVersion.setBorderWidth(0);
316               cellVersion.setPadding(padding);
317               cellVersion.setPaddingBottom(0);
318               cellVersion.setHorizontalAlignment(PdfPCell.ALIGN_CENTER);
319  
320               table.addCell(cellVersion);
321  
322               table.addCell(createVerticalStrut(PDFTools.cmToPt(0.7f), 2));
323  
324               boolean showBottomStrut = false;
325  
326               /*
327                * List point used for lists
328                */
329               Phrase phraseListPoint = new Phrase("»", boldFont);
330               phraseListPoint.setLeading(leading);
331  
332               PdfPCell cellListPoint = new PdfPCell();
333               cellListPoint.addElement(phraseListPoint);
334               cellListPoint.setBorderWidth(0);
335               cellListPoint.setPadding(padding);
336               cellListPoint.setPaddingLeft(padding * 2);
337               cellListPoint.setPaddingBottom(0);
338  
339               /*
340                * Textual references
341                */
342               for (String ref : Application.getInstance().getReviewMgmt()
343                       .getProductReferences()) {
344                   Phrase phraseRef = new Phrase(ref, italicFontSmall);
345                   phraseRef.setLeading(leading);
346  
347                   PdfPCell cellRef = new PdfPCell();
348                   cellRef.addElement(phraseRef);
349                   cellRef.setBorderWidth(0);
350                   cellRef.setPadding(padding);
351                   cellRef.setPaddingBottom(0);
352  
353                   table.addCell(cellListPoint);
354  
355                   table.addCell(cellRef);
356  
357                   showBottomStrut = true;
358               }
359  
360               /*
361                * External file references
362                */
363               for (File ref : Application.getInstance().getReviewMgmt()
364                       .getExtProdReferences()) {
365                   Phrase phraseRef = new Phrase();
366                   phraseRef.add(new Chunk(ref.getName(), italicFontSmall));
367                   phraseRef
368                           .add(new Chunk(" ("
369                                   + Data.getInstance().getLocaleStr(
370                                           "export.fileAttachment") + ")",
371                                   italicFontSmall));
372                   phraseRef.setFont(plainFont);
373                   phraseRef.setLeading(leading);
374  
375                   PdfPCell cellRef = new PdfPCell();
376                   cellRef.addElement(phraseRef);
377                   cellRef.setBorderWidth(0);
378                   cellRef.setPadding(padding);
379                   cellRef.setPaddingBottom(0);
380  
381                   table.addCell(cellListPoint);
382  
383                   if (attachProdExtRefs) {
384                       cellRef
385                               .setCellEvent(new PDFCellEventExtRef(pdfWriter, ref));
386                   }
387  
388                   table.addCell(cellRef);
389  
390                   showBottomStrut = true;
391               }
392  
393               if (showBottomStrut) {
394                   table.addCell(createVerticalStrut(PDFTools.cmToPt(0.4f), 2));
395               }
396  
397               /*
398                * "please prepare" for the reviwers; on questions ask moderators
399                */
400               cell = new PdfPCell();
401               cell.setBorder(0);
402               cell.setColspan(2);
403               cell.setPadding(padding);
404  
405               phrase = new Phrase();
406               phrase.setLeading(leading);
407  
408               if (attendee.getAspects() != null) {
409                   phrase.add(new Chunk(Data.getInstance().getLocaleStr(
410                           "export.pleasePrepareAspects")
411                           + " ", plainFont));
412               }
413  
414               List<Attendee> moderators = new ArrayList<Attendee>();
415               for (Attendee a : resiData.getReview().getAttendees()) {
416                   if (a.getRole() == Role.MODERATOR) {
417                       moderators.add(a);
418                   }
419               }
420  
421               if (moderators.size() == 1 && attendee.getRole() != Role.MODERATOR) {
422                   phrase.add(new Chunk(Data.getInstance().getLocaleStr(
423                           "export.askModerator")
424                           + " ", plainFont));
425               } else if (moderators.size() > 1
426                       && attendee.getRole() != Role.MODERATOR) {
427                   phrase.add(new Chunk(Data.getInstance().getLocaleStr(
428                           "export.askModerators")
429                           + " ", plainFont));
430               }
431  
432               cell.addElement(phrase);
433  
434               Phrase phraseStrutSmall = new Phrase(" ");
435               phraseStrutSmall.setLeading(leading / 2);
436  
437               if (moderators.size() > 0 && attendee.getRole() != Role.MODERATOR) {
438                   for (Attendee mod : moderators) {
439                       cell.addElement(phraseStrutSmall);
440                       cell.addElement(new Phrase(mod.getName(), boldFont));
441                       cell.addElement(new Phrase(mod.getContact(), italicFont));
442                   }
443               }
444  
445               table.addCell(cell);
446  
447               pdfDoc.add(table);
448           } catch (Exception e) {
449               /*
450                * Not part of unit testing because this exception is only thrown if
451                * an internal error occurs.
452                */
453               throw new ExportException(Data.getInstance().getLocaleStr(
454                       "message.pdfCreateTitlePageFailed"));
455           }
456       }
457  
458       private void writeAspects() throws ExportException {
459           try {
460               Font descriptionFont = new Font(BaseFont.createFont(
461                       BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED), 10);
462  
463               Font directiveFont = new Font(BaseFont
464                       .createFont(BaseFont.HELVETICA_BOLD, BaseFont.CP1252,
465                               BaseFont.EMBEDDED), 10);
466  
467               Font categoryFont = new Font(BaseFont.createFont(
468                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
469                       BaseFont.EMBEDDED), 10);
470  
471               Font reviewerFont = new Font(BaseFont.createFont(
472                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
473                       BaseFont.EMBEDDED), 9);
474  
475               /*
476                * Build base table for all attendees
477                */
478               PdfPTable tableAspects = new PdfPTable(1);
479               tableAspects.setWidthPercentage(100);
480               tableAspects.setSplitRows(false);
481               tableAspects.getDefaultCell().setBorderWidth(0);
482               tableAspects.getDefaultCell().setPadding(0);
483  
484               boolean grayBackground = true;
485  
486               /*
487                * If the role of the attendee is not reviewer show all aspects
488                */
489               List<Aspect> aspects = null;
490  
491               if (attendee.getRole() == Role.REVIEWER) {
492                   aspects = attMgmt.getAspects(attendee);
493               } else {
494                   aspects = resiData.getReview().getAspects();
495               }
496  
497               for (Aspect asp : aspects) {
498                   /*
499                    * Build table for one aspect
500                    */
501                   PdfPTable tableAspect = new PdfPTable(new float[] { 0.70f,
502                           0.30f });
503                   tableAspect.setWidthPercentage(100);
504                   tableAspect.getDefaultCell().setBorderWidth(0);
505                   tableAspect.getDefaultCell().setPadding(0);
506  
507                   PdfPCell cellAspect = new PdfPCell();
508                   cellAspect.setPadding(0);
509                   cellAspect.setBorder(0);
510  
511                   Phrase phraseStrut = new Phrase(" ");
512                   phraseStrut.setLeading(leading * 0.4f);
513  
514                   /*
515                    * directive and description of the aspect
516                    */
517                   PdfPCell cell = new PdfPCell();
518                   cell.setBorderWidth(0);
519                   cell.setPadding(padding * 0.4f);
520                   cell.setPaddingBottom(padding * 1.5f);
521                   cell.addElement(new Phrase(asp.getDirective(), directiveFont));
522                   cell.addElement(phraseStrut);
523                   cell.addElement(new Phrase(asp.getDescription(),
524                           descriptionFont));
525  
526                   /*
527                    * the reviewers of this aspect (moderator only)
528                    */
529                   if (attendee.getRole() == Role.MODERATOR) {
530                       cell.addElement(phraseStrut);
531                       cell.addElement(phraseStrut);
532  
533                       String separator = "";
534  
535                       Phrase phraseReviewers = new Phrase();
536                       phraseReviewers.setLeading(leading);
537                       phraseReviewers.setFont(reviewerFont);
538  
539                       for (Attendee att : attMgmt.getAttendees()) {
540                           if (attMgmt.hasAspect(asp, att)) {
541                               phraseReviewers.add(new Chunk(separator
542                                       + att.getName(), reviewerFont));
543  
544                               separator = "  ·  ";
545                           }
546                       }
547  
548                       cell.addElement(phraseReviewers);
549                   }
550  
551                   tableAspect.addCell(cell);
552  
553                   /*
554                    * category of the aspect
555                    */
556                   cell = new PdfPCell(new Phrase(asp.getCategory(), categoryFont));
557                   cell.setBorderWidth(0);
558                   cell.setPadding(padding * 0.4f);
559                   cell.setPaddingTop(padding * 1.1f);
560                   cell.setHorizontalAlignment(PdfPCell.ALIGN_RIGHT);
561  
562                   tableAspect.addCell(cell);
563  
564                   cellAspect.addElement(tableAspect);
565                   cellAspect.setPadding(0);
566                   cellAspect.setPaddingLeft(padding);
567                   cellAspect.setPaddingRight(padding);
568  
569                   if (grayBackground == true) {
570                       grayBackground = false;
571                       cellAspect.setBackgroundColor(cellBackground);
572                   } else {
573                       grayBackground = true;
574                   }
575  
576                   /*
577                    * Add aspect to the list
578                    */
579                   tableAspects.addCell(cellAspect);
580               }
581  
582               PdfPCell cellBottomLine = new PdfPCell();
583               cellBottomLine.setPadding(0);
584               cellBottomLine.setBorderWidth(0);
585               cellBottomLine.setBorderWidthBottom(1);
586               cellBottomLine.setBorderColor(cellBackground);
587  
588               tableAspects.addCell(cellBottomLine);
589  
590               /*
591                * Add the attendee base table to the document
592                */
593               pdfDoc.add(tableAspects);
594           } catch (Exception e) {
595               /*
596                * Not part of unit testing because this exception is only thrown if
597                * an internal error occurs.
598                */
599               throw new ExportException(Data.getInstance().getLocaleStr(
600                       "message.pdfWriteAspectsFailed"));
601           }
602       }
603  
604       @Override
605       protected void writeContent() throws ExportException {
606           try {
607               writeTitlePage();
608  
609               Font italicFont = new Font(BaseFont.createFont(
610                       BaseFont.HELVETICA_OBLIQUE, BaseFont.CP1252,
611                       BaseFont.EMBEDDED), 10);
612  
613               PdfPTable tableAspIntro = new PdfPTable(1);
614               tableAspIntro.setWidthPercentage(100);
615  
616               Phrase phraseAspIntro;
617  
618               PdfPCell cellAspIntro = new PdfPCell();
619               cellAspIntro.setBorderWidth(0);
620               cellAspIntro.setPadding(0);
621               cellAspIntro.setPaddingBottom(PDFTools.cmToPt(0.8f));
622  
623               if (attendee.getAspects() != null) {
624                   pdfDoc.newPage();
625  
626                   phraseAspIntro = new Phrase(Data.getInstance().getLocaleStr(
627                           "export.aspectsIntroReviewers"), italicFont);
628  
629                   cellAspIntro.addElement(phraseAspIntro);
630  
631                   tableAspIntro.addCell(cellAspIntro);
632  
633                   pdfDoc.add(tableAspIntro);
634               } else if (attendee.getRole() != Role.REVIEWER) {
635                   pdfDoc.newPage();
636  
637                   phraseAspIntro = new Phrase(Data.getInstance().getLocaleStr(
638                           "export.aspectsIntroGeneral"), italicFont);
639  
640                   cellAspIntro.addElement(phraseAspIntro);
641  
642                   tableAspIntro.addCell(cellAspIntro);
643  
644                   pdfDoc.add(tableAspIntro);
645               }
646  
647               writeAspects();
648           } catch (Exception e) {
649               /*
650                * Not part of unit testing because this exception is only thrown if
651                * an internal error occurs.
652                */
653               throw new ExportException(Data.getInstance().getLocaleStr(
654                       "message.pdfWriteInvitationFailed")
655                       + "\n\n" + e.getMessage());
656           }
657       }
658  
659   }
InvitationDirExporter.java
21   public class InvitationDirExporter {
22  
23       private ReviewManagement revMgmt = Application.getInstance()
24               .getReviewMgmt();
25  
26       private File reviewInfoDoc = null;
27       private Meeting meeting = null;
28       private Attendee attendee = null;
29       private File directory = null;
30       private boolean attachProdExtRefs = true;
31  
32       public InvitationDirExporter(String dirPath, Meeting meeting,
33               Attendee attendee, boolean attachProdExtRefs) {
34           super();
35  
36           this.meeting = meeting;
37           this.attendee = attendee;
38           this.directory = new File(dirPath);
39           this.attachProdExtRefs = attachProdExtRefs;
40  
41           this.reviewInfoDoc = new File(directory, Data.getInstance()
42                   .getLocaleStr("export.reviewInfoDocumentName"));
43       }
44  
45       public void writeDir() throws ExportException, DataException {
46           /*
47            * create directory
48            */
49           if (directory.exists()) {
50               FileTools.deleteDirectory(directory);
51           }
52  
53           directory.mkdir();
54  
55           /*
56            * write review info file
57            */
58           new InvitationPDFExporter(reviewInfoDoc.getAbsolutePath(), meeting,
59                   attendee, false).writeToFile();
60  
61           /*
62            * external product references
63            */
64           if (attachProdExtRefs) {
65               for (File ref : revMgmt.getExtProdReferences()) {
66                   try {
67                       FileTools.copyFile(ref, new File(directory, ref.getName()));
68                   } catch (IOException e) {
69                       /*
70                        * Not part of unit testing because this exception is only
71                        * thrown if an internal error occurs.
72                        */
73                       throw new ExportException(Data.getInstance().getLocaleStr(
74                               "message.invitationDirWriteFailed"));
75                   }
76               }
77           }
78       }
79  
80   }
FindingsCSVExporter.java
22   public class FindingsCSVExporter extends CSVExporter {
23  
24       private ReviewManagement revMgmt = Application.getInstance()
25               .getReviewMgmt();
26       private FindingManagement findMgmt = Application.getInstance()
27               .getFindingMgmt();
28  
29       private List<AppCSVColumnName> columnOrder = null;
30       private Map<String, String> severityMappings = null;
31       private List<Finding> findings = null;
32       private String reporter = null;
33  
34       public FindingsCSVExporter(AppCSVProfile csvProfile,
35               Map<String, String> severityMappings, List<Finding> findings,
36               String reporter) {
37           super();
38  
39           try {
40               this.columnOrder = csvProfile.getColumnOrder();
41               this.severityMappings = severityMappings;
42               this.findings = findings;
43               this.reporter = reporter;
44  
45               if (csvProfile.isEncapsulateContent()) {
46                   setEncapsulator("'");
47               }
48  
49               setColumns(columnOrder.size());
50  
51               if (csvProfile.isColsInFirstLine()) {
52                   csvHead = new String[getColumns()];
53  
54                   int index = 0;
55                   for (AppCSVColumnName col : columnOrder) {
56                       csvHead[index] = csvProfile.getColumnMapping(col);
57  
58                       index++;
59                   }
60               }
61           } catch (Exception e) {
62               /*
63                * Not part of unit testing because this exception is only thrown if
64                * an internal error occurs.
65                */
66               new ExportException(e.getMessage());
67           }
68       }
69  
70       public void addSeverityMapping(String sevName, String sevMapping) {
71           if (severityMappings == null) {
72               severityMappings = new HashMap<String, String>();
73           }
74  
75           severityMappings.put(sevName, sevMapping);
76       }
77  
78       @Override
79       protected void writeContent() {
80           for (Finding f : findings) {
81               String[] csvLine = newLine();
82               int index = 0;
83  
84               /*
85                * Write a line with each column
86                */
87               for (AppCSVColumnName col : columnOrder) {
88                   switch (col) {
89                   case DESCRIPTION:
90                       csvLine[index] = f.getDescription()
91                               + " ("
92                               + Data.getInstance().getLocaleStr(
93                                       "export.csvReviewFinding") + " "
94                               + f.getId() + ")";
95                       break;
96  
97                   case REFERENCE:
98                       String references = Data.getInstance().getLocaleStr(
99                               "export.csvReferenceText");
100                       references = references.replace("<findingId>", Integer
101                               .toString(f.getId()));
102                       references = references.replace("<reviewTitle>", revMgmt
103                               .getReviewName());
104                       references = references.replace("<productName>", revMgmt
105                               .getProductName());
106                       references = references.replace("<productVersion>", revMgmt
107                               .getProductVersion());
108  
109                       String refSep = "";
110                       String refs = "";
111                       for (String ref : findMgmt.getReferences(f)) {
112                           refs = refs + refSep + ref;
113                           refSep = " ** ";
114                       }
115  
116                       if (refs.equals("")) {
117                           refs = "--";
118                       }
119  
120                       references = references
121                               .replace("<productReferences>", refs);
122  
123                       csvLine[index] = references;
124                       break;
125  
126                   case REPORTER:
127                       csvLine[index] = reporter;
128                       break;
129  
130                   case SEVERITY:
131                       if (severityMappings != null
132                               && severityMappings.get(f.getSeverity()) != null) {
133                           csvLine[index] = severityMappings.get(f.getSeverity());
134                       } else {
135                           /*
136                            * Not part of unit testing because the Resi XML schema
137                            * says that each finding has a severity.
138                            */
139                           csvLine[index] = f.getSeverity();
140                       }
141                       break;
142  
143                   default:
144                       break;
145                   }
146  
147                   index++;
148               }
149  
150               csvDoc.add(csvLine);
151           }
152       }
153  
154   }
ExportException.java
28   @SuppressWarnings("serial")
29   public class ExportException extends Exception {
30  
31       public ExportException() {
32           super();
33       }
34  
35       public ExportException(String message) {
36           super(message);
37       }
38  
39   }
CSVExporter.java
15   public abstract class CSVExporter {
16  
17       private String separator = null;
18       private String encapsulator = null;
19       private int columns = 1;
20  
21       protected List<String[]> csvDoc = new ArrayList<String[]>();
22       protected String[] csvHead = null;
23  
24       protected CSVExporter() {
25           super();
26  
27           setSeparator(",");
28       }
29  
30       protected abstract void writeContent();
31  
32       protected String[] newLine() {
33           return new String[columns];
34       }
35  
36       /**
37        *
38        * @param filePath
39        * @throws ExportException
40        */
41       public void writeToFile(String filePath) throws ExportException {
42           writeContent();
43  
44           try {
45               OutputStreamWriter writer = new OutputStreamWriter(
46                       new FileOutputStream(filePath), "UTF-8");
47  
48               StringBuilder csvLine = new StringBuilder();
49  
50               List<String[]> csvContent = csvDoc;
51  
52               if (csvHead != null) {
53                   csvContent.add(0, csvHead);
54               }
55  
56               for (String[] line : csvContent) {
57                   csvLine.delete(0, csvLine.length());
58                   String sep = "";
59  
60                   for (String cell : line) {
61  
62                       /*
63                        * Replace encapsulator and separator chars in cell string
64                        */
65                       csvLine.append(sep);
66  
67                       if (encapsulator != null) {
68                           if (encapsulator.equals("'")) {
69                               cell = cell.replace(encapsulator, "\"");
70                           } else {
71                               cell = cell.replace(encapsulator, "'");
72                           }
73  
74                           csvLine.append(encapsulator);
75                       } else {
76                           if (separator.equals(";")) {
77                               cell = cell.replace(separator, ",");
78                           } else {
79                               cell = cell.replace(separator, ";");
80                           }
81                       }
82  
83                       csvLine.append(cell);
84  
85                       if (encapsulator != null) {
86                           csvLine.append(encapsulator);
87                       }
88  
89                       sep = separator;
90                   }
91  
92                   writer.write(csvLine.toString());
93                   writer.write('\n');
94               }
95  
96               writer.flush();
97  
98               writer.close();
99           } catch (Exception e) {
100               /*
101                * Not part of unit testing because this exception is only thrown if
102                * an internal error occurs.
103                */
104               throw new ExportException(e.getMessage());
105           }
106       }
107  
108       /**
109        * @return the separator
110        */
111       public String getSeparator() {
112           return separator;
113       }
114  
115       /**
116        * @param separator
117        *            the separator to set
118        */
119       public void setSeparator(String separator) {
120           if (separator != null && !separator.equals("")) {
121               this.separator = separator;
122           } else {
123               this.separator = ",";
124           }
125       }
126  
127       /**
128        * @return the encapsulator
129        */
130       public String getEncapsulator() {
131           return encapsulator;
132       }
133  
134       /**
135        * @param encapsulator
136        *            the encapsulator to set
137        */
138       public void setEncapsulator(String encapsulator) {
139           if (encapsulator != null && !encapsulator.equals("")) {
140               this.encapsulator = encapsulator;
141           } else {
142               this.encapsulator = null;
143           }
144       }
145  
146       /**
147        * @return the columns
148        */
149       public int getColumns() {
150           return columns;
151       }
152  
153       /**
154        * @param columns
155        *            the columns to set
156        */
157       public void setColumns(int columns) {
158           if (columns > 1) {
159               this.columns = columns;
160           } else {
161               this.columns = 1;
162           }
163       }
164  
165   }
Severities.java
44   @XmlAccessorType(XmlAccessType.FIELD)
45   @XmlType(name = "severitiesType", propOrder = {
46       "severities"
47   })
48   public class Severities {
49  
50       @XmlElement(name = "severity", required = true)
51       protected List<String> severities;
52  
53       /**
54        * Gets the value of the severities property.
55        *
56        * <p>
57        * This accessor method returns a reference to the live list,
58        * not a snapshot. Therefore any modification you make to the
59        * returned list will be present inside the JAXB object.
60        * This is why there is not a <CODE>set</CODE> method for the severities property.
61        *
62        * <p>
63        * For example, to add a new item, do as follows:
64        * <pre>
65        *    getSeverities().add(newItem);
66        * </pre>
67        *
68        *
69        * <p>
70        * Objects of the following type(s) are allowed in the list
71        * {@link String }
72        *
73        *
74        */
75       public List<String> getSeverities() {
76           if (severities == null) {
77               severities = new ArrayList<String>();
78           }
79           return this.severities;
80       }
81  
82       public boolean isSetSeverities() {
83           return ((this.severities!= null)&&(!this.severities.isEmpty()));
84       }
85  
86       public void unsetSeverities() {
87           this.severities = null;
88       }
89  
90   }
Role.java
34   @XmlType(name = "roleType")
35   @XmlEnum
36   public enum Role {
37  
38       @XmlEnumValue("moderator")
39       MODERATOR("moderator"),
40       @XmlEnumValue("scribe")
41       SCRIBE("scribe"),
42       @XmlEnumValue("reviewer")
43       REVIEWER("reviewer"),
44       @XmlEnumValue("author")
45       AUTHOR("author"),
46       @XmlEnumValue("customer")
47       CUSTOMER("customer");
48       private final String value;
49  
50       Role(String v) {
51           value = v;
52       }
53  
54       public String value() {
55           return value;
56       }
57  
58       public static Role fromValue(String v) {
59           for (Role c: Role.values()) {
60               if (c.value.equals(v)) {
61                   return c;
62               }
63           }
64           throw new IllegalArgumentException(v);
65       }
66  
67   }
Review.java
54   @XmlAccessorType(XmlAccessType.FIELD)
55   @XmlType(name = "reviewType", propOrder = {
56       "name",
57       "description",
58       "product",
59       "attendees",
60       "aspects",
61       "severities",
62       "meetings",
63       "impression",
64       "recommendation",
65       "comments"
66   })
67   public class Review {
68  
69       @XmlElement(required = true)
70       protected String name;
71       @XmlElement(required = true)
72       protected String description;
73       @XmlElement(required = true)
74       protected Product product;
75       @XmlElement(name = "attendee", required = true)
76       protected List<Attendee> attendees;
77       @XmlElement(name = "aspect", required = true)
78       protected List<Aspect> aspects;
79       @XmlElement(required = true)
80       protected Severities severities;
81       @XmlElement(name = "meeting", required = true)
82       protected List<Meeting> meetings;
83       @XmlElement(required = true)
84       protected String impression;
85       @XmlElement(required = true)
86       protected String recommendation;
87       @XmlElement(required = true)
88       protected String comments;
89  
90       /**
91        * Gets the value of the name property.
92        *
93        * @return
94        *     possible object is
95        *     {@link String }
96        *    
97        */
98       public String getName() {
99           return name;
100       }
101  
102       /**
103        * Sets the value of the name property.
104        *
105        * @param value
106        *     allowed object is
107        *     {@link String }
108        *    
109        */
110       public void setName(String value) {
111           this.name = value;
112       }
113  
114       public boolean isSetName() {
115           return (this.name!= null);
116       }
117  
118       /**
119        * Gets the value of the description property.
120        *
121        * @return
122        *     possible object is
123        *     {@link String }
124        *    
125        */
126       public String getDescription() {
127           return description;
128       }
129  
130       /**
131        * Sets the value of the description property.
132        *
133        * @param value
134        *     allowed object is
135        *     {@link String }
136        *    
137        */
138       public void setDescription(String value) {
139           this.description = value;
140       }
141  
142       public boolean isSetDescription() {
143           return (this.description!= null);
144       }
145  
146       /**
147        * Gets the value of the product property.
148        *
149        * @return
150        *     possible object is
151        *     {@link Product }
152        *    
153        */
154       public Product getProduct() {
155           return product;
156       }
157  
158       /**
159        * Sets the value of the product property.
160        *
161        * @param value
162        *     allowed object is
163        *     {@link Product }
164        *    
165        */
166       public void setProduct(Product value) {
167           this.product = value;
168       }
169  
170       public boolean isSetProduct() {
171           return (this.product!= null);
172       }
173  
174       /**
175        * Gets the value of the attendees property.
176        *
177        * <p>
178        * This accessor method returns a reference to the live list,
179        * not a snapshot. Therefore any modification you make to the
180        * returned list will be present inside the JAXB object.
181        * This is why there is not a <CODE>set</CODE> method for the attendees property.
182        *
183        * <p>
184        * For example, to add a new item, do as follows:
185        * <pre>
186        *    getAttendees().add(newItem);
187        * </pre>
188        *
189        *
190        * <p>
191        * Objects of the following type(s) are allowed in the list
192        * {@link Attendee }
193        *
194        *
195        */
196       public List<Attendee> getAttendees() {
197           if (attendees == null) {
198               attendees = new ArrayList<Attendee>();
199           }
200           return this.attendees;
201       }
202  
203       public boolean isSetAttendees() {
204           return ((this.attendees!= null)&&(!this.attendees.isEmpty()));
205       }
206  
207       public void unsetAttendees() {
208           this.attendees = null;
209       }
210  
211       /**
212        * Gets the value of the aspects property.
213        *
214        * <p>
215        * This accessor method returns a reference to the live list,
216        * not a snapshot. Therefore any modification you make to the
217        * returned list will be present inside the JAXB object.
218        * This is why there is not a <CODE>set</CODE> method for the aspects property.
219        *
220        * <p>
221        * For example, to add a new item, do as follows:
222        * <pre>
223        *    getAspects().add(newItem);
224        * </pre>
225        *
226        *
227        * <p>
228        * Objects of the following type(s) are allowed in the list
229        * {@link Aspect }
230        *
231        *
232        */
233       public List<Aspect> getAspects() {
234           if (aspects == null) {
235               aspects = new ArrayList<Aspect>();
236           }
237           return this.aspects;
238       }
239  
240       public boolean isSetAspects() {
241           return ((this.aspects!= null)&&(!this.aspects.isEmpty()));
242       }
243  
244       public void unsetAspects() {
245           this.aspects = null;
246       }
247  
248       /**
249        * Gets the value of the severities property.
250        *
251        * @return
252        *     possible object is
253        *     {@link Severities }
254        *    
255        */
256       public Severities getSeverities() {
257           return severities;
258       }
259  
260       /**
261        * Sets the value of the severities property.
262        *
263        * @param value
264        *     allowed object is
265        *     {@link Severities }
266        *    
267        */
268       public void setSeverities(Severities value) {
269           this.severities = value;
270       }
271  
272       public boolean isSetSeverities() {
273           return (this.severities!= null);
274       }
275  
276       /**
277        * Gets the value of the meetings property.
278        *
279        * <p>
280        * This accessor method returns a reference to the live list,
281        * not a snapshot. Therefore any modification you make to the
282        * returned list will be present inside the JAXB object.
283        * This is why there is not a <CODE>set</CODE> method for the meetings property.
284        *
285        * <p>
286        * For example, to add a new item, do as follows:
287        * <pre>
288        *    getMeetings().add(newItem);
289        * </pre>
290        *
291        *
292        * <p>
293        * Objects of the following type(s) are allowed in the list
294        * {@link Meeting }
295        *
296        *
297        */
298       public List<Meeting> getMeetings() {
299           if (meetings == null) {
300               meetings = new ArrayList<Meeting>();
301           }
302           return this.meetings;
303       }
304  
305       public boolean isSetMeetings() {
306           return ((this.meetings!= null)&&(!this.meetings.isEmpty()));
307       }
308  
309       public void unsetMeetings() {
310           this.meetings = null;
311       }
312  
313       /**
314        * Gets the value of the impression property.
315        *
316        * @return
317        *     possible object is
318        *     {@link String }
319        *    
320        */
321       public String getImpression() {
322           return impression;
323       }
324  
325       /**
326        * Sets the value of the impression property.
327        *
328        * @param value
329        *     allowed object is
330        *     {@link String }
331        *    
332        */
333       public void setImpression(String value) {
334           this.impression = value;
335       }
336  
337       public boolean isSetImpression() {
338           return (this.impression!= null);
339       }
340  
341       /**
342        * Gets the value of the recommendation property.
343        *
344        * @return
345        *     possible object is
346        *     {@link String }
347        *    
348        */
349       public String getRecommendation() {
350           return recommendation;
351       }
352  
353       /**
354        * Sets the value of the recommendation property.
355        *
356        * @param value
357        *     allowed object is
358        *     {@link String }
359        *    
360        */
361       public void setRecommendation(String value) {
362           this.recommendation = value;
363       }
364  
365       public boolean isSetRecommendation() {
366           return (this.recommendation!= null);
367       }
368  
369       /**
370        * Gets the value of the comments property.
371        *
372        * @return
373        *     possible object is
374        *     {@link String }
375        *    
376        */
377       public String getComments() {
378           return comments;
379       }
380  
381       /**
382        * Sets the value of the comments property.
383        *
384        * @param value
385        *     allowed object is
386        *     {@link String }
387        *    
388        */
389       public void setComments(String value) {
390           this.comments = value;
391       }
392  
393       public boolean isSetComments() {
394           return (this.comments!= null);
395       }
396  
397   }
Protocol.java
50   @XmlAccessorType(XmlAccessType.FIELD)
51   @XmlType(name = "protocolType", propOrder = {
52       "date",
53       "start",
54       "end",
55       "location",
56       "attendeeReferences",
57       "findings",
58       "comments"
59   })
60   public class Protocol {
61  
62       @XmlElement(required = true, type = String.class)
63       @XmlJavaTypeAdapter(Adapter5 .class)
64       @XmlSchemaType(name = "date")
65       protected Calendar date;
66       @XmlElement(required = true, type = String.class)
67       @XmlJavaTypeAdapter(Adapter6 .class)
68       @XmlSchemaType(name = "time")
69       protected Calendar start;
70       @XmlElement(required = true, type = String.class)
71       @XmlJavaTypeAdapter(Adapter7 .class)
72       @XmlSchemaType(name = "time")
73       protected Calendar end;
74       @XmlElement(required = true)
75       protected String location;
76       @XmlElement(name = "attendee", required = true)
77       protected List<AttendeeReference> attendeeReferences;
78       @XmlElement(name = "finding", required = true)
79       protected List<Finding> findings;
80       @XmlElement(required = true)
81       protected String comments;
82  
83       /**
84        * Gets the value of the date property.
85        *
86        * @return
87        *     possible object is
88        *     {@link String }
89        *    
90        */
91       public Calendar getDate() {
92           return date;
93       }
94  
95       /**
96        * Sets the value of the date property.
97        *
98        * @param value
99        *     allowed object is
100        *     {@link String }
101        *    
102        */
103       public void setDate(Calendar value) {
104           this.date = value;
105       }
106  
107       public boolean isSetDate() {
108           return (this.date!= null);
109       }
110  
111       /**
112        * Gets the value of the start property.
113        *
114        * @return
115        *     possible object is
116        *     {@link String }
117        *    
118        */
119       public Calendar getStart() {
120           return start;
121       }
122  
123       /**
124        * Sets the value of the start property.
125        *
126        * @param value
127        *     allowed object is
128        *     {@link String }
129        *    
130        */
131       public void setStart(Calendar value) {
132           this.start = value;
133       }
134  
135       public boolean isSetStart() {
136           return (this.start!= null);
137       }
138  
139       /**
140        * Gets the value of the end property.
141        *
142        * @return
143        *     possible object is
144        *     {@link String }
145        *    
146        */
147       public Calendar getEnd() {
148           return end;
149       }
150  
151       /**
152        * Sets the value of the end property.
153        *
154        * @param value
155        *     allowed object is
156        *     {@link String }
157        *    
158        */
159       public void setEnd(Calendar value) {
160           this.end = value;
161       }
162  
163       public boolean isSetEnd() {
164           return (this.end!= null);
165       }
166  
167       /**
168        * Gets the value of the location property.
169        *
170        * @return
171        *     possible object is
172        *     {@link String }
173        *    
174        */
175       public String getLocation() {
176           return location;
177       }
178  
179       /**
180        * Sets the value of the location property.
181        *
182        * @param value
183        *     allowed object is
184        *     {@link String }
185        *    
186        */
187       public void setLocation(String value) {
188           this.location = value;
189       }
190  
191       public boolean isSetLocation() {
192           return (this.location!= null);
193       }
194  
195       /**
196        * Gets the value of the attendeeReferences property.
197        *
198        * <p>
199        * This accessor method returns a reference to the live list,
200        * not a snapshot. Therefore any modification you make to the
201        * returned list will be present inside the JAXB object.
202        * This is why there is not a <CODE>set</CODE> method for the attendeeReferences property.
203        *
204        * <p>
205        * For example, to add a new item, do as follows:
206        * <pre>
207        *    getAttendeeReferences().add(newItem);
208        * </pre>
209        *
210        *
211        * <p>
212        * Objects of the following type(s) are allowed in the list
213        * {@link AttendeeReference }
214        *
215        *
216        */
217       public List<AttendeeReference> getAttendeeReferences() {
218           if (attendeeReferences == null) {
219               attendeeReferences = new ArrayList<AttendeeReference>();
220           }
221           return this.attendeeReferences;
222       }
223  
224       public boolean isSetAttendeeReferences() {
225           return ((this.attendeeReferences!= null)&&(!this.attendeeReferences.isEmpty()));
226       }
227  
228       public void unsetAttendeeReferences() {
229           this.attendeeReferences = null;
230       }
231  
232       /**
233        * Gets the value of the findings property.
234        *
235        * <p>
236        * This accessor method returns a reference to the live list,
237        * not a snapshot. Therefore any modification you make to the
238        * returned list will be present inside the JAXB object.
239        * This is why there is not a <CODE>set</CODE> method for the findings property.
240        *
241        * <p>
242        * For example, to add a new item, do as follows:
243        * <pre>
244        *    getFindings().add(newItem);
245        * </pre>
246        *
247        *
248        * <p>
249        * Objects of the following type(s) are allowed in the list
250        * {@link Finding }
251        *
252        *
253        */
254       public List<Finding> getFindings() {
255           if (findings == null) {
256               findings = new ArrayList<Finding>();
257           }
258           return this.findings;
259       }
260  
261       public boolean isSetFindings() {
262           return ((this.findings!= null)&&(!this.findings.isEmpty()));
263       }
264  
265       public void unsetFindings() {
266           this.findings = null;
267       }
268  
269       /**
270        * Gets the value of the comments property.
271        *
272        * @return
273        *     possible object is
274        *     {@link String }
275        *    
276        */
277       public String getComments() {
278           return comments;
279       }
280  
281       /**
282        * Sets the value of the comments property.
283        *
284        * @param value
285        *     allowed object is
286        *     {@link String }
287        *    
288        */
289       public void setComments(String value) {
290           this.comments = value;
291       }
292  
293       public boolean isSetComments() {
294           return (this.comments!= null);
295       }
296  
297   }
Product.java
43   @XmlAccessorType(XmlAccessType.FIELD)
44   @XmlType(name = "productType", propOrder = {
45       "name",
46       "references",
47       "version"
48   })
49   public class Product {
50  
51       @XmlElement(required = true)
52       protected String name;
53       @XmlElement(name = "reference", required = true)
54       protected List<String> references;
55       @XmlElement(required = true)
56       protected String version;
57  
58       /**
59        * Gets the value of the name property.
60        *
61        * @return
62        *     possible object is
63        *     {@link String }
64        *    
65        */
66       public String getName() {
67           return name;
68       }
69  
70       /**
71        * Sets the value of the name property.
72        *
73        * @param value
74        *     allowed object is
75        *     {@link String }
76        *    
77        */
78       public void setName(String value) {
79           this.name = value;
80       }
81  
82       public boolean isSetName() {
83           return (this.name!= null);
84       }
85  
86       /**
87        * Gets the value of the references property.
88        *
89        * <p>
90        * This accessor method returns a reference to the live list,
91        * not a snapshot. Therefore any modification you make to the
92        * returned list will be present inside the JAXB object.
93        * This is why there is not a <CODE>set</CODE> method for the references property.
94        *
95        * <p>
96        * For example, to add a new item, do as follows:
97        * <pre>
98        *    getReferences().add(newItem);
99        * </pre>
100        *
101        *
102        * <p>
103        * Objects of the following type(s) are allowed in the list
104        * {@link String }
105        *
106        *
107        */
108       public List<String> getReferences() {
109           if (references == null) {
110               references = new ArrayList<String>();
111           }
112           return this.references;
113       }
114  
115       public boolean isSetReferences() {
116           return ((this.references!= null)&&(!this.references.isEmpty()));
117       }
118  
119       public void unsetReferences() {
120           this.references = null;
121       }
122  
123       /**
124        * Gets the value of the version property.
125        *
126        * @return
127        *     possible object is
128        *     {@link String }
129        *    
130        */
131       public String getVersion() {
132           return version;
133       }
134  
135       /**
136        * Sets the value of the version property.
137        *
138        * @param value
139        *     allowed object is
140        *     {@link String }
141        *    
142        */
143       public void setVersion(String value) {
144           this.version = value;
145       }
146  
147       public boolean isSetVersion() {
148           return (this.version!= null);
149       }
150  
151   }
ObjectFactory.java
31   @XmlRegistry
32   public class ObjectFactory {
33  
34       private final static QName _Review_QNAME = new QName("http://www.informatik.uni-stuttgart.de/iste/se", "review");
35       private final static QName _Aspects_QNAME = new QName("http://www.informatik.uni-stuttgart.de/iste/se", "aspects");
36       private final static QName _Catalog_QNAME = new QName("http://www.informatik.uni-stuttgart.de/iste/se", "catalog");
37  
38       /**
39        * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.revager.app.model.schema
40        *
41        */
42       public ObjectFactory() {
43       }
44  
45       /**
46        * Create an instance of {@link Meeting }
47        *
48        */
49       public Meeting createMeeting() {
50           return new Meeting();
51       }
52  
53       /**
54        * Create an instance of {@link Finding }
55        *
56        */
57       public Finding createFinding() {
58           return new Finding();
59       }
60  
61       /**
62        * Create an instance of {@link Review }
63        *
64        */
65       public Review createReview() {
66           return new Review();
67       }
68  
69       /**
70        * Create an instance of {@link Severities }
71        *
72        */
73       public Severities createSeverities() {
74           return new Severities();
75       }
76  
77       /**
78        * Create an instance of {@link AspectsIds }
79        *
80        */
81       public AspectsIds createAspectsIds() {
82           return new AspectsIds();
83       }
84  
85       /**
86        * Create an instance of {@link Attendee }
87        *
88        */
89       public Attendee createAttendee() {
90           return new Attendee();
91       }
92  
93       /**
94        * Create an instance of {@link AttendeeReference }
95        *
96        */
97       public AttendeeReference createAttendeeReference() {
98           return new AttendeeReference();
99       }
100  
101       /**
102        * Create an instance of {@link Aspects }
103        *
104        */
105       public Aspects createAspects() {
106           return new Aspects();
107       }
108  
109       /**
110        * Create an instance of {@link Product }
111        *
112        */
113       public Product createProduct() {
114           return new Product();
115       }
116  
117       /**
118        * Create an instance of {@link Catalog }
119        *
120        */
121       public Catalog createCatalog() {
122           return new Catalog();
123       }
124  
125       /**
126        * Create an instance of {@link Aspect }
127        *
128        */
129       public Aspect createAspect() {
130           return new Aspect();
131       }
132  
133       /**
134        * Create an instance of {@link Protocol }
135        *
136        */
137       public Protocol createProtocol() {
138           return new Protocol();
139       }
140  
141       /**
142        * Create an instance of {@link JAXBElement }{@code <}{@link Review }{@code >}}
143        *
144        */
145       @XmlElementDecl(namespace = "http://www.informatik.uni-stuttgart.de/iste/se", name = "review")
146       public JAXBElement<Review> createReview(Review value) {
147           return new JAXBElement<Review>(_Review_QNAME, Review.class, null, value);
148       }
149  
150       /**
151        * Create an instance of {@link JAXBElement }{@code <}{@link Aspects }{@code >}}
152        *
153        */
154       @XmlElementDecl(namespace = "http://www.informatik.uni-stuttgart.de/iste/se", name = "aspects")
155       public JAXBElement<Aspects> createAspects(Aspects value) {
156           return new JAXBElement<Aspects>(_Aspects_QNAME, Aspects.class, null, value);
157       }
158  
159       /**
160        * Create an instance of {@link JAXBElement }{@code <}{@link Catalog }{@code >}}
161        *
162        */
163       @XmlElementDecl(namespace = "http://www.informatik.uni-stuttgart.de/iste/se", name = "catalog")
164       public JAXBElement<Catalog> createCatalog(Catalog value) {
165           return new JAXBElement<Catalog>(_Catalog_QNAME, Catalog.class, null, value);
166       }
167  
168   }
Meeting.java
47   @XmlAccessorType(XmlAccessType.FIELD)
48   @XmlType(name = "meetingType", propOrder = {
49       "plannedDate",
50       "plannedStart",
51       "plannedEnd",
52       "plannedLocation",
53       "protocol",
54       "canceled",
55       "comments"
56   })
57   public class Meeting {
58  
59       @XmlElement(name = "planned-date", required = true, type = String.class)
60       @XmlJavaTypeAdapter(Adapter1 .class)
61       @XmlSchemaType(name = "date")
62       protected Calendar plannedDate;
63       @XmlElement(name = "planned-start", required = true, type = String.class)
64       @XmlJavaTypeAdapter(Adapter2 .class)
65       @XmlSchemaType(name = "time")
66       protected Calendar plannedStart;
67       @XmlElement(name = "planned-end", required = true, type = String.class)
68       @XmlJavaTypeAdapter(Adapter3 .class)
69       @XmlSchemaType(name = "time")
70       protected Calendar plannedEnd;
71       @XmlElement(name = "planned-location", required = true)
72       protected String plannedLocation;
73       protected Protocol protocol;
74       protected String canceled;
75       @XmlElement(required = true)
76       protected String comments;
77  
78       /**
79        * Gets the value of the plannedDate property.
80        *
81        * @return
82        *     possible object is
83        *     {@link String }
84        *    
85        */
86       public Calendar getPlannedDate() {
87           return plannedDate;
88       }
89  
90       /**
91        * Sets the value of the plannedDate property.
92        *
93        * @param value
94        *     allowed object is
95        *     {@link String }
96        *    
97        */
98       public void setPlannedDate(Calendar value) {
99           this.plannedDate = value;
100       }
101  
102       public boolean isSetPlannedDate() {
103           return (this.plannedDate!= null);
104       }
105  
106       /**
107        * Gets the value of the plannedStart property.
108        *
109        * @return
110        *     possible object is
111        *     {@link String }
112        *    
113        */
114       public Calendar getPlannedStart() {
115           return plannedStart;
116       }
117  
118       /**
119        * Sets the value of the plannedStart property.
120        *
121        * @param value
122        *     allowed object is
123        *     {@link String }
124        *    
125        */
126       public void setPlannedStart(Calendar value) {
127           this.plannedStart = value;
128       }
129  
130       public boolean isSetPlannedStart() {
131           return (this.plannedStart!= null);
132       }
133  
134       /**
135        * Gets the value of the plannedEnd property.
136        *
137        * @return
138        *     possible object is
139        *     {@link String }
140        *    
141        */
142       public Calendar getPlannedEnd() {
143           return plannedEnd;
144       }
145  
146       /**
147        * Sets the value of the plannedEnd property.
148        *
149        * @param value
150        *     allowed object is
151        *     {@link String }
152        *    
153        */
154       public void setPlannedEnd(Calendar value) {
155           this.plannedEnd = value;
156       }
157  
158       public boolean isSetPlannedEnd() {
159           return (this.plannedEnd!= null);
160       }
161  
162       /**
163        * Gets the value of the plannedLocation property.
164        *
165        * @return
166        *     possible object is
167        *     {@link String }
168        *    
169        */
170       public String getPlannedLocation() {
171           return plannedLocation;
172       }
173  
174       /**
175        * Sets the value of the plannedLocation property.
176        *
177        * @param value
178        *     allowed object is
179        *     {@link String }
180        *    
181        */
182       public void setPlannedLocation(String value) {
183           this.plannedLocation = value;
184       }
185  
186       public boolean isSetPlannedLocation() {
187           return (this.plannedLocation!= null);
188       }
189  
190       /**
191        * Gets the value of the protocol property.
192        *
193        * @return
194        *     possible object is
195        *     {@link Protocol }
196        *    
197        */
198       public Protocol getProtocol() {
199           return protocol;
200       }
201  
202       /**
203        * Sets the value of the protocol property.
204        *
205        * @param value
206        *     allowed object is
207        *     {@link Protocol }
208        *    
209        */
210       public void setProtocol(Protocol value) {
211           this.protocol = value;
212       }
213  
214       public boolean isSetProtocol() {
215           return (this.protocol!= null);
216       }
217  
218       /**
219        * Gets the value of the canceled property.
220        *
221        * @return
222        *     possible object is
223        *     {@link String }
224        *    
225        */
226       public String getCanceled() {
227           return canceled;
228       }
229  
230       /**
231        * Sets the value of the canceled property.
232        *
233        * @param value
234        *     allowed object is
235        *     {@link String }
236        *    
237        */
238       public void setCanceled(String value) {
239           this.canceled = value;
240       }
241  
242       public boolean isSetCanceled() {
243           return (this.canceled!= null);
244       }
245  
246       /**
247        * Gets the value of the comments property.
248        *
249        * @return
250        *     possible object is
251        *     {@link String }
252        *    
253        */
254       public String getComments() {
255           return comments;
256       }
257  
258       /**
259        * Sets the value of the comments property.
260        *
261        * @param value
262        *     allowed object is
263        *     {@link String }
264        *    
265        */
266       public void setComments(String value) {
267           this.comments = value;
268       }
269  
270       public boolean isSetComments() {
271           return (this.comments!= null);
272       }
273  
274   }
Finding.java
49   @XmlAccessorType(XmlAccessType.FIELD)
50   @XmlType(name = "findingType", propOrder = {
51       "id",
52       "severity",
53       "description",
54       "references",
55       "aspects",
56       "externalReferences"
57   })
58   public class Finding {
59  
60       @XmlElement(required = true, type = String.class)
61       @XmlJavaTypeAdapter(Adapter4 .class)
62       @XmlSchemaType(name = "nonNegativeInteger")
63       protected Integer id;
64       @XmlElement(required = true)
65       protected String severity;
66       @XmlElement(required = true)
67       protected String description;
68       @XmlElement(name = "reference")
69       protected List<String> references;
70       @XmlElement(name = "aspect")
71       protected List<String> aspects;
72       @XmlElement(name = "external-reference")
73       @XmlSchemaType(name = "anyURI")
74       protected List<String> externalReferences;
75  
76       /**
77        * Gets the value of the id property.
78        *
79        * @return
80        *     possible object is
81        *     {@link String }
82        *    
83        */
84       public Integer getId() {
85           return id;
86       }
87  
88       /**
89        * Sets the value of the id property.
90        *
91        * @param value
92        *     allowed object is
93        *     {@link String }
94        *    
95        */
96       public void setId(Integer value) {
97           this.id = value;
98       }
99  
100       public boolean isSetId() {
101           return (this.id!= null);
102       }
103  
104       /**
105        * Gets the value of the severity property.
106        *
107        * @return
108        *     possible object is
109        *     {@link String }
110        *    
111        */
112       public String getSeverity() {
113           return severity;
114       }
115  
116       /**
117        * Sets the value of the severity property.
118        *
119        * @param value
120        *     allowed object is
121        *     {@link String }
122        *    
123        */
124       public void setSeverity(String value) {
125           this.severity = value;
126       }
127  
128       public boolean isSetSeverity() {
129           return (this.severity!= null);
130       }
131  
132       /**
133        * Gets the value of the description property.
134        *
135        * @return
136        *     possible object is
137        *     {@link String }
138        *    
139        */
140       public String getDescription() {
141           return description;
142       }
143  
144       /**
145        * Sets the value of the description property.
146        *
147        * @param value
148        *     allowed object is
149        *     {@link String }
150        *    
151        */
152       public void setDescription(String value) {
153           this.description = value;
154       }
155  
156       public boolean isSetDescription() {
157           return (this.description!= null);
158       }
159  
160       /**
161        * Gets the value of the references property.
162        *
163        * <p>
164        * This accessor method returns a reference to the live list,
165        * not a snapshot. Therefore any modification you make to the
166        * returned list will be present inside the JAXB object.
167        * This is why there is not a <CODE>set</CODE> method for the references property.
168        *
169        * <p>
170        * For example, to add a new item, do as follows:
171        * <pre>
172        *    getReferences().add(newItem);
173        * </pre>
174        *
175        *
176        * <p>
177        * Objects of the following type(s) are allowed in the list
178        * {@link String }
179        *
180        *
181        */
182       public List<String> getReferences() {
183           if (references == null) {
184               references = new ArrayList<String>();
185           }
186           return this.references;
187       }
188  
189       public boolean isSetReferences() {
190           return ((this.references!= null)&&(!this.references.isEmpty()));
191       }
192  
193       public void unsetReferences() {
194           this.references = null;
195       }
196  
197       /**
198        * Gets the value of the aspects property.
199        *
200        * <p>
201        * This accessor method returns a reference to the live list,
202        * not a snapshot. Therefore any modification you make to the
203        * returned list will be present inside the JAXB object.
204        * This is why there is not a <CODE>set</CODE> method for the aspects property.
205        *
206        * <p>
207        * For example, to add a new item, do as follows:
208        * <pre>
209        *    getAspects().add(newItem);
210        * </pre>
211        *
212        *
213        * <p>
214        * Objects of the following type(s) are allowed in the list
215        * {@link String }
216        *
217        *
218        */
219       public List<String> getAspects() {
220           if (aspects == null) {
221               aspects = new ArrayList<String>();
222           }
223           return this.aspects;
224       }
225  
226       public boolean isSetAspects() {
227           return ((this.aspects!= null)&&(!this.aspects.isEmpty()));
228       }
229  
230       public void unsetAspects() {
231           this.aspects = null;
232       }
233  
234       /**
235        * Gets the value of the externalReferences property.
236        *
237        * <p>
238        * This accessor method returns a reference to the live list,
239        * not a snapshot. Therefore any modification you make to the
240        * returned list will be present inside the JAXB object.
241        * This is why there is not a <CODE>set</CODE> method for the externalReferences property.
242        *
243        * <p>
244        * For example, to add a new item, do as follows:
245        * <pre>
246        *    getExternalReferences().add(newItem);
247        * </pre>
248        *
249        *
250        * <p>
251        * Objects of the following type(s) are allowed in the list
252        * {@link String }
253        *
254        *
255        */
256       public List<String> getExternalReferences() {
257           if (externalReferences == null) {
258               externalReferences = new ArrayList<String>();
259           }
260           return this.externalReferences;
261       }
262  
263       public boolean isSetExternalReferences() {
264           return ((this.externalReferences!= null)&&(!this.externalReferences.isEmpty()));
265       }
266  
267       public void unsetExternalReferences() {
268           this.externalReferences = null;
269       }
270  
271   }
Catalog.java
41   @XmlAccessorType(XmlAccessType.FIELD)
42   @XmlType(name = "catalogExchangeType", propOrder = {
43       "description",
44       "aspects"
45   })
46   public class Catalog {
47  
48       @XmlElement(required = true)
49       protected String description;
50       @XmlElement(required = true)
51       protected Aspects aspects;
52  
53       /**
54        * Gets the value of the description property.
55        *
56        * @return
57        *     possible object is
58        *     {@link String }
59        *    
60        */
61       public String getDescription() {
62           return description;
63       }
64  
65       /**
66        * Sets the value of the description property.
67        *
68        * @param value
69        *     allowed object is
70        *     {@link String }
71        *    
72        */
73       public void setDescription(String value) {
74           this.description = value;
75       }
76  
77       public boolean isSetDescription() {
78           return (this.description!= null);
79       }
80  
81       /**
82        * Gets the value of the aspects property.
83        *
84        * @return
85        *     possible object is
86        *     {@link Aspects }
87        *    
88        */
89       public Aspects getAspects() {
90           return aspects;
91       }
92  
93       /**
94        * Sets the value of the aspects property.
95        *
96        * @param value
97        *     allowed object is
98        *     {@link Aspects }
99        *    
100        */
101       public void setAspects(Aspects value) {
102           this.aspects = value;
103       }
104  
105       public boolean isSetAspects() {
106           return (this.aspects!= null);
107       }
108  
109   }
AttendeeReference.java
41   @XmlAccessorType(XmlAccessType.FIELD)
42   @XmlType(name = "attendeeReferenceType", propOrder = {
43       "attendee",
44       "preparationTime"
45   })
46   public class AttendeeReference {
47  
48       @XmlElement(required = true)
49       protected String attendee;
50       @XmlElement(name = "preparation-time")
51       protected Duration preparationTime;
52  
53       /**
54        * Gets the value of the attendee property.
55        *
56        * @return
57        *     possible object is
58        *     {@link String }
59        *    
60        */
61       public String getAttendee() {
62           return attendee;
63       }
64  
65       /**
66        * Sets the value of the attendee property.
67        *
68        * @param value
69        *     allowed object is
70        *     {@link String }
71        *    
72        */
73       public void setAttendee(String value) {
74           this.attendee = value;
75       }
76  
77       public boolean isSetAttendee() {
78           return (this.attendee!= null);
79       }
80  
81       /**
82        * Gets the value of the preparationTime property.
83        *
84        * @return
85        *     possible object is
86        *     {@link Duration }
87        *    
88        */
89       public Duration getPreparationTime() {
90           return preparationTime;
91       }
92  
93       /**
94        * Sets the value of the preparationTime property.
95        *
96        * @param value
97        *     allowed object is
98        *     {@link Duration }
99        *    
100        */
101       public void setPreparationTime(Duration value) {
102           this.preparationTime = value;
103       }
104  
105       public boolean isSetPreparationTime() {
106           return (this.preparationTime!= null);
107       }
108  
109   }
Attendee.java
43   @XmlAccessorType(XmlAccessType.FIELD)
44   @XmlType(name = "attendeeType", propOrder = {
45       "id",
46       "name",
47       "contact",
48       "role",
49       "aspects"
50   })
51   public class Attendee {
52  
53       @XmlElement(required = true)
54       protected String id;
55       @XmlElement(required = true)
56       protected String name;
57       @XmlElement(required = true)
58       protected String contact;
59       @XmlElement(required = true)
60       protected Role role;
61       protected AspectsIds aspects;
62  
63       /**
64        * Gets the value of the id property.
65        *
66        * @return
67        *     possible object is
68        *     {@link String }
69        *    
70        */
71       public String getId() {
72           return id;
73       }
74  
75       /**
76        * Sets the value of the id property.
77        *
78        * @param value
79        *     allowed object is
80        *     {@link String }
81        *    
82        */
83       public void setId(String value) {
84           this.id = value;
85       }
86  
87       public boolean isSetId() {
88           return (this.id!= null);
89       }
90  
91       /**
92        * Gets the value of the name property.
93        *
94        * @return
95        *     possible object is
96        *     {@link String }
97        *    
98        */
99       public String getName() {
100           return name;
101       }
102  
103       /**
104        * Sets the value of the name property.
105        *
106        * @param value
107        *     allowed object is
108        *     {@link String }
109        *    
110        */
111       public void setName(String value) {
112           this.name = value;
113       }
114  
115       public boolean isSetName() {
116           return (this.name!= null);
117       }
118  
119       /**
120        * Gets the value of the contact property.
121        *
122        * @return
123        *     possible object is
124        *     {@link String }
125        *    
126        */
127       public String getContact() {
128           return contact;
129       }
130  
131       /**
132        * Sets the value of the contact property.
133        *
134        * @param value
135        *     allowed object is
136        *     {@link String }
137        *    
138        */
139       public void setContact(String value) {
140           this.contact = value;
141       }
142  
143       public boolean isSetContact() {
144           return (this.contact!= null);
145       }
146  
147       /**
148        * Gets the value of the role property.
149        *
150        * @return
151        *     possible object is
152        *     {@link Role }
153        *    
154        */
155       public Role getRole() {
156           return role;
157       }
158  
159       /**
160        * Sets the value of the role property.
161        *
162        * @param value
163        *     allowed object is
164        *     {@link Role }
165        *    
166        */
167       public void setRole(Role value) {
168           this.role = value;
169       }
170  
171       public boolean isSetRole() {
172           return (this.role!= null);
173       }
174  
175       /**
176        * Gets the value of the aspects property.
177        *
178        * @return
179        *     possible object is
180        *     {@link AspectsIds }
181        *    
182        */
183       public AspectsIds getAspects() {
184           return aspects;
185       }
186  
187       /**
188        * Sets the value of the aspects property.
189        *
190        * @param value
191        *     allowed object is
192        *     {@link AspectsIds }
193        *    
194        */
195       public void setAspects(AspectsIds value) {
196           this.aspects = value;
197       }
198  
199       public boolean isSetAspects() {
200           return (this.aspects!= null);
201       }
202  
203   }
AspectsIds.java
42   @XmlAccessorType(XmlAccessType.FIELD)
43   @XmlType(name = "aspectsIdType", propOrder = {
44       "aspectIds"
45   })
46   public class AspectsIds {
47  
48       @XmlElement(name = "aspect-id", required = true)
49       protected List<String> aspectIds;
50  
51       /**
52        * Gets the value of the aspectIds property.
53        *
54        * <p>
55        * This accessor method returns a reference to the live list,
56        * not a snapshot. Therefore any modification you make to the
57        * returned list will be present inside the JAXB object.
58        * This is why there is not a <CODE>set</CODE> method for the aspectIds property.
59        *
60        * <p>
61        * For example, to add a new item, do as follows:
62        * <pre>
63        *    getAspectIds().add(newItem);
64        * </pre>
65        *
66        *
67        * <p>
68        * Objects of the following type(s) are allowed in the list
69        * {@link String }
70        *
71        *
72        */
73       public List<String> getAspectIds() {
74           if (aspectIds == null) {
75               aspectIds = new ArrayList<String>();
76           }
77           return this.aspectIds;
78       }
79  
80       public boolean isSetAspectIds() {
81           return ((this.aspectIds!= null)&&(!this.aspectIds.isEmpty()));
82       }
83  
84       public void unsetAspectIds() {
85           this.aspectIds = null;
86       }
87  
88   }
Aspects.java
41   @XmlAccessorType(XmlAccessType.FIELD)
42   @XmlType(name = "aspectsType", propOrder = {
43       "aspects"
44   })
45   public class Aspects {
46  
47       @XmlElement(name = "aspect", required = true)
48       protected List<Aspect> aspects;
49  
50       /**
51        * Gets the value of the aspects property.
52        *
53        * <p>
54        * This accessor method returns a reference to the live list,
55        * not a snapshot. Therefore any modification you make to the
56        * returned list will be present inside the JAXB object.
57        * This is why there is not a <CODE>set</CODE> method for the aspects property.
58        *
59        * <p>
60        * For example, to add a new item, do as follows:
61        * <pre>
62        *    getAspects().add(newItem);
63        * </pre>
64        *
65        *
66        * <p>
67        * Objects of the following type(s) are allowed in the list
68        * {@link Aspect }
69        *
70        *
71        */
72       public List<Aspect> getAspects() {
73           if (aspects == null) {
74               aspects = new ArrayList<Aspect>();
75           }
76           return this.aspects;
77       }
78  
79       public boolean isSetAspects() {
80           return ((this.aspects!= null)&&(!this.aspects.isEmpty()));
81       }
82  
83       public void unsetAspects() {
84           this.aspects = null;
85       }
86  
87   }
Aspect.java
42   @XmlAccessorType(XmlAccessType.FIELD)
43   @XmlType(name = "aspectType", propOrder = {
44       "id",
45       "category",
46       "directive",
47       "description"
48   })
49   public class Aspect {
50  
51       @XmlElement(required = true)
52       protected String id;
53       @XmlElement(required = true)
54       protected String category;
55       @XmlElement(required = true)
56       protected String directive;
57       @XmlElement(required = true)
58       protected String description;
59  
60       /**
61        * Gets the value of the id property.
62        *
63        * @return
64        *     possible object is
65        *     {@link String }
66        *    
67        */
68       public String getId() {
69           return id;
70       }
71  
72       /**
73        * Sets the value of the id property.
74        *
75        * @param value
76        *     allowed object is
77        *     {@link String }
78        *    
79        */
80       public void setId(String value) {
81           this.id = value;
82       }
83  
84       public boolean isSetId() {
85           return (this.id!= null);
86       }
87  
88       /**
89        * Gets the value of the category property.
90        *
91        * @return
92        *     possible object is
93        *     {@link String }
94        *    
95        */
96       public String getCategory() {
97           return category;
98       }
99  
100       /**
101        * Sets the value of the category property.
102        *
103        * @param value
104        *     allowed object is
105        *     {@link String }
106        *    
107        */
108       public void setCategory(String value) {
109           this.category = value;
110       }
111  
112       public boolean isSetCategory() {
113           return (this.category!= null);
114       }
115  
116       /**
117        * Gets the value of the directive property.
118        *
119        * @return
120        *     possible object is
121        *     {@link String }
122        *    
123        */
124       public String getDirective() {
125           return directive;
126       }
127  
128       /**
129        * Sets the value of the directive property.
130        *
131        * @param value
132        *     allowed object is
133        *     {@link String }
134        *    
135        */
136       public void setDirective(String value) {
137           this.directive = value;
138       }
139  
140       public boolean isSetDirective() {
141           return (this.directive!= null);
142       }
143  
144       /**
145        * Gets the value of the description property.
146        *
147        * @return
148        *     possible object is
149        *     {@link String }
150        *    
151        */
152       public String getDescription() {
153           return description;
154       }
155  
156       /**
157        * Sets the value of the description property.
158        *
159        * @param value
160        *     allowed object is
161        *     {@link String }
162        *    
163        */
164       public void setDescription(String value) {
165           this.description = value;
166       }
167  
168       public boolean isSetDescription() {
169           return (this.description!= null);
170       }
171  
172   }
Adapter7.java
14   public class Adapter7
15       extends XmlAdapter<String, Calendar>
16   {
17  
18  
19       public Calendar unmarshal(String value) {
20           return (javax.xml.bind.DatatypeConverter.parseTime(value));
21       }
22  
23       public String marshal(Calendar value) {
24           if (value == null) {
25               return null;
26           }
27           return (javax.xml.bind.DatatypeConverter.printTime(value));
28       }
29  
30   }
Adapter6.java
14   public class Adapter6
15       extends XmlAdapter<String, Calendar>
16   {
17  
18  
19       public Calendar unmarshal(String value) {
20           return (javax.xml.bind.DatatypeConverter.parseTime(value));
21       }
22  
23       public String marshal(Calendar value) {
24           if (value == null) {
25               return null;
26           }
27           return (javax.xml.bind.DatatypeConverter.printTime(value));
28       }
29  
30   }
Adapter5.java
14   public class Adapter5
15       extends XmlAdapter<String, Calendar>
16   {
17  
18  
19       public Calendar unmarshal(String value) {
20           return (javax.xml.bind.DatatypeConverter.parseDate(value));
21       }
22  
23       public String marshal(Calendar value) {
24           if (value == null) {
25               return null;
26           }
27           return (javax.xml.bind.DatatypeConverter.printDate(value));
28       }
29  
30   }
Adapter4.java
13   public class Adapter4
14       extends XmlAdapter<String, Integer>
15   {
16  
17  
18       public Integer unmarshal(String value) {
19           return (javax.xml.bind.DatatypeConverter.parseInt(value));
20       }
21  
22       public String marshal(Integer value) {
23           if (value == null) {
24               return null;
25           }
26           return (javax.xml.bind.DatatypeConverter.printInt(value));
27       }
28  
29   }
Adapter3.java
14   public class Adapter3
15       extends XmlAdapter<String, Calendar>
16   {
17  
18  
19       public Calendar unmarshal(String value) {
20           return (javax.xml.bind.DatatypeConverter.parseTime(value));
21       }
22  
23       public String marshal(Calendar value) {
24           if (value == null) {
25               return null;
26           }
27           return (javax.xml.bind.DatatypeConverter.printTime(value));
28       }
29  
30   }
Adapter2.java
14   public class Adapter2
15       extends XmlAdapter<String, Calendar>
16   {
17  
18  
19       public Calendar unmarshal(String value) {
20           return (javax.xml.bind.DatatypeConverter.parseTime(value));
21       }
22  
23       public String marshal(Calendar value) {
24           if (value == null) {
25               return null;
26           }
27           return (javax.xml.bind.DatatypeConverter.printTime(value));
28       }
29  
30   }
Adapter1.java
14   public class Adapter1
15       extends XmlAdapter<String, Calendar>
16   {
17  
18  
19       public Calendar unmarshal(String value) {
20           return (javax.xml.bind.DatatypeConverter.parseDate(value));
21       }
22  
23       public String marshal(Calendar value) {
24           if (value == null) {
25               return null;
26           }
27           return (javax.xml.bind.DatatypeConverter.printDate(value));
28       }
29  
30   }
AppSettingValue.java
28   public enum AppSettingValue {
29       /* If a given string value is invalid */
30       INVALID_VALUE,
31  
32       /* Boolean values */
33       TRUE, FALSE,
34  
35       /* Font size values */
36       AUTO, NORMAL, LARGE, EXTRA_LARGE;
37   }
AppSettingKey.java
28   public enum AppSettingKey {
29       DATABASE_VERSION,
30       
31       /* Application setting keys */
32       APP_LAST_REVIEW_PATH,
33       APP_LAST_MODE,
34       APP_DO_AUTO_SAVE,
35       APP_AUTO_SAVE_INTERVAL,
36       APP_FONT_SIZE,
37       APP_CHECK_VERSION,
38       
39       /* PDF protocol keys */
40       PDF_PROTOCOL_FOOT_TEXT,
41       PDF_PROTOCOL_LOGO,
42       PDF_PROTOCOL_SHOW_SIGN_FIELDS,
43       
44       /* PDF invitation keys */
45       PDF_INVITATION_TEXT,
46       PDF_INVITATION_FOOT_TEXT,
47       PDF_INVITATION_LOGO;
48       
49   }
AppCatalog.java
37   public class AppCatalog {
38  
39       /**
40        * The name of the catalog.
41        */
42       private String name = null;
43  
44       /**
45        * Internally used contructor.
46        *
47        * @param name
48        */
49       protected AppCatalog(String name) {
50           super();
51           this.name = name;
52       }
53       
54       /**
55        * Returns a string representation of this object.
56        */
57       @Override
58       public String toString() {
59           return this.name;
60       }
61  
62       /**
63        * If the name of two AppCatalog instances is equal, then they are declared
64        * as equal by this method.
65        */
66       @Override
67       public boolean equals(Object obj) {
68           AppCatalog otherCat = (AppCatalog) obj;
69           boolean isEqual = false;
70  
71           if (this.name.equals(otherCat.getName())) {
72               isEqual = true;
73           }
74  
75           return isEqual;
76       }
77  
78       /**
79        * Creates a new instance of this class. If a catalog with the given name
80        * does not exist, then a new one will be created in the database.
81        *
82        * @param name
83        *            of the catalog
84        * @return instance of this class
85        * @throws DataException
86        *             If an error occurs while creating a new instance
87        */
88       public static AppCatalog newInstance(String name) throws DataException {
89           try {
90               Connection conn = Data.getInstance().getAppData().openConnection();
91  
92               PreparedStatement ps = conn
93                       .prepareStatement("SELECT name FROM Catalogs "
94                               + "WHERE name = ?");
95  
96               ps.setString(1, name);
97  
98               ResultSet res = ps.executeQuery();
99  
100               /*
101                * If a catalog with the given name does not exist
102                */
103               if (!res.next()) {
104                   ps = conn.prepareStatement("INSERT INTO Catalogs "
105                           + "(name, sortPos) VALUES (?, ?)");
106  
107                   ps.setString(1, name);
108                   ps.setInt(2, Data.getInstance().getAppData()
109                           .getLastSortPosOfCatalogs() + 1);
110  
111                   ps.executeUpdate();
112               }
113  
114               res.close();
115               ps.close();
116               conn.close();
117           } catch (Exception e) {
118               /*
119                * Not part of the unit testing, because this exception is only
120                * thrown if there occurs an internal error.
121                */
122               throw new DataException(Data.getInstance().getLocaleStr(
123                       "message.newInstAppCatalogFailed")
124                       + " [NAME = " + name + "] " + e.getMessage());
125           }
126  
127           return new AppCatalog(name);
128       }
129  
130       /**
131        * Returns the name of a catalog.
132        *
133        * @return name of the catalog
134        */
135       public String getName() {
136           return name;
137       }
138  
139       /**
140        * Set the name of the catalog
141        *
142        * @param name
143        *            of the catalog
144        * @throws DataException
145        *             If an error occurs while setting the name
146        */
147       public void setName(String name) throws DataException {
148           try {
149               Connection conn = Data.getInstance().getAppData().openConnection();
150               int result = 0;
151  
152               PreparedStatement ps = conn
153                       .prepareStatement("SELECT COUNT(*) FROM Catalogs WHERE name=?");
154               ps.setString(1, name);
155  
156               ResultSet res = ps.executeQuery();
157  
158               res.next();
159  
160               result = res.getInt(1);
161  
162               res.close();
163  
164               /*
165                * If there exists no catalog with the given name
166                */
167               if (result == 0) {
168                   ps = conn.prepareStatement("UPDATE Catalogs "
169                           + "SET name=? WHERE name=?");
170  
171                   ps.setString(1, name);
172                   ps.setString(2, this.name);
173  
174                   ps.executeUpdate();
175  
176                   ps.close();
177                   conn.close();
178  
179                   this.name = name;
180               } else {
181                   ps.close();
182                   conn.close();
183  
184                   throw new DataException();
185               }
186           } catch (Exception e) {
187               throw new DataException(Data.getInstance().getLocaleStr(
188                       "message.setAppCatalogNameFailed")
189                       + " [NAME = " + this.name + "]");
190           }
191       }
192  
193       /**
194        * Pushes the catalog dependent on the given push mode.
195        *
196        * @param mode
197        *            to push
198        * @throws DataException
199        *             If an error occurs while pushing the catalog
200        */
201       private void pushCatalog(PushMode mode) throws DataException {
202           int curSortPos = this.getSortPos();
203           int pushSortPos = 0;
204           boolean doPush = false;
205  
206           if (mode == PushMode.UP) {
207               pushSortPos = getSortPosOfPredecessor();
208               doPush = getSortPos() > Data.getInstance().getAppData()
209                       .getFirstSortPosOfCatalogs();
210           } else if (mode == PushMode.DOWN) {
211               pushSortPos = getSortPosOfSuccessor();
212               doPush = getSortPos() < Data.getInstance().getAppData()
213                       .getLastSortPosOfCatalogs();
214           }
215  
216           if (doPush) {
217               try {
218                   Connection conn = Data.getInstance().getAppData()
219                           .openConnection();
220                   conn.setAutoCommit(false);
221  
222                   /*
223                    * Update sorting position of the other catalog
224                    */
225                   PreparedStatement ps = conn.prepareStatement("UPDATE Catalogs "
226                           + "SET sortPos=? WHERE sortPos=?");
227                   ps.setInt(1, curSortPos);
228                   ps.setInt(2, pushSortPos);
229                   ps.executeUpdate();
230  
231                   /*
232                    * Update sorting position of this catalog
233                    */
234                   ps = conn.prepareStatement("UPDATE Catalogs "
235                           + "SET sortPos=? WHERE name=?");
236                   ps.setInt(1, pushSortPos);
237                   ps.setString(2, this.name);
238                   ps.executeUpdate();
239  
240                   conn.commit();
241  
242                   ps.close();
243                   conn.close();
244               } catch (Exception e) {
245                   /*
246                    * Not part of the unit testing, because this exception is only
247                    * thrown if there occurs an internal error.
248                    */
249                   throw new DataException(Data.getInstance().getLocaleStr(
250                           "message.pushAppCatalogFailed")
251                           + " [NAME = " + this.name + "] " + e.getMessage());
252               }
253           }
254       }
255  
256       /**
257        * Pushes the catalog one step up.
258        *
259        * @throws DataException
260        *             If an error occurs while pushing the catalog
261        */
262       public void pushUp() throws DataException {
263           pushCatalog(PushMode.UP);
264       }
265  
266       /**
267        * Pushes the catalog one step down.
268        *
269        * @throws DataException
270        *             If an error occurs while pushing the catalog
271        */
272       public void pushDown() throws DataException {
273           pushCatalog(PushMode.DOWN);
274       }
275  
276       /**
277        * Pushes the catalog to the top of the list.
278        *
279        * @throws DataException
280        *             If an error occurs while pushing the catalog
281        */
282       public void pushTop() throws DataException {
283           while (this.getSortPos() > Data.getInstance().getAppData()
284                   .getFirstSortPosOfCatalogs()) {
285               pushUp();
286           }
287       }
288  
289       /**
290        * Pushes the catalog to the bottom of the list.
291        *
292        * @throws DataException
293        *             If an error occurs while pushing the catalog
294        */
295       public void pushBottom() throws DataException {
296           while (this.getSortPos() < Data.getInstance().getAppData()
297                   .getLastSortPosOfCatalogs()) {
298               pushDown();
299           }
300       }
301  
302       /**
303        * Returns the sorting position of the catalog.
304        *
305        * @return sorting position
306        * @throws DataException
307        *             If an error occurs while getting the sorting position
308        */
309       public int getSortPos() throws DataException {
310           int sortPos = 0;
311  
312           try {
313               Connection conn = Data.getInstance().getAppData().openConnection();
314  
315               PreparedStatement ps = conn
316                       .prepareStatement("SELECT sortPos FROM Catalogs "
317                               + "WHERE name = ?");
318               ps.setString(1, this.name);
319  
320               ResultSet res = ps.executeQuery();
321  
322               if (res.next()) {
323                   sortPos = res.getInt("sortPos");
324               }
325  
326               res.close();
327               ps.close();
328               conn.close();
329           } catch (Exception e) {
330               /*
331                * Not part of the unit testing, because this exception is only
332                * thrown if there occurs an internal error.
333                */
334               throw new DataException(Data.getInstance().getLocaleStr(
335                       "message.getSortPosOfAppCatalogFailed")
336                       + " [NAME = " + this.name + "] " + e.getMessage());
337           }
338  
339           return sortPos;
340       }
341  
342       /**
343        * Get the sorting position of the predecessor catalog.
344        *
345        * @return sorting position
346        * @throws DataException
347        *             If an error occurs while getting the sorting position
348        */
349       private int getSortPosOfPredecessor() throws DataException {
350           int sortPos = 0;
351  
352           try {
353               Connection conn = Data.getInstance().getAppData().openConnection();
354  
355               PreparedStatement ps = conn
356                       .prepareStatement("SELECT sortPos FROM Catalogs "
357                               + "WHERE sortPos < ? ORDER BY sortPos DESC");
358               ps.setInt(1, getSortPos());
359               ps.setMaxRows(1);
360  
361               ResultSet res = ps.executeQuery();
362  
363               if (res.next()) {
364                   sortPos = res.getInt("sortPos");
365               }
366  
367               res.close();
368               ps.close();
369               conn.close();
370           } catch (Exception e) {
371               /*
372                * Not part of the unit testing, because this exception is only
373                * thrown if there occurs an internal error.
374                */
375               throw new DataException(Data.getInstance().getLocaleStr(
376                       "message.getSortPosOfAppCatalogFailed")
377                       + " [NAME = " + this.name + "] " + e.getMessage());
378           }
379  
380           return sortPos;
381       }
382  
383       /**
384        * Get the sorting position of the successor catalog.
385        *
386        * @return sorting position
387        * @throws DataException
388        *             If an error occurs while getting the sorting position
389        */
390       private int getSortPosOfSuccessor() throws DataException {
391           int sortPos = 0;
392  
393           try {
394               Connection conn = Data.getInstance().getAppData().openConnection();
395  
396               PreparedStatement ps = conn
397                       .prepareStatement("SELECT sortPos FROM Catalogs "
398                               + "WHERE sortPos > ? ORDER BY sortPos ASC");
399               ps.setInt(1, getSortPos());
400               ps.setMaxRows(1);
401  
402               ResultSet res = ps.executeQuery();
403  
404               if (res.next()) {
405                   sortPos = res.getInt("sortPos");
406               }
407  
408               res.close();
409               ps.close();
410               conn.close();
411           } catch (Exception e) {
412               /*
413                * Not part of the unit testing, because this exception is only
414                * thrown if there occurs an internal error.
415                */
416               throw new DataException(Data.getInstance().getLocaleStr(
417                       "message.getSortPosOfAppCatalogFailed")
418                       + " [NAME = " + this.name + "] " + e.getMessage());
419           }
420  
421           return sortPos;
422       }
423  
424       /**
425        * Get the sorting position of the given category.
426        *
427        * @param category
428        * @return sorting position
429        * @throws DataException
430        *             If an error occurs while the sorting position
431        */
432       public int getSortPosCategory(String category) throws DataException {
433           int sortPos = 0;
434  
435           try {
436               Connection conn = Data.getInstance().getAppData().openConnection();
437  
438               PreparedStatement ps = conn
439                       .prepareStatement("SELECT sortPos FROM Categories "
440                               + "WHERE name = ? AND catalogName = ?");
441               ps.setString(1, category);
442               ps.setString(2, this.name);
443  
444               ResultSet res = ps.executeQuery();
445  
446               if (res.next()) {
447                   sortPos = res.getInt("sortPos");
448               }
449  
450               res.close();
451               ps.close();
452               conn.close();
453           } catch (Exception e) {
454               /*
455                * Not part of the unit testing, because this exception is only
456                * thrown if there occurs an internal error.
457                */
458               throw new DataException(Data.getInstance().getLocaleStr(
459                       "message.getSortPosOfAppCategoryFailed")
460                       + " [NAME = " + category + "] " + e.getMessage());
461           }
462  
463           return sortPos;
464       }
465  
466       /**
467        * Get the sorting position of the predecessor of the given category.
468        *
469        * @param category
470        * @return sorting position
471        * @throws DataException
472        *             If an error occurs while the sorting position
473        */
474       private int getSortPosCategoryOfPre(String category) throws DataException {
475           int sortPos = 0;
476  
477           try {
478               Connection conn = Data.getInstance().getAppData().openConnection();
479  
480               PreparedStatement ps = conn
481                       .prepareStatement("SELECT sortPos FROM Categories "
482                               + "WHERE sortPos < ? AND catalogName = ? "
483                               + "ORDER BY sortPos DESC");
484               ps.setInt(1, getSortPosCategory(category));
485               ps.setString(2, this.name);
486               ps.setMaxRows(1);
487  
488               ResultSet res = ps.executeQuery();
489  
490               if (res.next()) {
491                   sortPos = res.getInt("sortPos");
492               }
493  
494               res.close();
495               ps.close();
496               conn.close();
497           } catch (Exception e) {
498               /*
499                * Not part of the unit testing, because this exception is only
500                * thrown if there occurs an internal error.
501                */
502               throw new DataException(Data.getInstance().getLocaleStr(
503                       "message.getSortPosOfAppCategoryFailed")
504                       + " [NAME = " + category + "] " + e.getMessage());
505           }
506  
507           return sortPos;
508       }
509  
510       /**
511        * Get the sorting position of the successor of the given category.
512        *
513        * @param category
514        * @return sorting position
515        * @throws DataException
516        *             If an error occurs while the sorting position
517        */
518       private int getSortPosCategoryOfSuc(String category) throws DataException {
519           int sortPos = 0;
520  
521           try {
522               Connection conn = Data.getInstance().getAppData().openConnection();
523  
524               PreparedStatement ps = conn
525                       .prepareStatement("SELECT sortPos FROM Categories "
526                               + "WHERE sortPos > ? AND catalogName = ? "
527                               + "ORDER BY sortPos ASC");
528               ps.setInt(1, getSortPosCategory(category));
529               ps.setString(2, this.name);
530               ps.setMaxRows(1);
531  
532               ResultSet res = ps.executeQuery();
533  
534               if (res.next()) {
535                   sortPos = res.getInt("sortPos");
536               }
537  
538               res.close();
539               ps.close();
540               conn.close();
541           } catch (Exception e) {
542               /*
543                * Not part of the unit testing, because this exception is only
544                * thrown if there occurs an internal error.
545                */
546               throw new DataException(Data.getInstance().getLocaleStr(
547                       "message.getSortPosOfAppCategoryFailed")
548                       + " [NAME = " + category + "] " + e.getMessage());
549           }
550  
551           return sortPos;
552       }
553  
554       /**
555        * Returns the first sorting position of categories of this catalog.
556        *
557        * @return sorting position
558        * @throws DataException
559        *             If an error occurs while the sorting position
560        */
561       public int getFirstSortPosOfCategories() throws DataException {
562           int sortPos = 0;
563  
564           try {
565               Connection conn = Data.getInstance().getAppData().openConnection();
566  
567               PreparedStatement ps = conn
568                       .prepareStatement("SELECT sortPos FROM Categories "
569                               + "WHERE catalogName = ? " + "ORDER BY sortPos ASC");
570               ps.setString(1, this.name);
571               ps.setMaxRows(1);
572  
573               ResultSet res = ps.executeQuery();
574  
575               if (res.next()) {
576                   sortPos = res.getInt("sortPos");
577               }
578  
579               res.close();
580               ps.close();
581               conn.close();
582           } catch (Exception e) {
583               /*
584                * Not part of the unit testing, because this exception is only
585                * thrown if there occurs an internal error.
586                */
587               throw new DataException(Data.getInstance().getLocaleStr(
588                       "message.getFirstSortPosOfAppCategoriesFailed")
589                       + " [NAME = " + this.name + "] " + e.getMessage());
590           }
591  
592           return sortPos;
593       }
594  
595       /**
596        * Returns the last sorting position of categories of this catalog.
597        *
598        * @return sorting position
599        * @throws DataException
600        *             If an error occurs while the sorting position
601        */
602       public int getLastSortPosOfCategories() throws DataException {
603           int sortPos = 0;
604  
605           try {
606               Connection conn = Data.getInstance().getAppData().openConnection();
607  
608               PreparedStatement ps = conn
609                       .prepareStatement("SELECT sortPos FROM Categories "
610                               + "WHERE catalogName = ? "
611                               + "ORDER BY sortPos DESC");
612               ps.setString(1, this.name);
613               ps.setMaxRows(1);
614  
615               ResultSet res = ps.executeQuery();
616  
617               if (res.next()) {
618                   sortPos = res.getInt("sortPos");
619               }
620  
621               res.close();
622               ps.close();
623               conn.close();
624           } catch (Exception e) {
625               /*
626                * Not part of the unit testing, because this exception is only
627                * thrown if there occurs an internal error.
628                */
629               throw new DataException(Data.getInstance().getLocaleStr(
630                       "message.getLastSortPosOfAppCategoriesFailed")
631                       + " [NAME = " + this.name + "] " + e.getMessage());
632           }
633  
634           return sortPos;
635       }
636  
637       /**
638        * Pushes the given category with the given push mode.
639        *
640        * @param category
641        *            to push
642        * @param mode
643        * @throws DataException
644        *             If an error occurs while pushing the category
645        */
646       private void pushCategory(String category, PushMode mode)
647               throws DataException {
648           int curSortPos = getSortPosCategory(category);
649           int pushSortPos = 0;
650           boolean doPush = false;
651  
652           if (mode == PushMode.UP) {
653               pushSortPos = getSortPosCategoryOfPre(category);
654               doPush = curSortPos > getFirstSortPosOfCategories();
655           } else if (mode == PushMode.DOWN) {
656               pushSortPos = getSortPosCategoryOfSuc(category);
657               doPush = curSortPos < getLastSortPosOfCategories();
658           }
659  
660           if (doPush) {
661               try {
662                   Connection conn = Data.getInstance().getAppData()
663                           .openConnection();
664                   conn.setAutoCommit(false);
665  
666                   /*
667                    * Update sorting position of the other element
668                    */
669                   PreparedStatement ps = conn
670                           .prepareStatement("UPDATE Categories "
671                                   + "SET sortPos=? WHERE sortPos=? AND catalogName=?");
672                   ps.setInt(1, curSortPos);
673                   ps.setInt(2, pushSortPos);
674                   ps.setString(3, this.name);
675                   ps.executeUpdate();
676  
677                   /*
678                    * Update sorting position of this element
679                    */
680                   ps = conn.prepareStatement("UPDATE Categories "
681                           + "SET sortPos=? WHERE name=? AND catalogName=?");
682                   ps.setInt(1, pushSortPos);
683                   ps.setString(2, category);
684                   ps.setString(3, this.name);
685                   ps.executeUpdate();
686  
687                   conn.commit();
688  
689                   ps.close();
690                   conn.close();
691               } catch (Exception e) {
692                   /*
693                    * Not part of the unit testing, because this exception is only
694                    * thrown if there occurs an internal error.
695                    */
696                   throw new DataException(Data.getInstance().getLocaleStr(
697                           "message.pushAppCategoryFailed")
698                           + " [NAME = " + category + "] " + e.getMessage());
699               }
700           }
701       }
702  
703       /**
704        * Pushes the given category one step up.
705        *
706        * @param category
707        * @throws DataException
708        *             If an error occurs while pushing the category
709        */
710       public void pushUpCategory(String category) throws DataException {
711           pushCategory(category, PushMode.UP);
712       }
713  
714       /**
715        * Pushes the given category one step down.
716        *
717        * @param category
718        * @throws DataException
719        *             If an error occurs while pushing the category
720        */
721       public void pushDownCategory(String category) throws DataException {
722           pushCategory(category, PushMode.DOWN);
723       }
724  
725       /**
726        * Pushes the given category to the top.
727        *
728        * @param category
729        * @throws DataException
730        *             If an error occurs while pushing the category
731        */
732       public void pushTopCategory(String category) throws DataException {
733           while (getSortPosCategory(category) > getFirstSortPosOfCategories()) {
734               pushUpCategory(category);
735           }
736       }
737  
738       /**
739        * Pushes the given category to the bottom.
740        *
741        * @param category
742        * @throws DataException
743        *             If an error occurs while pushing the category
744        */
745       public void pushBottomCategory(String category) throws DataException {
746           while (getSortPosCategory(category) < getLastSortPosOfCategories()) {
747               pushDownCategory(category);
748           }
749       }
750  
751       /**
752        * Returns the number of categories of this catalog.
753        *
754        * @return number of categories
755        * @throws DataException
756        *             If an error occurs while getting the number of categories
757        */
758       public int getNumberOfCategories() throws DataException {
759           int numberOfCategories = 0;
760  
761           try {
762               Connection conn = Data.getInstance().getAppData().openConnection();
763  
764               PreparedStatement ps = conn
765                       .prepareStatement("SELECT COUNT(*) FROM Categories WHERE catalogName=?");
766               ps.setString(1, this.name);
767  
768               ResultSet res = ps.executeQuery();
769  
770               res.next();
771  
772               numberOfCategories = res.getInt(1);
773  
774               res.close();
775               ps.close();
776               conn.close();
777           } catch (Exception e) {
778               /*
779                * Not part of the unit testing, because this exception is only
780                * thrown if there occurs an internal error.
781                */
782               throw new DataException(Data.getInstance().getLocaleStr(
783                       "message.getNumberOfAppCategoriesFailed")
784                       + " [NAME = " + this.name + "] " + e.getMessage());
785           }
786  
787           return numberOfCategories;
788       }
789  
790       /**
791        * Returns the list of categories of this catalog.
792        *
793        * @return list of categories
794        * @throws DataException
795        *             If an error occurs while getting the categories
796        */
797       public List<String> getCategories() throws DataException {
798           List<String> categories = new ArrayList<String>();
799  
800           try {
801               Connection conn = Data.getInstance().getAppData().openConnection();
802  
803               PreparedStatement ps = conn
804                       .prepareStatement("SELECT name FROM Categories "
805                               + "WHERE catalogName = ? ORDER BY sortPos ASC");
806               ps.setString(1, this.name);
807  
808               ResultSet res = ps.executeQuery();
809  
810               while (res.next()) {
811                   categories.add(res.getString("name"));
812               }
813  
814               res.close();
815               ps.close();
816               conn.close();
817           } catch (Exception e) {
818               /*
819                * Not part of the unit testing, because this exception is only
820                * thrown if there occurs an internal error.
821                */
822               throw new DataException(Data.getInstance().getLocaleStr(
823                       "message.getAppCategoriesFailed")
824                       + " [NAME = " + this.name + "] " + e.getMessage());
825           }
826  
827           return categories;
828       }
829  
830       /**
831        * Returns a list of the categories which fit to the given filter.
832        *
833        * @param filter
834        *            to search for
835        * @return list of categories
836        * @throws DataException
837        *             If an error occurs while getting the categories
838        */
839       public List<String> getCategories(String filter) throws DataException {
840           List<String> categories = getCategories();
841           List<String> categoriesFiltered = new ArrayList<String>();
842  
843           for (String cat : categories) {
844               if (cat.toLowerCase().contains(filter.toLowerCase())) {
845                   categoriesFiltered.add(cat);
846               }
847           }
848  
849           return categoriesFiltered;
850       }
851  
852       /**
853        * Returns true if the given category exists.
854        *
855        * @param name
856        *            of the category
857        * @return true if category exists
858        * @throws DataException
859        *             If an error occurs while
860        */
861       public boolean isCategory(String name) throws DataException {
862           boolean isCat = false;
863  
864           try {
865               Connection conn = Data.getInstance().getAppData().openConnection();
866  
867               PreparedStatement ps = conn
868                       .prepareStatement("SELECT name FROM Categories "
869                               + "WHERE name=? AND catalogName=?");
870               ps.setString(1, name);
871               ps.setString(2, this.name);
872  
873               ResultSet res = ps.executeQuery();
874  
875               if (res.next()) {
876                   isCat = true;
877               }
878  
879               res.close();
880               ps.close();
881               conn.close();
882           } catch (Exception e) {
883               /*
884                * Not part of the unit testing, because this exception is only
885                * thrown if there occurs an internal error.
886                */
887               throw new DataException(Data.getInstance().getLocaleStr(
888                       "message.isAppCategoryFailed")
889                       + " [NAME = " + name + "] " + e.getMessage());
890           }
891  
892           return isCat;
893       }
894  
895       /**
896        * Updates tha name of the given category.
897        *
898        * @param oldName
899        *            of the category
900        * @param newName
901        *            of the category
902        * @throws DataException
903        *             If an error occurs while updating the name of the category
904        */
905       public void editCategory(String oldName, String newName)
906               throws DataException {
907           try {
908               /*
909                * If the given new name for the category does not exist
910                */
911               if (!isCategory(newName)) {
912                   Connection conn = Data.getInstance().getAppData()
913                           .openConnection();
914                   conn.setAutoCommit(false);
915  
916                   PreparedStatement ps = conn
917                           .prepareStatement("UPDATE Categories "
918                                   + "SET name=? WHERE name=? AND catalogName=?");
919                   ps.setString(1, newName);
920                   ps.setString(2, oldName);
921                   ps.setString(3, this.name);
922                   ps.executeUpdate();
923  
924                   ps = conn.prepareStatement("UPDATE Aspects "
925                           + "SET categoryName=? WHERE categoryName=? "
926                           + "AND catalogName=?");
927                   ps.setString(1, newName);
928                   ps.setString(2, oldName);
929                   ps.setString(3, this.name);
930                   ps.executeUpdate();
931  
932                   conn.commit();
933  
934                   ps.close();
935                   conn.close();
936               } else {
937                   throw new DataException();
938               }
939           } catch (Exception e) {
940               throw new DataException(Data.getInstance().getLocaleStr(
941                       "message.editAppCategoryFailed")
942                       + " [NAME = " + oldName + "] " + e.getMessage());
943           }
944       }
945  
946       /**
947        * Returns the first sorting position of the category of this catalog.
948        *
949        * @param category
950        * @return sorting position
951        * @throws DataException
952        *             If an error occurs while getting the sorting position
953        */
954       public int getFirstSortPosOfAspects(String category) throws DataException {
955           int sortPos = 0;
956  
957           try {
958               Connection conn = Data.getInstance().getAppData().openConnection();
959  
960               PreparedStatement ps = conn
961                       .prepareStatement("SELECT sortPos FROM Aspects "
962                               + "WHERE categoryName = ? AND catalogName = ? "
963                               + "ORDER BY sortPos ASC");
964               ps.setString(1, category);
965               ps.setString(2, this.name);
966               ps.setMaxRows(1);
967  
968               ResultSet res = ps.executeQuery();
969  
970               if (res.next()) {
971                   sortPos = res.getInt("sortPos");
972               }
973  
974               res.close();
975               ps.close();
976               conn.close();
977           } catch (Exception e) {
978               /*
979                * Not part of the unit testing, because this exception is only
980                * thrown if there occurs an internal error.
981                */
982               throw new DataException(Data.getInstance().getLocaleStr(
983                       "message.getFirstSortPosOfAppAspectsFailed")
984                       + " [NAME = " + category + "] " + e.getMessage());
985           }
986  
987           return sortPos;
988       }
989  
990       /**
991        * Returns the last sorting position of the category of this catalog.
992        *
993        * @param category
994        * @return sorting position
995        * @throws DataException
996        *             If an error occurs while getting the sorting position
997        */
998       public int getLastSortPosOfAspects(String category) throws DataException {
999           int sortPos = 0;
1000  
1001           try {
1002               Connection conn = Data.getInstance().getAppData().openConnection();
1003  
1004               PreparedStatement ps = conn
1005                       .prepareStatement("SELECT sortPos FROM Aspects "
1006                               + "WHERE categoryName = ? AND catalogName = ? "
1007                               + "ORDER BY sortPos DESC");
1008               ps.setString(1, category);
1009               ps.setString(2, this.name);
1010               ps.setMaxRows(1);
1011  
1012               ResultSet res = ps.executeQuery();
1013  
1014               if (res.next()) {
1015                   sortPos = res.getInt("sortPos");
1016               }
1017  
1018               res.close();
1019               ps.close();
1020               conn.close();
1021           } catch (Exception e) {
1022               /*
1023                * Not part of the unit testing, because this exception is only
1024                * thrown if there occurs an internal error.
1025                */
1026               throw new DataException(Data.getInstance().getLocaleStr(
1027                       "message.getLastSortPosOfAppAspectsFailed")
1028                       + " [NAME = " + category + "] " + e.getMessage());
1029           }
1030  
1031           return sortPos;
1032       }
1033  
1034       /**
1035        * Returns the number of aspects of the given category.
1036        *
1037        * @param category
1038        * @return number of aspects
1039        * @throws DataException
1040        *             If an error occurs while getting the number of aspects
1041        */
1042       public int getNumberOfAspects(String category) throws DataException {
1043           int numberOfAspects = 0;
1044  
1045           try {
1046               Connection conn = Data.getInstance().getAppData().openConnection();
1047  
1048               PreparedStatement ps;
1049  
1050               if (category == null) {
1051                   ps = conn.prepareStatement("SELECT COUNT(*) FROM Aspects "
1052                           + "WHERE catalogName=?");
1053                   ps.setString(1, this.name);
1054               } else {
1055                   ps = conn.prepareStatement("SELECT COUNT(*) FROM Aspects "
1056                           + "WHERE catalogName=? AND categoryName=?");
1057                   ps.setString(1, this.name);
1058                   ps.setString(2, category);
1059               }
1060  
1061               ResultSet res = ps.executeQuery();
1062  
1063               res.next();
1064  
1065               numberOfAspects = res.getInt(1);
1066  
1067               res.close();
1068               ps.close();
1069               conn.close();
1070           } catch (Exception e) {
1071               /*
1072                * Not part of the unit testing, because this exception is only
1073                * thrown if there occurs an internal error.
1074                */
1075               throw new DataException(Data.getInstance().getLocaleStr(
1076                       "message.getNumberOfAppAspectsFailed")
1077                       + " [NAME = " + this.name + "] " + e.getMessage());
1078           }
1079  
1080           return numberOfAspects;
1081       }
1082  
1083       /**
1084        * Returns the number of all aspects in this catalog.
1085        *
1086        * @return number of aspects
1087        * @throws DataException
1088        *             If an error occurs while getting the number of aspects
1089        */
1090       public int getNumberOfAspects() throws DataException {
1091           return getNumberOfAspects(null);
1092       }
1093  
1094       /**
1095        * Returns a list of aspects which are part of the given category.
1096        *
1097        * @param category
1098        * @return list of aspects
1099        * @throws DataException
1100        *             If an error occurs while getting the aspects
1101        */
1102       public List<AppAspect> getAspects(String category) throws DataException {
1103           List<AppAspect> aspects = new ArrayList<AppAspect>();
1104  
1105           try {
1106               Connection conn = Data.getInstance().getAppData().openConnection();
1107  
1108               PreparedStatement ps = conn
1109                       .prepareStatement("SELECT id FROM Aspects "
1110                               + "WHERE catalogName = ? AND categoryName = ? "
1111                               + "ORDER BY sortPos ASC");
1112               ps.setString(1, this.name);
1113               ps.setString(2, category);
1114  
1115               ResultSet res = ps.executeQuery();
1116  
1117               while (res.next()) {
1118                   aspects.add(new AppAspect(this, res.getInt("id")));
1119               }
1120  
1121               res.close();
1122               ps.close();
1123               conn.close();
1124           } catch (Exception e) {
1125               /*
1126                * Not part of the unit testing, because this exception is only
1127                * thrown if there occurs an internal error.
1128                */
1129               throw new DataException(Data.getInstance().getLocaleStr(
1130                       "message.getAppAspectsFailed")
1131                       + " [NAME = " + this.name + "] " + e.getMessage());
1132           }
1133  
1134           return aspects;
1135       }
1136  
1137       /**
1138        * Returns a list of aspects which are part of the given category and fit to
1139        * the given filter.
1140        *
1141        * @param category
1142        * @param filter
1143        *            to search for
1144        * @return list of aspects
1145        * @throws DataException
1146        *             If an error occurs while getting the aspects
1147        */
1148       public List<AppAspect> getAspects(String category, String filter)
1149               throws DataException {
1150           List<AppAspect> aspects = getAspects(category);
1151           List<AppAspect> aspectsFiltered = new ArrayList<AppAspect>();
1152  
1153           for (AppAspect asp : aspects) {
1154               if (asp.getDirective().toLowerCase().contains(filter.toLowerCase())
1155                       || asp.getDescription().toLowerCase().contains(
1156                               filter.toLowerCase())) {
1157                   aspectsFiltered.add(asp);
1158               }
1159           }
1160  
1161           return aspectsFiltered;
1162       }
1163  
1164       /**
1165        * Returns the aspect with the given id.
1166        *
1167        * @param id
1168        * @return aspect
1169        * @throws DataException
1170        *             If an error occurs while getting the aspect
1171        */
1172       public AppAspect getAspect(int id) throws DataException {
1173           return new AppAspect(this, id);
1174       }
1175  
1176       /**
1177        * Create and returns a new aspect by the given parameters.
1178        *
1179        * @param directive
1180        *            of the aspect
1181        * @param description
1182        *            of the aspect
1183        * @param category
1184        *            of the aspect
1185        * @return aspect
1186        * @throws DataException
1187        *             If an error occurs while creating the aspect
1188        */
1189       public AppAspect newAspect(String directive, String description,
1190               String category) throws DataException {
1191           return new AppAspect(this, directive, description, category);
1192       }
1193  
1194       /**
1195        * Remove the given aspect from the database.
1196        *
1197        * @param aspect
1198        * @throws DataException
1199        *             If an error occurs while removing the aspect
1200        */
1201       public void removeAspect(AppAspect aspect) throws DataException {
1202           String category = aspect.getCategory();
1203  
1204           try {
1205               Connection conn = Data.getInstance().getAppData().openConnection();
1206  
1207               PreparedStatement ps = conn.prepareStatement("DELETE FROM Aspects "
1208                       + "WHERE id = ?");
1209               ps.setInt(1, aspect.getId());
1210               ps.executeUpdate();
1211  
1212               if (getNumberOfAspects(category) == 0) {
1213                   ps = conn.prepareStatement("DELETE FROM Categories "
1214                           + "WHERE name = ? AND catalogName = ?");
1215                   ps.setString(1, category);
1216                   ps.setString(2, this.name);
1217                   ps.executeUpdate();
1218               }
1219  
1220               ps.close();
1221               conn.close();
1222           } catch (Exception e) {
1223               /*
1224                * Not part of the unit testing, because this exception is only
1225                * thrown if there occurs an internal error.
1226                */
1227               throw new DataException(Data.getInstance().getLocaleStr(
1228                       "message.removeAppAspectFailed")
1229                       + " [ASPECT_ID = " + aspect.getId() + "] " + e.getMessage());
1230           }
1231       }
1232  
1233       public void removeCategory(String category) {
1234           try {
1235               for(AppAspect asp:this.getAspects(category))
1236                   this.removeAspect(asp);
1237           } catch (DataException e) {
1238               // TODO Auto-generated catch block
1239               e.printStackTrace();
1240           }
1241       }
1242  
1243   }
AppCSVProfile.java
38   public class AppCSVProfile {
39  
40       private String name = null;
41  
42       /**
43        * Internally used constructor to create a new instance of this class.
44        *
45        * @param name
46        *            of the CSV profile
47        */
48       protected AppCSVProfile(String name) {
49           super();
50           this.name = name;
51       }
52  
53       /**
54        * Returns a string representation of this object.
55        */
56       @Override
57       public String toString() {
58           return this.name;
59       }
60  
61       /**
62        * If the name of two AppCSVProfile instances is equal, then they are
63        * declared as equal by this method.
64        */
65       @Override
66       public boolean equals(Object obj) {
67           AppCSVProfile otherProf = (AppCSVProfile) obj;
68           boolean isEqual = false;
69  
70           if (this.name.equals(otherProf.getName())) {
71               isEqual = true;
72           }
73  
74           return isEqual;
75       }
76  
77       /**
78        * Create a new instance of this class by the name of the CSV profile. If a
79        * profile with the given name does not exist in the database, a new one
80        * will be created.
81        *
82        * @param name
83        *            of the CSV profile
84        * @return CSV profile
85        * @throws DataException
86        *             If an error occurs while creating a new instance of this
87        *             class.
88        */
89       public static AppCSVProfile newInstance(String name) throws DataException {
90           try {
91               Connection conn = Data.getInstance().getAppData().openConnection();
92  
93               PreparedStatement ps = conn
94                       .prepareStatement("SELECT name FROM CSVProfiles "
95                               + "WHERE name = ?");
96  
97               ps.setString(1, name);
98  
99               ResultSet res = ps.executeQuery();
100  
101               /*
102                * If a profile with the given name does not exist
103                */
104               if (!res.next()) {
105                   ps = conn
106                           .prepareStatement("INSERT INTO CSVProfiles "
107                                   + "(name, columnOrder, columnsInFirstLine, encapsulateContent) "
108                                   + "VALUES (?, ?, ?, ?)");
109  
110                   ps.setString(1, name);
111                   ps.setString(2, AppCSVColumnName.DESCRIPTION.toString() + "|"
112                           + AppCSVColumnName.REFERENCE.toString() + "|"
113                           + AppCSVColumnName.SEVERITY.toString() + "|"
114                           + AppCSVColumnName.REPORTER.toString());
115                   ps.setBoolean(3, true);
116                   ps.setBoolean(4, true);
117  
118                   ps.executeUpdate();
119               }
120  
121               res.close();
122               ps.close();
123               conn.close();
124           } catch (Exception e) {
125               /*
126                * Not part of the unit testing, because this exception is only
127                * thrown if there occurs an internal error.
128                */
129               throw new DataException(Data.getInstance().getLocaleStr(
130                       "message.newInstAppCSVProfileFailed")
131                       + " [NAME = " + name + "] " + e.getMessage());
132           }
133  
134           return new AppCSVProfile(name);
135       }
136  
137       /**
138        * Returns the name of this CSV profile.
139        *
140        * @return name of the CSV profile
141        */
142       public String getName() {
143           return name;
144       }
145  
146       /**
147        * Sets the name of this CSV profile.
148        *
149        * @param name
150        *            of the CSV profile
151        * @throws DataException
152        *             If an error occurs while setting CSV profile's name
153        */
154       public void setName(String name) throws DataException {
155           try {
156               Connection conn = Data.getInstance().getAppData().openConnection();
157               int result = 0;
158  
159               PreparedStatement ps = conn
160                       .prepareStatement("SELECT COUNT(*) FROM CSVProfiles WHERE name=?");
161               ps.setString(1, name);
162  
163               ResultSet res = ps.executeQuery();
164  
165               res.next();
166  
167               result = res.getInt(1);
168  
169               res.close();
170  
171               /*
172                * If there is no attendee with the given name
173                */
174               if (result == 0) {
175                   ps = conn.prepareStatement("UPDATE CSVProfiles "
176                           + "SET name=? WHERE name=?");
177  
178                   ps.setString(1, name);
179                   ps.setString(2, this.name);
180  
181                   ps.executeUpdate();
182  
183                   ps.close();
184                   conn.close();
185  
186                   this.name = name;
187               } else {
188                   ps.close();
189                   conn.close();
190  
191                   throw new DataException();
192               }
193           } catch (Exception e) {
194               throw new DataException(Data.getInstance().getLocaleStr(
195                       "message.setAppCSVProfileNameFailed")
196                       + " [NAME = " + this.name + "] " + e.getMessage());
197           }
198       }
199  
200       /**
201        * Returns the column order of this CSV profile.
202        *
203        * @return list of column names
204        * @throws DataException
205        *             If an error occurs while getting the column order
206        */
207       public List<AppCSVColumnName> getColumnOrder() throws DataException {
208           List<AppCSVColumnName> colList = new ArrayList<AppCSVColumnName>();
209  
210           try {
211               Connection conn = Data.getInstance().getAppData().openConnection();
212  
213               PreparedStatement ps = conn
214                       .prepareStatement("SELECT columnOrder FROM CSVProfiles "
215                               + "WHERE name = ?");
216  
217               ps.setString(1, this.name);
218  
219               ResultSet res = ps.executeQuery();
220  
221               res.next();
222  
223               for (String colName : res.getString("columnOrder").split("\\|")) {
224                   colList.add(AppCSVColumnName.valueOf(colName));
225               }
226  
227               res.close();
228               ps.close();
229               conn.close();
230           } catch (Exception e) {
231               /*
232                * Not part of the unit testing, because this exception is only
233                * thrown if there occurs an internal error.
234                */
235               throw new DataException(Data.getInstance().getLocaleStr(
236                       "message.getAppCSVProfileColumnOrderFailed")
237                       + " [NAME = " + this.name + "] " + e.getMessage());
238           }
239  
240           return colList;
241       }
242  
243       /**
244        * Sets the column order of this CSV profile.
245        *
246        * @param colList
247        *            list of column names
248        * @throws DataException
249        *             If an error occurs while setting the column order
250        */
251       public void setColumnOrder(List<AppCSVColumnName> colList)
252               throws DataException {
253           /*
254            * Build a checklist to ensure the correctness of column order
255            */
256           List<AppCSVColumnName> checkList = new ArrayList<AppCSVColumnName>();
257  
258           for (AppCSVColumnName col : AppCSVColumnName.values()) {
259               checkList.add(col);
260           }
261  
262           /*
263            * Create the column order string
264            */
265           String colOrder = "";
266           String separator = "";
267  
268           for (AppCSVColumnName col : colList) {
269               checkList.remove(col);
270  
271               colOrder = colOrder + separator + col.toString();
272  
273               separator = "|";
274           }
275  
276           try {
277               if (checkList.isEmpty()) {
278                   Connection conn = Data.getInstance().getAppData()
279                           .openConnection();
280  
281                   PreparedStatement ps = conn
282                           .prepareStatement("UPDATE CSVProfiles "
283                                   + "SET columnOrder=? WHERE name=?");
284  
285                   ps.setString(1, colOrder);
286                   ps.setString(2, this.name);
287  
288                   ps.executeUpdate();
289  
290                   ps.close();
291                   conn.close();
292               } else {
293                   throw new DataException();
294               }
295           } catch (Exception e) {
296               throw new DataException(Data.getInstance().getLocaleStr(
297                       "message.setAppCSVProfileColumnOrderFailed")
298                       + " [NAME = " + this.name + "] " + e.getMessage());
299           }
300       }
301  
302       /**
303        * Returns boolean value if the property showColumnsInFirstLine is set or
304        * not.
305        *
306        * @return true if the property is set, otherwise false
307        * @throws DataException
308        *             If an error occurs while getting the value of the property
309        */
310       public boolean isColsInFirstLine() throws DataException {
311           boolean cfl = true;
312  
313           try {
314               Connection conn = Data.getInstance().getAppData().openConnection();
315  
316               PreparedStatement ps = conn
317                       .prepareStatement("SELECT columnsInFirstLine FROM CSVProfiles "
318                               + "WHERE name = ?");
319               ps.setString(1, this.name);
320  
321               ResultSet res = ps.executeQuery();
322  
323               res.next();
324  
325               cfl = res.getBoolean("columnsInFirstLine");
326  
327               res.close();
328               ps.close();
329               conn.close();
330           } catch (Exception e) {
331               /*
332                * Not part of the unit testing, because this exception is only
333                * thrown if there occurs an internal error.
334                */
335               throw new DataException(Data.getInstance().getLocaleStr(
336                       "message.getAppCSVProfilePropertyFailed")
337                       + " [NAME = " + this.name + "] " + e.getMessage());
338           }
339  
340           return cfl;
341       }
342  
343       /**
344        * Sets the property showColumnsInFirstLine of this CSV profile.
345        *
346        * @param cfl
347        *            value of the property
348        * @throws DataException
349        *             If an error occurs while setting the property's value
350        */
351       public void setColsInFirstLine(boolean cfl) throws DataException {
352           try {
353               Connection conn = Data.getInstance().getAppData().openConnection();
354  
355               PreparedStatement ps = conn.prepareStatement("UPDATE CSVProfiles "
356                       + "SET columnsInFirstLine=? WHERE name=?");
357               ps.setBoolean(1, cfl);
358               ps.setString(2, this.name);
359  
360               ps.executeUpdate();
361  
362               ps.close();
363               conn.close();
364           } catch (Exception e) {
365               /*
366                * Not part of the unit testing, because this exception is only
367                * thrown if there occurs an internal error.
368                */
369               throw new DataException(Data.getInstance().getLocaleStr(
370                       "message.setAppCSVProfilePropertyFailed")
371                       + " [NAME = " + this.name + "] " + e.getMessage());
372           }
373       }
374  
375       /**
376        * Returns boolean value if the property encapsulateContent is set or not.
377        *
378        * @return true if the property is set, otherwise false
379        * @throws DataException
380        *             If an error occurs while getting the value of the property
381        */
382       public boolean isEncapsulateContent() throws DataException {
383           boolean ec = true;
384  
385           try {
386               Connection conn = Data.getInstance().getAppData().openConnection();
387  
388               PreparedStatement ps = conn
389                       .prepareStatement("SELECT encapsulateContent FROM CSVProfiles "
390                               + "WHERE name = ?");
391               ps.setString(1, this.name);
392  
393               ResultSet res = ps.executeQuery();
394  
395               res.next();
396  
397               ec = res.getBoolean("encapsulateContent");
398  
399               res.close();
400               ps.close();
401               conn.close();
402           } catch (Exception e) {
403               /*
404                * Not part of the unit testing, because this exception is only
405                * thrown if there occurs an internal error.
406                */
407               throw new DataException(Data.getInstance().getLocaleStr(
408                       "message.getAppCSVProfilePropertyFailed")
409                       + " [NAME = " + this.name + "] " + e.getMessage());
410           }
411  
412           return ec;
413       }
414  
415       /**
416        * Sets the property encapsulateContent of this CSV profile.
417        *
418        * @param ec
419        *            value of the property
420        * @throws DataException
421        *             If an error occurs while setting property's value
422        */
423       public void setEncapsulateContent(boolean ec) throws DataException {
424           try {
425               Connection conn = Data.getInstance().getAppData().openConnection();
426  
427               PreparedStatement ps = conn.prepareStatement("UPDATE CSVProfiles "
428                       + "SET encapsulateContent=? WHERE name=?");
429               ps.setBoolean(1, ec);
430               ps.setString(2, this.name);
431  
432               ps.executeUpdate();
433  
434               ps.close();
435               conn.close();
436           } catch (Exception e) {
437               /*
438                * Not part of the unit testing, because this exception is only
439                * thrown if there occurs an internal error.
440                */
441               throw new DataException(Data.getInstance().getLocaleStr(
442                       "message.setAppCSVProfilePropertyFailed")
443                       + " [NAME = " + this.name + "] " + e.getMessage());
444           }
445       }
446  
447       /**
448        * Returns the mapping for a given column. If there is no mapping, then null
449        * will be returned.
450        *
451        * @param col
452        *            column of the requested mapping
453        * @return the mapping for the given column; if no mapping exists, the
454        *         original column name will be returned
455        * @throws DataException
456        *             If an error occurs while getting the column mapping
457        */
458       public String getColumnMapping(AppCSVColumnName col) throws DataException {
459           String mapping = col.toString();
460  
461           try {
462               Connection conn = Data.getInstance().getAppData().openConnection();
463  
464               PreparedStatement ps = conn
465                       .prepareStatement("SELECT columnMapping FROM CSVColumnMappings "
466                               + "WHERE profileName=? AND columnName=?");
467               ps.setString(1, this.name);
468               ps.setString(2, col.toString());
469  
470               ResultSet res = ps.executeQuery();
471  
472               if (res.next()) {
473                   mapping = res.getString("columnMapping");
474               }
475  
476               res.close();
477               ps.close();
478               conn.close();
479           } catch (Exception e) {
480               /*
481                * Not part of the unit testing, because this exception is only
482                * thrown if there occurs an internal error.
483                */
484               throw new DataException(Data.getInstance().getLocaleStr(
485                       "message.getAppCSVProfilePropertyFailed")
486                       + " [NAME = " + this.name + "] " + e.getMessage());
487           }
488  
489           return mapping;
490       }
491  
492       /**
493        * Checks if a column mapping for the given column exists.
494        *
495        * @param col
496        * @return
497        * @throws DataException
498        */
499       public boolean existColumnMapping(AppCSVColumnName col)
500               throws DataException {
501           boolean existMapping = false;
502  
503           try {
504               Connection conn = Data.getInstance().getAppData().openConnection();
505  
506               PreparedStatement ps = conn
507                       .prepareStatement("SELECT columnMapping FROM CSVColumnMappings "
508                               + "WHERE profileName=? AND columnName=?");
509               ps.setString(1, this.name);
510               ps.setString(2, col.toString());
511  
512               ResultSet res = ps.executeQuery();
513  
514               if (res.next()) {
515                   existMapping = true;
516               }
517  
518               res.close();
519               ps.close();
520               conn.close();
521           } catch (Exception e) {
522               /*
523                * Not part of the unit testing, because this exception is only
524                * thrown if there occurs an internal error.
525                */
526               throw new DataException(Data.getInstance().getLocaleStr(
527                       "message.getAppCSVProfilePropertyFailed")
528                       + " [NAME = " + this.name + "] " + e.getMessage());
529           }
530  
531           return existMapping;
532       }
533  
534       /**
535        * Sets a mapping for the given column.
536        *
537        * @param col
538        *            column
539        * @param map
540        *            mapping
541        * @throws DataException
542        *             If an error occurs while setting the column mapping
543        */
544       public void setColumnMapping(AppCSVColumnName col, String map)
545               throws DataException {
546           try {
547               Connection conn = Data.getInstance().getAppData().openConnection();
548  
549               PreparedStatement ps;
550  
551               if (existColumnMapping(col)) {
552                   ps = conn.prepareStatement("UPDATE CSVColumnMappings "
553                           + "SET columnMapping=? "
554                           + "WHERE profileName=? AND columnName=?");
555               } else {
556                   ps = conn.prepareStatement("INSERT INTO CSVColumnMappings "
557                           + "(columnMapping, profileName, columnName) "
558                           + "VALUES (?, ?, ?)");
559               }
560  
561               ps.setString(1, map);
562               ps.setString(2, this.name);
563               ps.setString(3, col.toString());
564  
565               ps.executeUpdate();
566  
567               ps.close();
568               conn.close();
569           } catch (Exception e) {
570               /*
571                * Not part of the unit testing, because this exception is only
572                * thrown if there occurs an internal error.
573                */
574               throw new DataException(Data.getInstance().getLocaleStr(
575                       "message.setAppCSVProfilePropertyFailed")
576                       + " [NAME = " + this.name + "] " + e.getMessage());
577           }
578       }
579  
580       /**
581        * Removes the mapping of the given column.
582        *
583        * @param col
584        *            column
585        * @throws DataException
586        *             If an error occurs while removing the column mapping
587        */
588       public void removeColumnMapping(AppCSVColumnName col) throws DataException {
589           try {
590               if (getColumnMapping(col) != null) {
591                   Connection conn = Data.getInstance().getAppData()
592                           .openConnection();
593  
594                   PreparedStatement ps = conn
595                           .prepareStatement("DELETE FROM CSVColumnMappings "
596                                   + "WHERE profileName=? AND columnName=?");
597  
598                   ps.setString(1, this.name);
599                   ps.setString(2, col.toString());
600  
601                   ps.executeUpdate();
602  
603                   ps.close();
604                   conn.close();
605               }
606           } catch (Exception e) {
607               /*
608                * Not part of the unit testing, because this exception is only
609                * thrown if there occurs an internal error.
610                */
611               throw new DataException(Data.getInstance().getLocaleStr(
612                       "message.setAppCSVProfilePropertyFailed")
613                       + " [NAME = " + this.name + "] " + e.getMessage());
614           }
615       }
616  
617       /**
618        * Returns the list of valid severity mapping of this CSV profile.
619        *
620        * @return list of severity mappings
621        * @throws DataException
622        *             If an error occurs while getting the severity mappings
623        */
624       public List<String> getValidSeverityMappings() throws DataException {
625           List<String> mappings = new ArrayList<String>();
626  
627           try {
628               Connection conn = Data.getInstance().getAppData().openConnection();
629  
630               PreparedStatement ps = conn
631                       .prepareStatement("SELECT validMappings FROM CSVSeverityMappings "
632                               + "WHERE profileName = ?");
633               ps.setString(1, this.name);
634  
635               ResultSet res = ps.executeQuery();
636  
637               if (res.next()) {
638                   for (String map : res.getString("validMappings").split("\\|")) {
639                       mappings.add(map);
640                   }
641               }
642  
643               res.close();
644               ps.close();
645               conn.close();
646           } catch (Exception e) {
647               /*
648                * Not part of the unit testing, because this exception is only
649                * thrown if there occurs an internal error.
650                */
651               throw new DataException(Data.getInstance().getLocaleStr(
652                       "message.getAppCSVProfilePropertyFailed")
653                       + " [NAME = " + this.name + "] " + e.getMessage());
654           }
655  
656           return mappings;
657       }
658  
659       /**
660        * Sets the valid severity mappings for this CSV profile. One mapping can
661        * only occur once in the list.
662        *
663        * @param mappings
664        *            list of severity mappings
665        * @throws DataException
666        *             If an error occurs while setting the severity mappings
667        */
668       public void setValidSeverityMappings(List<String> mappings)
669               throws DataException {
670           Set<String> mappingSet = new HashSet<String>();
671  
672           if (mappings == null) {
673               mappings = new ArrayList<String>();
674           }
675  
676           /*
677            * Prepare string of valid mappings
678            */
679           String maps = "";
680           String separator = "";
681  
682           for (String map : mappings) {
683               /*
684                * To ensure that a mapping is added only once, the mappingSet is
685                * used for help
686                */
687               if (mappingSet.add(map)) {
688                   maps = maps + separator + map.toString();
689                   separator = "|";
690               }
691           }
692  
693           try {
694               Connection conn = Data.getInstance().getAppData().openConnection();
695  
696               PreparedStatement ps;
697  
698               if (mappings.isEmpty()) {
699                   ps = conn.prepareStatement("DELETE FROM CSVSeverityMappings "
700                           + "WHERE profileName=?");
701                   ps.setString(1, this.name);
702               } else if (getValidSeverityMappings().isEmpty()) {
703                   ps = conn.prepareStatement("INSERT INTO CSVSeverityMappings "
704                           + "(profileName, validMappings) VALUES (?, ?)");
705                   ps.setString(1, this.name);
706                   ps.setString(2, maps);
707               } else {
708                   ps = conn.prepareStatement("UPDATE CSVSeverityMappings "
709                           + "SET validMappings=? WHERE profileName=?");
710                   ps.setString(1, maps);
711                   ps.setString(2, this.name);
712               }
713  
714               ps.executeUpdate();
715  
716               ps.close();
717               conn.close();
718           } catch (Exception e) {
719               /*
720                * Not part of the unit testing, because this exception is only
721                * thrown if there occurs an internal error.
722                */
723               throw new DataException(Data.getInstance().getLocaleStr(
724                       "message.setAppCSVProfilePropertyFailed")
725                       + " [NAME = " + this.name + "] " + e.getMessage());
726           }
727       }
728  
729       /**
730        * Returns if the given mapping is a valid severity mapping.
731        *
732        * @param mapping
733        *            to check
734        * @return true if the the mapping is a valid severity mapping
735        * @throws DataException
736        *             If an error occurs while checking the mapping
737        */
738       public boolean isValidSeverityMapping(String mapping) throws DataException {
739           return getValidSeverityMappings().contains(mapping);
740       }
741  
742       /**
743        * Returns the index of the specified element in this list, or -1 if this
744        * list does not contain the element.
745        *
746        * @param mapping
747        * @return index of the specified element
748        * @throws DataException
749        *             If an error occurs while getting the sorting position
750        */
751       private int getSortPosOfSeverityMapping(String mapping)
752               throws DataException {
753           return getValidSeverityMappings().indexOf(mapping);
754       }
755  
756       /**
757        * Returns constantly 0.
758        *
759        * @return 0
760        */
761       private int getFirstSortPosOfSeverityMappings() {
762           return 0;
763       }
764  
765       /**
766        * Returns the last index of the list of valid severity mappings.
767        *
768        * @return last index of list of severity mappings
769        * @throws DataException
770        *             If an error occurs while getting the sorting position
771        */
772       private int getLastSortPosOfSeverityMappings() throws DataException {
773           return getValidSeverityMappings().size() - 1;
774       }
775  
776       /**
777        * Pushes up the given severity mapping.
778        *
779        * @param mapping
780        * @throws DataException
781        *             If an error occurs while pushing the severity mapping
782        */
783       public void pushUpSeverityMapping(String mapping) throws DataException {
784           List<String> mappings = getValidSeverityMappings();
785  
786           int sortPos = getSortPosOfSeverityMapping(mapping);
787  
788           if (sortPos > getFirstSortPosOfSeverityMappings()
789                   && isValidSeverityMapping(mapping)) {
790               String otherMapping = mappings.get(sortPos - 1);
791               mappings.set(sortPos - 1, mapping);
792               mappings.set(sortPos, otherMapping);
793           }
794  
795           setValidSeverityMappings(mappings);
796       }
797  
798       /**
799        * Pushes down the given severity mapping.
800        *
801        * @param mapping
802        * @throws DataException
803        *             If an error occurs while pushing the severity mapping
804        */
805       public void pushDownSeverityMapping(String mapping) throws DataException {
806           List<String> mappings = getValidSeverityMappings();
807  
808           int sortPos = getSortPosOfSeverityMapping(mapping);
809  
810           if (sortPos < getLastSortPosOfSeverityMappings()
811                   && isValidSeverityMapping(mapping)) {
812               String otherMapping = mappings.get(sortPos + 1);
813               mappings.set(sortPos + 1, mapping);
814               mappings.set(sortPos, otherMapping);
815           }
816  
817           setValidSeverityMappings(mappings);
818       }
819  
820   }
AppCSVColumnName.java
27   public enum AppCSVColumnName {
28       DESCRIPTION, REFERENCE, SEVERITY, REPORTER;
29   }
AppAttendee.java
37   public class AppAttendee {
38  
39       /**
40        * The name of the attendee.
41        */
42       private String name = null;
43  
44       /**
45        * Contact information of the attendee
46        */
47       private String contact = null;
48  
49       /**
50        * Internally used contructor to create a new instance of this class by the
51        * name of the attendee.
52        *
53        * @param name
54        *            of the attendee
55        * @param contact
56        *            contact information of the attendee
57        */
58       protected AppAttendee(String name, String contact) {
59           super();
60           this.name = name;
61           this.contact = contact;
62       }
63  
64       /**
65        * Returns a string representation of this object.
66        */
67       @Override
68       public String toString() {
69           String contact = this.contact;
70  
71           if (contact.length() > 20) {
72               contact = contact.substring(0, 20) + "...";
73           }
74  
75           return this.name + " (" + contact + ")";
76       }
77  
78       /**
79        * If the name of two AppAttendee instances is equal, then they are declared
80        * as equal by this method.
81        */
82       @Override
83       public boolean equals(Object obj) {
84           AppAttendee otherAtt = (AppAttendee) obj;
85           boolean isEqual = false;
86  
87           try {
88               if (this.name.equals(otherAtt.getName())
89                       && this.contact.equals(otherAtt.getContact())) {
90                   isEqual = true;
91               }
92           } catch (DataException e) {
93               /*
94                * Not part of the unit testing, because this exception is only
95                * thrown if there occurs an internal error.
96                */
97               isEqual = false;
98           }
99  
100           return isEqual;
101       }
102  
103       /**
104        * Creates a new instance of this class by the attendee name.
105        *
106        * @param name
107        *            of the attendee
108        * @param contact
109        *            contact information of the attendee
110        * @return
111        * @throws DataException
112        *             If an error occurs while creating a new instance
113        */
114       public static AppAttendee newInstance(String name, String contact)
115               throws DataException {
116           try {
117               Connection conn = Data.getInstance().getAppData().openConnection();
118  
119               PreparedStatement ps = conn
120                       .prepareStatement("SELECT name,contact FROM Attendees "
121                               + "WHERE name = ? AND contact = ?");
122  
123               ps.setString(1, name);
124               ps.setString(2, contact);
125  
126               ResultSet res = ps.executeQuery();
127  
128               /*
129                * If an attendee with the given name does not exist
130                */
131               if (!res.next()) {
132                   ps = conn.prepareStatement("INSERT INTO Attendees "
133                           + "(name, contact) VALUES (?, ?)");
134  
135                   ps.setString(1, name);
136                   ps.setString(2, contact);
137  
138                   ps.executeUpdate();
139               }
140  
141               res.close();
142               ps.close();
143               conn.close();
144           } catch (Exception e) {
145               /*
146                * Not part of the unit testing, because this exception is only
147                * thrown if there occurs an internal error.
148                */
149               throw new DataException(Data.getInstance().getLocaleStr(
150                       "message.newInstAppAttendeeFailed")
151                       + " [NAME = " + name + "] " + e.getMessage());
152           }
153  
154           return new AppAttendee(name, contact);
155       }
156  
157       /**
158        * Returns the name of the attendee
159        *
160        * @return name of attendee
161        */
162       public String getName() {
163           return this.name;
164       }
165  
166       /**
167        * Returns the contact information of the attendee.
168        *
169        * @return attendee's contact information
170        * @throws DataException
171        *             If an error occurs while getting the contact information
172        */
173       public String getContact() throws DataException {
174           return this.contact;
175       }
176  
177       /**
178        * Sets name of the attendee.
179        *
180        * @param name
181        *            of the attendee
182        * @throws DataException
183        *             If an error occurs while setting attendee's name
184        */
185       public void setName(String name) throws DataException {
186           setNameAndContact(name, this.contact);
187       }
188  
189       /**
190        * Sets contact of the attendee.
191        *
192        * @param contact
193        *            contact information of the attendee
194        * @throws DataException
195        *             If an error occurs while setting attendee's contact
196        */
197       public void setContact(String contact) throws DataException {
198           setNameAndContact(this.name, contact);
199       }
200  
201       /**
202        * Sets name and contact of the attendee.
203        *
204        * @param name
205        *            of the attendee
206        * @param contact
207        *            contact information of the attendee
208        * @throws DataException
209        *             If an error occurs while setting attendee's name and contact
210        */
211       public void setNameAndContact(String name, String contact)
212               throws DataException {
213           int result = 0;
214  
215           try {
216               Connection conn = Data.getInstance().getAppData().openConnection();
217  
218               PreparedStatement ps = conn
219                       .prepareStatement("SELECT COUNT(*) FROM Attendees WHERE name=? AND contact=?");
220               ps.setString(1, name);
221               ps.setString(2, contact);
222  
223               ResultSet res = ps.executeQuery();
224  
225               res.next();
226  
227               result = res.getInt(1);
228  
229               res.close();
230  
231               /*
232                * If there is no attendee with the given name and contact
233                */
234               if (result == 0) {
235                   ps = conn.prepareStatement("UPDATE Attendees "
236                           + "SET name=?, contact=? WHERE name=? AND contact=?");
237  
238                   ps.setString(1, name);
239                   ps.setString(2, contact);
240                   ps.setString(3, this.name);
241                   ps.setString(4, this.contact);
242  
243                   ps.executeUpdate();
244  
245                   ps.close();
246  
247                   /*
248                    * If strengths for this attendee exist, update the attendee
249                    * strengths table
250                    */
251                   ps = conn
252                           .prepareStatement("UPDATE AttendeesStrengths "
253                                   + "SET attendeeName=?, attendeeContact=? WHERE attendeeName=? AND attendeeContact=?");
254  
255                   ps.setString(1, name);
256                   ps.setString(2, contact);
257                   ps.setString(3, this.name);
258                   ps.setString(4, this.contact);
259  
260                   ps.executeUpdate();
261  
262                   ps.close();
263  
264                   conn.close();
265  
266                   this.name = name;
267                   this.contact = contact;
268               } else {
269                   ps.close();
270                   conn.close();
271  
272                   throw new DataException();
273               }
274           } catch (Exception e) {
275               throw new DataException(Data.getInstance().getLocaleStr(
276                       "message.setAppAttendeeNameFailed")
277                       + " [NAME = " + this.name + "] " + e.getMessage());
278           }
279       }
280  
281       /**
282        * Returns the strengths of this attendee.
283        *
284        * @return strengths of this attendee
285        * @throws DataException
286        *             If an error occurs while getting attendee's strengths
287        */
288       public List<String> getStrengths() throws DataException {
289           List<String> contact = new ArrayList<String>();
290  
291           try {
292               Connection conn = Data.getInstance().getAppData().openConnection();
293  
294               PreparedStatement ps = conn
295                       .prepareStatement("SELECT categoryName FROM AttendeesStrengths "
296                               + "WHERE attendeeName=? AND attendeeContact=? ORDER BY categoryName ASC");
297  
298               ps.setString(1, this.name);
299               ps.setString(2, this.contact);
300  
301               ResultSet res = ps.executeQuery();
302  
303               while (res.next()) {
304                   contact.add(res.getString("categoryName"));
305               }
306  
307               res.close();
308               ps.close();
309               conn.close();
310           } catch (Exception e) {
311               /*
312                * Not part of the unit testing, because this exception is only
313                * thrown if there occurs an internal error.
314                */
315               throw new DataException(Data.getInstance().getLocaleStr(
316                       "message.getAppAttendeeStrengthsFailed")
317                       + " [NAME = " + this.name + "] " + e.getMessage());
318           }
319  
320           return contact;
321       }
322  
323       /**
324        * Check if this attendee has got the given strength
325        *
326        * @param str
327        *            strength to check
328        * @return true if the attendee has got the given strength, otherwise false
329        * @throws DataException
330        *             If an error occurs while checking the given strength
331        */
332       public boolean isStrength(String str) throws DataException {
333           boolean isStr = false;
334  
335           try {
336               Connection conn = Data.getInstance().getAppData().openConnection();
337  
338               PreparedStatement ps = conn
339                       .prepareStatement("SELECT * FROM AttendeesStrengths "
340                               + "WHERE attendeeName=? AND attendeeContact=? AND categoryName=?");
341               ps.setString(1, this.name);
342               ps.setString(2, this.contact);
343               ps.setString(3, str);
344  
345               ResultSet res = ps.executeQuery();
346  
347               if (res.next()) {
348                   isStr = true;
349               }
350  
351               res.close();
352               ps.close();
353               conn.close();
354           } catch (Exception e) {
355               /*
356                * Not part of the unit testing, because this exception is only
357                * thrown if there occurs an internal error.
358                */
359               throw new DataException(Data.getInstance().getLocaleStr(
360                       "message.isAppAttendeeStrengthFailed")
361                       + " [NAME = " + this.name + "] " + e.getMessage());
362           }
363  
364           return isStr;
365       }
366  
367       /**
368        * Adds the given strength to attendee's strengths.
369        *
370        * @param str
371        *            strength to add
372        * @throws DataException
373        *             If an error occurs while adding the given strength
374        */
375       public void addStrength(String str) throws DataException {
376           if (!isStrength(str)) {
377               try {
378                   Connection conn = Data.getInstance().getAppData()
379                           .openConnection();
380  
381                   PreparedStatement ps = conn
382                           .prepareStatement("INSERT INTO AttendeesStrengths "
383                                   + "(attendeeName, attendeeContact, categoryName) VALUES (?, ?, ?)");
384  
385                   ps.setString(1, this.name);
386                   ps.setString(2, this.contact);
387                   ps.setString(3, str);
388  
389                   ps.executeUpdate();
390  
391                   ps.close();
392                   conn.close();
393               } catch (Exception e) {
394                   /*
395                    * Not part of the unit testing, because this exception is only
396                    * thrown if there occurs an internal error.
397                    */
398                   throw new DataException(Data.getInstance().getLocaleStr(
399                           "message.addAppAttendeeStrengthFailed")
400                           + " [NAME = " + this.name + "] " + e.getMessage());
401               }
402           }
403       }
404  
405       /**
406        * Removes the given strength from attendee's strengths.
407        *
408        * @param str
409        *            strength to remove
410        * @throws DataException
411        *             If an error occurs while removing the strength
412        */
413       public void removeStrength(String str) throws DataException {
414           if (isStrength(str)) {
415               try {
416                   Connection conn = Data.getInstance().getAppData()
417                           .openConnection();
418  
419                   PreparedStatement ps = conn
420                           .prepareStatement("DELETE FROM AttendeesStrengths "
421                                   + "WHERE attendeeName=? AND attendeeContact=? AND categoryName=?");
422  
423                   ps.setString(1, this.name);
424                   ps.setString(2, this.contact);
425                   ps.setString(3, str);
426  
427                   ps.executeUpdate();
428  
429                   ps.close();
430                   conn.close();
431               } catch (Exception e) {
432                   /*
433                    * Not part of the unit testing, because this exception is only
434                    * thrown if there occurs an internal error.
435                    */
436                   throw new DataException(Data.getInstance().getLocaleStr(
437                           "message.removeAppAttendeeStrengthFailed")
438                           + " [NAME = " + this.name + "] " + e.getMessage());
439               }
440           }
441       }
442  
443       /**
444        * Returns this attendee as Attendee object (Resi XML schema).
445        *
446        * @return Attendee object
447        * @throws DataException
448        *             If an error occurs while converting the attendee to an
449        *             Attendee object
450        */
451       public Attendee getAsResiAttendee() throws DataException {
452           Attendee att = new Attendee();
453  
454           att.setContact(this.contact);
455           att.setAspects(null);
456           att.setId(null);
457           att.setName(this.name);
458           att.setRole(null);
459  
460           return att;
461       }
462  
463   }
AppAspect.java
36   public class AppAspect {
37  
38       /**
39        * The id of the aspect.
40        */
41       private int id = 0;
42  
43       /**
44        * The catalog to which the aspect belongs to.
45        */
46       private AppCatalog catalog = null;
47  
48       /**
49        * Constructor to create a new instance of this class by the aspect id and
50        * its catalog.
51        *
52        * @param id
53        *            of the aspect
54        */
55       public AppAspect(AppCatalog catalog, int id) {
56           super();
57           this.id = id;
58           this.catalog = catalog;
59       }
60  
61       /**
62        * Constructor to create a new aspect by the given parameters.
63        *
64        * @param directive
65        *            of the aspect
66        * @param description
67        *            of the aspect
68        * @param categoryName
69        *            of the aspect
70        * @param catalogName
71        *            of the aspect
72        * @param lastSortPos
73        *            of the aspect
74        * @throws DataException
75        *             If an error occurs while creating the aspect
76        */
77       public AppAspect(AppCatalog catalog, String directive, String description,
78               String categoryName) throws DataException {
79           super();
80  
81           this.catalog = catalog;
82  
83           int sortPos = catalog.getLastSortPosOfAspects(categoryName) + 1;
84  
85           try {
86               Connection conn = Data.getInstance().getAppData().openConnection();
87  
88               /*
89                * Add new aspect
90                */
91               PreparedStatement ps = conn
92                       .prepareStatement("INSERT INTO Aspects "
93                               + "(directive, description, categoryName, catalogName, sortPos) "
94                               + "VALUES (?, ?, ?, ?, ?)");
95  
96               ps.setString(1, directive);
97               ps.setString(2, description);
98               ps.setString(3, categoryName);
99               ps.setString(4, this.catalog.getName());
100               ps.setInt(5, sortPos);
101  
102               ps.executeUpdate();
103  
104               /*
105                * Add category if it does not exist
106                */
107               if (!catalog.isCategory(categoryName)) {
108                   ps = conn.prepareStatement("INSERT INTO Categories "
109                           + "(name, catalogName, sortPos) " + "VALUES (?, ?, ?)");
110  
111                   ps.setString(1, categoryName);
112                   ps.setString(2, this.catalog.getName());
113                   ps.setInt(3, this.catalog.getLastSortPosOfCategories() + 1);
114  
115                   ps.executeUpdate();
116               }
117  
118               /*
119                * Get ID of newly added AppAspect
120                */
121               ps = conn.prepareStatement("SELECT id FROM Aspects "
122                       + "WHERE sortPos = ? AND categoryName = ? "
123                       + "AND catalogName = ?");
124  
125               ps.setInt(1, sortPos);
126               ps.setString(2, categoryName);
127               ps.setString(3, this.catalog.getName());
128  
129               ResultSet res = ps.executeQuery();
130  
131               res.next();
132  
133               this.id = res.getInt("id");
134  
135               res.close();
136               ps.close();
137               conn.close();
138           } catch (Exception e) {
139               /*
140                * Not part of the unit testing, because this exception is only
141                * thrown if there occurs an internal error.
142                */
143               throw new DataException(Data.getInstance().getLocaleStr(
144                       "message.newAppAspectFailed")
145                       + " [DIRECTIVE = " + directive + "] " + e.getMessage());
146           }
147       }
148       
149       /**
150        * Returns a string representation of this object.
151        */
152       @Override
153       public String toString() {
154           try {
155               return getDirective();
156           } catch (DataException e) {
157               return "";
158           }
159       }
160  
161       /**
162        * If the id of two AppAspect instances is equal, then they are declared as
163        * equal by this method.
164        */
165       @Override
166       public boolean equals(Object obj) {
167           AppAspect otherAsp = (AppAspect) obj;
168           boolean isEqual = false;
169  
170           if (this.getId() == otherAsp.getId()) {
171               isEqual = true;
172           }
173  
174           return isEqual;
175       }
176  
177       /**
178        * Returns the id of this aspect.
179        *
180        * @return id of the aspect
181        */
182       public int getId() {
183           return this.id;
184       }
185  
186       /**
187        * Returns the directive of this aspect.
188        *
189        * @return aspect directive
190        * @throws DataException
191        *             If an error occurs while getting the directive of this aspect
192        */
193       public String getDirective() throws DataException {
194           String directive = null;
195  
196           try {
197               Connection conn = Data.getInstance().getAppData().openConnection();
198  
199               PreparedStatement ps = conn
200                       .prepareStatement("SELECT directive FROM Aspects "
201                               + "WHERE id = ?");
202               ps.setInt(1, this.id);
203  
204               ResultSet res = ps.executeQuery();
205  
206               res.next();
207  
208               directive = res.getString("directive");
209  
210               res.close();
211               ps.close();
212               conn.close();
213           } catch (Exception e) {
214               throw new DataException(Data.getInstance().getLocaleStr(
215                       "message.getAppAspectDirectiveFailed")
216                       + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
217           }
218  
219           return directive;
220       }
221  
222       /**
223        * Sets the directive of this aspect.
224        *
225        * @param dir
226        *            aspect directive
227        * @throws DataException
228        *             If an error occurs while setting the directive
229        */
230       public void setDirective(String dir) throws DataException {
231           try {
232               Connection conn = Data.getInstance().getAppData().openConnection();
233  
234               PreparedStatement ps = conn.prepareStatement("UPDATE Aspects "
235                       + "SET directive=? WHERE id=?");
236               ps.setString(1, dir);
237               ps.setInt(2, this.id);
238  
239               ps.executeUpdate();
240  
241               ps.close();
242               conn.close();
243           } catch (Exception e) {
244               /*
245                * Not part of the unit testing, because this exception is only
246                * thrown if there occurs an internal error.
247                */
248               throw new DataException(Data.getInstance().getLocaleStr(
249                       "message.setAppAspectDirectiveFailed")
250                       + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
251           }
252       }
253  
254       /**
255        * Returns the description of this aspect.
256        *
257        * @return aspect description
258        * @throws DataException
259        *             If an error occurs while getting the description
260        */
261       public String getDescription() throws DataException {
262           String description = null;
263  
264           try {
265               Connection conn = Data.getInstance().getAppData().openConnection();
266  
267               PreparedStatement ps = conn
268                       .prepareStatement("SELECT description FROM Aspects "
269                               + "WHERE id = ?");
270               ps.setInt(1, this.id);
271  
272               ResultSet res = ps.executeQuery();
273  
274               res.next();
275  
276               description = res.getString("description");
277  
278               res.close();
279               ps.close();
280               conn.close();
281           } catch (Exception e) {
282               /*
283                * Not part of the unit testing, because this exception is only
284                * thrown if there occurs an internal error.
285                */
286               throw new DataException(Data.getInstance().getLocaleStr(
287                       "message.getAppAspectDescriptionFailed")
288                       + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
289           }
290  
291           return description;
292       }
293  
294       /**
295        * Sets the description of this aspect.
296        *
297        * @param desc
298        *            aspect description
299        * @throws DataException
300        *             If an error occurs while setting the aspect description
301        */
302       public void setDescription(String desc) throws DataException {
303           try {
304               Connection conn = Data.getInstance().getAppData().openConnection();
305  
306               PreparedStatement ps = conn.prepareStatement("UPDATE Aspects "
307                       + "SET description=? WHERE id=?");
308               ps.setString(1, desc);
309               ps.setInt(2, this.id);
310  
311               ps.executeUpdate();
312  
313               ps.close();
314               conn.close();
315           } catch (Exception e) {
316               /*
317                * Not part of the unit testing, because this exception is only
318                * thrown if there occurs an internal error.
319                */
320               throw new DataException(Data.getInstance().getLocaleStr(
321                       "message.setAppAspectDescriptionFailed")
322                       + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
323           }
324       }
325  
326       /**
327        * Returns the category of this aspect.
328        *
329        * @return aspect category
330        * @throws DataException
331        *             If an error occurs while getting the category of this aspect
332        */
333       public String getCategory() throws DataException {
334           String category = null;
335  
336           try {
337               Connection conn = Data.getInstance().getAppData().openConnection();
338  
339               PreparedStatement ps = conn
340                       .prepareStatement("SELECT categoryName FROM Aspects "
341                               + "WHERE id = ?");
342               ps.setInt(1, this.id);
343  
344               ResultSet res = ps.executeQuery();
345  
346               res.next();
347  
348               category = res.getString("categoryName");
349  
350               res.close();
351               ps.close();
352               conn.close();
353           } catch (Exception e) {
354               /*
355                * Not part of the unit testing, because this exception is only
356                * thrown if there occurs an internal error.
357                */
358               throw new DataException(Data.getInstance().getLocaleStr(
359                       "message.getAppAspectCategoryFailed")
360                       + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
361           }
362  
363           return category;
364       }
365  
366       /**
367        * Sets the category of this aspect.
368        *
369        * @param cat
370        *            aspect category
371        * @throws DataException
372        *             If an error occurs while setting the category of this aspect
373        */
374       public void setCategory(String cat) throws DataException {
375           String currentCat = getCategory();
376  
377           try {
378               Connection conn = Data.getInstance().getAppData().openConnection();
379  
380               PreparedStatement ps;
381  
382               /*
383                * Add new category
384                */
385               if (this.catalog.isCategory(cat) == false) {
386                   ps = conn.prepareStatement("INSERT INTO Categories "
387                           + "(name, catalogName, sortPos) VALUES (?, ?, ?)");
388                   ps.setString(1, cat);
389                   ps.setString(2, this.catalog.getName());
390                   ps.setInt(3, this.catalog.getLastSortPosOfCategories() + 1);
391                   ps.executeUpdate();
392               }
393  
394               /*
395                * Update aspect
396                */
397               ps = conn.prepareStatement("UPDATE Aspects "
398                       + "SET categoryName=?, sortPos=? WHERE id=?");
399               ps.setString(1, cat);
400               ps.setInt(2, this.catalog.getLastSortPosOfAspects(cat) + 1);
401               ps.setInt(3, this.id);
402               ps.executeUpdate();
403  
404               /*
405                * Remove old category
406                */
407               if (this.catalog.getNumberOfAspects(currentCat) == 0) {
408                   ps = conn.prepareStatement("DELETE FROM Categories "
409                           + "WHERE name = ? AND catalogName = ?");
410                   ps.setString(1, currentCat);
411                   ps.setString(2, catalog.getName());
412                   ps.executeUpdate();
413               }
414  
415               ps.close();
416               conn.close();
417           } catch (Exception e) {
418               /*
419                * Not part of the unit testing, because this exception is only
420                * thrown if there occurs an internal error.
421                */
422               throw new DataException(Data.getInstance().getLocaleStr(
423                       "message.setAppAspectCategoryFailed")
424                       + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
425           }
426       }
427  
428       /**
429        * Pushes this aspect depending on the given push mode.
430        *
431        * @param mode
432        *            push mode
433        * @throws DataException
434        *             If an error occurs while pushing the aspect
435        */
436       private void pushAspect(PushMode mode) throws DataException {
437           int curSortPos = getSortPos();
438           int pushSortPos = 0;
439           boolean doPush = false;
440  
441           if (mode == PushMode.UP) {
442               pushSortPos = getSortPosOfPredecessor();
443               doPush = curSortPos > catalog
444                       .getFirstSortPosOfAspects(getCategory());
445           } else if (mode == PushMode.DOWN) {
446               pushSortPos = getSortPosOfSuccessor();
447               doPush = curSortPos < catalog
448                       .getLastSortPosOfAspects(getCategory());
449           }
450  
451           if (doPush) {
452               try {
453                   Connection conn = Data.getInstance().getAppData()
454                           .openConnection();
455                   conn.setAutoCommit(false);
456  
457                   /*
458                    * Update sorting position of the other element
459                    */
460                   PreparedStatement ps = conn
461                           .prepareStatement("UPDATE Aspects "
462                                   + "SET sortPos=? WHERE sortPos=? AND catalogName=? AND categoryName=?");
463                   ps.setInt(1, curSortPos);
464                   ps.setInt(2, pushSortPos);
465                   ps.setString(3, catalog.getName());
466                   ps.setString(4, getCategory());
467                   ps.executeUpdate();
468  
469                   /*
470                    * Update sorting position of this element
471                    */
472                   ps = conn.prepareStatement("UPDATE Aspects "
473                           + "SET sortPos=? WHERE id=?");
474                   ps.setInt(1, pushSortPos);
475                   ps.setInt(2, id);
476                   ps.executeUpdate();
477  
478                   conn.commit();
479  
480                   ps.close();
481                   conn.close();
482               } catch (Exception e) {
483                   /*
484                    * Not part of the unit testing, because this exception is only
485                    * thrown if there occurs an internal error.
486                    */
487                   throw new DataException(Data.getInstance().getLocaleStr(
488                           "message.pushAppAspectFailed")
489                           + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
490               }
491           }
492       }
493  
494       /**
495        * Pushes the aspect one step up.
496        *
497        * @throws DataException
498        *             If an error occurs while pushing the aspect
499        */
500       public void pushUp() throws DataException {
501           pushAspect(PushMode.UP);
502       }
503  
504       /**
505        * Pushes the aspect one step down.
506        *
507        * @throws DataException
508        *             If an error occurs while pushing the aspect
509        */
510       public void pushDown() throws DataException {
511           pushAspect(PushMode.DOWN);
512       }
513  
514       /**
515        * Pushes the aspect to the top.
516        *
517        * @throws DataException
518        *             If an error occurs while pushing the aspect
519        */
520       public void pushTop() throws DataException {
521           while (getSortPos() > catalog.getFirstSortPosOfAspects(getCategory())) {
522               pushUp();
523           }
524       }
525  
526       /**
527        * Pushes the aspect to the bottom.
528        *
529        * @throws DataException
530        *             If an error occurs while pushing the aspect
531        */
532       public void pushBottom() throws DataException {
533           while (getSortPos() < catalog.getLastSortPosOfAspects(getCategory())) {
534               pushDown();
535           }
536       }
537  
538       /**
539        * Returns the sorting position of this aspect.
540        *
541        * @return sorting position
542        * @throws DataException
543        *             If an error occurs while getting the sorting position
544        */
545       public int getSortPos() throws DataException {
546           int sortPos = 0;
547  
548           try {
549               Connection conn = Data.getInstance().getAppData().openConnection();
550  
551               PreparedStatement ps = conn
552                       .prepareStatement("SELECT sortPos FROM Aspects "
553                               + "WHERE id = ?");
554               ps.setInt(1, this.id);
555  
556               ResultSet res = ps.executeQuery();
557  
558               if (res.next()) {
559                   sortPos = res.getInt("sortPos");
560               }
561  
562               res.close();
563               ps.close();
564               conn.close();
565           } catch (Exception e) {
566               /*
567                * Not part of the unit testing, because this exception is only
568                * thrown if there occurs an internal error.
569                */
570               throw new DataException(Data.getInstance().getLocaleStr(
571                       "message.getSortPosOfAppAspectFailed")
572                       + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
573           }
574  
575           return sortPos;
576       }
577  
578       /**
579        * Returns the sorting position of the predecessor.
580        *
581        * @return sorting position
582        * @throws DataException
583        *             If an error occurs while getting the sorting position
584        */
585       private int getSortPosOfPredecessor() throws DataException {
586           int sortPos = 0;
587  
588           try {
589               Connection conn = Data.getInstance().getAppData().openConnection();
590  
591               PreparedStatement ps = conn
592                       .prepareStatement("SELECT sortPos FROM Aspects "
593                               + "WHERE sortPos < ? AND categoryName = ? AND catalogName = ? "
594                               + "ORDER BY sortPos DESC");
595               ps.setInt(1, getSortPos());
596               ps.setString(2, getCategory());
597               ps.setString(3, catalog.getName());
598               ps.setMaxRows(1);
599  
600               ResultSet res = ps.executeQuery();
601  
602               if (res.next()) {
603                   sortPos = res.getInt("sortPos");
604               }
605  
606               res.close();
607               ps.close();
608               conn.close();
609           } catch (Exception e) {
610               /*
611                * Not part of the unit testing, because this exception is only
612                * thrown if there occurs an internal error.
613                */
614               throw new DataException(Data.getInstance().getLocaleStr(
615                       "message.getSortPosOfAppAspectFailed")
616                       + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
617           }
618  
619           return sortPos;
620       }
621  
622       /**
623        * Returns the sorting position of the successor.
624        *
625        * @return sorting position
626        * @throws DataException
627        *             If an error occurs while getting the sorting position
628        */
629       private int getSortPosOfSuccessor() throws DataException {
630           int sortPos = 0;
631  
632           try {
633               Connection conn = Data.getInstance().getAppData().openConnection();
634  
635               PreparedStatement ps = conn
636                       .prepareStatement("SELECT sortPos FROM Aspects "
637                               + "WHERE sortPos > ? AND categoryName = ? AND catalogName = ? "
638                               + "ORDER BY sortPos ASC");
639               ps.setInt(1, getSortPos());
640               ps.setString(2, getCategory());
641               ps.setString(3, catalog.getName());
642               ps.setMaxRows(1);
643  
644               ResultSet res = ps.executeQuery();
645  
646               if (res.next()) {
647                   sortPos = res.getInt("sortPos");
648               }
649  
650               res.close();
651               ps.close();
652               conn.close();
653           } catch (Exception e) {
654               /*
655                * Not part of the unit testing, because this exception is only
656                * thrown if there occurs an internal error.
657                */
658               throw new DataException(Data.getInstance().getLocaleStr(
659                       "message.getSortPosOfAppAspectFailed")
660                       + " [ASPECT_ID = " + this.id + "] " + e.getMessage());
661           }
662  
663           return sortPos;
664       }
665  
666       /**
667        * Returns this AppAspect instance as an instance of the Aspect class (Resi
668        * XML schema). The id is null and has to be set!
669        *
670        * @return instance of Aspect class
671        * @throws DataException
672        *             If an error occurs while converting from AppAspect to Aspect
673        */
674       public Aspect getAsResiAspect() throws DataException {
675           Aspect asp = new Aspect();
676  
677           asp.setCategory(this.getCategory());
678           asp.setDescription(this.getDescription());
679           asp.setDirective(this.getDirective());
680           asp.setId(null);
681  
682           return asp;
683       }
684  
685   }
ResiData.java
34   public class ResiData extends Observable {
35  
36       /**
37        * Instance of the Review class (XML schema)
38        */
39       private Review review = null;
40  
41       /**
42        * Instance of the Catalog class (XML schema)
43        */
44       private Catalog catalog = null;
45  
46       /**
47        * Instance of the Aspects class (XML schema)
48        */
49       private Aspects aspects = null;
50  
51       /**
52        * The path to the currently loaded review
53        */
54       private String reviewPath = null;
55  
56       /**
57        * The path to the currently loaded catalog
58        */
59       private String catalogPath = null;
60  
61       /**
62        * The path to the currently loaded aspects
63        */
64       private String aspectsPath = null;
65  
66       /**
67        * Get Aspects object (Resi XML schema)
68        *
69        * @return the aspects
70        */
71       public Aspects getAspects() {        
72           return aspects;
73       }
74  
75       /**
76        * Set Aspects object (Resi XML schema)
77        *
78        * @param aspects
79        *            the aspects to set
80        */
81       public void setAspects(Aspects aspects) {
82           this.aspects = aspects;
83       }
84  
85       /**
86        * Clear Aspects object and its path to null.
87        */
88       public void clearAspects() {
89           aspects = null;
90           aspectsPath = null;
91       }
92  
93       /**
94        * Get Catalog object (Resi XML schema)
95        *
96        * @return the catalog
97        */
98       public Catalog getCatalog() {
99           return catalog;
100       }
101  
102       /**
103        * Set Catalog object (Resi XML schema)
104        *
105        * @param catalog
106        *            the catalog to set
107        */
108       public void setCatalog(Catalog catalog) {
109           this.catalog = catalog;
110       }
111  
112       /**
113        * Clear Catalog object and its path to null.
114        */
115       public void clearCatalog() {
116           catalog = null;
117           catalogPath = null;
118       }
119  
120       /**
121        * Get Review object (Resi XML schema)
122        *
123        * @return the review
124        */
125       public Review getReview() {
126           return review;
127       }
128  
129       /**
130        * Set Review object (Resi XML schema)
131        *
132        * @param review
133        *            the review to set
134        */
135       public void setReview(Review review) {
136           this.review = review;
137       }
138  
139       /**
140        * Clear Review object and its path to null.
141        */
142       public void clearReview() {
143           review = null;
144           reviewPath = null;
145       }
146  
147       /**
148        * If something changed in the ResiData model, this method should be
149        * invoked.
150        */
151       public void fireDataChanged() {
152           setChanged();
153           notifyObservers();
154       }
155  
156       /**
157        * Get the file path of currently loaded Aspects object.
158        *
159        * @return the aspectsPath
160        */
161       public String getAspectsPath() {
162           return aspectsPath;
163       }
164  
165       /**
166        * Set the file path of currently loaded Aspects object.
167        *
168        * @param aspectsPath
169        *            the aspectsPath to set
170        */
171       public void setAspectsPath(String aspectsPath) {
172           this.aspectsPath = aspectsPath;
173       }
174  
175       /**
176        * Get the file path of currently loaded Catalog object.
177        *
178        * @return the catalogPath
179        */
180       public String getCatalogPath() {
181           return catalogPath;
182       }
183  
184       /**
185        * Set the file path of currently loaded Catalog object.
186        *
187        * @param catalogPath
188        *            the catalogPath to set
189        */
190       public void setCatalogPath(String catalogPath) {
191           this.catalogPath = catalogPath;
192       }
193  
194       /**
195        * Get the file path of currently loaded Review object.
196        *
197        * @return the reviewPath
198        */
199       public String getReviewPath() {
200           return reviewPath;
201       }
202  
203       /**
204        * Set the file path of currently loaded Review object.
205        *
206        * @param reviewPath
207        *            the reviewPath to set
208        */
209       public void setReviewPath(String reviewPath) {
210           this.reviewPath = reviewPath;
211       }
212  
213   }
HelpData.java
35   public class HelpData {
36  
37       /**
38        * Absolute path of help data for the images
39        */
40       private String helpPath = "";
41  
42       /**
43        * Array with the help chapter ids
44        */
45       private String[] helpChapters = null;
46  
47       /**
48        * Array with the titles of the help chapters
49        */
50       private String[] helpChaptersTitle = null;
51  
52       /**
53        * Array with HTML content of the help chapters
54        */
55       private String[] helpChaptersContent = null;
56  
57       /**
58        * HTML head for the help chapters
59        */
60       private String helpHead = null;
61  
62       /**
63        * HTML foot for the help chapters
64        */
65       private String helpFoot = null;
66  
67       /**
68        * This method is internally used to read a HTML file (by URL).
69        *
70        * @param resource
71        * @return content of file as String
72        * @throws IOException
73        *             if an error occurs while reading the file
74        */
75       private String readHtmlFile(URL resource) throws IOException {
76           BufferedReader fileReader = null;
77           InputStream htmlFile = null;
78  
79           String htmlLine = null;
80           StringBuffer htmlStrBfr = null;
81  
82           htmlFile = (InputStream) resource.openStream();
83  
84           fileReader = new BufferedReader(
85                   new InputStreamReader(htmlFile, "UTF-8"));
86  
87           htmlStrBfr = new StringBuffer();
88  
89           while ((htmlLine = fileReader.readLine()) != null) {
90               htmlStrBfr.append(htmlLine + "\n");
91           }
92  
93           fileReader.close();
94           htmlFile.close();
95  
96           String htmlStr = htmlStrBfr.toString();
97  
98           /*
99            * Customizing path of images
100            */
101           htmlStr = Pattern.compile("<img \\p{Blank}*src=\"",
102                   Pattern.CASE_INSENSITIVE).matcher(htmlStr).replaceAll(
103                   "<img src=\"" + helpPath);
104  
105           return htmlStr;
106       }
107  
108       /**
109        * This method is internally used to load the chapters, its titles and its
110        * content into the arrays.
111        *
112        * @throws DataException
113        *             if there is an error while loading the help data
114        */
115       private void readInChapters() throws DataException {
116           String htmlStr = null;
117  
118           /*
119            * Create absolute path of help data to display the images
120            */
121           String currentDirectory = new File(HelpData.class.getProtectionDomain()
122                   .getCodeSource().getLocation().getPath()).getAbsolutePath()
123                   .replace("\\", "/");
124  
125           if (!currentDirectory.startsWith("/")) {
126               /*
127                * Only part of unit testing if you run the unit tests under
128                * Windows; there the starting slash is missing.
129                */
130               currentDirectory = "/" + currentDirectory;
131           }
132  
133           helpPath = "file:" + currentDirectory
134                   + Data.getInstance().getResource("path.helpDocBase");
135  
136           if (currentDirectory.endsWith(".jar")) {
137               /*
138                * Not part of unit testing because the correctness of the showed
139                * images is checked in the system test. Therefore the application
140                * has to be run from a Jar file.
141                */
142               helpPath = "jar:file:" + currentDirectory + "!"
143                       + Data.getInstance().getResource("path.helpDocBase");
144           }
145  
146           try {
147               /*
148                * Read head and foot
149                */
150               helpHead = readHtmlFile(getClass().getResource(
151                       Data.getInstance().getResource("path.help") + "head.html"));
152  
153               helpFoot = readHtmlFile(getClass().getResource(
154                       Data.getInstance().getResource("path.help") + "foot.html"));
155           } catch (Exception e) {
156               /*
157                * Not part of unit testing because this exception only is thrown if
158                * an internal error occurs which cannot be provoked.
159                */
160               throw new DataException(Data.getInstance().getLocaleStr(
161                       "message.helpLoadFailed"));
162           }
163  
164           /*
165            * Initialize chapter arrays
166            */
167           helpChapters = Data.getInstance().getResource("helpChapters")
168                   .split(",");
169           helpChaptersTitle = new String[helpChapters.length];
170           helpChaptersContent = new String[helpChapters.length];
171  
172           /*
173            * Read in chapter titles and content
174            */
175           for (int i = 0; i < helpChapters.length; i++) {
176  
177               try {
178                   htmlStr = readHtmlFile(getClass().getResource(
179                           Data.getInstance().getResource("path.help")
180                                   + Data.getInstance().getLocale().getLanguage()
181                                   + "/" + helpChapters[i] + ".html"));
182  
183                   helpChaptersContent[i] = helpHead
184                           + htmlStr.substring(htmlStr.indexOf("-->") + 3)
185                           + helpFoot;
186  
187                   helpChaptersTitle[i] = htmlStr.substring(
188                           htmlStr.indexOf("<!--#TITLE") + 10,
189                           htmlStr.indexOf("-->")).trim();
190  
191                   if (helpChaptersTitle[i].isEmpty()) {
192                       /*
193                        * Not part of unit testing because normally you don't have
194                        * any chapters without a title.
195                        */
196                       helpChaptersTitle[i] = Data.getInstance().getLocaleStr(
197                               "noTitle");
198                   }
199               } catch (Exception e) {
200                   /*
201                    * Not part of unit testing because this exception only is
202                    * thrown if an internal error occurs which cannot be provoked.
203                    */
204                   throw new DataException(Data.getInstance().getLocaleStr(
205                           "message.helpLoadFailed"));
206               }
207  
208           }
209       }
210  
211       /**
212        * Get chapter IDs as an array
213        *
214        * @return array of String elements where each String is an idea of a
215        *         certain chapter
216        * @throws DataException
217        */
218       public String[] getChapters() throws DataException {
219           if (helpChapters == null) {
220               readInChapters();
221           }
222  
223           return helpChapters.clone();
224       }
225  
226       /**
227        * Get chapter number
228        *
229        * @param chapter
230        *            name of the chapter
231        * @return number of the given chapter
232        * @throws DataException
233        */
234       public int getChapterNumber(String chapter) throws DataException {
235           if (helpChapters == null) {
236               readInChapters();
237           }
238  
239           int chapterNumber = Integer.MAX_VALUE;
240  
241           for (int i = 0; helpChapters.length > i; i++) {
242               if (helpChapters[i].equals(chapter)) {
243                   chapterNumber = i;
244  
245                   break;
246               }
247           }
248  
249           if (chapterNumber == Integer.MAX_VALUE) {
250               /*
251                * Not part of unit testing because normally you have not more than
252                * 10-20 chapters. This exception is only thrown if you have more
253                * than Integer.MAX_VALUE chapters.
254                */
255               throw new DataException();
256           }
257  
258           return chapterNumber;
259       }
260  
261       /**
262        * Get the title of a certain chapter
263        *
264        * @param chapter
265        *            the help chapter from which the title should be returned
266        * @return the title of the given chapter
267        * @throws DataException
268        */
269       public String getChapterTitle(String chapter) throws DataException {
270           if (helpChapters == null) {
271               readInChapters();
272           }
273  
274           String title = null;
275  
276           for (int i = 0; i < helpChapters.length; i++) {
277               if (helpChapters[i].equals(chapter)) {
278                   title = helpChaptersTitle[i];
279               }
280           }
281  
282           if (title == null) {
283               throw new DataException(Data.getInstance().getLocaleStr(
284                       "message.helpChapterNotFound")
285                       + " [CHAPTER = " + chapter + "]");
286           }
287  
288           return title;
289       }
290  
291       /**
292        * Returns the given chapter as HTML code
293        *
294        * @param chapter
295        *            the help chapter that should be returned
296        * @return chapter text as HTML code
297        * @throws DataException
298        */
299       public String getChapterContent(String chapter) throws DataException {
300           if (helpChapters == null) {
301               readInChapters();
302           }
303  
304           String htmlCode = null;
305  
306           for (int i = 0; i < helpChapters.length; i++) {
307               if (helpChapters[i].equals(chapter)) {
308                   htmlCode = helpChaptersContent[i];
309               }
310           }
311  
312           if (htmlCode == null) {
313               throw new DataException(Data.getInstance().getLocaleStr(
314                       "message.helpChapterNotFound")
315                       + " [CHAPTER = " + chapter + "]");
316           }
317  
318           return htmlCode;
319       }
320  
321   }
DataException.java
28   @SuppressWarnings("serial")
29   public class DataException extends Exception {
30  
31       public DataException() {
32           super();
33       }
34  
35       public DataException(String message) {
36           super(message);
37       }
38  
39   }
Data.java
34   public class Data {
35  
36       /**
37        * Path of the resources file
38        */
39       private final URL RESOURCES_FILE = this.getClass().getResource(
40               "/org/revager/resources/appResources.properties");
41  
42       /**
43        * The current locale of the data model
44        */
45       private Locale locale = null;
46  
47       /**
48        * Current mode (moderator, scribe etc.)
49        */
50       private String modeName = null;
51  
52       /**
53        * Properties for the current mode parameters
54        */
55       private Properties modeProp = new Properties();
56  
57       /**
58        * Properties for the default mode parameters
59        */
60       private Properties modeDefaultProp = new Properties();
61  
62       /**
63        * Properties for the application resources
64        */
65       private Properties resourcesProp = new Properties();
66  
67       /**
68        * Bundle for the locale strings
69        */
70       private ResourceBundle localeBundle = null;
71  
72       /**
73        * The only instance of this class
74        */
75       private static Data theInstance = null;
76  
77       /**
78        * Instance of ResiData class
79        */
80       private ResiData resiDataInstance = null;
81  
82       /**
83        * Instance of ApplicationData class
84        */
85       private ApplicationData appDataInstance = null;
86  
87       /**
88        * Instance of HelpData class
89        */
90       private HelpData helpDataInstance = null;
91  
92       /**
93        * Constructor is protected because of Singleton pattern; You can get an
94        * instance of this class by the method getInstance()
95        */
96       protected Data() {
97           super();
98  
99           /*
100            * Set the standard file encoding
101            */
102           System.setProperty("file.encoding", "UTF-8");
103  
104           /*
105            * Create instances of Data sub-classes
106            */
107           resiDataInstance = new ResiData();
108           appDataInstance = new ApplicationData();
109           helpDataInstance = new HelpData();
110  
111           /*
112            * Load resources properties
113            */
114           try {
115               resourcesProp.load(RESOURCES_FILE.openStream());
116           } catch (Exception e) {
117               /*
118                * Not part of unit testing because this code will only be reached
119                * if an internal error occurs.
120                */
121               System.err.println("Error while loading the resource file.");
122           }
123  
124           /*
125            * Load default mode properties
126            */
127           URL modeFile = this.getClass().getResource(
128                   getResource("path.modes") + "default.properties");
129  
130           try {
131               modeDefaultProp.load(modeFile.openStream());
132           } catch (Exception e) {
133               /*
134                * Not part of unit testing because this code will only be reached
135                * if an internal error occurs.
136                */
137               System.err.println("Error while loading the "
138                       + "default mode properties.");
139           }
140  
141           /*
142            * Load default locale data
143            */
144           setLocale(Locale.GERMANY);
145  
146           /*
147            * Set default mode
148            */
149           setMode("default");
150       }
151  
152       /**
153        * Get the only instance of Data class
154        *
155        * @return instance of Data class
156        */
157       public static Data getInstance() {
158           if (theInstance == null) {
159               theInstance = new Data();
160           }
161  
162           return theInstance;
163       }
164  
165       /**
166        * Get the only instance of ResiData class
167        *
168        * @return instance of ResiData class
169        */
170       public ResiData getResiData() {
171           return resiDataInstance;
172       }
173  
174       /**
175        * Get the only instance of ApplicationData class
176        *
177        * @return instance of ApplicationData class
178        */
179       public ApplicationData getAppData() {
180           return appDataInstance;
181       }
182  
183       /**
184        * Get the only instance of HelpData class
185        *
186        * @return instance of HelpData class
187        */
188       public HelpData getHelpData() {
189           return helpDataInstance;
190       }
191  
192       /**
193        * Get the current locale
194        *
195        * @return current locale
196        */
197       public Locale getLocale() {
198           return locale;
199       }
200  
201       /**
202        * Set the locale
203        *
204        * @param locale
205        *            the locale to set
206        */
207       public void setLocale(Locale locale) {
208           this.locale = locale;
209  
210           try {
211               localeBundle = ResourceBundle.getBundle(getResource("path.locale"));
212           } catch (Exception e) {
213               /*
214                * Not part of unit testing because this code will only be reached
215                * if an internal error occurs.
216                */
217               System.err.println("Error while loading locale data from the"
218                       + " following path: " + getResource("path.locale"));
219           }
220       }
221  
222       /**
223        * Get the current mode
224        *
225        * @return current mode as String, e.g. "none", "moderator" or "scribe"
226        */
227       public String getMode() {
228           return modeName;
229       }
230  
231       /**
232        * Set the mode as String, e.g. "none", "moderator" or "scribe"
233        *
234        * @param mode
235        *            the mode to set
236        */
237       public void setMode(String mode) {
238           this.modeName = mode;
239  
240           URL modeFile = getClass().getResource(
241                   getResource("path.modes") + mode + ".properties");
242  
243           try {
244               modeProp.clear();
245               modeProp.load(modeFile.openStream());
246           } catch (Exception e) {
247               System.err.println("Error while loading the following "
248                       + "mode properties: " + getResource("path.modes") + mode
249                       + ".properties");
250           }
251       }
252  
253       /**
254        * Get an icon as ImageIcon object by file name.
255        *
256        * @param iconFile
257        *            file name of the icon
258        * @return icon as ImageIcon
259        */
260       public ImageIcon getIcon(String iconFile) {
261           return new ImageIcon(getClass().getResource(
262                   getResource("path.icons") + iconFile));
263       }
264  
265       /**
266        * Get a resource by key
267        *
268        * @param key
269        * @return resource as String
270        */
271       public String getResource(String key) {
272           String resource = resourcesProp.getProperty(key);
273  
274           if (resource == null) {
275               System.err.println("The following resource was not found: " + key);
276           }
277  
278           return resource;
279       }
280  
281       /**
282        * Get a localized string by key
283        *
284        * @param key
285        * @return localized string
286        */
287       public String getLocaleStr(String key) {
288           String localeStr = null;
289  
290           try {
291               localeStr = localeBundle.getString(key);
292           } catch (Exception exc) {
293               localeStr = getLocaleStr("noLocaleString");
294           }
295  
296           return localeStr;
297       }
298  
299       /**
300        * Get a parameter of the current mode
301        *
302        * @param key
303        * @return parameter as boolean value
304        */
305       public boolean getModeParam(String key) {
306           boolean parameter;
307           String paramValue = modeProp.getProperty(key);
308  
309           /*
310            * If parameter is not set in the current mode, try to get the default
311            * value
312            */
313           if (paramValue == null) {
314               paramValue = modeDefaultProp.getProperty(key);
315           }
316  
317           if (paramValue != null && paramValue.equals("true")) {
318               parameter = true;
319           } else {
320               parameter = false;
321           }
322  
323           return parameter;
324       }
325   }
ApplicationData.java
50   public class ApplicationData extends Observable {
51  
52       /**
53        * Push mode values for the methods for pushing catalogs, categories and
54        * aspects.
55        *
56        * @author Johannes Wettinger
57        * @version 1.0
58        */
59       
ApplicationData.java
61       }
62  
63       /**
64        * Indicates the current version of the database (structure); it is
65        * important for later database (structure) updates.
66        */
67       private final int CURRENT_DATABASE_VERSION = 1;
68  
69       /**
70        * This attribute indicates if the application data are initialized or not.
71        */
72       private boolean appDataInitialized = false;
73  
74       /**
75        * Attribute to save the path of the application data.
76        */
77       private String appDataPath = null;
78  
79       /**
80        * If a custum path for the application data is given, it is saved here.
81        */
82       private String customAppDataDirectory = null;
83  
84       /**
85        * Initialization of the application data.
86        *
87        * @throws DataException
88        *             If an error occurs while the initialization of application
89        *             data
90        */
91       public void initialize() throws DataException {
92           if (appDataInitialized == false) {
93               boolean dbLocationFound = false;
94  
95               /*
96                * Possible paths to search for, to save the application data
97                * automatically.
98                */
99               String currentDirectory = new File(ApplicationData.class
100                       .getProtectionDomain().getCodeSource().getLocation()
101                       .getPath()).getAbsolutePath();
102  
103               int endIndex = currentDirectory.lastIndexOf("/");
104  
105               if (endIndex < currentDirectory.lastIndexOf("\\")) {
106                   /*
107                    * This statement is not part of the unit test, if you run it
108                    * under a platform different from Windows, because only Windows
109                    * uses backslashes in paths.
110                    */
111                   endIndex = currentDirectory.lastIndexOf("\\");
112               }
113  
114               String[] possibleDirectories = {
115                       currentDirectory = currentDirectory.substring(0,
116                               endIndex + 1),
117                       System.getProperty("user.dir") + "/",
118                       System.getProperty("user.home") + "/" };
119  
120               /*
121                * Check if a custom directory is given and valid
122                */
123               if (customAppDataDirectory != null
124                       && new File(customAppDataDirectory).canWrite()) {
125                   dbLocationFound = true;
126  
127                   appDataPath = customAppDataDirectory
128                           + Data.getInstance().getResource("dataDirectoryName");
129               }
130  
131               /*
132                * Check if database is existing;
133                *
134                * not part of the unit testing because in the unit testing, we use
135                * a custom directory for the database.
136                */
137               for (String dir : possibleDirectories) {
138                   if (new File(dir
139                           + Data.getInstance().getResource("dataDirectoryName"))
140                           .exists()
141                           && dbLocationFound == false) {
142                       dbLocationFound = true;
143  
144                       appDataPath = dir
145                               + Data.getInstance().getResource(
146                                       "dataDirectoryName");
147                   }
148               }
149  
150               /*
151                * Check where to create new database;
152                *
153                * not part of the unit testing because in the unit testing, we use
154                * a custom directory for the database.
155                */
156               for (String dir : possibleDirectories) {
157                   if (new File(dir).canWrite() && dbLocationFound == false) {
158                       dbLocationFound = true;
159  
160                       appDataPath = dir
161                               + Data.getInstance().getResource(
162                                       "dataDirectoryName");
163                   }
164               }
165  
166               System.setProperty("derby.system.home", appDataPath + "db/");
167  
168               appDataInitialized = true;
169  
170               /*
171                * Create tables in the database if the do not exist
172                */
173               try {
174                   createTables();
175               } catch (SQLException e) {
176                   /*
177                    * Not part of the unit testing, because this exception is only
178                    * thrown if there occurs an internal error while creating the
179                    * tables.
180                    */
181                   throw new DataException(Data.getInstance().getLocaleStr(
182                           "message.sqlTableCreationFailed")
183                           + " [ERROR = "
184                           + e.getErrorCode()
185                           + " "
186                           + e.getMessage() + "]");
187               }
188           }
189       }
190  
191       /**
192        * Open the database connection and initialize the database if necessary.
193        *
194        * @return Connection object
195        * @throws DataException
196        *             if there is an error while opening and initializing the
197        *             database
198        */
199       public Connection openConnection() throws DataException {
200           Connection c = null;
201  
202           /*
203            * Initialize application data
204            */
205           initialize();
206  
207           /*
208            * Open the connection to the database
209            */
210           try {
211               c = DriverManager.getConnection("jdbc:derby:Resi;create=true");
212           } catch (SQLException e) {
213               /*
214                * Not part of the unit testing, because this exception is only
215                * thrown if there occurs an internal error.
216                */
217               throw new DataException(Data.getInstance().getLocaleStr(
218                       "message.dbOpenFailed"));
219           }
220  
221           return c;
222       }
223  
224       /**
225        * Reset the database, that means delete all application data.
226        */
227       public void resetDatabase() {
228           if (appDataInitialized == true) {
229               FileTools.deleteDirectory(new File(appDataPath));
230  
231               appDataInitialized = false;
232               appDataPath = null;
233           }
234       }
235  
236       /**
237        * Returns the path of the currently used application data
238        *
239        * @return path to application data
240        */
241       public String getAppDataPath() {
242           if (appDataPath == null) {
243               return "";
244           } else {
245               return appDataPath;
246           }
247       }
248  
249       /**
250        * Returns the custom path to the application data
251        *
252        * @return custom path to application data
253        */
254       public String getCustomAppDataDirectory() {
255           return customAppDataDirectory;
256       }
257  
258       /**
259        * Set the custom path to the application data
260        *
261        * @param custom
262        *            path to application data
263        */
264       public void setCustomAppDataDirectory(String customDatabasePath) {
265           customDatabasePath = customDatabasePath.replace("\\", "/");
266  
267           if (!customDatabasePath.endsWith("/")) {
268               customDatabasePath = customDatabasePath + "/";
269           }
270  
271           this.customAppDataDirectory = customDatabasePath;
272       }
273  
274       /**
275        * Creates tables in the database if they does not exist.
276        *
277        * @throws DataException
278        *             If an error while the creation of tables occurs
279        * @throws SQLException
280        *             If an error while running the SQL statements occurs
281        */
282       private void createTables() throws DataException, SQLException {
283           Connection conn = openConnection();
284  
285           String[] names = { "TABLE" };
286           SortedSet<String> tables = new TreeSet<String>();
287  
288           String tableName = null;
289  
290           /*
291            * Get existing tables;
292            *
293            * normally the createTables() method is only invoked if you have a
294            * clean and empty database, so not tables exists; so the following
295            * statements are not part of the unit testing.
296            */
297           DatabaseMetaData meta = conn.getMetaData();
298           ResultSet tableNames = meta.getTables(null, null, null, names);
299  
300           while (tableNames.next()) {
301               tables.add(tableNames.getString("TABLE_NAME").toUpperCase());
302           }
303  
304           tableNames.close();
305  
306           /*
307            * Table LastReviews
308            */
309           tableName = "LastReviews";
310  
311           if (!tables.contains(tableName.toUpperCase())) {
312               PreparedStatement ps = conn
313                       .prepareStatement("CREATE TABLE "
314                               + tableName
315                               + " ( filePath VARCHAR(150) NOT NULL PRIMARY KEY, time BIGINT NOT NULL )");
316  
317               ps.executeUpdate();
318               ps.close();
319           }
320  
321           /*
322            * Table ReviewAttendees
323            */
324           tableName = "Attendees";
325  
326           if (!tables.contains(tableName.toUpperCase())) {
327               PreparedStatement ps = conn
328                       .prepareStatement("CREATE TABLE "
329                               + tableName
330                               + " ( name VARCHAR(100) NOT NULL, contact VARCHAR(1000) NOT NULL,"
331                               + " PRIMARY KEY(name,contact) )");
332  
333               ps.executeUpdate();
334               ps.close();
335           }
336  
337           /*
338            * Table AttendeesStrenghts
339            */
340           tableName = "AttendeesStrengths";
341  
342           if (!tables.contains(tableName.toUpperCase())) {
343               PreparedStatement ps = conn
344                       .prepareStatement("CREATE TABLE "
345                               + tableName
346                               + " ( attendeeName VARCHAR(100) NOT NULL, attendeeContact VARCHAR(1000) NOT NULL, categoryName VARCHAR(100) NOT NULL,"
347                               + " PRIMARY KEY(attendeeName,attendeeContact,categoryName) )");
348  
349               ps.executeUpdate();
350               ps.close();
351           }
352  
353           /*
354            * Table Catalogs
355            */
356           tableName = "Catalogs";
357  
358           if (!tables.contains(tableName.toUpperCase())) {
359               PreparedStatement ps = conn
360                       .prepareStatement("CREATE TABLE "
361                               + tableName
362                               + " ( name VARCHAR(100) NOT NULL PRIMARY KEY, sortPos INTEGER NOT NULL )");
363  
364               ps.executeUpdate();
365               ps.close();
366           }
367  
368           /*
369            * Table Categories
370            */
371           tableName = "Categories";
372  
373           if (!tables.contains(tableName.toUpperCase())) {
374               PreparedStatement ps = conn
375                       .prepareStatement("CREATE TABLE "
376                               + tableName
377                               + " ( name VARCHAR(100) NOT NULL, catalogName VARCHAR(100) NOT NULL, sortPos INTEGER NOT NULL,"
378                               + " PRIMARY KEY(name,catalogName) )");
379  
380               ps.executeUpdate();
381               ps.close();
382           }
383  
384           /*
385            * Table Aspects
386            */
387           tableName = "Aspects";
388  
389           if (!tables.contains(tableName.toUpperCase())) {
390               PreparedStatement ps = conn
391                       .prepareStatement("CREATE TABLE "
392                               + tableName
393                               + " ( id INTEGER NOT NULL PRIMARY KEY GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),"
394                               + " directive VARCHAR(500) NOT NULL, description VARCHAR(3000), categoryName VARCHAR(100) NOT NULL, catalogName VARCHAR(100) NOT NULL, sortPos INTEGER NOT NULL )");
395  
396               ps.executeUpdate();
397               ps.close();
398           }
399  
400           /*
401            * Table ApplicationSettings
402            */
403           tableName = "ApplicationSettings";
404  
405           if (!tables.contains(tableName.toUpperCase())) {
406               PreparedStatement ps = conn
407                       .prepareStatement("CREATE TABLE "
408                               + tableName
409                               + " ( settingKey VARCHAR(100) NOT NULL PRIMARY KEY, settingValue VARCHAR(3000) NOT NULL )");
410  
411               ps.executeUpdate();
412               ps.close();
413  
414               insertDefaultsApplicationSettings();
415           }
416  
417           /*
418            * Table CSVProfiles
419            */
420           tableName = "CSVProfiles";
421  
422           if (!tables.contains(tableName.toUpperCase())) {
423               PreparedStatement ps = conn
424                       .prepareStatement("CREATE TABLE "
425                               + tableName
426                               + " ( name VARCHAR(100) NOT NULL PRIMARY KEY,"
427                               + " columnOrder VARCHAR(200) NOT NULL, columnsInFirstLine VARCHAR(10) NOT NULL, encapsulateContent VARCHAR(10) NOT NULL )");
428  
429               ps.executeUpdate();
430               ps.close();
431  
432               insertDefaultsCSVProfiles();
433           }
434  
435           /*
436            * Table CSVColumnMappings
437            */
438           tableName = "CSVColumnMappings";
439  
440           if (!tables.contains(tableName.toUpperCase())) {
441               PreparedStatement ps = conn
442                       .prepareStatement("CREATE TABLE "
443                               + tableName
444                               + " ( profileName VARCHAR(100) NOT NULL, columnName VARCHAR(100) NOT NULL, columnMapping VARCHAR(100) NOT NULL, PRIMARY KEY(profileName,columnName) )");
445  
446               ps.executeUpdate();
447               ps.close();
448  
449               insertDefaultsCSVColumnMappings();
450           }
451  
452           /*
453            * Table CSVSeverityMappings
454            */
455           tableName = "CSVSeverityMappings";
456  
457           if (!tables.contains(tableName.toUpperCase())) {
458               PreparedStatement ps = conn.prepareStatement("CREATE TABLE "
459                       + tableName
460                       + " ( profileName VARCHAR(100) NOT NULL PRIMARY KEY,"
461                       + " validMappings VARCHAR(1000) NOT NULL )");
462  
463               ps.executeUpdate();
464               ps.close();
465  
466               insertDefaultsCSVSeverityMappings();
467           }
468  
469           /*
470            * Database connection is closed
471            */
472           conn.close();
473       }
474  
475       /**
476        * This method sets the default values for the application settings for a
477        * newly created database.
478        *
479        * @throws DataException
480        *             If an error occurs while setting the default values
481        * @throws SQLException
482        *             If an error while running the SQL statements occurs
483        */
484       private void insertDefaultsApplicationSettings() throws DataException,
485               SQLException {
486           Connection conn = openConnection();
487           PreparedStatement ps;
488  
489           /*
490            * Table ApplicationSettings
491            */
492           ps = conn.prepareStatement("INSERT INTO ApplicationSettings "
493                   + "(settingKey, settingValue) VALUES (?, ?)");
494  
495           ps.setString(1, AppSettingKey.DATABASE_VERSION.toString());
496           ps.setInt(2, CURRENT_DATABASE_VERSION);
497           ps.executeUpdate();
498  
499           ps.setString(1, AppSettingKey.APP_DO_AUTO_SAVE.toString());
500           ps.setString(2, AppSettingValue.TRUE.toString());
501           ps.executeUpdate();
502  
503           ps.setString(1, AppSettingKey.APP_AUTO_SAVE_INTERVAL.toString());
504           ps.setInt(2, 10);
505           ps.executeUpdate();
506  
507           ps.setString(1, AppSettingKey.APP_CHECK_VERSION.toString());
508           ps.setString(2, AppSettingValue.TRUE.toString());
509           ps.executeUpdate();
510  
511           ps.setString(1, AppSettingKey.APP_FONT_SIZE.toString());
512           ps.setString(2, AppSettingValue.NORMAL.toString());
513           ps.executeUpdate();
514  
515           ps.setString(1, AppSettingKey.PDF_PROTOCOL_SHOW_SIGN_FIELDS.toString());
516           ps.setString(2, AppSettingValue.FALSE.toString());
517           ps.executeUpdate();
518  
519           ps.setString(1, AppSettingKey.PDF_INVITATION_TEXT.toString());
520           ps.setString(2, Data.getInstance().getLocaleStr(
521                   "export.standardInvitationText"));
522           ps.executeUpdate();
523  
524           /*
525            * Close the statement and the connection
526            */
527           ps.close();
528           conn.close();
529       }
530  
531       /**
532        * This method sets the default CSV profile for the bug tracking system of
533        * Trac.
534        *
535        * @throws DataException
536        *             If an error occurs while setting the default values
537        * @throws SQLException
538        *             If an error while running the SQL statements occurs
539        */
540       private void insertDefaultsCSVProfiles() throws DataException, SQLException {
541           Connection conn = openConnection();
542           PreparedStatement ps;
543  
544           /*
545            * Table CSVProfiles
546            */
547           ps = conn
548                   .prepareStatement("INSERT INTO CSVProfiles "
549                           + "(name, columnOrder, columnsInFirstLine, encapsulateContent) "
550                           + "VALUES (?, ?, ?, ?)");
551  
552           ps.setString(1, "Trac");
553           ps.setString(2, AppCSVColumnName.DESCRIPTION.toString() + "|"
554                   + AppCSVColumnName.REFERENCE.toString() + "|"
555                   + AppCSVColumnName.SEVERITY.toString() + "|"
556                   + AppCSVColumnName.REPORTER.toString());
557           ps.setBoolean(3, true);
558           ps.setBoolean(4, false);
559           ps.executeUpdate();
560  
561           /*
562            * Close the statement and the connection
563            */
564           ps.close();
565           conn.close();
566       }
567  
568       /**
569        * This method sets the column mappings for the default CSV profile Trac.
570        *
571        * @throws DataException
572        *             If an error occurs while setting the default values
573        * @throws SQLException
574        *             If an error while running the SQL statements occurs
575        */
576       private void insertDefaultsCSVColumnMappings() throws DataException,
577               SQLException {
578           Connection conn = openConnection();
579           PreparedStatement ps;
580  
581           ps = conn.prepareStatement("INSERT INTO CSVColumnMappings "
582                   + " (profileName, columnName, columnMapping) VALUES (?, ?, ?)");
583  
584           ps.setString(1, "Trac");
585           ps.setString(2, AppCSVColumnName.DESCRIPTION.toString());
586           ps.setString(3, "summary");
587           ps.executeUpdate();
588  
589           ps.setString(1, "Trac");
590           ps.setString(2, AppCSVColumnName.REFERENCE.toString());
591           ps.setString(3, "description");
592           ps.executeUpdate();
593  
594           ps.setString(1, "Trac");
595           ps.setString(2, AppCSVColumnName.SEVERITY.toString());
596           ps.setString(3, "priority");
597           ps.executeUpdate();
598  
599           ps.setString(1, "Trac");
600           ps.setString(2, AppCSVColumnName.REPORTER.toString());
601           ps.setString(3, "reporter");
602           ps.executeUpdate();
603  
604           /*
605            * Close the statement and the connection
606            */
607           ps.close();
608           conn.close();
609       }
610  
611       /**
612        * This method sets the severity mappings for the CSV profile Trac.
613        *
614        * @throws DataException
615        *             If an error occurs while setting the default values
616        * @throws SQLException
617        *             If an error while running the SQL statements occurs
618        */
619       private void insertDefaultsCSVSeverityMappings() throws DataException,
620               SQLException {
621           Connection conn = openConnection();
622           PreparedStatement ps;
623  
624           ps = conn.prepareStatement("INSERT INTO CSVSeverityMappings "
625                   + " (profileName, validMappings) VALUES (?, ?)");
626  
627           ps.setString(1, "Trac");
628           ps.setString(2, "minor|major|critical");
629           ps.executeUpdate();
630  
631           /*
632            * Close the statement and the connection
633            */
634           ps.close();
635           conn.close();
636       }
637  
638       /**
639        * If something changed in the application data model, this method should be
640        * invoked.
641        */
642       public void fireDataChanged() {
643           setChanged();
644           notifyObservers();
645       }
646  
647       /**
648        * Returns the application setting of the given key as String.
649        *
650        * @param key
651        *            of the application setting
652        * @return value of the application setting
653        * @throws DataException
654        *             If an error occurs while getting the value from the database
655        */
656       public String getSetting(AppSettingKey key) throws DataException {
657           String setting = null;
658  
659           try {
660               Connection conn = openConnection();
661  
662               PreparedStatement ps = conn
663                       .prepareStatement("SELECT settingValue FROM ApplicationSettings "
664                               + "WHERE settingKey = ?");
665  
666               ps.setString(1, key.toString());
667  
668               ResultSet res = ps.executeQuery();
669  
670               if (res.next()) {
671                   setting = res.getString("settingValue");
672               }
673  
674               res.close();
675               ps.close();
676  
677               conn.close();
678           } catch (Exception e) {
679               /*
680                * Not part of the unit testing, because this exception is only
681                * thrown if there occurs an internal error.
682                */
683               throw new DataException(Data.getInstance().getLocaleStr(
684                       "message.getAppSettingFailed")
685                       + " [SETTING = " + key + "] " + e.getMessage());
686           }
687  
688           return setting;
689       }
690  
691       /**
692        * Returns the application setting of the given key as AppSettingValue.
693        *
694        * @param key
695        *            of the application setting
696        * @return value of the application setting
697        * @throws DataException
698        *             If an error occurs while getting the value from the database
699        */
700       public AppSettingValue getSettingValue(AppSettingKey key)
701               throws DataException {
702           AppSettingValue setting = null;
703           String settingStr = getSetting(key);
704  
705           try {
706               if (settingStr != null) {
707                   setting = AppSettingValue.valueOf(settingStr);
708               }
709           } catch (IllegalArgumentException e) {
710               setting = AppSettingValue.INVALID_VALUE;
711           }
712  
713           return setting;
714       }
715  
716       /**
717        * Sets the application setting by the given key and value (String).
718        *
719        * @param key
720        *            of the application setting
721        * @param value
722        *            of the application setting
723        * @throws DataException
724        *             If an error occurs while setting the value from the database
725        */
726       public void setSetting(AppSettingKey key, String value)
727               throws DataException {
728           try {
729               Connection conn = openConnection();
730               PreparedStatement ps = null;
731  
732               if (getSetting(key) == null) {
733                   ps = conn.prepareStatement("INSERT INTO ApplicationSettings "
734                           + "(settingValue, settingKey) VALUES (?, ?)");
735               } else {
736                   ps = conn.prepareStatement("UPDATE ApplicationSettings "
737                           + "SET settingValue=? WHERE settingKey=?");
738               }
739  
740               ps.setString(1, value);
741               ps.setString(2, key.toString());
742  
743               ps.executeUpdate();
744  
745               ps.close();
746               conn.close();
747           } catch (Exception e) {
748               /*
749                * Not part of the unit testing, because this exception is only
750                * thrown if there occurs an internal error.
751                */
752               throw new DataException(Data.getInstance().getLocaleStr(
753                       "message.setAppSettingFailed")
754                       + " [SETTING = " + key + "] " + e.getMessage());
755           }
756       }
757  
758       /**
759        * Sets the application setting by the given key and value
760        * (AppSettingValue).
761        *
762        * @param key
763        *            of the application setting
764        * @param value
765        *            of the application setting
766        * @throws DataException
767        *             If an error occurs while setting the value from the database
768        */
769       public void setSettingValue(AppSettingKey key, AppSettingValue value)
770               throws DataException {
771           setSetting(key, value.toString());
772       }
773  
774       /**
775        * Get the paths of the last opened reviews as list.
776        *
777        * @return list of review paths
778        * @throws DataException
779        *             If an error occurs while getting the paths
780        */
781       public List<String> getLastReviews() throws DataException {
782           List<String> lastReviews = new ArrayList<String>();
783  
784           try {
785               Connection conn = openConnection();
786  
787               /*
788                * Get reviews
789                */
790               PreparedStatement ps = conn
791                       .prepareStatement("SELECT filePath FROM LastReviews "
792                               + "ORDER BY time DESC");
793               ps.setMaxRows(Integer.parseInt(Data.getInstance().getResource(
794                       "numberOfLastReviews")));
795  
796               ResultSet res = ps.executeQuery();
797  
798               while (res.next()) {
799                   lastReviews.add(res.getString("filePath"));
800               }
801  
802               res.close();
803               ps.close();
804  
805               conn.close();
806           } catch (Exception e) {
807               /*
808                * Not part of the unit testing, because this exception is only
809                * thrown if there occurs an internal error.
810                */
811               throw new DataException(Data.getInstance().getLocaleStr(
812                       "message.getLastReviewsFailed")
813                       + " " + e.getMessage());
814           }
815  
816           return lastReviews;
817       }
818  
819       /**
820        * Adds the path of a new review.
821        *
822        * @param filePath
823        *            to add to the list of reviews
824        * @throws DataException
825        *             If an error occurs while adding a path to the list of last
826        *             opened reviews
827        */
828       public void addLastReview(String filePath) throws DataException {
829           try {
830               Connection conn = openConnection();
831  
832               /*
833                * 70 days ago from now
834                */
835               long timeAgo = Calendar.getInstance().getTimeInMillis()
836                       - (70 * 24 * 60 * 60 * 1000);
837  
838               /*
839                * Remove old reviews
840                */
841               PreparedStatement ps = conn
842                       .prepareStatement("DELETE FROM LastReviews WHERE time < ?");
843  
844               ps.setLong(1, timeAgo);
845  
846               ps.executeUpdate();
847  
848               ps.close();
849  
850               /*
851                * Insert new review or just update time
852                */
853               if (getLastReviews().contains(filePath)) {
854                   ps = conn.prepareStatement("UPDATE LastReviews "
855                           + "SET time=? WHERE filePath=?");
856               } else {
857                   ps = conn.prepareStatement("INSERT INTO LastReviews "
858                           + "(time, filePath) VALUES (?, ?)");
859               }
860  
861               ps.setLong(1, Calendar.getInstance().getTimeInMillis());
862               ps.setString(2, filePath);
863  
864               ps.executeUpdate();
865  
866               ps.close();
867               conn.close();
868           } catch (Exception e) {
869               /*
870                * Not part of the unit testing, because this exception is only
871                * thrown if there occurs an internal error.
872                */
873               throw new DataException(Data.getInstance().getLocaleStr(
874                       "message.addLastReviewFailed")
875                       + " (" + filePath + ") " + e.getMessage());
876           }
877       }
878  
879       /**
880        * Remove the given path from the list of opened reviews.
881        *
882        * @param filePath
883        *            to remove from the list
884        * @throws DataException
885        *             If an error occurs while removing
886        */
887       public void removeLastReview(String filePath) throws DataException {
888           try {
889               Connection conn = openConnection();
890  
891               PreparedStatement ps = conn
892                       .prepareStatement("DELETE FROM LastReviews "
893                               + "WHERE filePath = ?");
894  
895               ps.setString(1, filePath);
896  
897               ps.executeUpdate();
898  
899               ps.close();
900               conn.close();
901           } catch (Exception e) {
902               /*
903                * Not part of the unit testing, because this exception is only
904                * thrown if there occurs an internal error.
905                */
906               throw new DataException(Data.getInstance().getLocaleStr(
907                       "message.removeLastReviewFailed")
908                       + " (" + filePath + ") " + e.getMessage());
909           }
910       }
911  
912       /**
913        * Returns the list of catalogs saved in the application data.
914        *
915        * @return list of catalogs
916        * @throws DataException
917        *             If an error occurs while reading the catalogs from the
918        *             application data
919        */
920       public List<AppCatalog> getCatalogs() throws DataException {
921           List<AppCatalog> catalogs = new ArrayList<AppCatalog>();
922  
923           try {
924               Connection conn = openConnection();
925  
926               PreparedStatement ps = conn
927                       .prepareStatement("SELECT name FROM Catalogs "
928                               + "ORDER BY sortPos ASC");
929  
930               ResultSet res = ps.executeQuery();
931  
932               while (res.next()) {
933                   catalogs.add(AppCatalog.newInstance(res.getString("name")));
934               }
935  
936               res.close();
937               ps.close();
938               conn.close();
939           } catch (Exception e) {
940               /*
941                * Not part of the unit testing, because this exception is only
942                * thrown if there occurs an internal error.
943                */
944               throw new DataException(Data.getInstance().getLocaleStr(
945                       "message.getAppCatalogsFailed")
946                       + " " + e.getMessage());
947           }
948  
949           return catalogs;
950       }
951  
952       /**
953        * Returns a list of all catalogs which fit to the given filter.
954        *
955        * @param filter
956        *            to search for
957        * @return list of catalogs
958        * @throws DataException
959        *             If an error occurs while reading the catalogs from the
960        *             application data
961        */
962       public List<AppCatalog> getCatalogs(String filter) throws DataException {
963           List<AppCatalog> catalogs = getCatalogs();
964           List<AppCatalog> catalogsFiltered = new ArrayList<AppCatalog>();
965  
966           for (AppCatalog cat : catalogs) {
967               if (cat.getName().toLowerCase().contains(filter.toLowerCase())) {
968                   catalogsFiltered.add(cat);
969               }
970           }
971  
972           return catalogsFiltered;
973       }
974  
975       /**
976        * Returns the catalog with the given name. If a catalog with the given name
977        * does not exist, then null will be returned.
978        *
979        * @param name
980        *            of the catalog
981        * @return the catalog with the given name
982        * @throws DataException
983        *             If an error occurs while getting the catalog
984        */
985       public AppCatalog getCatalog(String name) throws DataException {
986           AppCatalog catalog = null;
987  
988           try {
989               Connection conn = openConnection();
990  
991               PreparedStatement ps = conn
992                       .prepareStatement("SELECT name FROM Catalogs "
993                               + " WHERE name = ?");
994  
995               ps.setString(1, name);
996  
997               ResultSet res = ps.executeQuery();
998  
999               if (res.next()) {
1000                   catalog = AppCatalog.newInstance(res.getString("name"));
1001               }
1002  
1003               res.close();
1004               ps.close();
1005               conn.close();
1006           } catch (Exception e) {
1007               /*
1008                * Not part of the unit testing, because this exception is only
1009                * thrown if there occurs an internal error.
1010                */
1011               throw new DataException(Data.getInstance().getLocaleStr(
1012                       "message.getAppCatalogFailed")
1013                       + " [NAME = " + name + "] " + e.getMessage());
1014           }
1015  
1016           return catalog;
1017       }
1018  
1019       /**
1020        * Create a new AppCatalog object. If a catalog with the given name does not
1021        * exist, a new one will be created in the database.
1022        *
1023        * @param name
1024        *            of the catalog
1025        * @return AppCatalog object
1026        * @throws DataException
1027        *             If an error occurs while creating a new AppCatalog object
1028        */
1029       public AppCatalog newCatalog(String name) throws DataException {
1030           return AppCatalog.newInstance(name);
1031       }
1032  
1033       /**
1034        * Remove the catalog with the given name from the database.
1035        *
1036        * @param name
1037        *            of the catalog to remove
1038        * @throws DataException
1039        *             If an error occurs while removing the catalog
1040        */
1041       public void removeCatalog(String name) throws DataException {
1042           try {
1043               Connection conn = openConnection();
1044               PreparedStatement ps;
1045  
1046               /*
1047                * Remove catalog and linked data
1048                */
1049               ps = conn.prepareStatement("DELETE FROM Catalogs "
1050                       + "WHERE name = ?");
1051               ps.setString(1, name);
1052               ps.executeUpdate();
1053  
1054               ps = conn.prepareStatement("DELETE FROM Categories "
1055                       + "WHERE catalogName = ?");
1056               ps.setString(1, name);
1057               ps.executeUpdate();
1058  
1059               ps = conn.prepareStatement("DELETE FROM Aspects "
1060                       + "WHERE catalogName = ?");
1061               ps.setString(1, name);
1062               ps.executeUpdate();
1063  
1064               ps.close();
1065               conn.close();
1066           } catch (Exception e) {
1067               /*
1068                * Not part of the unit testing, because this exception is only
1069                * thrown if there occurs an internal error.
1070                */
1071               throw new DataException(Data.getInstance().getLocaleStr(
1072                       "message.removeAppCatalogFailed")
1073                       + " [NAME = " + name + "] " + e.getMessage());
1074           }
1075       }
1076  
1077       /**
1078        * Remove the given catalog from the database.
1079        *
1080        * @param catalog
1081        *            to remove
1082        * @throws DataException
1083        *             If an error occurs while removing the catalog
1084        */
1085       public void removeCatalog(AppCatalog catalog) throws DataException {
1086           removeCatalog(catalog.getName());
1087       }
1088  
1089       /**
1090        * Returns the number of catalogs saved in the database.
1091        *
1092        * @return the numer of catalogs
1093        * @throws DataException
1094        *             If an error occurs while getting the number of catalogs
1095        */
1096       public int getNumberOfCatalogs() throws DataException {
1097           int numberOfCatalogs = 0;
1098  
1099           try {
1100               Connection conn = openConnection();
1101  
1102               PreparedStatement ps = conn
1103                       .prepareStatement("SELECT COUNT(*) FROM Catalogs");
1104  
1105               ResultSet res = ps.executeQuery();
1106  
1107               res.next();
1108  
1109               numberOfCatalogs = res.getInt(1);
1110  
1111               res.close();
1112               ps.close();
1113               conn.close();
1114           } catch (Exception e) {
1115               /*
1116                * Not part of the unit testing, because this exception is only
1117                * thrown if there occurs an internal error.
1118                */
1119               throw new DataException(Data.getInstance().getLocaleStr(
1120                       "message.getNumberOfAppCatalogsFailed")
1121                       + " " + e.getMessage());
1122           }
1123  
1124           return numberOfCatalogs;
1125       }
1126  
1127       /**
1128        * Returns the first sorting position of all catalogs saved in the database.
1129        *
1130        * @return first sorting position
1131        * @throws DataException
1132        *             If an error occurs while getting the sorting position
1133        */
1134       public int getFirstSortPosOfCatalogs() throws DataException {
1135           int sortPos = 0;
1136  
1137           try {
1138               Connection conn = openConnection();
1139  
1140               PreparedStatement ps = conn
1141                       .prepareStatement("SELECT sortPos FROM Catalogs "
1142                               + "ORDER BY sortPos ASC");
1143               ps.setMaxRows(1);
1144  
1145               ResultSet res = ps.executeQuery();
1146  
1147               if (res.next()) {
1148                   sortPos = res.getInt("sortPos");
1149               }
1150  
1151               res.close();
1152               ps.close();
1153               conn.close();
1154           } catch (Exception e) {
1155               /*
1156                * Not part of the unit testing, because this exception is only
1157                * thrown if there occurs an internal error.
1158                */
1159               throw new DataException(Data.getInstance().getLocaleStr(
1160                       "message.getFirstSortPosOfAppCatalogsFailed")
1161                       + " " + e.getMessage());
1162           }
1163  
1164           return sortPos;
1165       }
1166  
1167       /**
1168        * Returns the last sorting position of all catalogs saved in the database.
1169        *
1170        * @return last sorting position
1171        * @throws DataException
1172        *             If an error occurs while getting the sorting position
1173        */
1174       public int getLastSortPosOfCatalogs() throws DataException {
1175           int sortPos = 0;
1176  
1177           try {
1178               Connection conn = openConnection();
1179  
1180               PreparedStatement ps = conn
1181                       .prepareStatement("SELECT sortPos FROM Catalogs "
1182                               + "ORDER BY sortPos DESC");
1183               ps.setMaxRows(1);
1184  
1185               ResultSet res = ps.executeQuery();
1186  
1187               if (res.next()) {
1188                   sortPos = res.getInt("sortPos");
1189               }
1190  
1191               res.close();
1192               ps.close();
1193               conn.close();
1194           } catch (Exception e) {
1195               /*
1196                * Not part of the unit testing, because this exception is only
1197                * thrown if there occurs an internal error.
1198                */
1199               throw new DataException(Data.getInstance().getLocaleStr(
1200                       "message.getLastSortPosOfAppCatalogsFailed")
1201                       + " " + e.getMessage());
1202           }
1203  
1204           return sortPos;
1205       }
1206  
1207       /**
1208        * Returns the list of attendees saved in the database.
1209        *
1210        * @return list of attendees
1211        * @throws DataException
1212        *             If an error occurs while getting the attendees
1213        */
1214       public List<AppAttendee> getAttendees() throws DataException {
1215           List<AppAttendee> attendees = new ArrayList<AppAttendee>();
1216  
1217           try {
1218               Connection conn = openConnection();
1219  
1220               PreparedStatement ps = conn
1221                       .prepareStatement("SELECT name,contact FROM Attendees "
1222                               + "ORDER BY name ASC");
1223  
1224               ResultSet res = ps.executeQuery();
1225  
1226               while (res.next()) {
1227                   attendees.add(AppAttendee.newInstance(res.getString("name"),
1228                           res.getString("contact")));
1229               }
1230  
1231               res.close();
1232               ps.close();
1233               conn.close();
1234           } catch (Exception e) {
1235               /*
1236                * Not part of the unit testing, because this exception is only
1237                * thrown if there occurs an internal error.
1238                */
1239               throw new DataException(Data.getInstance().getLocaleStr(
1240                       "message.getAppAttendeesFailed")
1241                       + " " + e.getMessage());
1242           }
1243  
1244           return attendees;
1245       }
1246  
1247       /**
1248        * Returns a list of attendees which fit to the given filter.
1249        *
1250        * @param filter
1251        *            to search for
1252        * @return list of attendees
1253        * @throws DataException
1254        *             If an error occurs while getting the attendees
1255        */
1256       public List<AppAttendee> getAttendees(String filter) throws DataException {
1257           List<AppAttendee> attendees = getAttendees();
1258           List<AppAttendee> attendeesFiltered = new ArrayList<AppAttendee>();
1259  
1260           for (AppAttendee att : attendees) {
1261               String contact = att.getContact();
1262               boolean isInContact = false;
1263  
1264               if (contact != null) {
1265                   if (contact.toLowerCase().contains(filter.toLowerCase())) {
1266                       isInContact = true;
1267                   }
1268               }
1269  
1270               if (att.getName().toLowerCase().contains(filter.toLowerCase())
1271                       || isInContact) {
1272                   attendeesFiltered.add(att);
1273               }
1274           }
1275  
1276           return attendeesFiltered;
1277       }
1278  
1279       /**
1280        * Returns the attendee with the given name. If an attendee with the given
1281        * name does not exist, then null will be returned.
1282        *
1283        * @param name
1284        *            of the attendee in the database
1285        * @param contact
1286        *            contact information of the attendee in the database
1287        * @return AppAttendee object
1288        * @throws DataException
1289        *             If an error occurs while getting the attendee
1290        */
1291       public AppAttendee getAttendee(String name, String contact)
1292               throws DataException {
1293           AppAttendee attendee = null;
1294  
1295           try {
1296               Connection conn = openConnection();
1297  
1298               PreparedStatement ps = conn
1299                       .prepareStatement("SELECT name,contact FROM Attendees "
1300                               + " WHERE name = ? AND contact = ?");
1301  
1302               ps.setString(1, name);
1303               ps.setString(2, contact);
1304  
1305               ResultSet res = ps.executeQuery();
1306  
1307               if (res.next()) {
1308                   attendee = AppAttendee.newInstance(res.getString("name"), res
1309                           .getString("contact"));
1310               }
1311  
1312               res.close();
1313               ps.close();
1314               conn.close();
1315           } catch (Exception e) {
1316               /*
1317                * Not part of the unit testing, because this exception is only
1318                * thrown if there occurs an internal error.
1319                */
1320               throw new DataException(Data.getInstance().getLocaleStr(
1321                       "message.getAppAttendeeFailed")
1322                       + " [NAME = " + name + "] " + e.getMessage());
1323           }
1324  
1325           return attendee;
1326       }
1327  
1328       /**
1329        * Create a new AppAttendee object. If an attendee with the given name does
1330        * not exist, a new one will be created in the database.
1331        *
1332        * @param name
1333        *            of the attendee
1334        * @param contact
1335        *            contact information of the attendee
1336        * @return AppAttendee object of the newly created attendee
1337        * @throws DataException
1338        *             If an error occurs while creating the new attendee
1339        */
1340       public AppAttendee newAttendee(String name, String contact)
1341               throws DataException {
1342           return AppAttendee.newInstance(name, contact);
1343       }
1344  
1345       /**
1346        * Removes the attendee with the given name from the database.
1347        *
1348        * @param name
1349        *            of the attendee
1350        * @param contact
1351        *            contact information of the attendee
1352        * @throws DataException
1353        *             If an error occurs while removing the attendee
1354        */
1355       public void removeAttendee(String name, String contact) throws DataException {
1356           try {
1357               Connection conn = openConnection();
1358               PreparedStatement ps;
1359  
1360               /*
1361                * Remove attendee and linked data
1362                */
1363               ps = conn.prepareStatement("DELETE FROM Attendees "
1364                       + "WHERE name = ? AND contact = ?");
1365               ps.setString(1, name);
1366               ps.setString(2, contact);
1367               ps.executeUpdate();
1368  
1369               ps = conn.prepareStatement("DELETE FROM AttendeesStrengths "
1370                       + "WHERE attendeeName = ? AND attendeeContact = ?");
1371               ps.setString(1, name);
1372               ps.setString(2, contact);
1373               ps.executeUpdate();
1374  
1375               ps.close();
1376               conn.close();
1377           } catch (Exception e) {
1378               /*
1379                * Not part of the unit testing, because this exception is only
1380                * thrown if there occurs an internal error.
1381                */
1382               throw new DataException(Data.getInstance().getLocaleStr(
1383                       "message.removeAppAttendeeFailed")
1384                       + " [NAME = " + name + "] " + e.getMessage());
1385           }
1386       }
1387  
1388       /**
1389        * Removes the given attendee from the database.
1390        *
1391        * @param name
1392        *            of the attendee
1393        * @throws DataException
1394        *             If an error occurs while removing the attendee
1395        */
1396       public void removeAttendee(AppAttendee attendee) throws DataException {
1397           removeAttendee(attendee.getName(), attendee.getContact());
1398       }
1399  
1400       /**
1401        * Returns the number of attendees stored in the database.
1402        *
1403        * @return number of attendees
1404        * @throws DataException
1405        *             If an error occurs while getting the number of attendees
1406        */
1407       public int getNumberOfAttendees() throws DataException {
1408           int numberOfAttendees = 0;
1409  
1410           try {
1411               Connection conn = openConnection();
1412  
1413               PreparedStatement ps = conn
1414                       .prepareStatement("SELECT COUNT(*) FROM Attendees");
1415  
1416               ResultSet res = ps.executeQuery();
1417  
1418               res.next();
1419  
1420               numberOfAttendees = res.getInt(1);
1421  
1422               res.close();
1423               ps.close();
1424               conn.close();
1425           } catch (Exception e) {
1426               /*
1427                * Not part of the unit testing, because this exception is only
1428                * thrown if there occurs an internal error.
1429                */
1430               throw new DataException(Data.getInstance().getLocaleStr(
1431                       "message.getNumberOfAppAttendeesFailed")
1432                       + " " + e.getMessage());
1433           }
1434  
1435           return numberOfAttendees;
1436       }
1437  
1438       /**
1439        * Returns the list of CSV profiles stored in the database.
1440        *
1441        * @return list of CSV profiles
1442        * @throws DataException
1443        *             If an error occurs while getting the list of CSV profiles
1444        */
1445       public List<AppCSVProfile> getCSVProfiles() throws DataException {
1446           List<AppCSVProfile> profiles = new ArrayList<AppCSVProfile>();
1447  
1448           try {
1449               Connection conn = openConnection();
1450  
1451               PreparedStatement ps = conn
1452                       .prepareStatement("SELECT name FROM CSVProfiles "
1453                               + "ORDER BY name ASC");
1454  
1455               ResultSet res = ps.executeQuery();
1456  
1457               while (res.next()) {
1458                   profiles.add(AppCSVProfile.newInstance(res.getString("name")));
1459               }
1460  
1461               res.close();
1462               ps.close();
1463               conn.close();
1464           } catch (Exception e) {
1465               /*
1466                * Not part of the unit testing, because this exception is only
1467                * thrown if there occurs an internal error.
1468                */
1469               throw new DataException(Data.getInstance().getLocaleStr(
1470                       "message.getAppCSVProfilesFailed")
1471                       + " " + e.getMessage());
1472           }
1473  
1474           return profiles;
1475       }
1476  
1477       /**
1478        * Returns a list of CSV profiles which fit to the given filter.
1479        *
1480        * @param filter
1481        *            to search for
1482        * @return list of CSV profiles
1483        * @throws DataException
1484        *             If an error occurs while getting the CSV profiles
1485        */
1486       public List<AppCSVProfile> getCSVProfiles(String filter)
1487               throws DataException {
1488           List<AppCSVProfile> profiles = getCSVProfiles();
1489           List<AppCSVProfile> profilesFiltered = new ArrayList<AppCSVProfile>();
1490  
1491           for (AppCSVProfile prof : profiles) {
1492               if (prof.getName().toLowerCase().contains(filter.toLowerCase())) {
1493                   profilesFiltered.add(prof);
1494               }
1495           }
1496  
1497           return profilesFiltered;
1498       }
1499  
1500       /**
1501        * Returns the CSV profile with the given name. If no profile with the given
1502        * name exists, then null will be returned.
1503        *
1504        * @param name
1505        *            of the CSV profile
1506        * @return a CSV profile
1507        * @throws DataException
1508        *             If an error occurs while
1509        */
1510       public AppCSVProfile getCSVProfile(String name) throws DataException {
1511           AppCSVProfile profile = null;
1512  
1513           try {
1514               Connection conn = openConnection();
1515  
1516               PreparedStatement ps = conn
1517                       .prepareStatement("SELECT name FROM CSVProfiles "
1518                               + " WHERE name = ?");
1519  
1520               ps.setString(1, name);
1521  
1522               ResultSet res = ps.executeQuery();
1523  
1524               if (res.next()) {
1525                   profile = AppCSVProfile.newInstance(res.getString("name"));
1526               }
1527  
1528               res.close();
1529               ps.close();
1530               conn.close();
1531           } catch (Exception e) {
1532               /*
1533                * Not part of the unit testing, because this exception is only
1534                * thrown if there occurs an internal error.
1535                */
1536               throw new DataException(Data.getInstance().getLocaleStr(
1537                       "message.getAppCSVProfileFailed")
1538                       + " [NAME = " + name + "] " + e.getMessage());
1539           }
1540  
1541           return profile;
1542       }
1543  
1544       /**
1545        * Create a new AppCSVProfile object. If a profile with the given name does
1546        * not exist, a new one will be created in the database.
1547        *
1548        * @param name
1549        *            of the profile
1550        * @return a CSV profile
1551        * @throws DataException
1552        *             If an error occurs while creating a new profile
1553        */
1554       public AppCSVProfile newCSVProfile(String name) throws DataException {
1555           return AppCSVProfile.newInstance(name);
1556       }
1557  
1558       /**
1559        * Remove the CSV profile with the given name from the database.
1560        *
1561        * @param name
1562        *            of the CSV profile
1563        * @throws DataException
1564        *             If an error occurs while removing the profile
1565        */
1566       public void removeCSVProfile(String name) throws DataException {
1567           try {
1568               Connection conn = openConnection();
1569               PreparedStatement ps;
1570  
1571               /*
1572                * Remove catalog and linked data
1573                */
1574               ps = conn.prepareStatement("DELETE FROM CSVProfiles "
1575                       + "WHERE name = ?");
1576               ps.setString(1, name);
1577               ps.executeUpdate();
1578  
1579               ps = conn.prepareStatement("DELETE FROM CSVColumnMappings "
1580                       + "WHERE profileName = ?");
1581               ps.setString(1, name);
1582               ps.executeUpdate();
1583  
1584               ps = conn.prepareStatement("DELETE FROM CSVSeverityMappings "
1585                       + "WHERE profileName = ?");
1586               ps.setString(1, name);
1587               ps.executeUpdate();
1588  
1589               ps.close();
1590               conn.close();
1591           } catch (Exception e) {
1592               /*
1593                * Not part of the unit testing, because this exception is only
1594                * thrown if there occurs an internal error.
1595                */
1596               throw new DataException(Data.getInstance().getLocaleStr(
1597                       "message.removeAppCSVProfileFailed")
1598                       + " [NAME = " + name + "] " + e.getMessage());
1599           }
1600       }
1601  
1602       /**
1603        * Remove the given CSV profile from the database.
1604        *
1605        * @param profile
1606        * @throws DataException
1607        *             If an error occurs while removing the CSV profile
1608        */
1609       public void removeCSVProfile(AppCSVProfile profile) throws DataException {
1610           removeCSVProfile(profile.getName());
1611       }
1612  
1613       /**
1614        * Returns the number of CSV profiles stored in the database.
1615        *
1616        * @return number of CSV profiles
1617        * @throws DataException
1618        *             If an error occurs while getting the number of CSV profiles
1619        */
1620       public int getNumberOfCSVProfiles() throws DataException {
1621           int numberOfCSVProfiles = 0;
1622  
1623           try {
1624               Connection conn = openConnection();
1625  
1626               PreparedStatement ps = conn
1627                       .prepareStatement("SELECT COUNT(*) FROM CSVProfiles");
1628  
1629               ResultSet res = ps.executeQuery();
1630  
1631               res.next();
1632  
1633               numberOfCSVProfiles = res.getInt(1);
1634  
1635               res.close();
1636               ps.close();
1637               conn.close();
1638           } catch (Exception e) {
1639               /*
1640                * Not part of the unit testing, because this exception is only
1641                * thrown if there occurs an internal error.
1642                */
1643               throw new DataException(Data.getInstance().getLocaleStr(
1644                       "message.getNumberOfAppCatalogsFailed")
1645                       + " " + e.getMessage());
1646           }
1647  
1648           return numberOfCSVProfiles;
1649       }
1650  
1651   }
MeetingComparator.java
14   public class MeetingComparator implements Comparator<Meeting> {
15  
16       @Override
17       public int compare(Meeting meet1, Meeting meet2) {
18           if (meet1.getPlannedDate().equals(meet2.getPlannedDate())) {
19               return meet1.getPlannedStart().compareTo(meet2.getPlannedStart());
20           } else {
21               return meet1.getPlannedDate().compareTo(meet2.getPlannedDate());
22           }
23       }
24  
25   }
AttendeeComparator.java
14   public class AttendeeComparator implements Comparator<Attendee> {
15  
16       @Override
17       public int compare(Attendee att1, Attendee att2) {
18           int compName = att1.getName().compareTo(att2.getName());
19           int compContact = att1.getContact().compareTo(att2.getContact());
20           
21           if (compName != 0) {
22               return compName;
23           }
24           
25           if (compContact != 0) {
26               return compContact;
27           }
28           
29           return 0;
30       }
31       
32   }
AspectComparator.java
14   public class AspectComparator implements Comparator<Aspect> {
15  
16       @Override
17       public int compare(Aspect asp1, Aspect asp2) {
18           int compCat = asp1.getCategory().compareTo(asp2.getCategory());
19           int compDesc = asp1.getDescription().compareTo(asp2.getDescription());
20           int compDir = asp1.getDirective().compareTo(asp2.getDirective());
21           
22           if (compDir != 0) {
23               return compDir;
24           }
25           
26           if (compDesc != 0) {
27               return compDesc;
28           }
29           
30           if (compCat != 0) {
31               return compCat;
32           }
33           
34           return 0;
35       }
36  
37   }
SeverityManagement.java
18   public class SeverityManagement {
19  
20       private ResiData resiData = Data.getInstance().getResiData();
21  
22       /**
23        * Checks the severity of all findings and corrects incorrect values.
24        */
25       public void validateSeverities() {
26           String highestSev = getSeverities().get(0);
27  
28           for (Meeting m : resiData.getReview().getMeetings()) {
29               Protocol prot = m.getProtocol();
30  
31               if (prot != null) {
32                   for (Finding f : prot.getFindings()) {
33                       if (!isSeverity(f.getSeverity())) {
34                           f.setSeverity(highestSev);
35                       }
36                   }
37               }
38           }
39       }
40  
41       /**
42        *
43        * @param sev
44        * @return
45        */
46       public boolean isSeverity(String sev) {
47           if (getSeverities().contains(sev)) {
48               return true;
49           } else {
50               return false;
51           }
52       }
53  
54       /**
55        * Returns a list of severities of the current review
56        *
57        * @return Severities
58        */
59       public List<String> getSeverities() {
60           return resiData.getReview().getSeverities().getSeverities();
61       }
62  
63       /**
64        * Adds a severity to the list of severities of the current review
65        *
66        * @param sev
67        */
68       public void addSeverity(String sev) {
69           sev = sev.trim();
70  
71           if (!isSeverity(sev)) {
72               getSeverities().add(sev);
73  
74               resiData.fireDataChanged();
75           }
76       }
77  
78       /**
79        *
80        * @param sev
81        * @return
82        */
83       public String getReplaceSeverity(String sev) {
84           String replaceSeverity = null;
85  
86           if (isSeverity(sev)) {
87               if (getSeverities().indexOf(sev) == 0 && getSeverities().size() > 1) {
88                   replaceSeverity = getSeverities().get(1);
89               } else {
90                   replaceSeverity = getSeverities().get(
91                           getSeverities().indexOf(sev) - 1);
92               }
93           }
94  
95           return replaceSeverity;
96       }
97  
98       /**
99        *
100        * @param sev
101        * @return
102        */
103       public boolean isSeverityRemovable(String sev) {
104           if (isSeverity(sev) && getSeverities().size() <= 1) {
105               return false;
106           } else {
107               return true;
108           }
109       }
110  
111       /**
112        * Removes a severity form the list of severities of the current review
113        *
114        * @param sev
115        */
116       public void removeSeverity(String sev) {
117           if (isSeverityRemovable(sev)) {
118               String replaceSeverity = getReplaceSeverity(sev);
119  
120               for (Meeting m : resiData.getReview().getMeetings()) {
121                   Protocol prot = m.getProtocol();
122  
123                   if (prot != null) {
124                       for (Finding f : prot.getFindings()) {
125                           if (sev.equals(f.getSeverity())) {
126                               f.setSeverity(replaceSeverity);
127                           }
128                       }
129                   }
130               }
131  
132               getSeverities().remove(sev);
133  
134               resiData.fireDataChanged();
135           }
136       }
137  
138       /**
139        * Replaces a severity from the list of severities of the current review by
140        * another one
141        *
142        * @param oldSev
143        * @param newSev
144        */
145       public void editSeverity(String oldSev, String newSev) {
146           newSev = newSev.trim();
147  
148           if (getSeverities().contains(oldSev)) {
149               int index = getSeverities().indexOf(oldSev);
150  
151               getSeverities().remove(oldSev);
152  
153               if (!isSeverity(newSev)) {
154                   getSeverities().add(index, newSev);
155               }
156  
157               for (Meeting m : resiData.getReview().getMeetings()) {
158                   Protocol prot = m.getProtocol();
159  
160                   if (prot != null) {
161                       for (Finding f : prot.getFindings()) {
162                           if (oldSev.equals(f.getSeverity())) {
163                               f.setSeverity(newSev);
164                           }
165                       }
166                   }
167               }
168  
169               resiData.fireDataChanged();
170           }
171       }
172  
173       /**
174        * Returns the number of severities
175        *
176        * @return
177        */
178       public int getNumberOfSeverities() {
179           return Application.getInstance().getReviewMgmt()
180                   .getNumberOfSeverities();
181       }
182  
183       /**
184        * Pushs up a severity in the list of severities of the current review
185        *
186        * @param sev
187        */
188       public void pushUpSeverity(String sev) {
189           if (!isTopSeverity(sev)) {
190               int index = getSeverities().indexOf(sev);
191  
192               getSeverities().remove(index);
193               getSeverities().add(index - 1, sev);
194  
195               resiData.fireDataChanged();
196           }
197       }
198  
199       /**
200        * Pushs down a severity in the list of severities of the current review
201        *
202        * @param sev
203        */
204       public void pushDownSeverity(String sev) {
205           if (!isBottomSeverity(sev)) {
206               int index = getSeverities().indexOf(sev);
207  
208               getSeverities().remove(index);
209               getSeverities().add(index + 1, sev);
210  
211               resiData.fireDataChanged();
212           }
213       }
214  
215       /**
216        * Pushs up a severity to the top of the list of severities of the current
217        * review
218        *
219        * @param sev
220        */
221       public void pushTopSeverity(String sev) {
222           if (!isTopSeverity(sev)) {
223               int index = getSeverities().indexOf(sev);
224  
225               getSeverities().remove(index);
226               getSeverities().add(0, sev);
227  
228               resiData.fireDataChanged();
229           }
230       }
231  
232       /**
233        * Pushs up a severity to the bottom of the list of severities of the
234        * current review
235        *
236        * @param sev
237        */
238       public void pushBottomSeverity(String sev) {
239           if (!isBottomSeverity(sev)) {
240               int index = getSeverities().indexOf(sev);
241  
242               getSeverities().add(getSeverities().size(), sev);
243               getSeverities().remove(index);
244  
245               resiData.fireDataChanged();
246           }
247       }
248  
249       /**
250        * Returns a true if the severity is the element at the top of the list;
251        * otherwise false
252        *
253        * @param sev
254        * @return
255        */
256       public boolean isTopSeverity(String sev) {
257           int index = getSeverities().indexOf(sev);
258  
259           if (index == 0) {
260               return true;
261           } else {
262               return false;
263           }
264       }
265  
266       /**
267        * Returns a true if the severity is the element at the bottom of the list;
268        * otherwise false
269        *
270        * @param sev
271        * @return
272        */
273       public boolean isBottomSeverity(String sev) {
274           int index = getSeverities().indexOf(sev);
275  
276           if (index == getSeverities().size() - 1) {
277               return true;
278           } else {
279               return false;
280           }
281       }
282  
283   }
ReviewManagement.java
23   public class ReviewManagement {
24  
25       /**
26        * Reference to the instance of the Resi data model.
27        */
28       private ResiData resiData = Data.getInstance().getResiData();
29  
30       private final String REVIEW_FILE = Data.getInstance().getResource(
31               "reviewFileName");
32  
33       private final String REVIEW_INFO_DOC = Data.getInstance().getLocaleStr(
34               "export.reviewInfoDocumentName");
35  
36       private final String EXTREF_PREFIX = Data.getInstance().getResource(
37               "extRefURIPrefix");
38  
39       private final String EXTREF_DIRECTORY = Data.getInstance().getAppData()
40               .getAppDataPath()
41               + Data.getInstance().getResource("extRefsDirectoryName");
42  
43       /**
44        *
45        * @param extRefURI
46        * @return
47        */
48       public String getExtRefFileName(String extRefURI) {
49           String extRefFileName = null;
50  
51           try {
52               extRefFileName = new URI(extRefURI).getPath();
53           } catch (URISyntaxException e) {
54               extRefFileName = extRefURI.substring(EXTREF_PREFIX.length())
55                       .replace("%20", " ");
56           }
57  
58           if (extRefFileName.startsWith("/")) {
59               extRefFileName = extRefFileName.substring(1);
60           }
61  
62           return extRefFileName;
63       }
64  
65       /**
66        *
67        * @param extRefName
68        * @return
69        */
70       public String getExtRefURI(String fileName) {
71           return URI.create(EXTREF_PREFIX + fileName.replace(" ", "%20"))
72                   .toASCIIString();
73       }
74  
75       /**
76        *
77        * @param fileName
78        * @param find
79        * @return
80        */
81       public boolean isExtRef(String fileName) {
82           /*
83            * For the review file (review.xml) always return that it is referenced,
84            * because this file name has to be reserved for the review XML file.
85            */
86           if (fileName.toLowerCase().equals(REVIEW_FILE.toLowerCase())
87                   || fileName.toLowerCase().equals(REVIEW_INFO_DOC.toLowerCase())) {
88               return true;
89           }
90  
91           /*
92            * Check if a reference with this filename exists in any finding of the
93            * currently opened review
94            */
95           for (Meeting m : resiData.getReview().getMeetings()) {
96               Protocol prot = m.getProtocol();
97  
98               if (prot != null) {
99                   for (Finding f : prot.getFindings()) {
100                       if (f.getExternalReferences().contains(
101                               getExtRefURI(fileName))) {
102                           return true;
103                       }
104                   }
105               }
106           }
107  
108           /*
109            * Check if a reference with this filename exists in the product
110            * references
111            */
112           if (resiData.getReview().getProduct().getReferences().contains(
113                   getExtRefURI(fileName))) {
114               return true;
115           }
116  
117           return false;
118       }
119  
120       /**
121        *
122        * @param file
123        *            to add to external references
124        * @return the internal URI to add to the review XML file; null if an error
125        *         occured while trying to add the file
126        */
127       public String addExtRefFile(File file) {
128           String extRefFile = file.getName();
129  
130           /*
131            * Check if the name for the file is already used and find a new one if
132            * it is so
133            */
134           int index = 1;
135           String extRefName = extRefFile;
136  
137           while (isExtRef(extRefName)) {
138               int dotPos;
139  
140               if (extRefFile.lastIndexOf('.') != -1) {
141                   dotPos = extRefFile.lastIndexOf('.');
142               } else {
143                   dotPos = extRefFile.length();
144               }
145  
146               String fileName = extRefFile.substring(0, dotPos);
147               String fileEnding = extRefFile.substring(dotPos);
148  
149               extRefName = fileName + index + fileEnding;
150  
151               index++;
152           }
153  
154           File refFile = new File(EXTREF_DIRECTORY + extRefName);
155  
156           try {
157               FileTools.copyFile(file, refFile);
158           } catch (IOException e) {
159               /*
160                * Not part of unit testing because this code is only reached if an
161                * internal error occurs.
162                */
163               refFile.delete();
164               return null;
165           }
166  
167           return getExtRefURI(extRefName);
168       }
169  
170       /**
171        *
172        */
173       public void validateExtRefs() {
174           /*
175            * Remove duplicate product file references
176            */
177           List<String> prodRefs = resiData.getReview().getProduct()
178                   .getReferences();
179           List<String> refList = new ArrayList<String>();
180           int i = 0;
181  
182           while (prodRefs.size() > i) {
183               String ref = prodRefs.get(i);
184  
185               i++;
186  
187               if (refList.contains(ref)) {
188                   prodRefs.remove(ref);
189                   i--;
190               } else {
191                   refList.add(ref);
192               }
193           }
194  
195           /*
196            * Remove invalid and wrong product file references
197            */
198           i = 0;
199  
200           while (prodRefs.size() > i) {
201               String ref = prodRefs.get(i);
202  
203               i++;
204  
205               /*
206                * Remove references with no file
207                */
208               if (ref.startsWith(EXTREF_PREFIX)) {
209                   File extRefFile = new File(EXTREF_DIRECTORY
210                           + getExtRefFileName(ref));
211  
212                   if (!extRefFile.exists()) {
213                       prodRefs.remove(ref);
214                       i--;
215                   }
216               }
217           }
218  
219           /*
220            * Remove duplicate references in the findings of the currently opened
221            * review
222            */
223           for (Meeting m : resiData.getReview().getMeetings()) {
224               Protocol prot = m.getProtocol();
225  
226               if (prot != null) {
227  
228                   for (Finding f : prot.getFindings()) {
229                       refList = new ArrayList<String>();
230                       i = 0;
231  
232                       while (f.getExternalReferences().size() > i) {
233                           String ref = f.getExternalReferences().get(i);
234  
235                           i++;
236  
237                           if (refList.contains(ref)) {
238                               f.getExternalReferences().remove(ref);
239                               i--;
240                           } else {
241                               refList.add(ref);
242                           }
243                       }
244                   }
245               }
246           }
247  
248           /*
249            * Remove invalid and wrong references in the findings of the currently
250            * opened review
251            */
252           for (Meeting m : resiData.getReview().getMeetings()) {
253               Protocol prot = m.getProtocol();
254  
255               if (prot != null) {
256                   for (Finding f : prot.getFindings()) {
257                       i = 0;
258  
259                       while (f.getExternalReferences().size() > i) {
260                           String ref = f.getExternalReferences().get(i);
261  
262                           i++;
263  
264                           /*
265                            * Remove invalid references
266                            */
267                           if (!ref.startsWith(EXTREF_PREFIX)) {
268                               f.getExternalReferences().remove(ref);
269                               i--;
270                           } else {
271                               /*
272                                * Remove references with no file
273                                */
274                               File extRefFile = new File(EXTREF_DIRECTORY
275                                       + getExtRefFileName(ref));
276  
277                               if (!extRefFile.exists()) {
278                                   f.getExternalReferences().remove(ref);
279                                   i--;
280                               }
281                           }
282                       }
283                   }
284               }
285           }
286  
287           /*
288            * Remove files which are not referenced
289            */
290           for (File f : FileTools.getListOfFiles(new File(EXTREF_DIRECTORY))) {
291               if (!isExtRef(f.getName())) {
292                   f.delete();
293               }
294           }
295       }
296  
297       /**
298        *
299        */
300       public void refactorReview() {
301           Application.getInstance().getAspectMgmt().refactorIds();
302           Application.getInstance().getAttendeeMgmt().refactorIds();
303           Application.getInstance().getFindingMgmt().refactorIds();
304  
305           Application.getInstance().getSeverityMgmt().validateSeverities();
306  
307           validateExtRefs();
308       }
309  
310       /**
311        * Sets the name of the review.
312        *
313        * @param name
314        *            of the review
315        */
316       public void setReviewName(String name) {
317           name = name.trim();
318  
319           resiData.getReview().setName(name);
320  
321           resiData.fireDataChanged();
322       }
323  
324       /**
325        * Returns the name of the review.
326        *
327        * @return name of the review
328        */
329       public String getReviewName() {
330           return resiData.getReview().getName();
331       }
332  
333       /**
334        * Sets the description of the review.
335        *
336        * @param desc
337        *            description of the review
338        */
339       public void setReviewDescription(String desc) {
340           desc = desc.trim();
341  
342           resiData.getReview().setDescription(desc);
343  
344           resiData.fireDataChanged();
345       }
346  
347       /**
348        * Returns the description of the review.
349        *
350        * @return description of the review
351        */
352       public String getReviewDescription() {
353           return resiData.getReview().getDescription();
354       }
355  
356       /**
357        * Sets the comments of the review.
358        *
359        * @param comments
360        *            of the review
361        */
362       public void setReviewComments(String com) {
363           com = com.trim();
364  
365           resiData.getReview().setComments(com);
366  
367           resiData.fireDataChanged();
368       }
369  
370       /**
371        * Returns the comments of the review.
372        *
373        * @return comments of the review
374        */
375       public String getReviewComments() {
376           return resiData.getReview().getComments();
377       }
378  
379       /**
380        * Sets the name of the reviewed product.
381        *
382        * @param name
383        *            of the reviewed product
384        */
385       public void setProductName(String name) {
386           name = name.trim();
387  
388           resiData.getReview().getProduct().setName(name);
389  
390           resiData.fireDataChanged();
391       }
392  
393       /**
394        * Returns the name of the reviewed product.
395        *
396        * @return name of the reviewed product
397        */
398       public String getProductName() {
399           return resiData.getReview().getProduct().getName();
400       }
401  
402       /**
403        * Sets the version of the reviewed product.
404        *
405        * @param version
406        *            of the reviewed product
407        */
408       public void setProductVersion(String version) {
409           version = version.trim();
410  
411           resiData.getReview().getProduct().setVersion(version);
412  
413           resiData.fireDataChanged();
414       }
415  
416       /**
417        * Returns the version of the reviewed product.
418        *
419        * @return product version of the review
420        */
421       public String getProductVersion() {
422           return resiData.getReview().getProduct().getVersion();
423       }
424  
425       /**
426        *
427        * @param ref
428        * @return
429        */
430       public boolean isProductReference(String ref) {
431           if (getProductReferences().contains(ref)) {
432               return true;
433           } else {
434               return false;
435           }
436       }
437  
438       /**
439        *
440        * @param ref
441        * @return
442        */
443       public boolean isProductReferenceRemovable(String ref) {
444           if (isProductReference(ref) && getNumberOfProdRefs() <= 1) {
445               return false;
446           } else {
447               return true;
448           }
449       }
450  
451       /**
452        * Returns the products textual references of the review.
453        *
454        * @return product references of the review
455        */
456       public List<String> getProductReferences() {
457           List<String> textRefs = new ArrayList<String>();
458  
459           for (String ref : resiData.getReview().getProduct().getReferences()) {
460               if (!ref.startsWith(EXTREF_PREFIX)) {
461                   textRefs.add(ref);
462               }
463           }
464  
465           return textRefs;
466       }
467  
468       /**
469        * Adds a textual reference to the list of references of the reviewed
470        * product.
471        *
472        * @param reference
473        *            which should be added to the reviewed product
474        */
475       public void addProductReference(String ref) {
476           ref = ref.trim();
477  
478           if (!resiData.getReview().getProduct().getReferences().contains(ref)) {
479               resiData.getReview().getProduct().getReferences().add(ref);
480  
481               resiData.fireDataChanged();
482           }
483       }
484  
485       /**
486        * Removes a textual reference from the list of references of the reviewed
487        * product.
488        *
489        * @param reference
490        *            which should be removed from the reviewed product
491        */
492       public void removeProductReference(String ref) {
493           if (isProductReferenceRemovable(ref)) {
494               resiData.getReview().getProduct().getReferences().remove(ref);
495  
496               resiData.fireDataChanged();
497           }
498       }
499  
500       /**
501        *
502        * @param oldRef
503        * @param newRef
504        */
505       public void editProductReference(String oldRef, String newRef) {
506           int indexOld = resiData.getReview().getProduct().getReferences()
507                   .indexOf(oldRef);
508  
509           if (!newRef.trim().equals("")) {
510               resiData.getReview().getProduct().getReferences().set(indexOld,
511                       newRef);
512           }
513  
514           resiData.fireDataChanged();
515       }
516  
517       /**
518        *
519        * @param ref
520        * @return
521        */
522       public boolean isExtProdReferenceRemovable(File ref) {
523           if (isExtRef(ref.getName()) && getNumberOfProdRefs() <= 1) {
524               return false;
525           } else {
526               return true;
527           }
528       }
529  
530       /**
531        * Returns a list of external references of the product
532        *
533        * @param find
534        * @return list of files
535        */
536       public List<File> getExtProdReferences() {
537           List<File> fileRefs = new ArrayList<File>();
538  
539           for (String ref : resiData.getReview().getProduct().getReferences()) {
540               if (ref.startsWith(EXTREF_PREFIX)) {
541                   File extRefFile = new File(EXTREF_DIRECTORY
542                           + getExtRefFileName(ref));
543  
544                   fileRefs.add(extRefFile);
545               }
546           }
547  
548           return fileRefs;
549       }
550  
551       /**
552        * Adds a external reference by its file name to the list of references of
553        * the product
554        *
555        * @param fileName
556        * @return true if adding the external reference was succesful; otherwise
557        *         false
558        */
559       public boolean addExtProdReference(File file) {
560           List<String> prodRefs = resiData.getReview().getProduct()
561                   .getReferences();
562  
563           String extRefFile = addExtRefFile(file);
564  
565           if (extRefFile != null) {
566               prodRefs.add(extRefFile);
567  
568               resiData.fireDataChanged();
569  
570               return true;
571           } else {
572               /*
573                * Not part of unit testing because this method only returns false
574                * if an internal error occurs.
575                */
576               return false;
577           }
578       }
579  
580       /**
581        * Removes an external reference by its file name from the list of
582        * references of the product
583        *
584        * @param fileName
585        */
586       public void removeExtProdReference(File file) {
587           List<String> prodRefs = resiData.getReview().getProduct()
588                   .getReferences();
589  
590           String extRef = getExtRefURI(file.getName());
591  
592           file.delete();
593  
594           prodRefs.remove(extRef);
595  
596           resiData.fireDataChanged();
597       }
598  
599       /**
600        * Sets the impression of the reviewed product.
601        *
602        * @param impression
603        *            of the reviewed product
604        */
605       public void setImpression(String impr) {
606           impr = impr.trim();
607  
608           resiData.getReview().setImpression(impr);
609  
610           resiData.fireDataChanged();
611       }
612  
613       /**
614        * Returns the impression of the review.
615        *
616        * @return impression of the review
617        */
618       public String getImpression() {
619           return resiData.getReview().getImpression();
620       }
621  
622       /**
623        * Sets the recommendation of the reviewed product.
624        *
625        * @param recommendation
626        *            of the reviewed product
627        */
628       public void setRecommendation(String rec) {
629           rec = rec.trim();
630  
631           resiData.getReview().setRecommendation(rec);
632  
633           resiData.fireDataChanged();
634       }
635  
636       /**
637        * Returns the recommendation of the review.
638        *
639        * @return recommendation of the review
640        */
641       public String getRecommendation() {
642           return resiData.getReview().getRecommendation();
643       }
644  
645       /**
646        * Returns the number of all (textual and file) product references of the
647        * review.
648        *
649        * @return number of product references of the review
650        */
651       public int getNumberOfProdRefs() {
652           return resiData.getReview().getProduct().getReferences().size();
653       }
654  
655       /**
656        * Returns the number of severities
657        *
658        * @return
659        */
660       public int getNumberOfSeverities() {
661           return resiData.getReview().getSeverities().getSeverities().size();
662       }
663  
664       public int getNumberOfAttendees() {
665           return resiData.getReview().getAttendees().size();
666       }
667  
668       public int getNumberOfAspects() {
669           return resiData.getReview().getAspects().size();
670       }
671  
672       public int getNumberOfMeetings() {
673           return resiData.getReview().getMeetings().size();
674       }
675  
676       public int getNumberOfFindings() {
677           int number = 0;
678  
679           for (Meeting m : resiData.getReview().getMeetings()) {
680               Protocol prot = m.getProtocol();
681  
682               if (prot != null) {
683                   number = number + prot.getFindings().size();
684               }
685           }
686  
687           return number;
688       }
689  
690   }
ResiFileFilter.java
17   public class ResiFileFilter extends FileFilter implements FilenameFilter {
18  
19       public static final int TYPE_ALL = 1;
20       public static final int TYPE_DIRECTORY = 2;
21       public static final int TYPE_REVIEW = 3;
22       public static final int TYPE_CATALOG = 4;
23       public static final int TYPE_ASPECTS = 5;
24       public static final int TYPE_PDF = 6;
25       public static final int TYPE_CSV = 7;
26       public static final int TYPE_ZIP = 8;
27  
28       private final String ENDING_REVIEW_XML = "."
29               + Data.getInstance().getResource("fileEndingReviewXML")
30                       .toLowerCase();
31       private final String ENDING_REVIEW_ZIP = "."
32               + Data.getInstance().getResource("fileEndingReviewZIP")
33                       .toLowerCase();
34       private final String ENDING_CATALOG = "."
35               + Data.getInstance().getResource("fileEndingCatalog").toLowerCase();
36       private final String ENDING_ASPECTS = "."
37               + Data.getInstance().getResource("fileEndingAspects").toLowerCase();
38  
39       private int type = TYPE_ALL;
40  
41       public ResiFileFilter(int type) {
42           this.type = type;
43       }
44  
45       @Override
46       public boolean accept(File path) {
47           boolean returnValue = true;
48           String fileName = path.getName().toLowerCase();
49  
50           switch (type) {
51           case TYPE_ALL:
52               returnValue = true;
53               break;
54               
55           case TYPE_DIRECTORY:
56               returnValue = path.isDirectory();
57               break;
58  
59           case TYPE_REVIEW:
60               returnValue = path.isDirectory()
61                       || fileName.endsWith(ENDING_REVIEW_ZIP)
62                       || fileName.endsWith(ENDING_REVIEW_XML)
63                       || fileName.endsWith(".xml");
64               break;
65  
66           case TYPE_CATALOG:
67               returnValue = path.isDirectory()
68                       || fileName.endsWith(ENDING_CATALOG)
69                       || fileName.endsWith(".xml");
70               break;
71  
72           case TYPE_ASPECTS:
73               returnValue = path.isDirectory()
74                       || fileName.endsWith(ENDING_ASPECTS)
75                       || fileName.endsWith(".xml");
76               break;
77  
78           case TYPE_PDF:
79               returnValue = path.isDirectory() || fileName.endsWith(".pdf");
80               break;
81  
82           case TYPE_CSV:
83               returnValue = path.isDirectory() || fileName.endsWith(".csv")
84                       || fileName.endsWith(".txt");
85               break;
86  
87           case TYPE_ZIP:
88               returnValue = path.isDirectory() || fileName.endsWith(".zip");
89               break;
90  
91           default:
92               returnValue = true;
93               break;
94           }
95  
96           return returnValue;
97       }
98  
99       @Override
100       public boolean accept(File dir, String name) {
101           File f = new File(dir + name);
102           
103           return !f.isHidden() && accept(f);
104       }
105  
106       @Override
107       public String getDescription() {
108           String description = "";
109  
110           switch (type) {
111           case TYPE_ALL:
112               description = Data.getInstance().getLocaleStr(
113                       "fileChooser.typeAll");
114               break;
115  
116           case TYPE_DIRECTORY:
117               description = Data.getInstance().getLocaleStr(
118                       "fileChooser.typeDirectory");
119               break;
120  
121           case TYPE_REVIEW:
122               description = Data.getInstance().getLocaleStr(
123                       "fileChooser.typeReview")
124                       + " (*"
125                       + ENDING_REVIEW_ZIP
126                       + " *"
127                       + ENDING_REVIEW_XML
128                       + " *.xml)";
129               break;
130  
131           case TYPE_CATALOG:
132               description = Data.getInstance().getLocaleStr(
133                       "fileChooser.typeCatalog")
134                       + " (*" + ENDING_CATALOG + " *.xml)";
135               break;
136  
137           case TYPE_ASPECTS:
138               description = Data.getInstance().getLocaleStr(
139                       "fileChooser.typeAspects")
140                       + " (*" + ENDING_ASPECTS + " *.xml)";
141               break;
142  
143           case TYPE_PDF:
144               description = Data.getInstance()
145                       .getLocaleStr("fileChooser.typePDF")
146                       + " (*.pdf)";
147               break;
148  
149           case TYPE_CSV:
150               description = Data.getInstance()
151                       .getLocaleStr("fileChooser.typeCSV")
152                       + " (*.csv *.txt)";
153               break;
154  
155           case TYPE_ZIP:
156               description = Data.getInstance()
157                       .getLocaleStr("fileChooser.typeZIP")
158                       + " (*.zip)";
159               break;
160  
161           default:
162               description = Data.getInstance()
163                       .getLocaleStr("fileChooser.typeAll");
164               break;
165           }
166  
167           return description;
168       }
169  
170   }
ProtocolManagement.java
23   public class ProtocolManagement {
24  
25       private ResiData resiData = Data.getInstance().getResiData();
26  
27       /**
28        * Returns the protocol of the meeting
29        *
30        * @param meet
31        * @return protocol
32        */
33       public Protocol getProtocol(Meeting meet) {
34           return meet.getProtocol();
35       }
36  
37       /**
38        *
39        * @param date
40        * @param start
41        * @param end
42        * @param location
43        * @param meet
44        * @return
45        */
46       public Protocol setProtocol(Calendar date, Calendar start, Calendar end,
47               String location, Meeting meet) {
48           Protocol prot = new Protocol();
49  
50           prot.setDate(date);
51           prot.setStart(start);
52           prot.setEnd(end);
53           prot.setLocation(location);
54  
55           setProtocol(prot, meet);
56  
57           return prot;
58       }
59  
60       /**
61        *Adds a protocol to the given meeting
62        *
63        * @param prot
64        * @param meet
65        */
66       public void setProtocol(Protocol prot, Meeting meet) {
67           meet.setProtocol(prot);
68  
69           resiData.fireDataChanged();
70       }
71  
72       /**
73        * Removes a protocol from the given meeting
74        *
75        * @param meet
76        */
77       public void clearProtocol(Meeting meet) {
78           meet.setProtocol(null);
79  
80           resiData.fireDataChanged();
81       }
82  
83       /**
84        * Returns the list of AttendeeReferences of the given protocol
85        *
86        * @param prot
87        * @return
88        */
89       public List<Attendee> getAttendees(Protocol prot) {
90           List<Attendee> attendees = new ArrayList<Attendee>();
91  
92           for (AttendeeReference ar : prot.getAttendeeReferences()) {
93               Attendee att = Application.getInstance().getAttendeeMgmt()
94                       .getAttendee(Integer.parseInt(ar.getAttendee()));
95  
96               attendees.add(att);
97           }
98  
99           return attendees;
100       }
101  
102       /**
103        *
104        * @param att
105        * @param prot
106        * @return
107        */
108       public boolean isAttendee(Attendee att, Protocol prot) {
109           for (AttendeeReference ar : prot.getAttendeeReferences()) {
110               if (ar.getAttendee().equals(att.getId())) {
111                   return true;
112               }
113           }
114  
115           return false;
116       }
117  
118       /**
119        * Adds an attendee to the list of AttendeeReferences of the given protocol
120        *
121        * @param att
122        * @param prep
123        * @param prot
124        */
125       public void addAttendee(Attendee att, Duration prep, Protocol prot) {
126           if (!isAttendee(att, prot)) {
127               AttendeeReference attRef = new AttendeeReference();
128               attRef.setAttendee(att.getId());
129               attRef.setPreparationTime(prep);
130  
131               prot.getAttendeeReferences().add(attRef);
132  
133               resiData.fireDataChanged();
134           }
135       }
136  
137       /**
138        * Removes an attendee from the list of AttendeeReferences of the given
139        * protocol
140        *
141        * @param att
142        * @param prot
143        */
144       public void removeAttendee(Attendee att, Protocol prot) {
145           int i = 0;
146           
147           List<AttendeeReference> attRefs = prot.getAttendeeReferences();
148           
149           while (i < attRefs.size()) {
150               if (attRefs.get(i).getAttendee().equals(att.getId())) {
151                   prot.getAttendeeReferences().remove(attRefs.get(i));
152                   i--;
153                   
154                   resiData.fireDataChanged();
155               }
156               
157               i++;
158           }
159       }
160  
161       /**
162        *
163        * @param att
164        * @param prot
165        * @return
166        */
167       public Duration getAttendeePrepTime(Attendee att, Protocol prot) {
168           Duration dur = null;
169  
170           for (AttendeeReference ar : prot.getAttendeeReferences()) {
171               if (ar.getAttendee().equals(att.getId())) {
172                   dur = ar.getPreparationTime();
173               }
174           }
175  
176           return dur;
177       }
178  
179   }
MeetingManagement.java
20   public class MeetingManagement {
21  
22       /**
23        * Reference to the instance of the Resi data model.
24        */
25       private ResiData resiData = Data.getInstance().getResiData();
26  
27       /**
28        * Returns Meetings of the Review
29        *
30        * @return Meetings
31        */
32       public List<Meeting> getMeetings() {
33           return resiData.getReview().getMeetings();
34       }
35  
36       /**
37        *
38        * @param curMeet
39        * @return
40        */
41       public Meeting getPredecessorMeeting(Meeting curMeet) {
42           ProtocolComparator comp = new ProtocolComparator();
43           Meeting meet = null;
44  
45           for (int i = getMeetings().size() - 1; i >= 0; i--) {
46               meet = getMeetings().get(i);
47  
48               if (meet.getCanceled() == null && meet.getProtocol() != null) {
49                   if (comp.compare(curMeet.getProtocol(), meet.getProtocol()) > 0) {
50                       return meet;
51                   }
52               }
53           }
54  
55           return null;
56       }
57  
58       /**
59        *
60        * @param date
61        * @param start
62        * @param end
63        * @param location
64        * @return
65        */
66       public Meeting addMeeting(Calendar date, Calendar start, Calendar end,
67               String location) {
68           Meeting meeting = new Meeting();
69  
70           meeting.setPlannedDate(date);
71           meeting.setPlannedStart(start);
72           meeting.setPlannedEnd(end);
73           meeting.setPlannedLocation(location);
74  
75           addMeeting(meeting);
76  
77           return meeting;
78       }
79  
80       /**
81        * Adds a meeting to the review
82        *
83        * @param meet
84        */
85       public void addMeeting(Meeting meet) {
86           if (meet.getComments() == null) {
87               meet.setComments("");
88           }
89  
90           if (!getMeetings().contains(meet)) {
91               getMeetings().add(meet);
92  
93               Collections.sort(getMeetings(), new MeetingComparator());
94  
95               resiData.fireDataChanged();
96           }
97       }
98  
99       /**
100        * Removes meeting from the review
101        *
102        * @param meet
103        */
104       public void removeMeeting(Meeting meet) {
105           getMeetings().remove(meet);
106  
107           resiData.fireDataChanged();
108       }
109  
110       /**
111        * Removes meeting from the review
112        *
113        * @param meet
114        */
115       public void removeMeeting(int meetIndex) {
116           getMeetings().remove(meetIndex);
117  
118           resiData.fireDataChanged();
119       }
120  
121       /**
122        * Replaces a existing Meeting by another one
123        *
124        * @param oldMeet
125        * @param newMeet
126        */
127       public void editMeeting(Meeting oldMeet, Meeting newMeet) {
128           if (getMeetings().contains(oldMeet)) {
129               int index = getMeetings().indexOf(oldMeet);
130  
131               getMeetings().remove(oldMeet);
132               getMeetings().add(index, newMeet);
133  
134               resiData.fireDataChanged();
135           }
136       }
137  
138   }
ImportExportControl.java
40   public class ImportExportControl {
41  
42       
ImportExportControl.java
44       }
45  
46       /**
47        * The IO provider to load and store data in Resi XML format.
48        */
49       private ResiIO io = ResiIOFactory.getInstance().getIOProvider();
50  
51       public Catalog importCatalogXML(String filePath) throws ResiIOException {
52           io.loadCatalog(filePath);
53  
54           return Data.getInstance().getResiData().getCatalog();
55       }
56  
57       public void exportCatalogXML(String filePath, Catalog cat)
58               throws ResiIOException {
59           Data.getInstance().getResiData().setCatalog(cat);
60  
61           io.storeCatalog(filePath);
62       }
63  
64       public Aspects importAspectsXML(String filePath) throws ResiIOException {
65           io.loadAspects(filePath);
66  
67           return Data.getInstance().getResiData().getAspects();
68       }
69  
70       public void exportAspectsXML(String filePath, Aspects asps)
71               throws ResiIOException {
72           Data.getInstance().getResiData().setAspects(asps);
73  
74           io.storeAspects(filePath);
75       }
76  
77       public void exportMeetingProtocolPDF(String filePath, Meeting meeting,
78               boolean showSignFields, boolean attachProdExtRefs,
79               boolean attachFindExtRefs) throws ExportException, DataException {
80           ProtocolPDFExporter exporter = new MeetingProtocolPDFExporter(filePath,
81                   meeting, showSignFields, attachProdExtRefs, attachFindExtRefs);
82  
83           exporter.writeToFile();
84       }
85  
86       public void exportReviewProtocolPDF(String filePath,
87               boolean showSignFields, boolean attachProdExtRefs,
88               boolean attachFindExtRefs) throws ExportException, DataException {
89           ProtocolPDFExporter exporter = new ReviewProtocolPDFExporter(filePath,
90                   showSignFields, attachProdExtRefs, attachFindExtRefs);
91  
92           exporter.writeToFile();
93       }
94  
95       public void exportMeetingFindingsCSV(String filePath,
96               AppCSVProfile csvProfile, Meeting meeting,
97               Map<String, String> severityMappings, String reporter)
98               throws ExportException, ApplicationException {
99           if (meeting.getProtocol() != null) {
100               CSVExporter exporter = new FindingsCSVExporter(csvProfile,
101                       severityMappings, meeting.getProtocol().getFindings(),
102                       reporter);
103  
104               exporter.writeToFile(filePath);
105           } else {
106               throw new ApplicationException(Data.getInstance().getLocaleStr(
107                       "message.csvNoFindingsExist"));
108           }
109       }
110  
111       public void exportReviewFindingsCSV(String filePath,
112               AppCSVProfile csvProfile, Map<String, String> severityMappings,
113               String reporter) throws ExportException, ApplicationException {
114           List<Finding> findings = new ArrayList<Finding>();
115  
116           for (Meeting m : Data.getInstance().getResiData().getReview()
117                   .getMeetings()) {
118               if (m.getProtocol() != null) {
119                   findings.addAll(m.getProtocol().getFindings());
120               }
121           }
122  
123           if (findings.size() > 0) {
124               CSVExporter exporter = new FindingsCSVExporter(csvProfile,
125                       severityMappings, findings, reporter);
126  
127               exporter.writeToFile(filePath);
128           } else {
129               throw new ApplicationException(Data.getInstance().getLocaleStr(
130                       "message.csvNoFindingsExist"));
131           }
132       }
133  
134       public void exportInvitations(String dirPath, InvitationType type,
135               Meeting meeting, Attendee attendee, boolean attachProdExtRefs)
136               throws ExportException, DataException {
137           List<Attendee> attendees = new ArrayList<Attendee>();
138           attendees.add(attendee);
139  
140           exportInvitations(dirPath, type, meeting, attendees, attachProdExtRefs);
141       }
142  
143       public void exportInvitations(String dirPath, InvitationType type,
144               Meeting meeting, List<Attendee> attendees, boolean attachProdExtRefs)
145               throws ExportException, DataException {
146           DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
147  
148           File directory = new File(dirPath);
149           FileTools.deleteDirectory(directory);
150           directory.mkdir();
151           
152           String invitationPackName;
153           String invitationPackPath;
154  
155           for (Attendee att : attendees) {
156               invitationPackName = Data.getInstance().getLocaleStr(
157                       "export.invitationPackPrefix")
158                       + " "
159                       + sdf.format(new Date().getTime())
160                       + " "
161                       + att.getName()
162                       + " ("
163                       + Data.getInstance().getLocaleStr(
164                               "role." + att.getRole().toString().toLowerCase())
165                       + ")";
166  
167               switch (type) {
168               case PDF:
169                   invitationPackPath = new File(dirPath, invitationPackName
170                           + ".pdf").getAbsolutePath();
171  
172                   InvitationPDFExporter pdfExporter = new InvitationPDFExporter(
173                           invitationPackPath, meeting, att, attachProdExtRefs);
174  
175                   pdfExporter.writeToFile();
176                   break;
177  
178               case ZIP:
179                   invitationPackPath = new File(dirPath, invitationPackName
180                           + ".zip").getAbsolutePath();
181  
182                   InvitationZIPExporter zipExporter = new InvitationZIPExporter(
183                           invitationPackPath, meeting, att, attachProdExtRefs);
184  
185                   zipExporter.writeToFile();
186                   break;
187  
188               case DIRECTORY:
189                   invitationPackPath = new File(dirPath, invitationPackName)
190                           .getAbsolutePath();
191  
192                   InvitationDirExporter dirExporter = new InvitationDirExporter(
193                           invitationPackPath, meeting, att, attachProdExtRefs);
194  
195                   dirExporter.writeDir();
196                   break;
197  
198               default:
199                   break;
200               }
201           }
202       }
203  
204   }
FindingManagement.java
21   public class FindingManagement {
22  
23       private ResiData resiData = Data.getInstance().getResiData();
24  
25       private final String EXTREF_DIRECTORY = Data.getInstance().getAppData()
26               .getAppDataPath()
27               + Data.getInstance().getResource("extRefsDirectoryName");
28  
29       /**
30        *
31        * @param prot
32        * @return
33        */
34       private int getLastId() {
35           int lastId = 0;
36  
37           for (Meeting m : resiData.getReview().getMeetings()) {
38               Protocol prot = m.getProtocol();
39  
40               if (prot != null) {
41                   for (Finding f : prot.getFindings()) {
42                       if (f.getId() > lastId) {
43                           lastId = f.getId();
44                       }
45                   }
46               }
47           }
48  
49           return lastId;
50       }
51  
52       /**
53        * Refactor the ids of findings only if there are conflicts.
54        */
55       public void refactorIds() {
56           List<Integer> idList = new ArrayList<Integer>();
57  
58           for (Meeting m : resiData.getReview().getMeetings()) {
59               Protocol prot = m.getProtocol();
60  
61               if (prot != null) {
62                   for (Finding f : prot.getFindings()) {
63                       if (idList.contains(f.getId())) {
64                           f.setId(getLastId() + 1);
65  
66                           idList.add(f.getId());
67                       } else {
68                           idList.add(f.getId());
69                       }
70                   }
71               }
72           }
73  
74           resiData.fireDataChanged();
75       }
76  
77       /**
78        * Returns the list of findings of the given protocol
79        *
80        * @param prot
81        * @return list of findings
82        */
83       public List<Finding> getFindings(Protocol prot) {
84           return prot.getFindings();
85       }
86  
87       /**
88        * Returns the number of findings of the given protocol
89        *
90        * @param prot
91        * @return number of findings
92        */
93       public int getNumberOfFindings(Protocol prot) {
94           return prot.getFindings().size();
95       }
96  
97       /**
98        *
99        * @param description
100        * @param severity
101        * @param prot
102        * @return
103        */
104       public Finding addFinding(String description, String severity, Protocol prot) {
105           Finding finding = new Finding();
106  
107           finding.setDescription(description);
108           finding.setSeverity(severity);
109  
110           addFinding(finding, prot);
111  
112           return finding;
113       }
114  
115       /**
116        * Adds the finding to the given protocol
117        *
118        * @param find
119        * @param prot
120        */
121       public void addFinding(Finding find, Protocol prot) {
122           if (!prot.getFindings().contains(find)) {
123               find.setId(getLastId() + 1);
124  
125               prot.getFindings().add(find);
126  
127               resiData.fireDataChanged();
128           }
129       }
130  
131       /**
132        * Removes the finding from the given protocol
133        *
134        * @param find
135        * @param prot
136        */
137       public void removeFinding(Finding find, Protocol prot) {
138           prot.getFindings().remove(find);
139  
140           resiData.fireDataChanged();
141       }
142  
143       /**
144        * Replaces a finding in the given protocol by another one
145        *
146        * @param oldFind
147        * @param newFind
148        * @param prot
149        */
150       public void editFinding(Finding oldFind, Finding newFind, Protocol prot) {
151           if (prot.getFindings().contains(oldFind)) {
152               int id = oldFind.getId();
153               int index = prot.getFindings().indexOf(oldFind);
154  
155               prot.getFindings().remove(oldFind);
156  
157               newFind.setId(id);
158               prot.getFindings().add(index, newFind);
159  
160               resiData.fireDataChanged();
161           }
162       }
163  
164       /**
165        * Returns a list of references of the given finding
166        *
167        * @param find
168        * @return references
169        */
170       public List<String> getReferences(Finding find) {
171           return find.getReferences();
172       }
173  
174       /**
175        * Adds a reference to the list of references of the given finding
176        *
177        * @param ref
178        * @param find
179        */
180       public void addReference(String ref, Finding find) {
181           if (!find.getReferences().contains(ref)) {
182               find.getReferences().add(ref);
183  
184               resiData.fireDataChanged();
185           }
186       }
187  
188       /**
189        * Removes a reference from the list of references of the given finding
190        *
191        * @param ref
192        * @param find
193        */
194       public void removeReference(String ref, Finding find) {
195           find.getReferences().remove(ref);
196  
197           resiData.fireDataChanged();
198       }
199  
200       /**
201        * Returns a list of external references of the given finding
202        *
203        * @param find
204        * @return list of files
205        */
206       public List<File> getExtReferences(Finding find) {
207           ReviewManagement revMgmt = Application.getInstance().getReviewMgmt();
208  
209           List<File> list = new ArrayList<File>();
210  
211           for (String ref : find.getExternalReferences()) {
212               File extRefFile = new File(EXTREF_DIRECTORY
213                       + revMgmt.getExtRefFileName(ref));
214  
215               list.add(extRefFile);
216           }
217  
218           return list;
219       }
220  
221       /**
222        * Adds a external reference by its file name to the list of references of
223        * the given finding
224        *
225        * @param fileName
226        * @param find
227        * @return true if adding the external reference was succesful; otherwise
228        *         false
229        */
230       public boolean addExtReference(File file, Finding find) {
231           ReviewManagement revMgmt = Application.getInstance().getReviewMgmt();
232  
233           String extRefFile = revMgmt.addExtRefFile(file);
234  
235           if (extRefFile != null) {
236               find.getExternalReferences().add(extRefFile);
237  
238               resiData.fireDataChanged();
239  
240               return true;
241           } else {
242               /*
243                * Not part of unit testing because false is only returned if an
244                * internal error occured while adding the external reference.
245                */
246               return false;
247           }
248       }
249  
250       /**
251        * Removes an external reference by its file name from the list of
252        * references of the given finding
253        *
254        * @param fileName
255        * @param find
256        */
257       public void removeExtReference(File file, Finding find) {
258           ReviewManagement revMgmt = Application.getInstance().getReviewMgmt();
259  
260           String extRef = revMgmt.getExtRefURI(file.getName());
261  
262           file.delete();
263  
264           find.getExternalReferences().remove(extRef);
265  
266           resiData.fireDataChanged();
267       }
268  
269       /**
270        * Returns the list of aspects of the given finding
271        *
272        * @param find
273        * @return aspects
274        */
275       public List<String> getAspects(Finding find) {
276           return find.getAspects();
277       }
278  
279       /**
280        * Adds an aspect to the given finding
281        *
282        * @param asp
283        * @param find
284        */
285       public void addAspect(Aspect asp, Finding find) {
286           if (!find.getAspects().contains(asp.getDirective())) {
287               find.getAspects().add(
288                       asp.getDirective() + " (" + asp.getCategory() + ")");
289  
290               resiData.fireDataChanged();
291           }
292       }
293  
294       /**
295        *
296        * @param asp
297        * @param find
298        */
299       public void removeAspect(String asp, Finding find) {
300           find.getAspects().remove(asp);
301  
302           resiData.fireDataChanged();
303       }
304  
305       /**
306        *
307        * @param find
308        * @param prot
309        */
310       public void pushUpFinding(Finding find, Protocol prot) {
311           if (!isTopFinding(find, prot)) {
312               int index = prot.getFindings().indexOf(find);
313  
314               prot.getFindings().remove(index);
315               prot.getFindings().add(index - 1, find);
316  
317               resiData.fireDataChanged();
318           }
319       }
320  
321       /**
322        *
323        * @param find
324        * @param prot
325        */
326       public void pushDownFinding(Finding find, Protocol prot) {
327           if (!isBottomFinding(find, prot)) {
328               int index = prot.getFindings().indexOf(find);
329  
330               prot.getFindings().remove(index);
331               prot.getFindings().add(index + 1, find);
332  
333               resiData.fireDataChanged();
334           }
335       }
336  
337       /**
338        *
339        * @param find
340        * @param prot
341        */
342       public void pushTopFinding(Finding find, Protocol prot) {
343           if (!isTopFinding(find, prot)) {
344               int index = prot.getFindings().indexOf(find);
345  
346               prot.getFindings().remove(index);
347               prot.getFindings().add(0, find);
348  
349               resiData.fireDataChanged();
350           }
351       }
352  
353       /**
354        *
355        * @param find
356        * @param prot
357        */
358       public void pushBottomFinding(Finding find, Protocol prot) {
359           if (!isTopFinding(find, prot)) {
360               int index = prot.getFindings().indexOf(find);
361  
362               prot.getFindings().remove(index);
363               prot.getFindings().add(prot.getFindings().size(), find);
364  
365               resiData.fireDataChanged();
366           }
367       }
368  
369       /**
370        *
371        * @param find
372        * @param prot
373        * @return
374        */
375       public boolean isTopFinding(Finding find, Protocol prot) {
376           int index = prot.getFindings().indexOf(find);
377  
378           if (index == 0) {
379               return true;
380           } else {
381               return false;
382           }
383       }
384  
385       /**
386        *
387        * @param find
388        * @param prot
389        * @return
390        */
391       public boolean isBottomFinding(Finding find, Protocol prot) {
392           int index = prot.getFindings().indexOf(find);
393  
394           if (index == prot.getFindings().size() - 1) {
395               return true;
396           } else {
397               return false;
398           }
399       }
400  
401   }
AttendeeManagement.java
30   public class AttendeeManagement {
31  
32       private ResiData resiData = Data.getInstance().getResiData();
33  
34       /**
35        *
36        * @return
37        */
38       private int getLastId() {
39           int lastId = 0;
40  
41           for (Attendee a : resiData.getReview().getAttendees()) {
42               if (Integer.parseInt(a.getId()) > lastId) {
43                   lastId = Integer.parseInt(a.getId());
44               }
45           }
46  
47           return lastId;
48       }
49  
50       /**
51        *
52        * @param id
53        * @return
54        */
55       private boolean isId(String id) {
56           for (Attendee a : resiData.getReview().getAttendees()) {
57               if (a.getId().equals(id)) {
58                   return true;
59               }
60           }
61  
62           return false;
63       }
64  
65       /**
66        *
67        * @param att
68        * @param newId
69        * @return
70        */
71       private boolean renameId(Attendee att, String newId) {
72           if (isId(newId)) {
73               /*
74                * The following line of code depends on a random event, so it is
75                * not part of unit testing.
76                */
77               return false;
78           } else {
79               /*
80                * Rename attendee references
81                */
82               for (Meeting m : resiData.getReview().getMeetings()) {
83                   Protocol prot = m.getProtocol();
84  
85                   if (prot != null) {
86                       for (AttendeeReference ar : prot.getAttendeeReferences()) {
87                           if (ar.getAttendee().equals(att.getId())) {
88                               ar.setAttendee(newId);
89                           }
90                       }
91                   }
92               }
93  
94               /*
95                * Rename attendee id
96                */
97               att.setId(newId);
98  
99               return true;
100           }
101       }
102  
103       /**
104        *
105        */
106       public void refactorIds() {
107           /*
108            * Remove duplicate references
109            */
110           for (Meeting m : resiData.getReview().getMeetings()) {
111               List<String> idList = new ArrayList<String>();
112               Protocol prot = m.getProtocol();
113  
114               if (prot != null) {
115                   int i = 0;
116  
117                   while (prot.getAttendeeReferences().size() > i) {
118                       AttendeeReference ar = prot.getAttendeeReferences().get(i);
119  
120                       i++;
121  
122                       if (idList.contains(ar.getAttendee())) {
123                           prot.getAttendeeReferences().remove(ar);
124                           i--;
125                       } else {
126                           idList.add(ar.getAttendee());
127                       }
128                   }
129               }
130           }
131  
132           /*
133            * Remove wrong references
134            */
135           for (Meeting m : resiData.getReview().getMeetings()) {
136               Protocol prot = m.getProtocol();
137  
138               if (prot != null) {
139                   int i = 0;
140  
141                   while (prot.getAttendeeReferences().size() > i) {
142                       AttendeeReference ar = prot.getAttendeeReferences().get(i);
143  
144                       i++;
145  
146                       if (!isId(ar.getAttendee())) {
147                           prot.getAttendeeReferences().remove(ar);
148                           i--;
149                       }
150                   }
151               }
152           }
153  
154           /*
155            * Rename all current ids so that there aren't any number ids
156            */
157           for (Attendee a : resiData.getReview().getAttendees()) {
158               String newId = a.getId() + AppTools.getRandomString();
159  
160               /*
161                * The following three lines of code depend on a random event, so
162                * they are not part of unit testing.
163                */
164               while (!renameId(a, newId)) {
165                   newId += AppTools.getRandomString();
166               }
167           }
168  
169           /*
170            * Give attendees new systematic ids (numbers only)
171            */
172           int id = 1;
173  
174           for (Attendee a : resiData.getReview().getAttendees()) {
175               renameId(a, Integer.toString(id));
176  
177               id++;
178           }
179  
180           resiData.fireDataChanged();
181       }
182  
183       /**
184        *
185        */
186       public void updateAttendeesDictionary() {
187           ApplicationData appData = Data.getInstance().getAppData();
188  
189           for (Attendee att : getAttendees()) {
190               try {
191                   AppAttendee appAtt = appData.newAttendee(att.getName(), att
192                           .getContact());
193  
194                   if (att.getAspects() != null) {
195                       for (String str : appAtt.getStrengths()) {
196                           appAtt.removeStrength(str);
197                       }
198  
199                       for (Aspect asp : getAspects(att)) {
200                           appAtt.addStrength(asp.getCategory());
201                       }
202                   }
203               } catch (DataException e) {
204                   /*
205                    * do nothing and continue with the next attendee.
206                    */
207               }
208           }
209       }
210  
211       /**
212        * Returns the list of attendees of the review
213        *
214        * @return attendees of the review
215        */
216       public List<Attendee> getAttendees() {
217           return resiData.getReview().getAttendees();
218       }
219  
220       /**
221        * Returns an attendees of the review by using his ID
222        *
223        * @param id
224        *            of the attendee
225        * @return attendee of the review
226        */
227       public Attendee getAttendee(int id) {
228           Attendee att = null;
229  
230           for (Attendee a : resiData.getReview().getAttendees()) {
231               if (a.getId().equals(Integer.toString(id))) {
232                   att = a;
233               }
234           }
235  
236           return att;
237       }
238  
239       /**
240        * Returns the number of attendees of the review
241        *
242        * @return number of the review
243        */
244       public int getNumberOfAttendees() {
245           return resiData.getReview().getAttendees().size();
246       }
247  
248       /**
249        *
250        * @param asp
251        * @return
252        */
253       public boolean isAttendee(Attendee att) {
254           AttendeeComparator comp = new AttendeeComparator();
255  
256           for (Attendee a : getAttendees()) {
257               if (comp.compare(att, a) == 0) {
258                   return true;
259               }
260           }
261  
262           return false;
263       }
264  
265       /**
266        *
267        * @param name
268        * @param contact
269        * @param role
270        * @param aspects
271        * @return
272        */
273       public Attendee addAttendee(String name, String contact, Role role,
274               List<Aspect> aspects) {
275           Attendee attendee = new Attendee();
276  
277           attendee.setName(name);
278           attendee.setContact(contact);
279           attendee.setRole(role);
280  
281           if (aspects != null) {
282               AspectsIds aspIds = new AspectsIds();
283  
284               for (Aspect a : aspects) {
285                   aspIds.getAspectIds().add(a.getId());
286               }
287  
288               attendee.setAspects(aspIds);
289           }
290  
291           return addAttendee(attendee);
292       }
293  
294       /**
295        *
296        * @param appAtt
297        * @param role
298        * @param aspects
299        * @return
300        */
301       public Attendee addAttendee(AppAttendee appAtt, Role role,
302               List<Aspect> aspects) {
303           String contact;
304           try {
305               contact = appAtt.getContact();
306           } catch (DataException e) {
307               /*
308                * The following statement is not part of unit testing because it is
309                * only reached when an internal error occurs.
310                */
311               contact = "";
312           }
313  
314           return addAttendee(appAtt.getName(), contact, role, aspects);
315       }
316  
317       /**
318        * Adds attendee to the review
319        *
320        * @param attendee
321        *            which should be added to the review
322        */
323       public Attendee addAttendee(Attendee att) {
324           Attendee attendee = null;
325  
326           if (!getAttendees().contains(att) && !isAttendee(att)) {
327               att.setId(Integer.toString((getLastId() + 1)));
328  
329               getAttendees().add(att);
330  
331               Collections.sort(resiData.getReview().getAttendees(),
332                       new AttendeeComparator());
333  
334               resiData.fireDataChanged();
335  
336               attendee = att;
337           }
338  
339           return attendee;
340       }
341  
342       /**
343        *
344        * @param att
345        * @return
346        */
347       public boolean isAttendeeRemovable(Attendee att) {
348           if (getMeetings(att).size() == 0) {
349               return true;
350           } else {
351               return false;
352           }
353       }
354  
355       /**
356        * Removes the given attendee from the review
357        *
358        * @param att
359        *            attendee which should be removed from the review
360        */
361       public void removeAttendee(Attendee att) {
362           if (isAttendeeRemovable(att)) {
363               resiData.getReview().getAttendees().remove(att);
364  
365               resiData.fireDataChanged();
366           }
367       }
368  
369       /**
370        * Edits an attendee of the review
371        *
372        * @param oldAttendee
373        * @param newAttendee
374        */
375       public boolean editAttendee(Attendee oldAtt, Attendee newAtt) {
376           if (resiData.getReview().getAttendees().contains(oldAtt)
377                   && !isAttendee(newAtt)) {
378               String id = oldAtt.getId();
379               int index = resiData.getReview().getAttendees().indexOf(oldAtt);
380  
381               resiData.getReview().getAttendees().remove(oldAtt);
382  
383               newAtt.setId(id);
384               resiData.getReview().getAttendees().add(index, newAtt);
385  
386               resiData.fireDataChanged();
387  
388               return true;
389           }
390  
391           return false;
392       }
393  
394       /**
395        *
396        * @param att
397        * @return meetings of the attendee
398        */
399       public List<Meeting> getMeetings(Attendee att) {
400           List<Meeting> meetingList = new ArrayList<Meeting>();
401  
402           for (Meeting m : resiData.getReview().getMeetings()) {
403               Protocol prot = m.getProtocol();
404  
405               if (prot != null) {
406                   for (AttendeeReference ar : prot.getAttendeeReferences()) {
407                       if (ar.getAttendee().equals(att.getId())
408                               && !meetingList.contains(m)) {
409                           meetingList.add(m);
410                       }
411                   }
412               }
413           }
414  
415           return meetingList;
416       }
417  
418       /**
419        * Returns the list of aspects of the attendee
420        *
421        * @param attendee
422        * @return aspects of the attendee
423        */
424       public List<Aspect> getAspects(Attendee att) {
425           List<Aspect> aspectList = new ArrayList<Aspect>();
426  
427           for (Attendee a : resiData.getReview().getAttendees()) {
428               if (a == att && a.getAspects() != null) {
429                   for (String aspId : a.getAspects().getAspectIds()) {
430                       if (Application.getInstance().getAspectMgmt().getAspect(
431                               aspId) != null) {
432                           aspectList.add(Application.getInstance()
433                                   .getAspectMgmt().getAspect(aspId));
434                       }
435                   }
436               }
437           }
438  
439           return aspectList;
440       }
441  
442       /**
443        *
444        * @param asp
445        * @param att
446        * @return
447        */
448       public boolean hasAspect(Aspect asp, Attendee att) {
449           if (asp.getId() != null && getAspects(att).contains(asp)) {
450               return true;
451           } else {
452               return false;
453           }
454       }
455  
456       /**
457        * Adds aspect to the attendees list of aspects
458        *
459        * @param aspect
460        * @param attendee
461        *
462        */
463       public void addAspect(Aspect asp, Attendee att) {
464           AspectComparator comp = new AspectComparator();
465           AspectManagement aspMgmt = Application.getInstance().getAspectMgmt();
466           Aspect aspect = asp;
467  
468           /*
469            * If the aspect is not part of the review
470            */
471           if (!aspMgmt.isAspect(asp)) {
472               aspect = aspMgmt.addAspect(asp);
473           }
474  
475           /*
476            * If the aspect was a duplicate to an aspect which already is part of
477            * the review
478            */
479           if (aspect.getId() == null) {
480               for (Aspect a : aspMgmt.getAspects()) {
481                   if (comp.compare(aspect, a) == 0) {
482                       aspect = a;
483                   }
484               }
485           }
486  
487           if (att.getAspects() == null) {
488               att.setAspects(new AspectsIds());
489           }
490  
491           if (!att.getAspects().getAspectIds().contains(aspect.getId())) {
492               att.getAspects().getAspectIds().add(aspect.getId());
493  
494               resiData.fireDataChanged();
495           }
496       }
497  
498       /**
499        * Removes aspect to the attendees list of aspects
500        *
501        * @param aspect
502        * @param attendee
503        *
504        */
505       public void removeAspect(Aspect asp, Attendee att) {
506           if (att.getAspects() != null) {
507               att.getAspects().getAspectIds().remove(asp.getId());
508  
509               if (att.getAspects().getAspectIds().isEmpty()) {
510                   att.setAspects(null);
511               }
512  
513               resiData.fireDataChanged();
514           }
515       }
516  
517       /**
518        * Returns the number of aspects that are assigned to the attendee
519        *
520        * @param aspect
521        * @param attendee
522        *
523        */
524       public int getNumberOfAspects(Attendee att) {
525           if (att.getAspects() != null) {
526               return att.getAspects().getAspectIds().size();
527           } else {
528               return 0;
529           }
530       }
531  
532       /**
533        * Pushs up a aspect in the list of severities of the current review
534        *
535        * @param sev
536        */
537       public void pushUpAspect(Attendee att, Aspect asp) {
538           if (!isTopAspect(att, asp)) {
539               int index = getAspects(att).indexOf(asp);
540  
541               att.getAspects().getAspectIds().remove(index);
542               att.getAspects().getAspectIds().add(index - 1, asp.getId());
543  
544               resiData.fireDataChanged();
545           }
546       }
547  
548       /**
549        * Pushs down a Aspect in the list of Aspects of the current review
550        *
551        * @param asp
552        */
553       public void pushDownAspect(Attendee att, Aspect asp) {
554           if (!isBottomAspect(att, asp)) {
555               int index = getAspects(att).indexOf(asp);
556  
557               att.getAspects().getAspectIds().remove(index);
558               att.getAspects().getAspectIds().add(index + 1, asp.getId());
559  
560               resiData.fireDataChanged();
561           }
562       }
563  
564       /**
565        * Pushs up a Aspect to the top of the list of Aspects of the current review
566        *
567        * @param asp
568        */
569       public void pushTopAspect(Attendee att, Aspect asp) {
570           if (!isTopAspect(att, asp)) {
571               int index = getAspects(att).indexOf(asp);
572  
573               att.getAspects().getAspectIds().remove(index);
574               att.getAspects().getAspectIds().add(0, asp.getId());
575  
576               resiData.fireDataChanged();
577           }
578       }
579  
580       /**
581        * Pushs up a Aspect to the bottom of the list of Aspects of the current
582        * review
583        *
584        * @param asp
585        */
586       public void pushBottomAspect(Attendee att, Aspect asp) {
587           if (!isBottomAspect(att, asp)) {
588               int index = getAspects(att).indexOf(asp);
589  
590               att.getAspects().getAspectIds().remove(index);
591               att.getAspects().getAspectIds().add(getAspects(att).size(),
592                       asp.getId());
593  
594               resiData.fireDataChanged();
595           }
596       }
597  
598       /**
599        * Returns a true if the Aspect is the element at the top of the list;
600        * otherwise false
601        *
602        * @param asp
603        * @return
604        */
605       public boolean isTopAspect(Attendee att, Aspect asp) {
606           int index = getAspects(att).indexOf(asp);
607  
608           if (index == 0) {
609               return true;
610           } else {
611               return false;
612           }
613       }
614  
615       /**
616        * Returns a true if the Aspect is the element at the bottom of the list;
617        * otherwise false
618        *
619        * @param asp
620        * @return
621        */
622       public boolean isBottomAspect(Attendee att, Aspect asp) {
623           int index = getAspects(att).indexOf(asp);
624  
625           if (index == getAspects(att).size() - 1) {
626               return true;
627           } else {
628               return false;
629           }
630       }
631  
632       /**
633        *
634        * @param asp
635        * @return
636        */
637       public List<Attendee> getAttendeesWithAspect(Aspect asp) {
638           List<Attendee> attList = new ArrayList<Attendee>();
639  
640           for (Attendee att : getAttendees()) {
641               if (att.getAspects() != null
642                       && att.getAspects().getAspectIds().contains(asp.getId())) {
643                   attList.add(att);
644               }
645           }
646  
647           return attList;
648       }
649   }
AspectManagement.java
20   public class AspectManagement {
21  
22       private ResiData resiData = Data.getInstance().getResiData();
23  
24       /**
25        *
26        * @return
27        */
28       private int getLastId() {
29           int lastId = 0;
30  
31           for (Aspect a : resiData.getReview().getAspects()) {
32               if (Integer.parseInt(a.getId()) > lastId) {
33                   lastId = Integer.parseInt(a.getId());
34               }
35           }
36  
37           return lastId;
38       }
39  
40       /**
41        *
42        * @param id
43        * @return
44        */
45       private boolean isId(String id) {
46           for (Aspect a : resiData.getReview().getAspects()) {
47               if (a.getId().equals(id)) {
48                   return true;
49               }
50           }
51  
52           return false;
53       }
54  
55       /**
56        *
57        * @param asp
58        * @param newId
59        * @return
60        */
61       private boolean renameId(Aspect asp, String newId) {
62           if (isId(newId)) {
63               /*
64                * The following line of code depends on a random event, so it is
65                * not part of unit testing.
66                */
67               return false;
68           } else {
69               /*
70                * Rename aspect references
71                */
72               for (Attendee att : resiData.getReview().getAttendees()) {
73                   int index = -1;
74  
75                   if (att.getAspects() != null) {
76                       index = att.getAspects().getAspectIds()
77                               .indexOf(asp.getId());
78                   }
79  
80                   if (index != -1) {
81                       att.getAspects().getAspectIds().remove(index);
82                       att.getAspects().getAspectIds().add(index, newId);
83                   }
84               }
85  
86               /*
87                * Rename aspect id
88                */
89               asp.setId(newId);
90  
91               return true;
92           }
93       }
94  
95       /**
96        *
97        */
98       public void refactorIds() {
99           /*
100            * Remove duplicate references
101            */
102           for (Attendee a : resiData.getReview().getAttendees()) {
103               List<String> idList = new ArrayList<String>();
104  
105               int i = 0;
106  
107               if (a.getAspects() != null) {
108                   while (a.getAspects().getAspectIds().size() > i) {
109                       String aspId = a.getAspects().getAspectIds().get(i);
110  
111                       i++;
112  
113                       if (idList.contains(aspId)) {
114                           a.getAspects().getAspectIds().remove(aspId);
115                           i--;
116                       } else {
117                           idList.add(aspId);
118                       }
119                   }
120               }
121           }
122  
123           /*
124            * Remove wrong references
125            */
126           for (Attendee a : resiData.getReview().getAttendees()) {
127               int i = 0;
128  
129               if (a.getAspects() != null) {
130                   while (a.getAspects().getAspectIds().size() > i) {
131                       String aspId = a.getAspects().getAspectIds().get(i);
132  
133                       i++;
134  
135                       if (!isId(aspId)) {
136                           a.getAspects().getAspectIds().remove(aspId);
137                           i--;
138                       }
139                   }
140               }
141           }
142  
143           /*
144            * Rename all current ids so that there aren't any number ids
145            */
146           for (Aspect a : resiData.getReview().getAspects()) {
147               String newId = a.getId() + AppTools.getRandomString();
148  
149               /*
150                * The following three lines of code depend on a random event, so
151                * they are not part of unit testing.
152                */
153               while (!renameId(a, newId)) {
154                   newId += AppTools.getRandomString();
155               }
156           }
157  
158           /*
159            * Give attendees new systematic ids (numbers only)
160            */
161           int id = 1;
162  
163           for (Aspect a : resiData.getReview().getAspects()) {
164               renameId(a, Integer.toString(id));
165  
166               id++;
167           }
168  
169           resiData.fireDataChanged();
170       }
171  
172       /**
173        * Returns a list of aspects of the current review
174        *
175        * @return aspects
176        */
177       public List<Aspect> getAspects() {
178           return resiData.getReview().getAspects();
179       }
180  
181       /**
182        * Returns an aspect by using its id
183        *
184        * @param id
185        * @return aspect
186        */
187       public Aspect getAspect(String id) {
188           Aspect asp = null;
189  
190           for (Aspect a : resiData.getReview().getAspects()) {
191               if (a.getId().equals(id)) {
192                   asp = a;
193               }
194           }
195  
196           return asp;
197       }
198  
199       /**
200        *
201        * @param id
202        * @return
203        */
204       public Aspect getAspect(int id) {
205           return getAspect(Integer.toString(id));
206       }
207  
208       /**
209        *
210        * @param asp
211        * @return
212        */
213       public boolean isAspect(Aspect asp) {
214           AspectComparator comp = new AspectComparator();
215  
216           for (Aspect a : getAspects()) {
217               if (comp.compare(asp, a) == 0) {
218                   return true;
219               }
220           }
221  
222           return false;
223       }
224  
225       /**
226        *
227        * @param directive
228        * @param description
229        * @param category
230        * @return
231        */
232       public Aspect addAspect(String directive, String description,
233               String category) {
234           Aspect aspect = new Aspect();
235  
236           aspect.setDirective(directive);
237           aspect.setDescription(description);
238           aspect.setCategory(category);
239  
240           addAspect(aspect);
241  
242           return aspect;
243       }
244  
245       /**
246        * Adds an aspect to the list of aspects of the current review
247        *
248        * @param sev
249        */
250       public Aspect addAspect(Aspect asp) {
251           Aspect aspect = null;
252  
253           if (!resiData.getReview().getAspects().contains(asp) && !isAspect(asp)) {
254               asp.setId(Integer.toString(getLastId() + 1));
255  
256               resiData.getReview().getAspects().add(asp);
257  
258               resiData.fireDataChanged();
259  
260               aspect = asp;
261           }
262  
263           return aspect;
264       }
265  
266       /**
267        * Removes an aspect form the list of aspects of the current review
268        *
269        * @param asp
270        */
271       public void removeAspect(Aspect asp) {
272           AttendeeManagement attMgmt = Application.getInstance()
273                   .getAttendeeMgmt();
274  
275           if (asp.getId() != null) {
276               for (Attendee att : attMgmt.getAttendees()) {
277                   if (attMgmt.hasAspect(asp, att)) {
278                       attMgmt.removeAspect(asp, att);
279                   }
280               }
281  
282               resiData.getReview().getAspects().remove(asp);
283  
284               resiData.fireDataChanged();
285           }
286       }
287  
288       /**
289        * Replaces an aspect from the list of aspects of the current review by
290        * another one
291        *
292        * @param oldAsp
293        * @param newAsp
294        */
295       public boolean editAspect(Aspect oldAsp, Aspect newAsp) {
296           if (resiData.getReview().getAspects().contains(oldAsp)
297                   && !isAspect(newAsp)) {
298               String id = oldAsp.getId();
299               int index = resiData.getReview().getAspects().indexOf(oldAsp);
300  
301               resiData.getReview().getAspects().remove(oldAsp);
302  
303               newAsp.setId(id);
304               resiData.getReview().getAspects().add(index, newAsp);
305  
306               resiData.fireDataChanged();
307  
308               return true;
309           }
310  
311           return false;
312       }
313  
314       /**
315        * Pushs up an aspect in the list of aspects of the current review
316        *
317        * @param asp
318        */
319       public void pushUpAspect(Aspect asp) {
320           if (!isTopAspect(asp)) {
321               int index = resiData.getReview().getAspects().indexOf(asp);
322  
323               resiData.getReview().getAspects().remove(asp);
324               resiData.getReview().getAspects().add(index - 1, asp);
325  
326               resiData.fireDataChanged();
327           }
328       }
329  
330       /**
331        * Pushs down an aspect in the list of aspects of the current review
332        *
333        * @param sev
334        */
335       public void pushDownAspect(Aspect asp) {
336           if (!isBottomAspect(asp)) {
337               int index = resiData.getReview().getAspects().indexOf(asp);
338  
339               resiData.getReview().getAspects().remove(index);
340               resiData.getReview().getAspects().add(index + 1, asp);
341  
342               resiData.fireDataChanged();
343           }
344       }
345  
346       /**
347        * Pushs up an aspect to the top of the list of aspects of the current
348        * review
349        *
350        * @param sev
351        */
352       public void pushTopAspect(Aspect asp) {
353           if (!isTopAspect(asp)) {
354               int index = resiData.getReview().getAspects().indexOf(asp);
355  
356               resiData.getReview().getAspects().remove(index);
357               resiData.getReview().getAspects().add(0, asp);
358  
359               resiData.fireDataChanged();
360           }
361       }
362  
363       /**
364        * Pushs up an aspect to the bottom of the list of aspects of the current
365        * review
366        *
367        * @param sev
368        */
369       public void pushBottomAspect(Aspect asp) {
370           if (!isBottomAspect(asp)) {
371               int index = resiData.getReview().getAspects().indexOf(asp);
372  
373               resiData.getReview().getAspects().remove(index);
374               resiData.getReview().getAspects().add(
375                       resiData.getReview().getAspects().size(), asp);
376  
377               resiData.fireDataChanged();
378           }
379       }
380  
381       /**
382        * Returns an boolean whether the aspect is the element at the top of the
383        * list or not
384        *
385        * @param sev
386        * @return
387        */
388       public boolean isTopAspect(Aspect asp) {
389           int index = resiData.getReview().getAspects().indexOf(asp);
390  
391           if (index == 0) {
392               return true;
393           } else {
394               return false;
395           }
396       }
397  
398       /**
399        * Returns an boolean whether the aspect is the element at the bottom of the
400        * list or not
401        *
402        * @param sev
403        * @return
404        */
405       public boolean isBottomAspect(Aspect asp) {
406           int index = resiData.getReview().getAspects().indexOf(asp);
407  
408           if (index == resiData.getReview().getAspects().size() - 1) {
409               return true;
410           } else {
411               return false;
412           }
413       }
414  
415   }
ApplicationException.java
28   @SuppressWarnings("serial")
29   public class ApplicationException extends Exception {
30  
31       public ApplicationException() {
32           super();
33       }
34  
35       public ApplicationException(String message) {
36           super(message);
37       }
38  
39   }
ApplicationControl.java
25   public class ApplicationControl {
26  
27       /**
28        * The IO provider to load and store data in Resi XML format.
29        */
30       private ResiIO io = ResiIOFactory.getInstance().getIOProvider();
31  
32       private static final File REVIEW_FILE = new File(Data.getInstance()
33               .getAppData().getAppDataPath()
34               + Data.getInstance().getResource("reviewFileName"));
35       private static final File REVIEW_BACKUP_FILE = new File(Data.getInstance()
36               .getAppData().getAppDataPath()
37               + Data.getInstance().getResource("revBakFileName"));
38       private static final File EXTREFS_DIRECTORY = new File(Data.getInstance()
39               .getAppData().getAppDataPath()
40               + Data.getInstance().getResource("extRefsDirectoryName"));
41  
42       private static final String ENDING_ZIP = "."
43               + Data.getInstance().getResource("fileEndingReviewZIP")
44                       .toLowerCase();
45  
46       /**
47        * Clear review data
48        */
49       public void clearReview() {
50           /*
51            * Clean up review data
52            */
53           if (REVIEW_FILE.exists()) {
54               REVIEW_FILE.delete();
55           }
56  
57           if (REVIEW_BACKUP_FILE.exists()) {
58               REVIEW_BACKUP_FILE.delete();
59           }
60  
61           if (EXTREFS_DIRECTORY.exists()) {
62               FileTools.deleteDirectory(EXTREFS_DIRECTORY);
63           }
64  
65           Data.getInstance().getResiData().clearReview();
66           Data.getInstance().getResiData().setReview(new Review());
67  
68           EXTREFS_DIRECTORY.mkdir();
69  
70           /*
71            * Set standard severities
72            */
73           Data.getInstance().getResiData().getReview().setSeverities(
74                   new Severities());
75  
76           for (String sev : Data.getInstance().getLocaleStr("standardSeverities")
77                   .split(",")) {
78               Data.getInstance().getResiData().getReview().getSeverities()
79                       .getSeverities().add(sev);
80           }
81  
82           /*
83            * Set empty product
84            */
85           Data.getInstance().getResiData().getReview().setProduct(new Product());
86           Data.getInstance().getResiData().getReview().getProduct().setName("");
87           Data.getInstance().getResiData().getReview().getProduct()
88                   .setVersion("");
89  
90           /*
91            * Set empty values
92            */
93           Data.getInstance().getResiData().getReview().setComments("");
94           Data.getInstance().getResiData().getReview().setRecommendation("");
95           Data.getInstance().getResiData().getReview().setImpression("");
96  
97           Data.getInstance().getResiData().fireDataChanged();
98       }
99  
100       /**
101        * Clears the old review and creates a new one.
102        */
103       public void newReview() {
104           clearReview();
105       }
106  
107       /**
108        *
109        * @param filePath
110        * @throws ResiIOException
111        * @throws IOException
112        * @throws ApplicationException
113        */
114       public void storeReview(String filePath) throws ResiIOException,
115               IOException, ApplicationException {
116           if (filePath.startsWith(Data.getInstance().getAppData()
117                   .getAppDataPath())) {
118               throw new ApplicationException(Data.getInstance().getLocaleStr(
119                       "message.loadStoreFileInAppDataDir"));
120           }
121  
122           if (filePath.toLowerCase().endsWith(ENDING_ZIP)) {
123               storeReviewAsZIP(filePath);
124           } else {
125               storeReviewAsXML(filePath);
126           }
127  
128           Data.getInstance().getResiData().setReviewPath(filePath);
129  
130           Data.getInstance().getResiData().fireDataChanged();
131       }
132  
133       /**
134        *
135        * @param filePath
136        * @throws ResiIOException
137        * @throws IOException
138        * @throws ApplicationException
139        */
140       public void loadReview(String filePath) throws ResiIOException,
141               IOException, ApplicationException {
142           if (filePath.startsWith(Data.getInstance().getAppData()
143                   .getAppDataPath())) {
144               throw new ApplicationException(Data.getInstance().getLocaleStr(
145                       "message.loadStoreFileInAppDataDir"));
146           }
147  
148           if (filePath.toLowerCase().endsWith(ENDING_ZIP)) {
149               loadReviewFromZIP(filePath);
150           } else {
151               loadReviewFromXML(filePath);
152           }
153  
154           Application.getInstance().getReviewMgmt().refactorReview();
155           
156           Application.getInstance().getAttendeeMgmt().updateAttendeesDictionary();
157  
158           Data.getInstance().getResiData().setReviewPath(filePath);
159  
160           Data.getInstance().getResiData().fireDataChanged();
161       }
162  
163       /**
164        *
165        * @param filePath
166        * @throws ResiIOException
167        */
168       private void storeReviewAsXML(String filePath) throws ResiIOException {
169           io.storeReview(filePath);
170       }
171  
172       /**
173        *
174        * @param filePath
175        * @throws ResiIOException
176        * @throws IOException
177        */
178       private void storeReviewAsZIP(String filePath) throws ResiIOException,
179               IOException {
180           io.storeReview(REVIEW_FILE.getPath());
181  
182           List<File> reviewFiles = FileTools.getListOfFiles(EXTREFS_DIRECTORY);
183  
184           reviewFiles.add(REVIEW_FILE);
185  
186           FileTools.writeToZip(reviewFiles, new File(filePath), true, false);
187       }
188  
189       /**
190        *
191        * @param filePath
192        * @throws ResiIOException
193        */
194       private void loadReviewFromXML(String filePath) throws ResiIOException {
195           clearReview();
196  
197           io.loadReview(filePath);
198       }
199  
200       /**
201        *
202        * @param filePath
203        * @throws ResiIOException
204        * @throws IOException
205        */
206       private void loadReviewFromZIP(String filePath) throws ResiIOException,
207               IOException {
208           clearReview();
209  
210           FileTools.extractZipFile(new File(filePath), EXTREFS_DIRECTORY, true);
211  
212           File tempReviewFile = new File(EXTREFS_DIRECTORY.getPath() + "/"
213                   + REVIEW_FILE.getName());
214  
215           FileTools.copyFile(tempReviewFile, REVIEW_FILE);
216  
217           tempReviewFile.delete();
218  
219           io.loadReview(REVIEW_FILE.getPath());
220       }
221  
222       /**
223        *
224        * @throws ResiIOException
225        * @throws DataException
226        */
227       public void backupReview() throws ResiIOException, DataException {
228           io.storeReviewBackup();
229  
230           Data.getInstance().getAppData().setSetting(AppSettingKey.APP_LAST_MODE,
231                   Data.getInstance().getMode());
232       }
233  
234       /**
235        *
236        * @throws ResiIOException
237        * @throws DataException
238        */
239       public void restoreReview() throws ResiIOException, DataException {
240           if (isReviewRestorable()) {
241               Data.getInstance().getResiData().clearReview();
242  
243               Data.getInstance().setMode(
244                       Data.getInstance().getAppData().getSetting(
245                               AppSettingKey.APP_LAST_MODE));
246  
247               io.loadReviewBackup();
248  
249               Application.getInstance().getReviewMgmt().refactorReview();
250  
251               Data.getInstance().getResiData().fireDataChanged();
252           }
253       }
254  
255       /**
256        *
257        * @return
258        */
259       public boolean isReviewRestorable() {
260           return REVIEW_BACKUP_FILE.exists();
261       }
262  
263   }
Application.java
27   public class Application {
28  
29       /**
30        * Holds an instance of this class.
31        */
32       private static Application instance = null;
33  
34       /**
35        * Provides access to an instance of this class.
36        *
37        * @return instance of this class
38        */
39       public static Application getInstance() {
40           if (instance == null) {
41               instance = new Application();
42           }
43  
44           return instance;
45       }
46  
47       private Application() {
48           super();
49  
50           /*
51            * Initialize instances of the management and control classes
52            */
53           applicationCtl = new ApplicationControl();
54           importExportCtl = new ImportExportControl();
55           aspectMgmt = new AspectManagement();
56           attendeeMgmt = new AttendeeManagement();
57           findingMgmt = new FindingManagement();
58           meetingMgmt = new MeetingManagement();
59           protocolMgmt = new ProtocolManagement();
60           reviewMgmt = new ReviewManagement();
61           severityMgmt = new SeverityManagement();
62       }
63  
64       /*
65        * Instances of the management and control classes
66        */
67       private ApplicationControl applicationCtl;
68  
69       private ImportExportControl importExportCtl;
70  
71       private AspectManagement aspectMgmt;
72  
73       private AttendeeManagement attendeeMgmt;
74  
75       private FindingManagement findingMgmt;
76  
77       private MeetingManagement meetingMgmt;
78  
79       private ProtocolManagement protocolMgmt;
80  
81       private ReviewManagement reviewMgmt;
82  
83       private SeverityManagement severityMgmt;
84  
85       /**
86        * Returns the instance of the ApplicationControl class
87        *
88        * @return instance of the ApplicationControl class
89        */
90       public ApplicationControl getApplicationCtl() {
91           return applicationCtl;
92       }
93  
94       /**
95        * Returns the instance of the ImportExportControl class
96        *
97        * @return instance of the ImportExportControl class
98        */
99       public ImportExportControl getImportExportCtl() {
100           return importExportCtl;
101       }
102  
103       /**
104        * Returns the instance of the AspectManagement class
105        *
106        * @return instance of the AspectManagement class
107        */
108       public AspectManagement getAspectMgmt() {
109           return aspectMgmt;
110       }
111  
112       /**
113        * Returns the instance of the AttendeeManagement class
114        *
115        * @return instance of the AttendeeManagement class
116        */
117       public AttendeeManagement getAttendeeMgmt() {
118           return attendeeMgmt;
119       }
120  
121       /**
122        * Returns the instance of the FindingManagement class
123        *
124        * @return instance of the FindingManagement class
125        */
126       public FindingManagement getFindingMgmt() {
127           return findingMgmt;
128       }
129  
130       /**
131        * Returns the instance of the MeetingManagement class
132        *
133        * @return instance of the MeetingManagement class
134        */
135       public MeetingManagement getMeetingMgmt() {
136           return meetingMgmt;
137       }
138  
139       /**
140        * Returns the instance of the ProtocolManagement class
141        *
142        * @return instance of the ProtocolManagement class
143        */
144       public ProtocolManagement getProtocolMgmt() {
145           return protocolMgmt;
146       }
147  
148       /**
149        * Returns the instance of the ReviewManagement class
150        *
151        * @return instance of the ReviewManagement class
152        */
153       public ReviewManagement getReviewMgmt() {
154           return reviewMgmt;
155       }
156  
157       /**
158        * Returns the instance of the SeverityManagement class
159        *
160        * @return instance of the SeverityManagement class
161        */
162       public SeverityManagement getSeverityMgmt() {
163           return severityMgmt;
164       }
165  
166   }
Main.java
35   public class Main {
36  
37       /*
38        * The main method is not part of unit testing because it belongs to the
39        * system test.
40        */
41       public static void main(String[] args) {
42           /*
43            * Set the standard file encoding
44            */
45           System.setProperty("file.encoding", "UTF-8");
46  
47           /*
48            * Set custom path for storing the application data if given.
49            */
50           if (args.length >= 2) {
51               if (args[0].trim().equals("-data")) {
52                   Data.getInstance().getAppData().setCustomAppDataDirectory(
53                           args[1].trim());
54               }
55           }
56  
57           /*
58            * Initialize application data and start the main UI in the thread that
59            * runs the event loop.
60            */
61           try {
62               /*
63                * Run the user interface
64                */
65               Data.getInstance().getAppData().initialize();
66  
67               Runnable ui = new Runnable() {
68                   @Override
69                   public void run() {
70                       UI.getInstance().run();
71                   }
72               };
73  
74               SwingUtilities.invokeLater(ui);
75  
76               /*
77                * Run a thread to do automatic backups in background
78                */
79               Runnable autoBackup = new Runnable() {
80                   @Override
81                   public void run() {
82                       new AutoBackupWorker().execute();
83                   }
84               };
85  
86               SwingUtilities.invokeLater(autoBackup);
87           } catch (Exception e) {
88               JOptionPane.showMessageDialog(null, GUITools.getMessagePane(e
89                       .getMessage()), Data.getInstance().getLocaleStr("error"),
90                       JOptionPane.ERROR_MESSAGE);
91  
92               System.err.println(e.getMessage());
93           }
94       }
95  
96   }
created on June 16, 2009 3:48:54 PM CEST with CodeCover