cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r404929 - in /incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog: codegen/ db/
Date Mon, 08 May 2006 04:54:25 GMT
Author: aadamchik
Date: Sun May  7 21:54:24 2006
New Revision: 404929

URL: http://svn.apache.org/viewcvs?rev=404929&view=rev
Log:
implementing code and table generators smart "select all" checkbox state

Modified:
    incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/CodeGeneratorController.java
    incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/EntitiesTabController.java
    incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorController.java
    incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorView.java

Modified: incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/CodeGeneratorController.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/CodeGeneratorController.java?rev=404929&r1=404928&r2=404929&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/CodeGeneratorController.java
(original)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/CodeGeneratorController.java
Sun May  7 21:54:24 2006
@@ -96,6 +96,7 @@
         view = new CodeGeneratorDialog(generatorSelector.getView(), entitySelector
                 .getView());
         initBindings();
+
         view.pack();
         view.setModal(true);
         centerView();
@@ -128,6 +129,7 @@
                 : PredicateUtils.falsePredicate();
 
         updateSelection(predicate);
+        entitySelector.entitySelectedAction();
     }
 
     public void entitySelectedAction() {

Modified: incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/EntitiesTabController.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/EntitiesTabController.java?rev=404929&r1=404928&r2=404929&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/EntitiesTabController.java
(original)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/codegen/EntitiesTabController.java
Sun May  7 21:54:24 2006
@@ -87,6 +87,7 @@
     }
 
     protected void initBindings() {
+
         BindingBuilder builder = new BindingBuilder(
                 getApplication().getBindingFactory(),
                 this);
@@ -97,7 +98,7 @@
 
         tableBuilder.addColumn(
                 "",
-                "parent.setCurrentEntity(#item), parent.selected",
+                "parent.setCurrentEntity(#item), selected",
                 Boolean.class,
                 true,
                 Boolean.TRUE);
@@ -116,9 +117,35 @@
                 "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
 
         this.tableBinding = tableBuilder.bindToTable(view.getTable(), "parent.entities");
+    }
+
+    public boolean isSelected() {
+        return getParentController().isSelected();
+    }
+
+    public void setSelected(boolean selected) {
+        getParentController().setSelected(selected);
+        entitySelectedAction();
+    }
 
+    /**
+     * A callback action that updates the state of Select All checkbox.
+     */
+    public void entitySelectedAction() {
+        int selectedCount = getParentController().getSelectedEntitiesSize();
+
+        if (selectedCount == 0) {
+            view.getCheckAll().setSelected(false);
+        }
+        else if (selectedCount == getParentController().getEntities().size()) {
+            view.getCheckAll().setSelected(true);
+        }
     }
 
+    /**
+     * An action that updates entity check boxes in response to the Select All state
+     * change.
+     */
     public void checkAllAction() {
 
         Predicate predicate = view.getCheckAll().isSelected() ? PredicateUtils

Modified: incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorController.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorController.java?rev=404929&r1=404928&r2=404929&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorController.java
(original)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorController.java
Sun May  7 21:54:24 2006
@@ -88,6 +88,7 @@
 
     protected DbEntity table;
     protected List tables;
+    protected int permanentlyExcludedCount;
     protected Map excludedTables;
     protected List selectableTablesList;
     protected Map validationMessages;
@@ -144,6 +145,22 @@
         else {
             excludedTables.put(table.getName(), table);
         }
+        
+        tableSelectedAction();
+    }
+    
+    /**
+     * A callback action that updates the state of Select All checkbox.
+     */
+    public void tableSelectedAction() {
+        int unselectedCount = excludedTables.size() - permanentlyExcludedCount;
+
+        if (unselectedCount == selectableTablesList.size()) {
+            view.getCheckAll().setSelected(false);
+        }
+        else if (unselectedCount == 0) {
+            view.getCheckAll().setSelected(true);
+        }
     }
 
     public Object getProblem() {
@@ -244,6 +261,7 @@
         }
 
         // Find selectable tables
+        permanentlyExcludedCount = excludedTables.size();
         selectableTablesList.clear();
         tablesIt = tables.iterator();
         while (tablesIt.hasNext()) {
@@ -255,6 +273,7 @@
         }
 
         tableBinding.updateView();
+        tableSelectedAction();
     }
 
     public void checkAllAction() {

Modified: incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorView.java
URL: http://svn.apache.org/viewcvs/incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorView.java?rev=404929&r1=404928&r2=404929&view=diff
==============================================================================
--- incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorView.java
(original)
+++ incubator/cayenne/main/trunk/cayenne/cayenne-java/src/modeler/java/org/objectstyle/cayenne/modeler/dialog/db/TableSelectorView.java
Sun May  7 21:54:24 2006
@@ -82,8 +82,7 @@
     public TableSelectorView() {
 
         this.checkAll = new JCheckBox();
-        this.checkAll.setSelected(true);
-        this.checkAllLabel = new JLabel("Uncheck All Tables");
+        this.checkAllLabel = new JLabel("Check All Tables");
 
         checkAll.addItemListener(new ItemListener() {
 



Mime
View raw message