You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by hl...@apache.org on 2013/06/12 21:15:04 UTC

[1/4] git commit: Add ability to defer a change to the Palette until after a confirmation dialog

Updated Branches:
  refs/heads/master 53e056052 -> f40f4f7eb


Add ability to defer a change to the Palette until after a confirmation dialog


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a9bdf414
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a9bdf414
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a9bdf414

Branch: refs/heads/master
Commit: a9bdf414771678a6970e7459e955f6601e98e3e3
Parents: 53e0560
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Jun 11 07:49:03 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Jun 11 07:49:03 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/events.coffee      |  2 +
 .../META-INF/modules/t5/core/palette.coffee     | 62 ++++++++++++--------
 2 files changed, 38 insertions(+), 26 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a9bdf414/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
index 4054520..8d0efd3 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
@@ -130,6 +130,8 @@ define
     # * selectedValues - list of selected values (if change is allowed)
     # * reorder - if true, then the event represents changing the ordrer of the selections only
     # * cancel - function to invoke to prevent the change to the Palette from occurring
+    # * defer - like cancel, but returns a no-arguments function that will perform the update at a later date (e.g.,
+    #   after a confirmation panel)
     willChange: "t5:palette:willChange"
     # Event triggered after the selection has changed. The memo object has one property:
     # * selectedValues - list of selected values

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a9bdf414/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
index 9f8cc4c..f119496 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
@@ -136,7 +136,7 @@ define ["./dom", "underscore", "./events"],
 
         # The element before the first selected element is the pivot; all the selected elements will
         # move before the pivot. If there is no pivot, the elements are shifted to the front of the list.
-        firstMoverIndex= _.first(movers).index
+        firstMoverIndex = _.first(movers).index
         pivot = options[firstMoverIndex - 1]
 
         options = _.reject options, isSelected
@@ -178,15 +178,8 @@ define ["./dom", "underscore", "./events"],
 
         canceled = false
 
-        memo =
-          selectedValues: _.pluck options, "value"
-          reorder: true
-          cancel: -> canceled = true
-
-        @selected.trigger events.palette.willChange, memo
-
-        unless canceled
 
+        doUpdate = =>
           @deleteOptions @selected
 
           for o in options
@@ -196,6 +189,18 @@ define ["./dom", "underscore", "./events"],
 
           @updateAfterChange()
 
+        memo =
+          selectedValues: _.pluck options, "value"
+          reorder: true
+          cancel: -> canceled = true
+          defer: ->
+            canceled = true
+            return doUpdate
+
+        @selected.trigger events.palette.willChange, memo
+
+        doUpdate() unless canceled
+
       # Deletes all options from a select (an ElementWrapper), prior to new options being populated in.
       deleteOptions: (select) ->
 
@@ -223,32 +228,37 @@ define ["./dom", "underscore", "./events"],
 
         canceled = false
 
+        doUpdate = =>
+          for i in [(from.element.length - 1)..0] by -1
+            if from.element.options[i].selected
+              from.element.remove i
+
+          # A bit ugly: update the to select by removing all, then adding back in.
+
+          for i in [(to.element.length - 1)..0] by -1
+            to.element.options[i].selected = false
+            to.element.remove i
+
+          for o in toOptions
+            to.element.add o, null
+
+          @selected.trigger events.palette.didChange, memo
+
+          @updateAfterChange()
+
         memo =
           selectedValues: _.pluck selectedOptions, "value"
           reorder: false
           cancel: -> canceled = true
+          defer: ->
+            canceled = true
+            return doUpdate
 
         @selected.trigger events.palette.willChange, memo
 
-        return if canceled
+        doUpdate() unless canceled
 
         # Remove the movers (the selected from elements):
-        for i in [(from.element.length - 1)..0] by -1
-          if from.element.options[i].selected
-            from.element.remove i
-
-        # A bit ugly: update the to select by removing all, then adding back in.
-
-        for i in [(to.element.length - 1)..0] by -1
-          to.element.options[i].selected = false
-          to.element.remove i
-
-        for o in toOptions
-          to.element.add o, null
-
-        @selected.trigger events.palette.didChange, memo
-
-        @updateAfterChange()
 
 
       insertOption: (options, option, atEnd) ->


[2/4] git commit: Tighten up the code

Posted by hl...@apache.org.
Tighten up the code


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a083f0c2
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a083f0c2
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a083f0c2

Branch: refs/heads/master
Commit: a083f0c2f336f6551e1526ebdabb4f216de6e43d
Parents: a9bdf41
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Jun 11 08:15:43 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Jun 11 08:15:43 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/palette.coffee     | 42 +++++++-------------
 1 file changed, 14 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a083f0c2/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
index f119496..5c112f3 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
@@ -176,22 +176,29 @@ define ["./dom", "underscore", "./events"],
       # didUpdate events.
       reorderSelected: (options) ->
 
-        canceled = false
-
+        @performUpdate true, options, =>
 
-        doUpdate = =>
           @deleteOptions @selected
 
           for o in options
             @selected.element.add o, null
 
-          @selected.trigger events.palette.didChange, memo
+      # Performs the update, which includes the willChange and didChange events.
+      performUpdate: (isReorder, selectedOptions, updateCallback) ->
+
+        canceled = false
+        selectedValues = _.pluck selectedOptions, "value"
+
+        doUpdate = =>
+          updateCallback()
+
+          @selected.trigger events.palette.didChange, { selectedValues }
 
           @updateAfterChange()
 
         memo =
-          selectedValues: _.pluck options, "value"
-          reorder: true
+          selectedValues: selectedValues
+          reorder: isReorder
           cancel: -> canceled = true
           defer: ->
             canceled = true
@@ -226,9 +233,7 @@ define ["./dom", "underscore", "./events"],
 
         selectedOptions = if to is @selected then toOptions else fromOptions
 
-        canceled = false
-
-        doUpdate = =>
+        @performUpdate false, selectedOptions, =>
           for i in [(from.element.length - 1)..0] by -1
             if from.element.options[i].selected
               from.element.remove i
@@ -242,25 +247,6 @@ define ["./dom", "underscore", "./events"],
           for o in toOptions
             to.element.add o, null
 
-          @selected.trigger events.palette.didChange, memo
-
-          @updateAfterChange()
-
-        memo =
-          selectedValues: _.pluck selectedOptions, "value"
-          reorder: false
-          cancel: -> canceled = true
-          defer: ->
-            canceled = true
-            return doUpdate
-
-        @selected.trigger events.palette.willChange, memo
-
-        doUpdate() unless canceled
-
-        # Remove the movers (the selected from elements):
-
-
       insertOption: (options, option, atEnd) ->
 
         unless atEnd


[4/4] git commit: Pass the selected options, not the values, in the Palette willChange/didChange event memo

Posted by hl...@apache.org.
Pass the selected options, not the values, in the Palette willChange/didChange event memo


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/f40f4f7e
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/f40f4f7e
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/f40f4f7e

Branch: refs/heads/master
Commit: f40f4f7eb29e9c6b9e6197893a7e39bfef6e5dcb
Parents: d30479a
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Jun 11 12:11:47 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Jun 11 12:11:47 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/events.coffee      | 26 +++++++++++---------
 .../META-INF/modules/t5/core/palette.coffee     |  9 +++----
 tapestry-core/src/test/app1/PaletteDemo.tml     |  2 ++
 .../META-INF/modules/palette-demo.coffee        | 10 +++++---
 4 files changed, 28 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f40f4f7e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
index 8d0efd3..5c9d9c8 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
@@ -126,15 +126,19 @@ define
 
   # Events triggered by the Palette component.
   palette:
-    # Event triggered when the selection is about to change. The memo object has these properties:
-    # * selectedValues - list of selected values (if change is allowed)
-    # * reorder - if true, then the event represents changing the ordrer of the selections only
-    # * cancel - function to invoke to prevent the change to the Palette from occurring
-    # * defer - like cancel, but returns a no-arguments function that will perform the update at a later date (e.g.,
+    # Event triggered when the selection is about to change.
+    #
+    # * memo.selectedOptions - array of selected options (e.g., HTMLOptionElement) representing which options
+    #   will be selected in the Palette, should the change be allowed.
+    # * memo.reorder - if true, then the event represents changing the order of the selections only
+    # * memo.cancel - function to invoke to prevent the change to the Palette from occurring
+    # * memo.defer - like cancel, but returns a no-arguments function that will perform the update at a later date (e.g.,
     #   after a confirmation panel)
     willChange: "t5:palette:willChange"
-    # Event triggered after the selection has changed. The memo object has one property:
-    # * selectedValues - list of selected values
+    # Event triggered after the Palette selection has changed.
+    #
+    # * memo.selectedOptions - array of selected options (e.g., HTMLOptionElement)
+    # * memo.reorder - if true, the event represents a change in the order of selections only
     didChange: "t5:palette:didChange"
 
   # Defines a number of event names specific to Tapestry Zones. Zones are Tapestry components that are structured
@@ -148,12 +152,12 @@ define
     # content.
     update: "t5:zone:update"
 
-    # Triggered (by the standard handler) just before the content in a Zone will be updated.
+    # Triggered (by the standard `events.zone.update` event handler) just before the content in a Zone will be updated.
     willUpdate: "t5:zone:will-update"
 
-    # Triggered (by the standard handler) just after the content in a Zone has updated. If the zone was not visible, it
-    # is made visible after its content is changed, and before this event is triggered. Some number of other components that
-    # also perform Ajax updates of the page also trigger this event.
+    # Triggered (by the standard `events.zone.update` event handle) just after the content in a Zone has updated.
+    # If the zone was not visible, it is made visible after its content is changed, and before this event is triggered.
+    # Some number of other components that also perform Ajax updates of the page also trigger this event.
     #
     # Certain components bind this event to scan new additions to the page to see if certain structures exist and
     # create client-side support in the form of controllers and event handlers. DateField is one such example

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f40f4f7e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
index 5c112f3..b578dfb 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
@@ -184,21 +184,20 @@ define ["./dom", "underscore", "./events"],
             @selected.element.add o, null
 
       # Performs the update, which includes the willChange and didChange events.
-      performUpdate: (isReorder, selectedOptions, updateCallback) ->
+      performUpdate: (reorder, selectedOptions, updateCallback) ->
 
         canceled = false
-        selectedValues = _.pluck selectedOptions, "value"
 
         doUpdate = =>
           updateCallback()
 
-          @selected.trigger events.palette.didChange, { selectedValues }
+          @selected.trigger events.palette.didChange, { selectedOptions, reorder }
 
           @updateAfterChange()
 
         memo =
-          selectedValues: selectedValues
-          reorder: isReorder
+          selectedOptions: selectedOptions
+          reorder: reorder
           cancel: -> canceled = true
           defer: ->
             canceled = true

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f40f4f7e/tapestry-core/src/test/app1/PaletteDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/PaletteDemo.tml b/tapestry-core/src/test/app1/PaletteDemo.tml
index 7e516ce..4d06d78 100644
--- a/tapestry-core/src/test/app1/PaletteDemo.tml
+++ b/tapestry-core/src/test/app1/PaletteDemo.tml
@@ -44,6 +44,8 @@
     <dd id="selected-languages">${languages}</dd>
     <dt>Selected Values</dt>
     <dd id="event-selection"/>
+    <dt>Reorder</dt>
+    <dd id="event-reorder"></dd>
 </dl>
 
 </html>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f40f4f7e/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee b/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee
index 226e062..d75c9ba 100644
--- a/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee
+++ b/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee
@@ -1,5 +1,9 @@
-define ["t5/core/dom", "t5/core/events"],
-  (dom, events) ->
+define ["t5/core/dom", "t5/core/events", "underscore"],
+  (dom, events, _) ->
 
     dom.onDocument events.palette.willChange, (event, memo) ->
-      (dom "event-selection").update JSON.stringify memo.selectedValues
\ No newline at end of file
+
+      values = _.map memo.selectedOptions, (o) -> o.value
+
+      (dom "event-selection").update JSON.stringify values
+      (dom "event-reorder").update memo.reorder.toString()
\ No newline at end of file


[2/4] git commit: Tighten up the code

Posted by hl...@apache.org.
Tighten up the code


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/a083f0c2
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/a083f0c2
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/a083f0c2

Branch: refs/heads/master
Commit: a083f0c2f336f6551e1526ebdabb4f216de6e43d
Parents: a9bdf41
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Jun 11 08:15:43 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Jun 11 08:15:43 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/palette.coffee     | 42 +++++++-------------
 1 file changed, 14 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/a083f0c2/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
index f119496..5c112f3 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
@@ -176,22 +176,29 @@ define ["./dom", "underscore", "./events"],
       # didUpdate events.
       reorderSelected: (options) ->
 
-        canceled = false
-
+        @performUpdate true, options, =>
 
-        doUpdate = =>
           @deleteOptions @selected
 
           for o in options
             @selected.element.add o, null
 
-          @selected.trigger events.palette.didChange, memo
+      # Performs the update, which includes the willChange and didChange events.
+      performUpdate: (isReorder, selectedOptions, updateCallback) ->
+
+        canceled = false
+        selectedValues = _.pluck selectedOptions, "value"
+
+        doUpdate = =>
+          updateCallback()
+
+          @selected.trigger events.palette.didChange, { selectedValues }
 
           @updateAfterChange()
 
         memo =
-          selectedValues: _.pluck options, "value"
-          reorder: true
+          selectedValues: selectedValues
+          reorder: isReorder
           cancel: -> canceled = true
           defer: ->
             canceled = true
@@ -226,9 +233,7 @@ define ["./dom", "underscore", "./events"],
 
         selectedOptions = if to is @selected then toOptions else fromOptions
 
-        canceled = false
-
-        doUpdate = =>
+        @performUpdate false, selectedOptions, =>
           for i in [(from.element.length - 1)..0] by -1
             if from.element.options[i].selected
               from.element.remove i
@@ -242,25 +247,6 @@ define ["./dom", "underscore", "./events"],
           for o in toOptions
             to.element.add o, null
 
-          @selected.trigger events.palette.didChange, memo
-
-          @updateAfterChange()
-
-        memo =
-          selectedValues: _.pluck selectedOptions, "value"
-          reorder: false
-          cancel: -> canceled = true
-          defer: ->
-            canceled = true
-            return doUpdate
-
-        @selected.trigger events.palette.willChange, memo
-
-        doUpdate() unless canceled
-
-        # Remove the movers (the selected from elements):
-
-
       insertOption: (options, option, atEnd) ->
 
         unless atEnd


[3/4] git commit: Switch the Palette over to using just Glyphicons for the buttons

Posted by hl...@apache.org.
Switch the Palette over to using just Glyphicons for the buttons


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/d30479a0
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/d30479a0
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/d30479a0

Branch: refs/heads/master
Commit: d30479a03d9cb4796cbb0fb19fa7ea5ba3316fed
Parents: a083f0c
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Jun 11 08:16:25 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Jun 11 08:16:25 2013 -0700

----------------------------------------------------------------------
 .../tapestry5/corelib/components/Palette.java   |  20 +++++++++++--------
 .../resources/META-INF/assets/core/deselect.png | Bin 1837 -> 0 bytes
 .../META-INF/assets/core/move_down.png          | Bin 1338 -> 0 bytes
 .../resources/META-INF/assets/core/move_up.png  | Bin 1319 -> 0 bytes
 .../resources/META-INF/assets/core/select.png   | Bin 1885 -> 0 bytes
 .../tapestry5/corelib/components/Palette.tml    |   8 ++++----
 6 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
index 5ea4fba..05c096d 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
@@ -23,6 +23,7 @@ import org.apache.tapestry5.internal.util.SelectModelRenderer;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.ioc.annotations.Symbol;
 import org.apache.tapestry5.json.JSONArray;
+import org.apache.tapestry5.services.compatibility.DeprecationWarning;
 
 import java.util.Collection;
 
@@ -74,8 +75,7 @@ public class Palette extends AbstractField
     /**
      * The image to use for the deselect button (the default is a left pointing arrow).
      */
-    @Parameter(value = "asset:deselect.png")
-    @Property(write = false)
+    @Parameter
     private Asset deselect;
 
     /**
@@ -112,22 +112,19 @@ public class Palette extends AbstractField
     /**
      * The image to use for the move down button (the default is a downward pointing arrow).
      */
-    @Parameter(value = "asset:move_down.png")
-    @Property(write = false)
+    @Parameter
     private Asset moveDown;
 
     /**
      * The image to use for the move up button (the default is an upward pointing arrow).
      */
-    @Parameter(value = "asset:move_up.png")
-    @Property(write = false)
+    @Parameter
     private Asset moveUp;
 
     /**
      * The image to use for the select button (the default is a right pointing arrow).
      */
-    @Parameter(value = "asset:select.png")
-    @Property(write = false)
+    @Parameter
     private Asset select;
 
     /**
@@ -172,6 +169,13 @@ public class Palette extends AbstractField
     @Symbol(SymbolConstants.COMPACT_JSON)
     private boolean compactJSON;
 
+    @Inject
+    private DeprecationWarning deprecationWarning;
+
+    void pageLoaded() {
+        deprecationWarning.ignoredComponentParameters(resources, "select", "moveUp", "moveDown", "deselect");
+    }
+
 
     public final Renderable mainRenderer = new Renderable()
     {

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/META-INF/assets/core/deselect.png
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/core/deselect.png b/tapestry-core/src/main/resources/META-INF/assets/core/deselect.png
deleted file mode 100644
index 97473a6..0000000
Binary files a/tapestry-core/src/main/resources/META-INF/assets/core/deselect.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/META-INF/assets/core/move_down.png
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/core/move_down.png b/tapestry-core/src/main/resources/META-INF/assets/core/move_down.png
deleted file mode 100644
index 1f5c72a..0000000
Binary files a/tapestry-core/src/main/resources/META-INF/assets/core/move_down.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/META-INF/assets/core/move_up.png
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/core/move_up.png b/tapestry-core/src/main/resources/META-INF/assets/core/move_up.png
deleted file mode 100644
index 05a447b..0000000
Binary files a/tapestry-core/src/main/resources/META-INF/assets/core/move_up.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/META-INF/assets/core/select.png
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/core/select.png b/tapestry-core/src/main/resources/META-INF/assets/core/select.png
deleted file mode 100644
index 78c78a4..0000000
Binary files a/tapestry-core/src/main/resources/META-INF/assets/core/select.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml
index 8b3b196..cff60a1 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml
@@ -18,23 +18,23 @@
     <div class="palette-controls">
         <div>
             <button data-action="select" class="btn" disabled="${disabledValue}">
-                <img src="${select}" alt="${message:core-palette-select-label}"/>
+                <i class="icon-arrow-right"/>
             </button>
         </div>
         <div>
             <button data-action="deselect" class="btn" disabled="${disabledValue}">
-                <img src="${deselect}" alt="${message:core-palette-deselect-label}"/>
+                <i class="icon-arrow-left"/>
             </button>
         </div>
         <t:if test="reorder">
             <div>
                 <button data-action="move-up" class="btn" disabled="${disabledValue}">
-                    <img src="${moveUp}" alt="${message:core-palette-up-label}"/>
+                    <i class="icon-arrow-up"/>
                 </button>
             </div>
             <div>
                 <button data-action="move-down" class="btn" disabled="${disabledValue}">
-                    <img src="${moveDown}" alt="${message:core-palette-down-label}"/>
+                    <i class="icon-arrow-down"/>
                 </button>
             </div>
         </t:if>


[3/4] git commit: Switch the Palette over to using just Glyphicons for the buttons

Posted by hl...@apache.org.
Switch the Palette over to using just Glyphicons for the buttons


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/d30479a0
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/d30479a0
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/d30479a0

Branch: refs/heads/master
Commit: d30479a03d9cb4796cbb0fb19fa7ea5ba3316fed
Parents: a083f0c
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Jun 11 08:16:25 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Jun 11 08:16:25 2013 -0700

----------------------------------------------------------------------
 .../tapestry5/corelib/components/Palette.java   |  20 +++++++++++--------
 .../resources/META-INF/assets/core/deselect.png | Bin 1837 -> 0 bytes
 .../META-INF/assets/core/move_down.png          | Bin 1338 -> 0 bytes
 .../resources/META-INF/assets/core/move_up.png  | Bin 1319 -> 0 bytes
 .../resources/META-INF/assets/core/select.png   | Bin 1885 -> 0 bytes
 .../tapestry5/corelib/components/Palette.tml    |   8 ++++----
 6 files changed, 16 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
index 5ea4fba..05c096d 100644
--- a/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
+++ b/tapestry-core/src/main/java/org/apache/tapestry5/corelib/components/Palette.java
@@ -23,6 +23,7 @@ import org.apache.tapestry5.internal.util.SelectModelRenderer;
 import org.apache.tapestry5.ioc.annotations.Inject;
 import org.apache.tapestry5.ioc.annotations.Symbol;
 import org.apache.tapestry5.json.JSONArray;
+import org.apache.tapestry5.services.compatibility.DeprecationWarning;
 
 import java.util.Collection;
 
@@ -74,8 +75,7 @@ public class Palette extends AbstractField
     /**
      * The image to use for the deselect button (the default is a left pointing arrow).
      */
-    @Parameter(value = "asset:deselect.png")
-    @Property(write = false)
+    @Parameter
     private Asset deselect;
 
     /**
@@ -112,22 +112,19 @@ public class Palette extends AbstractField
     /**
      * The image to use for the move down button (the default is a downward pointing arrow).
      */
-    @Parameter(value = "asset:move_down.png")
-    @Property(write = false)
+    @Parameter
     private Asset moveDown;
 
     /**
      * The image to use for the move up button (the default is an upward pointing arrow).
      */
-    @Parameter(value = "asset:move_up.png")
-    @Property(write = false)
+    @Parameter
     private Asset moveUp;
 
     /**
      * The image to use for the select button (the default is a right pointing arrow).
      */
-    @Parameter(value = "asset:select.png")
-    @Property(write = false)
+    @Parameter
     private Asset select;
 
     /**
@@ -172,6 +169,13 @@ public class Palette extends AbstractField
     @Symbol(SymbolConstants.COMPACT_JSON)
     private boolean compactJSON;
 
+    @Inject
+    private DeprecationWarning deprecationWarning;
+
+    void pageLoaded() {
+        deprecationWarning.ignoredComponentParameters(resources, "select", "moveUp", "moveDown", "deselect");
+    }
+
 
     public final Renderable mainRenderer = new Renderable()
     {

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/META-INF/assets/core/deselect.png
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/core/deselect.png b/tapestry-core/src/main/resources/META-INF/assets/core/deselect.png
deleted file mode 100644
index 97473a6..0000000
Binary files a/tapestry-core/src/main/resources/META-INF/assets/core/deselect.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/META-INF/assets/core/move_down.png
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/core/move_down.png b/tapestry-core/src/main/resources/META-INF/assets/core/move_down.png
deleted file mode 100644
index 1f5c72a..0000000
Binary files a/tapestry-core/src/main/resources/META-INF/assets/core/move_down.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/META-INF/assets/core/move_up.png
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/core/move_up.png b/tapestry-core/src/main/resources/META-INF/assets/core/move_up.png
deleted file mode 100644
index 05a447b..0000000
Binary files a/tapestry-core/src/main/resources/META-INF/assets/core/move_up.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/META-INF/assets/core/select.png
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/META-INF/assets/core/select.png b/tapestry-core/src/main/resources/META-INF/assets/core/select.png
deleted file mode 100644
index 78c78a4..0000000
Binary files a/tapestry-core/src/main/resources/META-INF/assets/core/select.png and /dev/null differ

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/d30479a0/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml
index 8b3b196..cff60a1 100644
--- a/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml
+++ b/tapestry-core/src/main/resources/org/apache/tapestry5/corelib/components/Palette.tml
@@ -18,23 +18,23 @@
     <div class="palette-controls">
         <div>
             <button data-action="select" class="btn" disabled="${disabledValue}">
-                <img src="${select}" alt="${message:core-palette-select-label}"/>
+                <i class="icon-arrow-right"/>
             </button>
         </div>
         <div>
             <button data-action="deselect" class="btn" disabled="${disabledValue}">
-                <img src="${deselect}" alt="${message:core-palette-deselect-label}"/>
+                <i class="icon-arrow-left"/>
             </button>
         </div>
         <t:if test="reorder">
             <div>
                 <button data-action="move-up" class="btn" disabled="${disabledValue}">
-                    <img src="${moveUp}" alt="${message:core-palette-up-label}"/>
+                    <i class="icon-arrow-up"/>
                 </button>
             </div>
             <div>
                 <button data-action="move-down" class="btn" disabled="${disabledValue}">
-                    <img src="${moveDown}" alt="${message:core-palette-down-label}"/>
+                    <i class="icon-arrow-down"/>
                 </button>
             </div>
         </t:if>


[4/4] git commit: Pass the selected options, not the values, in the Palette willChange/didChange event memo

Posted by hl...@apache.org.
Pass the selected options, not the values, in the Palette willChange/didChange event memo


Project: http://git-wip-us.apache.org/repos/asf/tapestry-5/repo
Commit: http://git-wip-us.apache.org/repos/asf/tapestry-5/commit/f40f4f7e
Tree: http://git-wip-us.apache.org/repos/asf/tapestry-5/tree/f40f4f7e
Diff: http://git-wip-us.apache.org/repos/asf/tapestry-5/diff/f40f4f7e

Branch: refs/heads/master
Commit: f40f4f7eb29e9c6b9e6197893a7e39bfef6e5dcb
Parents: d30479a
Author: Howard M. Lewis Ship <hl...@apache.org>
Authored: Tue Jun 11 12:11:47 2013 -0700
Committer: Howard M. Lewis Ship <hl...@apache.org>
Committed: Tue Jun 11 12:11:47 2013 -0700

----------------------------------------------------------------------
 .../META-INF/modules/t5/core/events.coffee      | 26 +++++++++++---------
 .../META-INF/modules/t5/core/palette.coffee     |  9 +++----
 tapestry-core/src/test/app1/PaletteDemo.tml     |  2 ++
 .../META-INF/modules/palette-demo.coffee        | 10 +++++---
 4 files changed, 28 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f40f4f7e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
index 8d0efd3..5c9d9c8 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/events.coffee
@@ -126,15 +126,19 @@ define
 
   # Events triggered by the Palette component.
   palette:
-    # Event triggered when the selection is about to change. The memo object has these properties:
-    # * selectedValues - list of selected values (if change is allowed)
-    # * reorder - if true, then the event represents changing the ordrer of the selections only
-    # * cancel - function to invoke to prevent the change to the Palette from occurring
-    # * defer - like cancel, but returns a no-arguments function that will perform the update at a later date (e.g.,
+    # Event triggered when the selection is about to change.
+    #
+    # * memo.selectedOptions - array of selected options (e.g., HTMLOptionElement) representing which options
+    #   will be selected in the Palette, should the change be allowed.
+    # * memo.reorder - if true, then the event represents changing the order of the selections only
+    # * memo.cancel - function to invoke to prevent the change to the Palette from occurring
+    # * memo.defer - like cancel, but returns a no-arguments function that will perform the update at a later date (e.g.,
     #   after a confirmation panel)
     willChange: "t5:palette:willChange"
-    # Event triggered after the selection has changed. The memo object has one property:
-    # * selectedValues - list of selected values
+    # Event triggered after the Palette selection has changed.
+    #
+    # * memo.selectedOptions - array of selected options (e.g., HTMLOptionElement)
+    # * memo.reorder - if true, the event represents a change in the order of selections only
     didChange: "t5:palette:didChange"
 
   # Defines a number of event names specific to Tapestry Zones. Zones are Tapestry components that are structured
@@ -148,12 +152,12 @@ define
     # content.
     update: "t5:zone:update"
 
-    # Triggered (by the standard handler) just before the content in a Zone will be updated.
+    # Triggered (by the standard `events.zone.update` event handler) just before the content in a Zone will be updated.
     willUpdate: "t5:zone:will-update"
 
-    # Triggered (by the standard handler) just after the content in a Zone has updated. If the zone was not visible, it
-    # is made visible after its content is changed, and before this event is triggered. Some number of other components that
-    # also perform Ajax updates of the page also trigger this event.
+    # Triggered (by the standard `events.zone.update` event handle) just after the content in a Zone has updated.
+    # If the zone was not visible, it is made visible after its content is changed, and before this event is triggered.
+    # Some number of other components that also perform Ajax updates of the page also trigger this event.
     #
     # Certain components bind this event to scan new additions to the page to see if certain structures exist and
     # create client-side support in the form of controllers and event handlers. DateField is one such example

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f40f4f7e/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
index 5c112f3..b578dfb 100644
--- a/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
+++ b/tapestry-core/src/main/coffeescript/META-INF/modules/t5/core/palette.coffee
@@ -184,21 +184,20 @@ define ["./dom", "underscore", "./events"],
             @selected.element.add o, null
 
       # Performs the update, which includes the willChange and didChange events.
-      performUpdate: (isReorder, selectedOptions, updateCallback) ->
+      performUpdate: (reorder, selectedOptions, updateCallback) ->
 
         canceled = false
-        selectedValues = _.pluck selectedOptions, "value"
 
         doUpdate = =>
           updateCallback()
 
-          @selected.trigger events.palette.didChange, { selectedValues }
+          @selected.trigger events.palette.didChange, { selectedOptions, reorder }
 
           @updateAfterChange()
 
         memo =
-          selectedValues: selectedValues
-          reorder: isReorder
+          selectedOptions: selectedOptions
+          reorder: reorder
           cancel: -> canceled = true
           defer: ->
             canceled = true

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f40f4f7e/tapestry-core/src/test/app1/PaletteDemo.tml
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/app1/PaletteDemo.tml b/tapestry-core/src/test/app1/PaletteDemo.tml
index 7e516ce..4d06d78 100644
--- a/tapestry-core/src/test/app1/PaletteDemo.tml
+++ b/tapestry-core/src/test/app1/PaletteDemo.tml
@@ -44,6 +44,8 @@
     <dd id="selected-languages">${languages}</dd>
     <dt>Selected Values</dt>
     <dd id="event-selection"/>
+    <dt>Reorder</dt>
+    <dd id="event-reorder"></dd>
 </dl>
 
 </html>

http://git-wip-us.apache.org/repos/asf/tapestry-5/blob/f40f4f7e/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee
----------------------------------------------------------------------
diff --git a/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee b/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee
index 226e062..d75c9ba 100644
--- a/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee
+++ b/tapestry-core/src/test/coffeescript/META-INF/modules/palette-demo.coffee
@@ -1,5 +1,9 @@
-define ["t5/core/dom", "t5/core/events"],
-  (dom, events) ->
+define ["t5/core/dom", "t5/core/events", "underscore"],
+  (dom, events, _) ->
 
     dom.onDocument events.palette.willChange, (event, memo) ->
-      (dom "event-selection").update JSON.stringify memo.selectedValues
\ No newline at end of file
+
+      values = _.map memo.selectedOptions, (o) -> o.value
+
+      (dom "event-selection").update JSON.stringify values
+      (dom "event-reorder").update memo.reorder.toString()
\ No newline at end of file