FR [ 1794050 ] Usability: VCreateFrom OK button always enabled

http://sourceforge.net/tracker/?func=detail&atid=879335&aid=1794050&group_id=176962
This commit is contained in:
teo_sarca 2007-09-13 20:43:39 +00:00
parent 0c07ba601a
commit 23fdd39f08
4 changed files with 23 additions and 4 deletions

View File

@ -37,6 +37,9 @@ import org.compiere.util.*;
*
* @author Jorg Janke
* @version $Id: VCreateFrom.java,v 1.4 2006/10/11 09:52:23 comdivision Exp $
*
* @author Teo Sarca, SC ARHIPAC SERVICE SRL
* <li>FR [ 1794050 ] Usability: VCreateFrom OK button always enabled
*/
public abstract class VCreateFrom extends CDialog
implements ActionListener, TableModelListener
@ -134,7 +137,7 @@ public abstract class VCreateFrom extends CDialog
private CPanel southPanel = new CPanel();
private BorderLayout southLayout = new BorderLayout();
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
protected StatusBar statusBar = new StatusBar();
private StatusBar statusBar = new StatusBar();
protected MiniTable dataTable = new MiniTable();
protected JLabel locatorLabel = new JLabel();
protected VLocator locatorField = new VLocator();
@ -515,4 +518,20 @@ public abstract class VCreateFrom extends CDialog
dataTable.autoSize();
} // loadOrder
/**
* Set form status line.
* Please note, will enable/disable the OK button if the selectedRowCount > 0.
* @param selectedRowCount number of selected lines
* @param text additional text
*/
protected void setStatusLine(int selectedRowCount, String text) {
StringBuffer sb = new StringBuffer(String.valueOf(selectedRowCount));
if (text != null && text.trim().length() > 0) {
sb.append(" - ").append(text);
}
statusBar.setStatusLine(sb.toString());
//
confirmPanel.getOKButton().setEnabled(selectedRowCount > 0);
}
} // VCreateFrom

View File

@ -266,7 +266,7 @@ public class VCreateFromInvoice extends VCreateFrom implements VetoableChangeLis
if (((Boolean)model.getValueAt(i, 0)).booleanValue())
count++;
}
statusBar.setStatusLine(String.valueOf(count));
setStatusLine(count, null);
} // infoInvoice
/**

View File

@ -479,7 +479,7 @@ public class VCreateFromShipment extends VCreateFrom implements VetoableChangeLi
if (((Boolean) model.getValueAt(i, 0)).booleanValue())
count++;
}
statusBar.setStatusLine(String.valueOf(count));
setStatusLine(count, null);
} // info
/**

View File

@ -211,7 +211,7 @@ public class VCreateFromStatement extends VCreateFrom implements VetoableChangeL
count++;
}
}
statusBar.setStatusLine(String.valueOf(count) + " - " + Msg.getMsg(Env.getCtx(), "Sum") + " " + format.format(total));
setStatusLine(count, Msg.getMsg(Env.getCtx(), "Sum") + " " + format.format(total));
} // infoStatement
/**