use of org.compiere.swing.CPanel in project adempiere by adempiere.
the class PreviewPanel method setupPreview.
/**
* Create the preview UI components
*/
private void setupPreview() {
JRootPane rootPane = new JRootPane();
previewPanel.setLayout(new BorderLayout());
previewPanel.add(rootPane, BorderLayout.CENTER);
previewPanel.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
GridLayout gridLayout = new GridLayout(1, 3);
gridLayout.setHgap(4);
rootPane.getContentPane().setLayout(gridLayout);
rootPane.setGlassPane(new GlassPane());
rootPane.getGlassPane().setVisible(true);
CPanel column1 = new CPanel();
rootPane.getContentPane().add(column1);
CPanel column2 = new CPanel();
rootPane.getContentPane().add(column2);
CPanel column3 = new CPanel();
rootPane.getContentPane().add(column3);
column1.setLayout(new GridBagLayout());
JTree jtree = new JTree();
jtree.setFocusable(false);
jtree.setBorder(BorderFactory.createLineBorder(AdempierePLAF.getSecondary1(), 1));
column1.add(jtree, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 5, 2, 2), 0, 0));
CTextField normal = new CTextField("Text Field");
normal.setFocusable(false);
column1.add(normal, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 5, 5, 2), 0, 0));
error.setBackground(true);
error.setFocusable(false);
column1.add(error, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column2.setLayout(new GridBagLayout());
JTable jtable = new JTable(s_data, s_columns);
JScrollPane scrollPane = new JScrollPane(jtable);
jtable.setFocusable(false);
scrollPane.setPreferredSize(jtable.getPreferredSize());
column2.add(scrollPane, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 2), 0, 0));
mandatory.setMandatory(true);
mandatory.setFocusable(false);
column2.add(mandatory, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CTextField inactive = new CTextField(s_res.getString("Inactive"));
inactive.setEnabled(false);
column2.add(inactive, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
column3.setLayout(new GridBagLayout());
CTabbedPane tab = new CTabbedPane();
column3.add(tab, new GridBagConstraints(0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(5, 2, 2, 5), 0, 0));
CComboBox editable = new CComboBox(new Object[] { "Editable" });
editable.setEditable(true);
editable.setFocusable(false);
column3.add(editable, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 2), 0, 0));
CComboBox choice = new CComboBox(new Object[] { "Choice" });
choice.setEditable(false);
choice.setFocusable(false);
column3.add(choice, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2, 2, 5, 5), 0, 0));
tabPage1.setLayout(new BoxLayout(tabPage1, BoxLayout.Y_AXIS));
JRadioButton radio = new JRadioButton("Radio");
radio.setSelected(true);
radio.setMargin(new Insets(5, 5, 5, 5));
radio.setFocusable(false);
radio.setOpaque(false);
tabPage1.add(radio);
CCheckBox checkBox = new CCheckBox("Checkbox");
checkBox.setSelected(true);
checkBox.setMargin(new Insets(5, 5, 5, 5));
checkBox.setFocusable(false);
tabPage1.add(checkBox);
CLabel label = new CLabel("Label");
label.setHorizontalAlignment(JLabel.LEFT);
label.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
tabPage1.add(label);
button.setMargin(new Insets(5, 5, 5, 5));
button.setFocusable(false);
tabPage1.add(button);
tab.add(tabPage1, "tab1");
tab.add(new CPanel(), "tab2");
}
use of org.compiere.swing.CPanel in project adempiere by adempiere.
the class ProcessPanel method initComponents.
@Override
public void initComponents() {
mainLayout = new BorderLayout();
centerPanel = new CPanel();
parameterScrollPane = new CScrollPane(centerPanel);
//
southPanel = new CPanel();
southLayout = new FlowLayout();
// Buttons
bOK = ConfirmPanel.createOKButton(true);
bCancel = ConfirmPanel.createCancelButton(true);
bPrint = ConfirmPanel.createPrintButton(true);
bOK.addActionListener(this);
bCancel.addActionListener(this);
bPrint.addActionListener(this);
//
mainPanel.setLayout(mainLayout);
mainPanel.setMinimumSize(new Dimension(500, 100));
// South Panel
southPanel.setLayout(southLayout);
southLayout.setAlignment(FlowLayout.RIGHT);
southPanel.add(bPrint, null);
southPanel.add(bCancel, null);
southPanel.add(bOK, null);
// Editors
m_separators = new ArrayList<CLabel>();
//
message.setContentType("text/html");
message.setEditable(false);
message.setBackground(Color.white);
message.setFocusable(true);
//
centerPanel.setLayout(new ALayout());
centerPanel.setBorder(null);
if (isShowDescription()) {
mainPanel.add(messagePane, BorderLayout.NORTH);
messagePane.setMaximumSize(new Dimension(600, 300));
}
// Add Center Panel with scroll bar
parameterScrollPane.setAutoscrolls(true);
parameterScrollPane.createVerticalScrollBar();
parameterScrollPane.createHorizontalScrollBar();
//
mainPanel.add(parameterScrollPane, BorderLayout.CENTER);
// Add buttons
if (isShowButtons()) {
mainPanel.add(southPanel, BorderLayout.SOUTH);
}
//
mainLayout.setVgap(2);
// Set Text
message.setText(getTextMsg());
}
use of org.compiere.swing.CPanel in project adempiere by adempiere.
the class VAttributeGrid method addProduct.
// getGridElement
/**
* Add Product
* @param element panel
* @param product product
*/
private void addProduct(CPanel element, MProduct product) {
Insets ii = new Insets(2, 4, 2, 4);
int M_Product_ID = product.getM_Product_ID();
CPanel pe = new CPanel();
pe.setBorder(BorderFactory.createLineBorder(Color.BLUE, 1));
pe.setLayout(new GridBagLayout());
// Product Value - Price
pe.add(new JLabel(product.getValue()), new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, ii, 0, 0));
String formatted = "";
if (m_M_PriceList_Version_ID != 0) {
MProductPrice pp = MProductPrice.get(Env.getCtx(), m_M_PriceList_Version_ID, M_Product_ID, null);
if (pp != null) {
BigDecimal price = pp.getPriceStd();
formatted = m_price.format(price);
} else
formatted = "-";
}
pe.add(new JLabel(formatted, JLabel.RIGHT), new GridBagConstraints(1, 0, 1, 1, .5, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, ii, 0, 0));
// Product Name - Qty
pe.add(new JLabel(product.getName()), new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, ii, 0, 0));
formatted = "";
if (m_M_Warehouse_ID != 0) {
BigDecimal qty = MStorage.getQtyAvailable(m_M_Warehouse_ID, M_Product_ID, 0, null);
if (qty == null)
formatted = "-";
else
formatted = m_qty.format(qty);
}
pe.add(new JLabel(formatted, JLabel.RIGHT), new GridBagConstraints(1, 1, 1, 1, .5, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, ii, 0, 0));
//
element.add(pe);
}
use of org.compiere.swing.CPanel in project adempiere by adempiere.
the class VAttributeGrid method createGrid.
/**
* Create Grid
*/
private void createGrid() {
if (attributeCombo1 == null || m_setting)
// init
return;
int indexAttr1 = attributeCombo1.getSelectedIndex();
int indexAttr2 = attributeCombo2.getSelectedIndex();
if (indexAttr1 == indexAttr2) {
log.warning("Same Attribute Selected");
tabbedPane.setSelectedIndex(0);
return;
}
m_setting = true;
m_M_PriceList_Version_ID = 0;
KeyNamePair pl = (KeyNamePair) pickPriceList.getSelectedItem();
if (pl != null)
m_M_PriceList_Version_ID = pl.getKey();
m_M_Warehouse_ID = 0;
KeyNamePair wh = (KeyNamePair) pickWarehouse.getSelectedItem();
if (wh != null)
m_M_Warehouse_ID = wh.getKey();
// x dimension
int cols = 2;
MAttributeValue[] xValues = null;
if (indexAttr1 > 0)
xValues = m_attributes[indexAttr1 - 1].getMAttributeValues();
if (xValues != null) {
cols = xValues.length;
log.info("X - " + m_attributes[indexAttr1 - 1].getName() + " #" + xValues.length);
}
// y dimension
int rows = 2;
MAttributeValue[] yValues = null;
if (indexAttr2 > 0)
yValues = m_attributes[indexAttr2 - 1].getMAttributeValues();
if (yValues != null) {
rows = yValues.length;
log.info("Y - " + m_attributes[indexAttr2 - 1].getName() + " #" + yValues.length);
}
//
gridPanel.removeAll();
CPanel grid = new CPanel(new GridLayout(rows, cols, 5, 5));
gridPanel.add(modePanel, BorderLayout.NORTH);
gridPanel.add(new CScrollPane(grid), BorderLayout.CENTER);
//
log.info("Rows=" + rows + " - Cols=" + cols);
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
MAttributeValue xValue = null;
if (xValues != null)
xValue = xValues[col];
MAttributeValue yValue = null;
if (yValues != null)
yValue = yValues[row];
//
if (row == 0 && col == 0) {
CPanel descr = new CPanel(new GridLayout(2, 1, 0, 0));
if (xValues != null)
descr.add(new JLabel(m_attributes[indexAttr1 - 1].getName(), JLabel.TRAILING));
if (yValues != null)
descr.add(new JLabel(m_attributes[indexAttr2 - 1].getName()));
grid.add(descr);
} else if (// column labels
row == 0) {
if (xValue != null) {
grid.add(new JLabel(xValue.getName(), JLabel.TRAILING));
} else
grid.add(new JLabel());
} else if (// row labels
col == 0) {
if (yValue != null)
grid.add(new JLabel(yValue.getName()));
else
grid.add(new JLabel());
} else {
grid.add(getGridElement(xValue, yValue));
}
}
}
//
tabbedPane.setSelectedIndex(1);
m_setting = false;
m_frame.pack();
}
use of org.compiere.swing.CPanel in project adempiere by adempiere.
the class VCreateFromInvoiceUI method jbInit.
// dynInit
/**
* Static Init.
* <pre>
* parameterPanel
* parameterBankPanel
* parameterStdPanel
* bPartner/order/invoice/shopment/licator Label/Field
* dataPane
* southPanel
* confirmPanel
* statusBar
* </pre>
* @throws Exception
*/
private void jbInit() throws Exception {
bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID"));
orderLabel.setText(Msg.getElement(Env.getCtx(), "C_Order_ID", false));
shipmentLabel.setText(Msg.getElement(Env.getCtx(), "M_InOut_ID", false));
rmaLabel.setText(Msg.translate(Env.getCtx(), "M_RMA_ID"));
// Add to Main Form
v_Container.getContentPane().add(v_CreateFromPanel);
//
CPanel parameterPanel = v_CreateFromPanel.getParameterPanel();
parameterPanel.setLayout(new BorderLayout());
CPanel parameterStdPanel = new CPanel(new GridBagLayout());
parameterPanel.add(parameterStdPanel, BorderLayout.CENTER);
parameterStdPanel.add(bPartnerLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
if (bPartnerField != null)
parameterStdPanel.add(bPartnerField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
parameterStdPanel.add(orderLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(orderField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
parameterStdPanel.add(shipmentLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(shipmentField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
// Add RMA document selection to panel
parameterStdPanel.add(rmaLabel, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(rmaField, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
}
Aggregations