diff --git a/_Project-ID-ADempiere/sqls_3.1.1/20_insert_new_messages.sql b/_Project-ID-ADempiere/sqls_3.1.1/20_insert_new_messages.sql index 5067f076ca..13404a420c 100644 --- a/_Project-ID-ADempiere/sqls_3.1.1/20_insert_new_messages.sql +++ b/_Project-ID-ADempiere/sqls_3.1.1/20_insert_new_messages.sql @@ -47,9 +47,19 @@ INSERT INTO ad_message 0, SYSDATE, 0, 'OpenWindowMaximized', 'Open Window Maximized', 'I', 'D' ); + +INSERT INTO ad_message + (ad_message_id, ad_client_id, ad_org_id, isactive, created, + createdby, updated, updatedby, VALUE, msgtext, + msgtype, entitytype + ) + VALUES (50005, 0, 0, 'Y', SYSDATE, + 0, SYSDATE, 0, 'DeleteSelection', 'Delete Selected Items', + 'I', 'D' + ); UPDATE ad_sequence - SET currentnextsys = 50005 + SET currentnextsys = 50006 WHERE NAME = 'AD_Message'; COMMIT ; diff --git a/base/src/org/compiere/model/GridTab.java b/base/src/org/compiere/model/GridTab.java index 7b22b55c8b..34c2642072 100644 --- a/base/src/org/compiere/model/GridTab.java +++ b/base/src/org/compiere/model/GridTab.java @@ -18,6 +18,7 @@ package org.compiere.model; import java.beans.*; import java.io.*; +import java.math.BigDecimal; import java.sql.*; import java.text.*; import java.util.*; @@ -26,6 +27,11 @@ import java.util.logging.*; import javax.swing.event.*; import org.compiere.util.*; +import de.schaeffer.compiere.constants.Constants; +import de.schaeffer.compiere.tools.BPartnerSelection; +import de.schaeffer.compiere.tools.CustomValueComparison; +import de.schaeffer.compiere.tools.OrderWeightCheck; + /** * Tab Model. * - a combination of AD_Tab (the display attributes) and AD_Table information. @@ -2124,6 +2130,24 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable if (status == null || status.length() == 0) m_DataStatusEvent.setInfo("NavigateOrUpdate", null, false,false); fireDataStatusChanged(m_DataStatusEvent); + +// CHANGED: Vergleich von fpa und selected values BPartnerSelection + if (getName().equalsIgnoreCase("BPartner Selection")) { + BPartnerSelection.compareWithFpaValues(this, null); + return m_currentRow; + }// ende changed + // CHANGED: Vergleich von actual und customer values in OrderLine + else if (getName().equalsIgnoreCase("Order Line")) { + CustomValueComparison.compare(this); + return m_currentRow; + }// ende changed +// CHANGED: checks the total order weight + else if (getName().equalsIgnoreCase("Purchase Order")) { + //besser mit ID - getAD_Tab_ID() + OrderWeightCheck.compare(this); + return m_currentRow; + }// ende changed + return m_currentRow; } // setCurrentRow @@ -2442,5 +2466,85 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable { m_listenerList.add(DataStatusListener.class, l); } + +// CHANGED: Eigene Methode - für das Umsortieren der Tabellenzeilen + /** + * Vertauscht zwei Zeilen einer Tabelle. + * + * @author Karsten Thiemann + * @param from + * Index der Zeile die verschoben wird + * @param to + * Index der Zielzeile + */ + public void moveRow(int from, int to) { + // nothing to do + if (from == to) { + log.fine("nothing to do - from == to"); + return; + } + + // Row range check + int nextRow = verifyRow(to); + if (nextRow == -1) { + log.fine("Row range check - return"); + return; + } + // Check, if we have old uncommitted data + m_mTable.dataSave(nextRow, false); + + int lineCol = m_mTable.findColumn("Line"); + if (lineCol == -1) { + lineCol = m_mTable.findColumn("SeqNo"); + } + Integer lineNoCurrentRow = null; + Integer lineNoNextRow = null; + if (m_mTable.getValueAt(from, lineCol) instanceof Integer) { + // die verschiedenen Ansichten (Tabelle/Grid) liefern verschiedene + // Typen... + lineNoCurrentRow = (Integer) m_mTable.getValueAt(from, lineCol); + lineNoNextRow = (Integer) m_mTable.getValueAt(nextRow, lineCol); + } else if (m_mTable.getValueAt(from, lineCol) instanceof BigDecimal) { + lineNoCurrentRow = new Integer(((BigDecimal) m_mTable.getValueAt(from, lineCol)) + .intValue()); + lineNoNextRow = new Integer(((BigDecimal) m_mTable.getValueAt(nextRow, lineCol)) + .intValue()); + } else { + log.fine("unknown value format - return"); + return; + } + if (lineNoCurrentRow == Constants.FREIGHTCOST_LINENO + || lineNoNextRow == Constants.FREIGHTCOST_LINENO) { + return; // Versandkosten nicht mitsortieren! + } + log.fine("LineIndex from: " + from + " LineIndex to: " + nextRow); + log.fine("lineNoCurrentRow: " + lineNoCurrentRow + " lineNoNextRow: " + lineNoNextRow); + // switch the lineNo's + m_mTable.setValueAt(new Integer(-10), from, lineCol); // wegen der + // Dateiumbenennung + // (als + // Zwischenspeicher) + log.fine("LineNo der Zeile " + from + " auf -10 gesetzt."); + log.fine("aktueller Wert von LineNo: " + m_mTable.getValueAt(from, lineCol).toString()); + setCurrentRow(nextRow, false);// speichert alle Werte der Zeile + // (fehlerfrei!) + m_mTable.dataSave(true); + m_mTable.setValueAt(lineNoCurrentRow, nextRow, lineCol); + log.fine("LineNo der Zeile " + nextRow + " auf " + lineNoCurrentRow + " gesetzt."); + log.fine("aktueller Wert von LineNo: " + m_mTable.getValueAt(nextRow, lineCol).toString()); + setCurrentRow(from, false); + m_mTable.dataSave(true); + m_mTable.setValueAt(lineNoNextRow, from, lineCol); + log.fine("LineNo der Zeile " + from + " auf " + lineNoNextRow + " gesetzt."); + log.fine("aktueller Wert von LineNo: " + m_mTable.getValueAt(from, lineCol).toString()); + setCurrentRow(nextRow, false); + m_mTable.dataSave(true); + m_mTable.sort(lineCol, true); + navigate(nextRow); + } + + public void setCurrentRow(int row){ + setCurrentRow(row, false); + } } // MTab diff --git a/client/src/org/compiere/apps/APanel.java b/client/src/org/compiere/apps/APanel.java index 89ebd77aac..d3394d2d07 100644 --- a/client/src/org/compiere/apps/APanel.java +++ b/client/src/org/compiere/apps/APanel.java @@ -164,7 +164,7 @@ public final class APanel extends CPanel // Local (added to toolbar) private AppsAction aReport, aEnd, aHome, aHelp, aProduct, aAccount, aCalculator, aCalendar, aEditor, aPreference, aScript, - aOnline, aMailSupport, aAbout, aPrintScr, aScrShot, aExit, aBPartner; + aOnline, aMailSupport, aAbout, aPrintScr, aScrShot, aExit, aBPartner, aDeleteSelection; /************************************************************************** @@ -195,6 +195,7 @@ public final class APanel extends CPanel mEdit.addSeparator(); aCopy = addAction("Copy", mEdit, KeyStroke.getKeyStroke(KeyEvent.VK_F2, Event.SHIFT_MASK), false); aDelete = addAction("Delete", mEdit, KeyStroke.getKeyStroke(KeyEvent.VK_F3, 0), false); + aDeleteSelection = addAction("DeleteSelection", mEdit, KeyStroke.getKeyStroke(KeyEvent.VK_D, Event.CTRL_MASK), false); aIgnore = addAction("Ignore", mEdit, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), false); aRefresh = addAction("Refresh", mEdit, KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0), false); mEdit.addSeparator(); @@ -276,6 +277,7 @@ public final class APanel extends CPanel toolBar.add(aHelp.getButton()); // F1 toolBar.add(aNew.getButton()); toolBar.add(aDelete.getButton()); + toolBar.add(aDeleteSelection.getButton()); toolBar.add(aSave.getButton()); toolBar.addSeparator(); toolBar.add(aRefresh.getButton()); // F5 @@ -822,10 +824,12 @@ public final class APanel extends CPanel aSave.setEnabled(changed && !readOnly); // // No Rows - if (e.getTotalRows() == 0 && insertRecord) - { + if (e.getTotalRows() == 0 && insertRecord) { aNew.setEnabled(true); aDelete.setEnabled(false); + aDeleteSelection.setEnabled(false); + } else { + aDeleteSelection.setEnabled(true); } // Single-Multi @@ -1049,6 +1053,7 @@ public final class APanel extends CPanel { aSave.setEnabled(false); aDelete.setEnabled(false); + aDeleteSelection.setEnabled(false); } m_curTab.navigateCurrent(); // updates counter m_curGC.dynamicDisplay(0); @@ -1081,6 +1086,7 @@ public final class APanel extends CPanel aMulti.setEnabled(false); aNew.setEnabled(false); aDelete.setEnabled(false); + aDeleteSelection.setEnabled(false); aFind.setEnabled(false); aRefresh.setEnabled(false); aAttachment.setEnabled(false); @@ -1176,6 +1182,8 @@ public final class APanel extends CPanel cmd_new(true); else if (cmd.equals(aDelete.getName())) cmd_delete(); + else if (cmd.equals(aDeleteSelection.getName())) + cmd_deleteSelection(); else if (cmd.equals(aIgnore.getName())) cmd_ignore(); else if (cmd.equals(aRefresh.getName())) @@ -1288,6 +1296,70 @@ public final class APanel extends CPanel m_curGC.rowChanged(false, keyID); m_curGC.dynamicDisplay(0); } // cmd_delete + + /** + * Show a list to select one or more items to delete. + */ + private void cmd_deleteSelection(){ + if (m_curTab.isReadOnly()) + return; + //show table with deletion rows -> value, name... + JPanel messagePanel = new JPanel(); + JList list = new JList(); + JScrollPane scrollPane = new JScrollPane(list); + Vector data = new Vector(); + int noOfRows = m_curTab.getRowCount(); + for(int i=0; i