public class LoadAction extends EditLoadAction<LoadForm> {
private static Logger log = Logger.getLogger(LoadAction.class);
@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;
}