diff --git a/migration/i1.0a-release/oracle/201301311640_TICKET-1001569.sql b/migration/i1.0a-release/oracle/201301311640_TICKET-1001569.sql new file mode 100644 index 0000000000..d4a8b6f270 --- /dev/null +++ b/migration/i1.0a-release/oracle/201301311640_TICKET-1001569.sql @@ -0,0 +1,42 @@ +-- Jan 30, 2013 3:35:24 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +INSERT INTO AD_Form (Name,AccessLevel,Classname,AD_Form_ID,IsBetaFunctionality,EntityType,AD_Form_UU,AD_Org_ID,UpdatedBy,CreatedBy,Updated,Created,AD_Client_ID,IsActive) VALUES ('VCreateFromBatchStatementUI','3','org.compiere.apps.form.VCreateFromBatchStatementUI',200006,'N','D','f7ea6003-2e6b-4873-9e0b-a8c18ec2ee6d',0,100,100,TO_DATE('2013-01-30 15:35:23','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-01-30 15:35:23','YYYY-MM-DD HH24:MI:SS'),0,'Y') +; + +-- Jan 30, 2013 3:35:24 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Name,Help,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Form_Trl_UU ) SELECT l.AD_Language,t.AD_Form_ID, t.Name,t.Help,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=200006 AND NOT EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Form_ID=t.AD_Form_ID) +; + +-- Jan 30, 2013 3:36:19 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +UPDATE AD_Form SET Name='Bank Statement Create From Batch',Updated=TO_DATE('2013-01-30 15:36:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=200006 +; + +-- Jan 30, 2013 3:36:19 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +UPDATE AD_Form_Trl SET IsTranslated='N' WHERE AD_Form_ID=200006 +; + +-- Jan 30, 2013 3:37:04 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,AD_Form_ID,Name,Value,AD_Org_ID,AD_Client_ID,Created,Updated,UpdatedBy,IsActive,CreatedBy) VALUES ('N',200032,'N','N','986e4432-909a-4ca4-a838-0868f7d022a7','3','N','N',0,0,'Y','D',200006,'Bank Statement Create From Batch','C_BankStatement X_CreateFromBatch',0,0,TO_DATE('2013-01-30 15:37:04','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2013-01-30 15:37:04','YYYY-MM-DD HH24:MI:SS'),100,'Y',100) +; + +-- Jan 30, 2013 3:37:04 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Trl_UU ) SELECT l.AD_Language,t.AD_Process_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=200032 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) +; + +-- Jan 30, 2013 3:37:34 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +UPDATE AD_Column SET AD_Process_ID=200032,Updated=TO_DATE('2013-01-30 15:37:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208442 +; + +-- Jan 30, 2013 3:59:04 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +UPDATE AD_Form SET Classname='org.compiere.apps.form.VStatementCreateFromBatch',Updated=TO_DATE('2013-01-30 15:59:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=200006 +; + +SELECT register_migration_script('201301311640_TICKET-1001569.sql') FROM dual +; \ No newline at end of file diff --git a/migration/i1.0a-release/postgresql/201301311640_TICKET-1001569.sql b/migration/i1.0a-release/postgresql/201301311640_TICKET-1001569.sql new file mode 100644 index 0000000000..810eae97e6 --- /dev/null +++ b/migration/i1.0a-release/postgresql/201301311640_TICKET-1001569.sql @@ -0,0 +1,42 @@ +-- Jan 30, 2013 3:35:24 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +INSERT INTO AD_Form (Name,AccessLevel,Classname,AD_Form_ID,IsBetaFunctionality,EntityType,AD_Form_UU,AD_Org_ID,UpdatedBy,CreatedBy,Updated,Created,AD_Client_ID,IsActive) VALUES ('VCreateFromBatchStatementUI','3','org.compiere.apps.form.VCreateFromBatchStatementUI',200006,'N','D','f7ea6003-2e6b-4873-9e0b-a8c18ec2ee6d',0,100,100,TO_TIMESTAMP('2013-01-30 15:35:23','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-01-30 15:35:23','YYYY-MM-DD HH24:MI:SS'),0,'Y') +; + +-- Jan 30, 2013 3:35:24 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +INSERT INTO AD_Form_Trl (AD_Language,AD_Form_ID, Name,Help,Description, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Form_Trl_UU ) SELECT l.AD_Language,t.AD_Form_ID, t.Name,t.Help,t.Description, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Form t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Form_ID=200006 AND NOT EXISTS (SELECT * FROM AD_Form_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Form_ID=t.AD_Form_ID) +; + +-- Jan 30, 2013 3:36:19 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +UPDATE AD_Form SET Name='Bank Statement Create From Batch',Updated=TO_TIMESTAMP('2013-01-30 15:36:19','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=200006 +; + +-- Jan 30, 2013 3:36:19 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +UPDATE AD_Form_Trl SET IsTranslated='N' WHERE AD_Form_ID=200006 +; + +-- Jan 30, 2013 3:37:04 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +INSERT INTO AD_Process (CopyFromProcess,AD_Process_ID,IsDirectPrint,IsReport,AD_Process_UU,AccessLevel,IsBetaFunctionality,IsServerProcess,Statistic_Seconds,Statistic_Count,ShowHelp,EntityType,AD_Form_ID,Name,Value,AD_Org_ID,AD_Client_ID,Created,Updated,UpdatedBy,IsActive,CreatedBy) VALUES ('N',200032,'N','N','986e4432-909a-4ca4-a838-0868f7d022a7','3','N','N',0,0,'Y','D',200006,'Bank Statement Create From Batch','C_BankStatement X_CreateFromBatch',0,0,TO_TIMESTAMP('2013-01-30 15:37:04','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2013-01-30 15:37:04','YYYY-MM-DD HH24:MI:SS'),100,'Y',100) +; + +-- Jan 30, 2013 3:37:04 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +INSERT INTO AD_Process_Trl (AD_Language,AD_Process_ID, Help,Description,Name, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Process_Trl_UU ) SELECT l.AD_Language,t.AD_Process_ID, t.Help,t.Description,t.Name, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Process t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Process_ID=200032 AND NOT EXISTS (SELECT * FROM AD_Process_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Process_ID=t.AD_Process_ID) +; + +-- Jan 30, 2013 3:37:34 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +UPDATE AD_Column SET AD_Process_ID=200032,Updated=TO_TIMESTAMP('2013-01-30 15:37:34','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=208442 +; + +-- Jan 30, 2013 3:59:04 PM SGT +-- Ticket #1001569: Move receipts into batch from QS to Idempiere +UPDATE AD_Form SET Classname='org.compiere.apps.form.VStatementCreateFromBatch',Updated=TO_TIMESTAMP('2013-01-30 15:59:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Form_ID=200006 +; + +SELECT register_migration_script('201301311640_TICKET-1001569.sql') FROM dual +; \ No newline at end of file diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutCreateConfirm.java b/org.adempiere.base.process/src/org/compiere/process/InOutCreateConfirm.java index f7d11ec0ff..a56d35632e 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InOutCreateConfirm.java +++ b/org.adempiere.base.process/src/org/compiere/process/InOutCreateConfirm.java @@ -70,6 +70,9 @@ public class InOutCreateConfirm extends SvrProcess if (confirm == null) throw new Exception ("Cannot create Confirmation for " + shipment.getDocumentNo()); // + + addLog(confirm.getM_InOutConfirm_ID(), null, null, confirm.getDocumentNo(), confirm.get_Table_ID(), confirm.getM_InOutConfirm_ID()); + return confirm.getDocumentNo(); } // doIt diff --git a/org.adempiere.base.process/src/org/compiere/process/InOutCreateInvoice.java b/org.adempiere.base.process/src/org/compiere/process/InOutCreateInvoice.java index 36e725e84e..4a9c781e51 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InOutCreateInvoice.java +++ b/org.adempiere.base.process/src/org/compiere/process/InOutCreateInvoice.java @@ -146,6 +146,8 @@ public class InOutCreateInvoice extends SvrProcess invoice.saveEx(); } + addLog(invoice.getC_Invoice_ID(), invoice.getDateInvoiced(), invoice.getGrandTotal(), invoice.getDocumentNo(), invoice.get_Table_ID(), invoice.getC_Invoice_ID()); + return invoice.getDocumentNo(); } // InOutCreateInvoice diff --git a/org.adempiere.base.process/src/org/compiere/process/InvoiceCreateInOut.java b/org.adempiere.base.process/src/org/compiere/process/InvoiceCreateInOut.java index efb0cd8f0c..51b33ac208 100644 --- a/org.adempiere.base.process/src/org/compiere/process/InvoiceCreateInOut.java +++ b/org.adempiere.base.process/src/org/compiere/process/InvoiceCreateInOut.java @@ -92,6 +92,8 @@ public class InvoiceCreateInOut extends SvrProcess } if (m_inout == null) throw new InvoiceFullyMatchedException(); + + addLog(m_inout.getM_InOut_ID(), m_inout.getMovementDate(), null, m_inout.getDocumentNo(), m_inout.get_Table_ID(), m_inout.getM_InOut_ID()); // return m_inout.getDocumentNo(); } // doIt diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java index 50a0885c8c..610f9f14ec 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/APanel.java @@ -2549,12 +2549,12 @@ public final class APanel extends CPanel } // DocAction // Pop up Create From - else if (col.equals("CreateFrom") || col.equals("X_CreateFromBatch")) + else if (col.equals("CreateFrom")) { // Run form only if the button has no process defined - teo_sarca [ 1974354 ] if (vButton.getProcess_ID() <= 0) { - ICreateFrom cf = VCreateFromFactory.create(m_curTab, col); + ICreateFrom cf = VCreateFromFactory.create(m_curTab); if(cf != null) { if(cf.isInitOK()) @@ -2660,7 +2660,7 @@ public final class APanel extends CPanel pi.setAD_User_ID (Env.getAD_User_ID(m_ctx)); pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx)); ff.setProcessInfo(pi); - ff.openForm(form_ID); + ff.openForm(form_ID, m_curTab); ff.pack(); AEnv.showCenterScreen(ff); return; diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/FormFrame.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/FormFrame.java index 477a391026..eadbaadadf 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/form/FormFrame.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/FormFrame.java @@ -39,6 +39,7 @@ import org.compiere.apps.AGlassPane; import org.compiere.apps.AMenu; import org.compiere.apps.Help; import org.compiere.apps.WindowMenu; +import org.compiere.model.GridTab; import org.compiere.model.MRole; import org.compiere.model.MUser; import org.compiere.process.ProcessInfo; @@ -251,6 +252,11 @@ public class FormFrame extends CFrame * @return true if form opened */ public boolean openForm (int AD_Form_ID) + { + return openForm(AD_Form_ID, null); + } + + public boolean openForm (int AD_Form_ID, GridTab gridTab) { Properties ctx = Env.getCtx(); // @@ -296,7 +302,7 @@ public class FormFrame extends CFrame if (className == null) return false; // - return openForm(AD_Form_ID, className, name); + return openForm(AD_Form_ID, className, name, gridTab); } // openForm /** @@ -307,11 +313,17 @@ public class FormFrame extends CFrame * @return true if started */ protected boolean openForm (int AD_Form_ID, String className, String name) + { + return openForm(AD_Form_ID, className, name, null); + } + + protected boolean openForm (int AD_Form_ID, String className, String name, GridTab gridTab) { log.info("AD_Form_ID=" + AD_Form_ID + " - Class=" + className); Properties ctx = Env.getCtx(); Env.setContext(ctx, m_WindowNo, "WindowName", name); setTitle(Env.getHeader(ctx, m_WindowNo)); + this.gridTab = gridTab; try { @@ -481,5 +493,11 @@ public class FormFrame extends CFrame { return menuBar; } - + + private GridTab gridTab; + + public GridTab getGridTab() + { + return gridTab; + } } // FormFrame diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/form/VCreateFromForm.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VCreateFromForm.java new file mode 100644 index 0000000000..426c54e778 --- /dev/null +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VCreateFromForm.java @@ -0,0 +1,237 @@ +/****************************************************************************** + * Copyright (C) 2013 Elaine Tan * + * Copyright (C) 2013 Trek Global + * 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.compiere.apps.form; + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JScrollPane; +import javax.swing.event.TableModelEvent; +import javax.swing.event.TableModelListener; +import javax.swing.table.TableModel; + +import org.compiere.apps.ADialog; +import org.compiere.apps.AppsAction; +import org.compiere.apps.ConfirmPanel; +import org.compiere.apps.StatusBar; +import org.compiere.minigrid.MiniTable; +import org.compiere.swing.CPanel; +import org.compiere.swing.CToggleButton; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Trx; +import org.compiere.util.TrxRunnable; + +/** + * + * @author Elaine + * + */ +public class VCreateFromForm extends CPanel implements ActionListener, TableModelListener +{ + + /** + * + */ + private static final long serialVersionUID = -8242250391030501785L; + private CreateFromForm form; + private int windowNo; + /** FormFrame */ + private FormFrame m_frame; + + private CPanel parameterPanel = new CPanel(); + private ConfirmPanel confirmPanel = new ConfirmPanel(true); + private StatusBar statusBar = new StatusBar(); + private MiniTable dataTable = new MiniTable(); + + private static final String SELECT_DESELECT_ALL = "SelectAll"; + protected AppsAction selectDeselectAllAction = new AppsAction (SELECT_DESELECT_ALL, null, Msg.getMsg(Env.getCtx(), SELECT_DESELECT_ALL), true); + + public VCreateFromForm(CreateFromForm createFrom, FormFrame frame) + { + super(); + this.form = createFrom; + this.m_frame = frame; + + try + { + jbInit(); + confirmPanel.addActionListener(this); + + statusBar.setStatusDB(""); + tableChanged(null); + } + catch(Exception e) + { + + } + } + + protected void jbInit() throws Exception + { + m_frame.getContentPane().add(parameterPanel, BorderLayout.NORTH); + + JScrollPane dataPane = new JScrollPane(); + m_frame.getContentPane().add(dataPane, BorderLayout.CENTER); + dataPane.getViewport().add(dataTable, null); + + CToggleButton selectAllButton = (CToggleButton)selectDeselectAllAction.getButton(); + selectAllButton.setMargin(ConfirmPanel.s_insets); + selectAllButton.addActionListener(this); + confirmPanel.addComponent(selectAllButton); + + CPanel southPanel = new CPanel(); + m_frame.getContentPane().add(southPanel, BorderLayout.SOUTH); + BorderLayout southLayout = new BorderLayout(); + southPanel.setLayout(southLayout); + southPanel.add(confirmPanel, BorderLayout.CENTER); + southPanel.add(statusBar, BorderLayout.SOUTH); + } + + public void actionPerformed(ActionEvent e) + { + if (e.getActionCommand().equals(ConfirmPanel.A_OK)) + { + try + { + Trx.run(new TrxRunnable() + { + public void run(String trxName) + { + if (save(trxName)) + { + dispose(); + } + } + }); + } + catch (Exception ex) + { + ADialog.error(windowNo, this, "Error", ex.getLocalizedMessage()); + } + } + // Cancel + else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL)) + { + dispose(); + } + // Select All + // Trifon + else if (e.getActionCommand().equals(SELECT_DESELECT_ALL)) + { + TableModel model = dataTable.getModel(); + model.removeTableModelListener(this); + + // select or deselect all as required + int rows = model.getRowCount(); + Boolean selectAll = selectDeselectAllAction.isPressed() ? Boolean.FALSE : Boolean.TRUE; + for (int i = 0; i < rows; i++) + model.setValueAt(selectAll, i, 0); + + model.addTableModelListener(this); + + info(); + } + } + + public boolean save(String trxName) + { + dataTable.stopEditor(true); + + TableModel model = dataTable.getModel(); + int rows = model.getRowCount(); + if (rows == 0) + return false; + + return form.save(dataTable, trxName, m_frame.getGridTab()); + } + + public void tableChanged (TableModelEvent e) + { + int type = -1; + if (e != null) + { + type = e.getType(); + if (type != TableModelEvent.UPDATE) + return; + + if (e.getColumn() == 0) + { + TableModel model = dataTable.getModel(); + Boolean isPressed = (Boolean)model.getValueAt(0, 0); + int rows = model.getRowCount(); + boolean equals = true; + for (int i = 1; equals && i < rows; i++) + { + equals = isPressed.equals(model.getValueAt(i, 0)); + } + + if (equals) { + selectDeselectAllAction.setPressed(isPressed); + } + } + } + info(); + dataTable.repaint(); + } + + public void info() + { + TableModel model = dataTable.getModel(); + int rows = model.getRowCount(); + int count = 0; + for (int i = 0; i < rows; i++) + { + if (((Boolean)model.getValueAt(i, 0)).booleanValue()) + count++; + } + setStatusLine(count, null); + + form.info(dataTable, statusBar); + } + + public void setStatusLine(int selectedRowCount, String text) + { + StringBuilder sb = new StringBuilder(String.valueOf(selectedRowCount)); + if (text != null && text.trim().length() > 0) { + sb.append(" - ").append(text); + } + statusBar.setStatusLine(sb.toString()); + // + confirmPanel.getOKButton().setEnabled(selectedRowCount > 0); + } + + public MiniTable getMiniTable() + { + return dataTable; + } + + public CPanel getParameterPanel() + { + return parameterPanel; + } + + public ConfirmPanel getConfirmPanel() + { + return confirmPanel; + } + + public void dispose() + { + if (m_frame != null) + m_frame.dispose(); + m_frame = null; + } +} \ No newline at end of file diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromStatementBatchUI.java b/org.adempiere.ui.swing/src/org/compiere/apps/form/VStatementCreateFromBatch.java similarity index 87% rename from org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromStatementBatchUI.java rename to org.adempiere.ui.swing/src/org/compiere/apps/form/VStatementCreateFromBatch.java index 2cc5871c20..d16c920cab 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromStatementBatchUI.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/form/VStatementCreateFromBatch.java @@ -11,7 +11,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * *****************************************************************************/ -package org.compiere.grid; +package org.compiere.apps.form; import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; @@ -30,13 +30,11 @@ import javax.swing.JLabel; import javax.swing.table.DefaultTableModel; import org.compiere.apps.ADialog; -import org.compiere.apps.AEnv; import org.compiere.apps.ConfirmPanel; import org.compiere.grid.ed.VDate; import org.compiere.grid.ed.VLookup; import org.compiere.grid.ed.VNumber; import org.compiere.grid.ed.VString; -import org.compiere.model.GridTab; import org.compiere.model.MBankStatement; import org.compiere.model.MColumn; import org.compiere.model.MLookup; @@ -56,41 +54,40 @@ import org.compiere.util.Msg; * @author Elaine * */ -public class VCreateFromStatementBatchUI extends CreateFromStatementBatch implements ActionListener +public class VStatementCreateFromBatch extends StatementCreateFromBatch implements ActionListener, FormPanel { - private VCreateFromDialog dialog; - - public VCreateFromStatementBatchUI(GridTab mTab) + private VCreateFromForm form; + private FormFrame m_frame; + + public void init (int WindowNo, FormFrame frame) { - super(mTab); - log.info(getGridTab().toString()); - - dialog = new VCreateFromDialog(this, getGridTab().getWindowNo(), true); - - p_WindowNo = getGridTab().getWindowNo(); - + form = new VCreateFromForm(this, frame); + p_WindowNo = WindowNo; + m_frame = frame; + initForm(); + } + + @Override + public void initForm() + { try { if (!dynInit()) return; jbInit(); - - setInitOK(true); } catch(Exception e) { - log.log(Level.SEVERE, "", e); - setInitOK(false); + log.log(Level.SEVERE, "init", e); } - AEnv.positionCenterWindow(AEnv.getWindow(p_WindowNo), dialog); - } // VCreateFrom + } /** Window No */ private int p_WindowNo; /** Logger */ private CLogger log = CLogger.getCLogger(getClass()); - + private JLabel bankAccountLabel = new JLabel(); protected VLookup bankAccountField; @@ -127,25 +124,25 @@ public class VCreateFromStatementBatchUI extends CreateFromStatementBatch implem */ public boolean dynInit() throws Exception { - log.config(""); - super.dynInit(); + log.config(""); + //Refresh button CButton refreshButton = ConfirmPanel.createRefreshButton(false); refreshButton.setMargin(new Insets (1, 10, 0, 10)); refreshButton.setDefaultCapable(true); refreshButton.addActionListener(this); - dialog.getConfirmPanel().addButton(refreshButton); - dialog.getRootPane().setDefaultButton(refreshButton); + form.getConfirmPanel().addButton(refreshButton); +// form.getRootPane().setDefaultButton(refreshButton); - if (getGridTab().getValue("C_BankStatement_ID") == null) + if (m_frame.getGridTab() != null && m_frame.getGridTab().getValue("C_BankStatement_ID") == null) { - ADialog.error(0, dialog, "SaveErrorRowNotFound"); + ADialog.error(0, form, "SaveErrorRowNotFound"); return false; } - dialog.setTitle(getTitle()); + m_frame.setTitle(getTitle()); int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir); @@ -180,7 +177,7 @@ public class VCreateFromStatementBatchUI extends CreateFromStatementBatch implem amtFromField.addActionListener(this); amtToField.addActionListener(this); - loadBankAccount(); + executeQuery(); return true; } // dynInit @@ -217,7 +214,7 @@ public class VCreateFromStatementBatchUI extends CreateFromStatementBatch implem amtToLabel.setLabelFor(amtToField); amtToField.setToolTipText(Msg.translate(Env.getCtx(), "AmtTo")); - CPanel parameterPanel = dialog.getParameterPanel(); + CPanel parameterPanel = form.getParameterPanel(); parameterPanel.setLayout(new BorderLayout()); CPanel parameterBankPanel = new CPanel(); @@ -290,46 +287,38 @@ public class VCreateFromStatementBatchUI extends CreateFromStatementBatch implem if(e.getActionCommand().equals(ConfirmPanel.A_REFRESH)) { Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); - loadBankAccount(); - dialog.tableChanged(null); + executeQuery(); + form.tableChanged(null); Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } } // actionPerformed - protected void loadBankAccount() + public void executeQuery() { loadTableOIS(getBankAccountData(bankAccountField.getValue(), bPartnerLookup.getValue(), documentNoField.getText(), dateFromField.getValue(), dateToField.getValue(), amtFromField.getValue(), amtToField.getValue(), - documentTypeField.getValue(), tenderTypeField.getValue(), authorizationField.getText())); + documentTypeField.getValue(), tenderTypeField.getValue(), authorizationField.getText(), + m_frame.getGridTab())); } protected void loadTableOIS (Vector> data) { // Remove previous listeners - dialog.getMiniTable().getModel().removeTableModelListener(dialog); + form.getMiniTable().getModel().removeTableModelListener(form); // Set Model DefaultTableModel model = new DefaultTableModel(data, getOISColumnNames()); - model.addTableModelListener(dialog); - dialog.getMiniTable().setModel(model); + model.addTableModelListener(form); + form.getMiniTable().setModel(model); // - configureMiniTable(dialog.getMiniTable()); + configureMiniTable(form.getMiniTable()); } - public void showWindow() + public void dispose() { - dialog.setVisible(true); - } - - public void closeWindow() - { - dialog.dispose(); - } - - @Override - public Object getWindow() - { - return dialog; + if (m_frame != null) + m_frame.dispose(); + m_frame = null; } } \ No newline at end of file diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/DefaultCreateFromFactory.java b/org.adempiere.ui.swing/src/org/compiere/grid/DefaultCreateFromFactory.java index c067a3e7f9..0884e327b7 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/DefaultCreateFromFactory.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/DefaultCreateFromFactory.java @@ -30,30 +30,21 @@ public class DefaultCreateFromFactory implements ICreateFromFactory { @Override - public ICreateFrom create(GridTab mTab, String columnName) + public ICreateFrom create(GridTab mTab) { String tableName = mTab.getTableName(); - if (columnName.equals("CreateFrom")) - { - if (tableName.equals(I_C_Invoice.Table_Name)) - return new VCreateFromInvoiceUI(mTab); - else if (tableName.equals(I_C_BankStatement.Table_Name)) -// return new VCreateFromStatementUI(mTab); - return new VCreateFromStatementBatchUI(mTab); - else if (tableName.equals(I_M_InOut.Table_Name)) - return new VCreateFromShipmentUI(mTab); - else if (tableName.equals(I_M_RMA.Table_Name)) - return new VCreateFromRMAUI(mTab); - else if (tableName.equals(I_M_PackageMPS.Table_Name)) - return new VCreateFromPackageShipmentUI(mTab); - else if (tableName.equals(I_X_DepositBatch.Table_Name)) - return new VCreateFromDepositBatchUI(mTab); - } - else if (columnName.equalsIgnoreCase("X_CreateFromBatch")) - { - if (tableName.equals(I_C_BankStatement.Table_Name)) - return new VCreateFromBatchStatementUI(mTab); - } + if (tableName.equals(I_C_Invoice.Table_Name)) + return new VCreateFromInvoiceUI(mTab); + else if (tableName.equals(I_C_BankStatement.Table_Name)) + return new VCreateFromStatementUI(mTab); + else if (tableName.equals(I_M_InOut.Table_Name)) + return new VCreateFromShipmentUI(mTab); + else if (tableName.equals(I_M_RMA.Table_Name)) + return new VCreateFromRMAUI(mTab); + else if (tableName.equals(I_M_PackageMPS.Table_Name)) + return new VCreateFromPackageShipmentUI(mTab); + else if (tableName.equals(I_X_DepositBatch.Table_Name)) + return new VCreateFromDepositBatchUI(mTab); return null; } diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromBatchStatementUI.java b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromBatchStatementUI.java deleted file mode 100644 index d6b144ee78..0000000000 --- a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromBatchStatementUI.java +++ /dev/null @@ -1,335 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2013 Elaine Tan * - * Copyright (C) 2013 Trek Global - * 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.compiere.grid; - -import static org.compiere.model.SystemIDs.COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; - -import java.awt.BorderLayout; -import java.awt.Cursor; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.sql.Timestamp; -import java.util.Vector; -import java.util.logging.Level; - -import javax.swing.JLabel; -import javax.swing.table.DefaultTableModel; - -import org.compiere.apps.ADialog; -import org.compiere.apps.AEnv; -import org.compiere.apps.ConfirmPanel; -import org.compiere.grid.ed.VDate; -import org.compiere.grid.ed.VLookup; -import org.compiere.grid.ed.VNumber; -import org.compiere.grid.ed.VString; -import org.compiere.model.GridTab; -import org.compiere.model.MBankStatement; -import org.compiere.model.MColumn; -import org.compiere.model.MLookup; -import org.compiere.model.MLookupFactory; -import org.compiere.model.MPayment; -import org.compiere.swing.CButton; -import org.compiere.swing.CLabel; -import org.compiere.swing.CPanel; -import org.compiere.swing.CTextField; -import org.compiere.util.CLogger; -import org.compiere.util.DisplayType; -import org.compiere.util.Env; -import org.compiere.util.Msg; - -/** - * - * @author Elaine - * - */ -public class VCreateFromBatchStatementUI extends CreateFromBatchStatement implements ActionListener -{ - private VCreateFromDialog dialog; - - public VCreateFromBatchStatementUI(GridTab mTab) - { - super(mTab); - log.info(getGridTab().toString()); - - dialog = new VCreateFromDialog(this, getGridTab().getWindowNo(), true); - - p_WindowNo = getGridTab().getWindowNo(); - - try - { - if (!dynInit()) - return; - jbInit(); - - setInitOK(true); - } - catch(Exception e) - { - log.log(Level.SEVERE, "", e); - setInitOK(false); - } - AEnv.positionCenterWindow(AEnv.getWindow(p_WindowNo), dialog); - } // VCreateFrom - - /** Window No */ - private int p_WindowNo; - - /** Logger */ - private CLogger log = CLogger.getCLogger(getClass()); - - private JLabel bankAccountLabel = new JLabel(); - protected VLookup bankAccountField; - - private CLabel documentNoLabel = new CLabel(Msg.translate(Env.getCtx(), "DocumentNo")); - protected CTextField documentNoField = new CTextField(10); - - private JLabel documentTypeLabel = new JLabel(); - protected VLookup documentTypeField; - - private JLabel authorizationLabel = new JLabel(); - protected VString authorizationField = new VString(); - - private JLabel tenderTypeLabel = new JLabel(); - protected VLookup tenderTypeField; - - private CLabel amtFromLabel = new CLabel(Msg.translate(Env.getCtx(), "PayAmt")); - protected VNumber amtFromField = new VNumber("AmtFrom", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtFrom")); - private CLabel amtToLabel = new CLabel("-"); - protected VNumber amtToField = new VNumber("AmtTo", false, false, true, DisplayType.Amount, Msg.translate(Env.getCtx(), "AmtTo")); - - protected CLabel BPartner_idLabel = new CLabel(Msg.translate(Env.getCtx(), "BPartner")); - protected VLookup bPartnerLookup; - - private CLabel dateFromLabel = new CLabel(Msg.translate(Env.getCtx(), "DateTrx")); - protected VDate dateFromField = new VDate("DateFrom", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateFrom")); - private CLabel dateToLabel = new CLabel("-"); - protected VDate dateToField = new VDate("DateTo", false, false, true, DisplayType.Date, Msg.translate(Env.getCtx(), "DateTo")); - - - /** - * Dynamic Init - * @throws Exception if Lookups cannot be initialized - * @return true if initialized - */ - public boolean dynInit() throws Exception - { - log.config(""); - - super.dynInit(); - - //Refresh button - CButton refreshButton = ConfirmPanel.createRefreshButton(false); - refreshButton.setMargin(new Insets (1, 10, 0, 10)); - refreshButton.setDefaultCapable(true); - refreshButton.addActionListener(this); - dialog.getConfirmPanel().addButton(refreshButton); - dialog.getRootPane().setDefaultButton(refreshButton); - - if (getGridTab().getValue("C_BankStatement_ID") == null) - { - ADialog.error(0, dialog, "SaveErrorRowNotFound"); - return false; - } - - dialog.setTitle(getTitle()); - - int AD_Column_ID = COLUMN_C_BANKSTATEMENT_C_BANKACCOUNT_ID; // C_BankStatement.C_BankAccount_ID - MLookup lookup = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir); - bankAccountField = new VLookup ("C_BankAccount_ID", true, true, true, lookup); - // Set Default - int C_BankAccount_ID = Env.getContextAsInt(Env.getCtx(), p_WindowNo, "C_BankAccount_ID"); - bankAccountField.setValue(new Integer(C_BankAccount_ID)); - bankAccountField.addActionListener(this); - // initial Loading - authorizationField = new VString ("authorization", false, false, true, 10, 30, null, null); - authorizationField.addActionListener(this); - - MLookup lookupDocument = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir); - documentTypeField = new VLookup (MPayment.COLUMNNAME_C_DocType_ID,false,false,true,lookupDocument); - documentTypeField.addActionListener(this); - - MLookup lookupTender = MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List); - tenderTypeField = new VLookup (MPayment.COLUMNNAME_TenderType,false,false,true,lookupTender); - tenderTypeField.addActionListener(this); - - bPartnerLookup = new VLookup("C_BPartner_ID", false, false, true, - MLookupFactory.get (Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search)); - BPartner_idLabel.setLabelFor(bPartnerLookup); - bPartnerLookup.addActionListener(this); - - Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate); - dateToField.setValue(date); - - documentNoField.addActionListener(this); - dateFromField.addActionListener(this); - dateToField.addActionListener(this); - amtFromField.addActionListener(this); - amtToField.addActionListener(this); - - loadBankAccount(); - - return true; - } // dynInit - - /** - * Static Init. - *
- * parameterPanel - * parameterBankPanel - * parameterStdPanel - * bPartner/order/invoice/shopment/licator Label/Field - * dataPane - * southPanel - * confirmPanel - * statusBar - *- * @throws Exception - */ - private void jbInit() throws Exception - { - bankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID")); - authorizationLabel.setText(Msg.translate(Env.getCtx(), "R_AuthCode")); - - documentTypeLabel.setText(Msg.translate(Env.getCtx(), "C_DocType_ID")); - tenderTypeLabel.setText(Msg.translate(Env.getCtx(), "TenderType")); - - documentNoLabel.setLabelFor(documentNoField); - dateFromLabel.setLabelFor(dateFromField); - dateFromField.setToolTipText(Msg.translate(Env.getCtx(), "DateFrom")); - dateToLabel.setLabelFor(dateToField); - dateToField.setToolTipText(Msg.translate(Env.getCtx(), "DateTo")); - amtFromLabel.setLabelFor(amtFromField); - amtFromField.setToolTipText(Msg.translate(Env.getCtx(), "AmtFrom")); - amtToLabel.setLabelFor(amtToField); - amtToField.setToolTipText(Msg.translate(Env.getCtx(), "AmtTo")); - - CPanel parameterPanel = dialog.getParameterPanel(); - parameterPanel.setLayout(new BorderLayout()); - - CPanel parameterBankPanel = new CPanel(); - parameterBankPanel.setLayout(new GridBagLayout()); - parameterPanel.add(parameterBankPanel, BorderLayout.CENTER); - - parameterBankPanel.add(bankAccountLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - if (bankAccountField != null) - parameterBankPanel.add(bankAccountField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - - parameterBankPanel.add(documentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - if(documentTypeField!= null) - parameterBankPanel.add(documentTypeField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - - parameterBankPanel.add(tenderTypeLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - if(tenderTypeField!=null) - parameterBankPanel.add(tenderTypeField, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - - parameterBankPanel.add(BPartner_idLabel, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - parameterBankPanel.add(bPartnerLookup, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - - parameterBankPanel.add(documentNoLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - parameterBankPanel.add(documentNoField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - - parameterBankPanel.add(authorizationLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - parameterBankPanel.add(authorizationField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - - parameterBankPanel.add(amtFromLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - parameterBankPanel.add(amtFromField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - parameterBankPanel.add(amtToLabel, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - parameterBankPanel.add(amtToField, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - - parameterBankPanel.add(dateFromLabel, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - parameterBankPanel.add(dateFromField, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - parameterBankPanel.add(dateToLabel, new GridBagConstraints(4, 3, 1, 1, 0.0, 0.0 - ,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); - parameterBankPanel.add(dateToField, new GridBagConstraints(5, 3, 1, 1, 0.0, 0.0 - ,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0)); - - } // jbInit - - /*************************************************************************/ - - /** - * Action Listener - * @param e event - */ - public void actionPerformed(ActionEvent e) - { - log.config("Action=" + e.getActionCommand()); -// Object source = e.getSource(); - if(e.getActionCommand().equals(ConfirmPanel.A_REFRESH)) - { - Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); - loadBankAccount(); - dialog.tableChanged(null); - Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); - } - } // actionPerformed - - protected void loadBankAccount() - { - loadTableOIS(getBankAccountData(bankAccountField.getValue(), bPartnerLookup.getValue(), - documentNoField.getText(), dateFromField.getValue(), dateToField.getValue(), - amtFromField.getValue(), amtToField.getValue(), - documentTypeField.getValue(), tenderTypeField.getValue(), authorizationField.getText())); - } - - protected void loadTableOIS (Vector> data) - { - // Remove previous listeners - dialog.getMiniTable().getModel().removeTableModelListener(dialog); - // Set Model - DefaultTableModel model = new DefaultTableModel(data, getOISColumnNames()); - model.addTableModelListener(dialog); - dialog.getMiniTable().setModel(model); - // - - configureMiniTable(dialog.getMiniTable()); - } - - public void showWindow() - { - dialog.setVisible(true); - } - - public void closeWindow() - { - dialog.dispose(); - } - - @Override - public Object getWindow() - { - return dialog; - } -} \ No newline at end of file diff --git a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromFactory.java b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromFactory.java index c2f54bc56d..2eb8f4e4f4 100644 --- a/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromFactory.java +++ b/org.adempiere.ui.swing/src/org/compiere/grid/VCreateFromFactory.java @@ -20,13 +20,13 @@ import org.compiere.model.GridTab; public class VCreateFromFactory { - public static ICreateFrom create (GridTab mTab, String columnName) + public static ICreateFrom create (GridTab mTab) { ICreateFrom createFrom = null; List
+ * The Callout is in the string of
+ * "class.method;class.method;"
+ * If there is no class name, i.e. only a method name, the class is regarded
+ * as CalloutSystem.
+ * The class needs to comply with the Interface Callout.
+ *
+ * @param field field
+ * @return error message or ""
+ * @see org.compiere.model.Callout
+ */
+ private String processButtonCallout (IProcessButton button)
+ {
+ IADTabpanel adtab = findADTabpanel(button);
+ if (adtab != null) {
+ GridField field = adtab.getGridTab().getField(button.getColumnName());
+ if (field != null)
+ return adtab.getGridTab().processCallout(field);
+ else
+ return "";
+ } else {
+ return "";
+ }
+ } // processButtonCallout
+
+ public IADTabpanel findADTabpanel(IProcessButton button) {
+ IADTabpanel adtab = null;
+ if (button.getADTabpanel() != null)
+ return button.getADTabpanel();
+
+ Component c = button instanceof WEditor ? ((WEditor)button).getComponent() : (Component)button;
+ while (c != null) {
+ if (c instanceof IADTabpanel) {
+ adtab = (IADTabpanel) c;
+ break;
+ }
+ c = c.getParent();
+ }
+ return adtab;
+ }
+
+ /**
+ *
+ * @return IADTab
+ */
+ public IADTabbox getADTab() {
+ return adTabbox;
+ }
+
+ /**
+ * @param pi
+ */
+ public void executeASync(ProcessInfo pi) {
+ }
+
+ /**
+ * @param pi
+ */
+ private void onModalClose(ProcessInfo pi) {
+ boolean notPrint = pi != null
+ && pi.getAD_Process_ID() != adTabbox.getSelectedGridTab().getAD_Process_ID()
+ && pi.isReportingProcess() == false;
+ //
+ // Process Result
+
+ if (Executions.getCurrent() != null)
+ {
+ if (notPrint) // refresh if not print
+ {
+ updateUI(pi);
+ }
+ }
+ else
+ {
+ try {
+ //acquire desktop, 2 second timeout
+ Executions.activate(getComponent().getDesktop(), 2000);
+ try {
+ if (notPrint) // refresh if not print
+ {
+ updateUI(pi);
+ }
+ } catch(Error ex){
+ throw ex;
+ } finally{
+ //release full control of desktop
+ Executions.deactivate(getComponent().getDesktop());
+ }
+ } catch (Exception e) {
+ logger.log(Level.WARNING, "Failed to update UI upon unlock.", e);
+ }
+ }
+ }
+
+ private void updateUI(ProcessInfo pi) {
+ // Timeout
+ if (pi.isTimeout()) // set temporarily to R/O
+ Env.setContext(ctx, curWindowNo, "Processed", "Y");
+ // Update Status Line
+ String summary = pi.getSummary();
+ if (summary != null && summary.indexOf('@') != -1)
+ pi.setSummary(Msg.parseTranslation(Env.getCtx(), summary));
+
+ // Get Log Info
+ ProcessInfoUtil.setLogFromDB(pi);
+ ProcessInfoLog m_logs[] = pi.getLogs();
+ breadCrumb.setStatusLine(pi.getSummary(), pi.isError(),m_logs);
+ if (m_logs != null) {
+ ProcessInfoDialog dialog = new ProcessInfoDialog(AEnv.getDialogHeader(ctx, curWindowNo),Env.getHeader(ctx, curWindowNo), m_logs);
+ dialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener