94151 Invalid dialog when table is added to SessionBean1 second time. Further adding does nothing at all mercurial1_4_3fcs
authorjbaker@netbeans.org
Wed, 12 Dec 2007 22:13:51 +0000
changeset 19221e5d40cbe8a6
parent 1921 8f59bdaacf00
child 1923 148a2d783b42
94151 Invalid dialog when table is added to SessionBean1 second time. Further adding does nothing at all
Fix
visualweb.dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/customizers/RowSetSelection.form
visualweb.dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/customizers/RowSetSelection.java
     1.1 --- a/visualweb.dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/customizers/RowSetSelection.form	Tue Dec 11 21:44:08 2007 +0000
     1.2 +++ b/visualweb.dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/customizers/RowSetSelection.form	Wed Dec 12 22:13:51 2007 +0000
     1.3 @@ -1,6 +1,6 @@
     1.4  <?xml version="1.0" encoding="UTF-8" ?>
     1.5  
     1.6 -<Form version="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
     1.7 +<Form version="1.2" maxVersion="1.2" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
     1.8    <NonVisualComponents>
     1.9      <Component class="javax.swing.ButtonGroup" name="selections">
    1.10      </Component>
    1.11 @@ -14,7 +14,9 @@
    1.12      </Property>
    1.13    </AccessibilityProperties>
    1.14    <AuxValues>
    1.15 +    <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
    1.16      <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
    1.17 +    <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
    1.18      <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
    1.19      <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
    1.20      <AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
     2.1 --- a/visualweb.dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/customizers/RowSetSelection.java	Tue Dec 11 21:44:08 2007 +0000
     2.2 +++ b/visualweb.dataconnectivity/src/org/netbeans/modules/visualweb/dataconnectivity/customizers/RowSetSelection.java	Wed Dec 12 22:13:51 2007 +0000
     2.3 @@ -118,7 +118,7 @@
     2.4       * Create the thing.  No UI is created by this constructor.
     2.5       * Rather, we just search for rowsets and dataproviders.
     2.6       */
     2.7 -    public RowSetSelection( DesignContext currentContext, String tableName, String dataSrcName, String user, String url, String command ) {
     2.8 +    public RowSetSelection( DesignContext currentContext, String tableName, String dataSrcName, String user, String url, String command) {
     2.9  
    2.10          this.curContext = currentContext ;
    2.11          this.tableName = tableName ;
    2.12 @@ -169,15 +169,11 @@
    2.13      ArrayList cBeans_request = new ArrayList() ;
    2.14      ArrayList cBeans_session = new ArrayList() ;
    2.15      ArrayList cBeans_application = new ArrayList() ;
    2.16 +    ArrayList<DesignBean> alRowSets = new ArrayList<DesignBean>(); 
    2.17      private void findRowSets() {
    2.18  
    2.19  
    2.20 -        String thisScope = (String)curContext.getContextData(Constants.ContextData.SCOPE) ;
    2.21 -
    2.22 -        if ( compareScopes(thisScope, SCOPE_PAGE) == -99 ) {
    2.23 -            // if thisScope is unkown, set to PAGE.
    2.24 -            thisScope= SCOPE_PAGE ;
    2.25 -        }
    2.26 +        String thisScope = (String)curContext.getContextData(Constants.ContextData.SCOPE) ;  
    2.27  
    2.28          //DesignContext[] contexts = curContext.getProject().getDesignContexts() ;
    2.29   	DesignContext[] contexts = getDesignContexts(curContext);
    2.30 @@ -186,7 +182,7 @@
    2.31              String cScope = (String)contexts[i].getContextData(Constants.ContextData.SCOPE) ;
    2.32              Log.log("RSS:  examining " + contexts[i].getDisplayName() + " , " + cScope ) ;
    2.33              if ( compareScopes(thisScope,  cScope) < 0 ) {
    2.34 -                // ignore if "lower" scope.
    2.35 +                // ignore if "same" scope.
    2.36                  continue ;
    2.37              }
    2.38              if ( SCOPE_PAGE.equals(thisScope) && contexts[i] != curContext ) {
    2.39 @@ -195,16 +191,21 @@
    2.40              }
    2.41              if ( SCOPE_REQUEST.equals(thisScope) && SCOPE_REQUEST.equals(cScope) ) {
    2.42                  // If request Scope, loop context is also request
    2.43 -                if ( contexts[i] != curContext && ! isRequestBean(contexts[i] ) ) {
    2.44 +                if ( contexts[i] != curContext &&  (contexts[i].getDisplayName().indexOf("RequestBean") < 0) ) {
    2.45                      // ignore if REQUEST and (not self or not RequestBean)
    2.46                      continue ;
    2.47                  }
    2.48 -                if ( contexts[i] == curContext && ! isRequestBean(contexts[i])) {
    2.49 +                if ( contexts[i] == curContext && contexts[i].getDisplayName().indexOf("RequestBean") < 0) {
    2.50                      cBeans_thisPage.add(curContext) ;
    2.51                  }
    2.52              }
    2.53 -            DesignBean[] rowsets = contexts[i].getBeansOfType( CachedRowSetX.class ) ;
    2.54 -            for ( int j = 0 ; j < rowsets.length ; j++ ) {
    2.55 +            DesignBean[] rowsets = contexts[i].getBeansOfType( CachedRowSetX.class ) ;                       
    2.56 +            for ( int j = 0 ; j < rowsets.length ; j++ ) {                    
    2.57 +                if (alRowSets.contains(rowsets[j])) {
    2.58 +                    continue;
    2.59 +                }
    2.60 +
    2.61 +                alRowSets.add(rowsets[j]);               
    2.62                  int matchVal = compareRowSet( rowsets[j]) ;
    2.63                  if ( Log.isLoggable() ) {
    2.64                      Log.log( "RSS: " + contexts[i].getDisplayName() + "." + rowsets[j].getInstanceName()+ " match="+matchVal) ;
    2.65 @@ -216,14 +217,20 @@
    2.66                  }
    2.67              }
    2.68  
    2.69 -            // add non-page "create" contexts
    2.70 -            if ( isRequestBean(contexts[i])) {
    2.71 -                cBeans_request.add(contexts[i]) ;
    2.72 -            } else if ( compareScopes(cScope,SCOPE_SESSION) == 0 ) {
    2.73 -                cBeans_session.add(contexts[i]) ;
    2.74 -            } else if ( compareScopes(cScope,SCOPE_APPLICATION) == 0 ) {
    2.75 -                cBeans_application.add(contexts[i]) ;
    2.76 -            }
    2.77 +            // add non-page "create" contexts            
    2.78 +            if ( contexts[i].getDisplayName().indexOf("RequestBean") >= 0) {      
    2.79 +                if (!cBeans_request.contains(contexts[i])) {
    2.80 +                    cBeans_request.add(contexts[i]);
    2.81 +                }
    2.82 +            } else if (contexts[i].getDisplayName().indexOf("SessionBean") >= 0) {
    2.83 +                if (!cBeans_session.contains(contexts[i])) {
    2.84 +                    cBeans_session.add(contexts[i]);
    2.85 +                }
    2.86 +            } else if (contexts[i].getDisplayName().indexOf("ApplicationBean") >= 0) {
    2.87 +                if (!cBeans_application.contains(contexts[i])) {
    2.88 +                    cBeans_application.add(contexts[i]);
    2.89 +                }
    2.90 +            }             
    2.91          }
    2.92      }
    2.93      public boolean hasMatchingRowSets() {
    2.94 @@ -569,20 +576,6 @@
    2.95          return new RowSetSelectionQuery( text ) ;
    2.96      }
    2.97  
    2.98 -
    2.99 -    /***
   2.100 -     * Determine if it's a request bean.
   2.101 -     * TODO EA HACK:  just look for "RequestBean" in the name
   2.102 -     */
   2.103 -    private static boolean isRequestBean(DesignContext context) {
   2.104 -        if ( SCOPE_REQUEST.equals(context.getContextData(Constants.ContextData.SCOPE))) {
   2.105 -            if ( context.getDisplayName().indexOf("RequestBean") >= 0) {
   2.106 -                return true ;
   2.107 -            }
   2.108 -        }
   2.109 -        return false ;
   2.110 -    }
   2.111 -
   2.112      private static final String SCOPE_PAGE = "page" ; // ??unused??
   2.113      private static final String SCOPE_REQUEST = "request" ;
   2.114      private static final String SCOPE_SESSION = "session" ;