001/* 002 * This library is part of OpenCms - 003 * the Open Source Content Management System 004 * 005 * Copyright (c) Alkacon Software GmbH & Co. KG (http://www.alkacon.com) 006 * 007 * This library is free software; you can redistribute it and/or 008 * modify it under the terms of the GNU Lesser General Public 009 * License as published by the Free Software Foundation; either 010 * version 2.1 of the License, or (at your option) any later version. 011 * 012 * This library is distributed in the hope that it will be useful, 013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 015 * Lesser General Public License for more details. 016 * 017 * For further information about Alkacon Software, please see the 018 * company website: http://www.alkacon.com 019 * 020 * For further information about OpenCms, please see the 021 * project website: http://www.opencms.org 022 * 023 * You should have received a copy of the GNU Lesser General Public 024 * License along with this library; if not, write to the Free Software 025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 026 */ 027 028package org.opencms.ade.sitemap.client.edit; 029 030import org.opencms.ade.sitemap.client.CmsSitemapView; 031import org.opencms.ade.sitemap.client.Messages; 032import org.opencms.ade.sitemap.client.ui.css.I_CmsSitemapLayoutBundle; 033import org.opencms.ade.sitemap.shared.CmsLocaleComparePropertyData; 034import org.opencms.ade.sitemap.shared.rpc.I_CmsSitemapServiceAsync; 035import org.opencms.gwt.client.property.CmsReloadMode; 036import org.opencms.gwt.client.property.I_CmsPropertyEditorHandler; 037import org.opencms.gwt.client.rpc.CmsRpcAction; 038import org.opencms.gwt.client.util.CmsJsUtil; 039import org.opencms.gwt.shared.CmsGwtConstants; 040import org.opencms.gwt.shared.CmsListInfoBean; 041import org.opencms.gwt.shared.property.CmsClientProperty; 042import org.opencms.gwt.shared.property.CmsClientTemplateBean; 043import org.opencms.gwt.shared.property.CmsPropertyModification; 044import org.opencms.util.CmsUUID; 045 046import java.util.List; 047import java.util.Map; 048 049/** 050 * Property submission handler for the sitemap editor's locale comparison mode.<p> 051 */ 052public class CmsLocaleComparePropertyHandler implements I_CmsPropertyEditorHandler { 053 054 /** The property data loaded from the server. */ 055 private CmsLocaleComparePropertyData m_data; 056 057 /** The page information. */ 058 private CmsListInfoBean m_pageInfo; 059 060 /** 061 * Creates a new instance.<p> 062 * 063 * @param data the property data loaded from the server 064 */ 065 public CmsLocaleComparePropertyHandler(CmsLocaleComparePropertyData data) { 066 067 m_data = data; 068 } 069 070 /** 071 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getAllPropertyNames() 072 */ 073 public List<String> getAllPropertyNames() { 074 075 return CmsSitemapView.getInstance().getController().getData().getAllPropertyNames(); 076 077 } 078 079 /** 080 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getDefaultFileId() 081 */ 082 public CmsUUID getDefaultFileId() { 083 084 return m_data.getDefaultFileId(); 085 } 086 087 /** 088 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getDefaultFileProperties() 089 */ 090 public Map<String, CmsClientProperty> getDefaultFileProperties() { 091 092 return m_data.getDefaultFileProperties(); 093 } 094 095 /** 096 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getDialogTitle() 097 */ 098 public String getDialogTitle() { 099 100 return Messages.get().key(Messages.GUI_PROPERTY_EDITOR_TITLE_0); 101 } 102 103 /** 104 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getForbiddenUrlNames() 105 */ 106 public List<String> getForbiddenUrlNames() { 107 108 return m_data.getForbiddenUrlNames(); 109 } 110 111 /** 112 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getId() 113 */ 114 public CmsUUID getId() { 115 116 return m_data.getId(); 117 } 118 119 /** 120 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getInheritedProperty(java.lang.String) 121 */ 122 public CmsClientProperty getInheritedProperty(String name) { 123 124 return m_data.getInheritedProperty(name); 125 } 126 127 /** 128 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getModeClass() 129 */ 130 public String getModeClass() { 131 132 return I_CmsSitemapLayoutBundle.INSTANCE.sitemapItemCss().navMode(); 133 } 134 135 /** 136 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getName() 137 */ 138 public String getName() { 139 140 return m_data.getName(); 141 142 } 143 144 /** 145 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getOwnProperties() 146 */ 147 public Map<String, CmsClientProperty> getOwnProperties() { 148 149 return m_data.getOwnProperties(); 150 } 151 152 /** 153 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getPageInfo() 154 */ 155 public CmsListInfoBean getPageInfo() { 156 157 return m_pageInfo; 158 } 159 160 /** 161 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getPath() 162 */ 163 public String getPath() { 164 165 return m_data.getPath(); 166 } 167 168 /** 169 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#getPossibleTemplates() 170 */ 171 public Map<String, CmsClientTemplateBean> getPossibleTemplates() { 172 173 // TODO Auto-generated method stub 174 return null; 175 } 176 177 /** 178 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#handleSubmit(java.lang.String, java.lang.String, java.util.List, boolean, org.opencms.gwt.client.property.CmsReloadMode) 179 */ 180 public void handleSubmit( 181 final String newUrlName, 182 String vfsPath, 183 final List<CmsPropertyModification> propertyChanges, 184 final boolean editedName, 185 CmsReloadMode reloadMode) { 186 187 final CmsUUID id = m_data.getId(); 188 final I_CmsSitemapServiceAsync service = CmsSitemapView.getInstance().getController().getService(); 189 CmsRpcAction<Void> action = new CmsRpcAction<Void>() { 190 191 @Override 192 public void execute() { 193 194 start(0, false); 195 service.savePropertiesForLocaleCompareMode(id, newUrlName, propertyChanges, editedName, this); 196 } 197 198 @Override 199 protected void onResponse(Void result) { 200 201 stop(false); 202 CmsJsUtil.callNamedFunctionWithString(CmsGwtConstants.CALLBACK_HANDLE_CHANGED_PROPERTIES, "" + id); 203 204 } 205 }; 206 action.execute(); 207 } 208 209 /** 210 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#hasEditableName() 211 */ 212 public boolean hasEditableName() { 213 214 return m_data.hasEditableName(); 215 } 216 217 /** 218 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#isFolder() 219 */ 220 public boolean isFolder() { 221 222 return m_data.isFolder(); 223 } 224 225 /** 226 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#isHiddenProperty(java.lang.String) 227 */ 228 public boolean isHiddenProperty(String key) { 229 230 return false; 231 } 232 233 /** 234 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#isSimpleMode() 235 */ 236 public boolean isSimpleMode() { 237 238 return true; 239 } 240 241 /** 242 * Sets the page information.<p> 243 * 244 * @param pageInfo the page information 245 */ 246 public void setPageInfo(CmsListInfoBean pageInfo) { 247 248 m_pageInfo = pageInfo; 249 250 } 251 252 /** 253 * @see org.opencms.gwt.client.property.I_CmsPropertyEditorHandler#useAdeTemplates() 254 */ 255 public boolean useAdeTemplates() { 256 257 return true; 258 } 259 260}