Search in sources :

Example 1 with MainModule

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

the class EngineWindow method setEngine.

public void setEngine(Component component, String header, ButtonBar buttonsBar, GWTJahiaLanguage language, final Linker linker) {
    removeAll();
    add(component);
    setHeadingHtml(header);
    if (buttonsBar != null) {
        setBottomComponent(buttonsBar);
    }
    if (linker instanceof EditLinker || linker instanceof SidePanelLinker) {
        EditLinker editLinker = linker instanceof EditLinker ? (EditLinker) linker : ((SidePanelLinker) linker).getEditLinker();
        if (GXT.isIE) {
            // resize to fit main module area
            MainModule main = editLinker.getMainModule();
            setSize(main.getOffsetWidth(), main.getOffsetHeight());
            Element element = main.getElement();
            setPosition(WindowUtil.getAbsoluteLeft(element), WindowUtil.getAbsoluteTop(element));
            setBorders(false);
        } else if (editLinker.getMainAreaComponent() != null) {
            setContainer(editLinker.getMainAreaComponent().getElement());
        }
    }
}
Also used : EditLinker(org.jahia.ajax.gwt.client.widget.edit.EditLinker) SidePanelLinker(org.jahia.ajax.gwt.client.widget.edit.sidepanel.SidePanelTabItem.SidePanelLinker) Element(com.google.gwt.user.client.Element) MainModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.MainModule)

Example 2 with MainModule

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

the class NodePathActionItem method handleNewMainNodeLoaded.

@Override
public void handleNewMainNodeLoaded(GWTJahiaNode node) {
    String path = node.getPath();
    if (path.startsWith("/sites/" + node.getSiteKey())) {
        path = path.substring(node.getSiteKey().length() + 8);
    }
    text.addStyleName("node-path-text-inner");
    text.setStyleAttribute("color", "");
    text.setText(path);
    if (container.isRendered()) {
        container.getElement().setAttribute("data-nodedisplayname", node.getDisplayName());
        container.getElement().setAttribute("data-nodepath", node.getPath());
    }
    if (linker instanceof EditLinker) {
        MainModule mainModule = ((EditLinker) linker).getMainModule();
        HTML overlayLabel = mainModule.getOverlayLabel();
        if (overlayLabel != null) {
            text.setStyleAttribute("color", mainModule.getOverlayColorText());
            text.setText(text.getText() + " (" + overlayLabel.getText() + ")");
        }
    }
}
Also used : EditLinker(org.jahia.ajax.gwt.client.widget.edit.EditLinker) HTML(com.google.gwt.user.client.ui.HTML) MainModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.MainModule)

Example 3 with MainModule

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

the class InfoLayers method addInfoLayer.

private void addInfoLayer(Module module, String text, String textColor, String bgcolor, final List<LayoutContainer> images, Listener<ComponentEvent> listener, boolean headerOnly, final String opacity) {
    LayoutContainer layoutContainer = new LayoutContainer();
    RootPanel.get().add(layoutContainer);
    if (!(module instanceof MainModule)) {
        Element e = MainModule.getInstance().getInnerElement();
        DOM.appendChild(e, layoutContainer.getElement());
    }
    layoutContainer.el().makePositionable(true);
    layoutContainer.setZIndex(1001);
    LayoutContainer container = module.getContainer();
    El el = container.el();
    Point xy = WindowUtil.getXY(el.dom);
    int w = el.getWidth();
    int h = el.getHeight();
    final boolean header = headerOnly && module instanceof MainModule;
    int totalWidth = 0;
    if (header && module.getHeader() == null) {
        return;
    }
    if (header) {
        if (!module.getHeader().isVisible()) {
            h = 30;
        } else {
            for (Component component : module.getHeader().getTools()) {
                totalWidth += component.el().getSize().width;
            }
            El headerEl = module.getHeader().el();
            xy = WindowUtil.getXY(headerEl.dom);
            w = headerEl.getWidth();
            h = headerEl.getHeight();
            layoutContainer.addStyleName("header-info-layer");
        }
    }
    if (text != null) {
        layoutContainer.setLayout(new CenterLayout());
        HtmlContainer box = new HtmlContainer(text);
        box.addStyleName("x-view-item");
        box.setStyleAttribute("background-color", "white");
        box.setStyleAttribute("color", textColor);
        box.setStyleAttribute("font-weight", "bold");
        box.setStyleAttribute("text-align", "center");
        box.setWidth(250);
        box.setStyleAttribute("white-space", "normal");
        box.setStyleAttribute("position", "absolute");
        layoutContainer.add(box);
    }
    if (!images.isEmpty()) {
        layoutContainer.setLayout(new HBoxLayout());
        for (LayoutContainer image : images) {
            image.setHeight("16px");
            image.setWidth("16px");
            Component item = image.getItem(0);
            item.setHeight("12px");
            item.setWidth("12px");
            item.setStyleAttribute("left", "2px");
            item.setStyleAttribute("top", "2px");
            layoutContainer.add(image);
        }
    }
    if (bgcolor != null) {
        layoutContainer.setBorders(true);
        layoutContainer.setStyleAttribute("background-color", bgcolor);
    }
    layoutContainer.setStyleAttribute("opacity", opacity);
    final InfoLayer infoLayer = new InfoLayer(layoutContainer, xy, w, h, header, images.size());
    position(infoLayer, totalWidth);
    layoutContainer.show();
    containers.add(infoLayer);
    if (listener != null) {
        layoutContainer.sinkEvents(Event.ONCLICK);
        layoutContainer.addListener(Events.OnClick, listener);
    }
}
Also used : LayoutContainer(com.extjs.gxt.ui.client.widget.LayoutContainer) Element(com.google.gwt.user.client.Element) El(com.extjs.gxt.ui.client.core.El) HBoxLayout(com.extjs.gxt.ui.client.widget.layout.HBoxLayout) CenterLayout(com.extjs.gxt.ui.client.widget.layout.CenterLayout) MainModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.MainModule) Point(com.extjs.gxt.ui.client.util.Point) Component(com.extjs.gxt.ui.client.widget.Component) Point(com.extjs.gxt.ui.client.util.Point) HtmlContainer(com.extjs.gxt.ui.client.widget.HtmlContainer)

Example 4 with MainModule

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

the class EmptyEntryPoint method showPageEdit.

public static void showPageEdit(String target, String path, String template, String nodeTypes) {
    final RootPanel panel = RootPanel.get(target);
    panel.add(new MainModule(path, template, nodeTypes, getInstance().getConfiguration()));
}
Also used : RootPanel(com.google.gwt.user.client.ui.RootPanel) MainModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.MainModule)

Example 5 with MainModule

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

the class RenameActionItem method onComponentSelection.

public void onComponentSelection() {
    final GWTJahiaNode selection = linker.getSelectionContext().getSingleSelection();
    if (selection != null) {
        if (selection.isLocked()) {
            Window.alert(selection.getName() + " is locked");
            return;
        }
        MainModule mainModule = MainModule.getInstance();
        final boolean goTo;
        if (mainModule != null) {
            goTo = selection.getPath().equals(mainModule.getNode().getPath());
        } else {
            goTo = false;
        }
        linker.loading(Messages.get("statusbar.renaming.label"));
        String newName = Window.prompt(Messages.get("confirm.newName.label") + " " + selection.getName(), selection.getName());
        if (selection.isNodeType("nt:hierarchyNode") && newName != null && FileUploader.filenameHasInvalidCharacters(newName)) {
            MessageBox.alert(Messages.get("label.error"), Messages.getWithArgs("failure.upload.invalid.filename", "{0} is an invalid name", new String[] { newName }), null);
        } else if (maxNameSize > 0 && newName != null && newName.length() > 0 && newName.length() > maxNameSize) {
            MessageBox.alert(Messages.get("label.error"), Messages.getWithArgs("failure.upload.invalid.filename.toolong", "The name is too long. The maximum length is {0}", new String[] { String.valueOf(maxNameSize) }), null);
        } else if (newName != null && newName.length() > 0 && !newName.equals(selection.getName())) {
            JahiaContentManagementService.App.getInstance().rename(selection.getPath(), newName, new BaseAsyncCallback<GWTJahiaNode>() {

                public void onApplicationFailure(Throwable throwable) {
                    MessageBox.alert(Messages.get("failure.rename.label"), throwable.getLocalizedMessage(), null);
                    linker.loaded();
                }

                public void onSuccess(GWTJahiaNode node) {
                    if (goTo) {
                        linker.setSelectPathAfterDataUpdate(Arrays.asList(node.getPath()));
                    }
                    linker.loaded();
                    Map<String, Object> data = new HashMap<String, Object>();
                    data.put("node", node);
                    if (linker instanceof ManagerLinker) {
                        data.put(Linker.REFRESH_ALL, true);
                    }
                    linker.refresh(data);
                }
            });
        } else {
            linker.loaded();
        }
    }
}
Also used : GWTJahiaNode(org.jahia.ajax.gwt.client.data.node.GWTJahiaNode) ManagerLinker(org.jahia.ajax.gwt.client.widget.content.ManagerLinker) MainModule(org.jahia.ajax.gwt.client.widget.edit.mainarea.MainModule) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

MainModule (org.jahia.ajax.gwt.client.widget.edit.mainarea.MainModule)6 Element (com.google.gwt.user.client.Element)2 GWTJahiaNode (org.jahia.ajax.gwt.client.data.node.GWTJahiaNode)2 EditLinker (org.jahia.ajax.gwt.client.widget.edit.EditLinker)2 El (com.extjs.gxt.ui.client.core.El)1 Point (com.extjs.gxt.ui.client.util.Point)1 Component (com.extjs.gxt.ui.client.widget.Component)1 HtmlContainer (com.extjs.gxt.ui.client.widget.HtmlContainer)1 LayoutContainer (com.extjs.gxt.ui.client.widget.LayoutContainer)1 CenterLayout (com.extjs.gxt.ui.client.widget.layout.CenterLayout)1 HBoxLayout (com.extjs.gxt.ui.client.widget.layout.HBoxLayout)1 HTML (com.google.gwt.user.client.ui.HTML)1 RootPanel (com.google.gwt.user.client.ui.RootPanel)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 BaseAsyncCallback (org.jahia.ajax.gwt.client.core.BaseAsyncCallback)1 ManagerLinker (org.jahia.ajax.gwt.client.widget.content.ManagerLinker)1 SidePanelLinker (org.jahia.ajax.gwt.client.widget.edit.sidepanel.SidePanelTabItem.SidePanelLinker)1