📄 vcreatefrom.java
字号:
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Business Solution
* The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
* Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
* created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.grid;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;
import javax.swing.event.*;
import java.sql.*;
import java.util.*;
import java.beans.*;
import java.math.*;
import java.text.*;
import org.compiere.util.*;
import org.compiere.model.*;
import org.compiere.apps.*;
import org.compiere.grid.ed.*;
import org.compiere.minigrid.*;
import org.compiere.plaf.*;
import org.compiere.swing.*;
/**
* CreateFrom (Called from GridController.startProcess)
*
* @author Jorg Janke
* @version $Id: VCreateFrom.java,v 1.21 2003/03/18 07:07:39 jjanke Exp $
*/
public abstract class VCreateFrom extends JDialog
implements ActionListener, TableModelListener
{
/**
* Factory - called from APanel
* @param mTab Model Tab for the trx
* @return JDialog
*/
public static VCreateFrom create (MTab mTab)
{
// dynamic init preparation
int AD_Table_ID = Env.getContextAsInt(Env.getCtx(), mTab.getWindowNo(), "BaseTable_ID");
VCreateFrom retValue = null;
if (AD_Table_ID == 392) // C_BankStatement
retValue = new VCreateFromStatement (mTab);
else if (AD_Table_ID == 318) // C_Invoice
retValue = new VCreateFromInvoice (mTab);
else if (AD_Table_ID == 319) // M_InOut
retValue = new VCreateFromShipment (mTab);
else if (AD_Table_ID == 426) // C_PaySelection
return null; // ignore - will call process C_PaySelection_CreateFrom
else // Not supported CreateFrom
{
Log.error("VCreateFrom.create - Unsupported Table=" + AD_Table_ID);
return null;
}
return retValue;
} // create
/*************************************************************************/
/**
* Protected super class Constructor
* @param mTab MTab
*/
VCreateFrom (MTab mTab)
{
super((JFrame)Env.getWindow(mTab.getWindowNo()), true);
Log.trace(Log.l1_User, "VCreateFrom");
m_WindowNo = mTab.getWindowNo();
m_mTab = mTab;
try
{
if (!dynInit())
return;
jbInit();
confirmPanel.addActionListener(this);
// Set status
statusBar.setStatusDB("");
tableChanged(null);
m_initOK = true;
}
catch(Exception e)
{
Log.error("VCreateFrom", e);
m_initOK = false;
}
AEnv.positionCenterWindow(Env.getWindow(m_WindowNo), this);
} // VCreateFrom
/** Window No */
protected int m_WindowNo;
/** Model Tab */
protected MTab m_mTab;
private boolean m_initOK = false;
/** Loaded Order */
protected int m_C_Order_ID = 0;
//
private CPanel parameterPanel = new CPanel();
protected CPanel parameterBankPanel = new CPanel();
private BorderLayout parameterLayout = new BorderLayout();
private JLabel bankAccountLabel = new JLabel();
protected CPanel parameterStdPanel = new CPanel();
private JLabel bPartnerLabel = new JLabel();
protected VLookup bankAccountField;
private GridBagLayout parameterStdLayout = new GridBagLayout();
private GridBagLayout parameterBankLayout = new GridBagLayout();
protected VLookup bPartnerField;
private JLabel orderLabel = new JLabel();
protected JComboBox orderField = new JComboBox();
protected JLabel invoiceLabel = new JLabel();
protected JComboBox invoiceField = new JComboBox();
protected JLabel shipmentLabel = new JLabel();
protected JComboBox shipmentField = new JComboBox();
private JScrollPane dataPane = new JScrollPane();
private CPanel southPanel = new CPanel();
private BorderLayout southLayout = new BorderLayout();
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
protected StatusBar statusBar = new StatusBar();
protected MiniTable dataTable = new MiniTable();
protected JLabel locatorLabel = new JLabel();
protected VLocator locatorField = new VLocator();
/**
* Static Init.
* <pre>
* parameterPanel
* parameterBankPanel
* parameterStdPanel
* bPartner/order/invoice/shopment/licator Label/Field
* dataPane
* southPanel
* confirmPanel
* statusBar
* </pre>
* @throws Exception
*/
private void jbInit() throws Exception
{
CompiereColor.setBackground(this);
parameterPanel.setLayout(parameterLayout);
parameterStdPanel.setLayout(parameterStdLayout);
parameterBankPanel.setLayout(parameterBankLayout);
//
bankAccountLabel.setText(Msg.translate(Env.getCtx(), "C_BankAccount_ID"));
bPartnerLabel.setText(Msg.getElement(Env.getCtx(), "C_BPartner_ID"));
orderLabel.setText(Msg.getElement(Env.getCtx(), "C_Order_ID", false));
invoiceLabel.setText(Msg.getElement(Env.getCtx(), "C_Invoice_ID", false));
shipmentLabel.setText(Msg.getElement(Env.getCtx(), "M_InOut_ID", false));
locatorLabel.setText(Msg.translate(Env.getCtx(), "M_Locator_ID"));
//
this.getContentPane().add(parameterPanel, BorderLayout.NORTH);
parameterPanel.add(parameterBankPanel, BorderLayout.NORTH);
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));
parameterPanel.add(parameterStdPanel, BorderLayout.CENTER);
parameterStdPanel.add(bPartnerLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
if (bPartnerField != null)
parameterStdPanel.add(bPartnerField, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
parameterStdPanel.add(orderLabel, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(orderField, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
parameterStdPanel.add(invoiceLabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(invoiceField, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
parameterStdPanel.add(shipmentLabel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(shipmentField, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
parameterStdPanel.add(locatorLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));
parameterStdPanel.add(locatorField, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 0, 5, 5), 0, 0));
this.getContentPane().add(dataPane, BorderLayout.CENTER);
dataPane.getViewport().add(dataTable, null);
//
this.getContentPane().add(southPanel, BorderLayout.SOUTH);
southPanel.setLayout(southLayout);
southPanel.add(confirmPanel, BorderLayout.CENTER);
southPanel.add(statusBar, BorderLayout.SOUTH);
} // jbInit
/**
* Init OK to be able to make changes?
* @return on if initialized
*/
public boolean isInitOK()
{
return m_initOK;
} // isInitOK
/**
* Dynamic Init
* @throws Exception if Lookups cannot be initialized
* @return true if initialized
*/
abstract boolean dynInit() throws Exception;
/**
* Init Business Partner Details
* @param C_BPartner_ID BPartner
*/
abstract void initBPDetails(int C_BPartner_ID);
/**
* Add Info
*/
abstract void info();
/**
* Save & Insert Data
* @return true if saved
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -