use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class ProcessPanel method formatEditor.
public void formatEditor(CEditor editor1, CEditor editor2) {
//
WEditor editor = (WEditor) editor1;
WEditor editorTo = (WEditor) editor2;
configColumns(editor, editorTo);
//
if (editor == null) {
return;
}
//streach component to fill grid cell
editor.fillHorizontal();
//setup editor context menu
WEditorPopupMenu popupMenu;
popupMenu = editor.getPopupMenu();
if (popupMenu != null) {
popupMenu.addMenuListener((ContextMenuListener) editor);
mainPanel.appendChild(popupMenu);
}
//
Div div = new Div();
div.setAlign("right");
Label label = editor.getLabel();
div.appendChild(label);
if (label.getDecorator() != null)
div.appendChild(label.getDecorator());
//
currentRow.appendChild(div);
// Add Child
cols += 2;
//
Hbox box;
if (editorTo != null) {
box = new Hbox();
box.appendChild(editor.getComponent());
} else {
currentRow.appendChild(editor.getComponent());
m_separators.add(null);
return;
}
// The 2nd range editor
editorTo.fillHorizontal();
//setup editor context menu
popupMenu = editorTo.getPopupMenu();
if (popupMenu != null) {
popupMenu.addMenuListener((ContextMenuListener) editorTo);
mainPanel.appendChild(popupMenu);
}
//
Label separator = new Label(" - ");
m_separators.add(separator);
box.appendChild(separator);
box.appendChild(editorTo.getComponent());
// Add
currentRow.appendChild(box);
}
use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class ProcessPanel method initComponents.
/**
* Initialize components
*/
@Override
public void initComponents() {
m_separators = new ArrayList<Label>();
rows = new Rows();
//
mainPanel = new Panel();
parameterPanel = GridFactory.newGridLayout();
parameterPanel.setInnerWidth(width);
//setup columns
Columns columns = new Columns();
parameterPanel.appendChild(columns);
int colN = getColumns() * 2;
if (colN != 0) {
int percent = 100 / colN;
for (int i = 0; i < colN; i++) {
Column col = new Column();
col.setWidth((i == 0 ? ((int) percent / 2) : percent) + "%");
columns.appendChild(col);
}
}
// Add Rows
parameterPanel.appendChild(rows);
//
mainLayout = new Borderlayout();
mainLayout.setStyle("border: none; overflow: auto");
// Message Panel
if (isShowDescription()) {
messageDiv = new Div();
message = new Html();
messageDiv.appendChild(message);
messageDiv.setStyle(MESSAGE_DIV_STYLE);
messagePanel = new North();
messagePanel.appendChild(messageDiv);
messagePanel.setAutoscroll(true);
messagePanel.setStyle("border: none;");
mainLayout.appendChild(messagePanel);
}
// Parameter Panel
centerPanel = new Center();
mainLayout.appendChild(centerPanel);
centerPanel.appendChild(parameterPanel);
centerPanel.setFlex(false);
centerPanel.setStyle("border: none");
// Buttons Panel
if (isShowButtons()) {
Grid southRowPanel = GridFactory.newGridLayout();
Rows rows = southRowPanel.newRows();
Row row = rows.newRow();
Hbox hBox = new Hbox();
hBox.appendChild(lSaved);
fSavedName.addEventListener(Events.ON_CHANGE, this);
hBox.appendChild(fSavedName);
bSave.setEnabled(false);
bSave.setImage("/images/Save24.png");
bSave.setSclass("action-button");
bSave.addActionListener(this);
hBox.appendChild(bSave);
bDelete.setEnabled(false);
bDelete.setImage("/images/Delete24.png");
bDelete.setSclass("action-button");
bDelete.addActionListener(this);
hBox.appendChild(bDelete);
row.appendChild(hBox);
Panel confParaPanel = new Panel();
confParaPanel.setAlign("right");
// BR [ 300 ]
try {
// Set Ok
WAppsAction action = new WAppsAction(ConfirmPanel.A_OK, null, ConfirmPanel.A_OK);
bOK = action.getButton();
// Set to Cancel
action = new WAppsAction(ConfirmPanel.A_CANCEL, null, ConfirmPanel.A_CANCEL);
bCancel = action.getButton();
// Add Listener
bOK.addEventListener(Events.ON_CLICK, this);
bCancel.addEventListener(Events.ON_CLICK, this);
// Add to Panel
confParaPanel.appendChild(bCancel);
confParaPanel.appendChild(bOK);
} catch (Exception e) {
log.severe("Error loading Buttons " + e.getLocalizedMessage());
}
//
row.appendChild(confParaPanel);
South south = new South();
south.appendChild(southRowPanel);
// Add to Main panel
mainLayout.appendChild(south);
}
// Set Text
if (isShowDescription()) {
message.setContent(getTextMsg());
}
//
mainPanel.appendChild(mainLayout);
mainPanel.setHeight("100%");
mainPanel.setWidth("100%");
}
use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class WBOMDrop method createSelectionPanel.
// dispose
/**************************************************************************
* Create Selection Panel
* @param order
* @param invoice
* @param project
*/
private void createSelectionPanel(boolean order, boolean invoice, boolean project) {
Caption caption = new Caption(Msg.translate(Env.getCtx(), "Selection"));
// grpSelectionPanel.setWidth("100%");
grpSelectionPanel.appendChild(caption);
grpSelectionPanel.appendChild(selectionPanel);
productField.setRows(1);
productField.setMold("select");
KeyNamePair[] keyNamePair = getProducts();
for (int i = 0; i < keyNamePair.length; i++) {
productField.addItem(keyNamePair[i]);
}
Rows rows = selectionPanel.newRows();
Row boxProductQty = rows.newRow();
Label lblProduct = new Label(Msg.translate(Env.getCtx(), "M_Product_ID"));
Label lblQty = new Label(Msg.translate(Env.getCtx(), "Qty"));
productQty.setValue(new BigDecimal(1));
productField.addEventListener(Events.ON_SELECT, this);
productQty.addEventListener(Events.ON_CHANGE, this);
productField.setWidth("99%");
boxProductQty.appendChild(lblProduct.rightAlign());
boxProductQty.appendChild(productField);
boxProductQty.appendChild(lblQty.rightAlign());
boxProductQty.appendChild(productQty);
if (order) {
keyNamePair = getOrders();
orderField.setRows(1);
orderField.setMold("select");
orderField.setWidth("99%");
for (int i = 0; i < keyNamePair.length; i++) {
orderField.addItem(keyNamePair[i]);
}
Label lblOrder = new Label(Msg.translate(Env.getCtx(), "C_Order_ID"));
Row boxOrder = rows.newRow();
orderField.addEventListener(Events.ON_CLICK, this);
boxOrder.appendChild(lblOrder.rightAlign());
boxOrder.appendChild(orderField);
boxOrder.appendChild(new Space());
boxOrder.appendChild(new Space());
}
if (invoice) {
invoiceField.setRows(1);
invoiceField.setMold("select");
invoiceField.setWidth("99%");
keyNamePair = getInvoices();
for (int i = 0; i < keyNamePair.length; i++) {
invoiceField.addItem(keyNamePair[i]);
}
Label lblInvoice = new Label(Msg.translate(Env.getCtx(), "C_Invoice_ID"));
Row boxInvoices = rows.newRow();
invoiceField.addEventListener(Events.ON_SELECT, this);
boxInvoices.appendChild(lblInvoice.rightAlign());
boxInvoices.appendChild(invoiceField);
boxInvoices.appendChild(new Space());
boxInvoices.appendChild(new Space());
}
if (project) {
projectField.setRows(1);
projectField.setMold("select");
projectField.setWidth("99%");
keyNamePair = getProjects();
for (int i = 0; i < keyNamePair.length; i++) {
projectField.addItem(keyNamePair[i]);
}
Label lblProject = new Label(Msg.translate(Env.getCtx(), "C_Project_ID"));
Row boxProject = rows.newRow();
projectField.addEventListener(Events.ON_SELECT, this);
boxProject.appendChild(lblProject.rightAlign());
boxProject.appendChild(projectField);
boxProject.appendChild(new Space());
boxProject.appendChild(new Space());
}
// Enabled in ActionPerformed
confirmPanel.setEnabled("Ok", false);
}
use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class WBOMDrop 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) {
log.fine("M_Product_ID=" + M_Product_ID + ",Type=" + bomType + ",Name=" + name + ",Qty=" + lineQty);
boolean selected = true;
Hbox boxQty = new Hbox();
boxQty.setWidth("100%");
boxQty.setWidths("10%, 40%, 50%");
if (MProductBOM.BOMTYPE_StandardPart.equals(bomType)) {
String title = "";
Checkbox cb = new Checkbox();
cb.setLabel(title);
cb.setChecked(true);
cb.setEnabled(false);
m_selectionList.add(cb);
boxQty.appendChild(cb);
} else if (MProductBOM.BOMTYPE_OptionalPart.equals(bomType)) {
String title = Msg.getMsg(Env.getCtx(), "Optional");
Checkbox cb = new Checkbox();
cb.setLabel(title);
cb.setChecked(false);
selected = false;
cb.addEventListener(Events.ON_CHECK, this);
m_selectionList.add(cb);
boxQty.appendChild(cb);
} else // Alternative
{
String title = Msg.getMsg(Env.getCtx(), "Alternative") + " " + bomType;
Radio b = new Radio();
b.setLabel(title);
String groupName = String.valueOf(parentM_Product_ID) + "_" + bomType;
Radiogroup group = m_buttonGroups.get(groupName);
if (group == null) {
log.fine("ButtonGroup=" + groupName);
group = new Radiogroup();
m_buttonGroups.put(groupName, group);
group.appendChild(b);
// select first one
b.setSelected(true);
} else {
group.appendChild(b);
b.setSelected(false);
selected = false;
}
b.addEventListener(Events.ON_CLICK, this);
m_selectionList.add(b);
boxQty.appendChild(b);
}
// Add to List & display
m_productList.add(new Integer(M_Product_ID));
Decimalbox qty = new Decimalbox();
qty.setValue(lineQty);
qty.setReadonly(!selected);
m_qtyList.add(qty);
Label label = new Label(name);
HtmlBasedComponent c = (HtmlBasedComponent) label.rightAlign();
c.setStyle(c.getStyle() + ";margin-right: 5px");
boxQty.appendChild(c);
boxQty.appendChild(qty);
grpSelectProd.appendChild(boxQty);
}
use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class WCharge method createAccountPanel.
/**
* Creates the account panel.
*
* The account panel contains:
* <li>a table detailing all accounts
* <li>a button for creating charges for selected accounts
*/
private void createAccountPanel() {
Borderlayout borderlayout = new Borderlayout();
borderlayout.setStyle("position: absolute");
borderlayout.setWidth("100%");
borderlayout.setHeight("100%");
m_pnlAccount.appendChild(borderlayout);
North north = new North();
north.setBorder("none");
borderlayout.appendChild(north);
Label label = new Label(Msg.getMsg(Env.getCtx(), "ChargeFromAccount"));
label.setStyle("font-weight: bold;");
north.appendChild(label);
Center center = new Center();
center.setBorder("none");
center.setHflex("true");
center.setVflex("true");
center.setAutoscroll(true);
borderlayout.appendChild(center);
center.appendChild(m_tblData);
South south = new South();
south.setBorder("none");
borderlayout.appendChild(south);
Panel southPanel = new Panel();
southPanel.setAlign("right");
south.appendChild(southPanel);
m_btnAccount.setLabel(Msg.getMsg(Env.getCtx(), AD_MESSAGE_CREATE) + " " + Msg.getMsg(Env.getCtx(), "From") + " " + Msg.getElement(Env.getCtx(), "Account_ID"));
m_btnAccount.addEventListener(Events.ON_CLICK, this);
southPanel.appendChild(m_btnAccount);
return;
}
Aggregations