当前位置: 首页>>代码示例>>Java>>正文


Java Env.getContext方法代码示例

本文整理汇总了Java中org.compiere.util.Env.getContext方法的典型用法代码示例。如果您正苦于以下问题:Java Env.getContext方法的具体用法?Java Env.getContext怎么用?Java Env.getContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.compiere.util.Env的用法示例。


在下文中一共展示了Env.getContext方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: verifyLanguageAndSet

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * @param lang
 * @return previous language
 */
String verifyLanguageAndSet(final Language lang)
{
	final Properties ctx = getCtx();
	final String adLanguageOld = Env.getContext(ctx, Env.CTXNAME_AD_Language);

	//
	// Check the language (and update it if needed)
	Env.verifyLanguage(lang);

	//
	// Actual update
	final String adLanguageNew = lang.getAD_Language();
	Env.setContext(ctx, Env.CTXNAME_AD_Language, adLanguageNew);
	this.locale = lang.getLocale();
	UserSession.logger.info("Changed AD_Language: {} -> {}, {}", adLanguageOld, adLanguageNew, lang);

	return adLanguageOld;
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:23,代码来源:InternalUserSessionData.java

示例2: get_ValueAsString

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Gets the context value for the given {@code variableName} by calling {@link Env#getContext(Properties, int, int, String, Scope)} with {@link Scope#Window}.
 */
@Override
public String get_ValueAsString(final String variableName)
{
	Check.assumeNotNull(variableName, "variableName not null");
	
	if(PARAMETER_ContextTableName.equals(variableName))
	{
		return contextTableName;
	}

	// only checking the window scope; global scope might contain default values (e.g. #C_DocTypeTarget_ID) that might confuse a validation rule
	final String value = Env.getContext(ctx, windowNo, tabNo, variableName, Scope.Window);
	if (Env.isNumericPropertyName(variableName) && Env.isPropertyValueNull(variableName, value))
	{
		// Because empty fields are not exported in context, even if they are present in Tab
		// is better to return "-1" as default value, to make this explicit
		// and also to not make Env.parseContext log a WARNING message
		return "-1";
	}
	return value;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:25,代码来源:GridTabValidationContext.java

示例3: initInfo

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 *	General Init
 *	@return true, if success
 */
private boolean initInfo ()
{
	//  Set Defaults
	final int p_WindowNo = getWindowNo();
	String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
	if (bp != null && bp.length() != 0)
		fBPartner_ID.setValue(new Integer(bp));

	//  prepare table
	StringBuffer where = new StringBuffer("o.IsActive='Y'");
	if (p_whereClause.length() > 0)
		where.append(" AND ").append(Util.replace(p_whereClause, "C_Order.", "o."));
	prepareTable(s_invoiceLayout,
		" C_Order o",
		where.toString(),
		"2,3,4");

	return true;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:24,代码来源:InfoOrder.java

示例4: process

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Process given <code>lines</code> using <code>processor</code>.
 * 
 * NOTE:
 * <ul>
 * <li>user {@link #AD_USER_ID_Migration} will be used to save/update records.
 * </ul>
 *
 * @param ctx
 * @param lines document lines
 * @param processor processor used to process one document line
 * @return processing summary (i.e. the counters)
 * @throws Exception
 */
public <T> String process(final Properties ctx,
		final Iterator<T> lines,
		final IProcessor<T> processor)
{
	// we do everything as AD_User_ID 99 ("migration"), so we can later on identify the records that were created.
	final String userIdBkp = Env.getContext(ctx, Env.CTXNAME_AD_User_ID);
	try
	{
		Env.setContext(ctx, Env.CTXNAME_AD_User_ID, AD_USER_ID_Migration);
		return process0(lines, processor);
	}
	catch (final InterruptedException e)
	{
		return "Interrupted: " + getCountersAsString();
	}
	finally
	{
		Env.setContext(ctx, Env.CTXNAME_AD_User_ID, userIdBkp);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:35,代码来源:MatchInvHelper.java

示例5: initInfo

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 *	General Init
 *	@return true, if success
 */
private boolean initInfo ()
{
	//  Set Defaults
	final int p_WindowNo = getWindowNo();
	String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
	if (bp != null && bp.length() != 0)
		fBPartner_ID.setValue(new Integer(bp));

	//  prepare table
	StringBuffer where = new StringBuffer("i.IsActive='Y'");
	if (p_whereClause.length() > 0)
		where.append(" AND ").append(Util.replace(p_whereClause, "C_Invoice.", "i."));
	prepareTable(s_invoiceLayout,
		" C_Invoice_v i",   //  corrected for CM
		where.toString(),
		"2,3,4");
	//
//	MAllocationLine.setIsPaid(Env.getCtx(), 0, null);
	return true;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:25,代码来源:InfoInvoice.java

示例6: initInfo

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 *	General Init
 *	@return true, if success
 */
private boolean initInfo ()
{
	//  Set Defaults
	final int p_WindowNo = getWindowNo();
	String bp = Env.getContext(Env.getCtx(), p_WindowNo, "C_BPartner_ID");
	if (bp != null && bp.length() != 0)
		fBPartner_ID.setValue(new Integer(bp));

	//  prepare table
	StringBuffer where = new StringBuffer("i.IsActive='Y'");
	if (p_whereClause.length() > 0)
		where.append(" AND ").append(Util.replace(p_whereClause, "M_InOut.", "i."));
	prepareTable(s_invoiceLayout,
		" M_InOut i",
		where.toString(),
		"2,3,4");

	return true;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:24,代码来源:InfoInOut.java

示例7: extractLanguageFromWindowContext

import org.compiere.util.Env; //导入方法依赖的package包/类
private static final Language extractLanguageFromWindowContext(final Properties ctx, final int windowNo)
{
	if (!Env.isRegularWindowNo(windowNo))
	{
		return null;
	}

	//
	// Get Language directly from window context, if any (08966)
	{
		// Note: onlyWindow is true, otherwise the login language would be returned if no other language was found
		final String languageString = Env.getContext(ctx, windowNo, "AD_Language", true);
		if (!Env.isPropertyValueNull("AD_Language", languageString))
		{
			return Language.getLanguage(languageString);
		}
	}

	//
	// Get Language from the BPartner set in window context, if any (03040)
	{
		final int bpartnerId = Env.getContextAsInt(ctx, windowNo, "C_BPartner_ID");
		if (bpartnerId > 0)
		{
			final Language lang = Services.get(IBPartnerBL.class).getLanguage(ctx, bpartnerId);
			if (lang != null)
			{
				return lang;
			}
		}
	}

	return null;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:35,代码来源:ProcessInfo.java

示例8: load

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Load status from context
 */
public void load()
{
	final Properties ctx = Env.getCtx();

	// FRESH-352: check if we shall override the default background color which we set in the constructor
	final String windowHeaderNoticeBGColorStr = Env.getContext(ctx, Env.CTXNAME_UI_WindowHeader_Notice_BG_COLOR);
	if (!Check.isEmpty(windowHeaderNoticeBGColorStr, true))
	{
		final Color backgroundColor = Colors.toColor(windowHeaderNoticeBGColorStr);
		if (backgroundColor != null)
		{
			this.setBackground(backgroundColor);
		}
	}
	final String windowHeaderNoticeFGColorStr = Env.getContext(ctx, Env.CTXNAME_UI_WindowHeader_Notice_FG_COLOR);
	if (!Check.isEmpty(windowHeaderNoticeBGColorStr, true))
	{
		final Color foregroundColor = Colors.toColor(windowHeaderNoticeFGColorStr);
		if (foregroundColor != null)
		{
			label.setForeground(foregroundColor);
		}
	}


	final String windowHeaderNotice = Env.getContext(ctx, Env.CTXNAME_UI_WindowHeader_Notice_Text);

	if (!Check.isEmpty(windowHeaderNotice, true) && !"-".equals(windowHeaderNotice))
	{
		setNotice(windowHeaderNotice);
		setVisible(true);
	}
	else
	{
		setNotice("");
		setVisible(false);
	}

}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:43,代码来源:WindowHeaderNotice.java

示例9: get_ValueAsString

import org.compiere.util.Env; //导入方法依赖的package包/类
@Override
public String get_ValueAsString(String variableName)
{
	final int windowNo = getWindowNo();
	final int tabNo = getTabNo();
	
	// Check value at Tab level, fallback to Window level
	final String value = Env.getContext(this, windowNo, tabNo, variableName, Scope.Window);
	return value;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:11,代码来源:GridRowCtx.java

示例10: get_ValueAsString

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Get Variable Value (Evaluatee)
 *
 * @param variableName name
 * @return value
 */
@Override
public String get_ValueAsString(final String variableName)
{
	final Properties ctx = getCtx();
	return Env.getContext(ctx, m_vo.WindowNo, variableName, true);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:13,代码来源:GridTab.java

示例11: amounts

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 *  Cash Journal Line Invoice Amounts.
 *  when DiscountAnt, Amount, WriteOffAmt change
 *  making sure that add up to InvTotalAmt (created by CashJournal_Invoice)
 *	@param ctx context
 *	@param WindowNo window no
 *	@param mTab tab
 *	@param mField field
 *	@param value value
 *	@return null or error message
 */
public String amounts (Properties ctx, int WindowNo, GridTab mTab, GridField mField, Object value)
{
	//  Needs to be Invoice
	if (isCalloutActive() || !"I".equals(mTab.getValue("CashType")))
		return "";
	//  Check, if InvTotalAmt exists
	String total = Env.getContext(ctx, WindowNo, "InvTotalAmt");
	if (total == null || total.length() == 0)
		return "";
	BigDecimal InvTotalAmt = new BigDecimal(total);

	BigDecimal PayAmt = (BigDecimal)mTab.getValue("Amount");
	BigDecimal DiscountAmt = (BigDecimal)mTab.getValue("DiscountAmt");
	BigDecimal WriteOffAmt = (BigDecimal)mTab.getValue("WriteOffAmt");
	String colName = mField.getColumnName();
	log.debug(colName + " - Invoice=" + InvTotalAmt
		+ " - Amount=" + PayAmt + ", Discount=" + DiscountAmt + ", WriteOff=" + WriteOffAmt);

	//  Amount - calculate write off
	if (colName.equals("Amount"))
	{
		WriteOffAmt = InvTotalAmt.subtract(PayAmt).subtract(DiscountAmt);
		mTab.setValue("WriteOffAmt", WriteOffAmt);
	}
	else    //  calculate PayAmt
	{
		PayAmt = InvTotalAmt.subtract(DiscountAmt).subtract(WriteOffAmt);
		mTab.setValue("Amount", PayAmt);
	}

	return "";
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:44,代码来源:CalloutCashJournal.java

示例12: isIndirectParentValue

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * bug[1637757] Check whether is indirect parent.
 *
 * @return boolean
 */
private boolean isIndirectParentValue()
{
	final Properties ctx = getGridFieldContext();
	boolean result = false;
	int tabNo = m_vo.TabNo;
	int currentLevel = Env.getContextAsInt(ctx, m_vo.WindowNo, tabNo, GridTab.CTX_TabLevel);
	if (tabNo > 1 && currentLevel > 1)
	{
		while (tabNo >= 1 && !result)
		{
			tabNo--;
			int level = Env.getContextAsInt(ctx, m_vo.WindowNo, tabNo, GridTab.CTX_TabLevel);
			if (level > 0 && level < currentLevel)
			{
				String linkColumn = Env.getContext(ctx, m_vo.WindowNo, tabNo, GridTab.CTX_LinkColumnName);
				if (m_vo.getColumnName().equals(linkColumn))
				{
					result = true;
					log.info(result
							+ " - Link(" + linkColumn + ", W=" + m_vo.WindowNo + ",T=" + m_vo.TabNo
							+ ") = " + m_vo.getColumnName());
				}
				currentLevel = level;
			}
		}
	}
	return result;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:34,代码来源:GridField.java

示例13: backupValue

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * Backup the context value
 *
 * @author teo_sarca [ 1699826 ]
 */
private final void backupValue()
{
	if (!m_isBackupValue)
	{
		final Properties ctx = getGridFieldContext();
		m_backupValue = Env.getContext(ctx, m_vo.WindowNo, m_vo.getColumnName());
		if (log.isTraceEnabled())
			log.trace("Backup " + m_vo.WindowNo + "|" + m_vo.getColumnName() + "=" + m_backupValue);
		m_isBackupValue = true;
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:17,代码来源:GridField.java

示例14: getOnly_Warehouse_ID

import org.compiere.util.Env; //导入方法依赖的package包/类
/**
 * 	Get Warehouse restriction if any.
 *	@return	M_Warehouse_ID or 0
 */
private int getOnly_Warehouse_ID()
{
	String only_Warehouse = Env.getContext(Env.getCtx(), m_WindowNo, "M_Warehouse_ID", true);
	int only_Warehouse_ID = 0;
	try
	{
		if (only_Warehouse != null && only_Warehouse.length () > 0)
			only_Warehouse_ID = Integer.parseInt (only_Warehouse);
	}
	catch (Exception ex)
	{
	}
	return only_Warehouse_ID;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:19,代码来源:VLocator.java

示例15: isRowLoading

import org.compiere.util.Env; //导入方法依赖的package包/类
private boolean isRowLoading()
{
	if (m_mField == null)
	{
		return false;
	}
	final String rowLoadingStr = Env.getContext(Env.getCtx(), m_mField.getWindowNo(), m_mField.getVO().TabNo, GridTab.CTX_RowLoading);
	return "Y".equals(rowLoadingStr);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:10,代码来源:VLookup.java


注:本文中的org.compiere.util.Env.getContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。