Package net.datacrow.core.web.model

Examples of net.datacrow.core.web.model.DcWebObject


        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");
        int moduleIdx = objects.getModule();

        if (!getUser().isAuthorized(DcModules.get(moduleIdx)))
            return redirect();

        wod.initialize(moduleIdx);
        wod.setRowIdx(objects.getData().getRowIndex());
        wod.setID((String) data.get(data.size() - 1));
        wod.setName(wod.getDcObject().toString());
        wod.load();
       
        DcObject dco = wod.getDcObject();
        String filename = dco.getFilename();
        File file = new File(filename);
        HttpServletResponse response = (HttpServletResponse) fc.getExternalContext().getResponse();

        int read = 0;
View Full Code Here


   
    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

        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) {
View Full Code Here

   
    @Override
    public List<NavigationMenuItem> getMenuItems() {
        List<NavigationMenuItem> menu = new ArrayList<NavigationMenuItem>();
       
        DcWebObject wo = getItem();
        String itemBeanName =  wo.isChild() ? "webChildObject" : "webObject";
       
        menu.add(getMenuItem(DcResources.getText("lblBack"), "#{" + (wo.isChild() ? "childDetails" : "itemDetails") + ".back}", null));
       
        // SHOW MENU
        NavigationMenuItem show = getMenuItem(DcResources.getText("lblShow"), null, null);
       
        if (wo.isInformationTabVisible())
            show.add(getMenuItem(DcResources.getText("lblInformation"), "#{" + itemBeanName + ".switchToInfoTab}", "information.png"));
       
        if (wo.isTechnicalTabVisible())
            show.add(getMenuItem(DcResources.getText("lblTechnicalInfo"), "#{" + itemBeanName + ".switchToTechTab}", "informationtechnical.png"));

        if (wo.isChildrenTabVisible())
            show.add(getMenuItem(wo.getChildrenLabel(), "#{" + itemBeanName + ".switchToChildTab}", "modules/" + DcModules.get(wo.getModule()).getChild().getName() + "16.png"));

        menu.add(show);
       
        // PICTURE MENU
        if (wo.isPictureTabVisible()) {
            NavigationMenuItem pics = getMenuItem(DcResources.getText("lblPictures"), null, null);
            pics.add(getMenuItem(DcResources.getText("lblShow"), "#{itemDetailsImages.open}" ,"picture.png"));
            //if (getUser().isEditingAllowed(DcModules.get(wo.getModule())))
              //  pics.add(getMenuItem("Edit", "#{" + itemBeanName + ".switchToPicTab}", "picture.png"));
            menu.add(pics);
        }
       
       
        // EDIT MENU
        if (getUser().isEditingAllowed(DcModules.get(wo.getModule()))) {
            NavigationMenuItem edit = getMenuItem(DcResources.getText("lblEdit"), null, null);
            edit.add(getMenuItem(DcResources.getText("lblSave"), "#{" + (wo.isChild() ? "childDetails" : "itemDetails") + ".save}", "save.png"));
           
           
            menu.add(edit);
        }
       
View Full Code Here

        }
       
        if (wo.isChild()) {
            FacesContext fc = FacesContext.getCurrentInstance();
            VariableResolver vr = fc.getApplication().getVariableResolver();
            DcWebObject wod = (DcWebObject) vr.resolveVariable(fc, "webObject");
            dco.setValue( dco.getParentReferenceFieldIndex(), wod.getID());
        }
       
        try {
         
          dco.setUpdateGUI(false);
View Full Code Here

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

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

    @SuppressWarnings("unchecked")
    public String open() {
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        DcWebObject wo = (DcWebObject) vr.resolveVariable(fc, "webObject");
        List<Object> row = (List<Object>) wo.getChildren().getRowData();
        int moduleIdx = DcModules.get(wo.getModule()).getChild().getIndex();
       
        DcWebObject child = (DcWebObject) vr.resolveVariable(fc, "webChildObject");
       
        if (!getUser().isAuthorized(DcModules.get(moduleIdx)))
            return redirect();

        child.initialize(moduleIdx);
        child.setID((String) row.get(row.size() - 1));
        child.setName(child.getDcObject().toString());
        child.load();
        child.setChild(true);
       
        return current();
    }
View Full Code Here

        if (!isLoggedIn())
            return redirect();
       
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        DcWebObject wo = (DcWebObject) vr.resolveVariable(fc, "webObject");
       
        int moduleIdx = wo.getModule();
       
        if (!getUser().isAuthorized(DcModules.get(moduleIdx)))
            return redirect();
       
        DcWebObject child = (DcWebObject) vr.resolveVariable(fc, "webChildObject");
        child.initialize(DcModules.get(moduleIdx).getChild().getIndex());
        child.setNew(true);
       
        return current();
    }
View Full Code Here

    }

    public String save() {
        FacesContext fc = FacesContext.getCurrentInstance();
        VariableResolver vr = fc.getApplication().getVariableResolver();
        DcWebObject wod = (DcWebObject) vr.resolveVariable(fc, "webChildObject");
        return save(wod);
    }
View Full Code Here

TOP

Related Classes of net.datacrow.core.web.model.DcWebObject

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.