use of org.adempiere.webui.component.Row in project adempiere by adempiere.
the class WWFActivity method init.
private void init() {
Grid grid = new Grid();
grid.setWidth("100%");
grid.setHeight("100%");
grid.setStyle("margin:0; padding:0; position: absolute; align: center; valign: center;");
grid.makeNoStrip();
grid.setOddRowSclass("even");
Rows rows = new Rows();
grid.appendChild(rows);
Row row = new Row();
rows.appendChild(row);
Div div = new Div();
div.setAlign("right");
div.appendChild(lNode);
row.appendChild(div);
row.appendChild(fNode);
fNode.setWidth("100%");
fNode.setReadonly(true);
row = new Row();
rows.appendChild(row);
row.setValign("top");
div = new Div();
div.setAlign("right");
div.appendChild(lDesctiption);
row.appendChild(div);
row.appendChild(fDescription);
fDescription.setMultiline(true);
fDescription.setWidth("100%");
fDescription.setReadonly(true);
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(lHelp);
row.appendChild(div);
row.appendChild(fHelp);
fHelp.setMultiline(true);
fHelp.setWidth("100%");
fHelp.setReadonly(true);
fHelp.setRows(3);
row.appendChild(new Label());
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(lHistory);
row.appendChild(div);
row.appendChild(fHistory);
row.appendChild(new Label());
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(lAnswer);
row.appendChild(div);
Hbox hbox = new Hbox();
hbox.appendChild(fAnswerText);
hbox.appendChild(fAnswerList);
hbox.appendChild(fAnswerButton);
fAnswerButton.addEventListener(Events.ON_CLICK, this);
row.appendChild(hbox);
row.appendChild(bZoom);
bZoom.addEventListener(Events.ON_CLICK, this);
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(lTextMsg);
row.appendChild(div);
row.appendChild(fTextMsg);
fTextMsg.setMultiline(true);
fTextMsg.setWidth("100%");
row.appendChild(new Label());
row = new Row();
rows.appendChild(row);
div = new Div();
div.setAlign("right");
div.appendChild(lForward);
row.appendChild(div);
hbox = new Hbox();
hbox.appendChild(fForward.getComponent());
hbox.appendChild(lOptional);
row.appendChild(hbox);
row.appendChild(bOK);
bOK.addEventListener(Events.ON_CLICK, this);
Borderlayout layout = new Borderlayout();
layout.setWidth("100%");
layout.setHeight("100%");
layout.setStyle("background-color: transparent; position: absolute;");
North north = new North();
north.appendChild(listbox);
north.setSplittable(true);
north.setHflex("true");
//north.setVflex("true");
north.setHeight("50%");
layout.appendChild(north);
north.setStyle("background-color: transparent");
listbox.addEventListener(Events.ON_SELECT, this);
Center center = new Center();
center.appendChild(grid);
layout.appendChild(center);
center.setStyle("background-color: transparent");
center.setHflex("true");
center.setVflex("true");
South south = new South();
south.appendChild(statusBar);
layout.appendChild(south);
south.setStyle("background-color: transparent");
this.appendChild(layout);
this.setStyle("height: 100%; width: 100%; position: absolute;");
}
use of org.adempiere.webui.component.Row in project adempiere by adempiere.
the class WPAttributeDialog method addAttributeLine.
// initAttribute
/**
* Add Attribute Line
* @param attribute attribute
* @param product product level attribute
* @param readOnly value is read only
*/
private void addAttributeLine(Rows rows, MAttribute attribute, boolean product, boolean readOnly) {
log.fine(attribute + ", Product=" + product + ", R/O=" + readOnly);
m_row++;
Label label = new Label(attribute.getName());
if (product)
label.setStyle("font-weight: bold");
if (attribute.getDescription() != null)
label.setTooltiptext(attribute.getDescription());
Row row = rows.newRow();
row.appendChild(label.rightAlign());
//
MAttributeInstance instance = attribute.getMAttributeInstance(m_M_AttributeSetInstance_ID);
if (MAttribute.ATTRIBUTEVALUETYPE_List.equals(attribute.getAttributeValueType())) {
// optional = null
MAttributeValue[] values = attribute.getMAttributeValues();
Listbox editor = new Listbox();
editor.setMold("select");
for (MAttributeValue value : values) {
ListItem item = new ListItem(value != null ? value.getName() : "", value);
editor.appendChild(item);
}
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");
row.appendChild(editor);
if (readOnly)
editor.setEnabled(false);
else
m_editors.add(editor);
} else if (MAttribute.ATTRIBUTEVALUETYPE_Number.equals(attribute.getAttributeValueType())) {
NumberBox editor = new NumberBox(false);
if (instance != null)
editor.setValue(instance.getValueNumber());
else
editor.setValue(Env.ZERO);
row.appendChild(editor);
if (readOnly)
editor.setEnabled(false);
else
m_editors.add(editor);
} else // Text Field
{
Textbox editor = new Textbox();
if (instance != null)
editor.setText(instance.getValue());
row.appendChild(editor);
if (readOnly)
editor.setEnabled(false);
else
m_editors.add(editor);
}
}
use of org.adempiere.webui.component.Row in project adempiere by adempiere.
the class WPAttributeDialog method initAttributes.
// init
/**
* Dyanmic Init.
* @return true if initialized
*/
private boolean initAttributes() {
Rows rows = new Rows();
rows.setParent(centerLayout);
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) {
FDialog.error(m_WindowNo, this, "PAttributeNoAttributeSet");
return false;
}
// always read/write. The two are exclusive and can't co-exists.
if (// Set Instance Attributes and dialog controls
!m_productWindow || !m_productASI) {
if (// Instance attributes possible. Set up controls.
!m_productASI) {
Row row = new Row();
// New/Edit - Selection
if (// new
m_M_AttributeSetInstance_ID == 0)
cbNewEdit.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "NewRecord")));
else
cbNewEdit.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "EditRecord")));
cbNewEdit.addEventListener(Events.ON_CHECK, this);
row.appendChild(cbNewEdit);
bSelect.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "SelectExisting")));
bSelect.setImage(ServletFns.resolveThemeURL("~./images/PAttribute16.png"));
bSelect.addEventListener(Events.ON_CLICK, this);
row.appendChild(bSelect);
rows.appendChild(row);
}
// Add the Instance Attributes if any. If its a product attribute set
// this will do nothing.
// True = Instances
MAttribute[] attributes = as.getMAttributes(true);
log.fine("Instance Attributes=" + attributes.length);
for (int i = 0; i < attributes.length; i++) addAttributeLine(rows, attributes[i], false, false);
}
// 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 = products
MAttribute[] attributes = as.getMAttributes(false);
log.fine("Product Attributes=" + attributes.length);
for (int i = 0; i < attributes.length; i++) addAttributeLine(rows, attributes[i], true, !m_productWindow);
// Lot
if ((!m_productWindow || !m_productASI) && as.isLot()) {
Row row = new Row();
row.setParent(rows);
m_row++;
Label label = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "Lot")));
row.appendChild(label);
row.appendChild(fieldLotString);
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 Listbox();
fieldLot.setMold("select");
KeyNamePair[] keyNamePairs = DB.getKeyNamePairs(sql, true);
for (KeyNamePair pair : keyNamePairs) {
fieldLot.appendItem(pair.getName(), pair.getKey());
}
label = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "M_Lot_ID")));
row = new Row();
row.setParent(rows);
m_row++;
row.appendChild(label);
row.appendChild(fieldLot);
if (m_masi.getM_Lot_ID() != 0) {
for (int i = 1; i < fieldLot.getItemCount(); i++) {
ListItem pp = fieldLot.getItemAtIndex(i);
if ((Integer) pp.getValue() == m_masi.getM_Lot_ID()) {
fieldLot.setSelectedIndex(i);
fieldLotString.setReadonly(true);
break;
}
}
}
fieldLot.addEventListener(Events.ON_SELECT, this);
// New Lot Button
if (m_masi.getMAttributeSet().getM_LotCtl_ID() != 0) {
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))) {
row = new Row();
row.setParent(rows);
m_row++;
row.appendChild(bLot);
bLot.addEventListener(Events.ON_CLICK, this);
}
}
// Popup
// fieldLot.addMouseListener(new VPAttributeDialog_mouseAdapter(this)); // popup
mZoom = new Menuitem(Msg.getMsg(Env.getCtx(), "Zoom"), ServletFns.resolveThemeURL("~./images/Zoom16.png"));
mZoom.addEventListener(Events.ON_CLICK, this);
popupMenu.appendChild(mZoom);
this.appendChild(popupMenu);
}
// SerNo
if ((!m_productWindow || !m_productASI) && as.isSerNo()) {
Row row = new Row();
row.setParent(rows);
m_row++;
Label label = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "SerNo")));
row.appendChild(label);
row.appendChild(fieldSerNo);
fieldSerNo.setText(m_masi.getSerNo());
// New SerNo Button
if (m_masi.getMAttributeSet().getM_SerNoCtl_ID() != 0) {
if (MRole.getDefault().isTableAccess(MSerNoCtl.Table_ID, false) && !m_masi.isExcludeSerNo(m_AD_Column_ID, Env.isSOTrx(Env.getCtx(), m_WindowNoParent))) {
row = new Row();
row.setParent(rows);
m_row++;
row.appendChild(bSerNo);
bSerNo.addEventListener(Events.ON_CLICK, this);
}
}
}
// GuaranteeDate
if ((!m_productWindow || !m_productASI) && as.isGuaranteeDate()) {
Row row = new Row();
row.setParent(rows);
m_row++;
Label label = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "GuaranteeDate")));
if (m_M_AttributeSetInstance_ID == 0)
fieldGuaranteeDate.setValue(m_masi.getGuaranteeDate(true));
else
fieldGuaranteeDate.setValue(m_masi.getGuaranteeDate());
row.appendChild(label);
row.appendChild(fieldGuaranteeDate);
}
if (m_row == 0) {
FDialog.error(m_WindowNo, this, "PAttributeNoInfo");
return false;
}
// New/Edit Window
if (!m_productWindow) {
cbNewEdit.setChecked(m_M_AttributeSetInstance_ID == 0);
cmd_newEdit();
}
// Attrribute Set Instance Description
Label label = new Label(Util.cleanAmp(Msg.translate(Env.getCtx(), "Description")));
// label.setLabelFor(fieldDescription);
fieldDescription.setText(m_masi.getDescription());
fieldDescription.setReadonly(true);
Row row = new Row();
row.setParent(rows);
row.appendChild(label);
row.appendChild(fieldDescription);
return true;
}
use of org.adempiere.webui.component.Row in project adempiere by adempiere.
the class WAssignmentDialog method init.
/**
* Static Init
* @throws Exception
*/
private void init() throws Exception {
fResource.setMold("select");
fResource.addEventListener(Events.ON_SELECT, this);
delete.addEventListener(Events.ON_CLICK, this);
confirmPanel.addComponentsLeft(delete);
confirmPanel.addActionListener(Events.ON_CLICK, this);
//
this.appendChild(mainPanel);
mainPanel.makeNoStrip();
mainPanel.setStyle("background-color: transparent");
Rows rows = new Rows();
mainPanel.appendChild(rows);
Row row = new Row();
row.appendChild(ThemeUtils.makeRightAlign(lResource));
row.appendChild(fResource);
row.appendChild(new Label(" "));
rows.appendChild(row);
row = new Row();
row.setSpans("1, 2");
row.appendChild(ThemeUtils.makeRightAlign(lDate));
Div div = new Div();
div.appendChild(fDateFrom);
div.appendChild(fTimeFrom);
fTimeFrom.setStyle("margin-left: 1px");
row.appendChild(div);
rows.appendChild(row);
row = new Row();
row.appendChild(ThemeUtils.makeRightAlign(lQty));
row.appendChild(fQty);
row.appendChild(lUOM);
rows.appendChild(row);
row = new Row();
row.setSpans("1, 2");
row.appendChild(ThemeUtils.makeRightAlign(lName));
row.appendChild(fName);
fName.setStyle("width: 100%");
rows.appendChild(row);
row = new Row();
row.setSpans("1, 2");
row.appendChild(ThemeUtils.makeRightAlign(lDescription));
row.appendChild(fDescription);
fDescription.setMultiline(true);
fDescription.setRows(3);
fDescription.setStyle("width: 100%");
rows.appendChild(row);
row = new Row();
row.setSpans("3");
row.appendChild(new Label(" "));
rows.appendChild(row);
row = new Row();
row.setSpans("3");
row.appendChild(confirmPanel);
rows.appendChild(row);
//
}
use of org.adempiere.webui.component.Row in project adempiere by adempiere.
the class WAccountDialog method addLine.
// initAccount
/**
* Add Editor to parameterPanel alernative right/left depending on m_newRow.
* Field Value changes update Editors
* @param field field
* @param editor editor
* @param mandatory mandatory
*/
private void addLine(GridField field, WEditor editor, boolean mandatory) {
log.fine("Field=" + field);
Label label = editor.getLabel();
editor.setReadWrite(true);
editor.setMandatory(mandatory);
// MField => VEditor
field.addPropertyChangeListener(editor);
// label
if (m_newRow) {
m_row = new Row();
m_row.setStyle("background-color: transparent");
m_rows.appendChild(m_row);
}
// else
// m_gbc.gridx = 2;
Div div = new Div();
div.setStyle("text-align: right");
div.appendChild(label);
m_row.appendChild(div);
m_row.appendChild(editor.getComponent());
editor.dynamicDisplay();
//
m_newRow = !m_newRow;
}
Aggregations