Search in sources :

Example 1 with Module

use of org.jahia.ajax.gwt.client.widget.edit.mainarea.Module in project jahia by Jahia.

the class CreateContentEngine method initFooter.

/**
 * init buttons
 */
@Override
protected void initFooter() {
    for (ButtonItem buttonItem : config.getCreationButtons()) {
        BoxComponent button = buttonItem.create(this);
        buttons.add(button);
        buttonBar.add(button);
    }
    for (ButtonItem buttonItem : config.getCommonButtons()) {
        buttonBar.add(buttonItem.create(this));
    }
    List<Module> parentModules = ModuleHelper.getModulesByPath() != null ? ModuleHelper.getModulesByPath().get(parentPath) : null;
    if (parentModules != null && parentModules.size() == 1) {
        Module module = parentModules.get(0);
        childCount = module.getChildCount();
        listLimit = module.getListLimit();
    } else {
        childCount = 0;
        listLimit = -1;
    }
    setButtonsEnabled(false);
}
Also used : BoxComponent(com.extjs.gxt.ui.client.widget.BoxComponent) Module(org.jahia.ajax.gwt.client.widget.edit.mainarea.Module)

Example 2 with Module

use of org.jahia.ajax.gwt.client.widget.edit.mainarea.Module in project jahia by Jahia.

the class PasteReferenceActionItem method handleNewLinkerSelection.

public void handleNewLinkerSelection() {
    boolean b = false;
    if (!CopyPasteEngine.getInstance().getCopiedNodes().isEmpty()) {
        LinkerSelectionContext lh = linker.getSelectionContext();
        b = lh.getSingleSelection() != null && !lh.isLocked() && hasPermission(lh.getSelectionPermissions()) && PermissionsUtils.isPermitted("jcr:addChildNodes", lh.getSelectionPermissions()) && lh.isPasteAllowed();
        String refTypes = null;
        if (linker instanceof EditLinker && b) {
            final Module module = ((EditLinker) linker).getSelectedModule();
            refTypes = module.getReferenceTypes();
        } else if (lh.getSingleSelection() != null) {
            refTypes = lh.getSingleSelection().get("referenceTypes");
        }
        if (refTypes != null && refTypes.length() > 0) {
            String[] refs = refTypes.split(" ");
            allowedRefs = new ArrayList<String>();
            for (String ref : refs) {
                String[] types = ref.split("\\[|\\]");
                if (types[1] != null && Arrays.asList(types[1].split(" |,")).contains("jnt:contentReference")) {
                    allowedRefs.add("jnt:contentReference");
                    break;
                } else if (checkNodeType(CopyPasteEngine.getInstance().getCopiedNodes(), types[1])) {
                    allowedRefs.add(types[0]);
                }
            }
            if (this.allowedRefs.size() == 0) {
                b = false;
            }
        } else {
            b = false;
        }
    }
    setEnabled(b);
}
Also used : EditLinker(org.jahia.ajax.gwt.client.widget.edit.EditLinker) LinkerSelectionContext(org.jahia.ajax.gwt.client.widget.LinkerSelectionContext) Module(org.jahia.ajax.gwt.client.widget.edit.mainarea.Module)

Example 3 with Module

use of org.jahia.ajax.gwt.client.widget.edit.mainarea.Module in project jahia by Jahia.

the class NewContentActionItem method onComponentSelection.

public void onComponentSelection() {
    if (useEngine) {
        String nodeTypes = this.nodeTypes;
        if (linker instanceof EditLinker) {
            Module m = ((EditLinker) linker).getSelectedModule();
            if (m == null || useMainNode) {
                m = ((EditLinker) linker).getMainModule();
            }
            if (m instanceof ListModule) {
                nodeTypes = m.getNodeTypes();
            } else if (m instanceof AreaModule) {
                nodeTypes = m.getNodeTypes();
            }
        }
        GWTJahiaNode parent;
        if (useMainNode) {
            parent = linker.getSelectionContext().getMainNode();
        } else {
            parent = linker.getSelectionContext().getSingleSelection();
        }
        if (nodeTypes.length() > 0) {
            ContentActions.showContentWizard(linker, nodeTypes, parent, includeSubTypes);
        } else {
            ContentActions.showContentWizard(linker, parent.getChildConstraints(), parent, includeSubTypes);
        }
    } else {
        ContentActions.createNode(newNodeName, linker, getGwtToolbarItem().getTitle(), nodeTypes, mixins, nodeProperties, useMainNode);
    }
}
Also used : EditLinker(org.jahia.ajax.gwt.client.widget.edit.EditLinker) ListModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.ListModule) GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) AreaModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.AreaModule) Module(org.jahia.ajax.gwt.client.widget.edit.mainarea.Module) AreaModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.AreaModule) ListModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.ListModule)

Example 4 with Module

use of org.jahia.ajax.gwt.client.widget.edit.mainarea.Module in project jahia by Jahia.

the class TemplatesTabItem method create.

/**
 * Performs the creation of the tab item and populates its content. The tab contains two panes: one with the tree of templates,
 * available in the module, and the second pane with the detail structure of the template content.
 *
 * @param config
 *            the tab configuration
 * @return the created tab item
 */
@Override
public TabItem create(GWTSidePanelTab config) {
    super.create(config);
    this.tree.setSelectionModel(new TreeGridSelectionModel<GWTJahiaNode>() {

        @Override
        protected void handleMouseClick(GridEvent<GWTJahiaNode> e) {
            super.handleMouseClick(e);
            if (!getSelectedItem().getPath().equals(editLinker.getMainModule().getPath())) {
                if (!getSelectedItem().getNodeTypes().contains("jnt:virtualsite") && !getSelectedItem().getNodeTypes().contains("jnt:templatesFolder")) {
                    MainModule.staticGoTo(getSelectedItem().getPath(), null);
                }
            }
        }
    });
    this.tree.getSelectionModel().setSelectionMode(Style.SelectionMode.SINGLE);
    this.tree.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<GWTJahiaNode>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<GWTJahiaNode> se) {
            detailTree.getSelectionModel().deselectAll();
            if (se.getSelectedItem() != null) {
                detailLoader.load(se.getSelectedItem());
            } else {
                detailStore.removeAll();
            }
        }
    });
    tree.setContextMenu(createContextMenu(config.getTreeContextMenu(), tree.getSelectionModel()));
    selectMainNodeTreeLoadListener = new SelectMainNodeTreeLoadListener(tree);
    NodeColumnConfigList columns = new NodeColumnConfigList(config.getTreeColumns());
    columns.init();
    columns.get(0).setRenderer(NodeColumnConfigList.NAME_TREEGRID_RENDERER);
    RpcProxy<List<GWTJahiaNode>> proxy = new RpcProxy<List<GWTJahiaNode>>() {

        @Override
        protected void load(Object currentPage, final AsyncCallback<List<GWTJahiaNode>> callback) {
            if (currentPage != null) {
                GWTJahiaNode gwtJahiaNode = (GWTJahiaNode) currentPage;
                List<String> fields = new ArrayList<String>();
                fields.add(GWTJahiaNode.LOCKS_INFO);
                fields.add(GWTJahiaNode.PERMISSIONS);
                fields.add(GWTJahiaNode.CHILDREN_INFO);
                fields.add(GWTJahiaNode.ICON);
                JahiaContentManagementService.App.getInstance().lsLoad(gwtJahiaNode.getPath(), displayedDetailTypes, null, null, fields, false, 0, 0, false, hiddenDetailTypes, null, false, false, new AsyncCallback<PagingLoadResult<GWTJahiaNode>>() {

                    @Override
                    public void onFailure(Throwable caught) {
                        callback.onFailure(caught);
                    }

                    @Override
                    public void onSuccess(PagingLoadResult<GWTJahiaNode> nodes) {
                        callback.onSuccess(nodes.getData());
                    }
                });
            }
        }
    };
    detailLoader = new BaseTreeLoader<GWTJahiaNode>(proxy) {

        @Override
        public boolean hasChildren(GWTJahiaNode parent) {
            return parent.hasChildren();
        }
    };
    detailStore = new TreeStore<GWTJahiaNode>(detailLoader);
    detailTree = new TreeGrid<GWTJahiaNode>(detailStore, new ColumnModel(columns));
    detailTree.setAutoExpandColumn("displayName");
    detailTree.getTreeView().setRowHeight(25);
    detailTree.getTreeView().setForceFit(true);
    detailTree.setHeight("100%");
    detailTree.setIconProvider(ContentModelIconProvider.getInstance());
    detailTree.setAutoExpand(true);
    detailTree.setContextMenu(createContextMenu(config.getTableContextMenu(), detailTree.getSelectionModel()));
    detailTree.setView(new TreeGridView() {

        @Override
        protected void handleComponentEvent(GridEvent ge) {
            switch(ge.getEventTypeInt()) {
                case Event.ONMOUSEOVER:
                    GWTJahiaNode selection = (GWTJahiaNode) ge.getModel();
                    if (selection != null) {
                        List<Module> modules = ModuleHelper.getModulesByPath().get(selection.getPath());
                        if (modules != null) {
                            for (Module module : modules) {
                                Hover.getInstance().addHover(module, ge);
                            }
                        }
                    }
                    break;
                case Event.ONMOUSEOUT:
                    selection = (GWTJahiaNode) ge.getModel();
                    if (selection != null) {
                        List<Module> modules = ModuleHelper.getModulesByPath().get(selection.getPath());
                        if (modules != null) {
                            for (Module module : modules) {
                                Hover.getInstance().removeHover(module);
                            }
                        }
                    }
                    break;
            }
            editLinker.getMainModule().setCtrlActive(ge);
            super.handleComponentEvent(ge);
        }
    });
    detailTree.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<GWTJahiaNode>() {

        @Override
        public void selectionChanged(SelectionChangedEvent<GWTJahiaNode> se) {
            if (se.getSelection() != null) {
                for (GWTJahiaNode selection : se.getSelection()) {
                    List<Module> modules = ModuleHelper.getModulesByPath().get(selection.getPath());
                    if (modules != null) {
                        for (Module module : modules) {
                            if (!editLinker.getMainModule().getSelections().containsKey(module)) {
                                editLinker.getMainModule().handleNewModuleSelection(module);
                            }
                        }
                    }
                }
            }
        }
    });
    contentContainer = new LayoutContainer();
    contentContainer.setBorders(false);
    contentContainer.setScrollMode(Style.Scroll.AUTO);
    contentContainer.setLayout(new FitLayout());
    contentContainer.setTitle(Messages.get("label.detail", "detail"));
    contentContainer.add(detailTree);
    VBoxLayoutData contentVBoxData = new VBoxLayoutData();
    contentVBoxData.setFlex(2);
    tab.add(contentContainer, contentVBoxData);
    return tab;
}
Also used : NodeColumnConfigList(org.jahia.ajax.gwt.client.widget.NodeColumnConfigList) TreeGridView(com.extjs.gxt.ui.client.widget.treegrid.TreeGridView) VBoxLayoutData(com.extjs.gxt.ui.client.widget.layout.VBoxLayoutData) GridEvent(com.extjs.gxt.ui.client.event.GridEvent) AsyncCallback(com.google.gwt.user.client.rpc.AsyncCallback) ArrayList(java.util.ArrayList) RpcProxy(com.extjs.gxt.ui.client.data.RpcProxy) PagingLoadResult(com.extjs.gxt.ui.client.data.PagingLoadResult) NodeColumnConfigList(org.jahia.ajax.gwt.client.widget.NodeColumnConfigList) ArrayList(java.util.ArrayList) List(java.util.List) FitLayout(com.extjs.gxt.ui.client.widget.layout.FitLayout) GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) ColumnModel(com.extjs.gxt.ui.client.widget.grid.ColumnModel) MainModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.MainModule) Module(org.jahia.ajax.gwt.client.widget.edit.mainarea.Module)

Example 5 with Module

use of org.jahia.ajax.gwt.client.widget.edit.mainarea.Module in project jahia by Jahia.

the class ViewStatusActionItem method showLayer.

private void showLayer() {
    List<Module> modules = ModuleHelper.getModules();
    List<Module> list = new ArrayList<Module>();
    for (Module m : modules) {
        if (!m.getPath().endsWith("*")) {
            list.add(m);
        }
    }
    infoLayers.setMainModule(modules.iterator().next());
    before = new HashSet<InfoLayers.InfoLayer>(infoLayers.getContainers());
    viewStatus(list);
}
Also used : ArrayList(java.util.ArrayList) Module(org.jahia.ajax.gwt.client.widget.edit.mainarea.Module)

Aggregations

Module (org.jahia.ajax.gwt.client.widget.edit.mainarea.Module)9 GWTJahiaNode (org.jahia.ajax.gwt.client.data.node.GWTJahiaNode)5 ArrayList (java.util.ArrayList)2 LinkerSelectionContext (org.jahia.ajax.gwt.client.widget.LinkerSelectionContext)2 EditLinker (org.jahia.ajax.gwt.client.widget.edit.EditLinker)2 AreaModule (org.jahia.ajax.gwt.client.widget.edit.mainarea.AreaModule)2 PagingLoadResult (com.extjs.gxt.ui.client.data.PagingLoadResult)1 RpcProxy (com.extjs.gxt.ui.client.data.RpcProxy)1 ComponentEvent (com.extjs.gxt.ui.client.event.ComponentEvent)1 GridEvent (com.extjs.gxt.ui.client.event.GridEvent)1 Listener (com.extjs.gxt.ui.client.event.Listener)1 Margins (com.extjs.gxt.ui.client.util.Margins)1 BoxComponent (com.extjs.gxt.ui.client.widget.BoxComponent)1 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)1 ColumnModel (com.extjs.gxt.ui.client.widget.grid.ColumnModel)1 FitLayout (com.extjs.gxt.ui.client.widget.layout.FitLayout)1 VBoxLayoutData (com.extjs.gxt.ui.client.widget.layout.VBoxLayoutData)1 TreeGridView (com.extjs.gxt.ui.client.widget.treegrid.TreeGridView)1 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)1 FlowPanel (com.google.gwt.user.client.ui.FlowPanel)1