Implement saveAndCreate toolbar button.
This commit is contained in:
parent
ac90b69d9e
commit
6170d4bf3a
|
@ -25,6 +25,7 @@ import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.webui.AdempiereIdGenerator;
|
||||||
import org.adempiere.webui.LayoutUtils;
|
import org.adempiere.webui.LayoutUtils;
|
||||||
import org.adempiere.webui.event.ToolbarListener;
|
import org.adempiere.webui.event.ToolbarListener;
|
||||||
import org.adempiere.webui.session.SessionManager;
|
import org.adempiere.webui.session.SessionManager;
|
||||||
|
@ -65,6 +66,8 @@ public class CWindowToolbar extends FToolbar implements EventListener
|
||||||
|
|
||||||
private ToolBarButton btnHelp, btnNew, btnCopy, btnDelete, btnDeleteSelection, btnSave;
|
private ToolBarButton btnHelp, btnNew, btnCopy, btnDelete, btnDeleteSelection, btnSave;
|
||||||
|
|
||||||
|
private ToolBarButton btnSaveAndCreate; // Elaine 2009/03/02 - Save & Create
|
||||||
|
|
||||||
private ToolBarButton btnRefresh, btnFind, btnLock, btnAttachment;
|
private ToolBarButton btnRefresh, btnFind, btnLock, btnAttachment;
|
||||||
|
|
||||||
private ToolBarButton btnGridToggle;
|
private ToolBarButton btnGridToggle;
|
||||||
|
@ -129,16 +132,24 @@ public class CWindowToolbar extends FToolbar implements EventListener
|
||||||
addSeparator();
|
addSeparator();
|
||||||
btnHelp = createButton("Help", "Help","Help");
|
btnHelp = createButton("Help", "Help","Help");
|
||||||
btnNew = createButton("New", "New", "New");
|
btnNew = createButton("New", "New", "New");
|
||||||
|
|
||||||
|
btnNew.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "btnNew");
|
||||||
|
|
||||||
btnCopy = createButton("Copy", "Copy", "Copy");
|
btnCopy = createButton("Copy", "Copy", "Copy");
|
||||||
btnDelete = createButton("Delete", "Delete", "Delete");
|
btnDelete = createButton("Delete", "Delete", "Delete");
|
||||||
btnDeleteSelection = createButton("DeleteSelection", "DeleteSelection", "DeleteSelection");
|
btnDeleteSelection = createButton("DeleteSelection", "DeleteSelection", "DeleteSelection");
|
||||||
btnSave = createButton("Save", "Save", "Save");
|
btnSave = createButton("Save", "Save", "Save");
|
||||||
|
btnSave.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "btnSave");
|
||||||
|
|
||||||
|
btnSaveAndCreate = createButton("SaveCreate", "SaveCreate", "SaveCreate");
|
||||||
addSeparator();
|
addSeparator();
|
||||||
btnRefresh = createButton("Refresh", "Refresh", "Refresh");
|
btnRefresh = createButton("Refresh", "Refresh", "Refresh");
|
||||||
btnFind = createButton("Find", "Find", "Find");
|
btnFind = createButton("Find", "Find", "Find");
|
||||||
btnAttachment = createButton("Attachment", "Attachment", "Attachment");
|
btnAttachment = createButton("Attachment", "Attachment", "Attachment");
|
||||||
btnChat = createButton("Chat", "Chat", "Chat");
|
btnChat = createButton("Chat", "Chat", "Chat");
|
||||||
btnGridToggle = createButton("Toggle", "Multi", "Multi");
|
btnGridToggle = createButton("Toggle", "Multi", "Multi");
|
||||||
|
btnGridToggle.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "btnGridToggle");
|
||||||
|
|
||||||
btnHistoryRecords = createButton("HistoryRecords", "HistoryX", "History");
|
btnHistoryRecords = createButton("HistoryRecords", "HistoryX", "History");
|
||||||
addSeparator();
|
addSeparator();
|
||||||
btnParentRecord = createButton("ParentRecord", "Parent", "Parent");
|
btnParentRecord = createButton("ParentRecord", "Parent", "Parent");
|
||||||
|
@ -282,6 +293,7 @@ public class CWindowToolbar extends FToolbar implements EventListener
|
||||||
ctrlKeyMap.put(VK_P, btnPrint);
|
ctrlKeyMap.put(VK_P, btnPrint);
|
||||||
ctrlKeyMap.put(VK_N, btnNew);
|
ctrlKeyMap.put(VK_N, btnNew);
|
||||||
ctrlKeyMap.put(VK_S, btnSave);
|
ctrlKeyMap.put(VK_S, btnSave);
|
||||||
|
ctrlKeyMap.put(VK_A, btnSaveAndCreate);
|
||||||
ctrlKeyMap.put(VK_D, btnDelete);
|
ctrlKeyMap.put(VK_D, btnDelete);
|
||||||
ctrlKeyMap.put(VK_F, btnFind);
|
ctrlKeyMap.put(VK_F, btnFind);
|
||||||
}
|
}
|
||||||
|
@ -437,6 +449,18 @@ public class CWindowToolbar extends FToolbar implements EventListener
|
||||||
return !btnSave.isDisabled();
|
return !btnSave.isDisabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Elaine 2009/03/02 - Save & Create
|
||||||
|
public void enableSaveAndCreate(boolean enabled)
|
||||||
|
{
|
||||||
|
this.btnSaveAndCreate.setDisabled(!enabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSaveAndCreateEnable()
|
||||||
|
{
|
||||||
|
return !btnSaveAndCreate.isDisabled();
|
||||||
|
}
|
||||||
|
//
|
||||||
|
|
||||||
// public void enableExit(boolean enabled)
|
// public void enableExit(boolean enabled)
|
||||||
// {
|
// {
|
||||||
// this.btnExit.setDisabled(!enabled);
|
// this.btnExit.setDisabled(!enabled);
|
||||||
|
|
|
@ -95,6 +95,11 @@ public interface ToolbarListener
|
||||||
*/
|
*/
|
||||||
public void onDelete();
|
public void onDelete();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete selected record(s)
|
||||||
|
*/
|
||||||
|
public void onDeleteSelection();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save current record
|
* Save current record
|
||||||
*/
|
*/
|
||||||
|
@ -140,6 +145,26 @@ public interface ToolbarListener
|
||||||
*/
|
*/
|
||||||
public void onProductInfo();
|
public void onProductInfo();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* open chat window
|
||||||
|
*/
|
||||||
|
public void onChat();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Personal lock
|
||||||
|
*/
|
||||||
|
public void onLock();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Save and create
|
||||||
|
*/
|
||||||
|
public void onSaveCreate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy current record as a new record
|
||||||
|
*/
|
||||||
|
public void onCopy();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Export grid data
|
* Export grid data
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1213,8 +1213,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
{
|
{
|
||||||
insertRecord = curTab.isInsertRecord();
|
insertRecord = curTab.isInsertRecord();
|
||||||
}
|
}
|
||||||
// toolbar.enabledNew(!changed && insertRecord && !curTab.isSortTab());
|
toolbar.enabledNew(!changed && insertRecord && !curTab.isSortTab());
|
||||||
toolbar.enabledNew(insertRecord && !curTab.isSortTab());
|
|
||||||
toolbar.enableCopy(!changed && insertRecord && !curTab.isSortTab());
|
toolbar.enableCopy(!changed && insertRecord && !curTab.isSortTab());
|
||||||
toolbar.enableRefresh(!changed);
|
toolbar.enableRefresh(!changed);
|
||||||
toolbar.enableDelete(!changed && !readOnly && !curTab.isSortTab());
|
toolbar.enableDelete(!changed && !readOnly && !curTab.isSortTab());
|
||||||
|
@ -1226,7 +1225,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
}
|
}
|
||||||
toolbar.enableIgnore(changed && !readOnly);
|
toolbar.enableIgnore(changed && !readOnly);
|
||||||
toolbar.enableSave(changed && !readOnly);
|
toolbar.enableSave(changed && !readOnly);
|
||||||
|
toolbar.enableSaveAndCreate(changed && !readOnly);
|
||||||
//
|
//
|
||||||
// No Rows
|
// No Rows
|
||||||
if (e.getTotalRows() == 0 && insertRecord)
|
if (e.getTotalRows() == 0 && insertRecord)
|
||||||
|
@ -1541,6 +1540,19 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
|
||||||
//other error will be catch in the dataStatusChanged event
|
//other error will be catch in the dataStatusChanged event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see ToolbarListener#onSaveCreate()
|
||||||
|
*/
|
||||||
|
public void onSaveCreate()
|
||||||
|
{
|
||||||
|
boolean retValue = onSave(true);
|
||||||
|
if(retValue)
|
||||||
|
{
|
||||||
|
curTab.dataRefreshAll(true);
|
||||||
|
onNew();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see ToolbarListener#onDelete()
|
* @see ToolbarListener#onDelete()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<!-- change to false to use compress js which is much smaller -->
|
<!-- change to false to use compress js which is much smaller -->
|
||||||
<client-config>
|
<client-config>
|
||||||
<debug-js>false</debug-js>
|
<debug-js>false</debug-js>
|
||||||
|
<processing-prompt-delay>100</processing-prompt-delay>
|
||||||
</client-config>
|
</client-config>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 634 B |
Binary file not shown.
After Width: | Height: | Size: 785 B |
Loading…
Reference in New Issue