You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2015/09/15 19:42:26 UTC

svn commit: r1703265 - in /pivot/branches/2.0.x: ./ tutorials/src/org/apache/pivot/tutorials/calculator/ wtk/src/org/apache/pivot/wtk/

Author: rwhitcomb
Date: Tue Sep 15 17:42:25 2015
New Revision: 1703265

URL: http://svn.apache.org/r1703265
Log:
PIVOT-972:  Add a small tutorial application: a simple calculator app, to demonstrate
keyboard mappings and action mappings.

This is the first cut of the app, which works, except for some issues:
* The "Settings" button does nothing.
* There are issues with the result overflowing the display sometimes.
* Arithmetic errors are not trapped and handled gracefully.
* No shortcut key for the "+/-" button.
* Would like to "push" the buttons when the corresponding keys are pressed.
* No help is available.
* There may be a problem with "Clear" when an operator is pending.
* There is no check on the input size, which can easily overflow the display area.
* Backspace after an operator is chosen may not work correctly.
* The native window should be sized nicely to just fit the form.
* Needs Javadoc in the code.

Add another "famfamfam" icon for use here, and update the NOTICE file.

Add several Keyboard.KeyCode values that are used here for available virtual keys.

This is a merge of revision 1687874 from trunk to branches/2.0.x with one change
so that Calculator.java will compile with Java 6.

Added:
    pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java
      - copied, changed from r1687874, pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java
    pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/calculator/asterisk_orange.png
      - copied unchanged from r1687874, pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calculator/asterisk_orange.png
    pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/calculator/calculator.bxml
      - copied unchanged from r1687874, pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calculator/calculator.bxml
    pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/calculator/calculator_styles.json
      - copied unchanged from r1687874, pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calculator/calculator_styles.json
Modified:
    pivot/branches/2.0.x/   (props changed)
    pivot/branches/2.0.x/LICENSE
    pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Keyboard.java

Propchange: pivot/branches/2.0.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Sep 15 17:42:25 2015
@@ -1 +1 @@
-/pivot/trunk:1346574,1347051,1394847,1394858,1398511,1399331,1401781,1405882,1407585,1409081,1410536,1410555,1417081,1417258,1428056,1428650,1435351,1436707,1438126,1438659,1444260,1444910,1502657,1510821,1516518,1519859,1522078,1523205,1523736,1523776,1525982,1526005,1536829,1537222,1604238,1610563,1611829,1614462,1624381,1675204,1675517,1678238,1678251,1687873,1688523,1691618
+/pivot/trunk:1346574,1347051,1394847,1394858,1398511,1399331,1401781,1405882,1407585,1409081,1410536,1410555,1417081,1417258,1428056,1428650,1435351,1436707,1438126,1438659,1444260,1444910,1502657,1510821,1516518,1519859,1522078,1523205,1523736,1523776,1525982,1526005,1536829,1537222,1604238,1610563,1611829,1614462,1624381,1675204,1675517,1678238,1678251,1687873-1687874,1688523,1691618

Modified: pivot/branches/2.0.x/LICENSE
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/LICENSE?rev=1703265&r1=1703264&r2=1703265&view=diff
==============================================================================
--- pivot/branches/2.0.x/LICENSE (original)
+++ pivot/branches/2.0.x/LICENSE Tue Sep 15 17:42:25 2015
@@ -354,6 +354,7 @@ The following components are licensed un
      tutorials/src/org/apache/pivot/tutorials/buttons/resultset_previous.png
      tutorials/src/org/apache/pivot/tutorials/clock.png
      tutorials/src/org/apache/pivot/tutorials/cup.png
+     tutorials/src/org/apache/pivot/tutorials/calculator/asterisk_orange.png
      tutorials/src/org/apache/pivot/tutorials/explorer/buttons/resultset_next.png
      tutorials/src/org/apache/pivot/tutorials/explorer/menus/coins.png
      tutorials/src/org/apache/pivot/tutorials/explorer/navigation/bell.png

Copied: pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java (from r1687874, pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java)
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java?p2=pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java&p1=pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java&r1=1687874&r2=1703265&rev=1703265&view=diff
==============================================================================
--- pivot/trunk/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java (original)
+++ pivot/branches/2.0.x/tutorials/src/org/apache/pivot/tutorials/calculator/Calculator.java Tue Sep 15 17:42:25 2015
@@ -95,7 +95,9 @@ public class Calculator
             mainWindow.open(display);
             mainWindow.requestFocus();
         }
-        catch (IOException | SerializationException ex) {
+        catch (IOException ioe) {
+        }
+        catch (SerializationException se) {
         }
     }
 

Modified: pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Keyboard.java
URL: http://svn.apache.org/viewvc/pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Keyboard.java?rev=1703265&r1=1703264&r2=1703265&view=diff
==============================================================================
--- pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Keyboard.java (original)
+++ pivot/branches/2.0.x/wtk/src/org/apache/pivot/wtk/Keyboard.java Tue Sep 15 17:42:25 2015
@@ -201,6 +201,8 @@ public final class Keyboard {
         public static final int N8 = KeyEvent.VK_8;
         public static final int N9 = KeyEvent.VK_9;
 
+        public static final int PERIOD = KeyEvent.VK_PERIOD;
+
         public static final int TAB = KeyEvent.VK_TAB;
         public static final int SPACE = KeyEvent.VK_SPACE;
         public static final int ENTER = KeyEvent.VK_ENTER;
@@ -244,6 +246,9 @@ public final class Keyboard {
         public static final int MULTIPLY = KeyEvent.VK_MULTIPLY;
         public static final int DIVIDE = KeyEvent.VK_DIVIDE;
 
+        public static final int SLASH = KeyEvent.VK_SLASH;
+        public static final int ASTERISK = KeyEvent.VK_ASTERISK;
+
         public static final int F1 = KeyEvent.VK_F1;
         public static final int F2 = KeyEvent.VK_F2;
         public static final int F3 = KeyEvent.VK_F3;