use of com.extjs.gxt.ui.client.widget.Window in project jahia by Jahia.
the class ContentBrowseTabItem method create.
@Override
public TabItem create(final GWTSidePanelTab config) {
super.create(config);
contentContainer = new LayoutContainer();
contentContainer.setBorders(true);
contentContainer.setScrollMode(Style.Scroll.AUTO);
contentContainer.setLayout(new FitLayout());
// data proxy
final List<String> loadedNodeTypes = new ArrayList<String>();
loadedNodeTypes.addAll(JCRClientUtils.FILE_NODETYPES);
loadedNodeTypes.addAll(JCRClientUtils.CONTENT_NODETYPES);
RpcProxy<PagingLoadResult<GWTJahiaNode>> listProxy = getPagingLoadResultRpcProxy(config, loadedNodeTypes);
listLoader = new BaseListLoader<>(listProxy);
listLoader.addLoadListener(new LoadListener() {
@Override
public void loaderLoad(LoadEvent le) {
if (!le.isCancelled()) {
contentContainer.unmask();
}
}
});
contentStore = new ListStore<GWTJahiaNode>(listLoader);
contentStore.setStoreSorter(new StoreSorter<GWTJahiaNode>(new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
if (o1 instanceof String && o2 instanceof String) {
String s1 = (String) o1;
String s2 = (String) o2;
return Collator.getInstance().localeCompare(s1, s2);
} else if (o1 instanceof Comparable && o2 instanceof Comparable) {
return ((Comparable) o1).compareTo(o2);
}
return 0;
}
}));
addSelectionChangedListener();
tree.setContextMenu(createContextMenu(config.getTreeContextMenu(), tree.getSelectionModel()));
VBoxLayoutData contentVBoxData = new VBoxLayoutData();
contentVBoxData.setFlex(2);
if (config.getTableColumns().size() == 1) {
listView = new ThumbsListView(true);
listView.setStyleAttribute("overflow-x", "hidden");
listView.setStore(contentStore);
contentStore.setSortField("display");
listView.addListener(Events.DoubleClick, new Listener<ListViewEvent<GWTJahiaNode>>() {
@Override
public void handleEvent(ListViewEvent<GWTJahiaNode> be) {
Window w = new Window();
w.addStyleName("content-browse-preview");
GWTJahiaNode node = listView.getSelectionModel().getSelectedItem();
final String text = "Preview of " + node.getDisplayName();
w.setHeadingHtml(text);
w.setScrollMode(Style.Scroll.AUTO);
w.setModal(true);
w.setClosable(true);
w.setMaximizable(true);
w.setSize(Math.max(Integer.parseInt((String) node.get("j:width")) + 60, 400), Math.max(Integer.parseInt((String) node.get("j:height")) + 80, 50));
w.setBlinkModal(true);
w.setPlain(true);
w.setToolTip(text);
w.setLayout(new CenterLayout());
w.add(new Image(listView.getSelectionModel().getSelectedItem().getUrl()));
w.show();
}
});
listView.setContextMenu(createContextMenu(config.getTableContextMenu(), listView.getSelectionModel()));
contentContainer.add(listView);
} else {
NodeColumnConfigList displayColumns = new NodeColumnConfigList(config.getTableColumns(), true);
grid = new Grid<GWTJahiaNode>(contentStore, new ColumnModel(displayColumns));
grid.setAutoExpandColumn(displayColumns.getAutoExpand());
contentContainer.add(grid);
grid.setContextMenu(createContextMenu(config.getTableContextMenu(), grid.getSelectionModel()));
}
contentVBoxData = new VBoxLayoutData();
contentVBoxData.setFlex(2);
tab.add(contentContainer, contentVBoxData);
tab.setId("JahiaGxtContentBrowseTab");
return tab;
}
use of com.extjs.gxt.ui.client.widget.Window in project jahia by Jahia.
the class FileImagesBrowseTabItem method create.
@Override
public TabItem create(GWTSidePanelTab config) {
super.create(config);
contentContainer = new LayoutContainer();
contentContainer.setId("images-view");
contentContainer.setBorders(true);
contentContainer.setScrollMode(Style.Scroll.AUTOY);
contentContainer.setLayout(new FitLayout());
// data proxy
RpcProxy<PagingLoadResult<GWTJahiaNode>> listProxy = new RpcProxy<PagingLoadResult<GWTJahiaNode>>() {
@Override
protected void load(Object gwtJahiaFolder, AsyncCallback<PagingLoadResult<GWTJahiaNode>> listAsyncCallback) {
if (gwtJahiaFolder != null) {
String path = ((GWTJahiaNode) gwtJahiaFolder).getPath();
Log.debug("retrieving children of " + path);
JahiaContentManagementService.App.getInstance().lsLoad(path, JCRClientUtils.FILE_NODETYPES, null, null, Arrays.asList(GWTJahiaNode.PERMISSIONS, GWTJahiaNode.ICON, GWTJahiaNode.PUBLICATION_INFO, GWTJahiaNode.THUMBNAILS, GWTJahiaNode.TAGS, "j:width", "j:height"), false, -1, -1, false, null, null, false, false, listAsyncCallback);
} else {
contentContainer.unmask();
}
}
};
listLoader = new BaseListLoader<ListLoadResult<GWTJahiaNode>>(listProxy);
listLoader.addLoadListener(new LoadListener() {
@Override
public void loaderLoad(LoadEvent le) {
if (!le.isCancelled()) {
contentContainer.unmask();
}
}
});
contentStore = new ListStore<GWTJahiaNode>(listLoader);
contentStore.setStoreSorter(new StoreSorter<GWTJahiaNode>(new Comparator<Object>() {
@Override
public int compare(Object o1, Object o2) {
if (o1 instanceof String && o2 instanceof String) {
String s1 = (String) o1;
String s2 = (String) o2;
return Collator.getInstance().localeCompare(s1, s2);
} else if (o1 instanceof Comparable && o2 instanceof Comparable) {
return ((Comparable) o1).compareTo(o2);
}
return 0;
}
}));
tree.getSelectionModel().addSelectionChangedListener(new SelectionChangedListener<GWTJahiaNode>() {
@Override
public void selectionChanged(SelectionChangedEvent<GWTJahiaNode> event) {
contentContainer.mask(Messages.get("label.loading", "Loading..."), "x-mask-loading");
listLoader.load(event.getSelectedItem());
}
});
tree.setContextMenu(createContextMenu(config.getTreeContextMenu(), tree.getSelectionModel()));
listView = new ThumbsListView(true);
listView.setStyleAttribute("overflow-x", "hidden");
listView.setStore(contentStore);
contentStore.setSortField("display");
contentContainer.add(listView);
VBoxLayoutData contentVBoxData = new VBoxLayoutData();
contentVBoxData.setFlex(2);
tab.add(contentContainer, contentVBoxData);
listView.addListener(Events.DoubleClick, new Listener<ListViewEvent<GWTJahiaNode>>() {
@Override
public void handleEvent(ListViewEvent<GWTJahiaNode> be) {
Window w = new Window();
w.addStyleName("fileimage-browse-preview");
GWTJahiaNode node = listView.getSelectionModel().getSelectedItem();
final String text = "Preview of " + node.getDisplayName();
w.setHeadingHtml(text);
w.setScrollMode(Style.Scroll.AUTO);
w.setModal(true);
w.setClosable(true);
w.setMaximizable(true);
w.setSize(Math.max(Integer.parseInt((String) node.get("j:width")) + 60, 400), Math.max(Integer.parseInt((String) node.get("j:height")) + 80, 50));
w.setBlinkModal(true);
w.setPlain(true);
w.setToolTip(text);
w.setLayout(new CenterLayout());
w.add(new Image(listView.getSelectionModel().getSelectedItem().getUrl()));
w.show();
}
});
listView.setContextMenu(createContextMenu(config.getTableContextMenu(), listView.getSelectionModel()));
tab.setId("JahiaGxtFileImagesBrowseTab");
return tab;
}
use of com.extjs.gxt.ui.client.widget.Window in project jahia by Jahia.
the class NodeUsagesGrid method createUsageGrid.
public static Grid<GWTJahiaNodeUsage> createUsageGrid(final List<GWTJahiaNode> nodes, final String baseUsageUrl) {
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
ColumnConfig col = new ColumnConfig("pagePath", Messages.get("label.pageUrl", "Page URL"), 200);
col.setRenderer(new GridCellRenderer<GWTJahiaNodeUsage>() {
@Override
public Object render(GWTJahiaNodeUsage gwtJahiaNodeUsage, String s, ColumnData columnData, int i, int i1, ListStore<GWTJahiaNodeUsage> gwtJahiaNodeUsageListStore, com.extjs.gxt.ui.client.widget.grid.Grid<GWTJahiaNodeUsage> gwtJahiaNodeUsageGrid) {
if (gwtJahiaNodeUsage.getLanguage() == null) {
return "<a href=\"" + baseUsageUrl + gwtJahiaNodeUsage.getPagePath() + ".html\" target=\"_blank\">" + gwtJahiaNodeUsage.getPageTitle() + "<a>";
} else {
return "<a href=\"" + baseUsageUrl + "/../" + gwtJahiaNodeUsage.getLanguage() + gwtJahiaNodeUsage.getPagePath() + ".html\" target=\"_blank\">" + gwtJahiaNodeUsage.getPageTitle() + " (" + gwtJahiaNodeUsage.getLanguage() + ")<a>";
}
}
});
columns.add(col);
col = new ColumnConfig("path", Messages.get("label.path", "URL"), 600);
columns.add(col);
ColumnModel cm = new ColumnModel(columns);
final ListStore<GWTJahiaNodeUsage> usageStore = new ListStore<GWTJahiaNodeUsage>(new BaseListLoader(new RpcProxy<List<GWTJahiaNodeUsage>>() {
@Override
protected void load(Object loadConfig, final AsyncCallback<List<GWTJahiaNodeUsage>> asyncCallback) {
List<String> paths = new ArrayList<String>();
for (GWTJahiaNode selectedNode : nodes) {
paths.add(selectedNode.getPath());
}
instance.getUsages(paths, new BaseAsyncCallback<List<GWTJahiaNodeUsage>>() {
@Override
public void onApplicationFailure(Throwable throwable) {
Log.debug("Cannot retrieve usages", throwable);
}
@Override
public void onSuccess(List<GWTJahiaNodeUsage> gwtJahiaNodeUsages) {
asyncCallback.onSuccess(gwtJahiaNodeUsages);
}
});
}
}));
final Grid<GWTJahiaNodeUsage> tbl = new Grid<GWTJahiaNodeUsage>(usageStore, cm);
tbl.addListener(Events.RowDoubleClick, new Listener<GridEvent<?>>() {
@Override
public void handleEvent(GridEvent<?> tableEvent) {
Object url = tableEvent.getModel().get("path");
if (url != null && url instanceof String) {
instance.getRenderedContent((String) url, null, JahiaGWTParameters.getUILanguage(), null, "module", null, false, null, null, null, new BaseAsyncCallback<GWTRenderResult>() {
@Override
public void onSuccess(GWTRenderResult result) {
HTML html = new HTML(result.getResult());
Window w = new Window();
w.addStyleName("node-usage-dblclick-preview");
w.setScrollMode(Style.Scroll.AUTO);
w.setModal(true);
w.setClosable(true);
w.setMaximizable(true);
w.setSize(800, 600);
w.setBlinkModal(true);
w.setPlain(true);
w.setLayout(new CenterLayout());
w.add(html);
w.show();
}
});
}
}
});
usageStore.getLoader().load();
return tbl;
}
use of com.extjs.gxt.ui.client.widget.Window in project jahia by Jahia.
the class PortletDefinitionField method onTriggerClick.
@Override
protected void onTriggerClick(ComponentEvent componentEvent) {
super.onTriggerClick(componentEvent);
if (disabled || isReadOnly()) {
return;
}
final Window w = new Window();
w.addStyleName("portlet-definition-window");
w.setLayout(new FitLayout());
final PortletDefinitionCard card = new PortletDefinitionCard();
w.setModal(true);
w.setSize(600, 400);
ButtonBar bar = new ButtonBar();
Button ok = new Button(Messages.get("org.jahia.engines.PortletsManager.wizard.ok.label", "OK"), new SelectionListener<ButtonEvent>() {
@Override
public void componentSelected(ButtonEvent event) {
GWTJahiaPortletDefinition def = card.getSelectedPortletDefinition();
setRawValue(def.getDefinitionName());
w.hide();
}
});
ok.addStyleName("button-ok");
bar.add(ok);
w.setTopComponent(bar);
w.add(card);
w.show();
}
Aggregations