use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class InfoOrderPanel method statInit.
public void statInit() {
initComponents();
fDocumentNo.setWidth("100%");
fDescription.setWidth("100%");
fPOReference.setWidth("100%");
fDateFrom.setWidth("165px");
fDateTo.setWidth("165px");
fAmtFrom.getDecimalbox().setWidth("155px");
fAmtTo.getDecimalbox().setWidth("155px");
Rows rows = new Rows();
Row row = new Row();
rows.appendChild(row);
row.appendCellChild(lblDocumentNo.rightAlign());
row.appendCellChild(fDocumentNo);
row.appendCellChild(fBPartner_ID.getLabel().rightAlign());
row.appendCellChild(fBPartner_ID.getComponent());
row.appendCellChild(fIsSOTrx);
row = new Row();
rows.appendChild(row);
row.appendCellChild(lblDescription.rightAlign());
row.appendCellChild(fDescription);
row.appendCellChild(lblDateOrdered.rightAlign());
Hbox hbox = new Hbox();
hbox.appendChild(fDateFrom);
hbox.appendChild(new Label("-"));
hbox.appendChild(fDateTo);
hbox.appendChild(fIsDelivered);
row.appendCellChild(hbox, 2);
row = new Row();
rows.appendChild(row);
row.appendCellChild(lblOrderRef.rightAlign());
row.appendCellChild(fPOReference);
row.appendCellChild(lblGrandTotal.rightAlign());
hbox = new Hbox();
hbox.appendChild(fAmtFrom);
hbox.appendChild(new Label("-"));
hbox.appendChild(fAmtTo);
row.appendCellChild(hbox, 2);
p_criteriaGrid.appendChild(rows);
super.setSizes();
}
use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class WAttributeGrid method createGrid.
/**
* Create Grid
*/
private void createGrid() {
if (attributeCombo1 == null || m_setting)
// init
return;
Object attr1 = attributeCombo1.getSelectedItem().getValue();
Object attr2 = attributeCombo2.getSelectedItem().getValue();
if (attr1.equals(attr2)) {
FDialog.warn(m_WindowNo, "Same Attribute Selected", getTitle());
log.warning("Same Attribute Selected");
tabbox.setSelectedIndex(0);
return;
}
m_setting = true;
m_M_PriceList_Version_ID = 0;
ListItem pl = pickPriceList.getSelectedItem();
if (pl != null)
m_M_PriceList_Version_ID = Integer.valueOf(pl.getValue().toString());
m_M_Warehouse_ID = 0;
ListItem wh = pickWarehouse.getSelectedItem();
if (wh != null)
m_M_Warehouse_ID = Integer.valueOf(wh.getValue().toString());
// x dimension
int noOfCols = 2;
int indexAttr1 = 0;
MAttributeValue[] xValues = null;
if (attr1 != null) {
int value = Integer.parseInt(attr1.toString());
for (int i = 0; i < m_attributes.length; i++) {
if (m_attributes[i].getKeyNamePair().getKey() == value) {
xValues = m_attributes[i].getMAttributeValues();
indexAttr1 = i;
break;
}
}
}
if (xValues != null)
noOfCols = xValues.length;
// y dimension
int noOfRows = 2;
int indexAttr2 = 0;
MAttributeValue[] yValues = null;
if (attr2 != null) {
int value = Integer.parseInt(attr2.toString());
for (int i = 0; i < m_attributes.length; i++) {
if (m_attributes[i].getKeyNamePair().getKey() == value) {
yValues = m_attributes[i].getMAttributeValues();
indexAttr2 = i;
break;
}
}
}
if (yValues != null)
noOfRows = yValues.length;
gridView.getChildren().clear();
Rows rows = new Rows();
gridView.appendChild(rows);
log.info("Rows=" + noOfRows + " - Cols=" + noOfCols);
for (int rowIndex = 0; rowIndex < noOfRows; rowIndex++) {
Row row = new Row();
row.setWidth("100%");
rows.appendChild(row);
for (int colIndex = 0; colIndex < noOfCols; colIndex++) {
MAttributeValue xValue = null;
if (xValues != null)
xValue = xValues[colIndex];
MAttributeValue yValue = null;
if (yValues != null)
yValue = yValues[rowIndex];
if (rowIndex == 0 && colIndex == 0) {
Vbox descr = new Vbox();
descr.setWidth("100%");
if (xValues != null) {
Div div = new Div();
div.setAlign("right");
div.appendChild(new Label(m_attributes[indexAttr1].getName()));
descr.appendChild(div);
}
if (yValues != null)
descr.appendChild(new Label(m_attributes[indexAttr2].getName()));
row.appendChild(descr);
} else if (// column labels
rowIndex == 0) {
if (xValue != null) {
Div div = new Div();
div.setAlign("center");
div.appendChild(new Label(xValue.getName()));
row.appendChild(div);
} else
row.appendChild(new Label());
} else if (// row labels
colIndex == 0) {
if (yValue != null)
row.appendChild(new Label(yValue.getName()));
else
row.appendChild(new Label());
} else {
row.appendChild(getGridElement(xValue, yValue));
}
}
}
tabbox.setSelectedIndex(1);
m_setting = false;
}
use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class WAttributeGrid method addProduct.
// getGridElement
/**
* Add Product
* @param element panel
* @param product product
*/
private void addProduct(Panel element, MProduct product) {
int M_Product_ID = product.getM_Product_ID();
Vbox pe = new Vbox();
pe.setStyle("border-width: thin; border-color: blue;");
// Product Value - Price
pe.appendChild(new Label(product.getValue()));
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.appendChild(new Label(formatted));
// Product Name - Qty
pe.appendChild(new Label(product.getName()));
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.appendChild(new Label(formatted));
//
element.appendChild(pe);
}
use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class WCharge method createNewChargePanel.
/**
* Creates the New Charge panel.
*
* The New Charge panel is used to specify the name and key of an account
* and whether or not the account is a charge account.
*/
private void createNewChargePanel() {
final int nameFieldColumns = 20;
final int valueFieldColumns = 10;
// top row
m_lblValue.setValue(Msg.translate(Env.getCtx(), EColumn.VALUE.title()));
m_txbValueField.setCols(valueFieldColumns);
m_chbIsExpense.setChecked(true);
m_chbIsExpense.setLabel(Msg.getMsg(Env.getCtx(), EColumn.EXPENSE.title()));
// bottom row
m_lblName.setValue(Msg.translate(Env.getCtx(), EColumn.NAME.title()));
m_txbNameField.setCols(nameFieldColumns);
m_btnNew.setLabel(Msg.getMsg(Env.getCtx(), AD_MESSAGE_CREATE) + " " + Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New")));
m_btnNew.addEventListener(Events.ON_CLICK, this);
Rows rows = new Rows();
m_grdNew.appendChild(rows);
Row row = new Row();
rows.appendChild(row);
row.setSpans("3");
Label label = new Label(Msg.getMsg(Env.getCtx(), "ChargeNewAccount"));
label.setStyle("font-weight: bold;");
row.appendChild(label);
row = new Row();
rows.appendChild(row);
row.appendChild(m_lblValue);
row.appendChild(m_txbValueField);
row.appendChild(m_chbIsExpense);
row = new Row();
rows.appendChild(row);
row.appendChild(m_lblName);
row.appendChild(m_txbNameField);
row.appendChild(m_btnNew);
row = new Row();
rows.appendChild(row);
row.setSpans("3");
row.appendChild(new Separator());
return;
}
use of org.adempiere.webui.component.Label in project adempiere by adempiere.
the class LoginPanel method init.
private void init() {
//this.setContentSclass(ITheme.LOGIN_WINDOW_CLASS);
Div div = new Div();
ThemeUtils.addSclass("ad-loginpanel-header", div);
// TODO - localization
Label label = new Label("Login");
ThemeUtils.addSclass("ad-loginpanel-header-text", label);
div.appendChild(label);
this.appendChild(div);
Table table = new Table();
table.setId("grdLogin");
ThemeUtils.addSclass("ad-loginpanel-body", table);
this.appendChild(table);
Tr tr = new Tr();
table.appendChild(tr);
Td td = new Td();
ThemeUtils.addSclass("ad-loginpanel-header-logo", td);
tr.appendChild(td);
td.setDynamicProperty("colspan", "2");
Image image = new Image();
image.setSrc(ThemeUtils.getLargeLogo());
ThemeUtils.addSclass("ad-loginpanel-header-logo", image);
td.appendChild(image);
tr = new Tr();
tr.setId("rowUser");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
ThemeUtils.addSclass("login-label", td);
td.appendChild(lblUserId);
td = new Td();
ThemeUtils.addSclass("login-field", td);
tr.appendChild(td);
td.appendChild(txtUserId);
tr = new Tr();
tr.setId("rowPassword");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
ThemeUtils.addSclass("login-label", td);
td.appendChild(lblPassword);
td = new Td();
ThemeUtils.addSclass("login-field", td);
tr.appendChild(td);
td.appendChild(txtPassword);
tr = new Tr();
tr.setId("rowLanguage");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
ThemeUtils.addSclass("login-label", td);
td.appendChild(lblLanguage);
td = new Td();
ThemeUtils.addSclass("login-field", td);
tr.appendChild(td);
td.appendChild(lstLanguage);
if (MSystem.isZKRememberUserAllowed()) {
tr = new Tr();
tr.setId("rowRememberMe");
table.appendChild(tr);
td = new Td();
tr.appendChild(td);
ThemeUtils.addSclass("login-label", td);
td.appendChild(new Label(""));
td = new Td();
ThemeUtils.addSclass("login-field", td);
tr.appendChild(td);
td.appendChild(chkRememberMe);
}
div = new Div();
ThemeUtils.addSclass("ad-loginpanel-footer", div);
ConfirmPanel pnlButtons = new ConfirmPanel(false);
pnlButtons.addActionListener(this);
ThemeUtils.addSclass("ad-loginpanel-footer-pnl", pnlButtons);
pnlButtons.getButton(ConfirmPanel.A_OK).setSclass("login-btn");
div.appendChild(pnlButtons);
this.appendChild(div);
this.addEventListener(TokenEvent.ON_USER_TOKEN, new EventListener<Event>() {
@Override
public void onEvent(Event event) throws Exception {
String[] data = (String[]) event.getData();
try {
int AD_Session_ID = Integer.parseInt(data[0]);
MSession session = new MSession(Env.getCtx(), AD_Session_ID, null);
if (session.get_ID() == AD_Session_ID) {
int AD_User_ID = session.getCreatedBy();
MUser user = MUser.get(Env.getCtx(), AD_User_ID);
if (user != null && user.get_ID() == AD_User_ID) {
String token = data[1];
if (BrowserToken.validateToken(session, user, token)) {
if (MSystem.isZKRememberUserAllowed()) {
txtUserId.setValue(user.getName());
onUserIdChange();
chkRememberMe.setChecked(true);
}
if (MSystem.isZKRememberPasswordAllowed()) {
txtPassword.setValue(token);
txtPassword.setAttribute("user.token.hash", token);
txtPassword.setAttribute("user.token.sid", AD_Session_ID);
}
}
}
}
} catch (Exception e) {
//safe to ignore
logger.log(Level.INFO, e.getLocalizedMessage(), e);
}
}
});
}
Aggregations