use of org.compiere.apps.ALayoutConstraint in project adempiere by adempiere.
the class InfoCashLine method statInit.
/**
* Static Setup - add fields to parameterPanel
*/
private void statInit() {
// 5241 - C_Cash.C_Cash_ID
fCash_ID = new VLookup("C_Cash_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, p_TabNo, MColumn.getColumn_ID(MCash.Table_Name, MCash.COLUMNNAME_C_Cash_ID), DisplayType.Search));
lCash_ID.setLabelFor(fCash_ID);
fCash_ID.setBackground(AdempierePLAF.getInfoBackground());
fCash_ID.addActionListener(this);
;
// 5249 - C_Cash.C_CashBook_ID
fCashBook_ID = new VLookup("C_CashBook_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MCash.Table_Name, MCash.COLUMNNAME_C_CashBook_ID), DisplayType.TableDir));
lCashBook_ID.setLabelFor(fCashBook_ID);
fCashBook_ID.setBackground(AdempierePLAF.getInfoBackground());
fCashBook_ID.addActionListener(this);
// 5354 - C_CashLine.C_Invoice_ID
fInvoice_ID = new VLookup("C_Invoice_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MCashLine.Table_Name, MCashLine.COLUMNNAME_C_Invoice_ID), DisplayType.Search));
lInvoice_ID.setLabelFor(fInvoice_ID);
fInvoice_ID.setBackground(AdempierePLAF.getInfoBackground());
fInvoice_ID.addActionListener(this);
// 54090 - C_CashLine.C_Payment_ID
fPayment_ID = new VLookup("C_Payment_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MCashLine.Table_Name, MCashLine.COLUMNNAME_C_Payment_ID), DisplayType.Search));
lPayment_ID.setLabelFor(fPayment_ID);
fPayment_ID.setBackground(AdempierePLAF.getInfoBackground());
fPayment_ID.addActionListener(this);
// 5295 - C_CashLine.C_BankAccount_ID
fBankAccount_ID = new VLookup("C_BankAccount_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MCashLine.Table_Name, MCashLine.COLUMNNAME_C_BankAccount_ID), DisplayType.TableDir));
lBankAccount_ID.setLabelFor(fBankAccount_ID);
fBankAccount_ID.setBackground(AdempierePLAF.getInfoBackground());
fBankAccount_ID.addActionListener(this);
// 5296 - C_CashLine.C_Charge_ID
fCharge_ID = new VLookup(MCashLine.COLUMNNAME_C_Charge_ID, false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MCashLine.Table_Name, MCashLine.COLUMNNAME_C_Charge_ID), DisplayType.TableDir));
fCharge_ID.setBackground(AdempierePLAF.getInfoBackground());
fCharge_ID.addActionListener(this);
//
lDateFrom.setLabelFor(fDateFrom);
fDateFrom.setBackground(AdempierePLAF.getInfoBackground());
fDateFrom.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom"));
fDateFrom.addActionListener(this);
lDateTo.setLabelFor(fDateTo);
fDateTo.setBackground(AdempierePLAF.getInfoBackground());
fDateTo.setToolTipText(Msg.translate(Env.getCtx(), "DateTo"));
fDateTo.addActionListener(this);
lAmtFrom.setLabelFor(fAmtFrom);
fAmtFrom.setBackground(AdempierePLAF.getInfoBackground());
fAmtFrom.setToolTipText(Msg.translate(Env.getCtx(), "AmtFrom"));
fAmtFrom.addActionListener(this);
lAmtTo.setLabelFor(fAmtTo);
fAmtTo.setBackground(AdempierePLAF.getInfoBackground());
fAmtTo.setToolTipText(Msg.translate(Env.getCtx(), "AmtTo"));
fAmtTo.addActionListener(this);
//
cbAbsolute.setText(Msg.translate(Env.getCtx(), "AbsoluteAmt"));
cbAbsolute.setName("AbsoluteAmt");
cbAbsolute.setToolTipText(Msg.getMsg(Env.getCtx(), "AbsoluteAmt"));
cbAbsolute.setSelected(false);
cbAbsolute.addActionListener(this);
//
CPanel amtPanel = new CPanel();
CPanel datePanel = new CPanel();
amtPanel.setLayout(new ALayout(0, 0, true));
amtPanel.add(fAmtFrom, new ALayoutConstraint(0, 0));
amtPanel.add(lAmtTo, null);
amtPanel.add(fAmtTo, null);
datePanel.setLayout(new ALayout(0, 0, true));
datePanel.add(fDateFrom, new ALayoutConstraint(0, 0));
datePanel.add(lDateTo, null);
datePanel.add(fDateTo, null);
// First Row
p_criteriaGrid.setLayout(new ALayout());
p_criteriaGrid.add(lCashBook_ID, new ALayoutConstraint(0, 0));
p_criteriaGrid.add(fCashBook_ID, null);
p_criteriaGrid.add(lCash_ID, null);
p_criteriaGrid.add(fCash_ID, null);
// 2nd Row
p_criteriaGrid.add(lInvoice_ID, new ALayoutConstraint(1, 0));
p_criteriaGrid.add(fInvoice_ID, null);
p_criteriaGrid.add(lPayment_ID, null);
p_criteriaGrid.add(fPayment_ID, null);
// 3rd Row
p_criteriaGrid.add(lBankAccount_ID, new ALayoutConstraint(2, 0));
p_criteriaGrid.add(fBankAccount_ID, null);
p_criteriaGrid.add(lDateFrom, null);
p_criteriaGrid.add(datePanel, null);
// 4th Row
p_criteriaGrid.add(lCharge_ID, new ALayoutConstraint(3, 0));
p_criteriaGrid.add(fCharge_ID, null);
p_criteriaGrid.add(lAmtFrom, null);
p_criteriaGrid.add(amtPanel, null);
p_criteriaGrid.add(cbAbsolute, new ALayoutConstraint(3, 5));
}
use of org.compiere.apps.ALayoutConstraint in project adempiere by adempiere.
the class InfoInOut method statInit.
/**
* Static Setup - add fields to parameterPanel
*/
private void statInit() {
lDocumentNo.setLabelFor(fDocumentNo);
fDocumentNo.setBackground(AdempierePLAF.getInfoBackground());
fDocumentNo.addActionListener(this);
lDescription.setLabelFor(fDescription);
fDescription.setBackground(AdempierePLAF.getInfoBackground());
fDescription.addActionListener(this);
lPOReference.setLabelFor(fPOReference);
fPOReference.setBackground(AdempierePLAF.getInfoBackground());
fPOReference.addActionListener(this);
fIsSOTrx.setSelected(!"N".equals(Env.getContext(Env.getCtx(), p_WindowNo, "IsSOTrx")));
fIsSOTrx.addActionListener(this);
//
fBPartner_ID = new VLookup("C_BPartner_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MInOut.Table_Name, MInOut.COLUMNNAME_C_BPartner_ID), DisplayType.Search));
lBPartner_ID.setLabelFor(fBPartner_ID);
fBPartner_ID.setBackground(AdempierePLAF.getInfoBackground());
fBPartner_ID.addActionListener(this);
//
fShipper_ID = new VLookup("M_Shipper_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MInOut.Table_Name, MInOut.COLUMNNAME_M_Shipper_ID), DisplayType.TableDir));
lShipper_ID.setLabelFor(fShipper_ID);
fShipper_ID.setBackground(AdempierePLAF.getInfoBackground());
fShipper_ID.addActionListener(this);
//
lDateFrom.setLabelFor(fDateFrom);
fDateFrom.setBackground(AdempierePLAF.getInfoBackground());
fDateFrom.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom"));
fDateFrom.addActionListener(this);
lDateTo.setLabelFor(fDateTo);
fDateTo.setBackground(AdempierePLAF.getInfoBackground());
fDateTo.setToolTipText(Msg.translate(Env.getCtx(), "DateTo"));
fDateTo.addActionListener(this);
//
CPanel datePanel = new CPanel();
datePanel.setLayout(new ALayout(0, 0, true));
datePanel.add(fDateFrom, new ALayoutConstraint(0, 0));
datePanel.add(lDateTo, null);
datePanel.add(fDateTo, null);
// First Row
p_criteriaGrid.add(lDocumentNo, new ALayoutConstraint(0, 0));
p_criteriaGrid.add(fDocumentNo, null);
p_criteriaGrid.add(lBPartner_ID, null);
p_criteriaGrid.add(fBPartner_ID, null);
p_criteriaGrid.add(fIsSOTrx, new ALayoutConstraint(0, 5));
// 2nd Row
p_criteriaGrid.add(lDescription, new ALayoutConstraint(1, 0));
p_criteriaGrid.add(fDescription, null);
p_criteriaGrid.add(lDateFrom, null);
p_criteriaGrid.add(datePanel, null);
// 3rd Row
p_criteriaGrid.add(lPOReference, new ALayoutConstraint(2, 0));
p_criteriaGrid.add(fPOReference, null);
p_criteriaGrid.add(lShipper_ID, null);
p_criteriaGrid.add(fShipper_ID, null);
}
use of org.compiere.apps.ALayoutConstraint in project adempiere by adempiere.
the class InfoAssignment method statInit.
//private CButton bNew = new CButton();
/**
* Static Setup - add fields to parameterPanel.
* <pre>
* ResourceType Resource DateTimeFrom DateTimeTo New
* </pre>
*/
private void statInit() {
fieldResourceType = new VLookup("S_ResourceType_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MResourceType.Table_Name, MResourceType.COLUMNNAME_S_ResourceType_ID), DisplayType.TableDir));
fieldResourceType.addActionListener(this);
fieldResource = new VLookup("S_Resource_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MResource.Table_Name, MResource.COLUMNNAME_S_Resource_ID), DisplayType.TableDir));
fieldResource.addActionListener(this);
//
fieldFrom.addActionListener(this);
fieldTo.addActionListener(this);
//
p_criteriaGrid.setLayout(new ALayout());
p_criteriaGrid.add(labelResourceType, new ALayoutConstraint(0, 0));
p_criteriaGrid.add(fieldResourceType, null);
p_criteriaGrid.add(labelResource, null);
p_criteriaGrid.add(fieldResource, null);
//
p_criteriaGrid.add(labelFrom, new ALayoutConstraint(1, 0));
p_criteriaGrid.add(fieldFrom, null);
p_criteriaGrid.add(labelTo, null);
p_criteriaGrid.add(fieldTo, null);
//parameterPanel.add(bNew, null);
}
use of org.compiere.apps.ALayoutConstraint in project adempiere by adempiere.
the class VPAttributeDialog method initAttributes.
// jbInit
/**
* Dyanmic Init.
* @return true if initialized
*/
private boolean initAttributes() {
if (m_M_Product_ID == 0 && !m_productWindow)
return false;
MAttributeSet as = null;
if (m_M_Product_ID != 0) {
// Get Model
m_product = MProduct.get(Env.getCtx(), m_M_Product_ID);
if (m_product.getM_AttributeSetInstance_ID() > 0) {
m_productASI = true;
// The product has an instance associated with it.
if (m_M_AttributeSetInstance_ID != m_product.getM_AttributeSetInstance_ID()) {
log.fine("Different ASI than what is specified on Product!");
}
} else {
// Only show product attributes when in the product window.
m_productASI = m_productWindow;
}
m_masi = MAttributeSetInstance.get(Env.getCtx(), m_M_AttributeSetInstance_ID, m_M_Product_ID);
if (m_masi == null) {
log.severe("No Model for M_AttributeSetInstance_ID=" + m_M_AttributeSetInstance_ID + ", M_Product_ID=" + m_M_Product_ID);
return false;
}
Env.setContext(Env.getCtx(), m_WindowNo, "M_AttributeSet_ID", m_masi.getM_AttributeSet_ID());
// Get Attribute Set
as = m_masi.getMAttributeSet();
} else {
int M_AttributeSet_ID = Env.getContextAsInt(Env.getCtx(), m_WindowNoParent, "M_AttributeSet_ID");
m_masi = new MAttributeSetInstance(Env.getCtx(), 0, M_AttributeSet_ID, null);
as = m_masi.getMAttributeSet();
}
// Product has no Attribute Set
if (as == null) {
//ADialog.error(m_WindowNo, this, "PAttributeNoAttributeSet");
//return false;
}
// always read/write. The two are exclusive and can't co-exist.
if (// Set Instance Attributes and dialog controls
!m_productWindow || !m_productASI) {
if (// Instance attributes possible. Set up controls.
!m_productASI) {
// New/Edit - Selection
if (// new
m_M_AttributeSetInstance_ID == 0)
cbNewEdit.setText(Msg.getMsg(Env.getCtx(), "NewRecord"));
else
cbNewEdit.setText(Msg.getMsg(Env.getCtx(), "EditRecord"));
cbNewEdit.addActionListener(this);
centerPanel.add(cbNewEdit, new ALayoutConstraint(m_row++, 0));
bSelect.setText(Msg.getMsg(Env.getCtx(), "SelectExisting"));
bSelect.addActionListener(this);
centerPanel.add(bSelect, null);
}
// Add the Instance Attributes if any. If its a product attribute set
// this will do nothing.
MAttribute[] attributes = as.getMAttributes(true);
log.fine("Instance Attributes=" + attributes.length);
for (int i = 0; i < attributes.length; i++) addAttributeLine(attributes[i], false, false);
}
if (as != null) {
// Product attributes can be shown in any window but are read/write in the Product window only.
// This will do nothing if it is an instance attribute set.
// False = product attribute instances
MAttribute[] attributes = as.getMAttributes(false);
log.fine("Product Attributes=" + attributes.length);
for (int i = 0; i < attributes.length; i++) addAttributeLine(attributes[i], true, !m_productWindow);
}
// Lot
if ((!m_productWindow || !m_productASI) && as.isLot()) {
CLabel label = new CLabel(Msg.translate(Env.getCtx(), "Lot"));
label.setLabelFor(fieldLotString);
centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
centerPanel.add(fieldLotString, null);
fieldLotString.setText(m_masi.getLot());
// M_Lot_ID
// int AD_Column_ID = 9771; // M_AttributeSetInstance.M_Lot_ID
// fieldLot = new VLookup ("M_Lot_ID", false,false, true,
// MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, AD_Column_ID, DisplayType.TableDir));
String sql = "SELECT M_Lot_ID, Name " + "FROM M_Lot l " + "WHERE EXISTS (SELECT M_Product_ID FROM M_Product p " + "WHERE p.M_AttributeSet_ID=" + m_masi.getM_AttributeSet_ID() + " AND p.M_Product_ID=l.M_Product_ID)";
fieldLot = new CComboBox(DB.getKeyNamePairs(sql, true));
label = new CLabel(Msg.translate(Env.getCtx(), "M_Lot_ID"));
label.setLabelFor(fieldLot);
centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
centerPanel.add(fieldLot, null);
if (m_masi.getM_Lot_ID() != 0) {
for (int i = 1; i < fieldLot.getItemCount(); i++) {
KeyNamePair pp = (KeyNamePair) fieldLot.getItemAt(i);
if (pp.getKey() == m_masi.getM_Lot_ID()) {
fieldLot.setSelectedIndex(i);
fieldLotString.setEditable(false);
break;
}
}
}
fieldLot.addActionListener(this);
// New Lot Button
if (m_masi.getMAttributeSet().getM_LotCtl_ID() != 0 && m_readWrite) {
if (MRole.getDefault().isTableAccess(MLot.Table_ID, false) && MRole.getDefault().isTableAccess(MLotCtl.Table_ID, false) && !m_masi.isExcludeLot(m_AD_Column_ID, Env.isSOTrx(Env.getCtx(), m_WindowNoParent))) {
centerPanel.add(bLot, null);
bLot.addActionListener(this);
}
}
// Popup
// popup
fieldLot.addMouseListener(new VPAttributeDialog_mouseAdapter(this));
mZoom = new CMenuItem(Msg.getMsg(Env.getCtx(), "Zoom"), Env.getImageIcon("Zoom16.gif"));
mZoom.addActionListener(this);
popupMenu.add(mZoom);
}
// SerNo
if ((!m_productWindow || !m_productASI) && as.isSerNo()) {
CLabel label = new CLabel(Msg.translate(Env.getCtx(), "SerNo"));
label.setLabelFor(fieldSerNo);
fieldSerNo.setText(m_masi.getSerNo());
centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
centerPanel.add(fieldSerNo, null);
// New SerNo Button
if (m_masi.getMAttributeSet().getM_SerNoCtl_ID() != 0 && m_readWrite) {
if (MRole.getDefault().isTableAccess(MSerNoCtl.Table_ID, false) && !m_masi.isExcludeSerNo(m_AD_Column_ID, Env.isSOTrx(Env.getCtx(), m_WindowNoParent))) {
centerPanel.add(bSerNo, null);
bSerNo.addActionListener(this);
}
}
}
// GuaranteeDate
if ((!m_productWindow || !m_productASI) && as.isGuaranteeDate()) {
CLabel label = new CLabel(Msg.translate(Env.getCtx(), "GuaranteeDate"));
label.setLabelFor(fieldGuaranteeDate);
if (m_M_AttributeSetInstance_ID == 0)
fieldGuaranteeDate.setValue(m_masi.getGuaranteeDate(true));
else
fieldGuaranteeDate.setValue(m_masi.getGuaranteeDate());
centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
centerPanel.add(fieldGuaranteeDate, null);
}
if (m_row == 0) {
ADialog.error(m_WindowNo, this, "PAttributeNoInfo");
//return false;
}
// New/Edit Window
if ((!m_productWindow || !m_productASI) && m_AD_Column_ID != 0 && m_readWrite) {
cbNewEdit.setSelected(m_M_AttributeSetInstance_ID == 0);
cmd_newEdit();
}
// Attribute Set Instance Description
CLabel label = new CLabel(Msg.translate(Env.getCtx(), "Description"));
label.setLabelFor(fieldDescription);
fieldDescription.setText(m_masi.getDescription());
fieldDescription.setEditable(false);
centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
centerPanel.add(fieldDescription, null);
// Window usually to wide (??)
Dimension dd = centerPanel.getPreferredSize();
dd.width = Math.min(500, dd.width);
centerPanel.setPreferredSize(dd);
return true;
}
use of org.compiere.apps.ALayoutConstraint in project adempiere by adempiere.
the class VPAttributeDialog method addAttributeLine.
// initAttribute
/**
* Add Attribute Line
* @param attribute attribute
* @param product product level attribute
* @param readOnly value is read only
*/
private void addAttributeLine(MAttribute attribute, boolean product, boolean readOnly) {
log.fine(attribute + ", Product=" + product + ", R/O=" + readOnly);
CLabel label = new CLabel(attribute.getName());
if (product)
label.setFont(new Font(label.getFont().getFontName(), Font.BOLD, label.getFont().getSize()));
if (attribute.getDescription() != null)
label.setToolTipText(attribute.getDescription());
centerPanel.add(label, new ALayoutConstraint(m_row++, 0));
//
MAttributeInstance instance = attribute.getMAttributeInstance(m_M_AttributeSetInstance_ID);
if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attribute.getAttributeValueType())) {
// optional = null
MAttributeValue[] values = attribute.getMAttributeValues();
CComboBox editor = new CComboBox(values);
boolean found = false;
if (instance != null) {
for (int i = 0; i < values.length; i++) {
if (values[i] != null && values[i].getM_AttributeValue_ID() == instance.getM_AttributeValue_ID()) {
editor.setSelectedIndex(i);
found = true;
break;
}
}
if (found)
log.fine("Attribute=" + attribute.getName() + " #" + values.length + " - found: " + instance);
else
log.warning("Attribute=" + attribute.getName() + " #" + values.length + " - NOT found: " + instance);
} else
// setComboBox
log.fine("Attribute=" + attribute.getName() + " #" + values.length + " no instance");
label.setLabelFor(editor);
centerPanel.add(editor, null);
if (readOnly)
editor.setEnabled(false);
else
m_editors.add(editor);
} else if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attribute.getAttributeValueType())) {
VNumber editor = new VNumber(attribute.getName(), attribute.isMandatory(), readOnly, !readOnly, DisplayType.Number, attribute.getName());
if (instance != null)
editor.setValue(instance.getValueNumber());
else
editor.setValue(Env.ZERO);
label.setLabelFor(editor);
centerPanel.add(editor, null);
if (readOnly)
editor.setEnabled(false);
else
m_editors.add(editor);
} else // Text Field
{
VString editor = new VString(attribute.getName(), attribute.isMandatory(), false, true, 20, INSTANCE_VALUE_LENGTH, null, null);
if (instance != null)
editor.setText(instance.getValue());
label.setLabelFor(editor);
centerPanel.add(editor, null);
if (readOnly)
editor.setEnabled(false);
else
m_editors.add(editor);
}
}
Aggregations