use of org.compiere.model.GridField in project adempiere by adempiere.
the class WAccount method doGet.
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
log.config("WAccount.doGet");
WebSessionCtx wsc = WebSessionCtx.get(request);
WWindowStatus ws = WWindowStatus.get(request);
if (wsc == null || ws == null) {
WebUtil.createTimeoutPage(request, response, this, null);
return;
}
String columnName = WebUtil.getParameter(request, "ColumnName");
GridField mField = ws.curTab.getField(columnName);
log.config(" ColumnName=" + columnName + ", MField=" + mField.toString());
if (mField == null || columnName == null || columnName.equals("")) {
WebUtil.createTimeoutPage(request, response, this, Msg.getMsg(wsc.ctx, "ParameterMissing"));
return;
}
String target = "opener.document.WForm." + columnName;
WebDoc doc = WebDoc.create(mField.getHeader());
body body = doc.getBody();
body.setOnBlur("self.focus();");
body.addElement(fillTable(ws, mField, target));
button reset = new button();
reset.addElement("Reset");
reset.setOnClick(target + "D.value='';" + target + "F.value='';window.close();");
button cancel = new button();
cancel.addElement("Cancel");
cancel.setOnClick("window.close();");
body.addElement(new p(AlignType.RIGHT).addElement(reset).addElement(" ").addElement(cancel));
WebUtil.createResponse(request, response, this, null, doc, true);
}
use of org.compiere.model.GridField in project adempiere by adempiere.
the class WFindAdv method createPageFind.
private form createPageFind(HttpServletRequest request, HttpServletResponse response, WWindowStatus ws) throws ServletException, IOException {
boolean hasValue = false;
boolean hasName = false;
boolean hasDocNo = false;
boolean hasDescription = false;
//Get Info from target Tab
int size = ws.curTab.getFieldCount();
for (int i = 0; i < size; i++) {
GridField mField = ws.curTab.getField(i);
String columnName = mField.getColumnName();
if (mField.isDisplayed()) {
if (columnName.equals("Value"))
hasValue = true;
else if (columnName.equals("Name"))
hasName = true;
else if (columnName.equals("DocumentNo"))
hasDocNo = true;
else if (columnName.equals("Description"))
hasDescription = true;
}
}
form myForm = new form("/adempiere/WWindow", form.METHOD_POST, form.ENC_DEFAULT);
myForm.setName("WForm");
myForm.setOnSubmit("this.target=window.opener.name");
myForm.addElement(createTabs("Find"));
table table = new table();
//table.setClass("centerTable");
tr line = null;
if (hasValue) {
line = new tr();
line.addElement(new td().addElement(new label().addElement(Msg.translate(ws.ctx, "Value"))).setAlign("right"));
line.addElement(new td().addElement(new input("text", "txtValue", "")));
table.addElement(line);
}
if (hasDocNo) {
line = new tr();
line.addElement(new td().addElement(new label().addElement(Msg.translate(ws.ctx, "DocumentNo"))).setAlign("right"));
line.addElement(new td().addElement(new input("text", "txtDocumentNo", "")));
table.addElement(line);
}
if (hasName) {
line = new tr();
line.addElement(new td().addElement(new label().addElement(Msg.translate(ws.ctx, "Name"))).setAlign("right"));
line.addElement(new td().addElement(new input("text", "txtName", "")));
table.addElement(line);
}
if (hasDescription) {
line = new tr();
line.addElement(new td().addElement(new label().addElement(Msg.translate(ws.ctx, "Description"))).setAlign("right"));
line.addElement(new td().addElement(new input("text", "txtDescription", "")));
table.addElement(line);
}
if (!hasDescription && !hasDocNo && !hasName && !hasValue) {
line = new tr();
line.addElement(new td().addElement(new h2("N/A!")));
table.addElement(line);
}
myForm.addElement(table);
myForm.addElement(new input("hidden", "txtSQL", "FIND"));
myForm.addElement(new br());
myForm.addElement(new input("hidden", "PCommand", "FindAdv"));
myForm.addElement(" ");
myForm.addElement(new input("Reset", "", " Reset").setClass("resetbtn"));
myForm.addElement(" ");
input cmd = new input("Submit", "", " Submit");
cmd.setClass("submitbtn");
myForm.addElement(cmd);
myForm.addElement(" ");
cmd = new input("button", "", " Close");
cmd.setClass("closebtn");
cmd.setOnClick("window.close()");
myForm.addElement(cmd);
return myForm;
}
use of org.compiere.model.GridField in project adempiere by adempiere.
the class BrowserRow method getValue.
/**
* BR[ 268 ]
* Get Value from a column name in a row
* @param p_Row
* @param p_ColumnName
* @return
*/
public Object getValue(int p_Row, String p_ColumnName) {
Integer columnIndex = columnNamesIndex.get(p_ColumnName);
// Valid Index
if (columnIndex == null)
return null;
// Get current Value
GridField gridField = getValue(p_Row, columnIndex);
if (gridField == null)
return null;
// Return value of GridField
return gridField.getValue();
}
use of org.compiere.model.GridField in project adempiere by adempiere.
the class DeleteSelectionController method getValue.
/**
* Get value from index
* @param index
* @return
*/
private String getValue(int index) {
StringBuffer displayValue = new StringBuffer();
if (keyColumnName.trim().length() == 0) {
ArrayList<String> parentColumnNames = currentTab.getParentColumnNames();
for (Iterator<String> iter = parentColumnNames.iterator(); iter.hasNext(); ) {
String columnName = iter.next();
GridField field = currentTab.getField(columnName);
if (field.isLookup()) {
Lookup lookup = field.getLookup();
if (lookup != null) {
displayValue = displayValue.append(lookup.getDisplay(currentTab.getValue(index, columnName))).append(" | ");
} else {
displayValue = displayValue.append(currentTab.getValue(index, columnName)).append(" | ");
}
} else {
displayValue = displayValue.append(currentTab.getValue(index, columnName)).append(" | ");
}
}
} else {
final int id = currentTab.getKeyID(index);
String value = DB.getSQLValueStringEx(null, sql, id);
if (value != null)
value = value.replace(" - ", " | ");
displayValue.append(value);
// Append ID
if (displayValue.length() == 0 || CLogMgt.isLevelFine()) {
if (displayValue.length() > 0)
displayValue.append(" | ");
displayValue.append("<").append(id).append(">");
}
}
// Return
return displayValue.toString();
}
use of org.compiere.model.GridField in project adempiere by adempiere.
the class SmallViewController method createEditors.
/**
* Create editors for each field/fieldTo. The function calls the View to create
* the appropriate editor for the field.
*
* TODO The GridFields are Model level entities and the view should not have to
* deal with the Model. An intermediate factory could be used to create Controller
* level editors common to all interfaces. The View would then only have to implement
* the actual editor. There is a CEditor interface used but an abstract class would be
* better.
*/
private void createEditors() {
for (int i = 0; i < fields.size(); i++) {
// Get Values
GridField field = (GridField) fields.get(i);
GridField field_To = (GridField) fieldsTo.get(i);
createEditors(field, field_To);
}
}
Aggregations