本文整理汇总了Java中org.compiere.util.KeyNamePair.getKey方法的典型用法代码示例。如果您正苦于以下问题:Java KeyNamePair.getKey方法的具体用法?Java KeyNamePair.getKey怎么用?Java KeyNamePair.getKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.compiere.util.KeyNamePair
的用法示例。
在下文中一共展示了KeyNamePair.getKey方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadComboValues
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
public static void loadComboValues(CComboBox<KeyNamePair> combo, KeyNamePair[] values, int defaultKey)
{
combo.removeAllItems();
if (Check.isEmpty(values))
return;
KeyNamePair kp = null;
for (KeyNamePair pp : values)
{
combo.addItem(pp);
if (pp.getKey() == defaultKey)
{
kp = pp;
}
}
// Set Selection
if (kp != null)
combo.setSelectedItem(kp);
}
示例2: 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();
}
示例3: save
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
@Override
public boolean save(IMiniTable miniTable, String trxName)
{
log.info("");
int M_RMA_ID = Env.getContextAsInt(Env.getCtx(), getGridTab().getWindowNo(), "M_RMA_ID");
// Integer bpId = (Integer)bPartnerField.getValue();
MRMA rma = new MRMA(Env.getCtx(), M_RMA_ID, trxName);
//update BP
// rma.setC_BPartner_ID(bpId);
for (int i = 0; i < miniTable.getRowCount(); i++)
{
if (((Boolean)miniTable.getValueAt(i, 0)).booleanValue())
{
BigDecimal d = (BigDecimal)miniTable.getValueAt(i, 5); // 5-Movement Qty
KeyNamePair pp = (KeyNamePair)miniTable.getValueAt(i, 1); // 1-Line
int inOutLineId = pp.getKey();
MRMALine rmaLine = new MRMALine(rma.getCtx(), 0, rma.get_TrxName());
rmaLine.setM_RMA_ID(M_RMA_ID);
rmaLine.setM_InOutLine_ID(inOutLineId);
rmaLine.setQty(d);
rmaLine.setAD_Org_ID(rma.getAD_Org_ID());
if (!rmaLine.save())
{
throw new IllegalStateException("Could not create RMA Line");
}
}
}
rma.saveEx();
return true;
}
示例4: getM_Product_ID
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
private final int getM_Product_ID(final IRModelMetadata metadata, final List<Object> row)
{
final KeyNamePair productKNP = getRowValueOrNull(metadata, row, COLUMNNAME_M_Product_ID, KeyNamePair.class);
if (productKNP == null)
{
return -1;
}
return productKNP.getKey();
}
示例5: isValidASI
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
private boolean isValidASI(final KeyNamePair asi)
{
if (asi == null)
{
return false;
}
if (asi.getKey() <= 0)
{
return false;
}
return true;
}
示例6: getSelectedLocator
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
private final MLocator getSelectedLocator()
{
final KeyNamePair locatorKNP = (KeyNamePair)fLocator.getSelectedItem();
if (locatorKNP == null)
{
return null;
}
final int locatorId = locatorKNP.getKey();
final MLocator locator = MLocator.get(Env.getCtx(), locatorId);
return locator;
}
示例7: getC_BPartner
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
@Override
public I_C_BPartner getC_BPartner()
{
final KeyNamePair bpartnerKNP = infoWindow.getValue(rowIndexModel, IHUPackingAware.COLUMNNAME_C_BPartner_ID);
if (bpartnerKNP == null || bpartnerKNP.getKey() <= 0)
{
return null;
}
return retrieveC_BPartnerById(bpartnerKNP.getKey());
}
示例8: setM_Warehouse_Dest
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
@Override
public void setM_Warehouse_Dest(final KeyNamePair warehouseDestKNP)
{
if (warehouseDestKNP == null || warehouseDestKNP.getKey() <= 0)
{
rs.setM_Warehouse_Dest(null);
}
else
{
rs.setM_Warehouse_Dest_ID(warehouseDestKNP.getKey());
}
InterfaceWrapperHelper.save(rs);
}
示例9: getSelectedFactAcctOrNull
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
/**
* @return selected {@link I_Fact_Acct} if table was queried and if there is an actual selection
*/
private I_Fact_Acct getSelectedFactAcctOrNull()
{
if (tableModel == null)
{
return null;
}
final int selectedRow = table.getSelectedRow();
if (selectedRow < 0)
{
return null;
}
final int factAcctIdColumnIndex = tableModel.getColumnIndex(I_Fact_Acct.COLUMNNAME_Fact_Acct_ID);
if (factAcctIdColumnIndex < 0)
{
// log.warn("@[email protected] @" + I_Fact_Acct.COLUMNNAME_Fact_Acct_ID + "@");
return null;
}
final KeyNamePair factAcctKnp = (KeyNamePair)tableModel.getValueAt(selectedRow, factAcctIdColumnIndex);
if (factAcctKnp == null)
{
return null;
}
final int factAcctId = factAcctKnp.getKey();
// Retrieve the Fact_Acct record.
// NOTE: we query for it because in case it was deleted (user re-posted the document in another window), we don't want to get an error here.
final I_Fact_Acct factAcct = Services.get(IQueryBL.class)
.createQueryBuilder(I_Fact_Acct.class, Env.getCtx(), ITrx.TRXNAME_None)
.addEqualsFilter(I_Fact_Acct.COLUMN_Fact_Acct_ID, factAcctId)
.create()
.firstOnly(I_Fact_Acct.class);
return factAcct;
}
示例10: accept
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
@Override
public boolean accept(final IHUKey key, final Object value)
{
// If no filtering value was specified => accept it
if (value == null || KeyNamePair.EMPTY.equals(value))
{
return true;
}
final int productCategoryId = getProductCategoryIdFromValue(value);
if (productCategoryId < 0)
{
// shall not happen
return true;
}
final List<KeyNamePair> availableProductCategories = getPropertyAvailableValues(key);
for (final KeyNamePair availableProductCategory : availableProductCategories)
{
final int availableProductCateogoryId = availableProductCategory.getKey();
if (availableProductCateogoryId == productCategoryId)
{
return true;
}
}
return false;
}
示例11: getC_BPartner_Location_ID
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
/**
* Get BPartner Location
* @return C_BPartner_Location_ID
*/
public int getC_BPartner_Location_ID ()
{
if (m_bpartner != null)
{
KeyNamePair pp = (KeyNamePair)f_location.getSelectedItem();
if (pp != null)
return pp.getKey();
}
return 0;
}
示例12: action_loadTree
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
/**
* Action: Fill Tree with all nodes
*/
private void action_loadTree()
{
KeyNamePair tree = (KeyNamePair)treeField.getSelectedItem();
log.info("Tree=" + tree);
if (tree.getKey() <= 0)
{
centerList.setModel(new DefaultListModel());
return;
}
// Tree
m_tree = new MTree (Env.getCtx(), tree.getKey(), null);
cbAllNodes.setSelected(m_tree.isAllNodes());
bAddAll.setEnabled(!m_tree.isAllNodes());
bAdd.setEnabled(!m_tree.isAllNodes());
bDelete.setEnabled(!m_tree.isAllNodes());
bDeleteAll.setEnabled(!m_tree.isAllNodes());
//
// List
DefaultListModel model = new DefaultListModel();
ArrayList<ListItem> items = getTreeItemData();
for(ListItem item : items)
model.addElement(item);
// List
log.info("#" + model.getSize());
centerList.setModel(model);
// Tree
centerTree.initTree(m_tree.getAD_Tree_ID());
}
示例13: getChangedPeriodIds
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
private List<Integer> getChangedPeriodIds()
{
final List<Integer> periodIds = new ArrayList<Integer>();
final StringBuilder periodNames = new StringBuilder();
final KeyNamePair[] changedPeriods = retrieveChangedPeriods();
if (!Check.isEmpty(changedPeriods))
{
for (final KeyNamePair p : changedPeriods)
{
final int periodId = p.getKey();
if (periodId <= 0)
{
continue;
}
if (periodIds.contains(periodId))
{
continue;
}
periodIds.add(periodId);
final String periodName = p.getName();
if (periodNames.length() > 0)
{
periodNames.append(periodName);
}
}
}
if (periodIds.isEmpty())
{
log.debug("No periods to update found");
}
else
{
log.debug("Periods to update: {}", periodNames);
}
return periodIds;
}
示例14: showHistory
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
/**
* Show History
*/
@Override
protected void showHistory()
{
log.info("");
Integer M_Product_ID = getSelectedRowKey();
if (M_Product_ID == null)
return;
KeyNamePair kn = (KeyNamePair)pickWarehouse.getSelectedItem();
int M_Warehouse_ID = kn.getKey();
int M_AttributeSetInstance_ID = m_M_AttributeSetInstance_ID;
if (m_M_AttributeSetInstance_ID < -1) // not selected
M_AttributeSetInstance_ID = 0;
//
final int C_BPartner_ID = 0;
final InvoiceHistoryContext ihCtx = InvoiceHistoryContext.builder()
.setC_BPartner_ID(C_BPartner_ID)
.setM_Product_ID(M_Product_ID.intValue())
.setM_Warehouse_ID(M_Warehouse_ID)
.setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID)
.build();
final IInvoiceHistoryTabHandler invoiceHistoryTabHandler = ihCtx.getInvoiceHistoryTabHandler();
invoiceHistoryTabHandler.setTabEnabled(InvoiceHistory.TAB_PRICEHISTORY, true);
invoiceHistoryTabHandler.setTabEnabled(InvoiceHistory.TAB_RESERVED, true);
invoiceHistoryTabHandler.setTabEnabled(InvoiceHistory.TAB_ORDERED, true);
invoiceHistoryTabHandler.setTabEnabled(InvoiceHistory.TAB_UNCONFIRMED, true);
// task 08777: was true; setting to false because currently that tab is a performance nightmare and it's rarely used; TODO re-enable with task 08881
invoiceHistoryTabHandler.setTabEnabled(InvoiceHistory.TAB_ATP, false);
invoiceHistoryTabHandler.setTabEnabled(InvoiceHistory.TAB_RECEIVED, false);
invoiceHistoryTabHandler.setTabEnabled(InvoiceHistory.TAB_DELIVERED, false);
//
InvoiceHistory ih = new InvoiceHistory(ihCtx, getWindow());
ih.setVisible(true);
ih = null;
}
示例15: findDefaultOrg
import org.compiere.util.KeyNamePair; //导入方法依赖的package包/类
private static final KeyNamePair findDefaultOrg(final Set<KeyNamePair> orgs)
{
if(Check.isEmpty(orgs))
{
return null;
}
final String iniDefaultOrgName = Ini.getProperty(Ini.P_ORG);
if(!Check.isEmpty(iniDefaultOrgName))
{
KeyNamePair orgValue = null;
KeyNamePair orgValue2 = null;
for (final KeyNamePair org : orgs)
{
if(Objects.equals(org.getName(), iniDefaultOrgName))
{
orgValue = org;
}
if (orgValue2 == null && org.getKey() != 0)
{
orgValue2 = org; // first non-0 org
}
}
// Non-0 Org exists and last login was with 0
if (orgValue2 != null && orgValue != null && orgValue.getKey() == 0)
{
orgValue = orgValue2;
}
if(orgValue != null)
{
return orgValue;
}
}
return orgs.iterator().next();
}