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


Java KeyNamePair类代码示例

本文整理汇总了Java中org.compiere.util.KeyNamePair的典型用法代码示例。如果您正苦于以下问题:Java KeyNamePair类的具体用法?Java KeyNamePair怎么用?Java KeyNamePair使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: saveSelectionDetail

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
/**
 *	Save Selection Settings
 */
@Override
protected void saveSelectionDetail()
{
	//  publish for Callout to read
	final int p_WindowNo = getWindowNo();
	Integer ID = getSelectedRowKey();
	Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_Invoice_ID", ID == null ? "0" : ID.toString());
	//
	int C_InvoicePaySchedule_ID = 0;
	int row = p_table.getSelectedRow();
	if (row >= 0)
	{
		Object value = p_table.getValueAt(row, INDEX_PAYSCHEDULE);
		if (value != null && value instanceof KeyNamePair)
			C_InvoicePaySchedule_ID = ((KeyNamePair)value).getKey();
	}
	if (C_InvoicePaySchedule_ID <= 0)	//	not selected
		Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", "0");
	else
		Env.setContext(Env.getCtx(), p_WindowNo, Env.TAB_INFO, "C_InvoicePaySchedule_ID", String.valueOf(C_InvoicePaySchedule_ID));
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:25,代码来源:InfoInvoice.java

示例2: ProductKey

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
@Deprecated
ProductKey(final ITerminalContext terminalContext, final I_C_POSKey key, final String tableName, final int productId)
{
	super(terminalContext);

	this.key = key;
	this.tableName = tableName;
	this.value = new KeyNamePair(productId, key.getName());
	this.status = new ProductStatus();

	final Properties ctx = InterfaceWrapperHelper.getCtx(key);
	this.product = InterfaceWrapperHelper.create(ctx, value.getKey(), I_M_Product.class, ITrx.TRXNAME_None);
	this.bpartner = null;
	this.bpLocation = null;
	
	this.id = buildId();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:18,代码来源:ProductKey.java

示例3: isSelectionNone

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
@Override
public boolean isSelectionNone()
{
	final Object selectedItem = getSelectedItem();
	if (selectedItem == null)
	{
		return true;
	}
	else if (KeyNamePair.EMPTY.equals(selectedItem))
	{
		return true;
	}
	else if (ValueNamePair.EMPTY.equals(selectedItem))
	{
		return true;
	}
	else
	{
		return super.isSelectionNone();
	}

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

示例4: save

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
/**
 *  Save Statement - Insert Data
 *  @return true if saved
 */
@Override
public boolean save(final IMiniTable miniTable, final String trxName)
{
	//  fixed values
	int M_ShipperTransportation_ID = ((Integer)getGridTab().getValue("M_ShipperTransportation_ID")).intValue();
	MMShipperTransportation st = new MMShipperTransportation (Env.getCtx(), M_ShipperTransportation_ID, trxName);
	log.info(st.toString());

	//  Lines
	for (int i = 0; i < miniTable.getRowCount(); i++)
	{
		if (((Boolean)miniTable.getValueAt(i, 0)).booleanValue())
		{
			KeyNamePair pp = (KeyNamePair)miniTable.getValueAt(i, 1);   //  1-M_Package_ID
			int M_Package_ID = pp.getKey();

			log.debug("Line Package=" + M_Package_ID);
			//	
			final I_M_Package mpackage = InterfaceWrapperHelper.create(Env.getCtx(), M_Package_ID, I_M_Package.class, trxName);
			Services.get(IShipperTransportationBL.class).createShippingPackage(st, mpackage);
		}   //   if selected
	}   //  for all rows
	return true;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:29,代码来源:CreateFromPackage.java

示例5: getValueAsInt

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
public int getValueAsInt(final int row, final String columnName)
{
	final Object value = getValue(row, columnName);
	if (value == null)
	{
		return -1;
	}
	else if (value instanceof Number)
	{
		return ((Number)value).intValue();
	}
	else if (value instanceof KeyNamePair)
	{
		return ((KeyNamePair)value).getKey();
	}
	else if (value instanceof IDColumn)
	{
		return ((IDColumn)value).getRecord_ID();
	}
	else
	{
		log.warn("Cannot convert value " + value + " (" + value.getClass() + ") to int (row=" + row + ", columnName=" + columnName + ")");
		return -1;
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:26,代码来源:InfoSimple.java

示例6: getCurrencies

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
public static Map<Integer, KeyNamePair> getCurrencies()
{
	Hashtable<Integer, KeyNamePair> currencies = s_cacheCurrencies.get(0);
	if (currencies != null)
		return currencies;

	currencies = new Hashtable<Integer, KeyNamePair>(12); // Currenly only 10+1
	final String SQL = "SELECT C_Currency_ID, ISO_Code FROM C_Currency "
			+ "WHERE (IsEMUMember='Y' AND EMUEntryDate<now()) OR IsEuro='Y' "
			+ "ORDER BY 2";
	for (KeyNamePair knp : DB.getKeyNamePairs(SQL, false))
	{
		currencies.put(knp.getKey(), knp);
	}
	return currencies;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:17,代码来源:AbstractPaymentCheck.java

示例7: setAD_User_ID

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
@Override
public void setAD_User_ID(final int userId)
{
	if (userId <= 0)
	{
		setUser(null);
		usersPanel.onKeySelected(null);
	}
	else
	{
		final String userFullname = Services.get(IUserDAO.class).retrieveUserFullname(userId);
		setUser(new KeyNamePair(userId, userFullname));
		final ITerminalKey key = usersPanel.getKeyLayout().findKeyByValue(userId);
		usersPanel.onKeySelected(key);
	}
	//
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:18,代码来源:TerminalLoginDialog.java

示例8: getTableData

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
public KeyNamePair[] getTableData()
	{
		//	Tables
		final IUserRolePermissions role = Env.getUserRolePermissions(); // metas
//		int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx());
		boolean trl = !Env.isBaseLanguage(Env.getCtx(), "AD_Table");
		String lang = Env.getAD_Language(Env.getCtx());
		String sql = "SELECT DISTINCT t.AD_Table_ID,"
				+ (trl ? "trl.Name" : "t.Name")
			+ " FROM AD_Table t INNER JOIN AD_Tab tab ON (tab.AD_Table_ID=t.AD_Table_ID)"
			+ " INNER JOIN AD_Window_Access wa ON (tab.AD_Window_ID=wa.AD_Window_ID) "
			+ (trl ? "LEFT JOIN AD_Table_Trl trl on (trl.AD_Table_ID=t.AD_Table_ID and trl.AD_Language=" + DB.TO_STRING(lang) + ")" : "")
			+ " WHERE "+role.getIncludedRolesWhereClause("wa.AD_Role_ID", null) // metas
			+ " AND t.IsActive='Y' AND tab.IsActive='Y' "
			+ "ORDER BY 2";
		return DB.getKeyNamePairs(sql, true);
	}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:18,代码来源:Archive.java

示例9: initBPShipmentDetails

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
/**
 * Load PBartner dependent Order/Invoice/Shipment Field.
 * @param C_BPartner_ID
 */
private void initBPShipmentDetails(int C_BPartner_ID)
{
	log.info("C_BPartner_ID" + C_BPartner_ID);

	//  load Shipments (Receipts) - Completed, Closed
	shipmentField.removeActionListener(this);
	shipmentField.removeAllItems();
	//	None
	KeyNamePair pp = new KeyNamePair(0,"");
	shipmentField.addItem(pp);
	
	ArrayList<KeyNamePair> list = loadShipmentData(C_BPartner_ID);
	for(KeyNamePair knp : list)
		shipmentField.addItem(knp);
	
	shipmentField.setSelectedIndex(0);
	shipmentField.addActionListener(this);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:23,代码来源:VCreateFromInvoiceUI.java

示例10: onSelectedLinesChanged

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
private void onSelectedLinesChanged()
{
	final PickingOKPanel pickingOKPanel = getPickingOKPanel();

	//
	// Update BPartner Keys
	{
		final Set<KeyNamePair> bpartners = pickingOKPanel.getSelectedBPartners();
		bpartnerKeyLayout.createAndSetKeysFromBPartnerKNPs(bpartners);
	}

	//
	// Update DeliveryDate Keys
	{
		final Set<Date> deliveryDates = pickingOKPanel.getSelectedDeliveryDates();
		deliveryDateKeyLayout.createAndSetKeysFromDates(deliveryDates);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:19,代码来源:FreshSwingPickingTerminalPanel.java

示例11: getValue

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
/**
 *	Get Value
 *  @return key as Integer or String value
 */
@Override
public Object getValue()
{
	final NamePair p = getSelectedItem();
	if (p == null)
	{
		return null;
	}
	//
	if (p instanceof KeyNamePair)
	{
		if (p.getID() == null)	//	-1 return null
			return null;
		return new Integer(((KeyNamePair)p).getID());
	}
	return p.getID();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:22,代码来源:VComboBox.java

示例12: initBPInvoiceDetails

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
/**
 * Init Details - load invoices not shipped
 * @param C_BPartner_ID BPartner
 */
private void initBPInvoiceDetails(int C_BPartner_ID)
{
	log.info("C_BPartner_ID" + C_BPartner_ID);

	//  load Shipments (Receipts) - Completed, Closed
	invoiceField.removeActionListener(this);
	invoiceField.removeAllItems();
	//	None
	KeyNamePair pp = new KeyNamePair(0,"");
	invoiceField.addItem(pp);
	
	ArrayList<KeyNamePair> list = loadInvoiceData(C_BPartner_ID);
	for(KeyNamePair knp : list)
		invoiceField.addItem(knp);
	
	invoiceField.setSelectedIndex(0);
	invoiceField.addActionListener(this);
	upcField.addActionListener(this);
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:24,代码来源:VCreateFromShipmentUI.java

示例13: CUSplitKey

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
public CUSplitKey(final ITerminalContext terminalContext, final I_M_Product product, final BigDecimal qty, final I_C_UOM uom)
{
	super(terminalContext);

	Check.assumeNotNull(product, "product not null");
	this.product = product;

	Check.assumeNotNull(qty, "qty not null");
	this.qty = qty;

	Check.assumeNotNull(uom, "uom not null");
	this.uom = uom;

	final int productId = product.getM_Product_ID();
	id = getClass().getName() + "-" + productId;
	value = new KeyNamePair(productId, product.getName());

	updateName();
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:20,代码来源:CUSplitKey.java

示例14: authenticate

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
@PostMapping("/authenticate")
public JSONLoginAuthResponse authenticate(@RequestBody final JSONLoginAuthRequest request)
{
	userSession.assertNotLoggedIn();

	final Login loginService = getLoginService();
	startMFSession(loginService);

	try
	{
		final Set<KeyNamePair> availableRoles = loginService.authenticate(request.getUsername(), request.getPassword());

		//
		// Create JSON roles
		final Set<JSONLoginRole> jsonRoles = createJSONLoginRoles(loginService, availableRoles);

		if (jsonRoles.size() == 1)
		{
			final JSONLoginRole loginRole = jsonRoles.iterator().next();
			loginComplete(loginRole);

			return JSONLoginAuthResponse.loginComplete(loginRole);
		}

		return JSONLoginAuthResponse.of(jsonRoles);
	}
	catch (final Exception ex)
	{
		userSession.setLoggedIn(false);
		destroyMFSession(loginService);
		throw AdempiereException.wrapIfNeeded(ex);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:34,代码来源:LoginRestController.java

示例15: createJSONLoginRoles

import org.compiere.util.KeyNamePair; //导入依赖的package包/类
private Set<JSONLoginRole> createJSONLoginRoles(final Login loginService, final Set<KeyNamePair> availableRoles)
{
	if (availableRoles.isEmpty())
	{
		return ImmutableSet.of();
	}

	final LoginContext ctx = loginService.getCtx();
	final ImmutableSet.Builder<JSONLoginRole> jsonRoles = ImmutableSet.builder();
	for (final KeyNamePair role : availableRoles)
	{
		final int AD_Role_ID = role.getKey();
		final int AD_User_ID = ctx.getAD_User_ID();
		for (final KeyNamePair tenant : loginService.getAvailableClients(AD_Role_ID, AD_User_ID))
		{
			final int AD_Client_ID = tenant.getKey();

			final Set<KeyNamePair> availableOrgs = loginService.getAvailableOrgs(AD_Role_ID, AD_User_ID, AD_Client_ID);
			for (final KeyNamePair org : availableOrgs)
			{
				// If there is more than one available Org, then skip the "*" org
				if (availableOrgs.size() > 1 && org.getKey() == Env.CTXVALUE_AD_Org_ID_Any)
				{
					continue;
				}

				final String caption = Joiner.on(", ").join(role.getName(), tenant.getName(), org.getName());
				final JSONLoginRole jsonRole = JSONLoginRole.of(caption, AD_Role_ID, AD_Client_ID, org.getKey());
				jsonRoles.add(jsonRole);

			}
		}
	}

	return jsonRoles.build();
}
 
开发者ID:metasfresh,项目名称:metasfresh-webui-api,代码行数:37,代码来源:LoginRestController.java


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