use of org.jahia.ajax.gwt.client.data.GWTJahiaLanguage in project jahia by Jahia.
the class CreateButtonItem method continuePrepareAndSave.
protected void continuePrepareAndSave(final AbstractContentEngine engine, final boolean closeAfterSave, String nodeName) {
GWTJahiaNodeACL newNodeACL = new GWTJahiaNodeACL();
List<GWTJahiaNode> children = new ArrayList<GWTJahiaNode>();
newNodeACL.setAce(new ArrayList<GWTJahiaNodeACE>());
final Set<String> addedTypes = new HashSet<String>();
for (TabItem tab : engine.getTabs().getItems()) {
EditEngineTabItem item = tab.getData("item");
if (item instanceof ContentTabItem) {
if (((ContentTabItem) item).isNodeNameFieldDisplayed()) {
nodeName = ((ContentTabItem) item).getName().getValue();
}
final List<CheckBox> values = ((ContentTabItem) item).getCheckedLanguagesCheckBox();
if (values != null) {
// Checkboxes are not null so they are displayed, if list is empty this means that this
// content is not visible in any language
final List<GWTJahiaLanguage> siteLanguages = JahiaGWTParameters.getSiteLanguages();
if (values.size() != siteLanguages.size()) {
List<String> strings = new ArrayList<String>(siteLanguages.size());
for (GWTJahiaLanguage siteLanguage : siteLanguages) {
strings.add(siteLanguage.getLanguage());
}
GWTJahiaNodeProperty gwtJahiaNodeProperty = new GWTJahiaNodeProperty();
gwtJahiaNodeProperty.setName("j:invalidLanguages");
gwtJahiaNodeProperty.setMultiple(true);
for (CheckBox value : values) {
if (value.getValue()) {
strings.remove(value.getValueAttribute());
}
}
if (strings.size() > 0) {
gwtJahiaNodeProperty.setValues(new ArrayList<GWTJahiaNodePropertyValue>());
for (String string : strings) {
gwtJahiaNodeProperty.getValues().add(new GWTJahiaNodePropertyValue(string));
}
}
final List<GWTJahiaNodePropertyValue> gwtJahiaNodePropertyValues = gwtJahiaNodeProperty.getValues();
if (gwtJahiaNodePropertyValues != null && gwtJahiaNodePropertyValues.size() > 0) {
engine.getChangedProperties().add(gwtJahiaNodeProperty);
addedTypes.add("jmix:i18n");
}
}
}
}
item.doSave(engine.getNode(), engine.getChangedProperties(), engine.getChangedI18NProperties(), addedTypes, new HashSet<String>(), children, newNodeACL);
}
doSave((CreateContentEngine) engine, nodeName, engine.getChangedProperties(), engine.getChangedI18NProperties(), new ArrayList<String>(addedTypes), children, newNodeACL, closeAfterSave);
}
use of org.jahia.ajax.gwt.client.data.GWTJahiaLanguage in project jahia by Jahia.
the class TranslateMenuActionItem method initMenu.
private void initMenu(final Linker linker) {
boolean notEmpty = false;
menu.removeAll();
final String currentLanguage = JahiaGWTParameters.getLanguage();
for (final GWTJahiaLanguage sourceLang : JahiaGWTParameters.getSiteLanguages()) {
for (final GWTJahiaLanguage destLang : JahiaGWTParameters.getSiteLanguages()) {
if (!destLang.getDisplayName().equals(sourceLang.getDisplayName()) && (destLang.getLanguage().equals(currentLanguage) || sourceLang.getLanguage().equals(currentLanguage))) {
final LinkerSelectionContext lh = linker.getSelectionContext();
if (PermissionsUtils.isPermitted("jcr:modifyProperties_" + JahiaGWTParameters.getWorkspace() + "_" + destLang.getLanguage(), lh.getSelectionPermissions())) {
final GWTJahiaNode selection = lh.getSingleSelection();
if (selection != null && (!selection.isLocked() || !selection.getLockInfos().containsKey(destLang.getLanguage()))) {
MenuItem item = new MenuItem(sourceLang.getDisplayName() + "->" + destLang.getDisplayName());
item.addSelectionListener(new SelectionListener<MenuEvent>() {
@Override
public void componentSelected(MenuEvent ce) {
new TranslateContentEngine(selection, linker, sourceLang, destLang).show();
}
});
item.addStyleName("toolbar-item-translatemenu-item");
menu.add(item);
notEmpty = true;
}
}
}
}
}
if (notEmpty) {
setSubMenu(menu);
}
setEnabled(notEmpty);
}
use of org.jahia.ajax.gwt.client.data.GWTJahiaLanguage in project jahia by Jahia.
the class PublicationWorkflow method openPublicationWorkflow.
public static void openPublicationWorkflow(List<String> uuids, final Linker linker, final boolean allSubTree, final boolean allLanguages, final boolean checkForUnpublication) {
BaseAsyncCallback<List<GWTJahiaPublicationInfo>> asyncCallback = new OpenPublicationWorkflowCallback(linker, checkForUnpublication);
// todo
if (!allLanguages) {
JahiaContentManagementService.App.getInstance().getPublicationInfo(uuids, allSubTree, checkForUnpublication, asyncCallback);
} else {
Set<String> languages = new HashSet<>();
for (GWTJahiaLanguage gwtJahiaLanguage : JahiaGWTParameters.getSiteLanguages()) {
if (Boolean.TRUE.equals(gwtJahiaLanguage.isActive())) {
languages.add(gwtJahiaLanguage.getLanguage());
}
}
JahiaContentManagementService.App.getInstance().getPublicationInfo(uuids, allSubTree, checkForUnpublication, languages, asyncCallback);
}
}
use of org.jahia.ajax.gwt.client.data.GWTJahiaLanguage in project jahia by Jahia.
the class PublicationManagerEngine method init.
/**
* init
*/
private void init() {
setHeadingHtml(Messages.get("label.publicationmanager", "Publication Manager"));
setLayout(new FitLayout());
setSize(800, 600);
setBorders(false);
setBodyBorder(false);
setModal(true);
setMaximizable(true);
getHeader().setBorders(false);
getHeader().setIcon(ToolbarIconProvider.getInstance().getIcon("siteRepository"));
// tree component
GWTJahiaNodeTreeFactory factory = new GWTJahiaNodeTreeFactory(Arrays.asList("/sites/" + linker.getSelectionContext().getMainNode().getSiteKey()), true);
factory.setNodeTypes(nodeTypes);
factory.setFields(Arrays.asList(GWTJahiaNode.NAME, GWTJahiaNode.DISPLAY_NAME, GWTJahiaNode.PUBLICATION_INFOS, GWTJahiaNode.WORKFLOW_INFOS));
factory.setSelectedPath(linker.getSelectionContext().getMainNode().getPath());
loader = factory.getLoader();
List<ColumnConfig> columns = new LinkedList<ColumnConfig>();
ColumnConfig config = new ColumnConfig("displayName", Messages.get("label.name", "Name"), 150);
config.setRenderer(NodeColumnConfigList.NAME_TREEGRID_RENDERER);
config.setSortable(false);
columns.add(config);
checkboxMap = new HashMap<String, LayoutContainer>();
for (GWTJahiaLanguage language : languages) {
config = new PublicationCheckColumnConfig("publicationInfos", language.getDisplayName(), 100);
config.setDataIndex(language.getLanguage());
config.setSortable(false);
TableData td = new TableData();
td.setHorizontalAlign(Style.HorizontalAlignment.CENTER);
td.setVerticalAlign(Style.VerticalAlignment.MIDDLE);
HorizontalPanel p = new HorizontalPanel();
// final LayoutContainer ctn = new LayoutContainer();
// ctn.addStyleName("x-grid3-check-col");
// ctn.setWidth(16);
// ctn.setHeight(16);
// p.add(ctn,td);
p.add(new Text(language.getDisplayName()), td);
config.setWidget(p, language.getLanguage());
// checkboxMap.put(language.getLanguage(), ctn);
columns.add(config);
}
ColumnModel cm = new ColumnModel(columns);
// cm.addHeaderGroup(0, 1, new HeaderGroupConfig("Publication Info", 1, columns.size() - 1));
m_tree = factory.getTreeGrid(cm);
for (ColumnConfig column : columns) {
if (column instanceof CheckColumnConfig) {
m_tree.addPlugin((ComponentPlugin) column);
}
}
m_tree.setHideHeaders(false);
m_tree.setIconProvider(ContentModelIconProvider.getInstance());
m_tree.setAutoExpand(false);
m_tree.setAutoExpandMax(1000);
m_tree.setAutoExpandMin(150);
m_tree.setAutoExpandColumn("displayName");
m_tree.setBorders(true);
setScrollMode(Style.Scroll.AUTO);
add(m_tree);
ButtonBar buttonBar = new ButtonBar();
buttonBar.setAlignment(Style.HorizontalAlignment.CENTER);
Button button = new Button(Messages.get("label.publish", "Publish"));
button.addStyleName("button-publish");
buttonBar.add(button);
Button cancelButton = new Button(Messages.get("label.cancel", "Cancel"));
cancelButton.addStyleName("button-cancel");
buttonBar.add(cancelButton);
setBottomComponent(buttonBar);
m_tree.mask(Messages.get("label.loading", "Loading..."), "x-mask-loading");
loader.addLoadListener(new LoadListener() {
public void loaderLoad(LoadEvent le) {
m_tree.unmask();
}
});
loader.load();
cancelButton.addListener(Events.Select, new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent ce) {
hide();
}
});
button.addSelectionListener(new StartWorkflowButtonSelectionListener(this));
}
use of org.jahia.ajax.gwt.client.data.GWTJahiaLanguage in project jahia by Jahia.
the class LanguageSwitcherActionItem method updateSite.
private void updateSite() {
if (!JahiaGWTParameters.getSiteLanguages().equals(mainComponent.getStore().getModels())) {
events = false;
mainComponent.getStore().removeAll();
mainComponent.reset();
mainComponent.getStore().add(JahiaGWTParameters.getSiteLanguages());
mainComponent.getListView().getSelectionModel().setSelectionMode(Style.SelectionMode.SINGLE);
if (mainComponent.getSelection().isEmpty() || !JahiaGWTParameters.getLanguage().equals(mainComponent.getSelection().get(0).getLanguage())) {
// The getSelection() call above filters the store, so we explicitly clear the filters after that.
mainComponent.getStore().clearFilters();
for (GWTJahiaLanguage language : JahiaGWTParameters.getSiteLanguages()) {
if (language.getLanguage().equals(JahiaGWTParameters.getLanguage())) {
mainComponent.setSelection(Arrays.asList(language));
break;
}
}
}
events = true;
if (!JahiaGWTParameters.getSiteLanguages().contains(mainComponent.getSelection().get(0))) {
mainComponent.setSelection(Arrays.asList((GWTJahiaLanguage) JahiaGWTParameters.getSiteNode().get("j:defaultLanguage")));
}
}
if (!JahiaGWTParameters.getLanguage().equals(mainComponent.getSelection().get(0).getLanguage())) {
events = false;
GWTJahiaLanguage language = JahiaGWTParameters.getLanguage(JahiaGWTParameters.getLanguage());
if (language != null) {
mainComponent.setSelection(Arrays.asList(language));
}
events = true;
}
}
Aggregations