Examples of FacesContext


Examples of javax.faces.context.FacesContext

       
        return "itemimage";
    }
   
    public boolean isAllowUpload() {
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        DcWebImage wi = (DcWebImage) vr.resolveVariable(fc, "image");
        DcWebObject wo = (DcWebObject) vr.resolveVariable(fc, "webObject");
        return getUser().isEditingAllowed(DcModules.get(wo.getModule()).getField(wi.getFieldIdx()));
    }
View Full Code Here

Examples of javax.faces.context.FacesContext

        uploadedFile = upFile;
    }

    @SuppressWarnings("unchecked")
    public String upload() throws IOException {
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
       
        DcWebImage wi = (DcWebImage) vr.resolveVariable(fc, "image");
        byte[] b = uploadedFile.getBytes();
       
        DcWebObject wo = (DcWebObject) vr.resolveVariable(fc, "webObject");
        DcObject dco = wo.getDcObject();
        dco.setValue(wi.getFieldIdx(), new DcImageIcon(b));
       
        try {
            dco.saveUpdate(false);
            wi.setPicture((Picture) dco.getValue(wi.getFieldIdx()));
            wo.load();
       
            DcWebObjects objects = (DcWebObjects) vr.resolveVariable(fc, "webObjects");
            objects.update(wo);
           
        } catch (ValidationException ve) {
            ve.printStackTrace();
        }
       
        fc.getExternalContext().getApplicationMap().put("fileupload_bytes", uploadedFile.getBytes());
        fc.getExternalContext().getApplicationMap().put("fileupload_type", uploadedFile.getContentType());
        fc.getExternalContext().getApplicationMap().put("fileupload_name", uploadedFile.getName());
       
        return current();
    }
View Full Code Here

Examples of javax.faces.context.FacesContext

       
        return current();
    }

    public boolean isUploaded() {
        FacesContext facesContext = FacesContext.getCurrentInstance();
        return facesContext.getExternalContext().getApplicationMap().get("fileupload_bytes")!= null;
    }   
View Full Code Here

Examples of javax.faces.context.FacesContext

    public List<NavigationMenuItem> getMenuItems() {
       
        List<NavigationMenuItem> menu = new ArrayList<NavigationMenuItem>();

        // edit
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        DcWebObjects objects = (DcWebObjects) vr.resolveVariable(fc, "webObjects");
       
        if (getUser().isEditingAllowed(DcModules.get(objects.getModule()))) {
            NavigationMenuItem edit = getMenuItem(DcResources.getText("lblEdit"), null, null);
           
View Full Code Here

Examples of javax.faces.context.FacesContext

    public String search(boolean advanced) {
       
        if (!isLoggedIn())
            return redirect();
       
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        Map map = fc.getExternalContext().getRequestParameterMap();
       
        DcWebObjects objects = (DcWebObjects) vr.resolveVariable(fc, "webObjects");
        if (map.get("moduleId") != null && !map.get("moduleId").equals("")) {
            int moduleIdx = Integer.valueOf((String) map.get("moduleId"));
           
View Full Code Here

Examples of javax.faces.context.FacesContext

        }
        return df;
    }
   
    private void applyFilter(DcWebObjects wo, boolean advanced) {
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        AdvancedFilter af = (AdvancedFilter) vr.resolveVariable(fc, "advancedFilter");

        DataFilter df = advanced ?  af.getFilter() : getFilter(wo);
       
      List<WebFieldDefinition> definitions = new ArrayList<WebFieldDefinition>();
View Full Code Here

Examples of javax.faces.context.FacesContext

        return "details";
    }

    @Override
    protected DcWebObject getItem() {
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        return (DcWebObject) vr.resolveVariable(fc, "webObject");
    }
View Full Code Here

Examples of javax.faces.context.FacesContext

    public String open() {

        if (!isLoggedIn())
            return redirect();
       
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        DcWebObjects objects = (DcWebObjects) vr.resolveVariable(fc, "webObjects");
        List<?> data = (List) objects.getData().getRowData();
       
        DcWebObject wod = (DcWebObject) vr.resolveVariable(fc, "webObject");
       
View Full Code Here

Examples of javax.faces.context.FacesContext

   
    public String create() {
        if (!isLoggedIn())
            return redirect();
       
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        DcWebObjects objects = (DcWebObjects) vr.resolveVariable(fc, "webObjects");
       
        int moduleIdx = objects.getModule();
       
        if (!getUser().isAuthorized(DcModules.get(moduleIdx)))
View Full Code Here

Examples of javax.faces.context.FacesContext

       
        return current();
    }
   
    public String save() {
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        DcWebObject wod = (DcWebObject) vr.resolveVariable(fc, "webObject");
        return save(wod);
   
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.