IDEMPIERE-1394 Copy toolbar button wrongly enabled / Thanks to Naim Berisha (nberisha) for the patch

This commit is contained in:
Carlos Ruiz 2013-09-26 16:44:25 -05:00
parent 93c9beea4b
commit 761a07b08a
2 changed files with 9 additions and 1 deletions

View File

@ -71,7 +71,7 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
/** /**
* *
*/ */
private static final long serialVersionUID = -367141745573893540L; private static final long serialVersionUID = -5540268492066600133L;
public static final String BTNPREFIX = "Btn"; public static final String BTNPREFIX = "Btn";
@ -433,6 +433,10 @@ public class ADWindowToolbar extends FToolbar implements EventListener<Event>
public void enableNew(boolean enabled) public void enableNew(boolean enabled)
{ {
this.btnNew.setDisabled(!enabled); this.btnNew.setDisabled(!enabled);
}
public void enableCopy(boolean enabled)
{
this.btnCopy.setDisabled(!enabled); this.btnCopy.setDisabled(!enabled);
} }

View File

@ -1401,6 +1401,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
insertRecord = tabPanel.getGridTab().isInsertRecord(); insertRecord = tabPanel.getGridTab().isInsertRecord();
} }
toolbar.enableNew(!changed && insertRecord && !tabPanel.getGridTab().isSortTab()); toolbar.enableNew(!changed && insertRecord && !tabPanel.getGridTab().isSortTab());
toolbar.enableCopy(!changed && insertRecord && !tabPanel.getGridTab().isSortTab() && adTabbox.getSelectedGridTab().getRowCount()>0);
toolbar.enableRefresh(!changed); toolbar.enableRefresh(!changed);
toolbar.enableDelete(!changed && !readOnly && !tabPanel.getGridTab().isSortTab() && !processed); toolbar.enableDelete(!changed && !readOnly && !tabPanel.getGridTab().isSortTab() && !processed);
// //
@ -1446,6 +1447,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (e.getTotalRows() == 0 && insertRecord && !detailTab && !tabPanel.getGridTab().isSortTab()) if (e.getTotalRows() == 0 && insertRecord && !detailTab && !tabPanel.getGridTab().isSortTab())
{ {
toolbar.enableNew(true); toolbar.enableNew(true);
toolbar.enableCopy(false);
toolbar.enableDelete(false); toolbar.enableDelete(false);
} }
@ -1622,6 +1624,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
adTabbox.getSelectedTabpanel().dynamicDisplay(0); adTabbox.getSelectedTabpanel().dynamicDisplay(0);
toolbar.enableNew(false); toolbar.enableNew(false);
toolbar.enableCopy(false);
toolbar.enableDelete(false); toolbar.enableDelete(false);
breadCrumb.enableFirstNavigation(adTabbox.getSelectedGridTab().getCurrentRow() > 0); breadCrumb.enableFirstNavigation(adTabbox.getSelectedGridTab().getCurrentRow() > 0);
breadCrumb.enableLastNavigation(adTabbox.getSelectedGridTab().getCurrentRow() + 1 < adTabbox.getSelectedGridTab().getRowCount()); breadCrumb.enableLastNavigation(adTabbox.getSelectedGridTab().getCurrentRow() + 1 < adTabbox.getSelectedGridTab().getRowCount());
@ -1669,6 +1672,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
{ {
adTabbox.getSelectedTabpanel().dynamicDisplay(0); adTabbox.getSelectedTabpanel().dynamicDisplay(0);
toolbar.enableNew(false); toolbar.enableNew(false);
toolbar.enableCopy(false);
toolbar.enableDelete(false); toolbar.enableDelete(false);
breadCrumb.enableFirstNavigation(adTabbox.getSelectedGridTab().getCurrentRow() > 0); breadCrumb.enableFirstNavigation(adTabbox.getSelectedGridTab().getCurrentRow() > 0);
breadCrumb.enableLastNavigation(adTabbox.getSelectedGridTab().getCurrentRow() + 1 < adTabbox.getSelectedGridTab().getRowCount()); breadCrumb.enableLastNavigation(adTabbox.getSelectedGridTab().getCurrentRow() + 1 < adTabbox.getSelectedGridTab().getRowCount());