[kune-commits] r1510 - in trunk: img/screenshots src/main/java/cc/kune/common/client/ui/dialogs/tabbed src/main/java/cc/kune/core/server src/main/java/cc/kune/core/server/manager/impl src/main/java/cc/kune/core/server/properties src/main/java/cc/kune/core/server/rpc src/main/java/cc/kune/core/server/tool src/main/java/cc/kune/core/shared/dto src/main/java/cc/kune/gspace/client/i18n src/main/resources src/test/java/cc/kune/core/server/integration src/test/java/cc/kune/core/server/integration/site
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Tue Sep 6 00:45:30 CEST 2011
Author: vjrj_
Date: 2011-09-06 00:45:28 +0200 (Tue, 06 Sep 2011)
New Revision: 1510
Added:
trunk/img/screenshots/i18n-new.png
Modified:
trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java
trunk/src/main/java/cc/kune/core/server/InitData.java
trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java
trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java
trunk/src/main/java/cc/kune/core/server/tool/ServerToolRegistry.java
trunk/src/main/java/cc/kune/core/server/tool/ServerToolTarget.java
trunk/src/main/java/cc/kune/core/server/tool/ToolSimple.java
trunk/src/main/java/cc/kune/core/shared/dto/InitDataDTO.java
trunk/src/main/java/cc/kune/gspace/client/i18n/I18nCellList.java
trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPanel.java
trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslateRecomendPanel.java
trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslationProvider.java
trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslatorForm.java
trunk/src/main/java/cc/kune/gspace/client/i18n/ShowMorePagerPanel.java
trunk/src/main/resources/kune.properties
trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java
trunk/src/test/java/cc/kune/core/server/integration/site/InitDataTest.java
Log:
NEW - # 79: I18n refactorization
http://kune.ourproject.org/issues/ticket/79
And added the possibility to enable/disable by default or site wide tools in kune.properties.
Added: trunk/img/screenshots/i18n-new.png
===================================================================
(Binary files differ)
Property changes on: trunk/img/screenshots/i18n-new.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Modified: trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/common/client/ui/dialogs/tabbed/AbstractTabbedDialogPanel.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -42,7 +42,7 @@
import com.google.gwt.user.client.ui.Widget;
public abstract class AbstractTabbedDialogPanel implements AbstractTabbedDialogView {
- private final boolean authohide;
+ private final boolean autohide;
private BasicTopDialog dialog;
private final String dialogId;
private final String errorLabelId;
@@ -62,7 +62,7 @@
private int width;
public AbstractTabbedDialogPanel(final String dialogId, final String title, final boolean modal,
- final boolean authoHide, final NotifyLevelImages images, final String errorLabelId,
+ final boolean autoHide, final NotifyLevelImages images, final String errorLabelId,
final String firstBtnTitle, final String firstBtnId, final String sndBtnTitle,
final String sndBtnId, final ProvidersCollection provCollection) {
this.dialogId = dialogId;
@@ -75,7 +75,7 @@
this.sndBtnTitle = sndBtnTitle;
this.sndBtnId = sndBtnId;
this.provCollection = provCollection;
- this.authohide = authoHide;
+ this.autohide = autoHide;
}
public AbstractTabbedDialogPanel(final String dialogId, final String title, final boolean modal,
@@ -124,7 +124,7 @@
}
private void createDialog() {
- dialog = new BasicTopDialog.Builder(dialogId, authohide, modal).autoscroll(true).width(
+ dialog = new BasicTopDialog.Builder(dialogId, autohide, modal).autoscroll(true).width(
String.valueOf(width + 20)).height(String.valueOf(height + 20)).icon(iconCls).firstButtonId(
firstBtnId).firstButtonTitle(firstBtnTitle).sndButtonId(dialogId).sndButtonTitle(sndBtnTitle).sndButtonId(
sndBtnId).title(title).build();
Modified: trunk/src/main/java/cc/kune/core/server/InitData.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/InitData.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/core/server/InitData.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -19,7 +19,6 @@
*/
package cc.kune.core.server;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -45,7 +44,7 @@
private List<ExtMediaDescrip> extMediaDescrips;
private String flvEmbedObject;
private String galleryPermittedExtensions;
- private ArrayList<ToolSimple> groupTools;
+ private List<ToolSimple> groupTools;
private HashMap<String, GSpaceTheme> gSpaceThemes;
private int imgCropsize;
private int imgIconsize;
@@ -62,7 +61,7 @@
private String siteUrl;
private String[] timezones;
private UserInfo userInfo;
- private ArrayList<ToolSimple> userTools;
+ private List<ToolSimple> userTools;
public String getAviEmbedObject() {
return aviEmbedObject;
@@ -108,7 +107,7 @@
return galleryPermittedExtensions;
}
- public ArrayList<ToolSimple> getGroupTools() {
+ public List<ToolSimple> getGroupTools() {
return groupTools;
}
@@ -177,7 +176,7 @@
return userInfo;
}
- public ArrayList<ToolSimple> getUserTools() {
+ public List<ToolSimple> getUserTools() {
return userTools;
}
@@ -225,7 +224,7 @@
this.galleryPermittedExtensions = galleryPermittedExtensions;
}
- public void setGroupTools(final ArrayList<ToolSimple> groupTools) {
+ public void setGroupTools(final List<ToolSimple> groupTools) {
this.groupTools = groupTools;
}
@@ -294,7 +293,7 @@
this.userInfo = currentUserInfo;
}
- public void setUserTools(final ArrayList<ToolSimple> userTools) {
+ public void setUserTools(final List<ToolSimple> userTools) {
this.userTools = userTools;
}
Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/GroupManagerDefault.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -19,7 +19,6 @@
*/
package cc.kune.core.server.manager.impl;
-import java.util.Collection;
import java.util.List;
import java.util.Set;
@@ -171,7 +170,7 @@
group.setWorkspaceTheme(defaultSiteWorkspaceTheme);
initSocialNetwork(group, user.getUserGroup(), publicVisibility, snVisibility);
final String title = i18n.t("About [%s]", group.getLongName());
- initGroup(user, group, serverToolRegistry.getToolsForGroupsKeys(), title, publicDescrip);
+ initGroup(user, group, serverToolRegistry.getToolsRegisEnabledForGroups(), title, publicDescrip);
return group;
} else {
throw new UserMustBeLoggedException();
@@ -209,8 +208,9 @@
final String title = i18n.t("[%s] Bio", user.getName());
final String body = i18n.t("This user has not written its biography yet");
try {
- initGroup(user, userGroup, wantPersonalHomepage ? serverToolRegistry.getToolsForUserKeys()
- : ServerToolRegistry.emptyToolList, title, body);
+ initGroup(user, userGroup,
+ wantPersonalHomepage ? serverToolRegistry.getToolsRegisEnabledForUsers()
+ : ServerToolRegistry.emptyToolList, title, body);
super.persist(user, User.class);
} catch (final PersistenceException e) {
if (e.getCause() instanceof ConstraintViolationException) {
@@ -252,7 +252,7 @@
return findByShortName(shortName);
}
- private void initGroup(final User user, final Group group, final Collection<String> toolsToEnable,
+ private void initGroup(final User user, final Group group, final List<String> toolsToEnable,
final Object... vars) throws GroupShortNameInUseException {
try {
persist(group);
Modified: trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/core/server/properties/KuneProperties.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -42,10 +42,14 @@
String SITE_ADMIN_SHORTNAME = "kune.admin.shortName";
String SITE_DEF_LICENSE = "kune.default.license";
String SITE_DOMAIN = "kune.site.domain";
+ String SITE_GROUP_AVAILABLE_TOOLS = "kune.tools.groupSiteAvailableTools";
+ String SITE_GROUP_REGIST_ENABLED_TOOLS = "kune.tools.groupRegisEnabledTools";
String SITE_LOGO_URL = "kune.sitelogourl";
String SITE_NAME = "kune.default.site.name";
String SITE_SHORTNAME = "kune.default.site.shortName";
String SITE_URL = "kune.siteurl";
+ String SITE_USER_AVAILABLE_TOOLS = "kune.tools.userSiteAvailableTools";
+ String SITE_USER_REGIST_ENABLED_TOOLS = "kune.tools.userRegisEnabledTools";
String UPLOAD_DELAY_FOR_TEST = "kune.upload.delayfortest";
String UPLOAD_GALLERY_PERMITTED_EXTS = "kune.upload.gallerypermittedextensions";
String UPLOAD_LOCATION = "kune.upload.location";
Modified: trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/core/server/rpc/SiteRPC.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -141,8 +141,8 @@
data.setSiteLogoUrl(kuneProperties.get(KuneProperties.SITE_LOGO_URL));
data.setGalleryPermittedExtensions(kuneProperties.get(KuneProperties.UPLOAD_GALLERY_PERMITTED_EXTS));
data.setMaxFileSizeInMb(kuneProperties.get(KuneProperties.UPLOAD_MAX_FILE_SIZE));
- data.setUserTools(serverToolRegistry.getToolsForUsers());
- data.setGroupTools(serverToolRegistry.getToolsForGroups());
+ data.setUserTools(serverToolRegistry.getToolsAvailableForUsers());
+ data.setGroupTools(serverToolRegistry.getToolsAvailableForGroups());
data.setImgResizewidth(kuneProperties.getInteger(KuneProperties.IMAGES_RESIZEWIDTH));
data.setImgThumbsize(kuneProperties.getInteger(KuneProperties.IMAGES_THUMBSIZE));
data.setImgCropsize(kuneProperties.getInteger(KuneProperties.IMAGES_CROPSIZE));
Modified: trunk/src/main/java/cc/kune/core/server/tool/ServerToolRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/tool/ServerToolRegistry.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/core/server/tool/ServerToolRegistry.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -22,67 +22,102 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
+import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import cc.kune.core.server.properties.KuneProperties;
+
+import com.google.inject.Inject;
import com.google.inject.Singleton;
@Singleton
public class ServerToolRegistry {
- static Log log = LogFactory.getLog(ServerToolRegistry.class);
+ public static List<String> emptyToolList = new ArrayList<String>();
- public static Collection<String> emptyToolList = new ArrayList<String>();
+ static Log log = LogFactory.getLog(ServerToolRegistry.class);
- private final HashMap<String, ServerTool> tools;
- private final HashMap<String, ToolSimple> toolsForUsersMap;
- private final HashMap<String, ToolSimple> toolsForGroupsMap;
+ private final List<String> groupsAvailableToolsInProp;
+ private final List<String> groupsRegisEnabledTools;
+ private final List<String> groupsRegisEnabledToolsInProp;
+ private final HashMap<String, ServerTool> tools;
+ private final List<ToolSimple> toolsAvailableForGroups;
+ private final List<ToolSimple> toolsAvailableForUsers;
+ private final List<String> usersAvailableToolsInProp;
+ private final List<String> usersRegisEnabledTools;
+ private final List<String> usersRegisEnabledToolsInProp;
- public ServerToolRegistry() {
- tools = new HashMap<String, ServerTool>();
- toolsForUsersMap = new HashMap<String, ToolSimple>();
- toolsForGroupsMap = new HashMap<String, ToolSimple>();
- }
+ @Inject
+ public ServerToolRegistry(final KuneProperties kuneProperties) {
+ tools = new HashMap<String, ServerTool>();
+ toolsAvailableForUsers = new ArrayList<ToolSimple>();
+ toolsAvailableForGroups = new ArrayList<ToolSimple>();
+ usersRegisEnabledTools = new ArrayList<String>();
+ groupsRegisEnabledTools = new ArrayList<String>();
+ usersAvailableToolsInProp = kuneProperties.getList(KuneProperties.SITE_USER_AVAILABLE_TOOLS);
+ groupsAvailableToolsInProp = kuneProperties.getList(KuneProperties.SITE_GROUP_AVAILABLE_TOOLS);
+ usersRegisEnabledToolsInProp = kuneProperties.getList(KuneProperties.SITE_USER_REGIST_ENABLED_TOOLS);
+ groupsRegisEnabledToolsInProp = kuneProperties.getList(KuneProperties.SITE_GROUP_REGIST_ENABLED_TOOLS);
+ }
- public Collection<ServerTool> all() {
- return tools.values();
- }
+ public Collection<ServerTool> all() {
+ return tools.values();
+ }
- public ServerTool get(final String toolName) {
- return tools.get(toolName);
- }
+ public ServerTool get(final String toolName) {
+ return tools.get(toolName);
+ }
- public ArrayList<ToolSimple> getToolsForGroups() {
- return new ArrayList<ToolSimple>(toolsForGroupsMap.values());
- }
+ public List<ToolSimple> getToolsAvailableForGroups() {
+ return toolsAvailableForGroups;
+ }
- public Collection<String> getToolsForGroupsKeys() {
- return toolsForGroupsMap.keySet();
- }
+ public List<ToolSimple> getToolsAvailableForUsers() {
+ return toolsAvailableForUsers;
+ }
- public Collection<String> getToolsForUserKeys() {
- return toolsForUsersMap.keySet();
- }
+ public List<String> getToolsRegisEnabledForGroups() {
+ return groupsRegisEnabledTools;
+ }
- public ArrayList<ToolSimple> getToolsForUsers() {
- return new ArrayList<ToolSimple>(toolsForUsersMap.values());
+ public List<String> getToolsRegisEnabledForUsers() {
+ return usersRegisEnabledTools;
+ }
+
+ public void register(final ServerTool tool) {
+ final String name = tool.getName();
+ final String rootName = tool.getRootName();
+ final boolean userAvailable = usersAvailableToolsInProp.contains(name);
+ final boolean groupAvailable = groupsAvailableToolsInProp.contains(name);
+ if (userAvailable && usersRegisEnabledToolsInProp.contains(name)) {
+ usersRegisEnabledTools.add(name);
}
-
- public void register(final ServerTool tool) {
- String name = tool.getName();
- String rootName = tool.getRootName();
- tools.put(name, tool);
- switch (tool.getTarget()) {
- case forGroups:
- toolsForGroupsMap.put(name, new ToolSimple(name, rootName));
- break;
- case forUsers:
- toolsForUsersMap.put(name, new ToolSimple(name, rootName));
- break;
- case forBoth:
- toolsForGroupsMap.put(name, new ToolSimple(name, rootName));
- toolsForUsersMap.put(name, new ToolSimple(name, rootName));
- break;
+ if (groupAvailable && groupsRegisEnabledToolsInProp.contains(name)) {
+ groupsRegisEnabledTools.add(name);
+ }
+ if (userAvailable || groupAvailable) {
+ tools.put(name, tool);
+ switch (tool.getTarget()) {
+ case forGroups:
+ if (groupAvailable) {
+ toolsAvailableForGroups.add(new ToolSimple(name, rootName));
}
+ break;
+ case forUsers:
+ if (userAvailable) {
+ toolsAvailableForUsers.add(new ToolSimple(name, rootName));
+ }
+ break;
+ case forBoth:
+ if (groupAvailable) {
+ toolsAvailableForGroups.add(new ToolSimple(name, rootName));
+ }
+ if (userAvailable) {
+ toolsAvailableForUsers.add(new ToolSimple(name, rootName));
+ }
+ break;
+ }
}
+ }
}
Modified: trunk/src/main/java/cc/kune/core/server/tool/ServerToolTarget.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/tool/ServerToolTarget.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/core/server/tool/ServerToolTarget.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -20,5 +20,16 @@
package cc.kune.core.server.tool;
public enum ServerToolTarget {
- forUsers, forGroups, forBoth
+ /**
+ * This is a tool developed both for users and groups
+ */
+ forBoth,
+ /**
+ * A tools developed only for groups
+ */
+ forGroups,
+ /**
+ * A tool developed only for users
+ */
+ forUsers
}
Modified: trunk/src/main/java/cc/kune/core/server/tool/ToolSimple.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/tool/ToolSimple.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/core/server/tool/ToolSimple.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -21,58 +21,57 @@
public class ToolSimple {
- private final String name;
- private final String rootName;
+ private final String name;
+ private final String rootName;
- public ToolSimple(String name, String rootName) {
- this.name = name;
- this.rootName = rootName;
- }
+ public ToolSimple(final String name, final String rootName) {
+ this.name = name;
+ this.rootName = rootName;
+ }
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- ToolSimple other = (ToolSimple) obj;
- if (name == null) {
- if (other.name != null) {
- return false;
- }
- } else if (!name.equals(other.name)) {
- return false;
- }
- if (rootName == null) {
- if (other.rootName != null) {
- return false;
- }
- } else if (!rootName.equals(other.rootName)) {
- return false;
- }
- return true;
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
}
-
- public String getName() {
- return name;
+ if (obj == null) {
+ return false;
}
-
- public String getRootName() {
- return rootName;
+ if (getClass() != obj.getClass()) {
+ return false;
}
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((rootName == null) ? 0 : rootName.hashCode());
- return result;
+ final ToolSimple other = (ToolSimple) obj;
+ if (name == null) {
+ if (other.name != null) {
+ return false;
+ }
+ } else if (!name.equals(other.name)) {
+ return false;
}
+ if (rootName == null) {
+ if (other.rootName != null) {
+ return false;
+ }
+ } else if (!rootName.equals(other.rootName)) {
+ return false;
+ }
+ return true;
+ }
+ public String getName() {
+ return name;
+ }
+
+ public String getRootName() {
+ return rootName;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((name == null) ? 0 : name.hashCode());
+ result = prime * result + ((rootName == null) ? 0 : rootName.hashCode());
+ return result;
+ }
}
Modified: trunk/src/main/java/cc/kune/core/shared/dto/InitDataDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/InitDataDTO.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/core/shared/dto/InitDataDTO.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -19,11 +19,9 @@
*/
package cc.kune.core.shared.dto;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
-
import com.google.gwt.user.client.rpc.IsSerializable;
public class InitDataDTO implements IsSerializable {
@@ -32,21 +30,21 @@
private String chatDomain;
private String chatHttpBase;
private String chatRoomHost;
- private ArrayList<I18nCountryDTO> countries;
+ private List<I18nCountryDTO> countries;
private String currentCCversion;
private LicenseDTO defaultLicense;
private String defaultWsTheme;
private List<ExtMediaDescripDTO> extMediaDescrips;
private String flvEmbedObject;
private String galleryPermittedExtensions;
- private ArrayList<ToolSimpleDTO> groupTools;
+ private List<ToolSimpleDTO> groupTools;
private HashMap<String, GSpaceTheme> gSpaceThemes = new HashMap<String, GSpaceTheme>();
private int imgCropsize;
private int imgIconsize;
private int imgResizewidth;
private int imgThumbsize;
- private ArrayList<I18nLanguageSimpleDTO> languages;
- private ArrayList<LicenseDTO> licenses;
+ private List<I18nLanguageSimpleDTO> languages;
+ private List<LicenseDTO> licenses;
private String maxFileSizeInMb;
private String mp3EmbedObject;
private String oggEmbedObject;
@@ -56,7 +54,7 @@
private String siteUrl;
private String[] timezones;
private UserInfoDTO userInfo;
- private ArrayList<ToolSimpleDTO> userTools;
+ private List<ToolSimpleDTO> userTools;
public InitDataDTO() {
}
@@ -77,7 +75,7 @@
return chatRoomHost;
}
- public ArrayList<I18nCountryDTO> getCountries() {
+ public List<I18nCountryDTO> getCountries() {
return countries;
}
@@ -105,7 +103,7 @@
return galleryPermittedExtensions;
}
- public ArrayList<ToolSimpleDTO> getGroupTools() {
+ public List<ToolSimpleDTO> getGroupTools() {
return groupTools;
}
@@ -129,11 +127,11 @@
return imgThumbsize;
}
- public ArrayList<I18nLanguageSimpleDTO> getLanguages() {
+ public List<I18nLanguageSimpleDTO> getLanguages() {
return languages;
}
- public ArrayList<LicenseDTO> getLicenses() {
+ public List<LicenseDTO> getLicenses() {
return licenses;
}
@@ -174,7 +172,7 @@
return userInfo;
}
- public ArrayList<ToolSimpleDTO> getUserTools() {
+ public List<ToolSimpleDTO> getUserTools() {
return userTools;
}
@@ -198,7 +196,7 @@
this.chatRoomHost = chatRoomHost;
}
- public void setCountries(final ArrayList<I18nCountryDTO> countries) {
+ public void setCountries(final List<I18nCountryDTO> countries) {
this.countries = countries;
}
@@ -226,7 +224,7 @@
this.galleryPermittedExtensions = galleryPermittedExtensions;
}
- public void setGroupTools(final ArrayList<ToolSimpleDTO> groupTools) {
+ public void setGroupTools(final List<ToolSimpleDTO> groupTools) {
this.groupTools = groupTools;
}
@@ -250,11 +248,11 @@
this.imgThumbsize = imgThumbsize;
}
- public void setLanguages(final ArrayList<I18nLanguageSimpleDTO> languages) {
+ public void setLanguages(final List<I18nLanguageSimpleDTO> languages) {
this.languages = languages;
}
- public void setLicenses(final ArrayList<LicenseDTO> licenses) {
+ public void setLicenses(final List<LicenseDTO> licenses) {
this.licenses = licenses;
}
@@ -295,7 +293,7 @@
this.userInfo = currentUser;
}
- public void setUserTools(final ArrayList<ToolSimpleDTO> userTools) {
+ public void setUserTools(final List<ToolSimpleDTO> userTools) {
this.userTools = userTools;
}
Modified: trunk/src/main/java/cc/kune/gspace/client/i18n/I18nCellList.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/I18nCellList.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/I18nCellList.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -17,6 +17,7 @@
*/
package cc.kune.gspace.client.i18n;
+import cc.kune.common.client.utils.SimpleCallback;
import cc.kune.core.shared.dto.I18nLanguageSimpleDTO;
import cc.kune.core.shared.dto.I18nTranslationDTO;
import cc.kune.core.shared.i18n.I18nTranslationService;
@@ -26,8 +27,6 @@
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.dom.client.KeyPressHandler;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.safehtml.shared.SafeHtmlUtils;
import com.google.gwt.uibinder.client.UiBinder;
@@ -134,17 +133,10 @@
cellList.setEmptyListMessage(SafeHtmlUtils.fromTrustedString("<span style='padding: 10px; font-style: italic;'>Loading</span>"));
cellList.setKeyboardPagingPolicy(KeyboardPagingPolicy.INCREASE_RANGE);
cellList.setKeyboardSelectionPolicy(KeyboardSelectionPolicy.BOUND_TO_SELECTION);
- cellList.addHandler(new KeyPressHandler() {
- @Override
- public void onKeyPress(final KeyPressEvent event) {
- if (event.getNativeEvent().getKeyCode() == com.google.gwt.event.dom.client.KeyCodes.KEY_UP) {
- } else if (event.getNativeEvent().getKeyCode() == com.google.gwt.event.dom.client.KeyCodes.KEY_DOWN) {
- }
- }
- }, KeyPressEvent.getType());
- // Add a selection model so we can select cells.
final SingleSelectionModel<I18nTranslationDTO> selectionModel = new SingleSelectionModel<I18nTranslationDTO>(
I18nTranslationDTO.KEY_PROVIDER);
+ // Add a selection model so we can select cells.
+
cellList.setSelectionModel(selectionModel);
cellList.setValueUpdater(new ValueUpdater<I18nTranslationDTO>() {
@Override
@@ -156,14 +148,24 @@
@Override
public void onSelectionChange(final SelectionChangeEvent event) {
translatorForm.setInfo(selectionModel.getSelectedObject());
+ translatorForm.focusToTranslate();
+ // cellList.get
+ // pagerPanel.ensureVisible((UIObject) event.getSource());
}
});
cellList.sinkEvents(com.google.gwt.user.client.Event.KEYEVENTS);
// Create the UiBinder.
final Binder uiBinder = GWT.create(Binder.class);
initWidget(uiBinder.createAndBindUi(this));
- translatorForm.init(data, i18n, cellList);
+ translatorForm.init(data, i18n);
data.addDataDisplay(cellList);
+ data.setSelectionMode(selectionModel);
+ data.setLoadCallback(new SimpleCallback() {
+ @Override
+ public void onCallback() {
+ translatorForm.focusToTranslate();
+ }
+ });
// Set the cellList as the display of the pagers.
// pagerPanel is a scrollable pager that extends the range when the
Modified: trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPanel.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/I18nNewTranslatorPanel.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -13,7 +13,7 @@
public class I18nNewTranslatorPanel extends AbstractTabbedDialogPanel implements I18nNewTranslatorView {
- private static final int HEIGHT = 200;
+ private static final int HEIGHT = 280;
private static final String TRANSLATOR_ERROR_ID = "i18n-trans-panel-error";
private static final String TRANSLATOR_PANEL_ID = "i18n-trans-panel";
private static final int WIDTH = 570;
@@ -27,12 +27,11 @@
final TranslatorTabsCollection transGroup, final LanguageSelectorPanel lanSelectorPanel,
final I18nToTranslateGridPanel toTranslateGrid, final I18nTranslatedGridPanel translatedGrid,
final I18nTranslateRecomendPanel transRecommend, final CoreResources res) {
- super(TRANSLATOR_PANEL_ID, "", WIDTH, HEIGHT + 80, false, false, images, TRANSLATOR_ERROR_ID,
+ super(TRANSLATOR_PANEL_ID, "", WIDTH, HEIGHT, false, false, images, TRANSLATOR_ERROR_ID,
i18n.t("Close"), null, null, null, transGroup);
setIcon(res.language());
this.lanSelectorPanel = lanSelectorPanel;
lanSelectorPanel.addChangeListener(new SimpleCallback() {
-
@Override
public void onCallback() {
setLanguage(lanSelectorPanel.getLanguage());
@@ -41,7 +40,7 @@
this.toTranslateGrid = toTranslateGrid;
this.translatedGrid = translatedGrid;
this.transRecommend = transRecommend;
- transRecommend.setSize(String.valueOf(WIDTH), String.valueOf(HEIGHT));
+ transRecommend.setSize(WIDTH, HEIGHT);
super.setIconCls("k-options-icon");
super.setTitle(i18n.t("Help to translate kune"));
super.getInnerPanel().insert(lanSelectorPanel, 0);
Modified: trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslateRecomendPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslateRecomendPanel.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslateRecomendPanel.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -17,7 +17,7 @@
public I18nTranslateRecomendPanel(final I18nTranslationService i18n) {
tabTitle = new Label(i18n.t("Recommendations"));
recommFrame = new Frame("i18n-recom.html");
- recommFrame.setHeight("auto");
+ // recommFrame.setHeight("auto");
recommFrame.setStyleName("k-i18n-recommend");
initWidget(recommFrame);
}
@@ -26,9 +26,11 @@
return tabTitle;
}
- @Override
- public void setSize(final String width, final String height) {
- recommFrame.setWidth(width + "px");
- recommFrame.setHeight(height + "px");
+ public void setSize(final int width, final int height) {
+ final String widthS = width + "px";
+ final String heightS = height + "px";
+ recommFrame.setWidth(widthS);
+ recommFrame.setHeight(heightS);
+ // super.setSize(widthS, heightS);
}
}
Modified: trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslationProvider.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslationProvider.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslationProvider.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -17,6 +17,7 @@
import java.util.List;
+import cc.kune.common.client.utils.SimpleCallback;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.rpcservices.I18nServiceAsync;
import cc.kune.core.client.state.Session;
@@ -25,12 +26,15 @@
import com.google.gwt.user.cellview.client.CellList;
import com.google.gwt.view.client.ListDataProvider;
+import com.google.gwt.view.client.SingleSelectionModel;
import com.google.inject.Inject;
public class I18nTranslationProvider {
private final ListDataProvider<I18nTranslationDTO> dataProvider = new ListDataProvider<I18nTranslationDTO>();
private final I18nServiceAsync i18n;
+ private SimpleCallback loadCallback;
+ private SingleSelectionModel<I18nTranslationDTO> selectionModel;
private final Session session;
@Inject
@@ -43,10 +47,28 @@
dataProvider.addDataDisplay(displayList);
}
+ private void avance(final int increment) {
+ final I18nTranslationDTO selected = selectionModel.getSelectedObject();
+ final List<I18nTranslationDTO> list = dataProvider.getList();
+ final int pos = list.indexOf(selected);
+ final int next = pos + increment;
+ if (next >= 0 && next < list.size()) {
+ selectionModel.setSelected(list.get(next), true);
+ }
+ }
+
public void refreshDisplays() {
dataProvider.refresh();
}
+ public void selectNext() {
+ avance(1);
+ }
+
+ public void selectPrevious() {
+ avance(-1);
+ }
+
public void setLanguage(final I18nLanguageSimpleDTO language, final boolean toTranslate) {
dataProvider.getList().clear();
dataProvider.refresh();
@@ -56,8 +78,20 @@
public void onSuccess(final List<I18nTranslationDTO> result) {
dataProvider.setList(result);
dataProvider.refresh();
+ if (result.size() > 0) {
+ selectionModel.setSelected(result.get(0), true);
+ }
+ loadCallback.onCallback();
}
});
}
+ public void setLoadCallback(final SimpleCallback loadCallback) {
+ this.loadCallback = loadCallback;
+ }
+
+ public void setSelectionMode(final SingleSelectionModel<I18nTranslationDTO> selectionModel) {
+ this.selectionModel = selectionModel;
+ }
+
}
Modified: trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslatorForm.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslatorForm.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/I18nTranslatorForm.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -28,7 +28,6 @@
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.cellview.client.CellList;
import com.google.gwt.user.client.Timer;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Label;
@@ -45,8 +44,6 @@
}
private static Binder uiBinder = GWT.create(Binder.class);
-
- private CellList<I18nTranslationDTO> cellList;
@UiField
PushButton copyIcon;
private I18nTranslationProvider dataProvider;
@@ -86,6 +83,10 @@
translation.setText(toTranslate.getText());
}
+ public void focusToTranslate() {
+ translation.setFocus(true);
+ }
+
@UiHandler("translation")
void handleBlur(final BlurEvent event) {
update();
@@ -105,31 +106,29 @@
@UiHandler("translation")
void handleKeyPress(final KeyPressEvent event) {
- if (event.isControlKeyDown() && event.isAltKeyDown()
- && event.getNativeEvent().getKeyCode() == com.google.gwt.event.dom.client.KeyCodes.KEY_UP) {
- cellList.fireEvent(event);
- }
- if (event.isControlKeyDown() && event.isAltKeyDown()
- && event.getNativeEvent().getKeyCode() == com.google.gwt.event.dom.client.KeyCodes.KEY_DOWN) {
- cellList.fireEvent(event);
- }
- if (event.isAltKeyDown() && event.getCharCode() == 'v') {
+ if (event.isAltKeyDown()
+ && event.getNativeEvent().getKeyCode() == com.google.gwt.event.dom.client.KeyCodes.KEY_PAGEUP) {
+ // cellList.fireEvent(event);
+ dataProvider.selectPrevious();
+ } else if (event.isAltKeyDown()
+ && event.getNativeEvent().getKeyCode() == com.google.gwt.event.dom.client.KeyCodes.KEY_PAGEDOWN) {
+ // cellList.fireEvent(event);
+ dataProvider.selectNext();
+ } else if (event.isAltKeyDown() && event.getCharCode() == 'v') {
copyTranslation();
event.stopPropagation();
+ updateWithTimer();
}
- updateWithTimer();
}
- public void init(final I18nTranslationProvider dataProvider, final I18nTranslationService i18n,
- final CellList<I18nTranslationDTO> cellList) {
+ public void init(final I18nTranslationProvider dataProvider, final I18nTranslationService i18n) {
this.dataProvider = dataProvider;
this.i18n = i18n;
- this.cellList = cellList;
Tooltip.to(copyIcon, i18n.t("Copy the text to translate"));
toTranslateTitle.setText(i18n.t("translate this:"));
noteForTranslatorsTittle.setText(i18n.t("Notes:"));
keyboardRecomendationTitle.setText(i18n.t("Tip:"));
- keyboardRecomendation.setText(i18n.t("Pulse TAB/Shift-TAB to move from the list to the translation area, and use the cursor to move bettween list elements. Alt-V to copy the original text. The translations are autosaved"));
+ keyboardRecomendation.setText(i18n.t("Pulse Alt+PageUp or Alt+PageDown to move up/down in the list while translating, and Alt-V to copy the original text. The translations are autosaved"));
}
public void setInfo(final I18nTranslationDTO item) {
Modified: trunk/src/main/java/cc/kune/gspace/client/i18n/ShowMorePagerPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/i18n/ShowMorePagerPanel.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/java/cc/kune/gspace/client/i18n/ShowMorePagerPanel.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -19,6 +19,7 @@
import com.google.gwt.event.dom.client.ScrollHandler;
import com.google.gwt.user.cellview.client.AbstractPager;
import com.google.gwt.user.client.ui.ScrollPanel;
+import com.google.gwt.user.client.ui.UIObject;
import com.google.gwt.user.client.ui.Widget;
import com.google.gwt.view.client.HasRows;
@@ -59,24 +60,23 @@
// Handle scroll events.
scrollable.addScrollHandler(new ScrollHandler() {
- public void onScroll(ScrollEvent event) {
+ @Override
+ public void onScroll(final ScrollEvent event) {
// If scrolling up, ignore the event.
- int oldScrollPos = lastScrollPos;
+ final int oldScrollPos = lastScrollPos;
lastScrollPos = scrollable.getScrollPosition();
if (oldScrollPos >= lastScrollPos) {
return;
}
- HasRows display = getDisplay();
+ final HasRows display = getDisplay();
if (display == null) {
return;
}
- int maxScrollTop = scrollable.getWidget().getOffsetHeight()
- - scrollable.getOffsetHeight();
+ final int maxScrollTop = scrollable.getWidget().getOffsetHeight() - scrollable.getOffsetHeight();
if (lastScrollPos >= maxScrollTop) {
// We are near the end, so increase the page size.
- int newPageSize = Math.min(
- display.getVisibleRange().getLength() + incrementSize,
+ final int newPageSize = Math.min(display.getVisibleRange().getLength() + incrementSize,
display.getRowCount());
display.setVisibleRange(0, newPageSize);
}
@@ -84,10 +84,14 @@
});
}
+ public void ensureVisible(final UIObject object) {
+ scrollable.ensureVisible(object);
+ }
+
/**
* Get the number of rows by which the range is increased when the scrollbar
* reaches the bottom.
- *
+ *
* @return the increment size
*/
public int getIncrementSize() {
@@ -95,7 +99,11 @@
}
@Override
- public void setDisplay(HasRows display) {
+ protected void onRangeOrRowCountChanged() {
+ }
+
+ @Override
+ public void setDisplay(final HasRows display) {
assert display instanceof Widget : "display must extend Widget";
scrollable.setWidget((Widget) display);
super.setDisplay(display);
@@ -104,14 +112,11 @@
/**
* Set the number of rows by which the range is increased when the scrollbar
* reaches the bottom.
- *
- * @param incrementSize the incremental number of rows
+ *
+ * @param incrementSize
+ * the incremental number of rows
*/
- public void setIncrementSize(int incrementSize) {
+ public void setIncrementSize(final int incrementSize) {
this.incrementSize = incrementSize;
}
-
- @Override
- protected void onRangeOrRowCountChanged() {
- }
}
Modified: trunk/src/main/resources/kune.properties
===================================================================
--- trunk/src/main/resources/kune.properties 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/main/resources/kune.properties 2011-09-05 22:45:28 UTC (rev 1510)
@@ -41,6 +41,22 @@
# kune.site.welcomewave = w+rtackLTkDCA
kune.site.welcomewave =
+# which tools are available in this site by users
+kune.tools.userSiteAvailableTools = docs,blogs,wiki,tasks,barters
+# From these which tools are enabled for users after registration
+# Possible values:
+# kune.tools.userRegisEnabledTools = docs,blogs,wiki,tasks,barters
+kune.tools.userRegisEnabledTools = docs,blogs,wiki,tasks
+# WARNING: be sure that all tools in userRegisEnabledTools are included in userSiteAvailableTools
+
+# which tools are available in this site by groups
+kune.tools.groupSiteAvailableTools = docs,blogs,wiki,tasks,events,lists,chats
+# From these which tools are enabled for groups after registration
+# Possible values (don't enable chats on initialization/install, do later)
+# kune.tools.groupRegisEnabledTools = docs,blogs,wiki,tasks,events,chats
+kune.tools.groupRegisEnabledTools = docs,blogs,wiki,tasks,events,lists
+# WARNING: be sure that all tools in groupRegisEnabledTools are included in groupSiteAvailableTools
+
### Workspace enabled themes
# This names are also the name of the items in the theme menu and there are translated
Modified: trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/test/java/cc/kune/core/server/integration/DatabaseInitializerTest.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -30,7 +30,6 @@
import org.junit.Before;
import org.junit.Test;
-import cc.kune.chat.shared.ChatConstants;
import cc.kune.core.server.content.ContainerManager;
import cc.kune.core.server.content.ContentManager;
import cc.kune.core.server.manager.GroupManager;
@@ -99,9 +98,10 @@
final ToolConfiguration docToolConfig = defaultGroup.getToolConfiguration(NAME);
assertNotNull(docToolConfig);
assertTrue(docToolConfig.isEnabled());
- final ToolConfiguration chatToolConfig = defaultGroup.getToolConfiguration(ChatConstants.NAME);
- assertNotNull(chatToolConfig);
- assertTrue(chatToolConfig.isEnabled());
+ // final ToolConfiguration chatToolConfig =
+ // defaultGroup.getToolConfiguration(ChatConstants.NAME);
+ // assertNotNull(chatToolConfig);
+ // assertTrue(chatToolConfig.isEnabled());
final List<String> enabledTools = groupManager.findEnabledTools(defaultGroup.getId());
assertNotNull(enabledTools);
assertTrue(enabledTools.size() > 0);
Modified: trunk/src/test/java/cc/kune/core/server/integration/site/InitDataTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/integration/site/InitDataTest.java 2011-09-05 16:05:15 UTC (rev 1509)
+++ trunk/src/test/java/cc/kune/core/server/integration/site/InitDataTest.java 2011-09-05 22:45:28 UTC (rev 1510)
@@ -23,7 +23,7 @@
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import java.util.ArrayList;
+import java.util.List;
import org.junit.Before;
import org.junit.Test;
@@ -50,7 +50,7 @@
@Inject
UserSession session;
- private void assertValidLicenseDTOList(final ArrayList<LicenseDTO> licenseList) {
+ private void assertValidLicenseDTOList(final List<LicenseDTO> licenseList) {
assertTrue(licenseList.size() > 0);
for (final Object o : licenseList) {
assertNotNull(o);
More information about the kune-commits
mailing list