Merge revision 6246 from branches/adempiere341
This commit is contained in:
parent
34c5801c80
commit
fc34e54d53
|
@ -734,10 +734,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
|
|||
pd.setPage(page);
|
||||
pd.setClosable(true);
|
||||
pd.setWidth("500px");
|
||||
try {
|
||||
pd.doModal();
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
pd.doHighlighted();
|
||||
}
|
||||
}
|
||||
else if(menu.getAction().equals(MMenu.ACTION_Form))
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.webui;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.adempiere.webui.session.ServerContext;
|
||||
|
@ -23,7 +24,7 @@ import net.sf.cglib.proxy.InvocationHandler;
|
|||
* @author Low Heng Sin
|
||||
*
|
||||
*/
|
||||
public class ServerContextCallback implements InvocationHandler {
|
||||
public class ServerContextCallback implements InvocationHandler, Serializable {
|
||||
|
||||
public Object invoke(Object proxy, Method method, Object[] args)
|
||||
throws Throwable {
|
||||
|
|
|
@ -28,6 +28,9 @@ import java.sql.SQLException;
|
|||
import java.util.Enumeration;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
|
@ -44,6 +47,9 @@ import org.compiere.util.CLogger;
|
|||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Ini;
|
||||
import org.zkoss.web.servlet.Servlets;
|
||||
import org.zkoss.zk.ui.Execution;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
|
||||
/**
|
||||
* Windows Application Environment and utilities
|
||||
|
@ -691,4 +697,22 @@ public final class AEnv
|
|||
}
|
||||
return uri;
|
||||
} // getImageIcon
|
||||
|
||||
/**
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static boolean isFirefox2() {
|
||||
Execution execution = Executions.getCurrent();
|
||||
if (execution == null)
|
||||
return false;
|
||||
|
||||
Object n = execution.getNativeRequest();
|
||||
if (n instanceof ServletRequest) {
|
||||
String userAgent = Servlets.getUserAgent((ServletRequest) n);
|
||||
return userAgent.indexOf("Firefox/2") >= 0;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} // AEnv
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
package org.adempiere.webui.apps;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -11,13 +16,17 @@ import org.adempiere.webui.component.Panel;
|
|||
import org.adempiere.webui.component.VerticalBox;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.adempiere.webui.window.SimplePDFViewer;
|
||||
import org.compiere.apps.ProcessCtl;
|
||||
import org.compiere.print.ReportEngine;
|
||||
import org.compiere.process.ProcessInfo;
|
||||
import org.compiere.process.ProcessInfoUtil;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.au.out.AuEcho;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.DesktopUnavailableException;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
|
@ -29,6 +38,13 @@ import org.zkoss.zul.Div;
|
|||
import org.zkoss.zul.Hbox;
|
||||
import org.zkoss.zul.Html;
|
||||
|
||||
import com.lowagie.text.Document;
|
||||
import com.lowagie.text.pdf.PdfContentByte;
|
||||
import com.lowagie.text.pdf.PdfCopy;
|
||||
import com.lowagie.text.pdf.PdfImportedPage;
|
||||
import com.lowagie.text.pdf.PdfReader;
|
||||
import com.lowagie.text.pdf.PdfWriter;
|
||||
|
||||
/******************************************************************************
|
||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||
* Copyright (C) 2007 Low Heng Sin *
|
||||
|
@ -334,8 +350,8 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
|||
m_isLocked = false;
|
||||
if (Executions.getCurrent() != null)
|
||||
{
|
||||
updateUI(pi);
|
||||
Clients.showBusy(null, false);
|
||||
updateUI(pi);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -366,17 +382,20 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
|||
message.setContent(m_messageText.toString());
|
||||
//message.setCaretPosition(message.getDocument().getLength()); // scroll down
|
||||
m_ids = pi.getIDs();
|
||||
//
|
||||
bOK.setEnabled(true);
|
||||
|
||||
//no longer needed, hide to give more space to display log
|
||||
centerPanel.detach();
|
||||
invalidate();
|
||||
|
||||
Clients.response(new AuEcho(this, "onAfterProcess", null));
|
||||
}
|
||||
|
||||
public void onAfterProcess()
|
||||
{
|
||||
//
|
||||
afterProcessTask();
|
||||
// Close automatically
|
||||
if (m_IsReport && !pi.isError())
|
||||
if (m_IsReport && !m_pi.isError())
|
||||
this.dispose();
|
||||
|
||||
// If the process is a silent one and no errors occured, close the dialog
|
||||
|
@ -407,62 +426,138 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
|||
*/
|
||||
private void printShipments()
|
||||
{
|
||||
/*
|
||||
if (m_ids == null)
|
||||
return;
|
||||
if (!ADialog.ask(m_WindowNo, this, "PrintShipments"))
|
||||
if (!FDialog.ask(m_WindowNo, this, "PrintShipments"))
|
||||
return;
|
||||
|
||||
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("</p>");
|
||||
message.setText(m_messageText.toString());
|
||||
int retValue = ADialogDialog.A_CANCEL;
|
||||
do
|
||||
message.setContent(m_messageText.toString());
|
||||
Clients.showBusy("Processing...", true);
|
||||
Clients.response(new AuEcho(this, "onPrintShipments", null));
|
||||
} // printInvoices
|
||||
|
||||
public void onPrintShipments()
|
||||
{
|
||||
// Loop through all items
|
||||
List<File> pdfList = new ArrayList<File>();
|
||||
for (int i = 0; i < m_ids.length; i++)
|
||||
{
|
||||
int M_InOut_ID = m_ids[i];
|
||||
ReportCtl.startDocumentPrint(ReportEngine.SHIPMENT, M_InOut_ID, this, Env.getWindowNo(this), true);
|
||||
ReportEngine re = ReportEngine.get (Env.getCtx(), ReportEngine.SHIPMENT, M_InOut_ID);
|
||||
pdfList.add(re.getPDF());
|
||||
}
|
||||
|
||||
if (pdfList.size() > 1) {
|
||||
try {
|
||||
File outFile = File.createTempFile("PrintShipments", ".pdf");
|
||||
Document document = null;
|
||||
PdfWriter copy = null;
|
||||
for (File f : pdfList)
|
||||
{
|
||||
String fileName = f.getAbsolutePath();
|
||||
PdfReader reader = new PdfReader(fileName);
|
||||
reader.consolidateNamedDestinations();
|
||||
if (document == null)
|
||||
{
|
||||
document = new Document(reader.getPageSizeWithRotation(1));
|
||||
copy = PdfWriter.getInstance(document, new FileOutputStream(outFile));
|
||||
document.open();
|
||||
}
|
||||
int pages = reader.getNumberOfPages();
|
||||
PdfContentByte cb = copy.getDirectContent();
|
||||
for (int i = 1; i <= pages; i++) {
|
||||
document.newPage();
|
||||
PdfImportedPage page = copy.getImportedPage(reader, i);
|
||||
cb.addTemplate(page, 0, 0);
|
||||
}
|
||||
}
|
||||
document.close();
|
||||
|
||||
Clients.showBusy(null, false);
|
||||
Window win = new SimplePDFViewer(this.getTitle(), new FileInputStream(outFile));
|
||||
SessionManager.getAppDesktop().showWindow(win, "center");
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
}
|
||||
} else if (pdfList.size() > 0) {
|
||||
Clients.showBusy(null, false);
|
||||
try {
|
||||
Window win = new SimplePDFViewer(this.getTitle(), new FileInputStream(pdfList.get(0)));
|
||||
SessionManager.getAppDesktop().showWindow(win, "center");
|
||||
} catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
ADialogDialog d = new ADialogDialog (this,
|
||||
Env.getHeader(Env.getCtx(), m_WindowNo),
|
||||
Msg.getMsg(Env.getCtx(), "PrintoutOK?"),
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
retValue = d.getReturnCode();
|
||||
}
|
||||
while (retValue == ADialogDialog.A_CANCEL);
|
||||
*/
|
||||
} // printInvoices
|
||||
|
||||
/**
|
||||
* Print Invoices
|
||||
*/
|
||||
private void printInvoices()
|
||||
{
|
||||
/*
|
||||
if (m_ids == null)
|
||||
return;
|
||||
if (!ADialog.ask(m_WindowNo, this, "PrintInvoices"))
|
||||
if (!FDialog.ask(m_WindowNo, this, "PrintInvoices"))
|
||||
return;
|
||||
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("</p>");
|
||||
message.setText(m_messageText.toString());
|
||||
int retValue = ADialogDialog.A_CANCEL;
|
||||
do
|
||||
message.setContent(m_messageText.toString());
|
||||
Clients.showBusy("Processing...", true);
|
||||
Clients.response(new AuEcho(this, "onPrintInvoices", null));
|
||||
} // printInvoices
|
||||
|
||||
public void onPrintInvoices()
|
||||
{
|
||||
// Loop through all items
|
||||
List<File> pdfList = new ArrayList<File>();
|
||||
for (int i = 0; i < m_ids.length; i++)
|
||||
{
|
||||
int AD_Invoice_ID = m_ids[i];
|
||||
ReportCtl.startDocumentPrint(ReportEngine.INVOICE, AD_Invoice_ID, this, Env.getWindowNo(this), true);
|
||||
int C_Invoice_ID = m_ids[i];
|
||||
ReportEngine re = ReportEngine.get (Env.getCtx(), ReportEngine.INVOICE, C_Invoice_ID);
|
||||
pdfList.add(re.getPDF());
|
||||
}
|
||||
|
||||
if (pdfList.size() > 1) {
|
||||
try {
|
||||
File outFile = File.createTempFile("PrintInvoices", ".pdf");
|
||||
Document document = null;
|
||||
PdfWriter copy = null;
|
||||
for (File f : pdfList)
|
||||
{
|
||||
PdfReader reader = new PdfReader(f.getAbsolutePath());
|
||||
if (document == null)
|
||||
{
|
||||
document = new Document(reader.getPageSizeWithRotation(1));
|
||||
copy = PdfWriter.getInstance(document, new FileOutputStream(outFile));
|
||||
document.open();
|
||||
}
|
||||
PdfContentByte cb = copy.getDirectContent(); // Holds the PDF
|
||||
int pages = reader.getNumberOfPages();
|
||||
for (int i = 1; i <= pages; i++) {
|
||||
document.newPage();
|
||||
PdfImportedPage page = copy.getImportedPage(reader, i);
|
||||
cb.addTemplate(page, 0, 0);
|
||||
}
|
||||
}
|
||||
document.close();
|
||||
|
||||
Clients.showBusy(null, false);
|
||||
Window win = new SimplePDFViewer(this.getTitle(), new FileInputStream(outFile));
|
||||
SessionManager.getAppDesktop().showWindow(win, "center");
|
||||
} catch (Exception e) {
|
||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
}
|
||||
} else if (pdfList.size() > 0) {
|
||||
try {
|
||||
Window win = new SimplePDFViewer(this.getTitle(), new FileInputStream(pdfList.get(0)));
|
||||
SessionManager.getAppDesktop().showWindow(win, "center");
|
||||
} catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
ADialogDialog d = new ADialogDialog (this,
|
||||
Env.getHeader(Env.getCtx(), m_WindowNo),
|
||||
Msg.getMsg(Env.getCtx(), "PrintoutOK?"),
|
||||
JOptionPane.QUESTION_MESSAGE);
|
||||
retValue = d.getReturnCode();
|
||||
}
|
||||
while (retValue == ADialogDialog.A_CANCEL);
|
||||
*/
|
||||
} // printInvoices
|
||||
|
||||
public boolean isValid() {
|
||||
return valid;
|
||||
|
|
|
@ -34,7 +34,6 @@ import org.adempiere.webui.component.Row;
|
|||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Textbox;
|
||||
import org.adempiere.webui.component.WListbox;
|
||||
import org.adempiere.webui.component.WStatusBar;
|
||||
import org.adempiere.webui.editor.WDateEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
|
@ -43,6 +42,7 @@ import org.adempiere.webui.event.ValueChangeListener;
|
|||
import org.adempiere.webui.event.WTableModelEvent;
|
||||
import org.adempiere.webui.event.WTableModelListener;
|
||||
import org.adempiere.webui.panel.ADForm;
|
||||
import org.adempiere.webui.panel.StatusBarPanel;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.process.*;
|
||||
|
@ -85,7 +85,6 @@ public class WAllocation extends ADForm
|
|||
calculate();
|
||||
southPanel.appendChild(new Separator());
|
||||
southPanel.appendChild(statusBar);
|
||||
statusBar.setWidth("100%");
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
|
@ -140,7 +139,7 @@ public class WAllocation extends ADForm
|
|||
private WTableDirEditor currencyPick = null;
|
||||
private Checkbox multiCurrency = new Checkbox();
|
||||
private Label allocCurrencyLabel = new Label();
|
||||
private WStatusBar statusBar = new WStatusBar();
|
||||
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||
private Label dateLabel = new Label();
|
||||
private WDateEditor dateField = new WDateEditor();
|
||||
private Checkbox autoWriteOff = new Checkbox();
|
||||
|
|
|
@ -36,7 +36,6 @@ import org.adempiere.webui.component.Row;
|
|||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.WAppsAction;
|
||||
import org.adempiere.webui.component.WListbox;
|
||||
import org.adempiere.webui.component.WStatusBar;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WLocatorEditor;
|
||||
|
@ -44,6 +43,7 @@ import org.adempiere.webui.editor.WSearchEditor;
|
|||
import org.adempiere.webui.editor.WStringEditor;
|
||||
import org.adempiere.webui.event.WTableModelEvent;
|
||||
import org.adempiere.webui.event.WTableModelListener;
|
||||
import org.adempiere.webui.panel.StatusBarPanel;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
|
@ -177,7 +177,7 @@ public abstract class WCreateFrom extends Window
|
|||
private Panel southPanel = new Panel();
|
||||
// private Borderlayout southLayout = new Borderlayout();
|
||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||
private WStatusBar statusBar = new WStatusBar();
|
||||
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||
protected WListbox dataTable = ListboxFactory.newDataTable();
|
||||
protected Label locatorLabel = new Label();
|
||||
protected WLocatorEditor locatorField = new WLocatorEditor();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -14,78 +14,55 @@
|
|||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* 2007, Modified by Posterita Ltd.
|
||||
*/
|
||||
|
||||
package org.adempiere.webui.apps.form;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.*;
|
||||
import java.util.logging.*;
|
||||
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.GridFactory;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.panel.ADForm;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.model.MBPartner;
|
||||
import org.compiere.model.MInvoice;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MPayment;
|
||||
import org.compiere.model.X_M_Cost;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
import org.zkoss.zk.au.out.AuEcho;
|
||||
import org.zkoss.zk.ui.Desktop;
|
||||
import org.zkoss.zk.ui.DesktopUnavailableException;
|
||||
import org.zkoss.zk.ui.Executions;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.util.Clients;
|
||||
import org.zkoss.zkex.zul.Borderlayout;
|
||||
import org.zkoss.zkex.zul.Center;
|
||||
import org.zkoss.zkex.zul.South;
|
||||
|
||||
/**
|
||||
* Merge Entities : Based on VMerge
|
||||
* Merge Dialog.
|
||||
* Restriction - fails for Accounting
|
||||
*
|
||||
* @author Niraj Sohun
|
||||
* @date Jul 28, 2007
|
||||
* @author Jorg Janke
|
||||
* @version $Id: VMerge.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
|
||||
*/
|
||||
|
||||
public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
||||
public class WMerge extends ADForm
|
||||
implements EventListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private static CLogger log = CLogger.getCLogger(WInvoiceGen.class);
|
||||
|
||||
private Grid grdAll;
|
||||
private Rows rows;
|
||||
private Row row;
|
||||
|
||||
/** Confirmation panel containing Ok and Cancel button. */
|
||||
private ConfirmPanel m_pnlConfirm;
|
||||
|
||||
private WEditor[] from = new WEditor[4];
|
||||
private WEditor[] to = new WEditor[4];
|
||||
|
||||
private int[] fromIDs = new int[4];
|
||||
private int[] toIDs = new int[4];
|
||||
|
||||
private int[] AD_Column_ID = new int[] {2163, 2762, 971, 2221};
|
||||
private String[] text = new String[] {"AD_Org_ID", "C_BPartner_ID", "AD_User_ID", "M_Product_ID"};
|
||||
|
||||
private int m_totalCount;
|
||||
|
||||
private StringBuffer m_errorLog;
|
||||
|
||||
private Trx m_trx;
|
||||
private int m_totalCount = 0;
|
||||
/** Error Log */
|
||||
private StringBuffer m_errorLog = new StringBuffer();
|
||||
/** Connection */
|
||||
//private Connection m_con = null;
|
||||
private Trx m_trx = null;
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(WMerge.class);
|
||||
|
||||
static private String AD_ORG_ID = "AD_Org_ID";
|
||||
static private String C_BPARTNER_ID = "C_BPartner_ID";
|
||||
|
@ -93,192 +70,282 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
|||
static private String M_PRODUCT_ID = "M_Product_ID";
|
||||
|
||||
/** Tables to delete (not update) for AD_Org */
|
||||
static private String[] s_delete_Org = new String[] {"AD_OrgInfo"};
|
||||
|
||||
static private String[] s_delete_Org = new String[]
|
||||
{"AD_OrgInfo"};
|
||||
/** Tables to delete (not update) for AD_User */
|
||||
static private String[] s_delete_User = new String[] {"AD_User_Roles"};
|
||||
|
||||
static private String[] s_delete_User = new String[]
|
||||
{"AD_User_Roles"};
|
||||
/** Tables to delete (not update) for C_BPartner */
|
||||
static private String[] s_delete_BPartner = new String[] {"C_BP_Employee_Acct",
|
||||
"C_BP_Vendor_Acct", "C_BP_Customer_Acct", "T_Aging"};
|
||||
|
||||
static private String[] s_delete_BPartner = new String[]
|
||||
{"C_BP_Employee_Acct", "C_BP_Vendor_Acct", "C_BP_Customer_Acct",
|
||||
"T_Aging"};
|
||||
/** Tables to delete (not update) for M_Product */
|
||||
static private String[] s_delete_Product = new String[] {"M_Product_PO", "M_Replenish", "T_Replenish",
|
||||
static private String[] s_delete_Product = new String[]
|
||||
{"M_Product_PO", "M_Replenish", "T_Replenish",
|
||||
"M_ProductPrice", "M_Product_Costing",
|
||||
"M_Cost", // teo_sarca [ 1704554 ]
|
||||
"M_Product_Trl", "M_Product_Acct"}; // M_Storage
|
||||
|
||||
private String[] m_columnName = new String[]{"AD_Org_ID", "C_BPartner_ID", "AD_User_ID", "M_Product_ID"};
|
||||
private String[] m_columnName = null;
|
||||
private Label[] m_label = null;
|
||||
private WEditor[] m_from = null;
|
||||
private WEditor[] m_to = null;
|
||||
private String[] m_deleteTables = null;
|
||||
|
||||
public WMerge()
|
||||
{
|
||||
}
|
||||
|
||||
private Borderlayout mainLayout = new Borderlayout();
|
||||
private Panel CenterPanel = new Panel();
|
||||
private Grid centerLayout = GridFactory.newGridLayout();
|
||||
private Label mergeFromLabel = new Label();
|
||||
private Label mergeToLabel = new Label();
|
||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||
private String m_msg;
|
||||
private boolean m_success;
|
||||
|
||||
/**
|
||||
* Initialize Panel
|
||||
*/
|
||||
protected void initForm()
|
||||
{
|
||||
grdAll = new Grid();
|
||||
grdAll.setWidth("700px");
|
||||
log.info( "VMerge.init - WinNo=" + m_WindowNo);
|
||||
try
|
||||
{
|
||||
preInit();
|
||||
jbInit ();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.log(Level.SEVERE, "", ex);
|
||||
}
|
||||
} // init
|
||||
|
||||
/*btnCancel = new Button();
|
||||
btnCancel.setImage("/images/Cancel24.png");
|
||||
btnCancel.addEventListener(Events.ON_CLICK, this);
|
||||
/**
|
||||
* Pre Init
|
||||
*/
|
||||
private void preInit()
|
||||
{
|
||||
int count = 4; // ** Update **
|
||||
m_columnName = new String[count];
|
||||
m_label = new Label[count];
|
||||
m_from = new WEditor[count];
|
||||
m_to = new WEditor[count];
|
||||
|
||||
btnOk = new Button();
|
||||
btnOk.setImage("/images/Ok24.png");
|
||||
btnOk.addEventListener(Events.ON_CLICK, this);*/
|
||||
// ** Update **
|
||||
preInit (0, 2163, DisplayType.TableDir, AD_ORG_ID); // C_Order.AD_Org_ID
|
||||
preInit (1, 2762, DisplayType.Search, C_BPARTNER_ID); // C_Order.C_BPartner_ID
|
||||
preInit (2, 971, DisplayType.Search, AD_USER_ID); // AD_User_Roles.AD_User_ID
|
||||
preInit (3, 2221, DisplayType.Search, M_PRODUCT_ID); // C_OrderLine.M_Product_ID
|
||||
} // preInit
|
||||
|
||||
m_pnlConfirm = new ConfirmPanel(true);
|
||||
m_pnlConfirm.addActionListener(this);
|
||||
|
||||
initComponents();
|
||||
/**
|
||||
* Pre Init Line
|
||||
* @param index index
|
||||
* @param AD_Column_ID id
|
||||
* @param displayType display type
|
||||
* @param ColumnName column name
|
||||
*/
|
||||
private void preInit (int index, int AD_Column_ID, int displayType, String ColumnName)
|
||||
{
|
||||
m_columnName[index] = ColumnName;
|
||||
String what = Msg.translate(Env.getCtx(), ColumnName);
|
||||
m_label[index] = new Label(what);
|
||||
Lookup lookup = MLookupFactory.get (Env.getCtx(), m_WindowNo, 0, AD_Column_ID, displayType);
|
||||
if (displayType == DisplayType.Search)
|
||||
{
|
||||
m_from[index] = new WSearchEditor(ColumnName, false, false, true, lookup);
|
||||
m_to[index] = new WSearchEditor (ColumnName, false, false, true, lookup);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_from[index] = new WTableDirEditor(ColumnName, false, false, true, lookup);
|
||||
m_to[index] = new WTableDirEditor (ColumnName, false, false, true, lookup);
|
||||
}
|
||||
|
||||
public void initComponents()
|
||||
} // preInit
|
||||
|
||||
/**
|
||||
* Static init
|
||||
* @throws java.lang.Exception
|
||||
*/
|
||||
void jbInit () throws Exception
|
||||
{
|
||||
this.setWidth("710px");
|
||||
this.setBorder("normal");
|
||||
this.appendChild (mainLayout);
|
||||
mainLayout.setHeight("100%");
|
||||
mainLayout.setWidth("100%");
|
||||
//
|
||||
South south = new South();
|
||||
mainLayout.appendChild(south);
|
||||
south.appendChild(confirmPanel);
|
||||
confirmPanel.addActionListener(this);
|
||||
//
|
||||
Rows rows = centerLayout.newRows();
|
||||
|
||||
components();
|
||||
//
|
||||
CenterPanel.appendChild(centerLayout);
|
||||
|
||||
rows = new Rows();
|
||||
Center center = new Center();
|
||||
mainLayout.appendChild(center);
|
||||
center.appendChild(CenterPanel);
|
||||
|
||||
// Row 1
|
||||
row = new Row();
|
||||
row.appendChild(new Label(""));
|
||||
row.appendChild(new Label("Merge From (Deleted)"));
|
||||
row.appendChild(new Label("Merge To (Surviving)"));
|
||||
rows.appendChild(row);
|
||||
|
||||
for (int i = 0; i < 4; i++)
|
||||
Row row = rows.newRow();
|
||||
row.appendChild(new Label());
|
||||
row.appendChild(mergeFromLabel);
|
||||
row.appendChild(mergeToLabel);
|
||||
//
|
||||
mergeFromLabel.setText (Msg.getMsg(Env.getCtx(), "MergeFrom"));
|
||||
mergeFromLabel.setStyle("font-weight: bold");
|
||||
mergeToLabel.setText (Msg.getMsg(Env.getCtx(), "MergeTo"));
|
||||
mergeToLabel.setStyle("font-weight: bold");
|
||||
//
|
||||
for (int i = 0; i < m_label.length; i++)
|
||||
{
|
||||
row = new Row();
|
||||
row.appendChild(from[i].getLabel());
|
||||
row.appendChild(from[i].getComponent());
|
||||
row.appendChild(to[i].getComponent());
|
||||
rows.appendChild(row);
|
||||
row = rows.newRow();
|
||||
row.appendChild(m_label[i]);
|
||||
row.appendChild(m_from[i].getComponent());
|
||||
row.appendChild(m_to[i].getComponent());
|
||||
}
|
||||
} // jbInit
|
||||
|
||||
grdAll.appendChild(rows);
|
||||
this.appendChild(grdAll);
|
||||
|
||||
// Row 6
|
||||
this.appendChild(m_pnlConfirm);
|
||||
}
|
||||
|
||||
private void components()
|
||||
/**
|
||||
* Dispose
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
MLookup lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo,
|
||||
0, AD_Column_ID[0], DisplayType.TableDir);
|
||||
SessionManager.getAppDesktop().removeWindow();
|
||||
} // dispose
|
||||
|
||||
from[0] = new WTableDirEditor(lookup, Msg.translate(
|
||||
Env.getCtx(), text[0]), "from", true, false, true);
|
||||
|
||||
from[0].addValueChangeListener(this);
|
||||
|
||||
to[0] = new WTableDirEditor(lookup, Msg.translate(
|
||||
Env.getCtx(), text[0]), "to", true, false, true);
|
||||
|
||||
to[0].addValueChangeListener(this);
|
||||
|
||||
|
||||
// Search Editors
|
||||
|
||||
for (int i = 1; i < AD_Column_ID.length; i++)
|
||||
/**
|
||||
* Action Listener
|
||||
* @param e event
|
||||
*/
|
||||
public void onEvent (Event e)
|
||||
{
|
||||
lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo,
|
||||
0, AD_Column_ID[i], DisplayType.Search);
|
||||
|
||||
from[i] = new WSearchEditor(lookup, Msg.translate(
|
||||
Env.getCtx(), text[i]), "from", true, false, true);
|
||||
|
||||
from[i].addValueChangeListener(this);
|
||||
|
||||
to[i] = new WSearchEditor(lookup, Msg.translate(
|
||||
Env.getCtx(), text[i]), "to", true, false, true);
|
||||
|
||||
to[i].addValueChangeListener(this);
|
||||
}
|
||||
}
|
||||
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
{
|
||||
if (evt == null)
|
||||
if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
|
||||
{
|
||||
dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
WEditor edit = (WEditor)evt.getSource();
|
||||
String des = edit.getDescription();
|
||||
|
||||
String name = evt.getPropertyName();
|
||||
Object value = evt.getNewValue();
|
||||
|
||||
|
||||
if (name.equals("AD_Org_ID"))
|
||||
//
|
||||
String columnName = null;
|
||||
String from_Info = null;
|
||||
String to_Info = null;
|
||||
int from_ID = 0;
|
||||
int to_ID = 0;
|
||||
// get first merge pair
|
||||
for (int i = 0; (i < m_columnName.length && from_ID == 0 && to_ID == 0); i++)
|
||||
{
|
||||
if (des.equals("from"))
|
||||
Object value = m_from[i].getValue();
|
||||
if (value != null)
|
||||
{
|
||||
from[0].setValue(value);
|
||||
fromIDs[0] = ((Integer)value).intValue();
|
||||
if (value instanceof Integer)
|
||||
from_ID = ((Integer)value).intValue();
|
||||
else
|
||||
continue;
|
||||
value = m_to[i].getValue();
|
||||
if (value != null && value instanceof Integer)
|
||||
to_ID = ((Integer)value).intValue();
|
||||
else
|
||||
from_ID = 0;
|
||||
if (from_ID != 0)
|
||||
{
|
||||
columnName = m_columnName[i];
|
||||
from_Info = m_from[i].getDisplay ();
|
||||
to_Info = m_to[i].getDisplay ();
|
||||
}
|
||||
}
|
||||
} // get first merge pair
|
||||
|
||||
if (from_ID == 0 || from_ID == to_ID)
|
||||
return;
|
||||
|
||||
m_msg = Msg.getMsg(Env.getCtx(), "MergeFrom") + " = " + from_Info
|
||||
+ "\n" + Msg.getMsg(Env.getCtx(), "MergeTo") + " = " + to_Info;
|
||||
if (!FDialog.ask(m_WindowNo, this, "MergeQuestion", m_msg))
|
||||
return;
|
||||
|
||||
// ** Update **
|
||||
if (columnName.equals(AD_ORG_ID))
|
||||
m_deleteTables = s_delete_Org;
|
||||
else if (columnName.equals(AD_USER_ID))
|
||||
m_deleteTables = s_delete_User;
|
||||
else if (columnName.equals(C_BPARTNER_ID))
|
||||
m_deleteTables = s_delete_BPartner;
|
||||
else if (columnName.equals(M_PRODUCT_ID))
|
||||
m_deleteTables = s_delete_Product;
|
||||
|
||||
Clients.showBusy("Processing...", true);
|
||||
|
||||
if (!getDesktop().isServerPushEnabled())
|
||||
getDesktop().enableServerPush(true);
|
||||
|
||||
MergeRunnable runnable = new MergeRunnable(columnName, from_ID, to_ID, this.getDesktop());
|
||||
new Thread(runnable).start();
|
||||
|
||||
} // actionPerformed
|
||||
|
||||
class MergeRunnable implements Runnable {
|
||||
private int to_ID;
|
||||
private int from_ID;
|
||||
private String columnName;
|
||||
private Desktop desktop;
|
||||
private MergeRunnable(String columnName, int from_ID, int to_ID, Desktop desktop) {
|
||||
this.columnName = columnName;
|
||||
this.from_ID = from_ID;
|
||||
this.to_ID = to_ID;
|
||||
this.desktop = desktop;
|
||||
}
|
||||
public void run() {
|
||||
//get full control of desktop
|
||||
try {
|
||||
Executions.activate(desktop);
|
||||
try {
|
||||
m_success = merge (columnName, from_ID, to_ID);
|
||||
postMerge(columnName, to_ID);
|
||||
} finally{
|
||||
Clients.showBusy(null, false);
|
||||
Clients.response(new AuEcho(WMerge.this, "onAfterProcess", null));
|
||||
//release full control of desktop
|
||||
Executions.deactivate(desktop);
|
||||
}
|
||||
} catch (DesktopUnavailableException e) {
|
||||
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||
} catch (InterruptedException e) {
|
||||
log.log(Level.WARNING, e.getLocalizedMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onAfterProcess()
|
||||
{
|
||||
if (m_success)
|
||||
{
|
||||
FDialog.info (m_WindowNo, this, "MergeSuccess",
|
||||
m_msg + " #" + m_totalCount);
|
||||
}
|
||||
else
|
||||
{
|
||||
to[0].setValue(value);
|
||||
toIDs[0] = ((Integer)value).intValue();
|
||||
FDialog.error(m_WindowNo, this, "MergeError",
|
||||
m_errorLog.toString());
|
||||
return;
|
||||
}
|
||||
dispose();
|
||||
}
|
||||
else if (name.equals("C_BPartner_ID"))
|
||||
{
|
||||
if (des.equals("from"))
|
||||
{
|
||||
from[1].setValue(value);
|
||||
fromIDs[1] = ((Integer)value).intValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
to[1].setValue(value);
|
||||
toIDs[1] = ((Integer)value).intValue();
|
||||
}
|
||||
}
|
||||
else if (name.equals("M_Product_ID"))
|
||||
{
|
||||
if (des.equals("from"))
|
||||
{
|
||||
from[3].setValue(value);
|
||||
fromIDs[3] = ((Integer)value).intValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
to[3].setValue(value);
|
||||
toIDs[3] = ((Integer)value).intValue();
|
||||
}
|
||||
}
|
||||
else if (name.equals("AD_User_ID"))
|
||||
{
|
||||
if (des.equals("from"))
|
||||
{
|
||||
from[2].setValue(value);
|
||||
fromIDs[2] = ((Integer)value).intValue();
|
||||
}
|
||||
else
|
||||
{
|
||||
to[2].setValue(value);
|
||||
toIDs[2] = ((Integer)value).intValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Merge.
|
||||
* @param ColumnName column
|
||||
* @param from_ID from
|
||||
* @param to_ID to
|
||||
* @return true if merged
|
||||
*/
|
||||
private boolean merge (String ColumnName, int from_ID, int to_ID)
|
||||
{
|
||||
String TableName = ColumnName.substring(0, ColumnName.length()-3);
|
||||
|
||||
//log.config(ColumnName + " - From=" + from_ID + ",To=" + to_ID);
|
||||
log.config(ColumnName
|
||||
+ " - From=" + from_ID + ",To=" + to_ID);
|
||||
|
||||
boolean success = true;
|
||||
m_totalCount = 0;
|
||||
m_errorLog = new StringBuffer();
|
||||
|
||||
String sql = "SELECT t.TableName, c.ColumnName "
|
||||
+ "FROM AD_Table t"
|
||||
+ " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) "
|
||||
|
@ -293,28 +360,24 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
|||
+ "WHERE cc.IsKey='Y' AND cc.ColumnName=?)" // #2
|
||||
+ ") "
|
||||
+ "ORDER BY t.LoadSeq DESC";
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
m_trx = Trx.get(Trx.createTrxName("merge"), true);
|
||||
|
||||
//
|
||||
pstmt = DB.prepareStatement(sql, Trx.createTrxName());
|
||||
pstmt.setString(1, ColumnName);
|
||||
pstmt.setString(2, ColumnName);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
String tName = rs.getString(1);
|
||||
String cName = rs.getString(2);
|
||||
|
||||
if (!TableName.equals(tName)) // to be sure - sql should prevent it
|
||||
{
|
||||
int count = mergeTable (tName, cName, from_ID, to_ID);
|
||||
|
||||
if (count < 0)
|
||||
success = false;
|
||||
else
|
||||
|
@ -324,24 +387,28 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
|||
rs.close();
|
||||
pstmt.close();
|
||||
pstmt = null;
|
||||
|
||||
//log.config("Success=" + success + " - " + ColumnName + " - From=" + from_ID + ",To=" + to_ID);
|
||||
|
||||
//
|
||||
log.config("Success=" + success
|
||||
+ " - " + ColumnName + " - From=" + from_ID + ",To=" + to_ID);
|
||||
if (success)
|
||||
{
|
||||
sql = "DELETE " + TableName + " WHERE " + ColumnName + "=" + from_ID;
|
||||
|
||||
|
||||
|
||||
|
||||
if ( DB.executeUpdate(sql, m_trx.getTrxName()) < 0 )
|
||||
{
|
||||
m_errorLog.append(Env.NL).append("DELETE ").append(TableName).append(" - ");
|
||||
m_errorLog.append(Env.NL).append("DELETE ").append(TableName)
|
||||
.append(" - ");
|
||||
success = false;
|
||||
//log.config(m_errorLog.toString());
|
||||
log.config(m_errorLog.toString());
|
||||
m_trx.rollback();
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
if (success)
|
||||
m_trx.commit();
|
||||
else
|
||||
|
@ -352,22 +419,22 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// log.log(Level.SEVERE, ColumnName, ex);
|
||||
log.log(Level.SEVERE, ColumnName, ex);
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
try
|
||||
{
|
||||
if (pstmt != null)
|
||||
pstmt.close();
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
}
|
||||
|
||||
pstmt = null;
|
||||
return success;
|
||||
}
|
||||
} // merge
|
||||
|
||||
|
||||
/**
|
||||
* Merge Table
|
||||
|
@ -377,17 +444,13 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
|||
* @param to_ID to
|
||||
* @return -1 for error or number of changes
|
||||
*/
|
||||
|
||||
private int mergeTable (String TableName, String ColumnName, int from_ID, int to_ID)
|
||||
{
|
||||
// log.fine(TableName + "." + ColumnName + " - From=" + from_ID + ",To=" + to_ID);
|
||||
|
||||
log.fine(TableName + "." + ColumnName + " - From=" + from_ID + ",To=" + to_ID);
|
||||
String sql = "UPDATE " + TableName
|
||||
+ " SET " + ColumnName + "=" + to_ID
|
||||
+ " WHERE " + ColumnName + "=" + from_ID;
|
||||
|
||||
boolean delete = false;
|
||||
|
||||
for (int i = 0; i < m_deleteTables.length; i++)
|
||||
{
|
||||
if (m_deleteTables[i].equals(TableName))
|
||||
|
@ -396,7 +459,6 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
|||
sql = "DELETE " + TableName + " WHERE " + ColumnName + "=" + from_ID;
|
||||
}
|
||||
}
|
||||
|
||||
// Delete newly created MCost records - teo_sarca [ 1704554 ]
|
||||
if (delete && X_M_Cost.Table_Name.equals(TableName) && M_PRODUCT_ID.equals(ColumnName))
|
||||
{
|
||||
|
@ -411,23 +473,28 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
|||
|
||||
if ( count < 0 )
|
||||
{
|
||||
|
||||
count = -1;
|
||||
m_errorLog.append(Env.NL).append(delete ? "DELETE " : "UPDATE ").append(TableName).append(" - ").append(" - ").append(sql);
|
||||
//log.config(m_errorLog.toString());
|
||||
m_errorLog.append(Env.NL)
|
||||
.append(delete ? "DELETE " : "UPDATE ")
|
||||
.append(TableName).append(" - ")
|
||||
.append(" - ").append(sql);
|
||||
log.config(m_errorLog.toString());
|
||||
m_trx.rollback();
|
||||
|
||||
}
|
||||
//log.fine(count + (delete ? " -Delete- " : " -Update- ") + TableName);
|
||||
log.fine(count
|
||||
+ (delete ? " -Delete- " : " -Update- ") + TableName);
|
||||
|
||||
|
||||
return count;
|
||||
}
|
||||
} // mergeTable
|
||||
|
||||
/**
|
||||
* Post Merge
|
||||
* @param ColumnName column name
|
||||
* @param to_ID ID
|
||||
*/
|
||||
|
||||
private void postMerge (String ColumnName, int to_ID)
|
||||
{
|
||||
if (ColumnName.equals(AD_ORG_ID))
|
||||
|
@ -466,106 +533,7 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
|||
{
|
||||
|
||||
}
|
||||
}
|
||||
} // postMerge
|
||||
|
||||
private void process()
|
||||
{
|
||||
String columnName = null;
|
||||
String from_Info = null;
|
||||
String to_Info = null;
|
||||
int from_ID = 0;
|
||||
int to_ID = 0;
|
||||
|
||||
for (int i = 0; (i < m_columnName.length && from_ID == 0 && to_ID == 0); i++)
|
||||
{
|
||||
Object value;
|
||||
|
||||
value = from[i].getValue();
|
||||
|
||||
if (value != null)
|
||||
{
|
||||
if (value instanceof Integer)
|
||||
from_ID = ((Integer)value).intValue();
|
||||
else
|
||||
continue;
|
||||
|
||||
value = to[i].getValue();
|
||||
|
||||
if (value != null && value instanceof Integer)
|
||||
to_ID = ((Integer)value).intValue();
|
||||
else
|
||||
from_ID = 0;
|
||||
|
||||
if (from_ID != 0)
|
||||
{
|
||||
columnName = m_columnName[i];
|
||||
|
||||
from_Info = from[i].getDisplay ();
|
||||
to_Info = to[i].getDisplay ();
|
||||
}
|
||||
}
|
||||
} // get first merge pair
|
||||
|
||||
if (from_ID == 0 || from_ID == to_ID)
|
||||
return;
|
||||
|
||||
String msg = Msg.getMsg(Env.getCtx(), "MergeFrom") + " = " + from_Info
|
||||
+ "\n" + Msg.getMsg(Env.getCtx(), "MergeTo") + " = " + to_Info;
|
||||
|
||||
//if (!FDialog.ask(super.m_windowNo, this, msg))
|
||||
// return;
|
||||
|
||||
// ** Update **
|
||||
|
||||
if (columnName.equals(AD_ORG_ID))
|
||||
m_deleteTables = s_delete_Org;
|
||||
else if (columnName.equals(AD_USER_ID))
|
||||
m_deleteTables = s_delete_User;
|
||||
else if (columnName.equals(C_BPARTNER_ID))
|
||||
m_deleteTables = s_delete_BPartner;
|
||||
else if (columnName.equals(M_PRODUCT_ID))
|
||||
m_deleteTables = s_delete_Product;
|
||||
|
||||
//setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
|
||||
//confirmPanel.getOKButton().setEnabled(false);
|
||||
|
||||
boolean success = merge (columnName, from_ID, to_ID);
|
||||
postMerge(columnName, to_ID);
|
||||
|
||||
//confirmPanel.getOKButton().setEnabled(true);
|
||||
//setCursor(Cursor.getDefaultCursor());
|
||||
//
|
||||
|
||||
if (success)
|
||||
{
|
||||
FDialog.info (m_WindowNo, this, msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
FDialog.error(m_WindowNo, this, "MergeError", m_errorLog.toString());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* React to Ok and Cancel buttons being triggered.
|
||||
*
|
||||
* @param event the event to which to respond
|
||||
* @throws Exception if an exception occurred
|
||||
*/
|
||||
public void onEvent(Event event) throws Exception
|
||||
{
|
||||
if (event != null)
|
||||
{
|
||||
if (event.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
|
||||
{
|
||||
SessionManager.getAppDesktop().removeWindow();
|
||||
return;
|
||||
}
|
||||
else if (event.getTarget().getId().equals(ConfirmPanel.A_OK))
|
||||
{
|
||||
process();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // VMerge
|
||||
|
|
|
@ -14,128 +14,94 @@
|
|||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
* 2007, Modified by Posterita Ltd.
|
||||
*/
|
||||
|
||||
package org.adempiere.webui.apps.form;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Timestamp;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import java.sql.*;
|
||||
import java.util.*;
|
||||
import java.util.logging.*;
|
||||
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Column;
|
||||
import org.adempiere.webui.component.Columns;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.Datebox;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
import org.adempiere.webui.component.GridFactory;
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.adempiere.webui.component.Panel;
|
||||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.VerticalBox;
|
||||
import org.adempiere.webui.component.WStatusBar;
|
||||
import org.adempiere.webui.editor.WEditor;
|
||||
import org.adempiere.webui.editor.WDateEditor;
|
||||
import org.adempiere.webui.editor.WLocatorEditor;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.editor.WTableDirEditor;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.panel.ADForm;
|
||||
import org.compiere.model.GridField;
|
||||
import org.compiere.model.GridTab;
|
||||
import org.compiere.model.GridTable;
|
||||
import org.compiere.model.GridWindow;
|
||||
import org.compiere.model.GridWindowVO;
|
||||
import org.compiere.model.MLocatorLookup;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
import org.compiere.model.MQuery;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.DisplayType;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.compiere.util.NamePair;
|
||||
import org.adempiere.webui.panel.ADTabpanel;
|
||||
import org.adempiere.webui.panel.StatusBarPanel;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.compiere.model.*;
|
||||
import org.compiere.util.*;
|
||||
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.Hbox;
|
||||
import org.zkoss.zkex.zul.Borderlayout;
|
||||
import org.zkoss.zkex.zul.Center;
|
||||
import org.zkoss.zkex.zul.North;
|
||||
import org.zkoss.zkex.zul.South;
|
||||
import org.zkoss.zul.Separator;
|
||||
|
||||
public class WTrxMaterial extends ADForm implements EventListener, ValueChangeListener
|
||||
/**
|
||||
* Material Transaction History
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @version $Id: VTrxMaterial.java,v 1.3 2006/07/30 00:51:28 jjanke Exp $
|
||||
*/
|
||||
public class WTrxMaterial extends ADForm
|
||||
implements EventListener, ValueChangeListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** FormFrame */
|
||||
//private FormFrame m_frame;
|
||||
|
||||
/** GridController */
|
||||
private Grid m_gridController = new Grid();
|
||||
private Columns columns = new Columns();
|
||||
private Rows rows = new Rows();
|
||||
|
||||
private ADTabpanel m_gridController = null;
|
||||
/** MWindow */
|
||||
private GridWindow m_mWindow = null;
|
||||
|
||||
/** MTab pointer */
|
||||
private GridTab m_mTab = null;
|
||||
|
||||
private MQuery m_staticQuery = null;
|
||||
|
||||
/** Logger */
|
||||
private static CLogger log = CLogger.getCLogger(WTrxMaterial.class);
|
||||
|
||||
private VerticalBox mainPanel = new VerticalBox();
|
||||
private Hbox parameterPanel = new Hbox();
|
||||
//
|
||||
private Panel mainPanel = new Panel();
|
||||
private Borderlayout mainLayout = new Borderlayout();
|
||||
private Panel parameterPanel = new Panel();
|
||||
private Label orgLabel = new Label();
|
||||
private WEditor orgField;
|
||||
private WTableDirEditor orgField;
|
||||
private Label locatorLabel = new Label();
|
||||
private WLocatorEditor locatorField;
|
||||
private Label productLabel = new Label();
|
||||
private WEditor productField;
|
||||
private WSearchEditor productField;
|
||||
private Label dateFLabel = new Label();
|
||||
private Datebox dateFField;
|
||||
private WDateEditor dateFField;
|
||||
private Label dateTLabel = new Label();
|
||||
private Datebox dateTField;
|
||||
private WDateEditor dateTField;
|
||||
private Label mtypeLabel = new Label();
|
||||
private WEditor mtypeField;
|
||||
private WTableDirEditor mtypeField;
|
||||
private Grid parameterLayout = GridFactory.newGridLayout();
|
||||
private Panel southPanel = new Panel();
|
||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true, true, false, false, false, true);
|
||||
private WStatusBar statusBar = new WStatusBar();
|
||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true, true, false, false, false, true, false);
|
||||
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||
|
||||
public WTrxMaterial()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize Panel
|
||||
* @param WindowNo window
|
||||
* @param frame frame
|
||||
*/
|
||||
|
||||
protected void initForm()
|
||||
{
|
||||
log.info("");
|
||||
|
||||
try
|
||||
{
|
||||
dynParameter();
|
||||
jbInit();
|
||||
zkInit();
|
||||
dynInit();
|
||||
|
||||
this.appendChild(mainPanel);
|
||||
this.appendChild(statusBar);
|
||||
}
|
||||
catch(Exception ex)
|
||||
{
|
||||
|
@ -147,129 +113,81 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
|||
* Static Init
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
void jbInit() throws Exception
|
||||
void zkInit() throws Exception
|
||||
{
|
||||
orgLabel.setValue(Msg.translate(Env.getCtx(), "AD_Org_ID"));
|
||||
locatorLabel.setValue(Msg.translate(Env.getCtx(), "M_Locator_ID"));
|
||||
productLabel.setValue(Msg.translate(Env.getCtx(), "Product"));
|
||||
dateFLabel.setValue(Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
dateTLabel.setValue(Msg.translate(Env.getCtx(), "DateTo"));
|
||||
mtypeLabel.setValue(Msg.translate(Env.getCtx(), "MovementType"));
|
||||
this.appendChild(mainPanel);
|
||||
mainPanel.setStyle("width: 99%; height: 100%; border: none; padding: 0; margin: 0");
|
||||
mainPanel.appendChild(mainLayout);
|
||||
mainLayout.setWidth("100%");
|
||||
mainLayout.setHeight("100%");
|
||||
parameterPanel.appendChild(parameterLayout);
|
||||
//
|
||||
orgLabel.setText(Msg.translate(Env.getCtx(), "AD_Org_ID"));
|
||||
locatorLabel.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
|
||||
productLabel.setText(Msg.translate(Env.getCtx(), "Product"));
|
||||
dateFLabel.setText(Msg.translate(Env.getCtx(), "DateFrom"));
|
||||
dateTLabel.setText(Msg.translate(Env.getCtx(), "DateTo"));
|
||||
mtypeLabel.setText(Msg.translate(Env.getCtx(), "MovementType"));
|
||||
//
|
||||
North north = new North();
|
||||
mainLayout.appendChild(north);
|
||||
north.appendChild(parameterPanel);
|
||||
|
||||
m_gridController.setWidth("900px");
|
||||
m_gridController.setHeight("550px");
|
||||
|
||||
mainPanel.setWidth("100%");
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(parameterPanel);
|
||||
mainPanel.appendChild(new Separator());
|
||||
mainPanel.appendChild(m_gridController);
|
||||
mainPanel.appendChild(new Separator());
|
||||
|
||||
Hbox boxOrg = new Hbox();
|
||||
boxOrg.setWidth("100%");
|
||||
boxOrg.setWidth("35%, 75%");
|
||||
boxOrg.appendChild(orgLabel);
|
||||
boxOrg.appendChild(orgField.getComponent());
|
||||
|
||||
Hbox boxMType = new Hbox();
|
||||
boxMType.setWidth("100%");
|
||||
boxMType.setWidth("35%, 75%");
|
||||
boxMType.appendChild(mtypeLabel);
|
||||
boxMType.appendChild(mtypeField.getComponent());
|
||||
|
||||
Hbox boxDateF = new Hbox();
|
||||
boxDateF.setWidth("100%");
|
||||
boxDateF.setWidth("35%, 75%");
|
||||
boxDateF.appendChild(dateFLabel);
|
||||
boxDateF.appendChild(dateFField);
|
||||
|
||||
Hbox boxLocator = new Hbox();
|
||||
boxLocator.setWidth("100%");
|
||||
boxLocator.setWidth("35%, 75%");
|
||||
boxLocator.appendChild(locatorLabel);
|
||||
boxLocator.appendChild(locatorField.getComponent());
|
||||
|
||||
Hbox boxProduct = new Hbox();
|
||||
boxProduct.setWidth("100%");
|
||||
boxProduct.setWidth("35%, 75%");
|
||||
boxProduct.appendChild(productLabel);
|
||||
boxProduct.appendChild(productField.getComponent());
|
||||
|
||||
Hbox boxDateT = new Hbox();
|
||||
boxDateT.setWidth("100%");
|
||||
boxDateT.setWidth("35%, 75%");
|
||||
boxDateT.appendChild(dateTLabel);
|
||||
boxDateT.appendChild(dateTField);
|
||||
|
||||
VerticalBox boxCol1 = new VerticalBox();
|
||||
boxCol1.setWidth("100%");
|
||||
boxCol1.appendChild(boxOrg);
|
||||
boxCol1.appendChild(boxLocator);
|
||||
|
||||
VerticalBox boxCol2 = new VerticalBox();
|
||||
boxCol2.setWidth("100%");
|
||||
boxCol2.appendChild(boxMType);
|
||||
boxCol2.appendChild(boxProduct);
|
||||
|
||||
VerticalBox boxCol3 = new VerticalBox();
|
||||
boxCol3.setWidth("100%");
|
||||
boxCol3.appendChild(boxDateF);
|
||||
boxCol3.appendChild(boxDateT);
|
||||
|
||||
parameterPanel.setWidth("100%");
|
||||
parameterPanel.setStyle("text-align:right");
|
||||
parameterPanel.appendChild(boxCol1);
|
||||
parameterPanel.appendChild(new Separator());
|
||||
parameterPanel.appendChild(boxCol2);
|
||||
parameterPanel.appendChild(new Separator());
|
||||
parameterPanel.appendChild(boxCol3);
|
||||
Rows rows = parameterLayout.newRows();
|
||||
Row row = rows.newRow();
|
||||
row.appendChild(orgLabel.rightAlign());
|
||||
row.appendChild(orgField.getComponent());
|
||||
row.appendChild(mtypeLabel.rightAlign());
|
||||
row.appendChild(mtypeField.getComponent());
|
||||
row.appendChild(dateFLabel.rightAlign());
|
||||
row.appendChild(dateFField.getComponent());
|
||||
|
||||
row = rows.newRow();
|
||||
row.appendChild(locatorLabel.rightAlign());
|
||||
row.appendChild(locatorField.getComponent());
|
||||
row.appendChild(productLabel.rightAlign());
|
||||
row.appendChild(productField.getComponent());
|
||||
row.appendChild(dateTLabel.rightAlign());
|
||||
row.appendChild(dateTField.getComponent());
|
||||
//
|
||||
southPanel.appendChild(confirmPanel);
|
||||
southPanel.appendChild(new Separator());
|
||||
southPanel.appendChild(statusBar);
|
||||
South south = new South();
|
||||
south.setStyle("border: none");
|
||||
mainLayout.appendChild(south);
|
||||
south.appendChild(southPanel);
|
||||
|
||||
mainPanel.appendChild(southPanel);
|
||||
|
||||
this.setWidth("100%");
|
||||
this.appendChild(mainPanel);
|
||||
}
|
||||
LayoutUtils.addSclass("status-border", statusBar);
|
||||
} // jbInit
|
||||
|
||||
/**
|
||||
* Initialize Parameter fields
|
||||
* @throws Exception if Lookups cannot be initialized
|
||||
*/
|
||||
|
||||
private void dynParameter() throws Exception
|
||||
{
|
||||
Properties ctx = Env.getCtx();
|
||||
// Organization
|
||||
|
||||
MLookup orgLookup = MLookupFactory.get (ctx, m_WindowNo, 0, 3660, DisplayType.TableDir);
|
||||
orgField = new WTableDirEditor(orgLookup, "AD_Org_ID", "", false, false, true);
|
||||
orgField.addValueChangeListener(this);
|
||||
|
||||
orgField = new WTableDirEditor("AD_Org_ID", false, false, true, orgLookup);
|
||||
// orgField.addVetoableChangeListener(this);
|
||||
// Locator
|
||||
MLocatorLookup locatorLookup = new MLocatorLookup(ctx, m_WindowNo);
|
||||
locatorField = new WLocatorEditor ("M_Locator_ID", false, false, true, locatorLookup, m_WindowNo);
|
||||
locatorField.addValueChangeListener(this);
|
||||
|
||||
// locatorField.addVetoableChangeListener(this);
|
||||
// Product
|
||||
MLookup productLookup = MLookupFactory.get (ctx, m_WindowNo, 0, 3668, DisplayType.Search);
|
||||
productField = new WSearchEditor(productLookup, "M_Product_ID", "", false, false, true);
|
||||
productField = new WSearchEditor("M_Product_ID", false, false, true, productLookup);
|
||||
productField.addValueChangeListener(this);
|
||||
|
||||
// Movement Type
|
||||
MLookup mtypeLookup = MLookupFactory.get (ctx, m_WindowNo, 0, 3666, DisplayType.List);
|
||||
mtypeField = new WTableDirEditor(mtypeLookup, "MovementType", "", false, false, true);
|
||||
mtypeField.addValueChangeListener(this);
|
||||
|
||||
mtypeField = new WTableDirEditor("MovementType", false, false, true, mtypeLookup);
|
||||
// Dates
|
||||
dateFField = new Datebox();//"DateFrom", false, false, true, DisplayType.Date, Msg.getMsg(Env.getCtx(), "DateFrom"));
|
||||
dateTField = new Datebox();//"DateTo", false, false, true, DisplayType.Date, Msg.getMsg(Env.getCtx(), "DateTo"));
|
||||
|
||||
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
||||
dateFField = new WDateEditor("DateFrom", false, false, true, DisplayType.Date, Msg.getMsg(Env.getCtx(), "DateFrom"));
|
||||
dateTField = new WDateEditor("DateTo", false, false, true, DisplayType.Date, Msg.getMsg(Env.getCtx(), "DateTo"));
|
||||
//
|
||||
confirmPanel.addActionListener(this);
|
||||
statusBar.setStatusLine("");
|
||||
} // dynParameter
|
||||
|
||||
|
@ -283,127 +201,33 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
|||
m_staticQuery.addRestriction("AD_Client_ID", MQuery.EQUAL, Env.getAD_Client_ID(Env.getCtx()));
|
||||
int AD_Window_ID = 223; // Hardcoded
|
||||
GridWindowVO wVO = AEnv.getMWindowVO (m_WindowNo, AD_Window_ID, 0);
|
||||
|
||||
if (wVO == null)
|
||||
return;
|
||||
|
||||
m_mWindow = new GridWindow (wVO);
|
||||
m_mTab = m_mWindow.getTab(0);
|
||||
m_mWindow.initTab(0);
|
||||
|
||||
populateGrid();
|
||||
|
||||
//m_gridController.initGrid(m_mTab, true, m_WindowNo, null, null);
|
||||
//mainPanel.add(m_gridController, BorderLayout.CENTER);
|
||||
|
||||
//
|
||||
m_gridController = new ADTabpanel();
|
||||
m_gridController.init(null, m_WindowNo, m_mTab, m_mWindow);
|
||||
m_gridController.switchRowPresentation();
|
||||
Center center = new Center();
|
||||
mainLayout.appendChild(center);
|
||||
center.setFlex(true);
|
||||
center.appendChild(m_gridController);
|
||||
//
|
||||
m_mTab.setQuery(MQuery.getEqualQuery("1", "2"));
|
||||
m_mTab.query(false);
|
||||
statusBar.setStatusLine(" ", false);
|
||||
statusBar.setStatusDB(" ");
|
||||
} // dynInit
|
||||
|
||||
private void populateGrid()
|
||||
{
|
||||
m_gridController.getChildren().clear();
|
||||
m_gridController.appendChild(columns);
|
||||
m_gridController.appendChild(rows);
|
||||
|
||||
columns.getChildren().clear();
|
||||
|
||||
Column column = new Column();
|
||||
|
||||
AbstractTableModel tableModel = m_mTab.getTableModel();
|
||||
GridField[] gridfields = ((GridTable)tableModel).getFields();
|
||||
|
||||
for (int i = 0; i < gridfields.length; i++)
|
||||
{
|
||||
if (gridfields[i].isDisplayed())
|
||||
{
|
||||
column = new Column(gridfields[i].getHeader());
|
||||
columns.appendChild(column);
|
||||
}
|
||||
}
|
||||
|
||||
rows.getChildren().clear();
|
||||
|
||||
for (int i = 0; i < tableModel.getRowCount(); i++)
|
||||
{
|
||||
Row row = new Row();
|
||||
|
||||
for (int j = 0; j < tableModel.getColumnCount(); j++)
|
||||
{
|
||||
Label lab = new Label();
|
||||
|
||||
Label label = new Label("");
|
||||
|
||||
if (!gridfields[j].isDisplayed())
|
||||
break;
|
||||
|
||||
Object obj = tableModel.getValueAt(i, j);
|
||||
|
||||
if (obj != null)
|
||||
{
|
||||
if (tableModel.getColumnClass(j).equals(String.class))
|
||||
{
|
||||
label.setValue(obj.toString());
|
||||
}
|
||||
else if (tableModel.getColumnClass(j).equals(BigDecimal.class))
|
||||
{
|
||||
label.setValue(obj.toString());
|
||||
}
|
||||
else if (tableModel.getColumnClass(j).equals(Integer.class))
|
||||
{
|
||||
if (gridfields[j].isLookup())
|
||||
{
|
||||
MLookup lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo,
|
||||
0, gridfields[j].getAD_Column_ID(), gridfields[j].getDisplayType());
|
||||
|
||||
NamePair namepair = lookup.get(obj);
|
||||
|
||||
if (namepair != null)
|
||||
label.setValue(namepair.getName());
|
||||
else
|
||||
label.setValue("");
|
||||
}
|
||||
}
|
||||
else if (tableModel.getColumnClass(j).equals(Timestamp.class))
|
||||
{
|
||||
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date);
|
||||
label.setValue(dateFormat.format((Timestamp)obj));
|
||||
}
|
||||
else
|
||||
label.setValue("Missing Class");
|
||||
}
|
||||
|
||||
lab = new Label(label.getValue());
|
||||
row.appendChild(lab);
|
||||
}
|
||||
rows.appendChild(row);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dispose
|
||||
*/
|
||||
public void dispose()
|
||||
{
|
||||
/*if (m_gridController != null)
|
||||
m_gridController.dispose();
|
||||
*/
|
||||
m_gridController = null;
|
||||
m_mTab = null;
|
||||
|
||||
if (m_mWindow != null)
|
||||
m_mWindow.dispose();
|
||||
|
||||
m_mWindow = null;
|
||||
|
||||
orgField = null;
|
||||
locatorField = null;
|
||||
productField = null;
|
||||
mtypeField = null;
|
||||
dateFField = null;
|
||||
dateTField = null;
|
||||
SessionManager.getAppDesktop().removeWindow();
|
||||
} // dispose
|
||||
|
||||
|
||||
|
@ -411,93 +235,61 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
|||
* Action Listener
|
||||
* @param e event
|
||||
*/
|
||||
|
||||
public void onEvent(Event event) throws Exception
|
||||
public void onEvent (Event e)
|
||||
{
|
||||
if (confirmPanel.getButton("Cancel").equals(event.getTarget()))
|
||||
if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
|
||||
dispose();
|
||||
else if (confirmPanel.getButton("Refresh").equals(event.getTarget())
|
||||
|| confirmPanel.getButton("Ok").equals(event.getTarget()))
|
||||
else if (e.getTarget().getId().equals(ConfirmPanel.A_REFRESH)
|
||||
|| e.getTarget().getId().equals(ConfirmPanel.A_OK))
|
||||
refresh();
|
||||
else if (confirmPanel.getButton("Zoom").equals(event.getTarget()))
|
||||
else if (e.getTarget().getId().equals(ConfirmPanel.A_ZOOM))
|
||||
zoom();
|
||||
} // actionPerformed
|
||||
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* Property Listener
|
||||
* @param e event
|
||||
*/
|
||||
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
public void valueChange (ValueChangeEvent e)
|
||||
{
|
||||
if (evt.getPropertyName().equals("M_Product_ID"))
|
||||
productField.setValue(evt.getNewValue());
|
||||
}
|
||||
if (e.getPropertyName().equals("M_Product_ID"))
|
||||
productField.setValue(e.getNewValue());
|
||||
} // vetoableChange
|
||||
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* Refresh - Create Query and refresh grid
|
||||
*/
|
||||
|
||||
private void refresh()
|
||||
{
|
||||
/**
|
||||
* Create Where Clause
|
||||
*/
|
||||
|
||||
MQuery query = m_staticQuery.deepCopy();
|
||||
|
||||
// Organization
|
||||
Object value = null;
|
||||
if (orgField.getDisplay() != "")
|
||||
value = orgField.getValue();
|
||||
Object value = orgField.getValue();
|
||||
if (value != null && value.toString().length() > 0)
|
||||
query.addRestriction("AD_Org_ID", MQuery.EQUAL, value);
|
||||
|
||||
// Locator
|
||||
value = null;
|
||||
if (locatorField.getDisplay() != "")
|
||||
value = locatorField.getValue();
|
||||
if (value != null && value.toString().length() > 0)
|
||||
query.addRestriction("M_Locator_ID", MQuery.EQUAL, value);
|
||||
|
||||
// Product
|
||||
value = null;
|
||||
if (productField.getDisplay() != "")
|
||||
value = productField.getValue();
|
||||
if (value != null && value.toString().length() > 0)
|
||||
query.addRestriction("M_Product_ID", MQuery.EQUAL, value);
|
||||
|
||||
// MovementType
|
||||
value = null;
|
||||
if (mtypeField.getDisplay() != "")
|
||||
value = mtypeField.getValue();
|
||||
if (value != null && value.toString().length() > 0)
|
||||
query.addRestriction("MovementType", MQuery.EQUAL, value);
|
||||
|
||||
// DateFrom
|
||||
Date f = null;
|
||||
Timestamp ts =null;
|
||||
|
||||
if (dateFField.getValue() != null)
|
||||
{
|
||||
f = dateFField.getValue();
|
||||
ts = new Timestamp(f.getTime());
|
||||
}
|
||||
|
||||
Timestamp ts = (Timestamp)dateFField.getValue();
|
||||
if (ts != null)
|
||||
query.addRestriction("TRUNC(MovementDate)", MQuery.GREATER_EQUAL, ts);
|
||||
|
||||
// DateTO
|
||||
Date t = null;
|
||||
ts = null;
|
||||
|
||||
if (dateTField.getValue() != null)
|
||||
{
|
||||
t = dateTField.getValue();
|
||||
ts = new Timestamp(t.getTime());
|
||||
}
|
||||
|
||||
ts = (Timestamp)dateTField.getValue();
|
||||
if (ts != null)
|
||||
query.addRestriction("TRUNC(MovementDate)", MQuery.LESS_EQUAL, ts);
|
||||
log.info( "VTrxMaterial.refresh query=" + query.toString());
|
||||
|
@ -505,37 +297,31 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
|||
/**
|
||||
* Refresh/Requery
|
||||
*/
|
||||
|
||||
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "StartSearch"), false);
|
||||
|
||||
//
|
||||
m_mTab.setQuery(query);
|
||||
m_mTab.query(false);
|
||||
|
||||
//
|
||||
int no = m_mTab.getRowCount();
|
||||
statusBar.setStatusLine(" ", false);
|
||||
statusBar.setStatusDB(Integer.toString(no));
|
||||
|
||||
populateGrid();
|
||||
} // refresh
|
||||
|
||||
/**
|
||||
* Zoom
|
||||
*/
|
||||
|
||||
private void zoom()
|
||||
{
|
||||
log.info("");
|
||||
|
||||
//
|
||||
int AD_Window_ID = 0;
|
||||
String ColumnName = null;
|
||||
String SQL = null;
|
||||
|
||||
//
|
||||
int lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_InOutLine_ID");
|
||||
|
||||
if (lineID != 0)
|
||||
{
|
||||
log.fine("M_InOutLine_ID=" + lineID);
|
||||
|
||||
if (Env.getContext(Env.getCtx(), m_WindowNo, "MovementType").startsWith("C"))
|
||||
AD_Window_ID = 169; // Customer
|
||||
else
|
||||
|
@ -546,7 +332,6 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
|||
else
|
||||
{
|
||||
lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_InventoryLine_ID");
|
||||
|
||||
if (lineID != 0)
|
||||
{
|
||||
log.fine("M_InventoryLine_ID=" + lineID);
|
||||
|
@ -557,7 +342,6 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
|||
else
|
||||
{
|
||||
lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_MovementLine_ID");
|
||||
|
||||
if (lineID != 0)
|
||||
{
|
||||
log.fine("M_MovementLine_ID=" + lineID);
|
||||
|
@ -568,7 +352,6 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
|||
else
|
||||
{
|
||||
lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_ProductionLine_ID");
|
||||
|
||||
if (lineID != 0)
|
||||
{
|
||||
log.fine("M_ProductionLine_ID=" + lineID);
|
||||
|
@ -581,19 +364,16 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (AD_Window_ID == 0)
|
||||
return;
|
||||
|
||||
// Get Parent ID
|
||||
int parentID = 0;
|
||||
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
|
||||
pstmt.setInt(1, lineID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
parentID = rs.getInt(1);
|
||||
rs.close();
|
||||
|
@ -603,21 +383,13 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
|||
{
|
||||
log.log(Level.SEVERE, SQL, e);
|
||||
}
|
||||
|
||||
MQuery query = MQuery.getEqualQuery(ColumnName, parentID);
|
||||
log.config("AD_Window_ID=" + AD_Window_ID + " - " + query);
|
||||
|
||||
if (parentID == 0)
|
||||
log.log(Level.SEVERE, "No ParentValue - " + SQL + " - " + lineID);
|
||||
|
||||
// Zoom
|
||||
AEnv.zoom(AD_Window_ID, query);
|
||||
/* ADWindow frame = new ADWindow(Env.getCtx(), AD_Window_ID);
|
||||
} // zoom
|
||||
|
||||
if (frame == null)
|
||||
return;
|
||||
|
||||
SessionManager.getAppDesktop().showWindow(frame);
|
||||
frame = null;
|
||||
*/ } // zoom
|
||||
}
|
||||
} // VTrxMaterial
|
||||
|
|
|
@ -14,10 +14,10 @@ import org.adempiere.webui.component.Listbox;
|
|||
import org.adempiere.webui.component.Row;
|
||||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Textbox;
|
||||
import org.adempiere.webui.component.WStatusBar;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.panel.ADForm;
|
||||
import org.adempiere.webui.panel.StatusBarPanel;
|
||||
import org.adempiere.webui.window.FDialog;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLookup;
|
||||
|
@ -89,7 +89,7 @@ public class WWFActivity extends ADForm implements EventListener
|
|||
private WSearchEditor fForward = null; // dynInit
|
||||
private Label lForward = new Label(Msg.getMsg(Env.getCtx(), "Forward"));
|
||||
private Label lOptional = new Label("(" + Msg.translate(Env.getCtx(), "Optional") + ")");
|
||||
private WStatusBar statusBar = new WStatusBar();
|
||||
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||
|
||||
public WWFActivity()
|
||||
{
|
||||
|
@ -226,7 +226,6 @@ public class WWFActivity extends ADForm implements EventListener
|
|||
|
||||
South south = new South();
|
||||
south.appendChild(statusBar);
|
||||
statusBar.setWidth("100%");
|
||||
layout.appendChild(south);
|
||||
south.setStyle("background-color: transparent");
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ import java.util.List;
|
|||
import org.adempiere.webui.component.ADTabListModel.ADTabLabel;
|
||||
import org.zkoss.zhtml.Button;
|
||||
import org.zkoss.zhtml.Text;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -38,10 +39,15 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
|
|||
this.setStyle("margin:0;padding:0");
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
this.getChildren().clear();
|
||||
int i = 0;
|
||||
for (ADTabLabel tabLabel : listItems) {
|
||||
public synchronized void refresh() {
|
||||
List childs = getChildren();
|
||||
int childCount = childs.size();
|
||||
for (int c = childCount - 1; c >=0; c--) {
|
||||
removeChild((Component) childs.get(c));
|
||||
}
|
||||
Object[] items = listItems.toArray();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
ADTabLabel tabLabel = (ADTabLabel) items[i];
|
||||
Button button = new Button();
|
||||
Text text = new Text(tabLabel.label);
|
||||
button.appendChild(text);
|
||||
|
@ -67,7 +73,6 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
|
|||
|
||||
button.setParent(this);
|
||||
button.addEventListener(Events.ON_CLICK, this);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +84,7 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
|
|||
this.selectedIndex = index;
|
||||
}
|
||||
|
||||
public void setItems(List<ADTabLabel> listItems) {
|
||||
public synchronized void setItems(List<ADTabLabel> listItems) {
|
||||
this.listItems = listItems;
|
||||
refresh();
|
||||
}
|
||||
|
|
|
@ -441,7 +441,6 @@ public class CWindowToolbar extends FToolbar implements EventListener
|
|||
public void enableChanges(boolean enabled)
|
||||
{
|
||||
this.btnNew.setDisabled(!enabled);
|
||||
this.btnIgnore.setDisabled(!enabled);
|
||||
}
|
||||
|
||||
public void enableIgnore(boolean enabled)
|
||||
|
|
|
@ -13,15 +13,15 @@
|
|||
|
||||
package org.adempiere.webui.component;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zul.Hbox;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Low Heng Sin
|
||||
*
|
||||
*/
|
||||
public class Combinationbox extends Hbox
|
||||
public class Combinationbox extends Panel
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -49,11 +49,14 @@ public class Combinationbox extends Hbox
|
|||
private void initComponents()
|
||||
{
|
||||
textbox = new Textbox();
|
||||
textbox.setWidth("100%");
|
||||
button = new Button();
|
||||
button.setHeight("98%");
|
||||
button.setHeight("22px");
|
||||
button.setWidth("26px");
|
||||
appendChild(textbox);
|
||||
appendChild(button);
|
||||
|
||||
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||
this.setStyle(style);
|
||||
}
|
||||
|
||||
public void setText(String value)
|
||||
|
|
|
@ -23,6 +23,8 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
import org.zkoss.zul.Hbox;
|
||||
|
@ -68,6 +70,8 @@ public final class ConfirmPanel extends Hbox
|
|||
/** Action String New. */
|
||||
public static final String A_NEW = "New";
|
||||
|
||||
private boolean m_withText = false;
|
||||
|
||||
private Map<String, Button> buttonMap = new HashMap<String, Button>();
|
||||
|
||||
/**
|
||||
|
@ -98,9 +102,25 @@ public final class ConfirmPanel extends Hbox
|
|||
Button button = new Button();
|
||||
button.setName("btn"+name);
|
||||
button.setId(name);
|
||||
button.setSrc("images/"+name+"24.png");
|
||||
String text = Msg.translate(Env.getCtx(), name);
|
||||
if (!name.equals(text))
|
||||
text = text.replaceAll("[&]", "");
|
||||
else
|
||||
text = null;
|
||||
|
||||
if (m_withText && text != null)
|
||||
{
|
||||
button.setSrc("images/"+name+"16.png");
|
||||
button.setLabel(text);
|
||||
LayoutUtils.addSclass("action-text-button", button);
|
||||
}
|
||||
else
|
||||
{
|
||||
button.setSrc("images/"+name+"24.png");
|
||||
if (text != null)
|
||||
button.setTooltiptext(text);
|
||||
LayoutUtils.addSclass("action-button", button);
|
||||
}
|
||||
|
||||
buttonMap.put(name, button);
|
||||
|
||||
|
@ -123,6 +143,28 @@ public final class ConfirmPanel extends Hbox
|
|||
boolean withHistoryButton,
|
||||
boolean withZoomButton)
|
||||
{
|
||||
this(withCancelButton, withRefreshButton, withResetButton, withCustomizeButton, withHistoryButton, withZoomButton, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* create confirm panel with multiple options
|
||||
* @param withCancelButton with cancel
|
||||
* @param withRefreshButton with refresh
|
||||
* @param withResetButton with reset
|
||||
* @param withCustomizeButton with customize
|
||||
* @param withHistoryButton with history
|
||||
* @param withZoomButton with zoom
|
||||
*/
|
||||
public ConfirmPanel(boolean withCancelButton,
|
||||
boolean withRefreshButton,
|
||||
boolean withResetButton,
|
||||
boolean withCustomizeButton,
|
||||
boolean withHistoryButton,
|
||||
boolean withZoomButton,
|
||||
boolean withText)
|
||||
{
|
||||
m_withText = withText;
|
||||
|
||||
init();
|
||||
|
||||
setVisible(A_CANCEL, withCancelButton);
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.adempiere.webui.component;
|
|||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
||||
/**
|
||||
|
@ -62,6 +63,12 @@ public class EditorBox extends Panel
|
|||
|
||||
this.appendChild(txt);
|
||||
this.appendChild(btn);
|
||||
|
||||
btn.setHeight("22px");
|
||||
btn.setWidth("26px");
|
||||
|
||||
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||
this.setStyle(style);
|
||||
}
|
||||
|
||||
public Textbox getTextBox()
|
||||
|
|
|
@ -60,7 +60,8 @@ public class Label extends org.zkoss.zul.Label
|
|||
@Override
|
||||
public void setValue(String value) {
|
||||
super.setValue(value != null ? value.replaceAll("[&]", "") : null);
|
||||
setupMandatoryDecorator();
|
||||
if ((value == null || value.trim().length() == 0) && decorator != null)
|
||||
decorator.setVisible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,13 +76,18 @@ public class Label extends org.zkoss.zul.Label
|
|||
}
|
||||
|
||||
private void setupMandatoryDecorator() {
|
||||
String value = getValue();
|
||||
if (value != null && (value.trim().length() > 0) && mandatory) {
|
||||
if (decorator == null)
|
||||
createMandatoryDecorator();
|
||||
String value = getValue();
|
||||
if (mandatory && value != null && value.trim().length() > 0) {
|
||||
decorator.setVisible(true);
|
||||
} else
|
||||
decorator.setVisible(false);
|
||||
}
|
||||
|
||||
private void createMandatoryDecorator() {
|
||||
decorator = new Label("*");
|
||||
((Label)decorator).setStyle("text-decoration: none; font-size: xx-small; vertical-align: top;");
|
||||
} else if (decorator != null)
|
||||
decorator.setVisible(false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -257,13 +257,16 @@ public class ListModelTable extends ListModelList implements ListModelExt
|
|||
if (vector)
|
||||
{
|
||||
newRow = new Vector<Object>(getNoColumns());
|
||||
((Vector)newRow).ensureCapacity(getNoColumns());
|
||||
((Vector)newRow).setSize(getNoColumns());
|
||||
add(newRow);
|
||||
}
|
||||
else
|
||||
{
|
||||
newRow = new ArrayList<Object>(getNoColumns());
|
||||
((ArrayList)newRow).ensureCapacity(getNoColumns());
|
||||
for(int i = 0; i < getNoColumns(); i++)
|
||||
{
|
||||
newRow.add(null);
|
||||
}
|
||||
add(newRow);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,7 +219,10 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener
|
|||
* remove all items, to ease porting of swing form
|
||||
*/
|
||||
public void removeAllItems() {
|
||||
getItems().clear();
|
||||
int cnt = getItemCount();
|
||||
for (int i = cnt - 1; i >=0; i--) {
|
||||
removeItemAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,6 +20,7 @@ package org.adempiere.webui.component;
|
|||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
||||
/** Location Editor component
|
||||
|
@ -53,8 +54,13 @@ public class Locationbox extends Panel
|
|||
{
|
||||
txt = new Textbox();
|
||||
btn = new Button();
|
||||
btn.setHeight("22px");
|
||||
btn.setWidth("26px");
|
||||
this.appendChild(txt);
|
||||
this.appendChild(btn);
|
||||
|
||||
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||
this.setStyle(style);
|
||||
}
|
||||
|
||||
public Textbox getTextBox()
|
||||
|
|
|
@ -101,32 +101,39 @@ public class Messagebox extends Window implements EventListener
|
|||
lblMsg.setValue(msg);
|
||||
|
||||
btnOk.setLabel("OK");
|
||||
btnOk.setImage("/images/Ok24.png");
|
||||
btnOk.setImage("/images/Ok16.png");
|
||||
btnOk.addEventListener(Events.ON_CLICK, this);
|
||||
btnOk.setSclass("action-text-button");
|
||||
|
||||
btnCancel.setLabel("Cancel");
|
||||
btnCancel.setImage("/images/Cancel24.png");
|
||||
btnCancel.setImage("/images/Cancel16.png");
|
||||
btnCancel.addEventListener(Events.ON_CLICK, this);
|
||||
btnCancel.setSclass("action-text-button");
|
||||
|
||||
btnYes.setLabel("Yes");
|
||||
btnYes.setImage("/images/Ok24.png");
|
||||
btnYes.setImage("/images/Ok16.png");
|
||||
btnYes.addEventListener(Events.ON_CLICK, this);
|
||||
btnYes.setSclass("action-text-button");
|
||||
|
||||
btnNo.setLabel("No");
|
||||
btnNo.setImage("/images/Cancel24.png");
|
||||
btnNo.setImage("/images/Cancel16.png");
|
||||
btnNo.addEventListener(Events.ON_CLICK, this);
|
||||
btnNo.setSclass("action-text-button");
|
||||
|
||||
btnAbort.setLabel("Abort");
|
||||
//btnAbort.setImage("/images/");
|
||||
btnAbort.addEventListener(Events.ON_CLICK, this);
|
||||
btnAbort.setSclass("action-text-button");
|
||||
|
||||
btnRetry.setLabel("Retry");
|
||||
//btnRetry.setImage("/images/");
|
||||
btnRetry.addEventListener(Events.ON_CLICK, this);
|
||||
btnRetry.setSclass("action-text-button");
|
||||
|
||||
btnIgnore.setLabel("Ignore");
|
||||
btnIgnore.setImage("/images/Ignore24.png");
|
||||
btnIgnore.setImage("/images/Ignore16.png");
|
||||
btnIgnore.addEventListener(Events.ON_CLICK, this);
|
||||
btnIgnore.setSclass("action-text-button");
|
||||
|
||||
Panel pnlMessage = new Panel();
|
||||
pnlMessage.setWidth("100%");
|
||||
|
|
|
@ -16,14 +16,14 @@
|
|||
|
||||
package org.adempiere.webui.component;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zul.Hbox;
|
||||
|
||||
/**
|
||||
* Product Attribute Box
|
||||
* @author Low Heng Sin
|
||||
*/
|
||||
public class PAttributebox extends Hbox
|
||||
public class PAttributebox extends Panel
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -51,11 +51,14 @@ public class PAttributebox extends Hbox
|
|||
private void initComponents()
|
||||
{
|
||||
textBox = new Textbox();
|
||||
textBox.setWidth("100%");
|
||||
button = new Button();
|
||||
button.setHeight("98%");
|
||||
button.setHeight("22px");
|
||||
button.setWidth("26px");
|
||||
appendChild(textBox);
|
||||
appendChild(button);
|
||||
|
||||
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||
this.setStyle(style);
|
||||
}
|
||||
|
||||
public void setText(String value)
|
||||
|
|
|
@ -20,9 +20,10 @@ package org.adempiere.webui.component;
|
|||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
|
||||
public class Searchbox extends Panel//Hbox
|
||||
public class Searchbox extends Panel
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
|
||||
|
@ -48,13 +49,14 @@ public class Searchbox extends Panel//Hbox
|
|||
private void initComponents()
|
||||
{
|
||||
txt = new Textbox();
|
||||
// txt.setWidth("100%");
|
||||
btn = new Button();
|
||||
btn.setHeight("98%");
|
||||
btn.setHeight("22px");
|
||||
btn.setWidth("26px");
|
||||
appendChild(txt);
|
||||
appendChild(btn);
|
||||
|
||||
this.setStyle("display: inline-block");
|
||||
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||
this.setStyle(style);
|
||||
}
|
||||
|
||||
public Textbox getTextBox()
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
|
||||
package org.adempiere.webui.component;
|
||||
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zul.Hbox;
|
||||
|
||||
/**
|
||||
* URL Box
|
||||
*/
|
||||
public class Urlbox extends Hbox
|
||||
public class Urlbox extends Panel
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
@ -51,11 +52,14 @@ public class Urlbox extends Hbox
|
|||
private void initComponents()
|
||||
{
|
||||
txtUrl = new Textbox();
|
||||
txtUrl.setWidth("100%");
|
||||
btnUrl = new Button();
|
||||
btnUrl.setHeight("98%");
|
||||
btnUrl.setHeight("22px");
|
||||
btnUrl.setWidth("26px");
|
||||
appendChild(txtUrl);
|
||||
appendChild(btnUrl);
|
||||
|
||||
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||
this.setStyle(style);
|
||||
}
|
||||
|
||||
public void setText(String value)
|
||||
|
|
|
@ -400,10 +400,11 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
|||
*
|
||||
* @param headerValue The object to use for generating the header text.
|
||||
* @param headerIndex The column index of the header
|
||||
* @param classType
|
||||
* @return The generated ListHeader
|
||||
* @see #renderListHead(ListHead)
|
||||
*/
|
||||
private Component getListHeaderComponent(Object headerValue, int headerIndex)
|
||||
private Component getListHeaderComponent(Object headerValue, int headerIndex, Class classType)
|
||||
{
|
||||
ListHeader header = null;
|
||||
|
||||
|
@ -422,6 +423,22 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
|||
int width = headerText.trim().length() * 9;
|
||||
if (width > 300)
|
||||
width = 300;
|
||||
else if (classType != null)
|
||||
{
|
||||
if (classType.equals(String.class))
|
||||
{
|
||||
if (width > 0 && width < 180)
|
||||
width = 180;
|
||||
}
|
||||
else if (classType.equals(IDColumn.class))
|
||||
{
|
||||
header.setSort("none");
|
||||
if (width == 0)
|
||||
width = 30;
|
||||
}
|
||||
else if (width > 0 && width < 100)
|
||||
width = 100;
|
||||
}
|
||||
else if (width > 0 && width < 100)
|
||||
width = 100;
|
||||
|
||||
|
@ -483,7 +500,7 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
|||
for (int columnIndex = 0; columnIndex < m_tableColumns.size(); columnIndex++)
|
||||
{
|
||||
column = m_tableColumns.get(columnIndex);
|
||||
header = getListHeaderComponent(column.getHeaderValue(), columnIndex);
|
||||
header = getListHeaderComponent(column.getHeaderValue(), columnIndex, column.getColumnClass());
|
||||
head.appendChild(header);
|
||||
}
|
||||
head.setSizable(true);
|
||||
|
@ -693,6 +710,26 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
|||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param index
|
||||
* @param header
|
||||
*/
|
||||
public void setColumnHeader(int index, String header)
|
||||
{
|
||||
if (index >= 0 && index < m_tableColumns.size())
|
||||
{
|
||||
m_tableColumns.get(index).setHeaderValue(Util.cleanAmp(header));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void setColumnClass(int index, Class classType) {
|
||||
if (index >= 0 && index < m_tableColumns.size())
|
||||
{
|
||||
m_tableColumns.get(index).setColumnClass(classType);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -444,7 +444,13 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
|
|||
|
||||
setColumnReadOnly(index, readOnly);
|
||||
|
||||
// TODO transfer this to Renderer
|
||||
renderer.setColumnHeader(index, header);
|
||||
|
||||
renderer.setColumnClass(index, classType);
|
||||
|
||||
if (index < m_modelHeaderClass.size())
|
||||
m_modelHeaderClass.set(index, classType);
|
||||
else
|
||||
m_modelHeaderClass.add(classType);
|
||||
|
||||
return;
|
||||
|
@ -466,6 +472,10 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
|
|||
{
|
||||
setColumnReadOnly(index, readOnly);
|
||||
|
||||
WListItemRenderer renderer = (WListItemRenderer)getItemRenderer();
|
||||
|
||||
renderer.setColumnClass(index, classType);
|
||||
|
||||
m_modelHeaderClass.add(classType);
|
||||
|
||||
return;
|
||||
|
@ -489,6 +499,9 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
|
|||
|
||||
addColumn(header);
|
||||
|
||||
WListItemRenderer renderer = (WListItemRenderer)getItemRenderer();
|
||||
renderer.setColumnClass((renderer.getNoColumns() - 1), classType);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,240 +0,0 @@
|
|||
/******************************************************************************
|
||||
* Product: Posterita Ajax UI *
|
||||
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
* For the text or an alternative of this public license, you may reach us *
|
||||
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
|
||||
* or via info@posterita.org or http://www.posterita.org/ *
|
||||
*****************************************************************************/
|
||||
|
||||
package org.adempiere.webui.component;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import org.adempiere.webui.component.Label;
|
||||
import org.compiere.model.DataStatusEvent;
|
||||
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
||||
/**
|
||||
* Web UI status bar. Based upon the rich client's
|
||||
* {@link org.compiere.apps.StatusBar}. The basic status bar contains one or
|
||||
* both of (a) a general status description and (b) a database status
|
||||
* description. In addition, components can be added to the status bar to extend
|
||||
* its functionaility
|
||||
*
|
||||
* @author Andrew Kimball
|
||||
*/
|
||||
public class WStatusBar extends Grid implements EventListener
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** label */
|
||||
private Label statusLine = new Label();
|
||||
|
||||
private Label statusDB = new Label();
|
||||
|
||||
private Row statusBar = new Row();
|
||||
|
||||
private String m_text;
|
||||
|
||||
private DataStatusEvent m_dse = null;
|
||||
|
||||
private boolean mt_error;
|
||||
|
||||
private String mt_text;
|
||||
|
||||
/**
|
||||
* Constructor for a Standard Status Bar.
|
||||
*/
|
||||
public WStatusBar()
|
||||
{
|
||||
super();
|
||||
|
||||
Rows rows = new Rows();
|
||||
try
|
||||
{
|
||||
initialise();
|
||||
// this.setBorder("normal");
|
||||
rows.appendChild(statusBar);
|
||||
this.appendChild(rows);
|
||||
this.setWidth("99%");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
}
|
||||
// this.setName("statusBar");
|
||||
} // StatusBar
|
||||
|
||||
/**
|
||||
* Static Initialisation.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
private void initialise() throws Exception
|
||||
{
|
||||
statusLine.setValue("statusLine");
|
||||
statusBar.appendChild(statusLine);
|
||||
|
||||
statusDB.setValue("#");
|
||||
statusDB.setStyle("text-align:right; " + "color:"
|
||||
+ ZkCssHelper.createHexColorString(Color.blue));
|
||||
statusDB.addEventListener(Events.ON_CLICK, this);
|
||||
|
||||
statusBar.appendChild(statusDB);
|
||||
} // jbInit
|
||||
|
||||
/**
|
||||
* Get Status Line text.
|
||||
*
|
||||
* @return StatusLine text
|
||||
*/
|
||||
public final String getStatusLine()
|
||||
{
|
||||
return statusLine.getValue().trim();
|
||||
} // getStatusLine
|
||||
|
||||
/**
|
||||
* Set Status Line
|
||||
*
|
||||
* @param text
|
||||
* text
|
||||
* @param error
|
||||
* error
|
||||
*/
|
||||
public final void setStatusLine(final String text, final boolean error)
|
||||
{
|
||||
mt_error = error;
|
||||
mt_text = text;
|
||||
if (mt_error)
|
||||
{
|
||||
/* ZkCssHelper.appendStyle(statusLine, ZkCssHelper
|
||||
.createHexColorString(AdempierePLAF.getTextColor_Issue()));
|
||||
*/ }
|
||||
else
|
||||
{
|
||||
/* ZkCssHelper.appendStyle(statusLine, ZkCssHelper
|
||||
.createHexColorString(AdempierePLAF.getTextColor_OK()));
|
||||
*/ }
|
||||
statusLine.setValue(mt_text);
|
||||
//
|
||||
} // setStatusLine
|
||||
|
||||
/**
|
||||
* Set ToolTip of StatusLine
|
||||
*
|
||||
* @param tip
|
||||
* tooltip text
|
||||
*/
|
||||
public final void setStatusToolTip(final String tip)
|
||||
{
|
||||
statusLine.setTooltiptext(tip);
|
||||
} // setStatusToolTip
|
||||
|
||||
/**
|
||||
* Set Standard Status Line (non error)
|
||||
*
|
||||
* @param text
|
||||
* text to display on the status line
|
||||
*/
|
||||
public final void setStatusLine(final String text)
|
||||
{
|
||||
if (text == null)
|
||||
{
|
||||
setStatusLine("", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
setStatusLine(text, false);
|
||||
}
|
||||
} // setStatusLine
|
||||
|
||||
/**
|
||||
* Set Status DB Info
|
||||
*
|
||||
* @param text
|
||||
* description of database status
|
||||
* @param dse
|
||||
* data status event
|
||||
*/
|
||||
public final void setStatusDB(final String text, final DataStatusEvent dse)
|
||||
{
|
||||
if (text == null || text.length() == 0)
|
||||
{
|
||||
statusDB.setValue("");
|
||||
statusDB.setVisible(false);
|
||||
statusDB.detach();
|
||||
}
|
||||
else
|
||||
{
|
||||
StringBuffer sb = new StringBuffer(" ");
|
||||
sb.append(text).append(" ");
|
||||
statusDB.setValue(sb.toString());
|
||||
if (!statusDB.isVisible())
|
||||
{
|
||||
statusDB.setVisible(true);
|
||||
}
|
||||
statusDB.setParent(statusBar);
|
||||
}
|
||||
|
||||
// Save
|
||||
m_text = text;
|
||||
m_dse = dse;
|
||||
} // setStatusDB
|
||||
|
||||
/**
|
||||
* Set Status DB Info
|
||||
*
|
||||
* @param text
|
||||
* description of database status
|
||||
*/
|
||||
public final void setStatusDB(final String text)
|
||||
{
|
||||
setStatusDB(text, null);
|
||||
} // setStatusDB
|
||||
|
||||
/**
|
||||
* Set Status DB Info
|
||||
*
|
||||
* @param no
|
||||
* Database status identifier
|
||||
*/
|
||||
public final void setStatusDB(final int no)
|
||||
{
|
||||
setStatusDB(String.valueOf(no), null);
|
||||
} // setStatusDB
|
||||
|
||||
/**
|
||||
* Add Component to East of StatusBar
|
||||
*
|
||||
* @param component
|
||||
* component
|
||||
*/
|
||||
public final void addStatusComponent(final Component component)
|
||||
{
|
||||
this.appendChild(component);
|
||||
} // addStatusComponent
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.zkoss.zk.ui.event.EventListener#onEvent(org.zkoss.zk.ui.event.Event)
|
||||
*/
|
||||
public void onEvent(final Event evt) throws Exception
|
||||
{
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
}
|
|
@ -41,6 +41,8 @@ public class WTableColumn
|
|||
/** The header value of the column. */
|
||||
protected Object headerValue;
|
||||
|
||||
protected Class columnClass;
|
||||
|
||||
/**
|
||||
* Cover method, using a default width of 75
|
||||
* @see #WTableColumn(int)
|
||||
|
@ -252,4 +254,22 @@ public class WTableColumn
|
|||
{
|
||||
return isResizable;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Class
|
||||
*/
|
||||
public Class getColumnClass()
|
||||
{
|
||||
return columnClass;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param columnClass
|
||||
*/
|
||||
public void setColumnClass(Class columnClass)
|
||||
{
|
||||
this.columnClass = columnClass;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,6 +77,22 @@ public class WDateEditor extends WEditor
|
|||
this("Date", "Date", false, false, true);
|
||||
} // VDate
|
||||
|
||||
/**
|
||||
*
|
||||
* @param columnName
|
||||
* @param mandatory
|
||||
* @param readonly
|
||||
* @param updateable
|
||||
* @param displayType
|
||||
* @param label
|
||||
*/
|
||||
public WDateEditor(String columnName, boolean mandatory, boolean readonly, boolean updateable,
|
||||
int displayType, String label) {
|
||||
//TODO: support for displayType
|
||||
super(new Datebox(), columnName, label, null, mandatory, readonly, updateable);
|
||||
}
|
||||
|
||||
|
||||
public void onEvent(Event event)
|
||||
{
|
||||
Date date = getComponent().getValue();
|
||||
|
@ -126,6 +142,7 @@ public class WDateEditor extends WEditor
|
|||
if (value == null)
|
||||
{
|
||||
oldValue = null;
|
||||
getComponent().setValue(null);
|
||||
}
|
||||
else if (value instanceof Timestamp)
|
||||
{
|
||||
|
|
|
@ -411,4 +411,8 @@ public abstract class WEditor implements EventListener, PropertyChangeListener
|
|||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public void dynamicDisplay()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
|||
|
||||
private String m_columnName;
|
||||
private MLocatorLookup m_mLocator;
|
||||
private MLocator m_value;
|
||||
private Object m_value;
|
||||
private int m_WindowNo;
|
||||
|
||||
private static CLogger log = CLogger.getCLogger(WLocatorEditor.class);
|
||||
|
@ -113,7 +113,7 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
|||
value = null;
|
||||
}
|
||||
|
||||
m_value = m_mLocator.getMLocator(value, null);
|
||||
m_value = value;
|
||||
getComponent().setText(m_mLocator.getDisplay(value)); // loads value
|
||||
|
||||
// Data Binding
|
||||
|
@ -159,8 +159,9 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
|||
|
||||
public int getM_Locator_ID()
|
||||
{
|
||||
if (m_value != null/* && m_value instanceof Integer*/)
|
||||
return m_value.getM_Locator_ID();
|
||||
if (m_value != null
|
||||
&& m_value instanceof Integer)
|
||||
return ((Integer)m_value).intValue();
|
||||
|
||||
return 0;
|
||||
} // getM_Locator_ID
|
||||
|
@ -193,9 +194,8 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
|||
|
||||
int M_Locator_ID = 0;
|
||||
|
||||
//if (m_value instanceof Integer)
|
||||
if (m_value != null)
|
||||
M_Locator_ID = m_value.getM_Locator_ID();
|
||||
if (m_value instanceof Integer)
|
||||
M_Locator_ID = ((Integer)m_value).intValue();
|
||||
|
||||
m_mLocator.setOnly_Warehouse_ID(only_Warehouse_ID);
|
||||
m_mLocator.setOnly_Product_ID(getOnly_Product_ID());
|
||||
|
|
|
@ -827,17 +827,17 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
|||
|
||||
public void valueChange(ValueChangeEvent evt)
|
||||
{
|
||||
if (getColumnName().equals(evt.getPropertyName()))
|
||||
if ("zoom".equals(evt.getPropertyName()))
|
||||
{
|
||||
actionZoom(evt.getNewValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (evt.getNewValue() != null)
|
||||
{
|
||||
actionCombo(evt.getNewValue());
|
||||
}
|
||||
}
|
||||
else if ("zoom".equals(evt.getPropertyName()))
|
||||
{
|
||||
actionZoom(evt.getNewValue());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -211,7 +211,7 @@ ContextMenuListener, IZoomableEditor
|
|||
private void refreshList()
|
||||
{
|
||||
if (getComponent().getItemCount() > 0)
|
||||
getComponent().getItems().clear();
|
||||
getComponent().removeAllItems();
|
||||
|
||||
if (isReadWrite())
|
||||
{
|
||||
|
@ -327,4 +327,11 @@ ContextMenuListener, IZoomableEditor
|
|||
setValue(evt.getNewValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dynamicDisplay()
|
||||
{
|
||||
if (isReadWrite() && (!lookup.isValidated() || !lookup.isLoaded()))
|
||||
this.actionRefresh();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ import java.util.Map.Entry;
|
|||
import java.util.logging.Level;
|
||||
|
||||
import org.adempiere.webui.LayoutUtils;
|
||||
import org.adempiere.webui.apps.AEnv;
|
||||
import org.adempiere.webui.component.Bandbox;
|
||||
import org.adempiere.webui.component.Datebox;
|
||||
import org.adempiere.webui.component.Grid;
|
||||
|
@ -347,6 +348,7 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
|||
|
||||
if (editor instanceof WButtonEditor)
|
||||
{
|
||||
if (windowPanel != null)
|
||||
((WButtonEditor)editor).addActionListener(windowPanel);
|
||||
}
|
||||
else
|
||||
|
@ -356,8 +358,11 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
|||
|
||||
if (editor.getComponent() instanceof HtmlBasedComponent) {
|
||||
//can't stretch bandbox & datebox
|
||||
if (!(editor.getComponent() instanceof Bandbox) && !(editor.getComponent() instanceof Datebox))
|
||||
((HtmlBasedComponent)editor.getComponent()).setWidth("100%");
|
||||
if (!(editor.getComponent() instanceof Bandbox) &&
|
||||
!(editor.getComponent() instanceof Datebox)) {
|
||||
String width = AEnv.isFirefox2() ? "99%" : "100%";
|
||||
((HtmlBasedComponent)editor.getComponent()).setWidth(width);
|
||||
}
|
||||
}
|
||||
|
||||
WEditorPopupMenu popupMenu = editor.getPopupMenu();
|
||||
|
@ -460,14 +465,20 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
|||
}
|
||||
else
|
||||
{
|
||||
comp.dynamicDisplay();
|
||||
boolean rw = mField.isEditable(true); // r/w - check Context
|
||||
comp.setReadWrite(rw);
|
||||
if (comp.getLabel() != null)
|
||||
{
|
||||
comp.setMandatory(mField.isMandatory(true)); // check context
|
||||
}
|
||||
/*
|
||||
boolean manMissing = false;
|
||||
if (rw && mField.getValue() == null && mField.isMandatory(true)) // check context
|
||||
{
|
||||
manMissing = true;
|
||||
}
|
||||
comp.setBackground(manMissing || mField.isError());
|
||||
comp.setBackground(manMissing || mField.isError());*/
|
||||
}
|
||||
}
|
||||
else if (comp.isVisible())
|
||||
|
@ -724,6 +735,8 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
|||
|
||||
}
|
||||
//if (col >= 0)
|
||||
if (!uiCreated)
|
||||
createUI();
|
||||
dynamicDisplay(col);
|
||||
|
||||
//sync tree
|
||||
|
@ -835,7 +848,9 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
|||
//
|
||||
if (e.getNewValue() == null && e.getOldValue() != null
|
||||
&& e.getOldValue().toString().length() > 0) // some editors return "" instead of null
|
||||
mTable.setChanged (true);
|
||||
// this is the original code from GridController, don't know what it does there but it breaks ignore button for web ui
|
||||
// mTable.setChanged (true);
|
||||
mTable.setValueAt (e.getNewValue(), row, col);
|
||||
else
|
||||
{
|
||||
// mTable.setValueAt (e.getNewValue(), row, col, true);
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.adempiere.webui.apps.AEnv;
|
|||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.ListModelTable;
|
||||
import org.adempiere.webui.component.WListbox;
|
||||
import org.adempiere.webui.component.WStatusBar;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
|
@ -266,7 +265,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
|||
protected boolean p_multipleSelection;
|
||||
/** Initial WHERE Clause */
|
||||
protected String p_whereClause = "";
|
||||
protected WStatusBar statusBar = new WStatusBar();
|
||||
protected StatusBarPanel statusBar = new StatusBarPanel();
|
||||
/** */
|
||||
private Vector<Object> line;
|
||||
private boolean m_ok = false;
|
||||
|
|
|
@ -25,6 +25,7 @@ import org.compiere.model.DataStatusEvent;
|
|||
import org.compiere.model.MRole;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Msg;
|
||||
import org.zkoss.zk.ui.Component;
|
||||
import org.zkoss.zk.ui.event.Event;
|
||||
import org.zkoss.zk.ui.event.EventListener;
|
||||
import org.zkoss.zk.ui.event.Events;
|
||||
|
@ -52,6 +53,10 @@ public class StatusBarPanel extends Panel implements EventListener
|
|||
|
||||
private String m_text;
|
||||
|
||||
private Div east;
|
||||
|
||||
private Div west;
|
||||
|
||||
public StatusBarPanel()
|
||||
{
|
||||
super();
|
||||
|
@ -61,40 +66,41 @@ public class StatusBarPanel extends Panel implements EventListener
|
|||
private void init()
|
||||
{
|
||||
statusLine = new Label();
|
||||
statusDB = new Label();
|
||||
statusDB = new Label(" ");
|
||||
infoLine = new Label();
|
||||
|
||||
Hbox hbox = new Hbox();
|
||||
hbox.setWidth("100%");
|
||||
hbox.setHeight("100%");
|
||||
hbox.setWidths("50%, 50%");
|
||||
Div div = new Div();
|
||||
div.setStyle("text-align: left; ");
|
||||
div.appendChild(statusLine);
|
||||
div.setWidth("100%");
|
||||
west = new Div();
|
||||
west.setStyle("text-align: left; ");
|
||||
west.appendChild(statusLine);
|
||||
west.setWidth("100%");
|
||||
Vbox vbox = new Vbox();
|
||||
vbox.setPack("center");
|
||||
LayoutUtils.addSclass("status", vbox);
|
||||
vbox.appendChild(div);
|
||||
vbox.appendChild(west);
|
||||
hbox.appendChild(vbox);
|
||||
|
||||
div = new Div();
|
||||
div.setWidth("100%");
|
||||
div.setStyle("text-align: right; ");
|
||||
div.appendChild(infoLine);
|
||||
div.appendChild(statusDB);
|
||||
east = new Div();
|
||||
east.setWidth("100%");
|
||||
east.setStyle("text-align: right; ");
|
||||
east.appendChild(infoLine);
|
||||
east.appendChild(statusDB);
|
||||
|
||||
LayoutUtils.addSclass("status-db", statusDB);
|
||||
LayoutUtils.addSclass("status-info", infoLine);
|
||||
vbox = new Vbox();
|
||||
vbox.setPack("center");
|
||||
LayoutUtils.addSclass("status", vbox);
|
||||
vbox.appendChild(div);
|
||||
vbox.appendChild(east);
|
||||
hbox.appendChild(vbox);
|
||||
|
||||
this.appendChild(hbox);
|
||||
|
||||
statusDB.addEventListener(Events.ON_CLICK, this);
|
||||
infoLine.setVisible(false);
|
||||
}
|
||||
|
||||
public void setStatusDB (String text)
|
||||
|
@ -130,13 +136,28 @@ public class StatusBarPanel extends Panel implements EventListener
|
|||
statusLine.setTooltiptext(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add Component to East of StatusBar
|
||||
*
|
||||
* @param component
|
||||
* component
|
||||
*/
|
||||
public final void addStatusComponent(final Component component)
|
||||
{
|
||||
east.appendChild(component);
|
||||
} // addStatusComponent
|
||||
|
||||
/**
|
||||
* Set Info Line
|
||||
* @param text text
|
||||
*/
|
||||
public void setInfo (String text)
|
||||
{
|
||||
infoLine.setValue(text);
|
||||
infoLine.setValue(text != null ? text : "");
|
||||
if (text == null || text.trim().length() == 0)
|
||||
infoLine.setVisible(false);
|
||||
else
|
||||
infoLine.setVisible(true);
|
||||
} // setInfo
|
||||
|
||||
public void onEvent(Event event) throws Exception {
|
||||
|
@ -147,7 +168,7 @@ public class StatusBarPanel extends Panel implements EventListener
|
|||
return;
|
||||
|
||||
String title = Msg.getMsg(Env.getCtx(), "Who") + m_text;
|
||||
WRecordInfo info = new WRecordInfo (title, m_dse);
|
||||
new WRecordInfo (title, m_dse);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public class FDialog
|
|||
|
||||
if (title == null)
|
||||
{
|
||||
newTitle = Env.getHeader(ctx, windowNo);
|
||||
newTitle = windowNo > 0 ? Env.getHeader(ctx, windowNo) : null;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -141,7 +141,8 @@ public class FDialog
|
|||
|
||||
try
|
||||
{
|
||||
Messagebox.showDialog(out.toString(), newTitle, Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
String s = out.toString().replace("\n", "<br>");
|
||||
Messagebox.showDialog(s, newTitle, Messagebox.OK, Messagebox.EXCLAMATION);
|
||||
}
|
||||
catch (InterruptedException exception)
|
||||
{
|
||||
|
@ -239,7 +240,8 @@ public class FDialog
|
|||
|
||||
try
|
||||
{
|
||||
Messagebox.showDialog(out.toString(), Env.getHeader(ctx, windowNo), Messagebox.OK, Messagebox.ERROR);
|
||||
String s = out.toString().replace("\n", "<br>");
|
||||
Messagebox.showDialog(s, (windowNo > 0 ? Env.getHeader(ctx, windowNo) : null), Messagebox.OK, Messagebox.ERROR);
|
||||
}
|
||||
catch (InterruptedException exception)
|
||||
{
|
||||
|
@ -267,7 +269,8 @@ public class FDialog
|
|||
out.append(Msg.getMsg(Env.getCtx(), adMessage));
|
||||
if (msg != null && msg.length() > 0)
|
||||
out.append("\n").append(msg);
|
||||
return ask(windowNo, comp, out.toString());
|
||||
String s = out.toString().replace("\n", "<br>");
|
||||
return ask(windowNo, comp, s);
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
|
@ -284,7 +287,8 @@ public class FDialog
|
|||
{
|
||||
try
|
||||
{
|
||||
int response = Messagebox.showDialog(Msg.getMsg(Env.getCtx(), adMessage), "Confirmation", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||
String s = Msg.getMsg(Env.getCtx(), adMessage).replace("\n", "<br>");
|
||||
int response = Messagebox.showDialog(s, "Confirmation", Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
|
||||
|
||||
return (response == Messagebox.YES);
|
||||
}
|
||||
|
@ -343,7 +347,8 @@ public class FDialog
|
|||
|
||||
try
|
||||
{
|
||||
Messagebox.showDialog(out.toString(), Env.getHeader(ctx, windowNo), Messagebox.OK, Messagebox.INFORMATION);
|
||||
String s = out.toString().replace("\n", "<br>");
|
||||
Messagebox.showDialog(s, Env.getHeader(ctx, windowNo), Messagebox.OK, Messagebox.INFORMATION);
|
||||
}
|
||||
catch (InterruptedException exception)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2008 Low Heng Sin *
|
||||
* This program is free software; you can redistribute it and/or modify it *
|
||||
* under the terms version 2 of the GNU General Public License as published *
|
||||
* by the Free Software Foundation. This program is distributed in the hope *
|
||||
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
||||
* See the GNU General Public License for more details. *
|
||||
* You should have received a copy of the GNU General Public License along *
|
||||
* with this program; if not, write to the Free Software Foundation, Inc., *
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||
*****************************************************************************/
|
||||
package org.adempiere.webui.window;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.session.SessionManager;
|
||||
import org.zkoss.util.media.AMedia;
|
||||
import org.zkoss.zul.Iframe;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Low Heng Sin
|
||||
*
|
||||
*/
|
||||
public class SimplePDFViewer extends Window {
|
||||
|
||||
public SimplePDFViewer(String title, InputStream pdfInput) {
|
||||
Iframe iframe = new Iframe();
|
||||
iframe.setId("reportFrame");
|
||||
int height = Double.valueOf(SessionManager.getAppDesktop().getClientInfo().desktopHeight * 0.85).intValue();
|
||||
this.setHeight(height + "px");
|
||||
|
||||
height = height - 30;
|
||||
iframe.setHeight(height + "px");
|
||||
iframe.setWidth("100%");
|
||||
AMedia media = new AMedia(getTitle(), "pdf", "application/pdf", pdfInput);
|
||||
iframe.setContent(media);
|
||||
|
||||
this.setBorder("normal");
|
||||
this.appendChild(iframe);
|
||||
this.setClosable(true);
|
||||
this.setTitle(title);
|
||||
|
||||
int width = Double.valueOf(SessionManager.getAppDesktop().getClientInfo().desktopWidth * 0.80).intValue();
|
||||
this.setWidth(width + "px");
|
||||
}
|
||||
}
|
|
@ -70,8 +70,8 @@ public final class WAccountDialog extends Window
|
|||
{
|
||||
super ();
|
||||
this.setTitle(title);
|
||||
this.setHeight("450px");
|
||||
this.setWidth("650px");
|
||||
this.setHeight("500px");
|
||||
this.setWidth("700px");
|
||||
|
||||
log.config("C_AcctSchema_ID=" + C_AcctSchema_ID
|
||||
+ ", C_ValidCombination_ID=" + mAccount.C_ValidCombination_ID);
|
||||
|
@ -185,7 +185,7 @@ public final class WAccountDialog extends Window
|
|||
//
|
||||
|
||||
northPanel.appendChild(parameterPanel);
|
||||
parameterPanel.setWidth("80%");
|
||||
parameterPanel.setWidth("95%");
|
||||
northPanel.appendChild(toolBar);
|
||||
northPanel.setWidth("100%");
|
||||
|
||||
|
@ -193,15 +193,25 @@ public final class WAccountDialog extends Window
|
|||
|
||||
Borderlayout layout = new Borderlayout();
|
||||
layout.setParent(this);
|
||||
if (AEnv.isFirefox2())
|
||||
{
|
||||
layout.setHeight("93%");
|
||||
layout.setWidth("98%");
|
||||
layout.setStyle("background-color: transparent; position: absolute;");
|
||||
this.setStyle("position: relative;");
|
||||
}
|
||||
else
|
||||
{
|
||||
layout.setHeight("100%");
|
||||
layout.setWidth("100%");
|
||||
layout.setStyle("background-color: transparent;");
|
||||
}
|
||||
|
||||
North nRegion = new North();
|
||||
nRegion.setParent(layout);
|
||||
nRegion.setFlex(true);
|
||||
nRegion.setFlex(false);
|
||||
nRegion.appendChild(northPanel);
|
||||
nRegion.setStyle("background-color: transparent;");
|
||||
nRegion.setStyle("background-color: transparent; border: none");
|
||||
northPanel.setStyle("background-color: transparent;");
|
||||
|
||||
Center cRegion = new Center();
|
||||
|
@ -216,7 +226,7 @@ public final class WAccountDialog extends Window
|
|||
confirmPanel.setStyle("margin-top: 5px; margin-bottom: 5px");
|
||||
div.appendChild(statusBar);
|
||||
sRegion.appendChild(div);
|
||||
sRegion.setStyle("background-color: transparent;");
|
||||
sRegion.setStyle("background-color: transparent; border: none");
|
||||
|
||||
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
||||
|
||||
|
|
|
@ -29,11 +29,11 @@ import org.adempiere.webui.component.Row;
|
|||
import org.adempiere.webui.component.Rows;
|
||||
import org.adempiere.webui.component.Textbox;
|
||||
import org.adempiere.webui.component.ConfirmPanel;
|
||||
import org.adempiere.webui.component.WStatusBar;
|
||||
import org.adempiere.webui.component.Window;
|
||||
import org.adempiere.webui.editor.WSearchEditor;
|
||||
import org.adempiere.webui.event.ValueChangeEvent;
|
||||
import org.adempiere.webui.event.ValueChangeListener;
|
||||
import org.adempiere.webui.panel.StatusBarPanel;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLookupFactory;
|
||||
|
@ -167,7 +167,7 @@ public class WEMailDialog extends Window implements EventListener, ValueChangeLi
|
|||
private Textbox fAttachment = new Textbox();//40);
|
||||
private Textbox fMessage = new Textbox();
|
||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||
private WStatusBar statusBar = new WStatusBar();
|
||||
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||
|
||||
/**
|
||||
* Static Init
|
||||
|
@ -284,7 +284,6 @@ public class WEMailDialog extends Window implements EventListener, ValueChangeLi
|
|||
|
||||
South south = new South();
|
||||
south.appendChild(statusBar);
|
||||
statusBar.setWidth("100%");
|
||||
layout.appendChild(south);
|
||||
south.setStyle("background-color: white");
|
||||
|
||||
|
|
|
@ -309,7 +309,7 @@ public class WPAttributeDialog extends Window implements EventListener
|
|||
row = new Row();
|
||||
row.setParent(rows);
|
||||
m_row++;
|
||||
rows.appendChild(label);
|
||||
row.appendChild(label);
|
||||
row.appendChild(fieldLot);
|
||||
if (m_masi.getM_Lot_ID() != 0)
|
||||
{
|
||||
|
|
|
@ -142,7 +142,7 @@ public class WPAttributeInstance extends Window implements EventListener
|
|||
South south = new South();
|
||||
south.setParent(mainLayout);
|
||||
south.appendChild(confirmPanel);
|
||||
confirmPanel.addEventListener(Events.ON_CLICK, this);
|
||||
confirmPanel.addActionListener(this);
|
||||
} // jbInit
|
||||
|
||||
/** Table Column Layout Info */
|
||||
|
|
|
@ -46,6 +46,11 @@ html,body {
|
|||
width: 48px;
|
||||
}
|
||||
|
||||
.action-text-button {
|
||||
height: 32px;
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
|
||||
background-color: white;
|
||||
}
|
||||
|
@ -253,4 +258,9 @@ tr.tab-desktop-tb-m {
|
|||
|
||||
.status-info {
|
||||
padding-right: 10px;
|
||||
border-left: solid 1px #9CBDFF;
|
||||
}
|
||||
|
||||
.status-border {
|
||||
border: solid 1px #9CBDFF;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue