Package org.opencustomer.framework.webapp.panel

Examples of org.opencustomer.framework.webapp.panel.EditPanel


    @Override
    public EditPanel createPanel(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        EventVO event = (EventVO)attributes.get("event");

        EditPanel panel = new EditPanel(Right.CALENDAR_CALENDAR_WRITE, event);
       
        if(event.getId() == null) {
            panel.setTitle(MessageUtil.message(request, "module.calendar.event.headLine.create"));
        } else {
            panel.setTitle(MessageUtil.message(request, "module.calendar.event.headLine.edit", event.getTitle()));
           
            panel.setAttribute(DeleteAction.TEXT_TITLE, MessageUtil.message(request, "module.calendar.event.delete.headLine", event.getTitle()));
            panel.setAttribute(DeleteAction.TEXT_QUESTION, MessageUtil.message(request, "module.calendar.event.delete.question", event.getTitle()));
        }
       
        boolean contentEditable = isContentEditable(panel, (CalendarVO)attributes.get("calendar"), request);
       
        if(contentEditable) {
            panel.addAction(Action.Type.DELETE, "/calendar/event/delete");
        }
        panel.addAction(Action.Type.SAVE, "/calendar/event/save");
       
        panel.addPage("STANDARD",   "/calendar/event/pageStandard", "module.generic.panel.tab.standard", true, contentEditable ? null : Boolean.FALSE);
        panel.addPage("PARTICIPIANTS", "/calendar/event/pageParticipiants", "module.calendar.event.pageParticpiants", true, contentEditable ? null : Boolean.FALSE);
        panel.addPage("RECURRENCE", "/calendar/event/pageRecurrence", "module.calendar.event.pageRecurrence", true, contentEditable ? null : Boolean.FALSE);
        panel.addPage("SYSTEM",     "/calendar/event/pageSystem", "module.generic.panel.tab.system");
       
        return panel;
    }
View Full Code Here


    @Override
    public EditPanel createPanel(ActionMessages errors, LoadForm form, Hashtable<String, Object> attributes, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        CompanyVO company = (CompanyVO)attributes.get("company");

        EditPanel panel = new EditPanel(Right.CRM_COMPANIES_WRITE, company);
       
        boolean deletable = true;
       
        if(company.getId() == null)
            panel.setTitle(MessageUtil.message(request, "module.crm.company.headLine.create"));
        else {
            panel.setTitle(MessageUtil.message(request, "module.crm.company.headLine.edit", company.getCompanyName()));
           
            panel.setAttribute(DeleteAction.TEXT_TITLE, MessageUtil.message(request, "module.crm.company.delete.headLine", company.getCompanyName()));
            panel.setAttribute(DeleteAction.TEXT_QUESTION, MessageUtil.message(request, "module.crm.company.delete.question", company.getCompanyName()));
        }
       
        if(company.getPersons().size() > 0 || company.getPersonContacts().size() > 0 || company.getJobs().size() > 0)
            deletable = false;
       
        panel.addAction(Action.Type.DELETE, "/crm/company/delete", deletable);
        panel.addAction(Action.Type.SAVE, "/crm/company/save");
       
        if(SystemConfiguration.getInstance().getBooleanValue(SystemConfiguration.Key.SHOW_OVERVIEW)) {
            panel.addPage("OVERVIEW", "/crm/company/pageOverview""module.generic.panel.tab.overview");
        }
        panel.addPage("STANDARD", "/crm/company/pageStandard""module.generic.panel.tab.standard");
        panel.addPage("INFO",     "/crm/company/pageInfo",      "module.crm.company.page2");
        panel.addPage("ADDRESS""/crm/company/pageAddress",   "module.crm.company.pageAddress");
        panel.addPage("PERSON",   "/crm/company/pagePerson",    "module.crm.company.page3", company.getId() != null);
        panel.addPage("CONTACT""/crm/company/pageContact",   "module.crm.company.page4", company.getId() != null, true);
        panel.addPage("JOB",      "/crm/company/pageJob",       "module.generic.panel.tab.crm.jobs", company.getId() != null, true);
        panel.addPage("SYSTEM",   "/crm/company/pageSystem",    "module.generic.panel.tab.system");
       
        if(company.getId() == null) {
            panel.activatePage(panel.findPage("STANDARD"));
        }
       
        return panel;
    }
View Full Code Here

    @Override
    protected Panel getPanel(HttpServletRequest request) {
        if(request.getAttribute("external_company_id") != null
                || request.getAttribute("external_person_id") != null
                || request.getAttribute(Globals.JUMP_KEY) != null) {
            EditPanel panel = (EditPanel)Panel.getPanelStack(request).peek();
            if(panel.getEntity() instanceof CompanyVO)
                return panel;
            else
                return Panel.getPanelStack(request).peek(2);
        } else {
            return super.getPanel(request);
View Full Code Here

    @Override
    protected void preOperations(E form, ActionMessages errors, HttpServletRequest request)
    {
        UserVO activeUser = (UserVO) request.getSession().getAttribute(Globals.USER_KEY);
       
        EditPanel panel = getPanel();
       
        EntityAccess ea = getEntityAccess(request);
       
        if(panel.getAttribute("system_entityAccess") == null) {
            panel.setAttribute("system_entityAccess", ea);

            List<UsergroupVO> usergroups = new UsergroupDAO().getList(null, UsergroupDAO.AdminSelect.ALL, new Sort(UsergroupDAO.SORT_NAME, true), null, activeUser);
           
            // load a set usergroup where you do not have rights
            boolean usergroupAccess = false;
            for(UsergroupVO vo : usergroups) {
                if(ea.getOwnerGroup().equals(vo.getId())) {
                    usergroupAccess = true;
                    break;
                }
            }
            if(!usergroupAccess) {
                UsergroupVO vo = new UsergroupDAO().getById(ea.getOwnerGroup());
                usergroups.add(0, vo);
            }
            Collections.sort(usergroups, new Comparator<UsergroupVO>() {
                public int compare(UsergroupVO usergroup1, UsergroupVO usergroup2)
                {
                    return usergroup1.getName().compareTo(usergroup2.getName());
                }
            });           
            panel.setAttribute("system_usergroups", usergroups);
           
            if(ea != null) {
                UserVO user = (UserVO)request.getSession().getAttribute(Globals.USER_KEY);
               
                Page activePage = panel.getActivePage();
               
                activePage.setEditable(isEditable(panel, user, ea, request));
            }
           
            UserVO ownerUser = null;
   
            if(panel.getAttribute("system_ownerUser") == null && ea.getOwnerUser() > 0) {
                if(log.isDebugEnabled())
                    log.debug("load user for owner of entity access");
               
                ownerUser = new UserDAO().getById(ea.getOwnerUser());
                panel.setAttribute("system_ownerUser", ownerUser);
            }
           
            if(ea instanceof StampedVO) {
                StampedVO vo = (StampedVO)ea;
                panel.setAttribute("system_isStamped", Boolean.TRUE);
               
                if(panel.getAttribute("system_createUser") == null && vo.getCreateUser() != null && vo.getCreateUser() > 0) {
                    UserVO user = null;
                    if(vo.getCreateUser().equals(ea.getOwnerUser())) {
                        user = ownerUser;
                    } else {
                        user = new UserDAO().getById(vo.getCreateUser());
                    }
                    panel.setAttribute("system_createUser", user);
                }
   
                if(panel.getAttribute("system_modifyUser") == null && vo.getModifyUser() != null && vo.getModifyUser() > 0) {
                    UserVO user = null;
                    if(vo.getModifyUser().equals(ea.getOwnerUser())) {
                        user = ownerUser;
                    } else if(vo.getModifyUser().equals(vo.getCreateUser())) {
                        user = ownerUser;
                    } else {
                        user = new UserDAO().getById(vo.getModifyUser());
                    }
                    panel.setAttribute("system_modifyUser", user);
                }
            }
           
            if(ea instanceof VersionedVO) {
                panel.setAttribute("system_isVersioned", Boolean.TRUE);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.opencustomer.framework.webapp.panel.EditPanel

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.