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