Fix 3121975 POS Query Product Vertical Scroll Problem

http://sourceforge.net/tracker/index.php?func=detail&aid=3121975&group_id=176962&atid=879332
IDEMPIERE-61
This commit is contained in:
dellph 2011-08-15 13:10:57 -05:00
parent f92ee90799
commit 40177e56e5
2 changed files with 34 additions and 15 deletions

View File

@ -38,10 +38,8 @@ import org.compiere.util.Msg;
/**
* POS Query Product
*
* @author Comunidad de Desarrollo OpenXpertya
* *Basado en Codigo Original Modificado, Revisado y Optimizado de:
* @author Based on Modified Original Code, Revised and Optimized
* *Copyright (c) Jorg Janke
* @version $Id: QueryProduct.java,v 1.1 2004/07/12 04:10:04 jjanke Exp $
*/
public class QueryProduct extends PosQuery
{
@ -159,10 +157,20 @@ public class QueryProduct extends PosQuery
+ " ORDER BY Margin, QtyAvailable";
m_table.addMouseListener(this);
m_table.getSelectionModel().addListSelectionListener(this);
m_table.setColumnVisibility(m_table.getColumn(0), false);
m_table.getColumn(1).setPreferredWidth(175);
m_table.getColumn(2).setPreferredWidth(175);
m_table.getColumn(3).setPreferredWidth(100);
m_table.getColumn(4).setPreferredWidth(75);
m_table.getColumn(5).setPreferredWidth(75);
m_table.getColumn(6).setPreferredWidth(75);
m_table.getColumn(7).setPreferredWidth(75);
enableButtons();
m_table.setFillsViewportHeight( true ); //@Trifon
// m_table.setFocusable( true ); //@Trifon
m_table.growScrollbars();
centerScroll = new CScrollPane(m_table);
panel.add (centerScroll, "growx, growy,south");
m_table.growScrollbars();
panel.setPreferredSize(new Dimension(800,600));
f_value.requestFocus();
} // init
@ -209,6 +217,8 @@ public class QueryProduct extends PosQuery
if (row < 0)
row = 0;
m_table.getSelectionModel().setSelectionInterval(row, row);
// https://sourceforge.net/tracker/?func=detail&atid=879332&aid=3121975&group_id=176962
m_table.scrollRectToVisible(m_table.getCellRect(row, 1, true)); //@Trifon - BF[3121975]
return;
}
else if ("Next".equalsIgnoreCase(e.getActionCommand()))
@ -221,6 +231,8 @@ public class QueryProduct extends PosQuery
if (row >= rows)
row = rows - 1;
m_table.getSelectionModel().setSelectionInterval(row, row);
// https://sourceforge.net/tracker/?func=detail&atid=879332&aid=3121975&group_id=176962
m_table.scrollRectToVisible(m_table.getCellRect(row, 1, true)); //@Trifon - BF[3121975]
return;
}
// Exit

View File

@ -51,10 +51,9 @@ import org.compiere.util.Msg;
/**
* Current Line Sub Panel
*
* @author Comunidad de Desarrollo OpenXpertya
* *Basado en Codigo Original Modificado, Revisado y Optimizado de:
* *Copyright <EFBFBD> Jorg Janke
* @version $Id: SubCurrentLine.java,v 1.3 2004/07/24 04:31:52 jjanke Exp $
* @author OpenXpertya
* Based on Modified Original Code, Revised and Optimized
* *Copyright Jorg Janke
* red1 - [2093355 ] Small bugs in OpenXpertya POS
*/
public class SubCurrentLine extends PosSubPanel implements ActionListener, FocusListener, ListSelectionListener {
@ -66,12 +65,11 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener, Focus
/**
* Constructor
*
* @param posPanel
* POS Panel
* @param posPanel POS Panel
*/
public SubCurrentLine(PosBasePanel posPanel) {
super(posPanel);
} // PosSubCurrentLine
}
private CButton f_up;
private CButton f_delete;
@ -159,6 +157,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener, Focus
m_table.getColumn(5).setPreferredWidth(75);
m_table.getColumn(6).setPreferredWidth(30);
m_table.setFocusable(false);
m_table.setFillsViewportHeight( true ); //@Trifon
m_table.growScrollbars();
add (scroll, "growx, spanx, growy, pushy, h 200:300:");
@ -205,9 +204,7 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener, Focus
setPrice(Env.ZERO);
enableButtons();
} // init
} //init
/**
@ -286,6 +283,12 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener, Focus
qt.setQueryData(m_M_PriceList_Version_ID, m_M_Warehouse_ID);
qt.setVisible(true);
findProduct();
int row = m_table.getSelectedRow();
if (row < 0) row = 0;
m_table.getSelectionModel().setSelectionInterval(row, row);
// https://sourceforge.net/tracker/?func=detail&atid=879332&aid=3121975&group_id=176962
m_table.scrollRectToVisible(m_table.getCellRect(row, 1, true)); //@Trifon - BF[3121975]
}
// Name
else if (e.getSource() == f_name)
@ -293,13 +296,15 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener, Focus
if ("Previous".equalsIgnoreCase(e.getActionCommand()))
{
int rows = m_table.getRowCount();
if (rows == 0)
if (rows == 0)
return;
int row = m_table.getSelectedRow();
row--;
if (row < 0)
row = 0;
m_table.getSelectionModel().setSelectionInterval(row, row);
// https://sourceforge.net/tracker/?func=detail&atid=879332&aid=3121975&group_id=176962
m_table.scrollRectToVisible(m_table.getCellRect(row, 1, true)); //@Trifon - BF[3121975]
return;
}
else if ("Next".equalsIgnoreCase(e.getActionCommand()))
@ -312,6 +317,8 @@ public class SubCurrentLine extends PosSubPanel implements ActionListener, Focus
if (row >= rows)
row = rows - 1;
m_table.getSelectionModel().setSelectionInterval(row, row);
// https://sourceforge.net/tracker/?func=detail&atid=879332&aid=3121975&group_id=176962
m_table.scrollRectToVisible(m_table.getCellRect(row, 1, true)); //@Trifon - BF[3121975]
return;
}
// Delete