IDEMPIERE-236 Centralization of hardcoded IDs / using interface / rename class > SystemIDs

This commit is contained in:
Nicolas Micoud 2012-04-20 11:52:52 -05:00
parent 3a0f716618
commit 5457709c6a
3 changed files with 37 additions and 36 deletions

View File

@ -1,30 +1,31 @@
/******************************************************************************
* Product: Adempiere 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
/**
* List all hardcoded ID used in the code
* @author Carlos Ruiz, Nicolas Micoud, ...
*/
public class HardCodedIDs {
public final static int REFERENCE_POSTING_TYPE = 125;
public final static int WINDOW_MY_REQUESTS = 237;
}
/******************************************************************************
* Product: Adempiere 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. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.model;
/**
* List all hardcoded ID used in the code
* @author Carlos Ruiz, Nicolas Micoud, ...
*/
public interface SystemIDs
{
public final static int REFERENCE_POSTING_TYPE = 125;
public final static int WINDOW_MY_REQUESTS = 237;
}

View File

@ -29,7 +29,7 @@ import java.util.logging.Level;
import javax.swing.JComboBox;
import org.compiere.model.HardCodedIDs;
import org.compiere.model.SystemIDs;
import org.compiere.model.MAcctSchema;
import org.compiere.model.MAcctSchemaElement;
import org.compiere.model.MFactAcct;
@ -57,7 +57,7 @@ import org.compiere.util.ValueNamePair;
* <li>BF [ 1748449 ] Info Account - Posting Type is not translated
* <li>BF [ 1778373 ] AcctViewer: data is not sorted proper
*/
class AcctViewerData
class AcctViewerData implements SystemIDs
{
/**
* Constructor
@ -173,7 +173,7 @@ class AcctViewerData
*/
protected void fillPostingType (JComboBox cb)
{
int AD_Reference_ID = HardCodedIDs.REFERENCE_POSTING_TYPE;
int AD_Reference_ID = REFERENCE_POSTING_TYPE;
ValueNamePair[] pt = MRefList.getList(Env.getCtx(), AD_Reference_ID, true);
for (int i = 0; i < pt.length; i++)
cb.addItem(pt[i]);

View File

@ -58,13 +58,13 @@ import org.compiere.apps.wf.WFActivity;
import org.compiere.apps.wf.WFPanel;
import org.compiere.db.CConnection;
import org.compiere.grid.tree.VTreePanel;
import org.compiere.model.HardCodedIDs;
import org.compiere.model.MRole;
import org.compiere.model.MSession;
import org.compiere.model.MSysConfig;
import org.compiere.model.MSystem;
import org.compiere.model.MTreeNode;
import org.compiere.model.MUser;
import org.compiere.model.SystemIDs;
import org.compiere.swing.CButton;
import org.compiere.swing.CFrame;
import org.compiere.swing.CPanel;
@ -93,7 +93,7 @@ import org.compiere.util.Splash;
*
*/
public final class AMenu extends CFrame
implements ActionListener, PropertyChangeListener, ChangeListener, IEnvEventListener
implements ActionListener, PropertyChangeListener, ChangeListener, IEnvEventListener, SystemIDs
{
/**
* generated serialVersionUID
@ -688,7 +688,7 @@ public final class AMenu extends CFrame
// + " INNER JOIN AD_TABLE t ON (t.AD_Window_ID=m.AD_Window_ID) "
// + "WHERE t.AD_Table_ID=?", 417);
if (m_request_Menu_ID == 0)
m_request_Menu_ID = HardCodedIDs.WINDOW_MY_REQUESTS; // My Requests
m_request_Menu_ID = WINDOW_MY_REQUESTS; // My Requests
(new AMenuStartItem (m_request_Menu_ID, true, Msg.translate(m_ctx, "R_Request_ID"), this)).start(); // async load
} // gotoRequests