You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by gb...@apache.org on 2010/08/17 16:52:36 UTC

svn commit: r986339 - in /pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra: TerraCalendarSkin.java TerraCalendarSkin.json TerraCalendarSkin_zh.json

Author: gbrown
Date: Tue Aug 17 14:52:36 2010
New Revision: 986339

URL: http://svn.apache.org/viewvc?rev=986339&view=rev
Log:
Resolve PIVOT-392.

Added:
    pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.json
    pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin_zh.json
Modified:
    pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java

Modified: pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java
URL: http://svn.apache.org/viewvc/pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java?rev=986339&r1=986338&r2=986339&view=diff
==============================================================================
--- pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java (original)
+++ pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.java Tue Aug 17 14:52:36 2010
@@ -20,13 +20,17 @@ import java.awt.Color;
 import java.awt.Font;
 import java.awt.GradientPaint;
 import java.awt.Graphics2D;
+import java.io.IOException;
 import java.text.SimpleDateFormat;
 import java.util.GregorianCalendar;
 import java.util.Locale;
 
 import org.apache.pivot.collections.Dictionary;
+import org.apache.pivot.json.JSON;
+import org.apache.pivot.serialization.SerializationException;
 import org.apache.pivot.util.CalendarDate;
 import org.apache.pivot.util.Filter;
+import org.apache.pivot.util.Resources;
 import org.apache.pivot.wtk.Bounds;
 import org.apache.pivot.wtk.Button;
 import org.apache.pivot.wtk.ButtonGroup;
@@ -361,6 +365,8 @@ public class TerraCalendarSkin extends C
 
     private Button.DataRenderer dateButtonDataRenderer = new DateButtonDataRenderer();
 
+    private int weekdayCharacterIndex;
+
     private CalendarDate today = null;
 
     private Font font;
@@ -506,6 +512,17 @@ public class TerraCalendarSkin extends C
 
             calendarTablePane.getRows().add(calendarRow);
         }
+
+        Resources resources;
+        try {
+            resources = new Resources(TerraCalendarSkin.class.getName());
+        } catch (IOException exception) {
+            throw new RuntimeException(exception);
+        } catch (SerializationException exception) {
+            throw new RuntimeException(exception);
+        }
+
+        weekdayCharacterIndex = JSON.getInteger(resources, "weekdayCharacterIndex");
     }
 
     @Override
@@ -577,7 +594,7 @@ public class TerraCalendarSkin extends C
             Label label = (Label)row.get(i);
             gregorianCalendar.set(java.util.Calendar.DAY_OF_WEEK, firstDayOfWeek + i);
             String text = monthFormat.format(gregorianCalendar.getTime());
-            text = Character.toString(text.charAt(0));
+            text = Character.toString(text.charAt(weekdayCharacterIndex));
             label.setText(text);
         }
     }
@@ -707,6 +724,16 @@ public class TerraCalendarSkin extends C
         }
 
         this.font = font;
+
+        monthSpinner.getStyles().put("font", font);
+        yearSpinner.getStyles().put("font", font);
+
+        TablePane.Row row = calendarTablePane.getRows().get(1);
+        for (int i = 0; i < 7; i++) {
+            Label label = (Label)row.get(i);
+            label.getStyles().put("font", font);
+        }
+
         invalidateComponent();
     }
 
@@ -910,7 +937,7 @@ public class TerraCalendarSkin extends C
 
     @Override
     public void localeChanged(Calendar calendar, Locale previousLocale) {
-        invalidateComponent(); // TODO Necessary?
+        invalidateComponent();
 
         updateLabels();
         updateCalendar();

Added: pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.json
URL: http://svn.apache.org/viewvc/pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.json?rev=986339&view=auto
==============================================================================
--- pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.json (added)
+++ pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin.json Tue Aug 17 14:52:36 2010
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{  weekdayCharacterIndex: 0
+}

Added: pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin_zh.json
URL: http://svn.apache.org/viewvc/pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin_zh.json?rev=986339&view=auto
==============================================================================
--- pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin_zh.json (added)
+++ pivot/branches/1.5.x/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraCalendarSkin_zh.json Tue Aug 17 14:52:36 2010
@@ -0,0 +1,18 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in
+ * compliance with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+{  weekdayCharacterIndex: 2
+}