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/12 00:33:14 UTC

svn commit: r984611 - in /pivot/trunk: wtk-terra/src/org/apache/pivot/wtk/skin/terra/ wtk/src/org/apache/pivot/wtk/

Author: gbrown
Date: Wed Aug 11 22:33:14 2010
New Revision: 984611

URL: http://svn.apache.org/viewvc?rev=984611&view=rev
Log:
Javadoc updates; ignore indirect selection change events in TerraListViewSkin and TerraTableViewSkin.

Modified:
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
    pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/AccordionSelectionListener.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPaneListener.java
    pivot/trunk/wtk/src/org/apache/pivot/wtk/TabPaneSelectionListener.java

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java?rev=984611&r1=984610&r2=984611&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraListViewSkin.java Wed Aug 11 22:33:14 2010
@@ -1203,40 +1203,43 @@ public class TerraListViewSkin extends C
 
     @Override
     public void selectedRangesChanged(ListView listView, Sequence<Span> previousSelectedRanges) {
-        if (listView.isValid()) {
-            // Repaint the area occupied by the previous selection
-            if (previousSelectedRanges != null
-                && previousSelectedRanges.getLength() > 0) {
-                int rangeStart = previousSelectedRanges.get(0).start;
-                int rangeEnd = previousSelectedRanges.get(previousSelectedRanges.getLength() - 1).end;
-
-                Bounds previousSelectionBounds = getItemBounds(rangeStart);
-                previousSelectionBounds = previousSelectionBounds.union(getItemBounds(rangeEnd));
-                repaintComponent(previousSelectionBounds);
-            }
+        if (previousSelectedRanges != null
+            && previousSelectedRanges != listView.getSelectedRanges()) {
+            if (listView.isValid()) {
+                // Repaint the area occupied by the previous selection
+                if (previousSelectedRanges != null
+                    && previousSelectedRanges.getLength() > 0) {
+                    int rangeStart = previousSelectedRanges.get(0).start;
+                    int rangeEnd = previousSelectedRanges.get(previousSelectedRanges.getLength() - 1).end;
+
+                    Bounds previousSelectionBounds = getItemBounds(rangeStart);
+                    previousSelectionBounds = previousSelectionBounds.union(getItemBounds(rangeEnd));
+                    repaintComponent(previousSelectionBounds);
+                }
 
-            // Repaint the area occupied by the current selection
-            Sequence<Span> selectedRanges = listView.getSelectedRanges();
-            if (selectedRanges.getLength() > 0) {
-                int rangeStart = selectedRanges.get(0).start;
-                int rangeEnd = selectedRanges.get(selectedRanges.getLength() - 1).end;
-
-                Bounds selectionBounds = getItemBounds(rangeStart);
-                selectionBounds = selectionBounds.union(getItemBounds(rangeEnd));
-                repaintComponent(selectionBounds);
-
-                // Ensure that the selection is visible
-                Bounds visibleSelectionBounds = listView.getVisibleArea(selectionBounds);
-                if (visibleSelectionBounds != null
-                    && visibleSelectionBounds.height < selectionBounds.height) {
-                    // TODO Repainting the entire component is a workaround for PIVOT-490
-                    repaintComponent();
+                // Repaint the area occupied by the current selection
+                Sequence<Span> selectedRanges = listView.getSelectedRanges();
+                if (selectedRanges.getLength() > 0) {
+                    int rangeStart = selectedRanges.get(0).start;
+                    int rangeEnd = selectedRanges.get(selectedRanges.getLength() - 1).end;
+
+                    Bounds selectionBounds = getItemBounds(rangeStart);
+                    selectionBounds = selectionBounds.union(getItemBounds(rangeEnd));
+                    repaintComponent(selectionBounds);
+
+                    // Ensure that the selection is visible
+                    Bounds visibleSelectionBounds = listView.getVisibleArea(selectionBounds);
+                    if (visibleSelectionBounds != null
+                        && visibleSelectionBounds.height < selectionBounds.height) {
+                        // TODO Repainting the entire component is a workaround for PIVOT-490
+                        repaintComponent();
 
-                    listView.scrollAreaToVisible(selectionBounds);
+                        listView.scrollAreaToVisible(selectionBounds);
+                    }
                 }
+            } else {
+                validateSelection = true;
             }
-        } else {
-            validateSelection = true;
         }
     }
 }

Modified: pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java?rev=984611&r1=984610&r2=984611&view=diff
==============================================================================
--- pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java (original)
+++ pivot/trunk/wtk-terra/src/org/apache/pivot/wtk/skin/terra/TerraTableViewSkin.java Wed Aug 11 22:33:14 2010
@@ -1522,42 +1522,45 @@ public class TerraTableViewSkin extends 
 
     @Override
     public void selectedRangesChanged(TableView tableView, Sequence<Span> previousSelectedRanges) {
-        if (tableView.isValid()) {
-            // Repaint the area occupied by the previous selection
-            if (previousSelectedRanges != null
-                && previousSelectedRanges.getLength() > 0) {
-                int rangeStart = previousSelectedRanges.get(0).start;
-                int rangeEnd = previousSelectedRanges.get(previousSelectedRanges.getLength() - 1).end;
+        if (previousSelectedRanges != null
+            && previousSelectedRanges != tableView.getSelectedRanges()) {
+            if (tableView.isValid()) {
+                // Repaint the area occupied by the previous selection
+                if (previousSelectedRanges != null
+                    && previousSelectedRanges.getLength() > 0) {
+                    int rangeStart = previousSelectedRanges.get(0).start;
+                    int rangeEnd = previousSelectedRanges.get(previousSelectedRanges.getLength() - 1).end;
 
-                Bounds previousSelectionBounds = getRowBounds(rangeStart);
-                previousSelectionBounds = previousSelectionBounds.union(getRowBounds(rangeEnd));
+                    Bounds previousSelectionBounds = getRowBounds(rangeStart);
+                    previousSelectionBounds = previousSelectionBounds.union(getRowBounds(rangeEnd));
 
-                repaintComponent(previousSelectionBounds);
-            }
+                    repaintComponent(previousSelectionBounds);
+                }
 
-            // Repaint the area occupied by the current selection
-            Sequence<Span> selectedRanges = tableView.getSelectedRanges();
-            if (selectedRanges.getLength() > 0) {
-                int rangeStart = selectedRanges.get(0).start;
-                int rangeEnd = selectedRanges.get(selectedRanges.getLength() - 1).end;
-
-                Bounds selectionBounds = getRowBounds(rangeStart);
-                selectionBounds = selectionBounds.union(getRowBounds(rangeEnd));
-
-                repaintComponent(selectionBounds);
-
-                // Ensure that the selection is visible
-                Bounds visibleSelectionBounds = tableView.getVisibleArea(selectionBounds);
-                if (visibleSelectionBounds != null
-                    && visibleSelectionBounds.height < selectionBounds.height) {
-                    // TODO Repainting the entire component is a workaround for PIVOT-490
-                    repaintComponent();
+                // Repaint the area occupied by the current selection
+                Sequence<Span> selectedRanges = tableView.getSelectedRanges();
+                if (selectedRanges.getLength() > 0) {
+                    int rangeStart = selectedRanges.get(0).start;
+                    int rangeEnd = selectedRanges.get(selectedRanges.getLength() - 1).end;
+
+                    Bounds selectionBounds = getRowBounds(rangeStart);
+                    selectionBounds = selectionBounds.union(getRowBounds(rangeEnd));
+
+                    repaintComponent(selectionBounds);
+
+                    // Ensure that the selection is visible
+                    Bounds visibleSelectionBounds = tableView.getVisibleArea(selectionBounds);
+                    if (visibleSelectionBounds != null
+                        && visibleSelectionBounds.height < selectionBounds.height) {
+                        // TODO Repainting the entire component is a workaround for PIVOT-490
+                        repaintComponent();
 
-                    tableView.scrollAreaToVisible(selectionBounds);
+                        tableView.scrollAreaToVisible(selectionBounds);
+                    }
                 }
+            } else {
+                validateSelection = true;
             }
-        } else {
-            validateSelection = true;
         }
     }
 

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/AccordionSelectionListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/AccordionSelectionListener.java?rev=984611&r1=984610&r2=984611&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/AccordionSelectionListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/AccordionSelectionListener.java Wed Aug 11 22:33:14 2010
@@ -44,7 +44,10 @@ public interface AccordionSelectionListe
      * Called to preview a selected index change.
      *
      * @param accordion
+     * The source of the event.
+     *
      * @param selectedIndex
+     * The index that will be selected.
      */
     public Vote previewSelectedIndexChange(Accordion accordion, int selectedIndex);
 
@@ -52,7 +55,10 @@ public interface AccordionSelectionListe
      * Called when a selected index change has been vetoed.
      *
      * @param accordion
+     * The source of the event.
+     *
      * @param reason
+     * The reason the event was vetoed.
      */
     public void selectedIndexChangeVetoed(Accordion accordion, Vote reason);
 
@@ -60,7 +66,11 @@ public interface AccordionSelectionListe
      * Called when an accordion's selected index has changed.
      *
      * @param accordion
+     * The source of the event.
+     *
      * @param previousSelectedIndex
+     * If the selection changed directly, contains the index that was previously
+     * selected. Otherwise, contains the current selection.
      */
     public void selectedIndexChanged(Accordion accordion, int previousSelectedIndex);
 }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPaneListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPaneListener.java?rev=984611&r1=984610&r2=984611&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPaneListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/CardPaneListener.java Wed Aug 11 22:33:14 2010
@@ -44,7 +44,10 @@ public interface CardPaneListener {
      * Called to preview a selected index change.
      *
      * @param cardPane
+     * The source of the event.
+     *
      * @param selectedIndex
+     * The index that will be selected.
      */
     public Vote previewSelectedIndexChange(CardPane cardPane, int selectedIndex);
 
@@ -52,7 +55,10 @@ public interface CardPaneListener {
      * Called when a selected index change has been vetoed.
      *
      * @param cardPane
+     * The source of the event.
+     *
      * @param reason
+     * The reason the event was vetoed.
      */
     public void selectedIndexChangeVetoed(CardPane cardPane, Vote reason);
 
@@ -60,7 +66,11 @@ public interface CardPaneListener {
      * Called when a card pane's selected index has changed.
      *
      * @param cardPane
+     * The source of the event.
+     *
      * @param previousSelectedIndex
+     * If the selection changed directly, contains the index that was previously
+     * selected. Otherwise, contains the current selection.
      */
     public void selectedIndexChanged(CardPane cardPane, int previousSelectedIndex);
 }

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/TabPaneSelectionListener.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/TabPaneSelectionListener.java?rev=984611&r1=984610&r2=984611&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/TabPaneSelectionListener.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/TabPaneSelectionListener.java Wed Aug 11 22:33:14 2010
@@ -44,7 +44,10 @@ public interface TabPaneSelectionListene
      * Called to preview a selected index change.
      *
      * @param tabPane
+     * The source of the event.
+     *
      * @param selectedIndex
+     * The index that will be selected.
      */
     public Vote previewSelectedIndexChange(TabPane tabPane, int selectedIndex);
 
@@ -52,7 +55,10 @@ public interface TabPaneSelectionListene
      * Called when a selected index change has been vetoed.
      *
      * @param tabPane
+     * The source of the event.
+     *
      * @param reason
+     * The reason the event was vetoed.
      */
     public void selectedIndexChangeVetoed(TabPane tabPane, Vote reason);
 
@@ -60,7 +66,11 @@ public interface TabPaneSelectionListene
      * Called when a tab pane's selected index has changed.
      *
      * @param tabPane
+     * The source of the event.
+     *
      * @param previousSelectedIndex
+     * If the selection changed directly, contains the index that was previously
+     * selected. Otherwise, contains the current selection.
      */
     public void selectedIndexChanged(TabPane tabPane, int previousSelectedIndex);
 }