📄 archiveviewer.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 Smart Business Solution. The Initial
* Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
* are Copyright (C) 1999-2005 Jorg Janke.
* All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved.
* Contributor(s): ______________________________________.
*****************************************************************************/
package org.compiere.apps.form;
import java.awt.*;
import java.awt.event.*;
import java.beans.*;
import java.io.*;
import java.sql.*;
import java.util.logging.*;
import org.compiere.apps.*;
import org.compiere.grid.ed.*;
import org.compiere.model.*;
import org.compiere.swing.*;
import org.compiere.util.*;
import com.qoppa.pdf.*;
import com.qoppa.pdfViewer.*;
/**
* Arvhive Viewer
*
* @author Jorg Janke
* @version $Id: ArchiveViewer.java,v 1.6 2005/03/11 20:28:33 jjanke Exp $
*/
public class ArchiveViewer extends CTabbedPane
implements FormPanel, ActionListener, VetoableChangeListener
{
/**
* Initialize Panel
* @param WindowNo window
* @param frame parent frame
*/
public void init (int WindowNo, FormFrame frame)
{
log.info("");
m_WindowNo = WindowNo;
m_frame = frame;
try
{
dynInit();
jbInit();
frame.getContentPane().add(this, BorderLayout.CENTER);
frame.getContentPane().add(confirmPanel, BorderLayout.SOUTH);
//
m_frame.setIconImage(Env.getImage("Archive16.gif"));
}
catch(Exception e)
{
log.log(Level.SEVERE, "init", e);
}
} // init
/** Window No */
private int m_WindowNo = 0;
/** FormFrame */
private FormFrame m_frame;
/** The Archives */
private MArchive[] m_archives = new MArchive[0];
/** Archive Index */
private int m_index = 0;
/** Table direct */
private int m_AD_Table_ID = 0;
/** Record direct */
private int m_Record_ID = 0;
/** Logger */
private static CLogger log = CLogger.getCLogger(ArchiveViewer.class);
private CPanel queryPanel = new CPanel(new GridBagLayout());
private CCheckBox reportField = new CCheckBox(Msg.translate(Env.getCtx(), "IsReport"));
private CLabel processLabel = new CLabel(Msg.translate(Env.getCtx(), "AD_Process_ID"));
private CComboBox processField = null;
private CLabel tableLabel = new CLabel(Msg.translate(Env.getCtx(), "AD_Table_ID"));
private CComboBox tableField = null;
private CLabel bPartnerLabel = new CLabel(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
private VLookup bPartnerField = null;
private CLabel nameQLabel = new CLabel(Msg.translate(Env.getCtx(), "Name"));
private CTextField nameQField = new CTextField(15);
private CLabel descriptionQLabel = new CLabel(Msg.translate(Env.getCtx(), "Description"));
private CTextField descriptionQField = new CTextField(15);
private CLabel helpQLabel = new CLabel(Msg.translate(Env.getCtx(), "Help"));
private CTextField helpQField = new CTextField(15);
private CLabel createdByQLabel = new CLabel(Msg.translate(Env.getCtx(), "CreatedBy"));
private CComboBox createdByQField = null;
private CLabel createdQLabel = new CLabel(Msg.translate(Env.getCtx(), "Created"));
private VDate createdQFrom = new VDate();
private VDate createdQTo = new VDate();
//
private CPanel viewPanel = new CPanel(new BorderLayout(5,5));
private PDFViewerBean pdfViewer = Document.getViewer();
private CPanel viewEnterPanel = new CPanel(new GridBagLayout());
private CButton bBack = new CButton(Env.getImageIcon("wfBack24.gif"));
private CButton bNext = new CButton(Env.getImageIcon("wfNext24.gif"));
private CLabel positionInfo = new CLabel(".");
private CLabel createdByLabel = new CLabel(Msg.translate(Env.getCtx(), "CreatedBy"));
private CTextField createdByField = new CTextField(20);
private CLabel createdLabel = new CLabel(Msg.translate(Env.getCtx(), "Created"));
private VDate createdField = new VDate();
//
private CLabel nameLabel = new CLabel(Msg.translate(Env.getCtx(), "Name"));
private VString nameField = new VString("Name", true, false, true, 20, 60, null, null);
private CLabel descriptionLabel = new CLabel(Msg.translate(Env.getCtx(), "Description"));
private VText descriptionField = new VText("Description", false, false, true, 20, 255);
private CLabel helpLabel = new CLabel(Msg.translate(Env.getCtx(), "Help"));
private VText helpField = new VText("Help", false, false, true, 20, 2000);
private CButton updateArchive = ConfirmPanel.createOKButton(Msg.getMsg(Env.getCtx(), "Update"));
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
/**
* Dynamic Init
*/
private void dynInit()
{
int AD_Role_ID = Env.getAD_Role_ID(Env.getCtx());
// Processes
String sql = "SELECT DISTINCT p.AD_Process_ID, p.Name "
+ "FROM AD_Process p INNER JOIN AD_Process_Access pa ON (p.AD_Process_ID=pa.AD_Process_ID) "
+ "WHERE pa.AD_Role_ID=" + AD_Role_ID
+ " AND p.IsReport='Y' AND p.IsActive='Y' AND pa.IsActive='Y' "
+ "ORDER BY 2";
processField = new CComboBox(DB.getKeyNamePairs(sql, true));
// Tables
sql = "SELECT DISTINCT t.AD_Table_ID, t.Name "
+ "FROM AD_Table t INNER JOIN AD_Tab tab ON (tab.AD_Table_ID=t.AD_Table_ID)"
+ " INNER JOIN AD_Window_Access wa ON (tab.AD_Window_ID=wa.AD_Window_ID) "
+ "WHERE wa.AD_Role_ID=" + AD_Role_ID
+ " AND t.IsActive='Y' AND tab.IsActive='Y' "
+ "ORDER BY 2";
tableField = new CComboBox(DB.getKeyNamePairs(sql, true));
// Internal Users
sql = "SELECT AD_User_ID, Name "
+ "FROM AD_User u WHERE EXISTS "
+"(SELECT * FROM AD_User_Roles ur WHERE u.AD_User_ID=ur.AD_User_ID) "
+ "ORDER BY 2";
createdByQField = new CComboBox(DB.getKeyNamePairs(sql, true));
//
bPartnerField = VLookup.createBPartner(m_WindowNo);
} // dynInit
/**
* Static Init
* @throws Exception
*/
private void jbInit() throws Exception
{
int line = 0;
queryPanel.add(reportField, new GridBagConstraints(0, line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
reportField.addActionListener(this);
//
queryPanel.add(processLabel, new GridBagConstraints(0, ++line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
queryPanel.add(processField, new GridBagConstraints(1, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5,0,0,0), 0, 0));
queryPanel.add(bPartnerLabel, new GridBagConstraints(0, ++line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
queryPanel.add(bPartnerField, new GridBagConstraints(1, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5,0,0,0), 0, 0));
queryPanel.add(tableLabel, new GridBagConstraints(0, ++line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
queryPanel.add(tableField,new GridBagConstraints(1, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5,0,0,0), 0, 0));
//
queryPanel.add(nameQLabel, new GridBagConstraints(0, ++line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10,0,0,5), 0, 0));
queryPanel.add(nameQField, new GridBagConstraints(1, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10,0,0,0), 0, 0));
queryPanel.add(descriptionQLabel, new GridBagConstraints(0, ++line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
queryPanel.add(descriptionQField, new GridBagConstraints(1, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5,0,0,0), 0, 0));
queryPanel.add(helpQLabel, new GridBagConstraints(0, ++line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
queryPanel.add(helpQField, new GridBagConstraints(1, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5,0,0,0), 0, 0));
//
queryPanel.add(createdByQLabel, new GridBagConstraints(0, ++line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(10,0,0,5), 0, 0));
queryPanel.add(createdByQField, new GridBagConstraints(1, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(10,0,0,0), 0, 0));
queryPanel.add(createdQLabel, new GridBagConstraints(0, ++line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
queryPanel.add(createdQFrom, new GridBagConstraints(1, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,0,0,0), 0, 0));
queryPanel.add(createdQTo, new GridBagConstraints(2, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,0,0,0), 0, 0));
this.add(queryPanel, Msg.translate(Env.getCtx(),"QueryOfArchive"));
//
//
line = 0;
viewPanel.add(pdfViewer, BorderLayout.WEST);
//
bBack.addActionListener(this);
bNext.addActionListener(this);
positionInfo.setFontBold(true);
positionInfo.setHorizontalAlignment(CLabel.CENTER);
viewEnterPanel.add(bBack, new GridBagConstraints(0, line,
1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0,0,0,0), 0, 0));
viewEnterPanel.add(positionInfo, new GridBagConstraints(1, line,
1, 1, 0, 0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0,5,0,5), 0, 0));
viewEnterPanel.add(bNext, new GridBagConstraints(2, line,
1, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0,0,0,5), 0, 0));
//
createdByField.setReadWrite(false);
createdField.setReadWrite(false);
nameField.addVetoableChangeListener(this);
descriptionField.addVetoableChangeListener(this);
helpField.addVetoableChangeListener(this);
viewEnterPanel.add(createdByLabel, new GridBagConstraints(0, ++line,
3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
viewEnterPanel.add(createdByField, new GridBagConstraints(0, ++line,
3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,0,0,5), 0, 0));
// viewEnterPanel.add(createdLabel, new ALayoutConstraint(line++,0));
viewEnterPanel.add(createdField, new GridBagConstraints(0, ++line,
3, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(2,0,0,5), 0, 0));
//
viewEnterPanel.add(nameLabel, new GridBagConstraints(0, ++line,
3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
viewEnterPanel.add(nameField, new GridBagConstraints(0, ++line,
3, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,0,0,5), 0, 0));
//
viewEnterPanel.add(descriptionLabel, new GridBagConstraints(0, ++line,
3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
viewEnterPanel.add(descriptionField,new GridBagConstraints(0, ++line,
3, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,0,0,5), 0, 0));
//
viewEnterPanel.add(helpLabel, new GridBagConstraints(0, ++line,
3, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
viewEnterPanel.add(helpField, new GridBagConstraints(0, ++line,
3, 1, 1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(2,0,0,5), 0, 0));
//
viewEnterPanel.add(updateArchive, new GridBagConstraints(0, ++line,
3, 1, 0, 0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5,0,0,5), 0, 0));
//
viewEnterPanel.setPreferredSize(new Dimension(220,500));
updateArchive.addActionListener(this);
viewPanel.add(viewEnterPanel, BorderLayout.CENTER);
this.add(viewPanel, Msg.translate(Env.getCtx(),"ViewOfArchive"));
//
confirmPanel.addActionListener(this);
updateQDisplay();
//
this.setPreferredSize(new Dimension (720,500));
} // jbInit
/**
* Dispose
*/
public void dispose()
{
if (m_frame != null)
m_frame.dispose();
m_frame = null;
} // dispose
/**
* Action Listener
* @param e event
*/
public void actionPerformed (ActionEvent e)
{
log.info(e.getActionCommand());
//
if (e.getSource() == updateArchive)
cmd_updateArchive();
else if (e.getActionCommand().equals(ConfirmPanel.A_CANCEL))
dispose();
else if (e.getActionCommand().equals(ConfirmPanel.A_OK))
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -