Package com.adito.properties.forms

Examples of com.adito.properties.forms.AbstractPropertiesForm


     * @return ActionForward
     * @throws Exception
     */
    public ActionForward reset(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        AbstractPropertiesForm f = (AbstractPropertiesForm) form;
        f.clearValues();
        User user = isSetupMode() ? null : LogonControllerFactory.getInstance().getUser((HttpServletRequest) request);
        return rebuildItems(mapping, f.getParentCategory(), f, request, user);
    }
View Full Code Here


    }

    public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                     HttpServletResponse response) throws Exception {
        // Initialise form
        AbstractPropertiesForm pf = (AbstractPropertiesForm) form;
        pf.clearValues();
        pf.setUpdateAction(mapping.getPath() + ".do");
        pf.setInput(mapping.getInput());

        // Now try the struts supplied action mapping parameter
        if (mapping.getParameter() != null && !mapping.getParameter().equals("")) {
            PropertyList pl = new PropertyList(mapping.getParameter());
            Properties pr = pl.getAsNameValuePairs();
            BeanUtils.populate(pf, pr);
        }

        if ("changeSelectedCategory".equalsIgnoreCase(pf.getActionTarget())) {
            pf.setSelectedCategory(pf.getNewSelectedCategory());
        }

        // Build and display
        return rebuildItems(mapping, pf.getParentCategory(), pf, request, getSessionInfo(request).getUser());
    }
View Full Code Here

     */
    public ActionForward changeSelectedCategory(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                                HttpServletResponse response) throws Exception {
        if (log.isDebugEnabled())
            log.debug("Storing properties");
        AbstractPropertiesForm f = (AbstractPropertiesForm) form;
        f.storeItems();
        User user = isSetupMode() ? null : LogonControllerFactory.getInstance().getUser((HttpServletRequest) request);
        f.setSelectedCategory(f.getNewSelectedCategory());
        f.setNewSelectedCategory(-1);
        return rebuildItems(mapping, f.getParentCategory(), f, request, user);
    }
View Full Code Here

        return rebuildItems(mapping, f.getParentCategory(), f, request, user);
    }

    public ActionForward cancel(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
        AbstractPropertiesForm pf = (AbstractPropertiesForm) form;
        User user = isSetupMode() ? null : LogonControllerFactory.getInstance().getUser((HttpServletRequest) request);
        pf.setSelectedCategory(-1);
        pf.clearValues();
        int newCategory = pf.popCategory();
        pf.setParentCategory(newCategory);
        ActionForward fwd = rebuildItems(mapping, newCategory, pf, request, user);
        ActionForward cancel = mapping.findForward("cancel");
        return cancel != null ? cancel : fwd;
    }
View Full Code Here

     * @return ActionForward
     * @throws Exception
     */
    public ActionForward displayCategory(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                         HttpServletResponse response) throws Exception {
        AbstractPropertiesForm pf = (AbstractPropertiesForm) form;
        User user = isSetupMode() ? null : LogonControllerFactory.getInstance().getUser((HttpServletRequest) request);
        pf.setSelectedCategory(-1);
        pf.pushCategory(pf.getParentCategory());
        pf.setParentCategory(pf.getNewSelectedCategory());
        pf.setNewSelectedCategory(-1);
        return rebuildItems(mapping, pf.getParentCategory(), pf, request, user);
    }
View Full Code Here

        boolean restartRequired = false;

        // Temporarily store the properties
        if (log.isDebugEnabled())
            log.debug("Commiting properties");
        AbstractPropertiesForm f = (AbstractPropertiesForm) form;
        f.storeItems();

        // Check for save ability
        if (!((PropertiesForm) form).getEnabled()) {
            throw new Exception("Disabled.");
        }

        // Set the properties
        String oldVal, newVal;
        PropertyDefinition def;
        for (Iterator i = f.storedItems(); i.hasNext();) {
            PropertyItem item = (PropertyItem) i.next();
            def = item.getDefinition();
            newVal = String.valueOf(item.getPropertyValue());
            if (log.isDebugEnabled())
                log.debug("Setting '" + def.getName() + "' to '" + newVal + "'");
            oldVal = Property.setProperty(createKey(def, f, sessionInfo), newVal, sessionInfo);
            if ((oldVal == null && newVal != null) || !oldVal.equals(newVal)) {
                if (def.isRestartRequired()) {
                    restartRequired = true;
                }
            }
        }
        CoreUtil.resetMainNavigation(request.getSession());

        // Clean up and forward
        f.clearValues();
        ActionForward fwd;
        if (f.getForwardTo() != null && !f.getForwardTo().equals("")) {
            fwd = new ActionForward(f.getForwardTo(), f.isRedirect());
        } else {
            fwd = cancel(mapping, form, request, response);
        }
        if (restartRequired) {
            String orig = fwd.getPath();
View Full Code Here

    public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request,
                                     HttpServletResponse response) throws Exception {
        // Initialise form
        PolicyUtil.checkPermissions(PolicyConstants.SYSTEM_CONFIGURATION_RESOURCE_TYPE, new Permission[] { PolicyConstants.PERM_CHANGE }, request);
        AbstractPropertiesForm pf = (AbstractPropertiesForm) form;
        pf.setParentCategory(0);
        pf.setSelectedCategory(0);
        return super.unspecified(mapping, form, request, response);
    }
View Full Code Here

TOP

Related Classes of com.adito.properties.forms.AbstractPropertiesForm

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.