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);
}
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);
}
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);
}
}
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;
}
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);
}
Aggregations