use of javax.servlet.jsp.JspWriter in project adempiere by adempiere.
the class CheckOutLinkTag method doStartTag.
// setOneLine
/**
* Start Tag
* @return SKIP_BODY
* @throws JspException
*/
public int doStartTag() throws JspException {
HttpSession session = pageContext.getSession();
HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
WebBasket wb = (WebBasket) session.getAttribute(WebBasket.NAME);
// log.fine("WebBasket=" + wb);
if (wb != null && wb.getLineCount() > 0) {
log.fine("WebBasket exists");
//
JspWriter out = pageContext.getOut();
HtmlCode html = new HtmlCode();
//
if (!m_oneLine)
html.addElement(new hr("90%", "left"));
//
img img = new img("basket.gif");
img.setBorder(0);
a a = new a("basket.jsp");
a.setClass("menuMain");
if (m_oneLine) {
a.addElement(img);
a.addElement("Basket");
html.addElement(a);
html.addElement(" - ");
} else {
a.addElement("Basket");
a.addElement(img);
html.addElement(a);
// List Content
p p = new p();
p.setClass("Cbasket");
ArrayList<WebBasketLine> lines = wb.getLines();
for (int i = 0; i < lines.size(); i++) {
p.addElement("<br>");
Object line = lines.get(i);
p.addElement(line.toString());
}
p.addElement("<br><br>");
html.addElement(p);
// html.addElement(new br());
}
//
img = new img("checkout.gif");
img.setBorder(0);
String url = CheckOutServlet.NAME;
if (!request.isSecure())
url = "./" + CheckOutServlet.NAME;
a = new a(url);
a.setClass("menuMain");
a.addElement("Create Order");
a.addElement(img);
html.addElement(a);
//
html.output(out);
}
// web basket
return (SKIP_BODY);
}
use of javax.servlet.jsp.JspWriter in project adempiere by adempiere.
the class LocationTag method doStartTag.
/**
* Start Tag
* @return SKIP_BODY
* @throws JspException
*/
public int doStartTag() throws JspException {
Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
MLocation loc = new MLocation(ctx, 0, null);
HtmlCode html = new HtmlCode();
int C_Country_ID = getCountryID(loc);
int C_Region_ID = getRegionID(loc);
option[] countries = getCountries(loc, C_Country_ID);
// if (m_country != null) m_country.DisplaySequence;
String name = null;
label lbl = null;
input field = null;
select sel = null;
// City ***********************************************************
name = "City";
String city = (String) ExpressionUtil.evalNotNull("location", "city", m_city_el, String.class, this, pageContext);
lbl = new label();
lbl.setFor(name);
lbl.setID("LBL_" + name);
lbl.addElement(Msg.translate(ctx, name));
html.addElement(lbl);
field = new input(input.TYPE_TEXT, name, city);
field.setSize(40).setMaxlength(60).setID("ID_" + name);
field.setClass(C_MANDATORY);
html.addElement(field);
html.addElement(new br());
// Postal ***********************************************************
name = "Postal";
String postal = (String) ExpressionUtil.evalNotNull("location", "postal", m_postal_el, String.class, this, pageContext);
lbl = new label();
lbl.setFor(name);
lbl.setID("LBL_" + name);
lbl.addElement(Msg.translate(ctx, name));
html.addElement(lbl);
field = new input(input.TYPE_TEXT, name, postal);
field.setSize(10).setMaxlength(10).setID("ID_" + name);
field.setClass(C_MANDATORY);
html.addElement(field);
html.addElement(new br());
// Region *******************************************************
name = "C_Region_ID";
lbl = new label();
lbl.setFor(name);
lbl.setID("LBL_" + name);
String regionName = (String) ExpressionUtil.evalNotNull("location", "regionName", m_regionName_el, String.class, this, pageContext);
field = new input(input.TYPE_TEXT, "RegionName", regionName);
field.setSize(40).setMaxlength(60).setID("ID_RegionName");
if (m_country != null && m_country.isHasRegion()) {
sel = new select(name, getRegions(loc, C_Country_ID, C_Region_ID));
sel.setID("ID_" + name);
lbl.addElement(m_country.getRegionName());
html.addElement(lbl);
html.addElement(sel);
html.addElement(new span(" - "));
html.addElement(field);
} else {
lbl.addElement(Msg.translate(ctx, name));
html.addElement(lbl);
html.addElement(field);
}
html.addElement(new br());
// Country *******************************************************
name = "C_Country_ID";
lbl = new label();
lbl.setFor(name);
lbl.setID("LBL_" + name);
lbl.addElement(Msg.translate(ctx, name));
html.addElement(lbl);
sel = new select(name, countries);
sel.setID("ID_" + name);
sel.setClass(C_MANDATORY);
sel.setOnChange("changeCountry('ID_" + name + "');");
html.addElement(sel);
html.addElement(new br());
log.fine("C_Country_ID=" + C_Country_ID + ", C_Region_ID=" + C_Region_ID + ", RegionName=" + regionName + ", City=" + city + ", Postal=" + postal);
JspWriter out = pageContext.getOut();
html.output(out);
//
return (SKIP_BODY);
}
use of javax.servlet.jsp.JspWriter in project adempiere by adempiere.
the class LoginLinkTag method doStartTag.
/**
* Start Tag
* @return SKIP_BODY
* @throws JspException
*/
public int doStartTag() throws JspException {
Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
//
WebUser wu = getWebUser(ctx);
if (wu == null)
pageContext.getSession().removeAttribute(WebUser.NAME);
else
pageContext.getSession().setAttribute(WebUser.NAME, wu);
//
String serverContext = ctx.getProperty(WebSessionCtx.CTX_SERVER_CONTEXT);
// log.fine("doStartTag - ServerContext=" + serverContext);
HtmlCode html = null;
if (wu != null && wu.isValid())
html = getWelcomeLink(serverContext, wu);
else
html = getLoginLink(serverContext);
//
JspWriter out = pageContext.getOut();
/**
// Delete Cookie Call
if (cookieUser != null && !cookieUser.equals(" "))
{
log.fine("- Cookie=" + cookieUser);
html.addElement(" ");
a a = new a("loginServlet?mode=deleteCookie");
a.setClass("menuDetail");
a.addElement("(Delete Cookie)");
html.addElement(a);
}
**/
html.output(out);
//
return (SKIP_BODY);
}
use of javax.servlet.jsp.JspWriter in project adempiere by adempiere.
the class ProductCategoryListTag method doStartTag.
/**
* Start Tag
* @return SKIP_BODY
* @throws JspException
*/
public int doStartTag() throws JspException {
Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
int AD_Client_ID = Env.getAD_Client_ID(ctx);
String name = "M_Product_Category_ID";
option[] options = getCategories(AD_Client_ID);
select sel = new select(name, options);
sel.setID("ID_" + name);
log.fine("AD_Client_ID=" + AD_Client_ID + ", #=" + options.length);
// Assemble
HtmlCode html = new HtmlCode();
html.addElement(sel);
JspWriter out = pageContext.getOut();
html.output(out);
//
return (SKIP_BODY);
}
use of javax.servlet.jsp.JspWriter in project adempiere by adempiere.
the class WorkflowTag method doStartTag.
// setActivityID
/**
* Start Tag
* @return SKIP_BODY
* @throws JspException
*/
public int doStartTag() throws JspException {
Properties ctx = JSPEnv.getCtx((HttpServletRequest) pageContext.getRequest());
// Activity
int AD_WF_Activity_ID = 0;
String info = null;
try {
info = (String) ExpressionUtil.evalNotNull("workflow", "activityID", m_activityID_el, String.class, this, pageContext);
if (info != null && info.length() != 0)
AD_WF_Activity_ID = Integer.parseInt(info);
} catch (Exception e) {
log.severe("doStartTag - Activity" + e);
}
MWFActivity act = new MWFActivity(ctx, AD_WF_Activity_ID, null);
if (AD_WF_Activity_ID == 0 || act == null || act.get_ID() != AD_WF_Activity_ID) {
log.severe("doStartTag - Activity Not found - " + m_activityID_el + " (" + info + ")");
return (SKIP_BODY);
}
String name = null;
if (act.isUserApproval())
name = "IsApproved";
else if (act.isUserManual())
name = "IsConfirmed";
else
return (SKIP_BODY);
// YesNo
option[] yesNoOptions = new option[3];
yesNoOptions[0] = new option(" ");
yesNoOptions[0].addElement(" ");
yesNoOptions[0].setSelected(true);
yesNoOptions[1] = new option("Y");
yesNoOptions[1].addElement(Util.maskHTML(Msg.translate(ctx, "Yes")));
yesNoOptions[2] = new option("N");
yesNoOptions[2].addElement(Util.maskHTML(Msg.translate(ctx, "No")));
select yesNoSelect = new select(name, yesNoOptions);
yesNoSelect.setID("ID_" + name);
yesNoSelect.setClass(C_MANDATORY);
//
String nameTrl = Msg.translate(ctx, name);
// Assemble
HtmlCode html = new HtmlCode();
html.addElement(new b(nameTrl));
html.addElement(yesNoSelect);
html.addElement(new br());
JspWriter out = pageContext.getOut();
html.output(out);
//
return (SKIP_BODY);
}
Aggregations