@Test public final void testPreProcessNextTab() { try { HttpServletRequest aReq = new MockHttpServletRequest(); TargetManager targetManager = new MockTargetManager(testFile); testInstance.setTargetManager(targetManager); TargetGroup targetGroup = targetManager.loadGroup(15000L); List<Annotation> list = createAnnotationList(); assertFalse(checkSortedList(list)); targetGroup.setAnnotations(list); GroupsEditorContext ctx = new GroupsEditorContext(targetGroup, true); aReq.getSession().setAttribute(TabbedGroupController.EDITOR_CONTEXT, ctx); HttpServletResponse aResp = new MockHttpServletResponse(); GroupAnnotationCommand aCmd = new GroupAnnotationCommand(); TabbedController tc = new TabbedGroupController(); TabConfig tabConfig = new TabConfig(); tabConfig.setViewName("groups"); List<Tab> tabs = getTabList(targetManager); tabConfig.setTabs(tabs); tc.setTabConfig(tabConfig); Tab currentTab = tabs.get(1); BindException aErrors = new BindException(aCmd, aCmd.getActionCmd()); ModelAndView mav = testInstance.preProcessNextTab(tc, currentTab, aReq, aResp, aCmd, aErrors); assertNotNull(mav); assertTrue(checkSortedList((List<Annotation>)mav.getModel().get("annotations"))); } catch(Exception e) { fail(e.getMessage()); } }
@SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); GroupsEditorContext ctx = getEditorContext(req); TargetGroup targetGroup = ctx.getTargetGroup(); if (!targetGroup.isAnnotationsSet()) { targetGroup.setAnnotations(targetManager.getAnnotations(targetGroup)); } tmav.addObject(Constants.GBL_CMD_DATA, new GroupAnnotationCommand()); tmav.addObject("annotations", targetGroup.getSortedAnnotations()); return tmav; }
GroupAnnotationHandler extends AbstractGroupTabHandler { @SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); GroupsEditorContext ctx = getEditorContext(req); TargetGroup targetGroup = ctx.getTargetGroup(); if (!targetGroup.isAnnotationsSet()) { targetGroup.setAnnotations(targetManager.getAnnotations(targetGroup)); } tmav.addObject(Constants.GBL_CMD_DATA, new GroupAnnotationCommand()); tmav.addObject("annotations", targetGroup.getSortedAnnotations()); return tmav; } }
GroupAnnotationHandler extends AbstractGroupTabHandler { @SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); GroupsEditorContext ctx = getEditorContext(req); TargetGroup targetGroup = ctx.getTargetGroup(); if (!targetGroup.isAnnotationsSet()) { targetGroup.setAnnotations(targetManager.getAnnotations(targetGroup)); } tmav.addObject(Constants.GBL_CMD_DATA, new GroupAnnotationCommand()); tmav.addObject("annotations", targetGroup.getSortedAnnotations()); return tmav; }  }
GroupAnnotationHandler extends AbstractGroupTabHandler { @SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); GroupsEditorContext ctx = getEditorContext(req); TargetGroup targetGroup = ctx.getTargetGroup(); if (!targetGroup.isAnnotationsSet()) { targetGroup.setAnnotations(targetManager.getAnnotations(targetGroup)); } tmav.addObject(Constants.GBL_CMD_DATA, new GroupAnnotationCommand()); tmav.addObject("annotations", targetGroup.getSortedAnnotations()); return tmav; }  void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void processTab(TabbedController tc, Tab currentTab,
            HttpServletRequest req, HttpServletResponse res, Object comm,
            BindException errors); @SuppressWarnings("unchecked") TabbedModelAndView preProcessNextTab(TabbedController tc,
            Tab nextTabID, HttpServletRequest req, HttpServletResponse res,
            Object comm, BindException errors); ModelAndView processOther(TabbedController tc, Tab currentTab,
            HttpServletRequest req, HttpServletResponse res, Object comm,
            BindException errors); void setTargetManager(TargetManager targetManager); }
GroupAnnotationHandler extends AbstractGroupTabHandler { @SuppressWarnings("unchecked") public TabbedModelAndView preProcessNextTab(TabbedController tc, Tab nextTabID, HttpServletRequest req, HttpServletResponse res, Object comm, BindException errors) { TabbedModelAndView tmav = tc.new TabbedModelAndView(); GroupsEditorContext ctx = getEditorContext(req); TargetGroup targetGroup = ctx.getTargetGroup(); if (!targetGroup.isAnnotationsSet()) { targetGroup.setAnnotations(targetManager.getAnnotations(targetGroup)); } tmav.addObject(Constants.GBL_CMD_DATA, new GroupAnnotationCommand()); tmav.addObject("annotations", targetGroup.getSortedAnnotations()); return tmav; }  void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void processTab(TabbedController tc, Tab currentTab,
            HttpServletRequest req, HttpServletResponse res, Object comm,
            BindException errors); @SuppressWarnings("unchecked") TabbedModelAndView preProcessNextTab(TabbedController tc,
            Tab nextTabID, HttpServletRequest req, HttpServletResponse res,
            Object comm, BindException errors); ModelAndView processOther(TabbedController tc, Tab currentTab,
            HttpServletRequest req, HttpServletResponse res, Object comm,
            BindException errors); void setTargetManager(TargetManager targetManager);  }