* [ 1798539 ] Cannot Save a User Query

* Some UI changes for the new collapse grid features. Victor, please let me know if you don't like some of the changes.
This commit is contained in:
Heng Sin Low 2007-10-09 18:23:41 +00:00
parent ff19a0323c
commit 99aa228853
5 changed files with 184 additions and 4 deletions

View File

@ -9,7 +9,6 @@
<classpathentry kind="lib" path="/tools/lib/itext-1.4.8.jar"/> <classpathentry kind="lib" path="/tools/lib/itext-1.4.8.jar"/>
<classpathentry kind="lib" path="/tools/lib/jpedal.jar"/> <classpathentry kind="lib" path="/tools/lib/jpedal.jar"/>
<classpathentry kind="lib" path="/tools/lib/jnlp.jar"/> <classpathentry kind="lib" path="/tools/lib/jnlp.jar"/>
<classpathentry kind="lib" path="/tools/lib/barbecue-1.0.6d.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry kind="lib" path="/tools/lib/jfreechart-1.0.2.jar"/> <classpathentry kind="lib" path="/tools/lib/jfreechart-1.0.2.jar"/>
<classpathentry kind="lib" path="/tools/lib/jcommon-1.0.5.jar"/> <classpathentry kind="lib" path="/tools/lib/jcommon-1.0.5.jar"/>
@ -19,5 +18,6 @@
<classpathentry kind="lib" path="/tools/lib/ocrs12.jar"/> <classpathentry kind="lib" path="/tools/lib/ocrs12.jar"/>
<classpathentry kind="lib" path="/tools/lib/ojdbc14.jar"/> <classpathentry kind="lib" path="/tools/lib/ojdbc14.jar"/>
<classpathentry kind="lib" path="/tools/lib/c3p0-0.9.1.2.jar"/> <classpathentry kind="lib" path="/tools/lib/c3p0-0.9.1.2.jar"/>
<classpathentry kind="lib" path="/tools/lib/barbecue-1.1.jar"/>
<classpathentry kind="output" path="build"/> <classpathentry kind="output" path="build"/>
</classpath> </classpath>

View File

@ -41,9 +41,10 @@
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/JasperReportsTools/lib/xml-apis.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/> <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/JasperReportsTools/lib/xml-apis.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/JasperReportsTools/lib/jasperreports-1.3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/> <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/JasperReportsTools/lib/jasperreports-1.3.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/JasperReportsTools/lib/poi-2.0-final-20040126.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/> <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/JasperReportsTools/lib/poi-2.0-final-20040126.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/tools/lib/swinglabs-0.8.0.jar&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
</listAttribute> </listAttribute>
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/> <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.compiere.Adempiere"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.compiere.Adempiere"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="base"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="base"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-DPropertyFile=${workspace_loc}/adempiere/Adempiere/Adempiere.properties&#13;&#10;-Xms128M&#13;&#10;-Xmx256M"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-DPropertyFile=${workspace_loc}/adempiere/Adempiere/Adempiere.properties&#13;&#10;-DADEMPIERE_HOME=${workspace_loc}/adempiere/Adempiere&#13;&#10;-Xms128M&#13;&#10;-Xmx256M"/>
</launchConfiguration> </launchConfiguration>

View File

@ -137,4 +137,12 @@ import org.compiere.util.*;
* Alphanumeric identifier of the entity * Alphanumeric identifier of the entity
*/ */
public String getName(); public String getName();
/** Set Tab.
@param AD_Tab_ID Tab within a Window */
public void setAD_Tab_ID (int AD_Tab_ID);
/** Get Tab.
@return Tab within a Window */
public int getAD_Tab_ID();
} }

View File

@ -0,0 +1,153 @@
/******************************************************************************
* Product: Compiere ERP & CRM Smart Business Solution
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms version 2 of the GNU General Public License as published
* by the Free Software Foundation. This program is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* You may reach us at: ComPiere, Inc. - http://www.compiere.org/license.html
* 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA or info@compiere.org
*****************************************************************************/
package org.compiere.model;
import java.sql.*;
import java.util.*;
import java.util.logging.*;
import org.compiere.util.*;
/**
* User Query Model
*
* @author Jorg Janke
* @version $Id$
*/
public class MUserQuery extends X_AD_UserQuery
{
/**
* Get all active queries of client for Tab
* @param ctx context
* @param AD_Tab_ID tab
* @return array of queries
*/
public static MUserQuery[] get (Properties ctx, int AD_Tab_ID)
{
int AD_User_ID = Env.getAD_User_ID(ctx);
String sql = "SELECT * FROM AD_UserQuery "
+ "WHERE AD_Client_ID=? AND AD_Tab_ID=? AND IsActive='Y' "
+ "AND AD_User_ID in (0, " + AD_User_ID + ") "
+ "ORDER BY Name";
int AD_Client_ID = Env.getAD_Client_ID (ctx);
ArrayList<MUserQuery> list = new ArrayList<MUserQuery>();
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, AD_Client_ID);
pstmt.setInt (2, AD_Tab_ID);
ResultSet rs = pstmt.executeQuery();
while (rs.next ())
list.add(new MUserQuery (ctx, rs, null));
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
s_log.log (Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
MUserQuery[] retValue = new MUserQuery[list.size()];
list.toArray(retValue);
return retValue;
} // get
/**
* Get Specific Tab Query
* @param ctx context
* @param AD_Tab_ID tab
* @param name name
* @return query or null
*/
public static MUserQuery get (Properties ctx, int AD_Tab_ID, String name)
{
int AD_User_ID = Env.getAD_User_ID(ctx);
String sql = "SELECT * FROM AD_UserQuery "
+ "WHERE AD_Client_ID=? AND AD_Tab_ID=? AND UPPER(Name) LIKE ? AND IsActive='Y' "
+ "AND AD_User_ID in (0, " + AD_User_ID + ") "
+ "ORDER BY Name";
int AD_Client_ID = Env.getAD_Client_ID (ctx);
if (name == null)
name = "%";
MUserQuery retValue = null;
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, null);
pstmt.setInt (1, AD_Client_ID);
pstmt.setInt (2, AD_Tab_ID);
pstmt.setString (3, name.toUpperCase());
ResultSet rs = pstmt.executeQuery ();
if (rs.next ())
retValue = new MUserQuery (ctx, rs, null);
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
s_log.log (Level.SEVERE, sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
return retValue;
} // get
/** Logger */
private static CLogger s_log = CLogger.getCLogger (MUserQuery.class);
/**************************************************************************
* Standard Constructor
* @param ctx context
* @param AD_UserQuery_ID id
* @param trxName trx
*/
public MUserQuery(Properties ctx, int AD_UserQuery_ID, String trxName)
{
super (ctx, AD_UserQuery_ID, trxName);
} // MUserQuery
/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName trx
*/
public MUserQuery(Properties ctx, ResultSet rs, String trxName)
{
super (ctx, rs, trxName);
} // MUserQuery
} // MUserQuery

View File

@ -89,6 +89,24 @@ public class X_AD_UserQuery extends PO implements I_AD_UserQuery, I_Persistent
return result; return result;
} }
/** Set Tab.
@param AD_Tab_ID Tab within a Window */
public void setAD_Tab_ID (int AD_Tab_ID)
{
if (AD_Tab_ID <= 0) set_Value ("AD_Tab_ID", null);
else
set_Value ("AD_Tab_ID", new Integer(AD_Tab_ID));
}
/** Get Tab.
@return Tab within a Window */
public int getAD_Tab_ID()
{
Integer ii = (Integer)get_Value("AD_Tab_ID");
if (ii == null) return 0;
return ii.intValue();
}
/** Set Table. /** Set Table.
@param AD_Table_ID @param AD_Table_ID
Database Table information Database Table information