Examples of CategoryForm


Examples of com.devsniper.desktop.customers.view.CategoryForm

        return new CategoryPage();
    }

    @Override
    public void openFormView(Category category) {
        new CategoryForm(this, category).showDialog();
    }
View Full Code Here

Examples of com.jpoweredcart.admin.form.catalog.CategoryForm

  }
 
  @Override
  public CategoryForm newForm(){
   
    CategoryForm catForm = new CategoryForm();
    List<CategoryDesc> descList = languageAdminModel
        .createDescriptionList(CategoryDesc.class);
    catForm.setDescs(descList);
    List<CategoryToLayout> ctlList = new ArrayList<CategoryToLayout>();
    for(Store store: storeAdminModel.getAll()){
      CategoryToLayout ctl = new CategoryToLayout();
      ctl.setStoreId(store.getId());
      ctl.setStoreName(store.getName());
      ctlList.add(ctl);
    }
    catForm.setLayouts(ctlList);
   
    return catForm;
  }
View Full Code Here

Examples of com.jpoweredcart.admin.form.catalog.CategoryForm

  public CategoryForm getForm(Integer catId) {
   
    String sql = "SELECT DISTINCT *, (SELECT keyword FROM " +quoteTable("url_alias")
        + " WHERE query = ?) AS keyword FROM "
        + quoteTable("category")+" WHERE category_id = ?";
    CategoryForm catForm = (CategoryForm)getJdbcOperations().queryForObject(
        sql, new Object[]{"category_id="+catId, catId},
        new CategoryRowMapper(){
          @Override
          public Category mapRow(ResultSet rs, int rowNum)
              throws SQLException {
            CategoryForm form = (CategoryForm)super.mapRow(rs, rowNum);
            form.setKeyword(rs.getString("keyword"));
            return form;
          }
      }.setTargetClass(CategoryForm.class));
    catForm.setDescs(getDescriptions(catId));
    catForm.setStores(getCatStores(catId));
View Full Code Here

Examples of com.jpoweredcart.admin.form.catalog.CategoryForm

 
  @RequestMapping(value="/edit/{id}")
  public String edit(@PathVariable("id") Integer id, Model model, HttpServletRequest request){
   
    checkModifyPermission();
    CategoryForm catForm = categoryAdminModel.getForm(id);
    addFormAttributes(catForm, model, request);
   
    return "/admin/catalog/categoryForm";
  }
View Full Code Here

Examples of com.sparc.knappsack.forms.CategoryForm

    private Errors errors;
    private CategoryForm categoryForm;

    @Before
    public void setup() {
        categoryForm = new CategoryForm();
        errors = new BeanPropertyBindingResult(categoryForm, "categoryForm");
    }
View Full Code Here

Examples of com.sparc.knappsack.forms.CategoryForm

        Organization organization = organizationService.get(orgId);

        if (organization != null) {
            if (!model.containsAttribute("category")) {
                CategoryForm categoryForm = new CategoryForm();
                categoryForm.setOrganizationId(organization.getId());
                categoryForm.setOrgStorageConfigId(organization.getOrgStorageConfig().getId());

                model.addAttribute("category", categoryForm);
            }

            model.addAttribute("parentOrgId", organization.getId());
View Full Code Here

Examples of com.sparc.knappsack.forms.CategoryForm

        }

        if (!model.containsAttribute("category")) {

            if (category != null) {
                CategoryForm categoryForm = new CategoryForm();
                categoryForm.setDescription(category.getDescription());
                categoryForm.setId(category.getId());
                categoryForm.setName(category.getName());
                categoryForm.setStorageConfigurationId(category.getStorageConfiguration().getId());

                AppFile icon = category.getIcon();
                if (icon != null) {
                    MockMultipartFile iconMultipartFile = new MockMultipartFile(category.getIcon().getName(), category.getIcon().getName(), category.getIcon().getType(), new byte[0]);
                    categoryForm.setIcon(iconMultipartFile);
                }

                model.addAttribute("category", categoryForm);
            }
        }
View Full Code Here

Examples of com.sparc.knappsack.forms.CategoryForm

        return CategoryForm.class.isAssignableFrom(clazz);
    }

    @Override
    public void validate(Object target, Errors errors) {
        CategoryForm category = (CategoryForm) target;
        if (category.getName() == null || category.getName().isEmpty()) {
            errors.rejectValue(NAME_FIELD, "categoryValidator.emptyName");
        }

        if (category.getDescription() == null || category.getDescription().isEmpty()) {
            errors.rejectValue(DESCRIPTION_FIELD, "categoryValidator.emptyDescription");
        }

        if (category.isEditing()) {
            if (category.getIcon() != null && !category.getIcon().isEmpty()) {
                validateImageAttributes(category.getIcon(), errors);
            }
        } else {
            if (category.getIcon() == null || category.getIcon().isEmpty()) {
                errors.rejectValue(ICON_FIELD, "categoryValidator.emptyIcon");
            } else {
                validateImageAttributes(category.getIcon(), errors);
            }
        }
    }
View Full Code Here

Examples of com.sparc.knappsack.forms.CategoryForm

        Organization organization = getOrganization();

        List<Category> categories = categoryService.getAll();
        assertTrue(categories.size() == 0);

        CategoryForm categoryForm = new CategoryForm();
        categoryForm.setName("Test Category");
        categoryForm.setDescription("Test Description");
        categoryForm.setEditing(false);
        categoryForm.setOrganizationId(organization.getId());
        categoryForm.setStorageConfigurationId(organization.getStorageConfigurations().get(0).getId());
        Category category = categoryService.saveCategory(categoryForm);
        categories = categoryService.getAll();
        assertTrue(categories.size() == 1);
        assertTrue(category.getName().equals("Test Category"));
    }
View Full Code Here

Examples of com.sparc.knappsack.forms.CategoryForm

        Organization organization = getOrganization();

        List<Category> categories = categoryService.getAll();
        assertTrue(categories.size() == 0);

        CategoryForm categoryForm = new CategoryForm();
        categoryForm.setName("Test Category");
        categoryForm.setDescription("Test Description");
        categoryForm.setEditing(false);
        categoryForm.setOrganizationId(organization.getId());
        categoryForm.setStorageConfigurationId(organization.getStorageConfigurations().get(0).getId());
        Category category = categoryService.saveCategory(categoryForm);
        categories = categoryService.getAll();
        assertTrue(categories.size() == 1);
        assertTrue(category.getName().equals("Test Category"));

        categoryForm.setName("Test Category 2");
        categoryForm.setId(category.getId());
        categoryService.updateCategory(categoryForm);
        categories = categoryService.getAll();
        assertTrue(categories.size() == 1);
        assertTrue(category.getName().equals("Test Category 2"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.