Skip to content

Commit

Permalink
webui: Zoom Into shall open the right window (#10565)
Browse files Browse the repository at this point in the history
  • Loading branch information
teosarca committed Feb 25, 2021
1 parent 9eac43b commit a478f2a
Show file tree
Hide file tree
Showing 115 changed files with 6,118 additions and 3,668 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
/******************************************************************************
* 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;

import java.sql.ResultSet;
Expand All @@ -25,94 +9,44 @@
* Field Model
*
* @author Jorg Janke
* @version $Id: MField.java,v 1.2 2006/07/30 00:58:04 jjanke Exp $
*/
public class MField extends X_AD_Field
{

/**
*
*/
private static final long serialVersionUID = 7124162742037904113L;

/**
* Standard Constructor
*
* @param ctx context
* @param AD_Field_ID id
* @param trxName transaction
*/
public MField(Properties ctx, int AD_Field_ID, String trxName)
public MField(final Properties ctx, final int AD_Field_ID, final String trxName)
{
super(ctx, AD_Field_ID, trxName);
if (AD_Field_ID == 0)
if (is_new())
{
// setAD_Tab_ID (0); // parent
// setAD_Column_ID (0);
// setName (null);
setEntityType(ENTITYTYPE_UserMaintained); // U
setIsDisplayed(true); // Y
setIsEncrypted(false);
setIsFieldOnly(false);
setIsHeading(false);
setIsReadOnly(false);
setIsSameLine(false);
// setObscureType(OBSCURETYPE_ObscureDigitsButLast4);
}
} // MField
}

/**
* Load Constructor
*
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MField(Properties ctx, ResultSet rs, String trxName)
public MField(final Properties ctx, final ResultSet rs, final String trxName)
{
super(ctx, rs, trxName);
} // MField
}

/**
* Parent Constructor
*
* @param parent parent
*/
public MField(final I_AD_Tab parent)
{
this(InterfaceWrapperHelper.getCtx(parent), 0, InterfaceWrapperHelper.getTrxName(parent));
setClientOrgFromModel(parent);
setAD_Tab(parent);
} // MField

/**
* Copy Constructor
*
* @param parent parent
* @param from copy from
*/
public MField(MTab parent, MField from)
{
this(parent.getCtx(), 0, parent.get_TrxName());
copyValues(from, this);
setClientOrg(parent);
setAD_Tab_ID(parent.getAD_Tab_ID());
setEntityType(parent.getEntityType());
} // M_Field
}

/**
* Set Column Values
*
* @param column column
*/
public void setColumn(I_AD_Column column)
public void setColumn(final I_AD_Column column)
{
setAD_Column_ID(column.getAD_Column_ID());
setName(column.getName());
setDescription(column.getDescription());
setHelp(column.getHelp());
setDisplayLength(column.getFieldLength());
setEntityType(column.getEntityType());
} // setColumn
}

} // MField
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.adempiere.ad.service.ILookupDAO;
import org.adempiere.ad.service.ILookupDAO.IColumnInfo;
import org.adempiere.ad.service.ILookupDAO.ILookupDisplayInfo;
import org.adempiere.ad.service.ILookupDAO.ITableRefInfo;
import org.adempiere.ad.service.TableRefInfo;
import org.adempiere.ad.table.api.IADTableDAO;
import org.adempiere.ad.validationRule.IValidationRuleFactory;
import org.adempiere.exceptions.AdempiereException;
Expand Down Expand Up @@ -205,9 +205,7 @@ public static MLookup get(final Properties ctx, final int WindowNo, final int Ta
* Key, Value, Name, IsActive (where either key or value is null)
* </pre>
*
* @param ctx context for access
* @param WindowNo window no
* @param ColumnName key column name
* @param AD_Reference_ID display type
* @param AD_Reference_Value_ID AD_Reference (List, Table)
* @param IsParent parent (prevents query to directly access value)
Expand Down Expand Up @@ -267,7 +265,7 @@ else if ((AD_Reference_ID == DisplayType.Table || AD_Reference_ID == DisplayType
// Account
else if (AD_Reference_ID == DisplayType.Account)
{
final ITableRefInfo accountTableRefInfo = Services.get(ILookupDAO.class).retrieveAccountTableRefInfo();
final TableRefInfo accountTableRefInfo = Services.get(ILookupDAO.class).retrieveAccountTableRefInfo();
info = getLookupInfo(WindowNo, accountTableRefInfo);
}
else if (AD_Reference_ID == DisplayType.Location)
Expand Down Expand Up @@ -462,16 +460,14 @@ static public String getLookup_ListEmbed(final LanguageInfo languageInfo, final
return sql;
} // getLookup_ListEmbed

private static ArrayKey createCacheKey(final ITableRefInfo tableRef)
private static ArrayKey createCacheKey(final TableRefInfo tableRef)
{
return new ArrayKey(tableRef);
}

/***************************************************************************
* Get Lookup SQL for Table Lookup
*
* @param ctx context for access and dynamic access
* @param languageInfo report language
* @param WindowNo window no
* @param AD_Reference_Value_ID reference value
* @return SELECT Key, NULL, Name, IsActive FROM Table - if KeyColumn end with _ID
Expand All @@ -480,7 +476,7 @@ private static ArrayKey createCacheKey(final ITableRefInfo tableRef)
// NOTE: never make this method public because in case the lookup is cloned from a cached version we need to set the context and other relevant fields anyway
static private MLookupInfo getLookup_Table(final int WindowNo, final int AD_Reference_Value_ID)
{
final ITableRefInfo tableRefInfo = Services.get(ILookupDAO.class).retrieveTableRefInfo(AD_Reference_Value_ID);
final TableRefInfo tableRefInfo = Services.get(ILookupDAO.class).retrieveTableRefInfo(AD_Reference_Value_ID);
if (tableRefInfo == null)
{
return null;
Expand Down Expand Up @@ -518,20 +514,20 @@ static public String getLookup_TableEmbed(final LanguageInfo languageInfo, final
// NOTE: never make this method public because in case the lookup is cloned from a cached version we need to set the context and other relevant fields anyway
static private MLookupInfo getLookup_TableDir(final int WindowNo, final String ColumnName)
{
final ITableRefInfo tableRef = Services.get(ILookupDAO.class).retrieveTableDirectRefInfo(ColumnName);
final TableRefInfo tableRef = Services.get(ILookupDAO.class).retrieveTableDirectRefInfo(ColumnName);
return getLookupInfo(WindowNo, tableRef);
}

// NOTE: never make this method public because in case the lookup is cloned from a cached version we need to set the context and other relevant fields anyway
private static MLookupInfo getLookupInfo(final int windowNo, @NonNull final ITableRefInfo tableRefInfo)
private static MLookupInfo getLookupInfo(final int windowNo, @NonNull final TableRefInfo tableRefInfo)
{
final ArrayKey cacheKey = createCacheKey(tableRefInfo);
final MLookupInfo lookupInfo = s_cacheRefTable.getOrLoad(cacheKey, () -> buildLookupInfo(windowNo, tableRefInfo));
return lookupInfo == null ? null : lookupInfo.cloneIt(windowNo);
}

@Nullable
private static MLookupInfo buildLookupInfo(final int windowNo, @NonNull final ITableRefInfo tableRefInfo)
private static MLookupInfo buildLookupInfo(final int windowNo, @NonNull final TableRefInfo tableRefInfo)
{

final ILookupDisplayInfo lookupDisplayInfo = Services.get(ILookupDAO.class).retrieveLookupDisplayInfo(tableRefInfo);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,10 @@
/******************************************************************************
* 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;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Properties;

import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.FillMandatoryException;
import org.compiere.util.DB;

import de.metas.util.Check;

Expand All @@ -34,30 +15,14 @@
* @author victor.perez@e-evolution.com, e-Evolution
* <li>RF [2826384] The Order and Included Columns should be to fill mandatory
* <li>http://sourceforge.net/tracker/?func=detail&atid=879335&aid=2826384&group_id=176962
* @version $Id: MTab.java,v 1.2 2006/07/30 00:58:37 jjanke Exp $
*/
public class MTab extends X_AD_Tab
{

/**
*
*/
private static final long serialVersionUID = 4946144044358216142L;

/**
* Standard Constructor
* @param ctx context
* @param AD_Tab_ID id
* @param trxName transaction
*/
public MTab (Properties ctx, int AD_Tab_ID, String trxName)
public MTab (final Properties ctx, final int AD_Tab_ID, final String trxName)
{
super (ctx, AD_Tab_ID, trxName);
if (AD_Tab_ID == 0)
if (is_new())
{
// setAD_Window_ID (0);
// setAD_Table_ID (0);
// setName (null);
setEntityType (ENTITYTYPE_UserMaintained); // U
setHasTree (false);
setIsReadOnly (false);
Expand All @@ -69,101 +34,15 @@ public MTab (Properties ctx, int AD_Tab_ID, String trxName)
setIsInsertRecord(true);
setIsAdvancedTab(false);
}
} // M_Tab
}

/**
* Load Constructor
* @param ctx context
* @param rs result set
* @param trxName transaction
*/
public MTab (Properties ctx, ResultSet rs, String trxName)
public MTab (final Properties ctx, final ResultSet rs, final String trxName)
{
super(ctx, rs, trxName);
} // M_Tab

/**
* Parent Constructor
* @param parent parent
*/
public MTab (MWindow parent)
{
this (parent.getCtx(), 0, parent.get_TrxName());
setClientOrg(parent);
setAD_Window_ID(parent.getAD_Window_ID());
setEntityType(parent.getEntityType());
} // M_Tab

/**
* Parent Constructor
* @param parent parent
* @param from copy from
*/
public MTab (MWindow parent, MTab from)
{
this (parent.getCtx(), 0, parent.get_TrxName());
copyValues(from, this);
setClientOrg(parent);
setAD_Window_ID(parent.getAD_Window_ID());
setEntityType(parent.getEntityType());
} // M_Tab


/** The Fields */
private MField[] m_fields = null;

/** Packages for Model Classes */
/**
* Get Fields
* @param reload reload data
* @return array of lines
* @param trxName transaction
*/
public MField[] getFields (boolean reload, String trxName)
{
if (m_fields != null && !reload)
return m_fields;
String sql = "SELECT * FROM AD_Field WHERE AD_Tab_ID=? ORDER BY SeqNo";
ArrayList<MField> list = new ArrayList<MField>();
PreparedStatement pstmt = null;
try
{
pstmt = DB.prepareStatement (sql, trxName);
pstmt.setInt (1, getAD_Tab_ID());
ResultSet rs = pstmt.executeQuery ();
while (rs.next ())
list.add (new MField (getCtx(), rs, trxName));
rs.close ();
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
log.error(sql, e);
}
try
{
if (pstmt != null)
pstmt.close ();
pstmt = null;
}
catch (Exception e)
{
pstmt = null;
}
//
m_fields = new MField[list.size ()];
list.toArray (m_fields);
return m_fields;
} // getFields
}

/**
* Before Save
* @param newRecord new
* @return true
*/
@Override
protected boolean beforeSave (boolean newRecord)
protected boolean beforeSave (final boolean newRecord)
{
// UPDATE AD_Tab SET IsInsertRecord='N' WHERE IsInsertRecord='Y' AND IsReadOnly='Y'
if (isReadOnly() && isInsertRecord())
Expand All @@ -185,4 +64,4 @@ protected boolean beforeSave (boolean newRecord)

return true;
}
} // M_Tab
}

0 comments on commit a478f2a

Please sign in to comment.