- add change log context menu for field
This commit is contained in:
parent
aca590117d
commit
b05a179277
|
@ -87,6 +87,8 @@ public class GridField
|
||||||
/** The Mnemonic */
|
/** The Mnemonic */
|
||||||
private char m_mnemonic = 0;
|
private char m_mnemonic = 0;
|
||||||
|
|
||||||
|
private GridTab m_gridTab;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dispose
|
* Dispose
|
||||||
*/
|
*/
|
||||||
|
@ -1753,4 +1755,20 @@ public class GridField
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param gridTab
|
||||||
|
*/
|
||||||
|
public void setGridTab(GridTab gridTab)
|
||||||
|
{
|
||||||
|
m_gridTab = gridTab;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return GridTab
|
||||||
|
*/
|
||||||
|
public GridTab getGridTab()
|
||||||
|
{
|
||||||
|
return m_gridTab;
|
||||||
|
}
|
||||||
} // MField
|
} // MField
|
||||||
|
|
|
@ -333,6 +333,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
if (voF != null)
|
if (voF != null)
|
||||||
{
|
{
|
||||||
GridField field = new GridField (voF);
|
GridField field = new GridField (voF);
|
||||||
|
field.setGridTab(this);
|
||||||
String columnName = field.getColumnName();
|
String columnName = field.getColumnName();
|
||||||
//FR [ 1757088 ] - this create Bug [ 1866793 ]
|
//FR [ 1757088 ] - this create Bug [ 1866793 ]
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -0,0 +1,361 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 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. *
|
||||||
|
* *
|
||||||
|
* @sponsor www.metas.de *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.compiere.apps;
|
||||||
|
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Frame;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Vector;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import javax.swing.Icon;
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
import javax.swing.table.DefaultTableModel;
|
||||||
|
|
||||||
|
import org.compiere.grid.VTable;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
|
import org.compiere.model.MChangeLog;
|
||||||
|
import org.compiere.model.MColumn;
|
||||||
|
import org.compiere.model.MLookup;
|
||||||
|
import org.compiere.model.MLookupFactory;
|
||||||
|
import org.compiere.model.MRole;
|
||||||
|
import org.compiere.model.MTable;
|
||||||
|
import org.compiere.model.MUser;
|
||||||
|
import org.compiere.swing.CDialog;
|
||||||
|
import org.compiere.swing.CMenuItem;
|
||||||
|
import org.compiere.swing.CPanel;
|
||||||
|
import org.compiere.swing.CScrollPane;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change History for field
|
||||||
|
* @author Heng Sin Low
|
||||||
|
*/
|
||||||
|
public class FieldRecordInfo extends CDialog
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = -2860082302140462690L;
|
||||||
|
|
||||||
|
public static final String CHANGE_LOG_COMMAND = "ChangeLog";
|
||||||
|
/** The Menu Icon */
|
||||||
|
private static Icon s_icon = new ImageIcon(org.compiere.Adempiere.class.getResource("images/ChangeLog16.png"));
|
||||||
|
|
||||||
|
private int AD_Table_ID;
|
||||||
|
private int AD_Column_ID;
|
||||||
|
private int Record_ID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Record Info
|
||||||
|
* @param owner owner
|
||||||
|
* @param title title
|
||||||
|
* @param AD_Table_ID
|
||||||
|
* @param AD_Column_ID
|
||||||
|
* @param Record_ID
|
||||||
|
*/
|
||||||
|
public FieldRecordInfo (Frame owner, String title, int AD_Table_ID, int AD_Column_ID, int Record_ID)
|
||||||
|
{
|
||||||
|
super (owner, title, true);
|
||||||
|
|
||||||
|
this.AD_Table_ID = AD_Table_ID;
|
||||||
|
this.AD_Column_ID = AD_Column_ID;
|
||||||
|
this.Record_ID = Record_ID;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
jbInit ( dynInit(title) );
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, "", e);
|
||||||
|
}
|
||||||
|
AEnv.positionCenterWindow (owner, this);
|
||||||
|
AEnv.showCenterScreen(this);
|
||||||
|
} // FieldRecordInfo
|
||||||
|
|
||||||
|
|
||||||
|
private CPanel mainPanel = new CPanel (new BorderLayout(0,0));
|
||||||
|
private CScrollPane scrollPane = new CScrollPane ();
|
||||||
|
private VTable table = new VTable ();
|
||||||
|
private ConfirmPanel confirmPanel = new ConfirmPanel (false);
|
||||||
|
|
||||||
|
/** Logger */
|
||||||
|
protected CLogger log = CLogger.getCLogger(getClass());
|
||||||
|
/** The Data */
|
||||||
|
private Vector<Vector<String>> m_data = new Vector<Vector<String>>();
|
||||||
|
|
||||||
|
/** Date Time Format */
|
||||||
|
private SimpleDateFormat m_dateTimeFormat = DisplayType.getDateFormat
|
||||||
|
(DisplayType.DateTime, Env.getLanguage(Env.getCtx()));
|
||||||
|
/** Date Format */
|
||||||
|
private SimpleDateFormat m_dateFormat = DisplayType.getDateFormat
|
||||||
|
(DisplayType.DateTime, Env.getLanguage(Env.getCtx()));
|
||||||
|
/** Number Format */
|
||||||
|
private DecimalFormat m_numberFormat = DisplayType.getNumberFormat
|
||||||
|
(DisplayType.Number, Env.getLanguage(Env.getCtx()));
|
||||||
|
/** Amount Format */
|
||||||
|
private DecimalFormat m_amtFormat = DisplayType.getNumberFormat
|
||||||
|
(DisplayType.Amount, Env.getLanguage(Env.getCtx()));
|
||||||
|
/** Number Format */
|
||||||
|
private DecimalFormat m_intFormat = DisplayType.getNumberFormat
|
||||||
|
(DisplayType.Integer, Env.getLanguage(Env.getCtx()));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static Layout
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void jbInit (boolean showTable) throws Exception
|
||||||
|
{
|
||||||
|
getContentPane().add(mainPanel);
|
||||||
|
//
|
||||||
|
if (showTable)
|
||||||
|
{
|
||||||
|
mainPanel.add (scrollPane, BorderLayout.CENTER);
|
||||||
|
scrollPane.getViewport().add(table);
|
||||||
|
scrollPane.setPreferredSize(new Dimension(500,100));
|
||||||
|
}
|
||||||
|
//
|
||||||
|
mainPanel.add (confirmPanel, BorderLayout.SOUTH);
|
||||||
|
confirmPanel.addActionListener(this);
|
||||||
|
} // jbInit
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dynamic Init
|
||||||
|
* @param title title
|
||||||
|
* @return true if table initialized
|
||||||
|
*/
|
||||||
|
private boolean dynInit(String title)
|
||||||
|
{
|
||||||
|
// Title
|
||||||
|
if (AD_Table_ID != 0)
|
||||||
|
{
|
||||||
|
MTable table1 = MTable.get (Env.getCtx(), AD_Table_ID);
|
||||||
|
setTitle(title + " - " + table1.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only Client Preference can view Change Log
|
||||||
|
if (!MRole.PREFERENCETYPE_Client.equals(MRole.getDefault().getPreferenceType()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (Record_ID == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Data
|
||||||
|
String sql = "SELECT AD_Column_ID, Updated, UpdatedBy, OldValue, NewValue "
|
||||||
|
+ "FROM AD_ChangeLog "
|
||||||
|
+ "WHERE AD_Table_ID=? AND Record_ID=? AND AD_Column_ID=?"
|
||||||
|
+ "ORDER BY Updated DESC";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
|
pstmt.setInt (1, AD_Table_ID);
|
||||||
|
pstmt.setInt (2, Record_ID);
|
||||||
|
pstmt.setInt (3, AD_Column_ID);
|
||||||
|
rs = pstmt.executeQuery ();
|
||||||
|
while (rs.next ())
|
||||||
|
{
|
||||||
|
addLine (rs.getInt(1), rs.getTimestamp(2), rs.getInt(3),
|
||||||
|
rs.getString(4), rs.getString(5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, sql, e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Vector<String> columnNames = new Vector<String>();
|
||||||
|
columnNames.add(Msg.translate(Env.getCtx(), "NewValue"));
|
||||||
|
columnNames.add(Msg.translate(Env.getCtx(), "OldValue"));
|
||||||
|
columnNames.add(Msg.translate(Env.getCtx(), "UpdatedBy"));
|
||||||
|
columnNames.add(Msg.translate(Env.getCtx(), "Updated"));
|
||||||
|
DefaultTableModel model = new DefaultTableModel(m_data, columnNames);
|
||||||
|
table.setModel(model);
|
||||||
|
table.autoSize(false);
|
||||||
|
return true;
|
||||||
|
} // dynInit
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Line
|
||||||
|
* @param AD_Column_ID column
|
||||||
|
* @param Updated updated
|
||||||
|
* @param UpdatedBy user
|
||||||
|
* @param OldValue old
|
||||||
|
* @param NewValue new
|
||||||
|
*/
|
||||||
|
private void addLine (int AD_Column_ID, Timestamp Updated, int UpdatedBy,
|
||||||
|
String OldValue, String NewValue)
|
||||||
|
{
|
||||||
|
Vector<String> line = new Vector<String>();
|
||||||
|
// Column
|
||||||
|
MColumn column = MColumn.get (Env.getCtx(), AD_Column_ID);
|
||||||
|
//
|
||||||
|
if (OldValue != null && OldValue.equals(MChangeLog.NULL))
|
||||||
|
OldValue = null;
|
||||||
|
String showOldValue = OldValue;
|
||||||
|
if (NewValue != null && NewValue.equals(MChangeLog.NULL))
|
||||||
|
NewValue = null;
|
||||||
|
String showNewValue = NewValue;
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (DisplayType.isText (column.getAD_Reference_ID ()))
|
||||||
|
;
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.YesNo)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
{
|
||||||
|
boolean yes = OldValue.equals("true") || OldValue.equals("Y");
|
||||||
|
showOldValue = Msg.getMsg(Env.getCtx(), yes ? "Y" : "N");
|
||||||
|
}
|
||||||
|
if (NewValue != null)
|
||||||
|
{
|
||||||
|
boolean yes = NewValue.equals("true") || NewValue.equals("Y");
|
||||||
|
showNewValue = Msg.getMsg(Env.getCtx(), yes ? "Y" : "N");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.Amount)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_amtFormat
|
||||||
|
.format (new BigDecimal (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_amtFormat
|
||||||
|
.format (new BigDecimal (NewValue));
|
||||||
|
}
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.Integer)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_intFormat.format (new Integer (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_intFormat.format (new Integer (NewValue));
|
||||||
|
}
|
||||||
|
else if (DisplayType.isNumeric (column.getAD_Reference_ID ()))
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_numberFormat.format (new BigDecimal (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_numberFormat.format (new BigDecimal (NewValue));
|
||||||
|
}
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.Date)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_dateFormat.format (Timestamp.valueOf (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_dateFormat.format (Timestamp.valueOf (NewValue));
|
||||||
|
}
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.DateTime)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_dateTimeFormat.format (Timestamp.valueOf (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_dateTimeFormat.format (Timestamp.valueOf (NewValue));
|
||||||
|
}
|
||||||
|
else if (DisplayType.isLookup(column.getAD_Reference_ID ()))
|
||||||
|
{
|
||||||
|
MLookup lookup = MLookupFactory.get (Env.getCtx(), 0,
|
||||||
|
AD_Column_ID, column.getAD_Reference_ID(),
|
||||||
|
Env.getLanguage(Env.getCtx()), column.getColumnName(),
|
||||||
|
column.getAD_Reference_Value_ID(),
|
||||||
|
column.isParent(), null);
|
||||||
|
if (OldValue != null)
|
||||||
|
{
|
||||||
|
Object key = OldValue;
|
||||||
|
NamePair pp = lookup.get(key);
|
||||||
|
if (pp != null)
|
||||||
|
showOldValue = pp.getName();
|
||||||
|
}
|
||||||
|
if (NewValue != null)
|
||||||
|
{
|
||||||
|
Object key = NewValue;
|
||||||
|
NamePair pp = lookup.get(key);
|
||||||
|
if (pp != null)
|
||||||
|
showNewValue = pp.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (DisplayType.isLOB (column.getAD_Reference_ID ()))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.WARNING, OldValue + "->" + NewValue, e);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
line.add(showNewValue);
|
||||||
|
line.add(showOldValue);
|
||||||
|
// UpdatedBy
|
||||||
|
MUser user = MUser.get(Env.getCtx(), UpdatedBy);
|
||||||
|
line.add(user.getName());
|
||||||
|
// Updated
|
||||||
|
line.add(m_dateFormat.format(Updated));
|
||||||
|
|
||||||
|
m_data.add(line);
|
||||||
|
} // addLine
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ActionListener
|
||||||
|
* @param e event
|
||||||
|
*/
|
||||||
|
public void actionPerformed(ActionEvent e)
|
||||||
|
{
|
||||||
|
dispose();
|
||||||
|
} // actionPerformed
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add change log menu item
|
||||||
|
* @param l
|
||||||
|
* @param popupMenu
|
||||||
|
* @return CMenuItem
|
||||||
|
*/
|
||||||
|
public static CMenuItem addMenu (ActionListener l, JPopupMenu popupMenu)
|
||||||
|
{
|
||||||
|
CMenuItem mi = new CMenuItem (Msg.getElement(Env.getCtx(), "AD_ChangeLog_ID"), s_icon);
|
||||||
|
mi.setActionCommand(CHANGE_LOG_COMMAND);
|
||||||
|
mi.addActionListener(l);
|
||||||
|
popupMenu.add(mi);
|
||||||
|
return mi;
|
||||||
|
} // addMenu
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open field record info dialog
|
||||||
|
* @param mField
|
||||||
|
*/
|
||||||
|
public static void start(GridField mField) {
|
||||||
|
int WindowNo = mField.getWindowNo();
|
||||||
|
Frame frame = Env.getWindow(WindowNo);
|
||||||
|
new FieldRecordInfo(frame, mField.getColumnName(), mField.getGridTab().getAD_Table_ID(),
|
||||||
|
mField.getAD_Column_ID(), mField.getGridTab().getRecord_ID());
|
||||||
|
}
|
||||||
|
} // FieldRecordInfo
|
|
@ -18,6 +18,7 @@ package org.compiere.grid.ed;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Cursor;
|
import java.awt.Cursor;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
|
@ -25,6 +26,8 @@ import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.FocusListener;
|
import java.awt.event.FocusListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
@ -32,9 +35,13 @@ import java.sql.ResultSet;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.LookAndFeel;
|
import javax.swing.LookAndFeel;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MAccountLookup;
|
import org.compiere.model.MAccountLookup;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.swing.CButton;
|
import org.compiere.swing.CButton;
|
||||||
|
@ -60,6 +67,35 @@ public final class VAccount extends JComponent
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3397625857773619178L;
|
private static final long serialVersionUID = -3397625857773619178L;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Mouse Listener
|
||||||
|
*/
|
||||||
|
final class VAccount_mouseAdapter extends MouseAdapter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param adaptee adaptee
|
||||||
|
*/
|
||||||
|
VAccount_mouseAdapter(VAccount adaptee)
|
||||||
|
{
|
||||||
|
m_adaptee = adaptee;
|
||||||
|
} // VNumber_mouseAdapter
|
||||||
|
|
||||||
|
private VAccount m_adaptee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mouse Listener
|
||||||
|
* @param e event
|
||||||
|
*/
|
||||||
|
public void mouseClicked(MouseEvent e)
|
||||||
|
{
|
||||||
|
// popup menu
|
||||||
|
if (SwingUtilities.isRightMouseButton(e))
|
||||||
|
m_adaptee.popupMenu.show((Component)e.getSource(), e.getX(), e.getY());
|
||||||
|
} // mouseClicked
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param columnName
|
* @param columnName
|
||||||
|
@ -90,6 +126,7 @@ public final class VAccount extends JComponent
|
||||||
m_text.addFocusListener(this);
|
m_text.addFocusListener(this);
|
||||||
m_text.setFont(AdempierePLAF.getFont_Field());
|
m_text.setFont(AdempierePLAF.getFont_Field());
|
||||||
m_text.setForeground(AdempierePLAF.getTextColor_Normal());
|
m_text.setForeground(AdempierePLAF.getTextColor_Normal());
|
||||||
|
m_text.addMouseListener(new VAccount_mouseAdapter(this));
|
||||||
this.add(m_text, BorderLayout.CENTER);
|
this.add(m_text, BorderLayout.CENTER);
|
||||||
|
|
||||||
m_button.setIcon(Env.getImageIcon("Account10.gif"));
|
m_button.setIcon(Env.getImageIcon("Account10.gif"));
|
||||||
|
@ -125,6 +162,8 @@ public final class VAccount extends JComponent
|
||||||
private int m_WindowNo;
|
private int m_WindowNo;
|
||||||
|
|
||||||
private String m_columnName;
|
private String m_columnName;
|
||||||
|
// Popup
|
||||||
|
JPopupMenu popupMenu = new JPopupMenu();
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(VAccount.class);
|
private static CLogger log = CLogger.getCLogger(VAccount.class);
|
||||||
|
|
||||||
|
@ -257,6 +296,12 @@ public final class VAccount extends JComponent
|
||||||
*/
|
*/
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
|
if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.getSource() == m_text)
|
if (e.getSource() == m_text)
|
||||||
cmd_text();
|
cmd_text();
|
||||||
else
|
else
|
||||||
|
@ -296,7 +341,8 @@ public final class VAccount extends JComponent
|
||||||
}
|
}
|
||||||
} // cmd_button
|
} // cmd_button
|
||||||
|
|
||||||
private boolean m_cmdTextRunning = false;
|
private boolean m_cmdTextRunning = false;
|
||||||
|
private GridField m_mField;
|
||||||
/**
|
/**
|
||||||
* Text - try to find Alias or start Dialog
|
* Text - try to find Alias or start Dialog
|
||||||
*/
|
*/
|
||||||
|
@ -398,6 +444,10 @@ public final class VAccount extends JComponent
|
||||||
{
|
{
|
||||||
if (mField != null)
|
if (mField != null)
|
||||||
m_WindowNo = mField.getWindowNo();
|
m_WindowNo = mField.getWindowNo();
|
||||||
|
m_mField = mField;
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
|
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,6 +40,7 @@ import javax.swing.LookAndFeel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
import org.compiere.apps.search.InfoSchedule;
|
import org.compiere.apps.search.InfoSchedule;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MResourceAssignment;
|
import org.compiere.model.MResourceAssignment;
|
||||||
|
@ -175,6 +176,7 @@ public class VAssignment extends JComponent
|
||||||
/** The Format */
|
/** The Format */
|
||||||
private DateFormat m_dateFormat = DisplayType.getDateFormat(DisplayType.DateTime);
|
private DateFormat m_dateFormat = DisplayType.getDateFormat(DisplayType.DateTime);
|
||||||
private NumberFormat m_qtyFormat = DisplayType.getNumberFormat(DisplayType.Quantity);
|
private NumberFormat m_qtyFormat = DisplayType.getNumberFormat(DisplayType.Quantity);
|
||||||
|
private GridField m_mField;
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(VAssignment.class);
|
private static CLogger log = CLogger.getCLogger(VAssignment.class);
|
||||||
|
|
||||||
|
@ -354,6 +356,9 @@ public class VAssignment extends JComponent
|
||||||
*/
|
*/
|
||||||
public void setField(GridField mField)
|
public void setField(GridField mField)
|
||||||
{
|
{
|
||||||
|
m_mField = mField;
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -371,6 +376,11 @@ public class VAssignment extends JComponent
|
||||||
*/
|
*/
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
|
if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!m_button.isEnabled())
|
if (!m_button.isEnabled())
|
||||||
return;
|
return;
|
||||||
m_button.setEnabled(false);
|
m_button.setEnabled(false);
|
||||||
|
|
|
@ -16,13 +16,20 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.grid.ed;
|
package org.compiere.grid.ed;
|
||||||
|
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
|
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.swing.CCheckBox;
|
import org.compiere.swing.CCheckBox;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.Msg;
|
import org.compiere.util.Msg;
|
||||||
|
@ -41,6 +48,35 @@ public class VCheckBox extends CCheckBox
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3822806631369725112L;
|
private static final long serialVersionUID = -3822806631369725112L;
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Mouse Listener
|
||||||
|
*/
|
||||||
|
final class VCheckBox_mouseAdapter extends MouseAdapter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param adaptee adaptee
|
||||||
|
*/
|
||||||
|
VCheckBox_mouseAdapter(VCheckBox adaptee)
|
||||||
|
{
|
||||||
|
m_adaptee = adaptee;
|
||||||
|
} // VNumber_mouseAdapter
|
||||||
|
|
||||||
|
private VCheckBox m_adaptee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mouse Listener
|
||||||
|
* @param e event
|
||||||
|
*/
|
||||||
|
public void mouseClicked(MouseEvent e)
|
||||||
|
{
|
||||||
|
// popup menu
|
||||||
|
if (SwingUtilities.isRightMouseButton(e))
|
||||||
|
m_adaptee.popupMenu.show((Component)e.getSource(), e.getX(), e.getY());
|
||||||
|
} // mouseClicked
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
*/
|
*/
|
||||||
|
@ -85,6 +121,7 @@ public class VCheckBox extends CCheckBox
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
this.addActionListener(this);
|
this.addActionListener(this);
|
||||||
|
addMouseListener(new VCheckBox_mouseAdapter(this));
|
||||||
} // VCheckBox
|
} // VCheckBox
|
||||||
|
|
||||||
/** Mnemonic saved */
|
/** Mnemonic saved */
|
||||||
|
@ -98,6 +135,9 @@ public class VCheckBox extends CCheckBox
|
||||||
} // dispose
|
} // dispose
|
||||||
|
|
||||||
private String m_columnName;
|
private String m_columnName;
|
||||||
|
private GridField m_mField;
|
||||||
|
// Popup
|
||||||
|
JPopupMenu popupMenu = new JPopupMenu();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Editable
|
* Set Editable
|
||||||
|
@ -176,7 +216,12 @@ public class VCheckBox extends CCheckBox
|
||||||
*/
|
*/
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
// ADebug.info("VCheckBox.actionPerformed");
|
if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// ADebug.info("VCheckBox.actionPerformed");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
fireVetoableChange(m_columnName, null, getValue());
|
fireVetoableChange(m_columnName, null, getValue());
|
||||||
|
@ -192,6 +237,9 @@ public class VCheckBox extends CCheckBox
|
||||||
*/
|
*/
|
||||||
public void setField (org.compiere.model.GridField mField)
|
public void setField (org.compiere.model.GridField mField)
|
||||||
{
|
{
|
||||||
|
m_mField = mField;
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -46,6 +46,7 @@ import javax.swing.text.Document;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
import org.compiere.apps.AEnv;
|
import org.compiere.apps.AEnv;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.swing.CButton;
|
import org.compiere.swing.CButton;
|
||||||
|
@ -431,6 +432,11 @@ public class VDate extends JComponent
|
||||||
ValuePreference.start (m_mField, getValue(), getDisplay());
|
ValuePreference.start (m_mField, getValue(), getDisplay());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (e.getSource() == m_button)
|
if (e.getSource() == m_button)
|
||||||
{
|
{
|
||||||
m_button.setEnabled(false);
|
m_button.setEnabled(false);
|
||||||
|
@ -556,6 +562,8 @@ public class VDate extends JComponent
|
||||||
if (m_mField != null
|
if (m_mField != null
|
||||||
&& MRole.getDefault().isShowPreference())
|
&& MRole.getDefault().isShowPreference())
|
||||||
ValuePreference.addMenu (this, popupMenu);
|
ValuePreference.addMenu (this, popupMenu);
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,6 +35,7 @@ import javax.swing.LookAndFeel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.MLocation;
|
import org.compiere.model.MLocation;
|
||||||
|
@ -340,6 +341,12 @@ public class VLocation extends JComponent
|
||||||
*/
|
*/
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
|
if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_GridField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.getSource() == mDelete)
|
if (e.getSource() == mDelete)
|
||||||
m_value = null; // create new
|
m_value = null; // create new
|
||||||
//
|
//
|
||||||
|
@ -395,6 +402,8 @@ public class VLocation extends JComponent
|
||||||
public void setField (org.compiere.model.GridField mField)
|
public void setField (org.compiere.model.GridField mField)
|
||||||
{
|
{
|
||||||
m_GridField = mField;
|
m_GridField = mField;
|
||||||
|
if (m_GridField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
} // VLocation
|
} // VLocation
|
||||||
|
|
|
@ -42,6 +42,8 @@ import javax.swing.SwingUtilities;
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
import org.compiere.apps.AEnv;
|
import org.compiere.apps.AEnv;
|
||||||
import org.compiere.apps.AWindow;
|
import org.compiere.apps.AWindow;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MLocator;
|
import org.compiere.model.MLocator;
|
||||||
import org.compiere.model.MLocatorLookup;
|
import org.compiere.model.MLocatorLookup;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
|
@ -190,6 +192,7 @@ public class VLocator extends JComponent
|
||||||
JPopupMenu popupMenu = new JPopupMenu();
|
JPopupMenu popupMenu = new JPopupMenu();
|
||||||
private CMenuItem mZoom;
|
private CMenuItem mZoom;
|
||||||
private CMenuItem mRefresh;
|
private CMenuItem mRefresh;
|
||||||
|
private GridField m_mField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/disable
|
* Enable/disable
|
||||||
|
@ -365,6 +368,12 @@ public class VLocator extends JComponent
|
||||||
*/
|
*/
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
|
if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Refresh
|
// Refresh
|
||||||
if (e.getSource() == mRefresh)
|
if (e.getSource() == mRefresh)
|
||||||
{
|
{
|
||||||
|
@ -536,6 +545,9 @@ public class VLocator extends JComponent
|
||||||
*/
|
*/
|
||||||
public void setField (org.compiere.model.GridField mField)
|
public void setField (org.compiere.model.GridField mField)
|
||||||
{
|
{
|
||||||
|
m_mField = mField;
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ import javax.swing.SwingUtilities;
|
||||||
import org.compiere.apps.ADialog;
|
import org.compiere.apps.ADialog;
|
||||||
import org.compiere.apps.AEnv;
|
import org.compiere.apps.AEnv;
|
||||||
import org.compiere.apps.AWindow;
|
import org.compiere.apps.AWindow;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
import org.compiere.apps.search.Info;
|
import org.compiere.apps.search.Info;
|
||||||
import org.compiere.apps.search.InfoBPartner;
|
import org.compiere.apps.search.InfoBPartner;
|
||||||
import org.compiere.apps.search.InfoFactory;
|
import org.compiere.apps.search.InfoFactory;
|
||||||
|
@ -679,6 +680,9 @@ public class VLookup extends JComponent
|
||||||
if (m_mField != null
|
if (m_mField != null
|
||||||
&& MRole.getDefault().isShowPreference())
|
&& MRole.getDefault().isShowPreference())
|
||||||
ValuePreference.addMenu (this, popupMenu);
|
ValuePreference.addMenu (this, popupMenu);
|
||||||
|
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
|
|
||||||
|
@ -700,6 +704,11 @@ public class VLookup extends JComponent
|
||||||
ValuePreference.start (m_mField, getValue(), getDisplay());
|
ValuePreference.start (m_mField, getValue(), getDisplay());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Combo Selection
|
// Combo Selection
|
||||||
else if (e.getSource() == m_combo)
|
else if (e.getSource() == m_combo)
|
||||||
|
|
|
@ -19,6 +19,7 @@ package org.compiere.grid.ed;
|
||||||
import java.awt.AWTEvent;
|
import java.awt.AWTEvent;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Component;
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.EventQueue;
|
import java.awt.EventQueue;
|
||||||
|
@ -31,6 +32,8 @@ import java.awt.event.FocusListener;
|
||||||
import java.awt.event.InputEvent;
|
import java.awt.event.InputEvent;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.KeyListener;
|
import java.awt.event.KeyListener;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
@ -39,11 +42,14 @@ import java.text.ParseException;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
import javax.swing.LookAndFeel;
|
import javax.swing.LookAndFeel;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.text.Document;
|
import javax.swing.text.Document;
|
||||||
|
|
||||||
import org.compiere.apps.AEnv;
|
import org.compiere.apps.AEnv;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.swing.CButton;
|
import org.compiere.swing.CButton;
|
||||||
|
@ -74,6 +80,38 @@ public final class VNumber extends JComponent
|
||||||
public final static int SIZE = 12;
|
public final static int SIZE = 12;
|
||||||
/** Automatically pop up calculator */
|
/** Automatically pop up calculator */
|
||||||
public final static boolean AUTO_POPUP = false;
|
public final static boolean AUTO_POPUP = false;
|
||||||
|
|
||||||
|
JPopupMenu popupMenu = new JPopupMenu();
|
||||||
|
|
||||||
|
/******************************************************************************
|
||||||
|
* Mouse Listener
|
||||||
|
*/
|
||||||
|
final class VNumber_mouseAdapter extends MouseAdapter
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* @param adaptee adaptee
|
||||||
|
*/
|
||||||
|
VNumber_mouseAdapter(VNumber adaptee)
|
||||||
|
{
|
||||||
|
m_adaptee = adaptee;
|
||||||
|
} // VNumber_mouseAdapter
|
||||||
|
|
||||||
|
private VNumber m_adaptee;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mouse Listener
|
||||||
|
* @param e event
|
||||||
|
*/
|
||||||
|
public void mouseClicked(MouseEvent e)
|
||||||
|
{
|
||||||
|
// popup menu
|
||||||
|
if (SwingUtilities.isRightMouseButton(e))
|
||||||
|
m_adaptee.popupMenu.show((Component)e.getSource(), e.getX(), e.getY());
|
||||||
|
} // mouseClicked
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IDE Bean Constructor
|
* IDE Bean Constructor
|
||||||
*/
|
*/
|
||||||
|
@ -127,6 +165,8 @@ public final class VNumber extends JComponent
|
||||||
setReadWrite(false);
|
setReadWrite(false);
|
||||||
else
|
else
|
||||||
setReadWrite(true);
|
setReadWrite(true);
|
||||||
|
|
||||||
|
m_text.addMouseListener(new VNumber_mouseAdapter(this));
|
||||||
} // VNumber
|
} // VNumber
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -512,6 +552,11 @@ public final class VNumber extends JComponent
|
||||||
ValuePreference.start (m_mField, getValue());
|
ValuePreference.start (m_mField, getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.getSource() == m_button)
|
if (e.getSource() == m_button)
|
||||||
{
|
{
|
||||||
|
@ -690,11 +735,13 @@ public final class VNumber extends JComponent
|
||||||
public void setField (GridField mField)
|
public void setField (GridField mField)
|
||||||
{
|
{
|
||||||
m_mField = mField;
|
m_mField = mField;
|
||||||
/**
|
|
||||||
if (m_mField != null
|
if (m_mField != null
|
||||||
&& MRole.getDefault().isShowPreference())
|
&& MRole.getDefault().isShowPreference())
|
||||||
ValuePreference.addMenu (this, popupMenu);
|
ValuePreference.addMenu (this, popupMenu);
|
||||||
**/
|
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -36,6 +36,7 @@ import javax.swing.LookAndFeel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.MAttributeSet;
|
import org.compiere.model.MAttributeSet;
|
||||||
|
@ -199,6 +200,7 @@ public class VPAttribute extends JComponent
|
||||||
|
|
||||||
/** Calling Window Info */
|
/** Calling Window Info */
|
||||||
private int m_AD_Column_ID = 0;
|
private int m_AD_Column_ID = 0;
|
||||||
|
private GridField m_mField;
|
||||||
/** No Instance Key */
|
/** No Instance Key */
|
||||||
private static Integer NO_INSTANCE = new Integer(0);
|
private static Integer NO_INSTANCE = new Integer(0);
|
||||||
/** Logger */
|
/** Logger */
|
||||||
|
@ -343,6 +345,10 @@ public class VPAttribute extends JComponent
|
||||||
// To determine behavior
|
// To determine behavior
|
||||||
m_AD_Column_ID = mField.getAD_Column_ID();
|
m_AD_Column_ID = mField.getAD_Column_ID();
|
||||||
m_GridField = mField;
|
m_GridField = mField;
|
||||||
|
|
||||||
|
m_mField = mField;
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -359,6 +365,12 @@ public class VPAttribute extends JComponent
|
||||||
*/
|
*/
|
||||||
public void actionPerformed(ActionEvent e)
|
public void actionPerformed(ActionEvent e)
|
||||||
{
|
{
|
||||||
|
if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!m_button.isEnabled ())
|
if (!m_button.isEnabled ())
|
||||||
return;
|
return;
|
||||||
m_button.setEnabled (false);
|
m_button.setEnabled (false);
|
||||||
|
|
|
@ -34,6 +34,7 @@ import javax.swing.SwingUtilities;
|
||||||
import javax.swing.event.CaretListener;
|
import javax.swing.event.CaretListener;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.Obscure;
|
import org.compiere.model.Obscure;
|
||||||
|
@ -144,10 +145,10 @@ public final class VString extends CTextField
|
||||||
|
|
||||||
this.addKeyListener(this);
|
this.addKeyListener(this);
|
||||||
this.addActionListener(this);
|
this.addActionListener(this);
|
||||||
|
addMouseListener(new VString_mouseAdapter(this));
|
||||||
// Popup for Editor
|
// Popup for Editor
|
||||||
if (fieldLength > displayLength)
|
if (fieldLength > displayLength)
|
||||||
{
|
{
|
||||||
addMouseListener(new VString_mouseAdapter(this));
|
|
||||||
mEditor = new CMenuItem (Msg.getMsg(Env.getCtx(), "Editor"), Env.getImageIcon("Editor16.gif"));
|
mEditor = new CMenuItem (Msg.getMsg(Env.getCtx(), "Editor"), Env.getImageIcon("Editor16.gif"));
|
||||||
mEditor.addActionListener(this);
|
mEditor.addActionListener(this);
|
||||||
popupMenu.add(mEditor);
|
popupMenu.add(mEditor);
|
||||||
|
@ -277,6 +278,11 @@ public final class VString extends CTextField
|
||||||
ValuePreference.start (m_mField, getValue());
|
ValuePreference.start (m_mField, getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if(e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Invoke Editor
|
// Invoke Editor
|
||||||
if (e.getSource() == mEditor)
|
if (e.getSource() == mEditor)
|
||||||
|
@ -305,6 +311,8 @@ public final class VString extends CTextField
|
||||||
if (m_mField != null
|
if (m_mField != null
|
||||||
&& MRole.getDefault().isShowPreference())
|
&& MRole.getDefault().isShowPreference())
|
||||||
ValuePreference.addMenu (this, popupMenu);
|
ValuePreference.addMenu (this, popupMenu);
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,7 +32,9 @@ import javax.swing.LookAndFeel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
import org.compiere.apps.ScriptEditor;
|
import org.compiere.apps.ScriptEditor;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.swing.CMenuItem;
|
import org.compiere.swing.CMenuItem;
|
||||||
import org.compiere.swing.CTextArea;
|
import org.compiere.swing.CTextArea;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -138,6 +140,7 @@ public class VText extends CTextArea
|
||||||
private String m_oldText;
|
private String m_oldText;
|
||||||
private String m_initialText;
|
private String m_initialText;
|
||||||
private volatile boolean m_setting = false;
|
private volatile boolean m_setting = false;
|
||||||
|
private GridField m_mField;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Editor to value
|
* Set Editor to value
|
||||||
|
@ -193,6 +196,11 @@ public class VText extends CTextArea
|
||||||
}
|
}
|
||||||
catch (PropertyVetoException pve) {}
|
catch (PropertyVetoException pve) {}
|
||||||
}
|
}
|
||||||
|
else if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} // actionPerformed
|
} // actionPerformed
|
||||||
|
|
||||||
private int findWindowNo() {
|
private int findWindowNo() {
|
||||||
|
@ -240,6 +248,9 @@ public class VText extends CTextArea
|
||||||
*/
|
*/
|
||||||
public void setField (org.compiere.model.GridField mField)
|
public void setField (org.compiere.model.GridField mField)
|
||||||
{
|
{
|
||||||
|
m_mField = mField;
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
} // VText
|
} // VText
|
||||||
|
|
|
@ -34,6 +34,8 @@ import javax.swing.LookAndFeel;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.swing.CMenuItem;
|
import org.compiere.swing.CMenuItem;
|
||||||
import org.compiere.swing.CTextPane;
|
import org.compiere.swing.CTextPane;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
@ -153,6 +155,7 @@ public class VTextLong extends CTextPane
|
||||||
private String m_oldText;
|
private String m_oldText;
|
||||||
private String m_initialText;
|
private String m_initialText;
|
||||||
private volatile boolean m_setting = false;
|
private volatile boolean m_setting = false;
|
||||||
|
private GridField m_mField;
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(VTextLong.class);
|
private static CLogger log = CLogger.getCLogger(VTextLong.class);
|
||||||
|
|
||||||
|
@ -204,6 +207,11 @@ public class VTextLong extends CTextPane
|
||||||
}
|
}
|
||||||
catch (PropertyVetoException pve) {}
|
catch (PropertyVetoException pve) {}
|
||||||
}
|
}
|
||||||
|
else if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
} // actionPerformed
|
} // actionPerformed
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -246,6 +254,9 @@ public class VTextLong extends CTextPane
|
||||||
*/
|
*/
|
||||||
public void setField (org.compiere.model.GridField mField)
|
public void setField (org.compiere.model.GridField mField)
|
||||||
{
|
{
|
||||||
|
m_mField = mField;
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ import javax.swing.SwingUtilities;
|
||||||
|
|
||||||
import org.adempiere.plaf.AdempierePLAF;
|
import org.adempiere.plaf.AdempierePLAF;
|
||||||
import org.compiere.apps.ADialog;
|
import org.compiere.apps.ADialog;
|
||||||
|
import org.compiere.apps.FieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.swing.CButton;
|
import org.compiere.swing.CButton;
|
||||||
|
@ -151,10 +152,10 @@ public class VURL extends JComponent
|
||||||
|
|
||||||
m_text.addKeyListener(this);
|
m_text.addKeyListener(this);
|
||||||
m_text.addActionListener(this);
|
m_text.addActionListener(this);
|
||||||
|
m_text.addMouseListener(new VURL_mouseAdapter(this));
|
||||||
// Popup for Editor
|
// Popup for Editor
|
||||||
if (fieldLength > displayLength)
|
if (fieldLength > displayLength)
|
||||||
{
|
{
|
||||||
addMouseListener(new VURL_mouseAdapter(this));
|
|
||||||
mEditor = new CMenuItem (Msg.getMsg(Env.getCtx(), "Editor"), Env.getImageIcon("Editor16.gif"));
|
mEditor = new CMenuItem (Msg.getMsg(Env.getCtx(), "Editor"), Env.getImageIcon("Editor16.gif"));
|
||||||
mEditor.addActionListener(this);
|
mEditor.addActionListener(this);
|
||||||
popupMenu.add(mEditor);
|
popupMenu.add(mEditor);
|
||||||
|
@ -385,6 +386,11 @@ public class VURL extends JComponent
|
||||||
ValuePreference.start (m_mField, getValue());
|
ValuePreference.start (m_mField, getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (e.getActionCommand().equals(FieldRecordInfo.CHANGE_LOG_COMMAND))
|
||||||
|
{
|
||||||
|
FieldRecordInfo.start(m_mField);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Invoke Editor
|
// Invoke Editor
|
||||||
else if (e.getSource() == mEditor)
|
else if (e.getSource() == mEditor)
|
||||||
|
@ -442,6 +448,8 @@ public class VURL extends JComponent
|
||||||
if (m_mField != null
|
if (m_mField != null
|
||||||
&& MRole.getDefault().isShowPreference())
|
&& MRole.getDefault().isShowPreference())
|
||||||
ValuePreference.addMenu (this, popupMenu);
|
ValuePreference.addMenu (this, popupMenu);
|
||||||
|
if (m_mField != null)
|
||||||
|
FieldRecordInfo.addMenu(this, popupMenu);
|
||||||
} // setField
|
} // setField
|
||||||
|
|
||||||
|
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 559 B |
|
@ -18,8 +18,11 @@ import java.sql.ResultSet;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.webui.component.Combinationbox;
|
import org.adempiere.webui.component.Combinationbox;
|
||||||
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.window.WAccountDialog;
|
import org.adempiere.webui.window.WAccountDialog;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MAccountLookup;
|
import org.compiere.model.MAccountLookup;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
|
@ -34,7 +37,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class WAccountEditor extends WEditor
|
public class WAccountEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
|
||||||
|
|
||||||
|
@ -42,6 +45,8 @@ public class WAccountEditor extends WEditor
|
||||||
|
|
||||||
private Object m_value;
|
private Object m_value;
|
||||||
|
|
||||||
|
private WEditorPopupMenu popupMenu;
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
private static CLogger log = CLogger.getCLogger(WAccountEditor.class);
|
private static CLogger log = CLogger.getCLogger(WAccountEditor.class);
|
||||||
|
|
||||||
|
@ -51,6 +56,14 @@ public class WAccountEditor extends WEditor
|
||||||
getComponent().setButtonImage("/images/Account10.png");
|
getComponent().setButtonImage("/images/Account10.png");
|
||||||
|
|
||||||
m_mAccount = new MAccountLookup (gridField.getVO().ctx, gridField.getWindowNo());
|
m_mAccount = new MAccountLookup (gridField.getVO().ctx, gridField.getWindowNo());
|
||||||
|
|
||||||
|
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||||
|
popupMenu.addMenuListener(this);
|
||||||
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
getComponent().setContext(popupMenu.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -197,5 +210,13 @@ public class WAccountEditor extends WEditor
|
||||||
getComponent().setEnabled(readWrite);
|
getComponent().setEnabled(readWrite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMenu(ContextMenuEvent evt) {
|
||||||
|
if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,10 @@ import java.util.Date;
|
||||||
|
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Datebox;
|
import org.adempiere.webui.component.Datebox;
|
||||||
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
@ -36,7 +39,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
* @date Mar 12, 2007
|
* @date Mar 12, 2007
|
||||||
* @version $Revision: 0.10 $
|
* @version $Revision: 0.10 $
|
||||||
*/
|
*/
|
||||||
public class WDateEditor extends WEditor
|
public class WDateEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
@ -48,6 +51,7 @@ public class WDateEditor extends WEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
private Timestamp oldValue = new Timestamp(0);
|
private Timestamp oldValue = new Timestamp(0);
|
||||||
|
private WEditorPopupMenu popupMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -103,6 +107,13 @@ public class WDateEditor extends WEditor
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
getComponent().setFormat(DisplayType.getDateFormat(AEnv.getLanguage(Env.getCtx())).toPattern());
|
getComponent().setFormat(DisplayType.getDateFormat(AEnv.getLanguage(Env.getCtx())).toPattern());
|
||||||
|
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||||
|
popupMenu.addMenuListener(this);
|
||||||
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
getComponent().setContext(popupMenu.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
|
@ -192,4 +203,13 @@ public class WDateEditor extends WEditor
|
||||||
return LISTENER_EVENTS;
|
return LISTENER_EVENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMenu(ContextMenuEvent evt) {
|
||||||
|
if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,10 @@ import java.sql.Timestamp;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.adempiere.webui.component.DatetimeBox;
|
import org.adempiere.webui.component.DatetimeBox;
|
||||||
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
@ -27,7 +30,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*
|
*
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*/
|
*/
|
||||||
public class WDatetimeEditor extends WEditor
|
public class WDatetimeEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
|
@ -39,6 +42,7 @@ public class WDatetimeEditor extends WEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
private Timestamp oldValue = new Timestamp(0);
|
private Timestamp oldValue = new Timestamp(0);
|
||||||
|
private WEditorPopupMenu popupMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -95,6 +99,13 @@ public class WDatetimeEditor extends WEditor
|
||||||
private void init()
|
private void init()
|
||||||
{
|
{
|
||||||
getComponent().setDateFormat(DisplayType.getDateFormat());
|
getComponent().setDateFormat(DisplayType.getDateFormat());
|
||||||
|
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||||
|
popupMenu.addMenuListener(this);
|
||||||
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
getComponent().setContext(popupMenu.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
|
@ -184,4 +195,12 @@ public class WDatetimeEditor extends WEditor
|
||||||
return LISTENER_EVENTS;
|
return LISTENER_EVENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMenu(ContextMenuEvent evt) {
|
||||||
|
if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.util.ArrayList;
|
||||||
|
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Msg;
|
||||||
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;
|
||||||
|
@ -39,12 +41,13 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 8172397145177408454L;
|
private static final long serialVersionUID = 8172397145177408454L;
|
||||||
private static final String EVENT_ATTRIBUTE = "EVENT";
|
public static final String EVENT_ATTRIBUTE = "EVENT";
|
||||||
public static final String ZOOM_EVENT = "ZOOM";
|
public static final String ZOOM_EVENT = "ZOOM";
|
||||||
public static final String REQUERY_EVENT = "REQUERY";
|
public static final String REQUERY_EVENT = "REQUERY";
|
||||||
public static final String PREFERENCE_EVENT = "VALUE_PREFERENCE";
|
public static final String PREFERENCE_EVENT = "VALUE_PREFERENCE";
|
||||||
public static final String NEW_EVENT = "NEW_RECORD";
|
public static final String NEW_EVENT = "NEW_RECORD";
|
||||||
public static final String UPDATE_EVENT = "UPDATE_RECORD"; // Elaine 2009/02/16 - update record
|
public static final String UPDATE_EVENT = "UPDATE_RECORD"; // Elaine 2009/02/16 - update record
|
||||||
|
public static final String CHANGE_LOG_EVENT = "CHANGE_LOG";
|
||||||
|
|
||||||
private boolean newEnabled = true;
|
private boolean newEnabled = true;
|
||||||
private boolean updateEnabled = true; // Elaine 2009/02/16 - update record
|
private boolean updateEnabled = true; // Elaine 2009/02/16 - update record
|
||||||
|
@ -91,7 +94,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
{
|
{
|
||||||
zoomItem = new Menuitem();
|
zoomItem = new Menuitem();
|
||||||
zoomItem.setAttribute(EVENT_ATTRIBUTE, ZOOM_EVENT);
|
zoomItem.setAttribute(EVENT_ATTRIBUTE, ZOOM_EVENT);
|
||||||
zoomItem.setLabel("Zoom");
|
zoomItem.setLabel(Msg.getMsg(Env.getCtx(), "Zoom"));
|
||||||
zoomItem.setImage("/images/Zoom16.png");
|
zoomItem.setImage("/images/Zoom16.png");
|
||||||
zoomItem.addEventListener(Events.ON_CLICK, this);
|
zoomItem.addEventListener(Events.ON_CLICK, this);
|
||||||
|
|
||||||
|
@ -112,7 +115,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
{
|
{
|
||||||
prefItem = new Menuitem();
|
prefItem = new Menuitem();
|
||||||
prefItem.setAttribute(EVENT_ATTRIBUTE, PREFERENCE_EVENT);
|
prefItem.setAttribute(EVENT_ATTRIBUTE, PREFERENCE_EVENT);
|
||||||
prefItem.setLabel("Value Preference");
|
prefItem.setLabel(Msg.getMsg(Env.getCtx(), "ValuePreference"));
|
||||||
prefItem.setImage("/images/VPreference16.png");
|
prefItem.setImage("/images/VPreference16.png");
|
||||||
prefItem.addEventListener(Events.ON_CLICK, this);
|
prefItem.addEventListener(Events.ON_CLICK, this);
|
||||||
this.appendChild(prefItem);
|
this.appendChild(prefItem);
|
||||||
|
@ -122,7 +125,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
{
|
{
|
||||||
newItem = new Menuitem();
|
newItem = new Menuitem();
|
||||||
newItem.setAttribute(EVENT_ATTRIBUTE, NEW_EVENT);
|
newItem.setAttribute(EVENT_ATTRIBUTE, NEW_EVENT);
|
||||||
newItem.setLabel("New Record");
|
newItem.setLabel(Msg.getMsg(Env.getCtx(), "NewRecord"));
|
||||||
newItem.setImage("/images/New16.png");
|
newItem.setImage("/images/New16.png");
|
||||||
newItem.addEventListener(Events.ON_CLICK, this);
|
newItem.addEventListener(Events.ON_CLICK, this);
|
||||||
this.appendChild(newItem);
|
this.appendChild(newItem);
|
||||||
|
@ -139,6 +142,7 @@ public class WEditorPopupMenu extends Menupopup implements EventListener
|
||||||
this.appendChild(updateItem);
|
this.appendChild(updateItem);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addMenuListener(ContextMenuListener listener)
|
public void addMenuListener(ContextMenuListener listener)
|
||||||
|
|
|
@ -22,7 +22,10 @@ import java.beans.PropertyChangeListener;
|
||||||
|
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.Locationbox;
|
import org.adempiere.webui.component.Locationbox;
|
||||||
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.adempiere.webui.window.WLocationDialog;
|
import org.adempiere.webui.window.WLocationDialog;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MLocation;
|
import org.compiere.model.MLocation;
|
||||||
|
@ -40,13 +43,15 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*
|
*
|
||||||
* This class is based on VLocation written by Jorg Janke
|
* This class is based on VLocation written by Jorg Janke
|
||||||
**/
|
**/
|
||||||
public class WLocationEditor extends WEditor implements EventListener, PropertyChangeListener
|
public class WLocationEditor extends WEditor implements EventListener, PropertyChangeListener, ContextMenuListener
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK};
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger(WLocationEditor.class);
|
private static CLogger log = CLogger.getCLogger(WLocationEditor.class);
|
||||||
private MLocationLookup m_Location;
|
private MLocationLookup m_Location;
|
||||||
private MLocation m_value;
|
private MLocation m_value;
|
||||||
|
|
||||||
|
private WEditorPopupMenu popupMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor without GridField
|
* Constructor without GridField
|
||||||
|
@ -63,7 +68,7 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
||||||
|
|
||||||
setColumnName(columnName);
|
setColumnName(columnName);
|
||||||
m_Location = mLocation;
|
m_Location = mLocation;
|
||||||
getComponent().setButtonImage("/images/Location10.png");
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,9 +78,21 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
||||||
public WLocationEditor(GridField gridField) {
|
public WLocationEditor(GridField gridField) {
|
||||||
super(new Locationbox(), gridField);
|
super(new Locationbox(), gridField);
|
||||||
m_Location = (MLocationLookup)gridField.getLookup();
|
m_Location = (MLocationLookup)gridField.getLookup();
|
||||||
getComponent().setButtonImage("/images/Location10.png");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void init()
|
||||||
|
{
|
||||||
|
getComponent().setButtonImage("/images/Location10.png");
|
||||||
|
|
||||||
|
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||||
|
popupMenu.addMenuListener(this);
|
||||||
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
getComponent().setContext(popupMenu.getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDisplay()
|
public String getDisplay()
|
||||||
{
|
{
|
||||||
|
@ -183,4 +200,11 @@ public class WLocationEditor extends WEditor implements EventListener, PropertyC
|
||||||
return LISTENER_EVENTS;
|
return LISTENER_EVENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMenu(ContextMenuEvent evt) {
|
||||||
|
if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,7 @@ import org.adempiere.webui.component.EditorBox;
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.adempiere.webui.window.WLocatorDialog;
|
import org.adempiere.webui.window.WLocatorDialog;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MLocator;
|
import org.compiere.model.MLocator;
|
||||||
|
@ -113,8 +114,12 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
if (gridField != null)
|
if (gridField != null)
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(true, true, false);
|
popupMenu = new WEditorPopupMenu(true, true, false);
|
||||||
|
if (gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
getComponent().setContext(popupMenu.getId());
|
getComponent().setContext(popupMenu.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(Object value)
|
public void setValue(Object value)
|
||||||
|
@ -289,6 +294,10 @@ public class WLocatorEditor extends WEditor implements EventListener, PropertyCh
|
||||||
{
|
{
|
||||||
actionZoom();
|
actionZoom();
|
||||||
}
|
}
|
||||||
|
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -24,7 +24,9 @@ import org.adempiere.webui.ValuePreference;
|
||||||
import org.adempiere.webui.apps.AEnv;
|
import org.adempiere.webui.apps.AEnv;
|
||||||
import org.adempiere.webui.component.NumberBox;
|
import org.adempiere.webui.component.NumberBox;
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
@ -40,7 +42,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
*
|
*
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*/
|
*/
|
||||||
public class WNumberEditor extends WEditor
|
public class WNumberEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
public static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
public static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
|
|
||||||
|
@ -52,6 +54,8 @@ public class WNumberEditor extends WEditor
|
||||||
|
|
||||||
private int displayType;
|
private int displayType;
|
||||||
|
|
||||||
|
private WEditorPopupMenu popupMenu;
|
||||||
|
|
||||||
public WNumberEditor()
|
public WNumberEditor()
|
||||||
{
|
{
|
||||||
this("Number", false, false, true, DisplayType.Number, "");
|
this("Number", false, false, true, DisplayType.Number, "");
|
||||||
|
@ -110,6 +114,13 @@ public class WNumberEditor extends WEditor
|
||||||
displayType = DisplayType.Number;
|
displayType = DisplayType.Number;
|
||||||
DecimalFormat format = DisplayType.getNumberFormat(displayType, AEnv.getLanguage(Env.getCtx()));
|
DecimalFormat format = DisplayType.getNumberFormat(displayType, AEnv.getLanguage(Env.getCtx()));
|
||||||
getComponent().getDecimalbox().setFormat(format.toPattern());
|
getComponent().getDecimalbox().setFormat(format.toPattern());
|
||||||
|
|
||||||
|
popupMenu = new WEditorPopupMenu(true, true, false);
|
||||||
|
if (gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
getComponent().setContext(popupMenu.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -204,5 +215,9 @@ public class WNumberEditor extends WEditor
|
||||||
ValuePreference.start (this.getGridField(), getValue());
|
ValuePreference.start (this.getGridField(), getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.adempiere.webui.component.PAttributebox;
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.adempiere.webui.window.WPAttributeDialog;
|
import org.adempiere.webui.window.WPAttributeDialog;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
|
@ -75,6 +76,10 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
|
||||||
// Popup
|
// Popup
|
||||||
popupMenu = new WEditorPopupMenu(true, false, false);
|
popupMenu = new WEditorPopupMenu(true, false, false);
|
||||||
getComponent().getTextbox().setContext(popupMenu.getId());
|
getComponent().getTextbox().setContext(popupMenu.getId());
|
||||||
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -272,6 +277,10 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
actionZoom();
|
actionZoom();
|
||||||
}
|
}
|
||||||
|
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void actionZoom()
|
public void actionZoom()
|
||||||
|
|
|
@ -34,6 +34,7 @@ import org.adempiere.webui.grid.WBPartner;
|
||||||
import org.adempiere.webui.panel.InfoBPartnerPanel;
|
import org.adempiere.webui.panel.InfoBPartnerPanel;
|
||||||
import org.adempiere.webui.panel.InfoPanel;
|
import org.adempiere.webui.panel.InfoPanel;
|
||||||
import org.adempiere.webui.panel.InfoProductPanel;
|
import org.adempiere.webui.panel.InfoProductPanel;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.Lookup;
|
import org.compiere.model.Lookup;
|
||||||
import org.compiere.model.MLookup;
|
import org.compiere.model.MLookup;
|
||||||
|
@ -164,7 +165,11 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
getComponent().setButtonImage("/images/PickOpen10.png");
|
getComponent().setButtonImage("/images/PickOpen10.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
(getComponent().getTextbox()).setContext(popupMenu.getId());
|
getComponent().getTextbox().setContext(popupMenu.getId());
|
||||||
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -297,6 +302,10 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value
|
||||||
}
|
}
|
||||||
actionBPartner(false);
|
actionBPartner(false);
|
||||||
}
|
}
|
||||||
|
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.adempiere.webui.window.WTextEditorDialog;
|
import org.adempiere.webui.window.WTextEditorDialog;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
|
@ -144,6 +145,11 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
||||||
editor.setAttribute("EVENT", EDITOR_EVENT);
|
editor.setAttribute("EVENT", EDITOR_EVENT);
|
||||||
editor.addEventListener(Events.ON_CLICK, popupMenu);
|
editor.addEventListener(Events.ON_CLICK, popupMenu);
|
||||||
popupMenu.appendChild(editor);
|
popupMenu.appendChild(editor);
|
||||||
|
|
||||||
|
if (gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
|
||||||
getComponent().setContext(popupMenu.getId());
|
getComponent().setContext(popupMenu.getId());
|
||||||
|
|
||||||
|
@ -248,6 +254,10 @@ public class WStringEditor extends WEditor implements ContextMenuListener
|
||||||
oldValue = newText;
|
oldValue = newText;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,6 +28,7 @@ import org.adempiere.webui.component.Combobox;
|
||||||
import org.adempiere.webui.event.ContextMenuEvent;
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
import org.adempiere.webui.event.ContextMenuListener;
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.model.Lookup;
|
import org.compiere.model.Lookup;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
|
@ -144,6 +145,10 @@ ContextMenuListener, IZoomableEditor
|
||||||
if (gridField != null)
|
if (gridField != null)
|
||||||
{
|
{
|
||||||
popupMenu = new WEditorPopupMenu(zoom, true, true);
|
popupMenu = new WEditorPopupMenu(zoom, true, true);
|
||||||
|
if (gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
getComponent().setContext(popupMenu.getId());
|
getComponent().setContext(popupMenu.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -374,6 +379,10 @@ ContextMenuListener, IZoomableEditor
|
||||||
ValuePreference.start (this.getGridField(), getValue());
|
ValuePreference.start (this.getGridField(), getValue());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
else if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void propertyChange(PropertyChangeEvent evt)
|
public void propertyChange(PropertyChangeEvent evt)
|
||||||
|
|
|
@ -17,7 +17,10 @@ import java.sql.Timestamp;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
|
@ -28,7 +31,7 @@ import org.zkoss.zul.Timebox;
|
||||||
*
|
*
|
||||||
* @author Low Heng Sin
|
* @author Low Heng Sin
|
||||||
*/
|
*/
|
||||||
public class WTimeEditor extends WEditor
|
public class WTimeEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CHANGE};
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
@ -39,6 +42,7 @@ public class WTimeEditor extends WEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
private Timestamp oldValue = new Timestamp(0);
|
private Timestamp oldValue = new Timestamp(0);
|
||||||
|
private WEditorPopupMenu popupMenu;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -47,6 +51,7 @@ public class WTimeEditor extends WEditor
|
||||||
public WTimeEditor(GridField gridField)
|
public WTimeEditor(GridField gridField)
|
||||||
{
|
{
|
||||||
super(new Timebox(), gridField);
|
super(new Timebox(), gridField);
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -61,6 +66,7 @@ public class WTimeEditor extends WEditor
|
||||||
String title)
|
String title)
|
||||||
{
|
{
|
||||||
super(new Timebox(), columnName, title, null, mandatory, readonly, updateable);
|
super(new Timebox(), columnName, title, null, mandatory, readonly, updateable);
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -81,13 +87,26 @@ public class WTimeEditor extends WEditor
|
||||||
{
|
{
|
||||||
super(new Timebox(), label, description, mandatory, readonly, updateable);
|
super(new Timebox(), label, description, mandatory, readonly, updateable);
|
||||||
setColumnName("Time");
|
setColumnName("Time");
|
||||||
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WTimeEditor()
|
public WTimeEditor()
|
||||||
{
|
{
|
||||||
this("Time", "Time", false, false, true);
|
this("Time", "Time", false, false, true);
|
||||||
|
init();
|
||||||
} // VDate
|
} // VDate
|
||||||
|
|
||||||
|
private void init()
|
||||||
|
{
|
||||||
|
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||||
|
popupMenu.addMenuListener(this);
|
||||||
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
getComponent().setContext(popupMenu.getId());
|
||||||
|
}
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
{
|
{
|
||||||
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()))
|
if (Events.ON_CHANGE.equalsIgnoreCase(event.getName()))
|
||||||
|
@ -174,4 +193,12 @@ public class WTimeEditor extends WEditor
|
||||||
public void fillHorizontal() {
|
public void fillHorizontal() {
|
||||||
//do nothing, can't stretch a timebox
|
//do nothing, can't stretch a timebox
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMenu(ContextMenuEvent evt) {
|
||||||
|
if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,22 +18,34 @@
|
||||||
package org.adempiere.webui.editor;
|
package org.adempiere.webui.editor;
|
||||||
|
|
||||||
import org.adempiere.webui.component.Urlbox;
|
import org.adempiere.webui.component.Urlbox;
|
||||||
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
import org.adempiere.webui.window.FDialog;
|
import org.adempiere.webui.window.FDialog;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.zkoss.zk.ui.event.Event;
|
import org.zkoss.zk.ui.event.Event;
|
||||||
import org.zkoss.zk.ui.event.Events;
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
|
||||||
public class WUrlEditor extends WEditor
|
public class WUrlEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
|
private static final String[] LISTENER_EVENTS = {Events.ON_CLICK, Events.ON_CHANGE};
|
||||||
private String oldValue;
|
private String oldValue;
|
||||||
|
private WEditorPopupMenu popupMenu;
|
||||||
|
|
||||||
public WUrlEditor(GridField gridField)
|
public WUrlEditor(GridField gridField)
|
||||||
{
|
{
|
||||||
super(new Urlbox(), gridField);
|
super(new Urlbox(), gridField);
|
||||||
getComponent().setButtonImage("/images/Online10.png");
|
getComponent().setButtonImage("/images/Online10.png");
|
||||||
|
|
||||||
|
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||||
|
popupMenu.addMenuListener(this);
|
||||||
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
getComponent().setContext(popupMenu.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,4 +136,14 @@ public class WUrlEditor extends WEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMenu(ContextMenuEvent evt)
|
||||||
|
{
|
||||||
|
if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,10 @@ import java.beans.PropertyChangeEvent;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.adempiere.webui.component.Checkbox;
|
import org.adempiere.webui.component.Checkbox;
|
||||||
|
import org.adempiere.webui.event.ContextMenuEvent;
|
||||||
|
import org.adempiere.webui.event.ContextMenuListener;
|
||||||
import org.adempiere.webui.event.ValueChangeEvent;
|
import org.adempiere.webui.event.ValueChangeEvent;
|
||||||
|
import org.adempiere.webui.window.WFieldRecordInfo;
|
||||||
import org.compiere.model.GridField;
|
import org.compiere.model.GridField;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
@ -35,7 +38,7 @@ import org.zkoss.zk.ui.event.Events;
|
||||||
* @date Mar 11, 2007
|
* @date Mar 11, 2007
|
||||||
* @version $Revision: 0.10 $
|
* @version $Revision: 0.10 $
|
||||||
*/
|
*/
|
||||||
public class WYesNoEditor extends WEditor
|
public class WYesNoEditor extends WEditor implements ContextMenuListener
|
||||||
{
|
{
|
||||||
public static final String[] LISTENER_EVENTS = {Events.ON_CHECK};
|
public static final String[] LISTENER_EVENTS = {Events.ON_CHECK};
|
||||||
private static final CLogger logger;
|
private static final CLogger logger;
|
||||||
|
@ -46,6 +49,7 @@ public class WYesNoEditor extends WEditor
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean oldValue = false;
|
private boolean oldValue = false;
|
||||||
|
private WEditorPopupMenu popupMenu;
|
||||||
|
|
||||||
public WYesNoEditor(GridField gridField)
|
public WYesNoEditor(GridField gridField)
|
||||||
{
|
{
|
||||||
|
@ -68,6 +72,14 @@ public class WYesNoEditor extends WEditor
|
||||||
getComponent().setLabel(label.getValue());
|
getComponent().setLabel(label.getValue());
|
||||||
label.setValue("");
|
label.setValue("");
|
||||||
label.setTooltiptext("");
|
label.setTooltiptext("");
|
||||||
|
|
||||||
|
popupMenu = new WEditorPopupMenu(false, false, true);
|
||||||
|
popupMenu.addMenuListener(this);
|
||||||
|
if (gridField != null && gridField.getGridTab() != null)
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.addMenu(popupMenu);
|
||||||
|
}
|
||||||
|
getComponent().setContext(popupMenu.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onEvent(Event event)
|
public void onEvent(Event event)
|
||||||
|
@ -148,4 +160,13 @@ public class WYesNoEditor extends WEditor
|
||||||
return LISTENER_EVENTS;
|
return LISTENER_EVENTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMenu(ContextMenuEvent evt)
|
||||||
|
{
|
||||||
|
if (WEditorPopupMenu.CHANGE_LOG_EVENT.equals(evt.getContextEvent()))
|
||||||
|
{
|
||||||
|
WFieldRecordInfo.start(gridField);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,379 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2009 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. *
|
||||||
|
* *
|
||||||
|
* @sponsor www.metas.de *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.adempiere.webui.window;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.Timestamp;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Vector;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.webui.apps.AEnv;
|
||||||
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
|
import org.adempiere.webui.component.Listbox;
|
||||||
|
import org.adempiere.webui.component.SimpleListModel;
|
||||||
|
import org.adempiere.webui.component.Window;
|
||||||
|
import org.adempiere.webui.editor.WEditorPopupMenu;
|
||||||
|
import org.compiere.model.GridField;
|
||||||
|
import org.compiere.model.MChangeLog;
|
||||||
|
import org.compiere.model.MColumn;
|
||||||
|
import org.compiere.model.MLookup;
|
||||||
|
import org.compiere.model.MLookupFactory;
|
||||||
|
import org.compiere.model.MRole;
|
||||||
|
import org.compiere.model.MTable;
|
||||||
|
import org.compiere.model.MUser;
|
||||||
|
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.EventListener;
|
||||||
|
import org.zkoss.zk.ui.event.Events;
|
||||||
|
import org.zkoss.zkex.zul.Borderlayout;
|
||||||
|
import org.zkoss.zkex.zul.Center;
|
||||||
|
import org.zkoss.zkex.zul.South;
|
||||||
|
import org.zkoss.zul.Listhead;
|
||||||
|
import org.zkoss.zul.Listheader;
|
||||||
|
import org.zkoss.zul.Menuitem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Change History for field
|
||||||
|
* @author Low Heng Sin
|
||||||
|
*/
|
||||||
|
public class WFieldRecordInfo extends Window implements EventListener
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 3859352394520596098L;
|
||||||
|
private int AD_Table_ID;
|
||||||
|
private int AD_Column_ID;
|
||||||
|
private int Record_ID;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Record Info
|
||||||
|
* @param title title
|
||||||
|
* @param AD_Table_ID
|
||||||
|
* @param AD_Column_ID
|
||||||
|
* @param Record_ID
|
||||||
|
*/
|
||||||
|
public WFieldRecordInfo (String title, int AD_Table_ID, int AD_Column_ID, int Record_ID)
|
||||||
|
{
|
||||||
|
super ();
|
||||||
|
this.setTitle(title);
|
||||||
|
this.setAttribute("modal", Boolean.TRUE);
|
||||||
|
this.setWidth("600px");
|
||||||
|
this.setHeight("400px");
|
||||||
|
this.setBorder("normal");
|
||||||
|
this.setSizable(true);
|
||||||
|
this.setClosable(true);
|
||||||
|
this.setMaximizable(true);
|
||||||
|
|
||||||
|
this.AD_Table_ID = AD_Table_ID;
|
||||||
|
this.AD_Column_ID = AD_Column_ID;
|
||||||
|
this.Record_ID = Record_ID;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
init ( dynInit(title) );
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, "", e);
|
||||||
|
}
|
||||||
|
AEnv.showCenterScreen(this);
|
||||||
|
} // WFieldRecordInfo
|
||||||
|
|
||||||
|
|
||||||
|
private Listbox table = new Listbox();
|
||||||
|
private ConfirmPanel confirmPanel = new ConfirmPanel (false);
|
||||||
|
|
||||||
|
/** Logger */
|
||||||
|
protected CLogger log = CLogger.getCLogger(getClass());
|
||||||
|
/** The Data */
|
||||||
|
private Vector<Vector<String>> m_data = new Vector<Vector<String>>();
|
||||||
|
|
||||||
|
/** Date Time Format */
|
||||||
|
private SimpleDateFormat m_dateTimeFormat = DisplayType.getDateFormat
|
||||||
|
(DisplayType.DateTime, Env.getLanguage(Env.getCtx()));
|
||||||
|
/** Date Format */
|
||||||
|
private SimpleDateFormat m_dateFormat = DisplayType.getDateFormat
|
||||||
|
(DisplayType.DateTime, Env.getLanguage(Env.getCtx()));
|
||||||
|
/** Number Format */
|
||||||
|
private DecimalFormat m_numberFormat = DisplayType.getNumberFormat
|
||||||
|
(DisplayType.Number, Env.getLanguage(Env.getCtx()));
|
||||||
|
/** Amount Format */
|
||||||
|
private DecimalFormat m_amtFormat = DisplayType.getNumberFormat
|
||||||
|
(DisplayType.Amount, Env.getLanguage(Env.getCtx()));
|
||||||
|
/** Number Format */
|
||||||
|
private DecimalFormat m_intFormat = DisplayType.getNumberFormat
|
||||||
|
(DisplayType.Integer, Env.getLanguage(Env.getCtx()));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Static Layout
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private void init (boolean showTable) throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
Borderlayout layout = new Borderlayout();
|
||||||
|
layout.setParent(this);
|
||||||
|
layout.setWidth("100%");
|
||||||
|
layout.setHeight("100%");
|
||||||
|
|
||||||
|
Center center = new Center();
|
||||||
|
center.setParent(layout);
|
||||||
|
center.setFlex(true);
|
||||||
|
if (showTable)
|
||||||
|
{
|
||||||
|
center.appendChild(table);
|
||||||
|
table.setWidth("100%");
|
||||||
|
table.setVflex(true);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
South south = new South();
|
||||||
|
south.setParent(layout);
|
||||||
|
south.appendChild(confirmPanel);
|
||||||
|
|
||||||
|
confirmPanel.addActionListener(Events.ON_CLICK, this);
|
||||||
|
} // init
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dynamic Init
|
||||||
|
* @param title title
|
||||||
|
* @return true if table initialized
|
||||||
|
*/
|
||||||
|
private boolean dynInit(String title)
|
||||||
|
{
|
||||||
|
// Title
|
||||||
|
if (AD_Table_ID != 0)
|
||||||
|
{
|
||||||
|
MTable table1 = MTable.get (Env.getCtx(), AD_Table_ID);
|
||||||
|
setTitle(title + " - " + table1.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Only Client Preference can view Change Log
|
||||||
|
if (!MRole.PREFERENCETYPE_Client.equals(MRole.getDefault().getPreferenceType()))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (Record_ID == 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Data
|
||||||
|
String sql = "SELECT AD_Column_ID, Updated, UpdatedBy, OldValue, NewValue "
|
||||||
|
+ "FROM AD_ChangeLog "
|
||||||
|
+ "WHERE AD_Table_ID=? AND Record_ID=? AND AD_Column_ID=?"
|
||||||
|
+ "ORDER BY Updated DESC";
|
||||||
|
PreparedStatement pstmt = null;
|
||||||
|
ResultSet rs = null;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
pstmt = DB.prepareStatement (sql, null);
|
||||||
|
pstmt.setInt (1, AD_Table_ID);
|
||||||
|
pstmt.setInt (2, Record_ID);
|
||||||
|
pstmt.setInt (3, AD_Column_ID);
|
||||||
|
rs = pstmt.executeQuery ();
|
||||||
|
while (rs.next ())
|
||||||
|
{
|
||||||
|
addLine (rs.getInt(1), rs.getTimestamp(2), rs.getInt(3),
|
||||||
|
rs.getString(4), rs.getString(5));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.SEVERE, sql, e);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
DB.close(rs, pstmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
Vector<String> columnNames = new Vector<String>();
|
||||||
|
columnNames.add(Msg.translate(Env.getCtx(), "NewValue"));
|
||||||
|
columnNames.add(Msg.translate(Env.getCtx(), "OldValue"));
|
||||||
|
columnNames.add(Msg.translate(Env.getCtx(), "UpdatedBy"));
|
||||||
|
columnNames.add(Msg.translate(Env.getCtx(), "Updated"));
|
||||||
|
|
||||||
|
Listhead listhead = new Listhead();
|
||||||
|
listhead.setSizable(true);
|
||||||
|
|
||||||
|
for (int i = 0; i < columnNames.size(); i++)
|
||||||
|
{
|
||||||
|
Listheader listheader = new Listheader(columnNames.get(i).replaceAll("[&]", ""));
|
||||||
|
listhead.appendChild(listheader);
|
||||||
|
}
|
||||||
|
|
||||||
|
table.appendChild(listhead);
|
||||||
|
SimpleListModel model = new SimpleListModel(m_data);
|
||||||
|
table.setItemRenderer(model);
|
||||||
|
table.setModel(model);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
} // dynInit
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add Line
|
||||||
|
* @param AD_Column_ID column
|
||||||
|
* @param Updated updated
|
||||||
|
* @param UpdatedBy user
|
||||||
|
* @param OldValue old
|
||||||
|
* @param NewValue new
|
||||||
|
*/
|
||||||
|
private void addLine (int AD_Column_ID, Timestamp Updated, int UpdatedBy,
|
||||||
|
String OldValue, String NewValue)
|
||||||
|
{
|
||||||
|
Vector<String> line = new Vector<String>();
|
||||||
|
// Column
|
||||||
|
MColumn column = MColumn.get (Env.getCtx(), AD_Column_ID);
|
||||||
|
//
|
||||||
|
if (OldValue != null && OldValue.equals(MChangeLog.NULL))
|
||||||
|
OldValue = null;
|
||||||
|
String showOldValue = OldValue;
|
||||||
|
if (NewValue != null && NewValue.equals(MChangeLog.NULL))
|
||||||
|
NewValue = null;
|
||||||
|
String showNewValue = NewValue;
|
||||||
|
//
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (DisplayType.isText (column.getAD_Reference_ID ()))
|
||||||
|
;
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.YesNo)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
{
|
||||||
|
boolean yes = OldValue.equals("true") || OldValue.equals("Y");
|
||||||
|
showOldValue = Msg.getMsg(Env.getCtx(), yes ? "Y" : "N");
|
||||||
|
}
|
||||||
|
if (NewValue != null)
|
||||||
|
{
|
||||||
|
boolean yes = NewValue.equals("true") || NewValue.equals("Y");
|
||||||
|
showNewValue = Msg.getMsg(Env.getCtx(), yes ? "Y" : "N");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.Amount)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_amtFormat
|
||||||
|
.format (new BigDecimal (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_amtFormat
|
||||||
|
.format (new BigDecimal (NewValue));
|
||||||
|
}
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.Integer)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_intFormat.format (new Integer (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_intFormat.format (new Integer (NewValue));
|
||||||
|
}
|
||||||
|
else if (DisplayType.isNumeric (column.getAD_Reference_ID ()))
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_numberFormat.format (new BigDecimal (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_numberFormat.format (new BigDecimal (NewValue));
|
||||||
|
}
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.Date)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_dateFormat.format (Timestamp.valueOf (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_dateFormat.format (Timestamp.valueOf (NewValue));
|
||||||
|
}
|
||||||
|
else if (column.getAD_Reference_ID() == DisplayType.DateTime)
|
||||||
|
{
|
||||||
|
if (OldValue != null)
|
||||||
|
showOldValue = m_dateTimeFormat.format (Timestamp.valueOf (OldValue));
|
||||||
|
if (NewValue != null)
|
||||||
|
showNewValue = m_dateTimeFormat.format (Timestamp.valueOf (NewValue));
|
||||||
|
}
|
||||||
|
else if (DisplayType.isLookup(column.getAD_Reference_ID ()))
|
||||||
|
{
|
||||||
|
MLookup lookup = MLookupFactory.get (Env.getCtx(), 0,
|
||||||
|
AD_Column_ID, column.getAD_Reference_ID(),
|
||||||
|
Env.getLanguage(Env.getCtx()), column.getColumnName(),
|
||||||
|
column.getAD_Reference_Value_ID(),
|
||||||
|
column.isParent(), null);
|
||||||
|
if (OldValue != null)
|
||||||
|
{
|
||||||
|
Object key = OldValue;
|
||||||
|
NamePair pp = lookup.get(key);
|
||||||
|
if (pp != null)
|
||||||
|
showOldValue = pp.getName();
|
||||||
|
}
|
||||||
|
if (NewValue != null)
|
||||||
|
{
|
||||||
|
Object key = NewValue;
|
||||||
|
NamePair pp = lookup.get(key);
|
||||||
|
if (pp != null)
|
||||||
|
showNewValue = pp.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (DisplayType.isLOB (column.getAD_Reference_ID ()))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
log.log(Level.WARNING, OldValue + "->" + NewValue, e);
|
||||||
|
}
|
||||||
|
//
|
||||||
|
line.add(showNewValue);
|
||||||
|
line.add(showOldValue);
|
||||||
|
// UpdatedBy
|
||||||
|
MUser user = MUser.get(Env.getCtx(), UpdatedBy);
|
||||||
|
line.add(user.getName());
|
||||||
|
// Updated
|
||||||
|
line.add(m_dateFormat.format(Updated));
|
||||||
|
|
||||||
|
m_data.add(line);
|
||||||
|
} // addLine
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param event
|
||||||
|
*/
|
||||||
|
public void onEvent(Event event) throws Exception {
|
||||||
|
this.detach();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Open field record info dialog
|
||||||
|
* @param gridField
|
||||||
|
*/
|
||||||
|
public static void start(GridField gridField) {
|
||||||
|
new WFieldRecordInfo(gridField.getColumnName(),
|
||||||
|
gridField.getGridTab().getAD_Table_ID(), gridField.getAD_Column_ID(),
|
||||||
|
gridField.getGridTab().getRecord_ID());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add change log menu item
|
||||||
|
* @param popupMenu
|
||||||
|
*/
|
||||||
|
public static void addMenu(WEditorPopupMenu popupMenu) {
|
||||||
|
Menuitem changeLogItem = new Menuitem();
|
||||||
|
changeLogItem.setLabel(Msg.getElement(Env.getCtx(), "AD_ChangeLog_ID"));
|
||||||
|
changeLogItem.setImage("/images/ChangeLog16.png");
|
||||||
|
changeLogItem.setAttribute(WEditorPopupMenu.EVENT_ATTRIBUTE, WEditorPopupMenu.CHANGE_LOG_EVENT);
|
||||||
|
changeLogItem.addEventListener(Events.ON_CLICK, popupMenu);
|
||||||
|
|
||||||
|
popupMenu.appendChild(changeLogItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // WFieldRecordInfo
|
Binary file not shown.
After Width: | Height: | Size: 559 B |
Loading…
Reference in New Issue