use of org.compiere.swing.CLabel in project adempiere by adempiere.
the class VProductConfigurationBOM method createSelectionPanel.
/**************************************************************************
* Create Selection Panel
* @param order
* @param invoice
* @param project
*/
private void createSelectionPanel(boolean order, boolean invoice, boolean project) {
int row = 0;
selectionPanel.setBorder(new TitledBorder(Msg.translate(Env.getCtx(), "Selection")));
productField = new CComboBox(getProducts());
CLabel label = new CLabel(Msg.translate(Env.getCtx(), "M_Product_ID"));
label.setLabelFor(productField);
selectionPanel.add(label, new ALayoutConstraint(row++, 0));
selectionPanel.add(productField);
productField.addActionListener(this);
// Qty
label = new CLabel(productQty.getTitle());
label.setLabelFor(productQty);
selectionPanel.add(label);
selectionPanel.add(productQty);
productQty.setValue(Env.ONE);
productQty.addActionListener(this);
if (order) {
orderField = new CComboBox(getOrders());
label = new CLabel(Msg.translate(Env.getCtx(), "C_Order_ID"));
label.setLabelFor(orderField);
selectionPanel.add(label, new ALayoutConstraint(row++, 0));
selectionPanel.add(orderField);
orderField.addActionListener(this);
}
if (invoice) {
invoiceField = new CComboBox(getInvoices());
label = new CLabel(Msg.translate(Env.getCtx(), "C_Invoice_ID"));
label.setLabelFor(invoiceField);
selectionPanel.add(label, new ALayoutConstraint(row++, 0));
selectionPanel.add(invoiceField);
invoiceField.addActionListener(this);
}
if (project) {
projectField = new CComboBox(getProjects());
label = new CLabel(Msg.translate(Env.getCtx(), "C_Project_ID"));
label.setLabelFor(projectField);
selectionPanel.add(label, new ALayoutConstraint(row++, 0));
selectionPanel.add(projectField);
projectField.addActionListener(this);
}
// Enabled in ActionPerformed
confirmPanel.getOKButton().setEnabled(false);
// Size
Dimension size = selectionPanel.getPreferredSize();
size.width = WINDOW_WIDTH;
selectionPanel.setPreferredSize(size);
}
use of org.compiere.swing.CLabel in project adempiere by adempiere.
the class VProductConfigurationBOM method addDisplay.
// addBOMLine
/**
* Add Line to Display
* @param parentM_Product_ID parent product
* @param M_Product_ID product
* @param bomType bom type
* @param name name
* @param lineQty qty
*/
private void addDisplay(int parentM_Product_ID, int M_Product_ID, String bomType, String name, BigDecimal lineQty, int PP_Product_BOM_ID, String M_Feature, int PP_Product_BOMLine_ID) {
log.fine("M_Product_ID=" + M_Product_ID + ",Type=" + bomType + ",Name=" + name + ",Qty=" + lineQty);
//
boolean selected = true;
if (MPPProductBOMLine.COMPONENTTYPE_Component.equals(bomType)) {
String title = "";
JCheckBox cb = new JCheckBox(title);
cb.setSelected(true);
cb.setEnabled(false);
m_selectionList.add(cb);
this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
} else //FIXME: add different types for libero
if (MPPProductBOMLine.COMPONENTTYPE_Variant.equals(bomType)) {
String title = Msg.getMsg(Env.getCtx(), "Optional");
JCheckBox cb = new JCheckBox(title);
cb.setSelected(false);
selected = false;
cb.addActionListener(this);
m_selectionList.add(cb);
this.add(cb, new ALayoutConstraint(m_bomLine++, 0));
} else // Alternative
{
//String title = Msg.getMsg(Env.getCtx(), "Alternative") + " " + bomType;
String title = M_Feature;
JRadioButton b = new JRadioButton(title);
//String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType;
String groupName = String.valueOf(getProductFromMPPProductBOM(PP_Product_BOM_ID).get_ID()) + "_" + bomType;
ButtonGroup group = (ButtonGroup) m_buttonGroups.get(groupName);
if (group == null) {
log.fine("ButtonGroup=" + groupName);
group = new ButtonGroup();
m_buttonGroups.put(groupName, group);
group.add(b);
// select first one
b.setSelected(true);
} else {
group.add(b);
b.setSelected(false);
selected = false;
}
b.addActionListener(this);
m_selectionList.add(b);
this.add(b, new ALayoutConstraint(m_bomLine++, 0));
}
// Add to List & display
m_productList.add(new Integer(M_Product_ID));
m_bomLineIDList.add(new Integer(PP_Product_BOMLine_ID));
/*VNumber qty = new VNumber ("Qty", true, false, true, DisplayType.Quantity, name);
qty.setValue(lineQty);
qty.setReadWrite(selected);
m_qtyList.add(qty);
*/
CLabel label = new CLabel(name);
//label.setLabelFor(qty);
this.add(label);
//this.add(qty);
}
use of org.compiere.swing.CLabel in project adempiere by adempiere.
the class VBOMDrop method createSelectionPanel.
/**************************************************************************
* Create Selection Panel
* @param order
* @param invoice
* @param project
*/
private void createSelectionPanel(boolean order, boolean invoice, boolean project) {
int row = 0;
selectionPanel.setBorder(new TitledBorder(Msg.translate(Env.getCtx(), "Selection")));
productField = new CComboBox(getProducts());
CLabel label = new CLabel(Msg.translate(Env.getCtx(), "M_Product_ID"));
label.setLabelFor(productField);
selectionPanel.add(label, new ALayoutConstraint(row++, 0));
selectionPanel.add(productField);
productField.addActionListener(this);
// Qty
label = new CLabel(productQty.getTitle());
label.setLabelFor(productQty);
selectionPanel.add(label);
selectionPanel.add(productQty);
productQty.setValue(Env.ONE);
productQty.addActionListener(this);
if (order) {
orderField = new CComboBox(getOrders());
label = new CLabel(Msg.translate(Env.getCtx(), "C_Order_ID"));
label.setLabelFor(orderField);
selectionPanel.add(label, new ALayoutConstraint(row++, 0));
selectionPanel.add(orderField);
orderField.addActionListener(this);
}
if (invoice) {
invoiceField = new CComboBox(getInvoices());
label = new CLabel(Msg.translate(Env.getCtx(), "C_Invoice_ID"));
label.setLabelFor(invoiceField);
selectionPanel.add(label, new ALayoutConstraint(row++, 0));
selectionPanel.add(invoiceField);
invoiceField.addActionListener(this);
}
if (project) {
projectField = new CComboBox(getProjects());
label = new CLabel(Msg.translate(Env.getCtx(), "C_Project_ID"));
label.setLabelFor(projectField);
selectionPanel.add(label, new ALayoutConstraint(row++, 0));
selectionPanel.add(projectField);
projectField.addActionListener(this);
}
// Enabled in ActionPerformed
confirmPanel.getOKButton().setEnabled(false);
// Size
Dimension size = selectionPanel.getPreferredSize();
size.width = WINDOW_WIDTH;
selectionPanel.setPreferredSize(size);
}
use of org.compiere.swing.CLabel in project adempiere by adempiere.
the class VPanel method addField.
/**
* Add the previous Field and Label to Panel
* @param editor editor
* @param mField field model
* @param wrap move to next line after this field
*/
public void addField(VEditor editor, GridField mField) {
//[ 1757088 ]
int AD_Tab_ID = mField.getIncluded_Tab_ID();
if (AD_Tab_ID != 0) {
CollapsiblePanel m_tab = new CollapsiblePanel("");
m_tabincludelist.put(AD_Tab_ID, m_tab);
m_main.add(m_tab, "newline, spanx, growx");
m_tab.setName("IncludedTab#" + AD_Tab_ID);
if (includedTabList.containsKey(AD_Tab_ID)) {
includeTab(includedTabList.get(AD_Tab_ID));
}
return;
}
CLabel label = VEditorFactory.getLabel(mField);
if (label == null && editor == null)
return;
boolean sameLine = mField.isSameLine();
//[ 1757088 ] // sets top
String fieldGroup = mField.getFieldGroup();
String fieldGroupType = mField.getFieldGroupType();
if (Util.isEmpty(fieldGroup)) {
fieldGroup = m_oldFieldGroup;
fieldGroupType = m_oldFieldGroupType;
}
if (// sets top
addGroup(fieldGroup, fieldGroupType)) {
if (X_AD_FieldGroup.FIELDGROUPTYPE_Collapse.equals(fieldGroupType)) {
CollapsiblePanel panel = (CollapsiblePanel) m_tablist.get(fieldGroup);
panel.getCollapsiblePane().setCollapsed(mField.getIsCollapsedByDefault());
}
sameLine = false;
} else {
fieldGroup = m_oldFieldGroup;
fieldGroupType = m_oldFieldGroupType;
}
// label constraints
String constraints = "align trailing";
if (!sameLine) {
constraints += ", newline";
}
// *** The Label ***
if (label == null) {
label = new CLabel("");
label.setName(mField.getColumnName());
}
//
if (mField.isCreateMnemonic())
setMnemonic(label, mField.getMnemonic());
if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Tab)) {
CPanel m_tab = (CPanel) m_tablist.get(fieldGroup);
m_tab.add(label, constraints);
} else if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Collapse)) {
CollapsiblePanel m_tab = (CollapsiblePanel) m_tablist.get(fieldGroup);
m_tab.getCollapsiblePane().getContentPane().add(label, constraints);
} else // Label
{
m_main.add(label, constraints);
}
int currentWidth = label.getPreferredSize().width;
labelMinWidth = currentWidth > labelMinWidth ? currentWidth : labelMinWidth;
// *** The Field ***
if (editor != null) {
Component field = (Component) editor;
// field constraints
// long fields span all remaining columns
constraints = "growx, pushx";
if (mField.isLongField()) {
constraints += mField.isLongField() ? ",spanx" : "";
}
if (wrap) {
// Vertical Spacing in Swing Client
// - https://sourceforge.net/tracker/?func=detail&aid=3073406&group_id=176962&atid=883808
constraints += ", wrap 0";
}
//[ 1757088 ]
if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Tab)) {
CPanel m_tab = (CPanel) m_tablist.get(fieldGroup);
m_tab.add(field, constraints);
} else if (fieldGroupType.equals(X_AD_FieldGroup.FIELDGROUPTYPE_Collapse)) {
CollapsiblePanel m_tab = (CollapsiblePanel) m_tablist.get(fieldGroup);
Component comp = (Component) editor;
comp.setMinimumSize(comp.getPreferredSize());
if (mField.getDisplayType() == DisplayType.Text || mField.getDisplayType() == DisplayType.Memo || mField.getDisplayType() == DisplayType.TextLong) {
Component component = (Component) editor;
component.setMinimumSize(component.getPreferredSize());
}
if (!mField.isLongField())
fieldMinWidth = field.getPreferredSize().width > fieldMinWidth ? field.getPreferredSize().width : fieldMinWidth;
m_tab.getCollapsiblePane().getContentPane().add(field, constraints);
} else // Label or null
{
m_main.add(field, constraints);
if (!mField.isLongField())
fieldMinWidth = field.getPreferredSize().width > fieldMinWidth ? field.getPreferredSize().width : fieldMinWidth;
}
// Link Label to Field
if (label != null)
label.setLabelFor(field);
else if (mField.isCreateMnemonic())
setMnemonic(editor, mField.getMnemonic());
}
}
use of org.compiere.swing.CLabel in project adempiere by adempiere.
the class QueryDocType method init.
/**
* Set up Panel
*/
protected void init() {
setTitle(Msg.translate(Env.getCtx(), "C_DocType_ID"));
// North
parameterPanel.setLayout(new MigLayout("fill", "", "[50][50][]"));
parameterPanel.setBorder(new TitledBorder(Msg.getMsg(ctx, "Query")));
//
CLabel lname = new CLabel(Msg.translate(ctx, "Name"));
parameterPanel.add(lname, " growy");
f_Name = new POSTextField("", posPanel.getKeyboard());
lname.setLabelFor(f_Name);
parameterPanel.add(f_Name, "h 30, w 200");
f_Name.addActionListener(this);
CLabel ldescription = new CLabel(Msg.translate(ctx, "Description"));
parameterPanel.add(ldescription, " growy");
f_Description = new POSTextField("", posPanel.getKeyboard());
lname.setLabelFor(f_Description);
parameterPanel.add(f_Description, "h 30, w 200");
f_Description.addActionListener(this);
// Center
posTable.prepareTable(s_layout, s_sqlFrom, s_sqlWhere, false, "C_DocType");
//
posTable.growScrollbars();
SwingUtilities.invokeLater(new Runnable() {
public void run() {
f_Name.requestFocus();
}
});
}
Aggregations