use of org.jahia.ajax.gwt.client.widget.edit.EditLinker 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.EditLinker in project jahia by Jahia.
the class LayoutTabItem method attachPropertiesEditor.
@Override
public void attachPropertiesEditor(final NodeHolder engine, final AsyncTabItem tab) {
if (engine.getNode() != null && engine.getLinker() instanceof EditLinker) {
final PropertiesEditor.PropertyAdapterField templateField = propertiesEditor.getFieldsMap().get("j:view");
final PropertiesEditor.PropertyAdapterField skinField = propertiesEditor.getFieldsMap().get("j:skin");
final PropertiesEditor.PropertyAdapterField subNodesViewField = propertiesEditor.getFieldsMap().get("j:subNodesView");
listener = new SelectionChangedListener<GWTJahiaValueDisplayBean>() {
public void selectionChanged(SelectionChangedEvent<GWTJahiaValueDisplayBean> se) {
Map<String, List<String>> contextParams = new HashMap<String, List<String>>();
if (skinField != null && skinField.getValue() != null) {
contextParams.put("forcedSkin", Arrays.asList(((ComboBox<GWTJahiaValueDisplayBean>) skinField.getField()).getValue().getValue()));
}
if (subNodesViewField != null && subNodesViewField.getValue() != null) {
contextParams.put("forcedSubNodesTemplate", Arrays.asList(((ComboBox<GWTJahiaValueDisplayBean>) subNodesViewField.getField()).getValue().getValue()));
}
String template = (templateField != null && templateField.getValue() != null) ? ((ComboBox<GWTJahiaValueDisplayBean>) templateField.getField()).getValue().getValue() : null;
if (engine.getNode() != null) {
JahiaContentManagementService.App.getInstance().getRenderedContent(engine.getNode().getPath(), null, LayoutTabItem.this.language, template, "preview", contextParams, false, null, null, null, new BaseAsyncCallback<GWTRenderResult>() {
public void onSuccess(GWTRenderResult result) {
HTML html = new HTML(result.getResult());
setHTML(html);
tab.layout();
}
});
} else {
setHTML(null);
}
}
};
if (templateField != null) {
((ComboBox<GWTJahiaValueDisplayBean>) templateField.getField()).addSelectionChangedListener(listener);
}
if (skinField != null) {
((ComboBox<GWTJahiaValueDisplayBean>) skinField.getField()).addSelectionChangedListener(listener);
}
if (subNodesViewField != null) {
((ComboBox<GWTJahiaValueDisplayBean>) subNodesViewField.getField()).addSelectionChangedListener(listener);
}
tab.setLayout(new FillLayout());
if (ctn == null) {
ctn = new LayoutContainer(new FitLayout());
tab.add(ctn);
htmlPreview = new LayoutContainer();
htmlPreview.addStyleName(cssWrapper);
htmlPreview.setStyleAttribute("background-color", "white");
FieldSet f = new FieldSet();
f.addStyleName("x-panel");
f.setHeadingHtml(Messages.get("label.preview", "Preview"));
f.setScrollMode(Style.Scroll.AUTO);
f.add(htmlPreview);
tab.add(f);
}
ctn.add(propertiesEditor);
} else {
super.attachPropertiesEditor(engine, tab);
}
}
use of org.jahia.ajax.gwt.client.widget.edit.EditLinker in project jahia by Jahia.
the class SwitchModeActionItem method handleNewLinkerSelection.
public void handleNewLinkerSelection() {
if (showOpenInNewWindowSubmenu) {
Menu m = new Menu();
MenuItem menuItem = new MenuItem(Messages.get("label.openInNewWindow", "Open in new window"));
menuItem.setIcon(ToolbarIconProvider.getInstance().getIcon("openWindow"));
menuItem.addStyleName(getGwtToolbarItem().getClassName() + "-openWindow");
menuItem.addSelectionListener(new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
onComponentSelection(true);
}
});
m.add(menuItem);
setSubMenu(m);
}
final String workspace = getPropertyValue(getGwtToolbarItem(), "workspace");
if ((linker instanceof EditLinker && ((EditLinker) linker).isInSettingsPage()) || !hasPermission(linker.getSelectionContext().getMainNode()) || !isNodeTypeAllowed(linker.getSelectionContext().getMainNode())) {
setEnabled(false);
} else {
if (workspace.equalsIgnoreCase("live")) {
final GWTJahiaNode node = linker.getSelectionContext().getMainNode();
if (node == null) {
setEnabled(false);
} else {
GWTJahiaPublicationInfo publicationInfo = node.getAggregatedPublicationInfo() != null ? node.getAggregatedPublicationInfo() : node.getQuickPublicationInfo();
if (publicationInfo.getStatus() == GWTJahiaPublicationInfo.NOT_PUBLISHED || publicationInfo.getStatus() == GWTJahiaPublicationInfo.UNPUBLISHED) {
setEnabled(false);
} else {
setEnabled(true);
}
}
} else {
setEnabled(true);
}
}
}
use of org.jahia.ajax.gwt.client.widget.edit.EditLinker in project jahia by Jahia.
the class UndeleteActionItem method onComponentSelection.
@Override
public void onComponentSelection() {
final LinkerSelectionContext lh = linker.getSelectionContext();
if (!lh.getMultipleSelection().isEmpty()) {
String message = null;
if (lh.getMultipleSelection().size() > 1) {
message = Messages.getWithArgs("message.undelete.multiple.confirm", "Do you really want to undelete the {0} selected resources?", new String[] { String.valueOf(lh.getMultipleSelection().size()) });
} else {
message = Messages.getWithArgs("message.undelete.confirm", "Do you really want to undelete the selected resource {0}?", new String[] { lh.getSingleSelection().getDisplayName() });
}
MessageBox.confirm(Messages.get("label.information", "Information"), message, new Listener<MessageBoxEvent>() {
public void handleEvent(MessageBoxEvent be) {
if (be.getButtonClicked().getItemId().equalsIgnoreCase(Dialog.YES)) {
final List<String> l = new ArrayList<String>();
for (GWTJahiaNode node : lh.getMultipleSelection()) {
l.add(node.getPath());
}
JahiaContentManagementService.App.getInstance().undeletePaths(l, new BaseAsyncCallback() {
@Override
public void onApplicationFailure(Throwable throwable) {
Log.error(throwable.getMessage(), throwable);
MessageBox.alert(Messages.get("label.error", "Error"), throwable.getMessage(), null);
}
public void onSuccess(Object result) {
EditLinker el = null;
if (linker instanceof SidePanelTabItem.SidePanelLinker) {
el = ((SidePanelTabItem.SidePanelLinker) linker).getEditLinker();
} else if (linker instanceof EditLinker) {
el = (EditLinker) linker;
}
Map<String, Object> data = new HashMap<String, Object>();
if (el != null && l.contains(el.getSelectionContext().getMainNode().getPath())) {
data.put("node", el.getSelectionContext().getMainNode());
} else {
data.put(Linker.REFRESH_ALL, true);
}
linker.refresh(data);
}
});
}
}
});
}
}
use of org.jahia.ajax.gwt.client.widget.edit.EditLinker in project jahia by Jahia.
the class ChannelDisplayActionItem method initMainComponent.
/**
* init main component
*/
private void initMainComponent() {
final ComboBox<GWTJahiaChannel> comboBox = new ComboBox<GWTJahiaChannel>();
comboBox.setDisplayField("display");
comboBox.setTriggerAction(ComboBox.TriggerAction.ALL);
comboBox.setStore(new ListStore<GWTJahiaChannel>());
comboBox.getStore().add(JahiaGWTParameters.getChannels());
comboBox.setTemplate(getChannelTemplate());
comboBox.setItemSelector("div.thumb-wrap");
comboBox.addSelectionChangedListener(new SelectionChangedListener<GWTJahiaChannel>() {
@Override
public void selectionChanged(SelectionChangedEvent<GWTJahiaChannel> event) {
GWTJahiaChannel selectedChannel = event.getSelectedItem();
if (linker instanceof EditLinker) {
((EditLinker) linker).getMainModule().switchChannel(selectedChannel, null);
}
}
});
horizontalPanel = new HorizontalPanel();
horizontalPanel.add(comboBox);
horizontalPanel.addStyleName(getGwtToolbarItem().getClassName());
horizontalPanel.addStyleName("action-bar-menu-item");
setEnabled(true);
}
Aggregations