viernes, 11 de julio de 2014
External Frame Class in ADempiere
package org.adempiere.bseni;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.panel.ADForm;
import org.compiere.apps.form.VSQLProcess;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Iframe;
public class WExternalFrame extends ADForm implements EventListener
{
private static final long serialVersionUID = -2038792517003449189L;
private static CLogger log = CLogger.getCLogger(VSQLProcess.class);
/** Grid used to layout components. */
private Grid m_grdMain = new Grid();
/** SQL label. */
private Label m_lblSql = new Label("SQL");
/** SQL statement field. */
private Textbox m_txbSqlField = new Textbox();
/** Process button. */
private Button m_btnSql = createProcessButton();
/** Field to hold result of SQL statement execution. */
private Textbox m_txbResultField = new Textbox();
/**
* Default constructor.
*/
public WExternalFrame()
{
super();
}
@Override
protected void initForm()
{
Iframe iframe = new Iframe("http://www.postgresql.org/docs/8.0/interactive/tutorial.html");
iframe.setWidth("100%");
iframe.setHeight("100%");
this.appendChild(iframe);
return;
}
/**
* Create Process Button.
* @return button
*/
public static final Button createProcessButton()
{
Button btnProcess = new Button();
btnProcess.setImage("/images/Process24.png");
btnProcess.setName(Msg.getMsg(Env.getCtx(), "Process"));
return btnProcess;
} // createProcessButton
/**
* Process a semicolon delimitted list of SQL Statements.
*
* @param sqlStatements one or more statements separated by a semicolon (';')
* @param allowDML whether to allow DML statements
* @return a string summarising the results
*/
public static String processStatements (String sqlStatements, boolean allowDML)
{
return VSQLProcess.processStatements(sqlStatements, allowDML);
}
/**
* Process SQL Statements.
*
* @param sqlStatement a single SQL statement
* @param allowDML whether to allow DML statements
* @return a string summarising the results
*/
public static String processStatement (String sqlStatement, boolean allowDML)
{
return VSQLProcess.processStatement(sqlStatement, allowDML);
}
/*
* (non-Javadoc)
* @see org.adempiere.webui.panel.ADForm#onEvent(org.zkoss.zk.ui.event.Event)
*/
public void onEvent(Event event) throws Exception
{
m_txbResultField.setText(processStatements (m_txbSqlField.getText(), false));
}
}
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario