use of org.adempiere.model.MViewDefinition in project adempiere by adempiere.
the class ViewElementHandler method create.
public void create(Properties ctx, TransformerHandler document) throws SAXException {
int AD_View_ID = Env.getContextAsInt(ctx, "AD_View_ID");
PackOut packOut = (PackOut) ctx.get("PackOutProcess");
X_AD_View m_View = new X_AD_View(ctx, AD_View_ID, null);
AttributesImpl atts = new AttributesImpl();
createViewBinding(atts, m_View);
document.startElement("", "", "view", atts);
// Tab Tag
StringBuilder whereClause = new StringBuilder(I_AD_View.COLUMNNAME_AD_View_ID).append("=?");
List<MViewDefinition> viewDefinitions = new Query(ctx, I_AD_View_Definition.Table_Name, whereClause.toString(), getTrxName(ctx)).setParameters(m_View.getAD_View_ID()).setOrderBy(X_AD_View_Definition.COLUMNNAME_SeqNo + "," + X_AD_View_Definition.COLUMNNAME_AD_View_Definition_ID).list();
for (MViewDefinition vd : viewDefinitions) {
//Is not export table definition because maybe cause changes in tables
//So that of tables should are created before to import Browser
//packOut.createTable(vd.getAD_Table_ID(), document);
createViewDefinition(ctx, document, vd.getAD_View_Definition_ID());
}
// Loop tags.
document.endElement("", "", "view");
}
use of org.adempiere.model.MViewDefinition in project adempiere by adempiere.
the class VBrowser method cmd_Process.
/**
* Process Action
*/
private void cmd_Process() {
m_frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
m_ok = true;
// End Worker
if (m_worker != null) {
// worker continues, but it does not block UI
if (m_worker.isAlive())
m_worker.interrupt();
log.config("Worker alive=" + m_worker.isAlive());
}
m_worker = null;
saveResultSelection(detail);
saveSelection(detail);
// Is Process ok
boolean isOk = false;
// Valid Process, Selected Keys and process parameters
if (getAD_Process_ID() > 0 && getSelectedKeys() != null) {
processParameterPanel.getProcessInfo().setAD_PInstance_ID(-1);
// BR [ 249 ]
if (processParameterPanel.validateParameters() == null) {
// Save Parameters
if (processParameterPanel.saveParameters() == null) {
// Get Process Info
ProcessInfo pi = processParameterPanel.getProcessInfo();
// Set Selected Values
if (getFieldKey() != null && getFieldKey().get_ID() > 0) {
MViewDefinition viewDefinition = (MViewDefinition) getFieldKey().getAD_View_Column().getAD_View_Definition();
pi.setAliasForTableSelection(viewDefinition.getTableAlias());
pi.setTableSelectionId(viewDefinition.getAD_Table_ID());
}
pi.setSelectionValues(getSelectedValues());
//
setBrowseProcessInfo(pi);
// Execute Process
ProcessCtl worker = new ProcessCtl(this, getWindowNo(), pi, null);
//
String msg = Msg.getMsg(Env.getCtx(), "Processing");
// For Dialog
if (m_frame.isDialog()) {
m_waiting = new Waiting(m_frame.getCDialog(), msg, false, getBrowseProcessInfo().getEstSeconds());
} else {
m_waiting = new Waiting(m_frame.getCFrame(), msg, false, getBrowseProcessInfo().getEstSeconds());
}
// complete tasks in unlockUI /
worker.run();
m_waiting.doNotWait();
setStatusLine(pi.getSummary(), pi.isError());
// For Valid Ok
isOk = !pi.isError();
}
}
}
m_frame.setCursor(Cursor.getDefaultCursor());
// For when is ok the process
if (isOk) {
// Close
if (getParentWindowNo() > 0) {
dispose();
return;
}
// Else Reset
p_loadedOK = initBrowser();
collapsibleSearch.setCollapsed(false);
}
}
use of org.adempiere.model.MViewDefinition in project adempiere by adempiere.
the class ViewCopyFrom method doIt.
/**
* Copy view from other view
*
* @return result string
*/
@SuppressWarnings("unchecked")
protected String doIt() throws Exception {
MView viewFrom = new MView(getCtx(), p_AD_View_ID, get_TrxName());
MView viewTo = new MView(getCtx(), p_Record_ID, get_TrxName());
String name = viewTo.getName();
String value = viewTo.getValue();
viewTo.copyValues(viewFrom, viewTo);
viewTo.setName(name);
viewTo.setValue(value);
viewTo.saveEx();
for (MViewDefinition viewDefinitionFrom : viewFrom.getViewDefinitions()) {
MViewDefinition viewDefinitionTo = new MViewDefinition(getCtx(), 0, get_TrxName());
viewDefinitionTo.copyValues(viewDefinitionFrom, viewDefinitionTo);
viewDefinitionTo.setAD_View_ID(viewTo.getAD_View_ID());
viewDefinitionTo.saveEx();
for (MViewColumn viewColumnFrom : viewDefinitionFrom.getADViewColumns()) {
MViewColumn viewColumnTo = new MViewColumn(getCtx(), 0, get_TrxName());
viewColumnTo.copyValues(viewColumnFrom, viewColumnTo);
viewColumnTo.setAD_View_Definition_ID(viewDefinitionTo.getAD_View_Definition_ID());
viewColumnTo.saveEx();
}
}
return "@Ok@";
}
use of org.adempiere.model.MViewDefinition in project adempiere by adempiere.
the class WBrowser method cmd_Ok.
/**
* Ok Action
*/
private void cmd_Ok() {
log.config("OK=" + true);
m_ok = true;
saveResultSelection(detail);
saveSelection(detail);
// Is Process ok
boolean isOk = false;
// Valid Process, Selected Keys and process parameters
if (getAD_Process_ID() > 0 && getSelectedKeys() != null) {
parameterPanel.getProcessInfo().setAD_PInstance_ID(-1);
// FR [ 265 ]
if (parameterPanel.validateParameters() == null) {
// Save Parameters
if (parameterPanel.saveParameters() == null) {
// Get Process Info
ProcessInfo pi = parameterPanel.getProcessInfo();
if (getFieldKey() != null && getFieldKey().get_ID() > 0) {
MViewDefinition viewDefinition = (MViewDefinition) getFieldKey().getAD_View_Column().getAD_View_Definition();
pi.setAliasForTableSelection(viewDefinition.getTableAlias());
pi.setTableSelectionId(viewDefinition.getAD_Table_ID());
}
// Set Selected Values
pi.setSelectionValues(getSelectedValues());
//
setBrowseProcessInfo(pi);
// Execute Process
ProcessCtl worker = new ProcessCtl(this, pi.getWindowNo(), pi, null);
showBusyDialog();
worker.run();
hideBusyDialog();
setStatusLine(pi.getSummary(), pi.isError());
// For Valid Ok
isOk = !pi.isError();
}
}
}
// For when is ok the process
if (isOk) {
// Close
if (getParentWindowNo() > 0) {
// BR [ 394 ]
Env.clearWinContext(getWindowNo());
SessionManager.getAppDesktop().closeActiveWindow();
return;
}
// Else Reset
p_loadedOK = initBrowser();
collapsibleSeach.setOpen(true);
}
}
Aggregations