chemistry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f...@apache.org
Subject svn commit: r1758765 - in /chemistry/opencmis/trunk: chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/ chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistr...
Date Thu, 01 Sep 2016 12:14:58 GMT
Author: fmui
Date: Thu Sep  1 12:14:58 2016
New Revision: 1758765

URL: http://svn.apache.org/viewvc?rev=1758765&view=rev
Log:
Workbench: added language support

Modified:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionParameterMap.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AbstractSpringLoginTab.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
    chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java

Modified: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionParameterMap.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionParameterMap.java?rev=1758765&r1=1758764&r2=1758765&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionParameterMap.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-api/src/main/java/org/apache/chemistry/opencmis/client/SessionParameterMap.java
Thu Sep  1 12:14:58 2016
@@ -600,6 +600,13 @@ public class SessionParameterMap extends
     }
 
     /**
+     * Sets the JVM default locale of the session.
+     */
+    public void setDefaultLocale() {
+        setLocale(Locale.getDefault());
+    }
+
+    /**
      * Sets whether cookies should be managed or not.
      * 
      * @param cookies

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AbstractSpringLoginTab.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AbstractSpringLoginTab.java?rev=1758765&r1=1758764&r2=1758765&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AbstractSpringLoginTab.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/AbstractSpringLoginTab.java
Thu Sep  1 12:14:58 2016
@@ -18,7 +18,6 @@
  */
 package org.apache.chemistry.opencmis.workbench;
 
-import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
 import java.awt.Dimension;

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java?rev=1758765&r1=1758764&r2=1758765&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/BasicLoginTab.java
Thu Sep  1 12:14:58 2016
@@ -53,6 +53,7 @@ public class BasicLoginTab extends Abstr
     public static final String SYSPROP_USER = ClientSession.WORKBENCH_PREFIX + "user";
     public static final String SYSPROP_PASSWORD = ClientSession.WORKBENCH_PREFIX + "password";
     public static final String SYSPROP_CSRF_HEADER = ClientSession.WORKBENCH_PREFIX + "csrfheader";
+    public static final String SYSPROP_LANGUAGE = ClientSession.WORKBENCH_PREFIX + "language";
 
     private JTextField urlField;
     private JRadioButton bindingAtomButton;
@@ -71,6 +72,7 @@ public class BasicLoginTab extends Abstr
     private JRadioButton cookiesOnButton;
     private JRadioButton cookiesOffButton;
     private JTextField csrfHeaderField;
+    private JTextField languageField;
     private JFormattedTextField connectTimeoutField;
     private JFormattedTextField readTimeoutField;
 
@@ -106,6 +108,10 @@ public class BasicLoginTab extends Abstr
                 + "If the server needs a CSRF header, enter the name of the header, otherwise
leave this field blank.");
         csrfHeaderField.setText(System.getProperty(SYSPROP_CSRF_HEADER, ""));
 
+        languageField = createTextField(this, "Language:", "<html>Enter a <b>ISO
639 language</b> code.<br>"
+                + "The language code is sent to the server but it may not be used by the
server.");
+        languageField.setText(System.getProperty(SYSPROP_LANGUAGE, Locale.getDefault().getLanguage()));
+
         connectTimeoutField = createIntegerField(this, "Connect timeout (secs):",
                 "<html>Enter the <b>connect timeout</b> in seconds.<br>This
is the time the client waits to connect to the server.");
         try {
@@ -122,7 +128,7 @@ public class BasicLoginTab extends Abstr
             readTimeoutField.setValue(600);
         }
 
-        makeCompactGrid(11);
+        makeCompactGrid(12);
     }
 
     private void createBindingButtons(Container pane) {
@@ -277,6 +283,21 @@ public class BasicLoginTab extends Abstr
             authentication = ClientSession.Authentication.OAUTH_BEARER;
         }
 
+        Locale locale = null;
+        String language = languageField.getText().trim();
+        if (language.length() > 1 && language.charAt(0) != '-' && language.charAt(0)
!= '_') {
+            int sep1 = language.indexOf('-');
+            int sep2 = language.indexOf('_');
+
+            if (sep1 > 0) {
+                locale = new Locale(language.substring(0, sep1), language.substring(sep1
+ 1));
+            } else if (sep2 > 0) {
+                locale = new Locale(language.substring(0, sep2), language.substring(sep2
+ 1));
+            } else {
+                locale = new Locale(language);
+            }
+        }
+
         long connectTimeout = 0;
         if (connectTimeoutField.getValue() instanceof Number) {
             connectTimeout = ((Number) connectTimeoutField.getValue()).longValue() * 1000;
@@ -297,7 +318,7 @@ public class BasicLoginTab extends Abstr
 
         return ClientSession.createSessionParameters(url, binding, username, password, authentication,
                 compressionOnButton.isSelected(), clientCompressionOnButton.isSelected(),
cookiesOnButton.isSelected(),
-                csrfHeaderField.getText(), connectTimeout, readTimeout);
+                csrfHeaderField.getText(), locale, connectTimeout, readTimeout);
     }
 
     @Override

Modified: chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java?rev=1758765&r1=1758764&r2=1758765&view=diff
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
(original)
+++ chemistry/opencmis/trunk/chemistry-opencmis-workbench/chemistry-opencmis-workbench/src/main/java/org/apache/chemistry/opencmis/workbench/model/ClientSession.java
Thu Sep  1 12:14:58 2016
@@ -126,7 +126,7 @@ public class ClientSession {
 
     public static SessionParameterMap createSessionParameters(String url, BindingType binding,
String username,
             String password, Authentication authentication, boolean compression, boolean
clientCompression,
-            boolean cookies, String csrfHeader, long connectionTimeout, long readTimeout)
{
+            boolean cookies, String csrfHeader, Locale locale, long connectionTimeout, long
readTimeout) {
         SessionParameterMap parameters = new SessionParameterMap();
 
         switch (binding) {
@@ -171,6 +171,10 @@ public class ClientSession {
             }
         }
 
+        if (locale != null) {
+            parameters.setLocale(locale);
+        }
+
         if (connectionTimeout > 0) {
             parameters.setConnectionTimeout(connectionTimeout);
         } else {



Mime
View raw message