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.setPage(page);
|
||||||
pd.setClosable(true);
|
pd.setClosable(true);
|
||||||
pd.setWidth("500px");
|
pd.setWidth("500px");
|
||||||
try {
|
pd.doHighlighted();
|
||||||
pd.doModal();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(menu.getAction().equals(MMenu.ACTION_Form))
|
else if(menu.getAction().equals(MMenu.ACTION_Form))
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.webui;
|
package org.adempiere.webui;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.adempiere.webui.session.ServerContext;
|
import org.adempiere.webui.session.ServerContext;
|
||||||
|
@ -23,7 +24,7 @@ import net.sf.cglib.proxy.InvocationHandler;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ServerContextCallback implements InvocationHandler {
|
public class ServerContextCallback implements InvocationHandler, Serializable {
|
||||||
|
|
||||||
public Object invoke(Object proxy, Method method, Object[] args)
|
public Object invoke(Object proxy, Method method, Object[] args)
|
||||||
throws Throwable {
|
throws Throwable {
|
||||||
|
|
|
@ -28,6 +28,9 @@ import java.sql.SQLException;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import javax.servlet.ServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.window.FDialog;
|
import org.adempiere.webui.window.FDialog;
|
||||||
|
@ -44,6 +47,9 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Ini;
|
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
|
* Windows Application Environment and utilities
|
||||||
|
@ -691,4 +697,22 @@ public final class AEnv
|
||||||
}
|
}
|
||||||
return uri;
|
return uri;
|
||||||
} // getImageIcon
|
} // 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
|
} // AEnv
|
||||||
|
|
|
@ -1,8 +1,13 @@
|
||||||
package org.adempiere.webui.apps;
|
package org.adempiere.webui.apps;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
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.VerticalBox;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
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.apps.ProcessCtl;
|
||||||
|
import org.compiere.print.ReportEngine;
|
||||||
import org.compiere.process.ProcessInfo;
|
import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.process.ProcessInfoUtil;
|
import org.compiere.process.ProcessInfoUtil;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
import org.zkoss.zk.au.out.AuEcho;
|
||||||
import org.zkoss.zk.ui.Component;
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.DesktopUnavailableException;
|
import org.zkoss.zk.ui.DesktopUnavailableException;
|
||||||
import org.zkoss.zk.ui.Executions;
|
import org.zkoss.zk.ui.Executions;
|
||||||
|
@ -29,6 +38,13 @@ import org.zkoss.zul.Div;
|
||||||
import org.zkoss.zul.Hbox;
|
import org.zkoss.zul.Hbox;
|
||||||
import org.zkoss.zul.Html;
|
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 *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 2007 Low Heng Sin *
|
* Copyright (C) 2007 Low Heng Sin *
|
||||||
|
@ -334,8 +350,8 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
||||||
m_isLocked = false;
|
m_isLocked = false;
|
||||||
if (Executions.getCurrent() != null)
|
if (Executions.getCurrent() != null)
|
||||||
{
|
{
|
||||||
updateUI(pi);
|
|
||||||
Clients.showBusy(null, false);
|
Clients.showBusy(null, false);
|
||||||
|
updateUI(pi);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -366,17 +382,20 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
||||||
message.setContent(m_messageText.toString());
|
message.setContent(m_messageText.toString());
|
||||||
//message.setCaretPosition(message.getDocument().getLength()); // scroll down
|
//message.setCaretPosition(message.getDocument().getLength()); // scroll down
|
||||||
m_ids = pi.getIDs();
|
m_ids = pi.getIDs();
|
||||||
//
|
|
||||||
bOK.setEnabled(true);
|
|
||||||
|
|
||||||
//no longer needed, hide to give more space to display log
|
//no longer needed, hide to give more space to display log
|
||||||
centerPanel.detach();
|
centerPanel.detach();
|
||||||
invalidate();
|
invalidate();
|
||||||
|
|
||||||
|
Clients.response(new AuEcho(this, "onAfterProcess", null));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onAfterProcess()
|
||||||
|
{
|
||||||
//
|
//
|
||||||
afterProcessTask();
|
afterProcessTask();
|
||||||
// Close automatically
|
// Close automatically
|
||||||
if (m_IsReport && !pi.isError())
|
if (m_IsReport && !m_pi.isError())
|
||||||
this.dispose();
|
this.dispose();
|
||||||
|
|
||||||
// If the process is a silent one and no errors occured, close the dialog
|
// If the process is a silent one and no errors occured, close the dialog
|
||||||
|
@ -407,63 +426,139 @@ public class ProcessDialog extends Window implements EventListener//, ASyncProce
|
||||||
*/
|
*/
|
||||||
private void printShipments()
|
private void printShipments()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (m_ids == null)
|
if (m_ids == null)
|
||||||
return;
|
return;
|
||||||
if (!ADialog.ask(m_WindowNo, this, "PrintShipments"))
|
if (!FDialog.ask(m_WindowNo, this, "PrintShipments"))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("</p>");
|
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintShipments")).append("</p>");
|
||||||
message.setText(m_messageText.toString());
|
message.setContent(m_messageText.toString());
|
||||||
int retValue = ADialogDialog.A_CANCEL;
|
Clients.showBusy("Processing...", true);
|
||||||
do
|
Clients.response(new AuEcho(this, "onPrintShipments", null));
|
||||||
{
|
|
||||||
// Loop through all items
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
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
|
} // 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];
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Print Invoices
|
* Print Invoices
|
||||||
*/
|
*/
|
||||||
private void printInvoices()
|
private void printInvoices()
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
if (m_ids == null)
|
if (m_ids == null)
|
||||||
return;
|
return;
|
||||||
if (!ADialog.ask(m_WindowNo, this, "PrintInvoices"))
|
if (!FDialog.ask(m_WindowNo, this, "PrintInvoices"))
|
||||||
return;
|
return;
|
||||||
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("</p>");
|
m_messageText.append("<p>").append(Msg.getMsg(Env.getCtx(), "PrintInvoices")).append("</p>");
|
||||||
message.setText(m_messageText.toString());
|
message.setContent(m_messageText.toString());
|
||||||
int retValue = ADialogDialog.A_CANCEL;
|
Clients.showBusy("Processing...", true);
|
||||||
do
|
Clients.response(new AuEcho(this, "onPrintInvoices", null));
|
||||||
{
|
|
||||||
// Loop through all items
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
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
|
} // printInvoices
|
||||||
|
|
||||||
|
public void onPrintInvoices()
|
||||||
|
{
|
||||||
|
// Loop through all items
|
||||||
|
List<File> pdfList = new ArrayList<File>();
|
||||||
|
for (int i = 0; i < m_ids.length; i++)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isValid() {
|
public boolean isValid() {
|
||||||
return valid;
|
return valid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,6 @@ import org.adempiere.webui.component.Row;
|
||||||
import org.adempiere.webui.component.Rows;
|
import org.adempiere.webui.component.Rows;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.component.WListbox;
|
import org.adempiere.webui.component.WListbox;
|
||||||
import org.adempiere.webui.component.WStatusBar;
|
|
||||||
import org.adempiere.webui.editor.WDateEditor;
|
import org.adempiere.webui.editor.WDateEditor;
|
||||||
import org.adempiere.webui.editor.WSearchEditor;
|
import org.adempiere.webui.editor.WSearchEditor;
|
||||||
import org.adempiere.webui.editor.WTableDirEditor;
|
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.WTableModelEvent;
|
||||||
import org.adempiere.webui.event.WTableModelListener;
|
import org.adempiere.webui.event.WTableModelListener;
|
||||||
import org.adempiere.webui.panel.ADForm;
|
import org.adempiere.webui.panel.ADForm;
|
||||||
|
import org.adempiere.webui.panel.StatusBarPanel;
|
||||||
import org.adempiere.webui.window.FDialog;
|
import org.adempiere.webui.window.FDialog;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.*;
|
||||||
import org.compiere.process.*;
|
import org.compiere.process.*;
|
||||||
|
@ -85,7 +85,6 @@ public class WAllocation extends ADForm
|
||||||
calculate();
|
calculate();
|
||||||
southPanel.appendChild(new Separator());
|
southPanel.appendChild(new Separator());
|
||||||
southPanel.appendChild(statusBar);
|
southPanel.appendChild(statusBar);
|
||||||
statusBar.setWidth("100%");
|
|
||||||
}
|
}
|
||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
|
@ -140,7 +139,7 @@ public class WAllocation extends ADForm
|
||||||
private WTableDirEditor currencyPick = null;
|
private WTableDirEditor currencyPick = null;
|
||||||
private Checkbox multiCurrency = new Checkbox();
|
private Checkbox multiCurrency = new Checkbox();
|
||||||
private Label allocCurrencyLabel = new Label();
|
private Label allocCurrencyLabel = new Label();
|
||||||
private WStatusBar statusBar = new WStatusBar();
|
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||||
private Label dateLabel = new Label();
|
private Label dateLabel = new Label();
|
||||||
private WDateEditor dateField = new WDateEditor();
|
private WDateEditor dateField = new WDateEditor();
|
||||||
private Checkbox autoWriteOff = new Checkbox();
|
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.Rows;
|
||||||
import org.adempiere.webui.component.WAppsAction;
|
import org.adempiere.webui.component.WAppsAction;
|
||||||
import org.adempiere.webui.component.WListbox;
|
import org.adempiere.webui.component.WListbox;
|
||||||
import org.adempiere.webui.component.WStatusBar;
|
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.editor.WEditor;
|
import org.adempiere.webui.editor.WEditor;
|
||||||
import org.adempiere.webui.editor.WLocatorEditor;
|
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.editor.WStringEditor;
|
||||||
import org.adempiere.webui.event.WTableModelEvent;
|
import org.adempiere.webui.event.WTableModelEvent;
|
||||||
import org.adempiere.webui.event.WTableModelListener;
|
import org.adempiere.webui.event.WTableModelListener;
|
||||||
|
import org.adempiere.webui.panel.StatusBarPanel;
|
||||||
import org.compiere.model.*;
|
import org.compiere.model.*;
|
||||||
import org.compiere.util.*;
|
import org.compiere.util.*;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
@ -177,7 +177,7 @@ public abstract class WCreateFrom extends Window
|
||||||
private Panel southPanel = new Panel();
|
private Panel southPanel = new Panel();
|
||||||
// private Borderlayout southLayout = new Borderlayout();
|
// private Borderlayout southLayout = new Borderlayout();
|
||||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||||
private WStatusBar statusBar = new WStatusBar();
|
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||||
protected WListbox dataTable = ListboxFactory.newDataTable();
|
protected WListbox dataTable = ListboxFactory.newDataTable();
|
||||||
protected Label locatorLabel = new Label();
|
protected Label locatorLabel = new Label();
|
||||||
protected WLocatorEditor locatorField = new WLocatorEditor();
|
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
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
@ -14,271 +14,338 @@
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/**
|
|
||||||
* 2007, Modified by Posterita Ltd.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.adempiere.webui.apps.form;
|
package org.adempiere.webui.apps.form;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.*;
|
||||||
import java.sql.ResultSet;
|
import java.util.logging.*;
|
||||||
|
|
||||||
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
import org.adempiere.webui.component.Grid;
|
import org.adempiere.webui.component.Grid;
|
||||||
|
import org.adempiere.webui.component.GridFactory;
|
||||||
import org.adempiere.webui.component.Label;
|
import org.adempiere.webui.component.Label;
|
||||||
|
import org.adempiere.webui.component.Panel;
|
||||||
import org.adempiere.webui.component.Row;
|
import org.adempiere.webui.component.Row;
|
||||||
import org.adempiere.webui.component.Rows;
|
import org.adempiere.webui.component.Rows;
|
||||||
import org.adempiere.webui.component.ConfirmPanel;
|
|
||||||
import org.adempiere.webui.editor.WEditor;
|
import org.adempiere.webui.editor.WEditor;
|
||||||
import org.adempiere.webui.editor.WSearchEditor;
|
import org.adempiere.webui.editor.WSearchEditor;
|
||||||
import org.adempiere.webui.editor.WTableDirEditor;
|
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.panel.ADForm;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.adempiere.webui.window.FDialog;
|
import org.adempiere.webui.window.FDialog;
|
||||||
import org.compiere.model.MBPartner;
|
import org.compiere.model.*;
|
||||||
import org.compiere.model.MInvoice;
|
import org.compiere.util.*;
|
||||||
import org.compiere.model.MLookup;
|
import org.zkoss.zk.au.out.AuEcho;
|
||||||
import org.compiere.model.MLookupFactory;
|
import org.zkoss.zk.ui.Desktop;
|
||||||
import org.compiere.model.MPayment;
|
import org.zkoss.zk.ui.DesktopUnavailableException;
|
||||||
import org.compiere.model.X_M_Cost;
|
import org.zkoss.zk.ui.Executions;
|
||||||
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.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
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
|
* @author Jorg Janke
|
||||||
* @date Jul 28, 2007
|
* @version $Id: VMerge.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
|
||||||
*/
|
*/
|
||||||
|
public class WMerge extends ADForm
|
||||||
public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
implements EventListener
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private int m_totalCount = 0;
|
||||||
|
/** Error Log */
|
||||||
private static CLogger log = CLogger.getCLogger(WInvoiceGen.class);
|
private StringBuffer m_errorLog = new StringBuffer();
|
||||||
|
/** Connection */
|
||||||
private Grid grdAll;
|
//private Connection m_con = null;
|
||||||
private Rows rows;
|
private Trx m_trx = null;
|
||||||
private Row row;
|
/** Logger */
|
||||||
|
private static CLogger log = CLogger.getCLogger(WMerge.class);
|
||||||
/** 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;
|
|
||||||
|
|
||||||
static private String AD_ORG_ID = "AD_Org_ID";
|
static private String AD_ORG_ID = "AD_Org_ID";
|
||||||
static private String C_BPARTNER_ID = "C_BPartner_ID";
|
static private String C_BPARTNER_ID = "C_BPartner_ID";
|
||||||
static private String AD_USER_ID = "AD_User_ID";
|
static private String AD_USER_ID = "AD_User_ID";
|
||||||
static private String M_PRODUCT_ID = "M_Product_ID";
|
static private String M_PRODUCT_ID = "M_Product_ID";
|
||||||
|
|
||||||
/** Tables to delete (not update) for AD_Org */
|
/** 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 */
|
/** 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 */
|
/** Tables to delete (not update) for C_BPartner */
|
||||||
static private String[] s_delete_BPartner = new String[] {"C_BP_Employee_Acct",
|
static private String[] s_delete_BPartner = new String[]
|
||||||
"C_BP_Vendor_Acct", "C_BP_Customer_Acct", "T_Aging"};
|
{"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",
|
||||||
|
"M_ProductPrice", "M_Product_Costing",
|
||||||
|
"M_Cost", // teo_sarca [ 1704554 ]
|
||||||
|
"M_Product_Trl", "M_Product_Acct"}; // M_Storage
|
||||||
|
|
||||||
/** Tables to delete (not update) for M_Product */
|
private String[] m_columnName = null;
|
||||||
static private String[] s_delete_Product = new String[] {"M_Product_PO", "M_Replenish", "T_Replenish",
|
private Label[] m_label = null;
|
||||||
"M_ProductPrice", "M_Product_Costing",
|
private WEditor[] m_from = null;
|
||||||
"M_Cost", // teo_sarca [ 1704554 ]
|
private WEditor[] m_to = null;
|
||||||
"M_Product_Trl", "M_Product_Acct"}; // M_Storage
|
private String[] m_deleteTables = null;
|
||||||
|
|
||||||
private String[] m_columnName = new String[]{"AD_Org_ID", "C_BPartner_ID", "AD_User_ID", "M_Product_ID"};
|
|
||||||
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()
|
protected void initForm()
|
||||||
{
|
{
|
||||||
grdAll = new Grid();
|
log.info( "VMerge.init - WinNo=" + m_WindowNo);
|
||||||
grdAll.setWidth("700px");
|
try
|
||||||
|
|
||||||
/*btnCancel = new Button();
|
|
||||||
btnCancel.setImage("/images/Cancel24.png");
|
|
||||||
btnCancel.addEventListener(Events.ON_CLICK, this);
|
|
||||||
|
|
||||||
btnOk = new Button();
|
|
||||||
btnOk.setImage("/images/Ok24.png");
|
|
||||||
btnOk.addEventListener(Events.ON_CLICK, this);*/
|
|
||||||
|
|
||||||
m_pnlConfirm = new ConfirmPanel(true);
|
|
||||||
m_pnlConfirm.addActionListener(this);
|
|
||||||
|
|
||||||
initComponents();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initComponents()
|
|
||||||
{
|
|
||||||
this.setWidth("710px");
|
|
||||||
this.setBorder("normal");
|
|
||||||
|
|
||||||
components();
|
|
||||||
|
|
||||||
rows = new Rows();
|
|
||||||
|
|
||||||
// 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 = new Row();
|
preInit();
|
||||||
row.appendChild(from[i].getLabel());
|
jbInit ();
|
||||||
row.appendChild(from[i].getComponent());
|
}
|
||||||
row.appendChild(to[i].getComponent());
|
catch (Exception ex)
|
||||||
rows.appendChild(row);
|
{
|
||||||
|
log.log(Level.SEVERE, "", ex);
|
||||||
|
}
|
||||||
|
} // init
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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];
|
||||||
|
|
||||||
|
// ** 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
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
grdAll.appendChild(rows);
|
} // preInit
|
||||||
this.appendChild(grdAll);
|
|
||||||
|
|
||||||
// Row 6
|
/**
|
||||||
this.appendChild(m_pnlConfirm);
|
* Static init
|
||||||
}
|
* @throws java.lang.Exception
|
||||||
|
*/
|
||||||
private void components()
|
void jbInit () throws Exception
|
||||||
{
|
{
|
||||||
MLookup lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo,
|
this.appendChild (mainLayout);
|
||||||
0, AD_Column_ID[0], DisplayType.TableDir);
|
mainLayout.setHeight("100%");
|
||||||
|
mainLayout.setWidth("100%");
|
||||||
|
//
|
||||||
|
South south = new South();
|
||||||
|
mainLayout.appendChild(south);
|
||||||
|
south.appendChild(confirmPanel);
|
||||||
|
confirmPanel.addActionListener(this);
|
||||||
|
//
|
||||||
|
Rows rows = centerLayout.newRows();
|
||||||
|
|
||||||
from[0] = new WTableDirEditor(lookup, Msg.translate(
|
//
|
||||||
Env.getCtx(), text[0]), "from", true, false, true);
|
CenterPanel.appendChild(centerLayout);
|
||||||
|
|
||||||
from[0].addValueChangeListener(this);
|
Center center = new Center();
|
||||||
|
mainLayout.appendChild(center);
|
||||||
|
center.appendChild(CenterPanel);
|
||||||
|
|
||||||
to[0] = new WTableDirEditor(lookup, Msg.translate(
|
Row row = rows.newRow();
|
||||||
Env.getCtx(), text[0]), "to", true, false, true);
|
row.appendChild(new Label());
|
||||||
|
row.appendChild(mergeFromLabel);
|
||||||
to[0].addValueChangeListener(this);
|
row.appendChild(mergeToLabel);
|
||||||
|
//
|
||||||
|
mergeFromLabel.setText (Msg.getMsg(Env.getCtx(), "MergeFrom"));
|
||||||
// Search Editors
|
mergeFromLabel.setStyle("font-weight: bold");
|
||||||
|
mergeToLabel.setText (Msg.getMsg(Env.getCtx(), "MergeTo"));
|
||||||
for (int i = 1; i < AD_Column_ID.length; i++)
|
mergeToLabel.setStyle("font-weight: bold");
|
||||||
|
//
|
||||||
|
for (int i = 0; i < m_label.length; i++)
|
||||||
{
|
{
|
||||||
lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo,
|
row = rows.newRow();
|
||||||
0, AD_Column_ID[i], DisplayType.Search);
|
row.appendChild(m_label[i]);
|
||||||
|
row.appendChild(m_from[i].getComponent());
|
||||||
from[i] = new WSearchEditor(lookup, Msg.translate(
|
row.appendChild(m_to[i].getComponent());
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
} // jbInit
|
||||||
|
|
||||||
public void valueChange(ValueChangeEvent evt)
|
/**
|
||||||
|
* Dispose
|
||||||
|
*/
|
||||||
|
public void dispose()
|
||||||
{
|
{
|
||||||
if (evt == null)
|
SessionManager.getAppDesktop().removeWindow();
|
||||||
|
} // dispose
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Action Listener
|
||||||
|
* @param e event
|
||||||
|
*/
|
||||||
|
public void onEvent (Event e)
|
||||||
|
{
|
||||||
|
if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
|
||||||
{
|
{
|
||||||
|
dispose();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//
|
||||||
WEditor edit = (WEditor)evt.getSource();
|
String columnName = null;
|
||||||
String des = edit.getDescription();
|
String from_Info = null;
|
||||||
|
String to_Info = null;
|
||||||
String name = evt.getPropertyName();
|
int from_ID = 0;
|
||||||
Object value = evt.getNewValue();
|
int to_ID = 0;
|
||||||
|
// get first merge pair
|
||||||
|
for (int i = 0; (i < m_columnName.length && from_ID == 0 && to_ID == 0); i++)
|
||||||
if (name.equals("AD_Org_ID"))
|
|
||||||
{
|
{
|
||||||
if (des.equals("from"))
|
Object value = m_from[i].getValue();
|
||||||
|
if (value != null)
|
||||||
{
|
{
|
||||||
from[0].setValue(value);
|
if (value instanceof Integer)
|
||||||
fromIDs[0] = ((Integer)value).intValue();
|
from_ID = ((Integer)value).intValue();
|
||||||
}
|
else
|
||||||
else
|
continue;
|
||||||
{
|
value = m_to[i].getValue();
|
||||||
to[0].setValue(value);
|
if (value != null && value instanceof Integer)
|
||||||
toIDs[0] = ((Integer)value).intValue();
|
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;
|
||||||
}
|
}
|
||||||
else if (name.equals("C_BPartner_ID"))
|
public void run() {
|
||||||
{
|
//get full control of desktop
|
||||||
if (des.equals("from"))
|
try {
|
||||||
{
|
Executions.activate(desktop);
|
||||||
from[1].setValue(value);
|
try {
|
||||||
fromIDs[1] = ((Integer)value).intValue();
|
m_success = merge (columnName, from_ID, to_ID);
|
||||||
}
|
postMerge(columnName, to_ID);
|
||||||
else
|
} finally{
|
||||||
{
|
Clients.showBusy(null, false);
|
||||||
to[1].setValue(value);
|
Clients.response(new AuEcho(WMerge.this, "onAfterProcess", null));
|
||||||
toIDs[1] = ((Integer)value).intValue();
|
//release full control of desktop
|
||||||
}
|
Executions.deactivate(desktop);
|
||||||
}
|
}
|
||||||
else if (name.equals("M_Product_ID"))
|
} catch (DesktopUnavailableException e) {
|
||||||
{
|
log.log(Level.SEVERE, e.getLocalizedMessage(), e);
|
||||||
if (des.equals("from"))
|
} catch (InterruptedException e) {
|
||||||
{
|
log.log(Level.WARNING, e.getLocalizedMessage(), e);
|
||||||
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();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onAfterProcess()
|
||||||
|
{
|
||||||
|
if (m_success)
|
||||||
|
{
|
||||||
|
FDialog.info (m_WindowNo, this, "MergeSuccess",
|
||||||
|
m_msg + " #" + m_totalCount);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FDialog.error(m_WindowNo, this, "MergeError",
|
||||||
|
m_errorLog.toString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dispose();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 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)
|
private boolean merge (String ColumnName, int from_ID, int to_ID)
|
||||||
{
|
{
|
||||||
String TableName = ColumnName.substring(0, ColumnName.length()-3);
|
String TableName = ColumnName.substring(0, ColumnName.length()-3);
|
||||||
|
log.config(ColumnName
|
||||||
//log.config(ColumnName + " - From=" + from_ID + ",To=" + to_ID);
|
+ " - From=" + from_ID + ",To=" + to_ID);
|
||||||
|
|
||||||
boolean success = true;
|
boolean success = true;
|
||||||
m_totalCount = 0;
|
m_totalCount = 0;
|
||||||
m_errorLog = new StringBuffer();
|
m_errorLog = new StringBuffer();
|
||||||
|
|
||||||
String sql = "SELECT t.TableName, c.ColumnName "
|
String sql = "SELECT t.TableName, c.ColumnName "
|
||||||
+ "FROM AD_Table t"
|
+ "FROM AD_Table t"
|
||||||
+ " INNER JOIN AD_Column c ON (t.AD_Table_ID=c.AD_Table_ID) "
|
+ " 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
|
+ "WHERE cc.IsKey='Y' AND cc.ColumnName=?)" // #2
|
||||||
+ ") "
|
+ ") "
|
||||||
+ "ORDER BY t.LoadSeq DESC";
|
+ "ORDER BY t.LoadSeq DESC";
|
||||||
|
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
m_trx = Trx.get(Trx.createTrxName("merge"), true);
|
m_trx = Trx.get(Trx.createTrxName("merge"), true);
|
||||||
|
//
|
||||||
pstmt = DB.prepareStatement(sql, Trx.createTrxName());
|
pstmt = DB.prepareStatement(sql, Trx.createTrxName());
|
||||||
pstmt.setString(1, ColumnName);
|
pstmt.setString(1, ColumnName);
|
||||||
pstmt.setString(2, ColumnName);
|
pstmt.setString(2, ColumnName);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
String tName = rs.getString(1);
|
String tName = rs.getString(1);
|
||||||
String cName = rs.getString(2);
|
String cName = rs.getString(2);
|
||||||
|
|
||||||
if (!TableName.equals(tName)) // to be sure - sql should prevent it
|
if (!TableName.equals(tName)) // to be sure - sql should prevent it
|
||||||
{
|
{
|
||||||
int count = mergeTable (tName, cName, from_ID, to_ID);
|
int count = mergeTable (tName, cName, from_ID, to_ID);
|
||||||
|
|
||||||
if (count < 0)
|
if (count < 0)
|
||||||
success = false;
|
success = false;
|
||||||
else
|
else
|
||||||
|
@ -324,24 +387,28 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
||||||
rs.close();
|
rs.close();
|
||||||
pstmt.close();
|
pstmt.close();
|
||||||
pstmt = null;
|
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)
|
if (success)
|
||||||
{
|
{
|
||||||
sql = "DELETE " + TableName + " WHERE " + ColumnName + "=" + from_ID;
|
sql = "DELETE " + TableName + " WHERE " + ColumnName + "=" + from_ID;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ( DB.executeUpdate(sql, m_trx.getTrxName()) < 0 )
|
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;
|
success = false;
|
||||||
//log.config(m_errorLog.toString());
|
log.config(m_errorLog.toString());
|
||||||
m_trx.rollback();
|
m_trx.rollback();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
//
|
||||||
if (success)
|
if (success)
|
||||||
m_trx.commit();
|
m_trx.commit();
|
||||||
else
|
else
|
||||||
|
@ -352,22 +419,22 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
// log.log(Level.SEVERE, ColumnName, ex);
|
log.log(Level.SEVERE, ColumnName, ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cleanup
|
// Cleanup
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (pstmt != null)
|
if (pstmt != null)
|
||||||
pstmt.close();
|
pstmt.close();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
pstmt = null;
|
pstmt = null;
|
||||||
return success;
|
return success;
|
||||||
}
|
} // merge
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merge Table
|
* Merge Table
|
||||||
|
@ -377,17 +444,13 @@ public class WMerge extends ADForm implements EventListener, ValueChangeListener
|
||||||
* @param to_ID to
|
* @param to_ID to
|
||||||
* @return -1 for error or number of changes
|
* @return -1 for error or number of changes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private int mergeTable (String TableName, String ColumnName, int from_ID, int to_ID)
|
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
|
String sql = "UPDATE " + TableName
|
||||||
+ " SET " + ColumnName + "=" + to_ID
|
+ " SET " + ColumnName + "=" + to_ID
|
||||||
+ " WHERE " + ColumnName + "=" + from_ID;
|
+ " WHERE " + ColumnName + "=" + from_ID;
|
||||||
|
|
||||||
boolean delete = false;
|
boolean delete = false;
|
||||||
|
|
||||||
for (int i = 0; i < m_deleteTables.length; i++)
|
for (int i = 0; i < m_deleteTables.length; i++)
|
||||||
{
|
{
|
||||||
if (m_deleteTables[i].equals(TableName))
|
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;
|
sql = "DELETE " + TableName + " WHERE " + ColumnName + "=" + from_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete newly created MCost records - teo_sarca [ 1704554 ]
|
// Delete newly created MCost records - teo_sarca [ 1704554 ]
|
||||||
if (delete && X_M_Cost.Table_Name.equals(TableName) && M_PRODUCT_ID.equals(ColumnName))
|
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 )
|
if ( count < 0 )
|
||||||
{
|
{
|
||||||
|
|
||||||
count = -1;
|
count = -1;
|
||||||
m_errorLog.append(Env.NL).append(delete ? "DELETE " : "UPDATE ").append(TableName).append(" - ").append(" - ").append(sql);
|
m_errorLog.append(Env.NL)
|
||||||
//log.config(m_errorLog.toString());
|
.append(delete ? "DELETE " : "UPDATE ")
|
||||||
|
.append(TableName).append(" - ")
|
||||||
|
.append(" - ").append(sql);
|
||||||
|
log.config(m_errorLog.toString());
|
||||||
m_trx.rollback();
|
m_trx.rollback();
|
||||||
|
|
||||||
}
|
}
|
||||||
//log.fine(count + (delete ? " -Delete- " : " -Update- ") + TableName);
|
log.fine(count
|
||||||
|
+ (delete ? " -Delete- " : " -Update- ") + TableName);
|
||||||
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
} // mergeTable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post Merge
|
* Post Merge
|
||||||
* @param ColumnName column name
|
* @param ColumnName column name
|
||||||
* @param to_ID ID
|
* @param to_ID ID
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void postMerge (String ColumnName, int to_ID)
|
private void postMerge (String ColumnName, int to_ID)
|
||||||
{
|
{
|
||||||
if (ColumnName.equals(AD_ORG_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++)
|
} // VMerge
|
||||||
{
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* Product: Adempiere ERP & CRM Smart Business Solution *
|
* Product: Adempiere ERP & CRM Smart Business Solution *
|
||||||
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* 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 *
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
@ -14,128 +14,94 @@
|
||||||
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
|
||||||
* or via info@compiere.org or http://www.compiere.org/license.html *
|
* or via info@compiere.org or http://www.compiere.org/license.html *
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
/**
|
|
||||||
* 2007, Modified by Posterita Ltd.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.adempiere.webui.apps.form;
|
package org.adempiere.webui.apps.form;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.sql.*;
|
||||||
import java.sql.PreparedStatement;
|
import java.util.*;
|
||||||
import java.sql.ResultSet;
|
import java.util.logging.*;
|
||||||
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 org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
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.ConfirmPanel;
|
||||||
import org.adempiere.webui.component.Datebox;
|
|
||||||
import org.adempiere.webui.component.Grid;
|
import org.adempiere.webui.component.Grid;
|
||||||
|
import org.adempiere.webui.component.GridFactory;
|
||||||
import org.adempiere.webui.component.Label;
|
import org.adempiere.webui.component.Label;
|
||||||
import org.adempiere.webui.component.Panel;
|
import org.adempiere.webui.component.Panel;
|
||||||
import org.adempiere.webui.component.Row;
|
import org.adempiere.webui.component.Row;
|
||||||
import org.adempiere.webui.component.Rows;
|
import org.adempiere.webui.component.Rows;
|
||||||
import org.adempiere.webui.component.VerticalBox;
|
import org.adempiere.webui.editor.WDateEditor;
|
||||||
import org.adempiere.webui.component.WStatusBar;
|
|
||||||
import org.adempiere.webui.editor.WEditor;
|
|
||||||
import org.adempiere.webui.editor.WLocatorEditor;
|
import org.adempiere.webui.editor.WLocatorEditor;
|
||||||
import org.adempiere.webui.editor.WSearchEditor;
|
import org.adempiere.webui.editor.WSearchEditor;
|
||||||
import org.adempiere.webui.editor.WTableDirEditor;
|
import org.adempiere.webui.editor.WTableDirEditor;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.event.ValueChangeListener;
|
import org.adempiere.webui.event.ValueChangeListener;
|
||||||
import org.adempiere.webui.panel.ADForm;
|
import org.adempiere.webui.panel.ADForm;
|
||||||
import org.compiere.model.GridField;
|
import org.adempiere.webui.panel.ADTabpanel;
|
||||||
import org.compiere.model.GridTab;
|
import org.adempiere.webui.panel.StatusBarPanel;
|
||||||
import org.compiere.model.GridTable;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
import org.compiere.model.GridWindow;
|
import org.compiere.model.*;
|
||||||
import org.compiere.model.GridWindowVO;
|
import org.compiere.util.*;
|
||||||
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.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zkex.zul.Borderlayout;
|
||||||
import org.zkoss.zul.Hbox;
|
import org.zkoss.zkex.zul.Center;
|
||||||
|
import org.zkoss.zkex.zul.North;
|
||||||
|
import org.zkoss.zkex.zul.South;
|
||||||
import org.zkoss.zul.Separator;
|
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 */
|
/** GridController */
|
||||||
private Grid m_gridController = new Grid();
|
private ADTabpanel m_gridController = null;
|
||||||
private Columns columns = new Columns();
|
|
||||||
private Rows rows = new Rows();
|
|
||||||
|
|
||||||
/** MWindow */
|
/** MWindow */
|
||||||
private GridWindow m_mWindow = null;
|
private GridWindow m_mWindow = null;
|
||||||
|
|
||||||
/** MTab pointer */
|
/** MTab pointer */
|
||||||
private GridTab m_mTab = null;
|
private GridTab m_mTab = null;
|
||||||
|
|
||||||
private MQuery m_staticQuery = null;
|
|
||||||
|
|
||||||
|
private MQuery m_staticQuery = null;
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(WTrxMaterial.class);
|
private static CLogger log = CLogger.getCLogger(WTrxMaterial.class);
|
||||||
|
//
|
||||||
private VerticalBox mainPanel = new VerticalBox();
|
private Panel mainPanel = new Panel();
|
||||||
private Hbox parameterPanel = new Hbox();
|
private Borderlayout mainLayout = new Borderlayout();
|
||||||
|
private Panel parameterPanel = new Panel();
|
||||||
private Label orgLabel = new Label();
|
private Label orgLabel = new Label();
|
||||||
private WEditor orgField;
|
private WTableDirEditor orgField;
|
||||||
private Label locatorLabel = new Label();
|
private Label locatorLabel = new Label();
|
||||||
private WLocatorEditor locatorField;
|
private WLocatorEditor locatorField;
|
||||||
private Label productLabel = new Label();
|
private Label productLabel = new Label();
|
||||||
private WEditor productField;
|
private WSearchEditor productField;
|
||||||
private Label dateFLabel = new Label();
|
private Label dateFLabel = new Label();
|
||||||
private Datebox dateFField;
|
private WDateEditor dateFField;
|
||||||
private Label dateTLabel = new Label();
|
private Label dateTLabel = new Label();
|
||||||
private Datebox dateTField;
|
private WDateEditor dateTField;
|
||||||
private Label mtypeLabel = new Label();
|
private Label mtypeLabel = new Label();
|
||||||
private WEditor mtypeField;
|
private WTableDirEditor mtypeField;
|
||||||
|
private Grid parameterLayout = GridFactory.newGridLayout();
|
||||||
private Panel southPanel = new Panel();
|
private Panel southPanel = new Panel();
|
||||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true, true, false, false, false, true);
|
private ConfirmPanel confirmPanel = new ConfirmPanel(true, true, false, false, false, true, false);
|
||||||
private WStatusBar statusBar = new WStatusBar();
|
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||||
|
|
||||||
public WTrxMaterial()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Panel
|
* Initialize Panel
|
||||||
* @param WindowNo window
|
|
||||||
* @param frame frame
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected void initForm()
|
protected void initForm()
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
dynParameter();
|
dynParameter();
|
||||||
jbInit();
|
zkInit();
|
||||||
dynInit();
|
dynInit();
|
||||||
|
|
||||||
this.appendChild(mainPanel);
|
|
||||||
this.appendChild(statusBar);
|
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -147,129 +113,81 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
||||||
* Static Init
|
* Static Init
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
|
void zkInit() throws Exception
|
||||||
void jbInit() throws Exception
|
|
||||||
{
|
{
|
||||||
orgLabel.setValue(Msg.translate(Env.getCtx(), "AD_Org_ID"));
|
this.appendChild(mainPanel);
|
||||||
locatorLabel.setValue(Msg.translate(Env.getCtx(), "M_Locator_ID"));
|
mainPanel.setStyle("width: 99%; height: 100%; border: none; padding: 0; margin: 0");
|
||||||
productLabel.setValue(Msg.translate(Env.getCtx(), "Product"));
|
mainPanel.appendChild(mainLayout);
|
||||||
dateFLabel.setValue(Msg.translate(Env.getCtx(), "DateFrom"));
|
mainLayout.setWidth("100%");
|
||||||
dateTLabel.setValue(Msg.translate(Env.getCtx(), "DateTo"));
|
mainLayout.setHeight("100%");
|
||||||
mtypeLabel.setValue(Msg.translate(Env.getCtx(), "MovementType"));
|
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");
|
Rows rows = parameterLayout.newRows();
|
||||||
m_gridController.setHeight("550px");
|
Row row = rows.newRow();
|
||||||
|
row.appendChild(orgLabel.rightAlign());
|
||||||
mainPanel.setWidth("100%");
|
row.appendChild(orgField.getComponent());
|
||||||
mainPanel.appendChild(new Separator());
|
row.appendChild(mtypeLabel.rightAlign());
|
||||||
mainPanel.appendChild(parameterPanel);
|
row.appendChild(mtypeField.getComponent());
|
||||||
mainPanel.appendChild(new Separator());
|
row.appendChild(dateFLabel.rightAlign());
|
||||||
mainPanel.appendChild(m_gridController);
|
row.appendChild(dateFField.getComponent());
|
||||||
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);
|
|
||||||
|
|
||||||
|
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(confirmPanel);
|
||||||
southPanel.appendChild(new Separator());
|
southPanel.appendChild(new Separator());
|
||||||
southPanel.appendChild(statusBar);
|
southPanel.appendChild(statusBar);
|
||||||
|
South south = new South();
|
||||||
|
south.setStyle("border: none");
|
||||||
|
mainLayout.appendChild(south);
|
||||||
|
south.appendChild(southPanel);
|
||||||
|
|
||||||
mainPanel.appendChild(southPanel);
|
LayoutUtils.addSclass("status-border", statusBar);
|
||||||
|
} // jbInit
|
||||||
this.setWidth("100%");
|
|
||||||
this.appendChild(mainPanel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize Parameter fields
|
* Initialize Parameter fields
|
||||||
* @throws Exception if Lookups cannot be initialized
|
* @throws Exception if Lookups cannot be initialized
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void dynParameter() throws Exception
|
private void dynParameter() throws Exception
|
||||||
{
|
{
|
||||||
Properties ctx = Env.getCtx();
|
Properties ctx = Env.getCtx();
|
||||||
// Organization
|
// Organization
|
||||||
|
|
||||||
MLookup orgLookup = MLookupFactory.get (ctx, m_WindowNo, 0, 3660, DisplayType.TableDir);
|
MLookup orgLookup = MLookupFactory.get (ctx, m_WindowNo, 0, 3660, DisplayType.TableDir);
|
||||||
orgField = new WTableDirEditor(orgLookup, "AD_Org_ID", "", false, false, true);
|
orgField = new WTableDirEditor("AD_Org_ID", false, false, true, orgLookup);
|
||||||
orgField.addValueChangeListener(this);
|
// orgField.addVetoableChangeListener(this);
|
||||||
|
|
||||||
// Locator
|
// Locator
|
||||||
MLocatorLookup locatorLookup = new MLocatorLookup(ctx, m_WindowNo);
|
MLocatorLookup locatorLookup = new MLocatorLookup(ctx, m_WindowNo);
|
||||||
locatorField = new WLocatorEditor ("M_Locator_ID", false, false, true, locatorLookup, m_WindowNo);
|
locatorField = new WLocatorEditor ("M_Locator_ID", false, false, true, locatorLookup, m_WindowNo);
|
||||||
locatorField.addValueChangeListener(this);
|
// locatorField.addVetoableChangeListener(this);
|
||||||
|
|
||||||
// Product
|
// Product
|
||||||
MLookup productLookup = MLookupFactory.get (ctx, m_WindowNo, 0, 3668, DisplayType.Search);
|
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);
|
productField.addValueChangeListener(this);
|
||||||
|
|
||||||
// Movement Type
|
// Movement Type
|
||||||
MLookup mtypeLookup = MLookupFactory.get (ctx, m_WindowNo, 0, 3666, DisplayType.List);
|
MLookup mtypeLookup = MLookupFactory.get (ctx, m_WindowNo, 0, 3666, DisplayType.List);
|
||||||
mtypeField = new WTableDirEditor(mtypeLookup, "MovementType", "", false, false, true);
|
mtypeField = new WTableDirEditor("MovementType", false, false, true, mtypeLookup);
|
||||||
mtypeField.addValueChangeListener(this);
|
// Dates
|
||||||
|
dateFField = new WDateEditor("DateFrom", false, false, true, DisplayType.Date, Msg.getMsg(Env.getCtx(), "DateFrom"));
|
||||||
// Dates
|
dateTField = new WDateEditor("DateTo", false, false, true, DisplayType.Date, Msg.getMsg(Env.getCtx(), "DateTo"));
|
||||||
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(this);
|
||||||
|
|
||||||
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
|
||||||
statusBar.setStatusLine("");
|
statusBar.setStatusLine("");
|
||||||
} // dynParameter
|
} // 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()));
|
m_staticQuery.addRestriction("AD_Client_ID", MQuery.EQUAL, Env.getAD_Client_ID(Env.getCtx()));
|
||||||
int AD_Window_ID = 223; // Hardcoded
|
int AD_Window_ID = 223; // Hardcoded
|
||||||
GridWindowVO wVO = AEnv.getMWindowVO (m_WindowNo, AD_Window_ID, 0);
|
GridWindowVO wVO = AEnv.getMWindowVO (m_WindowNo, AD_Window_ID, 0);
|
||||||
|
|
||||||
if (wVO == null)
|
if (wVO == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_mWindow = new GridWindow (wVO);
|
m_mWindow = new GridWindow (wVO);
|
||||||
m_mTab = m_mWindow.getTab(0);
|
m_mTab = m_mWindow.getTab(0);
|
||||||
m_mWindow.initTab(0);
|
m_mWindow.initTab(0);
|
||||||
|
//
|
||||||
populateGrid();
|
m_gridController = new ADTabpanel();
|
||||||
|
m_gridController.init(null, m_WindowNo, m_mTab, m_mWindow);
|
||||||
//m_gridController.initGrid(m_mTab, true, m_WindowNo, null, null);
|
m_gridController.switchRowPresentation();
|
||||||
//mainPanel.add(m_gridController, BorderLayout.CENTER);
|
Center center = new Center();
|
||||||
|
mainLayout.appendChild(center);
|
||||||
|
center.setFlex(true);
|
||||||
|
center.appendChild(m_gridController);
|
||||||
|
//
|
||||||
m_mTab.setQuery(MQuery.getEqualQuery("1", "2"));
|
m_mTab.setQuery(MQuery.getEqualQuery("1", "2"));
|
||||||
m_mTab.query(false);
|
m_mTab.query(false);
|
||||||
statusBar.setStatusLine(" ", false);
|
statusBar.setStatusLine(" ", false);
|
||||||
statusBar.setStatusDB(" ");
|
statusBar.setStatusDB(" ");
|
||||||
} // dynInit
|
} // 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
|
* Dispose
|
||||||
*/
|
*/
|
||||||
public void dispose()
|
public void dispose()
|
||||||
{
|
{
|
||||||
/*if (m_gridController != null)
|
SessionManager.getAppDesktop().removeWindow();
|
||||||
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;
|
|
||||||
} // dispose
|
} // dispose
|
||||||
|
|
||||||
|
|
||||||
|
@ -411,93 +235,61 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
||||||
* Action Listener
|
* Action Listener
|
||||||
* @param e event
|
* @param e event
|
||||||
*/
|
*/
|
||||||
|
public void onEvent (Event e)
|
||||||
public void onEvent(Event event) throws Exception
|
|
||||||
{
|
{
|
||||||
if (confirmPanel.getButton("Cancel").equals(event.getTarget()))
|
if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
|
||||||
dispose();
|
dispose();
|
||||||
else if (confirmPanel.getButton("Refresh").equals(event.getTarget())
|
else if (e.getTarget().getId().equals(ConfirmPanel.A_REFRESH)
|
||||||
|| confirmPanel.getButton("Ok").equals(event.getTarget()))
|
|| e.getTarget().getId().equals(ConfirmPanel.A_OK))
|
||||||
refresh();
|
refresh();
|
||||||
else if (confirmPanel.getButton("Zoom").equals(event.getTarget()))
|
else if (e.getTarget().getId().equals(ConfirmPanel.A_ZOOM))
|
||||||
zoom();
|
zoom();
|
||||||
|
} // actionPerformed
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Property Listener
|
* Property Listener
|
||||||
* @param e event
|
* @param e event
|
||||||
*/
|
*/
|
||||||
|
public void valueChange (ValueChangeEvent e)
|
||||||
public void valueChange(ValueChangeEvent evt)
|
|
||||||
{
|
{
|
||||||
if (evt.getPropertyName().equals("M_Product_ID"))
|
if (e.getPropertyName().equals("M_Product_ID"))
|
||||||
productField.setValue(evt.getNewValue());
|
productField.setValue(e.getNewValue());
|
||||||
}
|
} // vetoableChange
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Refresh - Create Query and refresh grid
|
* Refresh - Create Query and refresh grid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void refresh()
|
private void refresh()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Create Where Clause
|
* Create Where Clause
|
||||||
*/
|
*/
|
||||||
|
|
||||||
MQuery query = m_staticQuery.deepCopy();
|
MQuery query = m_staticQuery.deepCopy();
|
||||||
|
|
||||||
// Organization
|
// Organization
|
||||||
Object value = null;
|
Object value = orgField.getValue();
|
||||||
if (orgField.getDisplay() != "")
|
|
||||||
value = orgField.getValue();
|
|
||||||
if (value != null && value.toString().length() > 0)
|
if (value != null && value.toString().length() > 0)
|
||||||
query.addRestriction("AD_Org_ID", MQuery.EQUAL, value);
|
query.addRestriction("AD_Org_ID", MQuery.EQUAL, value);
|
||||||
|
|
||||||
// Locator
|
// Locator
|
||||||
value = null;
|
value = locatorField.getValue();
|
||||||
if (locatorField.getDisplay() != "")
|
|
||||||
value = locatorField.getValue();
|
|
||||||
if (value != null && value.toString().length() > 0)
|
if (value != null && value.toString().length() > 0)
|
||||||
query.addRestriction("M_Locator_ID", MQuery.EQUAL, value);
|
query.addRestriction("M_Locator_ID", MQuery.EQUAL, value);
|
||||||
|
|
||||||
// Product
|
// Product
|
||||||
value = null;
|
value = productField.getValue();
|
||||||
if (productField.getDisplay() != "")
|
|
||||||
value = productField.getValue();
|
|
||||||
if (value != null && value.toString().length() > 0)
|
if (value != null && value.toString().length() > 0)
|
||||||
query.addRestriction("M_Product_ID", MQuery.EQUAL, value);
|
query.addRestriction("M_Product_ID", MQuery.EQUAL, value);
|
||||||
|
|
||||||
// MovementType
|
// MovementType
|
||||||
value = null;
|
value = mtypeField.getValue();
|
||||||
if (mtypeField.getDisplay() != "")
|
|
||||||
value = mtypeField.getValue();
|
|
||||||
if (value != null && value.toString().length() > 0)
|
if (value != null && value.toString().length() > 0)
|
||||||
query.addRestriction("MovementType", MQuery.EQUAL, value);
|
query.addRestriction("MovementType", MQuery.EQUAL, value);
|
||||||
|
|
||||||
// DateFrom
|
// DateFrom
|
||||||
Date f = null;
|
Timestamp ts = (Timestamp)dateFField.getValue();
|
||||||
Timestamp ts =null;
|
|
||||||
|
|
||||||
if (dateFField.getValue() != null)
|
|
||||||
{
|
|
||||||
f = dateFField.getValue();
|
|
||||||
ts = new Timestamp(f.getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ts != null)
|
if (ts != null)
|
||||||
query.addRestriction("TRUNC(MovementDate)", MQuery.GREATER_EQUAL, ts);
|
query.addRestriction("TRUNC(MovementDate)", MQuery.GREATER_EQUAL, ts);
|
||||||
|
|
||||||
// DateTO
|
// DateTO
|
||||||
Date t = null;
|
ts = (Timestamp)dateTField.getValue();
|
||||||
ts = null;
|
|
||||||
|
|
||||||
if (dateTField.getValue() != null)
|
|
||||||
{
|
|
||||||
t = dateTField.getValue();
|
|
||||||
ts = new Timestamp(t.getTime());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ts != null)
|
if (ts != null)
|
||||||
query.addRestriction("TRUNC(MovementDate)", MQuery.LESS_EQUAL, ts);
|
query.addRestriction("TRUNC(MovementDate)", MQuery.LESS_EQUAL, ts);
|
||||||
log.info( "VTrxMaterial.refresh query=" + query.toString());
|
log.info( "VTrxMaterial.refresh query=" + query.toString());
|
||||||
|
@ -505,37 +297,31 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
||||||
/**
|
/**
|
||||||
* Refresh/Requery
|
* Refresh/Requery
|
||||||
*/
|
*/
|
||||||
|
|
||||||
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "StartSearch"), false);
|
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "StartSearch"), false);
|
||||||
|
//
|
||||||
m_mTab.setQuery(query);
|
m_mTab.setQuery(query);
|
||||||
m_mTab.query(false);
|
m_mTab.query(false);
|
||||||
|
//
|
||||||
int no = m_mTab.getRowCount();
|
int no = m_mTab.getRowCount();
|
||||||
statusBar.setStatusLine(" ", false);
|
statusBar.setStatusLine(" ", false);
|
||||||
statusBar.setStatusDB(Integer.toString(no));
|
statusBar.setStatusDB(Integer.toString(no));
|
||||||
|
|
||||||
populateGrid();
|
|
||||||
} // refresh
|
} // refresh
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zoom
|
* Zoom
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void zoom()
|
private void zoom()
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
|
//
|
||||||
int AD_Window_ID = 0;
|
int AD_Window_ID = 0;
|
||||||
String ColumnName = null;
|
String ColumnName = null;
|
||||||
String SQL = null;
|
String SQL = null;
|
||||||
|
//
|
||||||
int lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_InOutLine_ID");
|
int lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_InOutLine_ID");
|
||||||
|
|
||||||
if (lineID != 0)
|
if (lineID != 0)
|
||||||
{
|
{
|
||||||
log.fine("M_InOutLine_ID=" + lineID);
|
log.fine("M_InOutLine_ID=" + lineID);
|
||||||
|
|
||||||
if (Env.getContext(Env.getCtx(), m_WindowNo, "MovementType").startsWith("C"))
|
if (Env.getContext(Env.getCtx(), m_WindowNo, "MovementType").startsWith("C"))
|
||||||
AD_Window_ID = 169; // Customer
|
AD_Window_ID = 169; // Customer
|
||||||
else
|
else
|
||||||
|
@ -546,7 +332,6 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_InventoryLine_ID");
|
lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_InventoryLine_ID");
|
||||||
|
|
||||||
if (lineID != 0)
|
if (lineID != 0)
|
||||||
{
|
{
|
||||||
log.fine("M_InventoryLine_ID=" + lineID);
|
log.fine("M_InventoryLine_ID=" + lineID);
|
||||||
|
@ -557,7 +342,6 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_MovementLine_ID");
|
lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_MovementLine_ID");
|
||||||
|
|
||||||
if (lineID != 0)
|
if (lineID != 0)
|
||||||
{
|
{
|
||||||
log.fine("M_MovementLine_ID=" + lineID);
|
log.fine("M_MovementLine_ID=" + lineID);
|
||||||
|
@ -568,7 +352,6 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_ProductionLine_ID");
|
lineID = Env.getContextAsInt(Env.getCtx(), m_WindowNo, "M_ProductionLine_ID");
|
||||||
|
|
||||||
if (lineID != 0)
|
if (lineID != 0)
|
||||||
{
|
{
|
||||||
log.fine("M_ProductionLine_ID=" + lineID);
|
log.fine("M_ProductionLine_ID=" + lineID);
|
||||||
|
@ -581,19 +364,16 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AD_Window_ID == 0)
|
if (AD_Window_ID == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get Parent ID
|
// Get Parent ID
|
||||||
int parentID = 0;
|
int parentID = 0;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
|
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
|
||||||
pstmt.setInt(1, lineID);
|
pstmt.setInt(1, lineID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
parentID = rs.getInt(1);
|
parentID = rs.getInt(1);
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -603,21 +383,13 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, SQL, e);
|
log.log(Level.SEVERE, SQL, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
MQuery query = MQuery.getEqualQuery(ColumnName, parentID);
|
MQuery query = MQuery.getEqualQuery(ColumnName, parentID);
|
||||||
log.config("AD_Window_ID=" + AD_Window_ID + " - " + query);
|
log.config("AD_Window_ID=" + AD_Window_ID + " - " + query);
|
||||||
|
|
||||||
if (parentID == 0)
|
if (parentID == 0)
|
||||||
log.log(Level.SEVERE, "No ParentValue - " + SQL + " - " + lineID);
|
log.log(Level.SEVERE, "No ParentValue - " + SQL + " - " + lineID);
|
||||||
|
|
||||||
// Zoom
|
// Zoom
|
||||||
AEnv.zoom(AD_Window_ID, query);
|
AEnv.zoom(AD_Window_ID, query);
|
||||||
/* ADWindow frame = new ADWindow(Env.getCtx(), AD_Window_ID);
|
} // zoom
|
||||||
|
|
||||||
if (frame == null)
|
} // VTrxMaterial
|
||||||
return;
|
|
||||||
|
|
||||||
SessionManager.getAppDesktop().showWindow(frame);
|
|
||||||
frame = null;
|
|
||||||
*/ } // zoom
|
|
||||||
}
|
|
||||||
|
|
|
@ -14,10 +14,10 @@ import org.adempiere.webui.component.Listbox;
|
||||||
import org.adempiere.webui.component.Row;
|
import org.adempiere.webui.component.Row;
|
||||||
import org.adempiere.webui.component.Rows;
|
import org.adempiere.webui.component.Rows;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.component.WStatusBar;
|
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.editor.WSearchEditor;
|
import org.adempiere.webui.editor.WSearchEditor;
|
||||||
import org.adempiere.webui.panel.ADForm;
|
import org.adempiere.webui.panel.ADForm;
|
||||||
|
import org.adempiere.webui.panel.StatusBarPanel;
|
||||||
import org.adempiere.webui.window.FDialog;
|
import org.adempiere.webui.window.FDialog;
|
||||||
import org.compiere.model.MColumn;
|
import org.compiere.model.MColumn;
|
||||||
import org.compiere.model.MLookup;
|
import org.compiere.model.MLookup;
|
||||||
|
@ -89,7 +89,7 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
private WSearchEditor fForward = null; // dynInit
|
private WSearchEditor fForward = null; // dynInit
|
||||||
private Label lForward = new Label(Msg.getMsg(Env.getCtx(), "Forward"));
|
private Label lForward = new Label(Msg.getMsg(Env.getCtx(), "Forward"));
|
||||||
private Label lOptional = new Label("(" + Msg.translate(Env.getCtx(), "Optional") + ")");
|
private Label lOptional = new Label("(" + Msg.translate(Env.getCtx(), "Optional") + ")");
|
||||||
private WStatusBar statusBar = new WStatusBar();
|
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||||
|
|
||||||
public WWFActivity()
|
public WWFActivity()
|
||||||
{
|
{
|
||||||
|
@ -226,7 +226,6 @@ public class WWFActivity extends ADForm implements EventListener
|
||||||
|
|
||||||
South south = new South();
|
South south = new South();
|
||||||
south.appendChild(statusBar);
|
south.appendChild(statusBar);
|
||||||
statusBar.setWidth("100%");
|
|
||||||
layout.appendChild(south);
|
layout.appendChild(south);
|
||||||
south.setStyle("background-color: transparent");
|
south.setStyle("background-color: transparent");
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.List;
|
||||||
import org.adempiere.webui.component.ADTabListModel.ADTabLabel;
|
import org.adempiere.webui.component.ADTabListModel.ADTabLabel;
|
||||||
import org.zkoss.zhtml.Button;
|
import org.zkoss.zhtml.Button;
|
||||||
import org.zkoss.zhtml.Text;
|
import org.zkoss.zhtml.Text;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
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");
|
this.setStyle("margin:0;padding:0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public synchronized void refresh() {
|
||||||
this.getChildren().clear();
|
List childs = getChildren();
|
||||||
int i = 0;
|
int childCount = childs.size();
|
||||||
for (ADTabLabel tabLabel : listItems) {
|
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();
|
Button button = new Button();
|
||||||
Text text = new Text(tabLabel.label);
|
Text text = new Text(tabLabel.label);
|
||||||
button.appendChild(text);
|
button.appendChild(text);
|
||||||
|
@ -67,7 +73,6 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
|
||||||
|
|
||||||
button.setParent(this);
|
button.setParent(this);
|
||||||
button.addEventListener(Events.ON_CLICK, this);
|
button.addEventListener(Events.ON_CLICK, this);
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +84,7 @@ public class ADButtonTabList extends Panel implements IADTabList, EventListener
|
||||||
this.selectedIndex = index;
|
this.selectedIndex = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setItems(List<ADTabLabel> listItems) {
|
public synchronized void setItems(List<ADTabLabel> listItems) {
|
||||||
this.listItems = listItems;
|
this.listItems = listItems;
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -441,7 +441,6 @@ public class CWindowToolbar extends FToolbar implements EventListener
|
||||||
public void enableChanges(boolean enabled)
|
public void enableChanges(boolean enabled)
|
||||||
{
|
{
|
||||||
this.btnNew.setDisabled(!enabled);
|
this.btnNew.setDisabled(!enabled);
|
||||||
this.btnIgnore.setDisabled(!enabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void enableIgnore(boolean enabled)
|
public void enableIgnore(boolean enabled)
|
||||||
|
|
|
@ -13,15 +13,15 @@
|
||||||
|
|
||||||
package org.adempiere.webui.component;
|
package org.adempiere.webui.component;
|
||||||
|
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zul.Hbox;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class Combinationbox extends Hbox
|
public class Combinationbox extends Panel
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -49,11 +49,14 @@ public class Combinationbox extends Hbox
|
||||||
private void initComponents()
|
private void initComponents()
|
||||||
{
|
{
|
||||||
textbox = new Textbox();
|
textbox = new Textbox();
|
||||||
textbox.setWidth("100%");
|
|
||||||
button = new Button();
|
button = new Button();
|
||||||
button.setHeight("98%");
|
button.setHeight("22px");
|
||||||
|
button.setWidth("26px");
|
||||||
appendChild(textbox);
|
appendChild(textbox);
|
||||||
appendChild(button);
|
appendChild(button);
|
||||||
|
|
||||||
|
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||||
|
this.setStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String value)
|
public void setText(String value)
|
||||||
|
|
|
@ -23,6 +23,8 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.adempiere.webui.LayoutUtils;
|
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.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
import org.zkoss.zul.Hbox;
|
import org.zkoss.zul.Hbox;
|
||||||
|
@ -68,6 +70,8 @@ public final class ConfirmPanel extends Hbox
|
||||||
/** Action String New. */
|
/** Action String New. */
|
||||||
public static final String A_NEW = "New";
|
public static final String A_NEW = "New";
|
||||||
|
|
||||||
|
private boolean m_withText = false;
|
||||||
|
|
||||||
private Map<String, Button> buttonMap = new HashMap<String, Button>();
|
private Map<String, Button> buttonMap = new HashMap<String, Button>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -98,15 +102,50 @@ public final class ConfirmPanel extends Hbox
|
||||||
Button button = new Button();
|
Button button = new Button();
|
||||||
button.setName("btn"+name);
|
button.setName("btn"+name);
|
||||||
button.setId(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;
|
||||||
|
|
||||||
LayoutUtils.addSclass("action-button", button);
|
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);
|
buttonMap.put(name, button);
|
||||||
|
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
{
|
||||||
|
this(withCancelButton, withRefreshButton, withResetButton, withCustomizeButton, withHistoryButton, withZoomButton, false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create confirm panel with multiple options
|
* create confirm panel with multiple options
|
||||||
* @param withCancelButton with cancel
|
* @param withCancelButton with cancel
|
||||||
|
@ -121,8 +160,11 @@ public final class ConfirmPanel extends Hbox
|
||||||
boolean withResetButton,
|
boolean withResetButton,
|
||||||
boolean withCustomizeButton,
|
boolean withCustomizeButton,
|
||||||
boolean withHistoryButton,
|
boolean withHistoryButton,
|
||||||
boolean withZoomButton)
|
boolean withZoomButton,
|
||||||
|
boolean withText)
|
||||||
{
|
{
|
||||||
|
m_withText = withText;
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
setVisible(A_CANCEL, withCancelButton);
|
setVisible(A_CANCEL, withCancelButton);
|
||||||
|
|
|
@ -20,6 +20,7 @@ package org.adempiere.webui.component;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
|
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -62,6 +63,12 @@ public class EditorBox extends Panel
|
||||||
|
|
||||||
this.appendChild(txt);
|
this.appendChild(txt);
|
||||||
this.appendChild(btn);
|
this.appendChild(btn);
|
||||||
|
|
||||||
|
btn.setHeight("22px");
|
||||||
|
btn.setWidth("26px");
|
||||||
|
|
||||||
|
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||||
|
this.setStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Textbox getTextBox()
|
public Textbox getTextBox()
|
||||||
|
|
|
@ -60,7 +60,8 @@ public class Label extends org.zkoss.zul.Label
|
||||||
@Override
|
@Override
|
||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
super.setValue(value != null ? value.replaceAll("[&]", "") : null);
|
super.setValue(value != null ? value.replaceAll("[&]", "") : null);
|
||||||
setupMandatoryDecorator();
|
if ((value == null || value.trim().length() == 0) && decorator != null)
|
||||||
|
decorator.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -75,15 +76,20 @@ public class Label extends org.zkoss.zul.Label
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupMandatoryDecorator() {
|
private void setupMandatoryDecorator() {
|
||||||
|
if (decorator == null)
|
||||||
|
createMandatoryDecorator();
|
||||||
String value = getValue();
|
String value = getValue();
|
||||||
if (value != null && (value.trim().length() > 0) && mandatory) {
|
if (mandatory && value != null && value.trim().length() > 0) {
|
||||||
if (decorator == null)
|
decorator.setVisible(true);
|
||||||
decorator = new Label("*");
|
} else
|
||||||
((Label)decorator).setStyle("text-decoration: none; font-size: xx-small; vertical-align: top;");
|
|
||||||
} else if (decorator != null)
|
|
||||||
decorator.setVisible(false);
|
decorator.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createMandatoryDecorator() {
|
||||||
|
decorator = new Label("*");
|
||||||
|
((Label)decorator).setStyle("text-decoration: none; font-size: xx-small; vertical-align: top;");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* alias for setValue, added to ease porting of swing form
|
* alias for setValue, added to ease porting of swing form
|
||||||
* @param translate
|
* @param translate
|
||||||
|
|
|
@ -257,13 +257,16 @@ public class ListModelTable extends ListModelList implements ListModelExt
|
||||||
if (vector)
|
if (vector)
|
||||||
{
|
{
|
||||||
newRow = new Vector<Object>(getNoColumns());
|
newRow = new Vector<Object>(getNoColumns());
|
||||||
((Vector)newRow).ensureCapacity(getNoColumns());
|
((Vector)newRow).setSize(getNoColumns());
|
||||||
add(newRow);
|
add(newRow);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
newRow = new ArrayList<Object>(getNoColumns());
|
newRow = new ArrayList<Object>(getNoColumns());
|
||||||
((ArrayList)newRow).ensureCapacity(getNoColumns());
|
for(int i = 0; i < getNoColumns(); i++)
|
||||||
|
{
|
||||||
|
newRow.add(null);
|
||||||
|
}
|
||||||
add(newRow);
|
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
|
* remove all items, to ease porting of swing form
|
||||||
*/
|
*/
|
||||||
public void removeAllItems() {
|
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.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
|
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
|
|
||||||
/** Location Editor component
|
/** Location Editor component
|
||||||
|
@ -53,8 +54,13 @@ public class Locationbox extends Panel
|
||||||
{
|
{
|
||||||
txt = new Textbox();
|
txt = new Textbox();
|
||||||
btn = new Button();
|
btn = new Button();
|
||||||
|
btn.setHeight("22px");
|
||||||
|
btn.setWidth("26px");
|
||||||
this.appendChild(txt);
|
this.appendChild(txt);
|
||||||
this.appendChild(btn);
|
this.appendChild(btn);
|
||||||
|
|
||||||
|
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||||
|
this.setStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Textbox getTextBox()
|
public Textbox getTextBox()
|
||||||
|
|
|
@ -101,32 +101,39 @@ public class Messagebox extends Window implements EventListener
|
||||||
lblMsg.setValue(msg);
|
lblMsg.setValue(msg);
|
||||||
|
|
||||||
btnOk.setLabel("OK");
|
btnOk.setLabel("OK");
|
||||||
btnOk.setImage("/images/Ok24.png");
|
btnOk.setImage("/images/Ok16.png");
|
||||||
btnOk.addEventListener(Events.ON_CLICK, this);
|
btnOk.addEventListener(Events.ON_CLICK, this);
|
||||||
|
btnOk.setSclass("action-text-button");
|
||||||
|
|
||||||
btnCancel.setLabel("Cancel");
|
btnCancel.setLabel("Cancel");
|
||||||
btnCancel.setImage("/images/Cancel24.png");
|
btnCancel.setImage("/images/Cancel16.png");
|
||||||
btnCancel.addEventListener(Events.ON_CLICK, this);
|
btnCancel.addEventListener(Events.ON_CLICK, this);
|
||||||
|
btnCancel.setSclass("action-text-button");
|
||||||
|
|
||||||
btnYes.setLabel("Yes");
|
btnYes.setLabel("Yes");
|
||||||
btnYes.setImage("/images/Ok24.png");
|
btnYes.setImage("/images/Ok16.png");
|
||||||
btnYes.addEventListener(Events.ON_CLICK, this);
|
btnYes.addEventListener(Events.ON_CLICK, this);
|
||||||
|
btnYes.setSclass("action-text-button");
|
||||||
|
|
||||||
btnNo.setLabel("No");
|
btnNo.setLabel("No");
|
||||||
btnNo.setImage("/images/Cancel24.png");
|
btnNo.setImage("/images/Cancel16.png");
|
||||||
btnNo.addEventListener(Events.ON_CLICK, this);
|
btnNo.addEventListener(Events.ON_CLICK, this);
|
||||||
|
btnNo.setSclass("action-text-button");
|
||||||
|
|
||||||
btnAbort.setLabel("Abort");
|
btnAbort.setLabel("Abort");
|
||||||
//btnAbort.setImage("/images/");
|
//btnAbort.setImage("/images/");
|
||||||
btnAbort.addEventListener(Events.ON_CLICK, this);
|
btnAbort.addEventListener(Events.ON_CLICK, this);
|
||||||
|
btnAbort.setSclass("action-text-button");
|
||||||
|
|
||||||
btnRetry.setLabel("Retry");
|
btnRetry.setLabel("Retry");
|
||||||
//btnRetry.setImage("/images/");
|
//btnRetry.setImage("/images/");
|
||||||
btnRetry.addEventListener(Events.ON_CLICK, this);
|
btnRetry.addEventListener(Events.ON_CLICK, this);
|
||||||
|
btnRetry.setSclass("action-text-button");
|
||||||
|
|
||||||
btnIgnore.setLabel("Ignore");
|
btnIgnore.setLabel("Ignore");
|
||||||
btnIgnore.setImage("/images/Ignore24.png");
|
btnIgnore.setImage("/images/Ignore16.png");
|
||||||
btnIgnore.addEventListener(Events.ON_CLICK, this);
|
btnIgnore.addEventListener(Events.ON_CLICK, this);
|
||||||
|
btnIgnore.setSclass("action-text-button");
|
||||||
|
|
||||||
Panel pnlMessage = new Panel();
|
Panel pnlMessage = new Panel();
|
||||||
pnlMessage.setWidth("100%");
|
pnlMessage.setWidth("100%");
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
|
|
||||||
package org.adempiere.webui.component;
|
package org.adempiere.webui.component;
|
||||||
|
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zul.Hbox;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product Attribute Box
|
* Product Attribute Box
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*/
|
*/
|
||||||
public class PAttributebox extends Hbox
|
public class PAttributebox extends Panel
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -51,11 +51,14 @@ public class PAttributebox extends Hbox
|
||||||
private void initComponents()
|
private void initComponents()
|
||||||
{
|
{
|
||||||
textBox = new Textbox();
|
textBox = new Textbox();
|
||||||
textBox.setWidth("100%");
|
|
||||||
button = new Button();
|
button = new Button();
|
||||||
button.setHeight("98%");
|
button.setHeight("22px");
|
||||||
|
button.setWidth("26px");
|
||||||
appendChild(textBox);
|
appendChild(textBox);
|
||||||
appendChild(button);
|
appendChild(button);
|
||||||
|
|
||||||
|
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||||
|
this.setStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String value)
|
public void setText(String value)
|
||||||
|
|
|
@ -20,9 +20,10 @@ package org.adempiere.webui.component;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
|
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
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 static final long serialVersionUID = 1L;
|
||||||
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
|
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
|
||||||
|
@ -48,13 +49,14 @@ public class Searchbox extends Panel//Hbox
|
||||||
private void initComponents()
|
private void initComponents()
|
||||||
{
|
{
|
||||||
txt = new Textbox();
|
txt = new Textbox();
|
||||||
// txt.setWidth("100%");
|
|
||||||
btn = new Button();
|
btn = new Button();
|
||||||
btn.setHeight("98%");
|
btn.setHeight("22px");
|
||||||
|
btn.setWidth("26px");
|
||||||
appendChild(txt);
|
appendChild(txt);
|
||||||
appendChild(btn);
|
appendChild(btn);
|
||||||
|
|
||||||
this.setStyle("display: inline-block");
|
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||||
|
this.setStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Textbox getTextBox()
|
public Textbox getTextBox()
|
||||||
|
|
|
@ -17,13 +17,14 @@
|
||||||
|
|
||||||
package org.adempiere.webui.component;
|
package org.adempiere.webui.component;
|
||||||
|
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zul.Hbox;
|
import org.zkoss.zul.Hbox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* URL Box
|
* URL Box
|
||||||
*/
|
*/
|
||||||
public class Urlbox extends Hbox
|
public class Urlbox extends Panel
|
||||||
{
|
{
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
@ -51,11 +52,14 @@ public class Urlbox extends Hbox
|
||||||
private void initComponents()
|
private void initComponents()
|
||||||
{
|
{
|
||||||
txtUrl = new Textbox();
|
txtUrl = new Textbox();
|
||||||
txtUrl.setWidth("100%");
|
|
||||||
btnUrl = new Button();
|
btnUrl = new Button();
|
||||||
btnUrl.setHeight("98%");
|
btnUrl.setHeight("22px");
|
||||||
|
btnUrl.setWidth("26px");
|
||||||
appendChild(txtUrl);
|
appendChild(txtUrl);
|
||||||
appendChild(btnUrl);
|
appendChild(btnUrl);
|
||||||
|
|
||||||
|
String style = AEnv.isFirefox2() ? "display: inline" : "display: inline-block";
|
||||||
|
this.setStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setText(String value)
|
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 headerValue The object to use for generating the header text.
|
||||||
* @param headerIndex The column index of the header
|
* @param headerIndex The column index of the header
|
||||||
|
* @param classType
|
||||||
* @return The generated ListHeader
|
* @return The generated ListHeader
|
||||||
* @see #renderListHead(ListHead)
|
* @see #renderListHead(ListHead)
|
||||||
*/
|
*/
|
||||||
private Component getListHeaderComponent(Object headerValue, int headerIndex)
|
private Component getListHeaderComponent(Object headerValue, int headerIndex, Class classType)
|
||||||
{
|
{
|
||||||
ListHeader header = null;
|
ListHeader header = null;
|
||||||
|
|
||||||
|
@ -422,6 +423,22 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
||||||
int width = headerText.trim().length() * 9;
|
int width = headerText.trim().length() * 9;
|
||||||
if (width > 300)
|
if (width > 300)
|
||||||
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)
|
else if (width > 0 && width < 100)
|
||||||
width = 100;
|
width = 100;
|
||||||
|
|
||||||
|
@ -483,7 +500,7 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
||||||
for (int columnIndex = 0; columnIndex < m_tableColumns.size(); columnIndex++)
|
for (int columnIndex = 0; columnIndex < m_tableColumns.size(); columnIndex++)
|
||||||
{
|
{
|
||||||
column = m_tableColumns.get(columnIndex);
|
column = m_tableColumns.get(columnIndex);
|
||||||
header = getListHeaderComponent(column.getHeaderValue(), columnIndex);
|
header = getListHeaderComponent(column.getHeaderValue(), columnIndex, column.getColumnClass());
|
||||||
head.appendChild(header);
|
head.appendChild(header);
|
||||||
}
|
}
|
||||||
head.setSizable(true);
|
head.setSizable(true);
|
||||||
|
@ -693,6 +710,26 @@ public class WListItemRenderer implements ListitemRenderer, EventListener, Listi
|
||||||
return item;
|
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,8 +444,14 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
|
||||||
|
|
||||||
setColumnReadOnly(index, readOnly);
|
setColumnReadOnly(index, readOnly);
|
||||||
|
|
||||||
// TODO transfer this to Renderer
|
renderer.setColumnHeader(index, header);
|
||||||
m_modelHeaderClass.add(classType);
|
|
||||||
|
renderer.setColumnClass(index, classType);
|
||||||
|
|
||||||
|
if (index < m_modelHeaderClass.size())
|
||||||
|
m_modelHeaderClass.set(index, classType);
|
||||||
|
else
|
||||||
|
m_modelHeaderClass.add(classType);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -466,6 +472,10 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
|
||||||
{
|
{
|
||||||
setColumnReadOnly(index, readOnly);
|
setColumnReadOnly(index, readOnly);
|
||||||
|
|
||||||
|
WListItemRenderer renderer = (WListItemRenderer)getItemRenderer();
|
||||||
|
|
||||||
|
renderer.setColumnClass(index, classType);
|
||||||
|
|
||||||
m_modelHeaderClass.add(classType);
|
m_modelHeaderClass.add(classType);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -489,6 +499,9 @@ public class WListbox extends Listbox implements TableValueChangeListener, WTabl
|
||||||
|
|
||||||
addColumn(header);
|
addColumn(header);
|
||||||
|
|
||||||
|
WListItemRenderer renderer = (WListItemRenderer)getItemRenderer();
|
||||||
|
renderer.setColumnClass((renderer.getNoColumns() - 1), classType);
|
||||||
|
|
||||||
return;
|
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. */
|
/** The header value of the column. */
|
||||||
protected Object headerValue;
|
protected Object headerValue;
|
||||||
|
|
||||||
|
protected Class columnClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cover method, using a default width of 75
|
* Cover method, using a default width of 75
|
||||||
* @see #WTableColumn(int)
|
* @see #WTableColumn(int)
|
||||||
|
@ -252,4 +254,22 @@ public class WTableColumn
|
||||||
{
|
{
|
||||||
return isResizable;
|
return isResizable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @return Class
|
||||||
|
*/
|
||||||
|
public Class getColumnClass()
|
||||||
|
{
|
||||||
|
return columnClass;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param columnClass
|
||||||
|
*/
|
||||||
|
public void setColumnClass(Class columnClass)
|
||||||
|
{
|
||||||
|
this.columnClass = columnClass;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,23 @@ public class WDateEditor extends WEditor
|
||||||
this("Date", "Date", false, false, true);
|
this("Date", "Date", false, false, true);
|
||||||
} // VDate
|
} // VDate
|
||||||
|
|
||||||
public void onEvent(Event event)
|
/**
|
||||||
|
*
|
||||||
|
* @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();
|
Date date = getComponent().getValue();
|
||||||
Timestamp newValue = null;
|
Timestamp newValue = null;
|
||||||
|
@ -126,6 +142,7 @@ public class WDateEditor extends WEditor
|
||||||
if (value == null)
|
if (value == null)
|
||||||
{
|
{
|
||||||
oldValue = null;
|
oldValue = null;
|
||||||
|
getComponent().setValue(null);
|
||||||
}
|
}
|
||||||
else if (value instanceof Timestamp)
|
else if (value instanceof Timestamp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -411,4 +411,8 @@ public abstract class WEditor implements EventListener, PropertyChangeListener
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void dynamicDisplay()
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,7 +53,7 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
|
|
||||||
private String m_columnName;
|
private String m_columnName;
|
||||||
private MLocatorLookup m_mLocator;
|
private MLocatorLookup m_mLocator;
|
||||||
private MLocator m_value;
|
private Object m_value;
|
||||||
private int m_WindowNo;
|
private int m_WindowNo;
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger(WLocatorEditor.class);
|
private static CLogger log = CLogger.getCLogger(WLocatorEditor.class);
|
||||||
|
@ -113,7 +113,7 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
value = null;
|
value = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_value = m_mLocator.getMLocator(value, null);
|
m_value = value;
|
||||||
getComponent().setText(m_mLocator.getDisplay(value)); // loads value
|
getComponent().setText(m_mLocator.getDisplay(value)); // loads value
|
||||||
|
|
||||||
// Data Binding
|
// Data Binding
|
||||||
|
@ -159,8 +159,9 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
|
|
||||||
public int getM_Locator_ID()
|
public int getM_Locator_ID()
|
||||||
{
|
{
|
||||||
if (m_value != null/* && m_value instanceof Integer*/)
|
if (m_value != null
|
||||||
return m_value.getM_Locator_ID();
|
&& m_value instanceof Integer)
|
||||||
|
return ((Integer)m_value).intValue();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} // getM_Locator_ID
|
} // getM_Locator_ID
|
||||||
|
@ -193,9 +194,8 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
|
|
||||||
int M_Locator_ID = 0;
|
int M_Locator_ID = 0;
|
||||||
|
|
||||||
//if (m_value instanceof Integer)
|
if (m_value instanceof Integer)
|
||||||
if (m_value != null)
|
M_Locator_ID = ((Integer)m_value).intValue();
|
||||||
M_Locator_ID = m_value.getM_Locator_ID();
|
|
||||||
|
|
||||||
m_mLocator.setOnly_Warehouse_ID(only_Warehouse_ID);
|
m_mLocator.setOnly_Warehouse_ID(only_Warehouse_ID);
|
||||||
m_mLocator.setOnly_Product_ID(getOnly_Product_ID());
|
m_mLocator.setOnly_Product_ID(getOnly_Product_ID());
|
||||||
|
|
|
@ -827,16 +827,16 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
|
|
||||||
public void valueChange(ValueChangeEvent evt)
|
public void valueChange(ValueChangeEvent evt)
|
||||||
{
|
{
|
||||||
if (getColumnName().equals(evt.getPropertyName()))
|
if ("zoom".equals(evt.getPropertyName()))
|
||||||
{
|
{
|
||||||
if (evt.getNewValue() != null)
|
actionZoom(evt.getNewValue());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (evt.getNewValue() != null)
|
||||||
{
|
{
|
||||||
actionCombo(evt.getNewValue());
|
actionCombo(evt.getNewValue());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else if ("zoom".equals(evt.getPropertyName()))
|
|
||||||
{
|
|
||||||
actionZoom(evt.getNewValue());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -211,7 +211,7 @@ ContextMenuListener, IZoomableEditor
|
||||||
private void refreshList()
|
private void refreshList()
|
||||||
{
|
{
|
||||||
if (getComponent().getItemCount() > 0)
|
if (getComponent().getItemCount() > 0)
|
||||||
getComponent().getItems().clear();
|
getComponent().removeAllItems();
|
||||||
|
|
||||||
if (isReadWrite())
|
if (isReadWrite())
|
||||||
{
|
{
|
||||||
|
@ -327,4 +327,11 @@ ContextMenuListener, IZoomableEditor
|
||||||
setValue(evt.getNewValue());
|
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 java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Bandbox;
|
import org.adempiere.webui.component.Bandbox;
|
||||||
import org.adempiere.webui.component.Datebox;
|
import org.adempiere.webui.component.Datebox;
|
||||||
import org.adempiere.webui.component.Grid;
|
import org.adempiere.webui.component.Grid;
|
||||||
|
@ -347,7 +348,8 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
||||||
|
|
||||||
if (editor instanceof WButtonEditor)
|
if (editor instanceof WButtonEditor)
|
||||||
{
|
{
|
||||||
((WButtonEditor)editor).addActionListener(windowPanel);
|
if (windowPanel != null)
|
||||||
|
((WButtonEditor)editor).addActionListener(windowPanel);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -356,8 +358,11 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
||||||
|
|
||||||
if (editor.getComponent() instanceof HtmlBasedComponent) {
|
if (editor.getComponent() instanceof HtmlBasedComponent) {
|
||||||
//can't stretch bandbox & datebox
|
//can't stretch bandbox & datebox
|
||||||
if (!(editor.getComponent() instanceof Bandbox) && !(editor.getComponent() instanceof Datebox))
|
if (!(editor.getComponent() instanceof Bandbox) &&
|
||||||
((HtmlBasedComponent)editor.getComponent()).setWidth("100%");
|
!(editor.getComponent() instanceof Datebox)) {
|
||||||
|
String width = AEnv.isFirefox2() ? "99%" : "100%";
|
||||||
|
((HtmlBasedComponent)editor.getComponent()).setWidth(width);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WEditorPopupMenu popupMenu = editor.getPopupMenu();
|
WEditorPopupMenu popupMenu = editor.getPopupMenu();
|
||||||
|
@ -460,14 +465,20 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
comp.dynamicDisplay();
|
||||||
boolean rw = mField.isEditable(true); // r/w - check Context
|
boolean rw = mField.isEditable(true); // r/w - check Context
|
||||||
comp.setReadWrite(rw);
|
comp.setReadWrite(rw);
|
||||||
|
if (comp.getLabel() != null)
|
||||||
|
{
|
||||||
|
comp.setMandatory(mField.isMandatory(true)); // check context
|
||||||
|
}
|
||||||
|
/*
|
||||||
boolean manMissing = false;
|
boolean manMissing = false;
|
||||||
if (rw && mField.getValue() == null && mField.isMandatory(true)) // check context
|
if (rw && mField.getValue() == null && mField.isMandatory(true)) // check context
|
||||||
{
|
{
|
||||||
manMissing = true;
|
manMissing = true;
|
||||||
}
|
}
|
||||||
comp.setBackground(manMissing || mField.isError());
|
comp.setBackground(manMissing || mField.isError());*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (comp.isVisible())
|
else if (comp.isVisible())
|
||||||
|
@ -724,6 +735,8 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
||||||
|
|
||||||
}
|
}
|
||||||
//if (col >= 0)
|
//if (col >= 0)
|
||||||
|
if (!uiCreated)
|
||||||
|
createUI();
|
||||||
dynamicDisplay(col);
|
dynamicDisplay(col);
|
||||||
|
|
||||||
//sync tree
|
//sync tree
|
||||||
|
@ -835,7 +848,9 @@ DataStatusListener, ValueChangeListener, IADTabpanel
|
||||||
//
|
//
|
||||||
if (e.getNewValue() == null && e.getOldValue() != null
|
if (e.getNewValue() == null && e.getOldValue() != null
|
||||||
&& e.getOldValue().toString().length() > 0) // some editors return "" instead of 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
|
else
|
||||||
{
|
{
|
||||||
// mTable.setValueAt (e.getNewValue(), row, col, true);
|
// 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.ConfirmPanel;
|
||||||
import org.adempiere.webui.component.ListModelTable;
|
import org.adempiere.webui.component.ListModelTable;
|
||||||
import org.adempiere.webui.component.WListbox;
|
import org.adempiere.webui.component.WListbox;
|
||||||
import org.adempiere.webui.component.WStatusBar;
|
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.event.ValueChangeListener;
|
import org.adempiere.webui.event.ValueChangeListener;
|
||||||
|
@ -266,7 +265,7 @@ public abstract class InfoPanel extends Window implements EventListener, WTableM
|
||||||
protected boolean p_multipleSelection;
|
protected boolean p_multipleSelection;
|
||||||
/** Initial WHERE Clause */
|
/** Initial WHERE Clause */
|
||||||
protected String p_whereClause = "";
|
protected String p_whereClause = "";
|
||||||
protected WStatusBar statusBar = new WStatusBar();
|
protected StatusBarPanel statusBar = new StatusBarPanel();
|
||||||
/** */
|
/** */
|
||||||
private Vector<Object> line;
|
private Vector<Object> line;
|
||||||
private boolean m_ok = false;
|
private boolean m_ok = false;
|
||||||
|
|
|
@ -25,6 +25,7 @@ import org.compiere.model.DataStatusEvent;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
import org.zkoss.zk.ui.Component;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.EventListener;
|
import org.zkoss.zk.ui.event.EventListener;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
@ -52,6 +53,10 @@ public class StatusBarPanel extends Panel implements EventListener
|
||||||
|
|
||||||
private String m_text;
|
private String m_text;
|
||||||
|
|
||||||
|
private Div east;
|
||||||
|
|
||||||
|
private Div west;
|
||||||
|
|
||||||
public StatusBarPanel()
|
public StatusBarPanel()
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
|
@ -61,40 +66,41 @@ public class StatusBarPanel extends Panel implements EventListener
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
statusLine = new Label();
|
statusLine = new Label();
|
||||||
statusDB = new Label();
|
statusDB = new Label(" ");
|
||||||
infoLine = new Label();
|
infoLine = new Label();
|
||||||
|
|
||||||
Hbox hbox = new Hbox();
|
Hbox hbox = new Hbox();
|
||||||
hbox.setWidth("100%");
|
hbox.setWidth("100%");
|
||||||
hbox.setHeight("100%");
|
hbox.setHeight("100%");
|
||||||
hbox.setWidths("50%, 50%");
|
hbox.setWidths("50%, 50%");
|
||||||
Div div = new Div();
|
west = new Div();
|
||||||
div.setStyle("text-align: left; ");
|
west.setStyle("text-align: left; ");
|
||||||
div.appendChild(statusLine);
|
west.appendChild(statusLine);
|
||||||
div.setWidth("100%");
|
west.setWidth("100%");
|
||||||
Vbox vbox = new Vbox();
|
Vbox vbox = new Vbox();
|
||||||
vbox.setPack("center");
|
vbox.setPack("center");
|
||||||
LayoutUtils.addSclass("status", vbox);
|
LayoutUtils.addSclass("status", vbox);
|
||||||
vbox.appendChild(div);
|
vbox.appendChild(west);
|
||||||
hbox.appendChild(vbox);
|
hbox.appendChild(vbox);
|
||||||
|
|
||||||
div = new Div();
|
east = new Div();
|
||||||
div.setWidth("100%");
|
east.setWidth("100%");
|
||||||
div.setStyle("text-align: right; ");
|
east.setStyle("text-align: right; ");
|
||||||
div.appendChild(infoLine);
|
east.appendChild(infoLine);
|
||||||
div.appendChild(statusDB);
|
east.appendChild(statusDB);
|
||||||
|
|
||||||
LayoutUtils.addSclass("status-db", statusDB);
|
LayoutUtils.addSclass("status-db", statusDB);
|
||||||
LayoutUtils.addSclass("status-info", infoLine);
|
LayoutUtils.addSclass("status-info", infoLine);
|
||||||
vbox = new Vbox();
|
vbox = new Vbox();
|
||||||
vbox.setPack("center");
|
vbox.setPack("center");
|
||||||
LayoutUtils.addSclass("status", vbox);
|
LayoutUtils.addSclass("status", vbox);
|
||||||
vbox.appendChild(div);
|
vbox.appendChild(east);
|
||||||
hbox.appendChild(vbox);
|
hbox.appendChild(vbox);
|
||||||
|
|
||||||
this.appendChild(hbox);
|
this.appendChild(hbox);
|
||||||
|
|
||||||
statusDB.addEventListener(Events.ON_CLICK, this);
|
statusDB.addEventListener(Events.ON_CLICK, this);
|
||||||
|
infoLine.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStatusDB (String text)
|
public void setStatusDB (String text)
|
||||||
|
@ -130,13 +136,28 @@ public class StatusBarPanel extends Panel implements EventListener
|
||||||
statusLine.setTooltiptext(text);
|
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
|
* Set Info Line
|
||||||
* @param text text
|
* @param text text
|
||||||
*/
|
*/
|
||||||
public void setInfo (String 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
|
} // setInfo
|
||||||
|
|
||||||
public void onEvent(Event event) throws Exception {
|
public void onEvent(Event event) throws Exception {
|
||||||
|
@ -147,7 +168,7 @@ public class StatusBarPanel extends Panel implements EventListener
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String title = Msg.getMsg(Env.getCtx(), "Who") + m_text;
|
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)
|
if (title == null)
|
||||||
{
|
{
|
||||||
newTitle = Env.getHeader(ctx, windowNo);
|
newTitle = windowNo > 0 ? Env.getHeader(ctx, windowNo) : null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,8 @@ public class FDialog
|
||||||
|
|
||||||
try
|
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)
|
catch (InterruptedException exception)
|
||||||
{
|
{
|
||||||
|
@ -239,7 +240,8 @@ public class FDialog
|
||||||
|
|
||||||
try
|
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)
|
catch (InterruptedException exception)
|
||||||
{
|
{
|
||||||
|
@ -267,7 +269,8 @@ public class FDialog
|
||||||
out.append(Msg.getMsg(Env.getCtx(), adMessage));
|
out.append(Msg.getMsg(Env.getCtx(), adMessage));
|
||||||
if (msg != null && msg.length() > 0)
|
if (msg != null && msg.length() > 0)
|
||||||
out.append("\n").append(msg);
|
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
|
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);
|
return (response == Messagebox.YES);
|
||||||
}
|
}
|
||||||
|
@ -343,7 +347,8 @@ public class FDialog
|
||||||
|
|
||||||
try
|
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)
|
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 ();
|
super ();
|
||||||
this.setTitle(title);
|
this.setTitle(title);
|
||||||
this.setHeight("450px");
|
this.setHeight("500px");
|
||||||
this.setWidth("650px");
|
this.setWidth("700px");
|
||||||
|
|
||||||
log.config("C_AcctSchema_ID=" + C_AcctSchema_ID
|
log.config("C_AcctSchema_ID=" + C_AcctSchema_ID
|
||||||
+ ", C_ValidCombination_ID=" + mAccount.C_ValidCombination_ID);
|
+ ", C_ValidCombination_ID=" + mAccount.C_ValidCombination_ID);
|
||||||
|
@ -185,7 +185,7 @@ public final class WAccountDialog extends Window
|
||||||
//
|
//
|
||||||
|
|
||||||
northPanel.appendChild(parameterPanel);
|
northPanel.appendChild(parameterPanel);
|
||||||
parameterPanel.setWidth("80%");
|
parameterPanel.setWidth("95%");
|
||||||
northPanel.appendChild(toolBar);
|
northPanel.appendChild(toolBar);
|
||||||
northPanel.setWidth("100%");
|
northPanel.setWidth("100%");
|
||||||
|
|
||||||
|
@ -193,15 +193,25 @@ public final class WAccountDialog extends Window
|
||||||
|
|
||||||
Borderlayout layout = new Borderlayout();
|
Borderlayout layout = new Borderlayout();
|
||||||
layout.setParent(this);
|
layout.setParent(this);
|
||||||
layout.setHeight("100%");
|
if (AEnv.isFirefox2())
|
||||||
layout.setWidth("100%");
|
{
|
||||||
layout.setStyle("background-color: transparent;");
|
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();
|
North nRegion = new North();
|
||||||
nRegion.setParent(layout);
|
nRegion.setParent(layout);
|
||||||
nRegion.setFlex(true);
|
nRegion.setFlex(false);
|
||||||
nRegion.appendChild(northPanel);
|
nRegion.appendChild(northPanel);
|
||||||
nRegion.setStyle("background-color: transparent;");
|
nRegion.setStyle("background-color: transparent; border: none");
|
||||||
northPanel.setStyle("background-color: transparent;");
|
northPanel.setStyle("background-color: transparent;");
|
||||||
|
|
||||||
Center cRegion = new Center();
|
Center cRegion = new Center();
|
||||||
|
@ -216,7 +226,7 @@ public final class WAccountDialog extends Window
|
||||||
confirmPanel.setStyle("margin-top: 5px; margin-bottom: 5px");
|
confirmPanel.setStyle("margin-top: 5px; margin-bottom: 5px");
|
||||||
div.appendChild(statusBar);
|
div.appendChild(statusBar);
|
||||||
sRegion.appendChild(div);
|
sRegion.appendChild(div);
|
||||||
sRegion.setStyle("background-color: transparent;");
|
sRegion.setStyle("background-color: transparent; border: none");
|
||||||
|
|
||||||
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
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.Rows;
|
||||||
import org.adempiere.webui.component.Textbox;
|
import org.adempiere.webui.component.Textbox;
|
||||||
import org.adempiere.webui.component.ConfirmPanel;
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
import org.adempiere.webui.component.WStatusBar;
|
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
import org.adempiere.webui.editor.WSearchEditor;
|
import org.adempiere.webui.editor.WSearchEditor;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.event.ValueChangeListener;
|
import org.adempiere.webui.event.ValueChangeListener;
|
||||||
|
import org.adempiere.webui.panel.StatusBarPanel;
|
||||||
import org.compiere.model.Lookup;
|
import org.compiere.model.Lookup;
|
||||||
import org.compiere.model.MClient;
|
import org.compiere.model.MClient;
|
||||||
import org.compiere.model.MLookupFactory;
|
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 fAttachment = new Textbox();//40);
|
||||||
private Textbox fMessage = new Textbox();
|
private Textbox fMessage = new Textbox();
|
||||||
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
|
||||||
private WStatusBar statusBar = new WStatusBar();
|
private StatusBarPanel statusBar = new StatusBarPanel();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static Init
|
* Static Init
|
||||||
|
@ -284,7 +284,6 @@ public class WEMailDialog extends Window implements EventListener, ValueChangeLi
|
||||||
|
|
||||||
South south = new South();
|
South south = new South();
|
||||||
south.appendChild(statusBar);
|
south.appendChild(statusBar);
|
||||||
statusBar.setWidth("100%");
|
|
||||||
layout.appendChild(south);
|
layout.appendChild(south);
|
||||||
south.setStyle("background-color: white");
|
south.setStyle("background-color: white");
|
||||||
|
|
||||||
|
|
|
@ -309,7 +309,7 @@ public class WPAttributeDialog extends Window implements EventListener
|
||||||
row = new Row();
|
row = new Row();
|
||||||
row.setParent(rows);
|
row.setParent(rows);
|
||||||
m_row++;
|
m_row++;
|
||||||
rows.appendChild(label);
|
row.appendChild(label);
|
||||||
row.appendChild(fieldLot);
|
row.appendChild(fieldLot);
|
||||||
if (m_masi.getM_Lot_ID() != 0)
|
if (m_masi.getM_Lot_ID() != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -142,7 +142,7 @@ public class WPAttributeInstance extends Window implements EventListener
|
||||||
South south = new South();
|
South south = new South();
|
||||||
south.setParent(mainLayout);
|
south.setParent(mainLayout);
|
||||||
south.appendChild(confirmPanel);
|
south.appendChild(confirmPanel);
|
||||||
confirmPanel.addEventListener(Events.ON_CLICK, this);
|
confirmPanel.addActionListener(this);
|
||||||
} // jbInit
|
} // jbInit
|
||||||
|
|
||||||
/** Table Column Layout Info */
|
/** Table Column Layout Info */
|
||||||
|
|
|
@ -46,6 +46,11 @@ html,body {
|
||||||
width: 48px;
|
width: 48px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.action-text-button {
|
||||||
|
height: 32px;
|
||||||
|
width: 80px;
|
||||||
|
}
|
||||||
|
|
||||||
div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
|
div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
}
|
}
|
||||||
|
@ -253,4 +258,9 @@ tr.tab-desktop-tb-m {
|
||||||
|
|
||||||
.status-info {
|
.status-info {
|
||||||
padding-right: 10px;
|
padding-right: 10px;
|
||||||
|
border-left: solid 1px #9CBDFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-border {
|
||||||
|
border: solid 1px #9CBDFF;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue