use of org.compiere.model.GridTab in project adempiere by adempiere.
the class AbstractADWindowPanel method initEmbeddedTab.
private void initEmbeddedTab(MQuery query, int tabIndex) {
GridTab gTab = gridWindow.getTab(tabIndex);
gTab.addDataStatusListener(this);
adTab.addTab(gTab, embeddedTabPanel);
if (gTab.isSortTab()) {
((ADSortTab) embeddedTabPanel).registerAPanel(this);
} else {
((ADTabPanel) embeddedTabPanel).init(this, curWindowNo, gTab, gridWindow);
}
}
use of org.compiere.model.GridTab in project adempiere by adempiere.
the class AbstractADWindowPanel method initTab.
/**
* @param query
* @param tabIndex
*/
protected void initTab(MQuery query, int tabIndex) {
gridWindow.initTab(tabIndex);
GridTab gTab = gridWindow.getTab(tabIndex);
Env.setContext(ctx, curWindowNo, tabIndex, GridTab.CTX_TabLevel, Integer.toString(gTab.getTabLevel()));
// Query first tab
if (tabIndex == 0) {
query = initialQuery(query, gTab);
if (gTab.isHighVolume() && m_findCancelled)
return;
if (query != null && query.getRecordCount() <= 1) {
// goSingleRow = true;
}
// Set initial Query on first tab
if (query != null) {
m_onlyCurrentRows = false;
gTab.setQuery(query);
}
curTab = gTab;
curTabIndex = tabIndex;
}
if (gTab.isSortTab()) {
ADSortTab sortTab = new ADSortTab(curWindowNo, gTab);
toolbar.setCurrentPanel(sortTab);
sortTab.setGlobalToolbar(toolbar);
if (includedMap.containsKey(gTab.getAD_Tab_ID())) {
IADTabPanel includePanel = includedMap.get(gTab.getAD_Tab_ID());
if (includePanel.isEmbedded())
includedMap.get(gTab.getAD_Tab_ID()).embed(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, sortTab);
else
includedMap.get(gTab.getAD_Tab_ID()).HorizontalEmbedded(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, sortTab);
} else {
adTab.addTab(gTab, sortTab);
sortTab.registerAPanel(this);
if (tabIndex == 0) {
curTabPanel = sortTab;
curTabPanel.createUI();
curTabPanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords());
curTabPanel.activate(true);
}
gTab.addDataStatusListener(this);
}
} else {
//build embedded tab map
ADTabPanel fTabPanel = new ADTabPanel();
toolbar.setCurrentPanel(fTabPanel);
fTabPanel.setGlobalToolbar(toolbar);
GridField[] fields = gTab.getTableModel().getFields();
for (int i = 0; i < fields.length; i++) {
if (fields[i].getIncluded_Tab_ID() > 0) {
if (fields[i].isEmbedded())
fTabPanel.setIsEmbedded(fields[i].isEmbedded());
includedMap.put(fields[i].getIncluded_Tab_ID(), fTabPanel);
}
}
if (includedMap.containsKey(gTab.getAD_Tab_ID())) {
IADTabPanel includePanel = includedMap.get(gTab.getAD_Tab_ID());
if (includePanel.isEmbedded())
includedMap.get(gTab.getAD_Tab_ID()).embed(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, fTabPanel);
else
includedMap.get(gTab.getAD_Tab_ID()).HorizontalEmbedded(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, fTabPanel);
fTabPanel.setGlobalToolbar(toolbar);
} else {
gTab.addDataStatusListener(this);
fTabPanel.init(this, curWindowNo, gTab, gridWindow);
adTab.addTab(gTab, fTabPanel);
if (tabIndex == 0) {
fTabPanel.createUI();
curTabPanel = fTabPanel;
toolbar.setCurrentPanel(curTabPanel);
curTabPanel.setGlobalToolbar(toolbar);
curTabPanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords());
curTabPanel.activate(true);
}
}
}
if (tabIndex == 0) {
toolbar.setCurrentPanel(curTabPanel);
if (curTab.isHighVolume() && m_findCreateNew)
onNew();
else if (query == null && curTab.getRowCount() == 0 && Env.isAutoNew(ctx, curWindowNo))
onNew();
else if (!curTab.isReadOnly() && curTab.isQueryNewRecord())
onNew();
}
}
use of org.compiere.model.GridTab in project adempiere by adempiere.
the class AbstractADWindowPanel method onSave.
/**
* @param onSaveEvent
*/
private boolean onSave(boolean onSaveEvent) {
GridTab currentTab = toolbar.getCurrentPanel().getGridTab();
if (currentTab.isSortTab()) {
((ADSortTab) curTabPanel).saveData();
// set explicitly
toolbar.enableSave(true);
toolbar.enableIgnore(false);
return true;
} else {
if (onSaveEvent && currentTab.getCommitWarning() != null && currentTab.getCommitWarning().trim().length() > 0) {
if (!FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", currentTab.getCommitWarning())) {
return false;
}
}
boolean retValue = currentTab.dataSave(onSaveEvent);
if (!retValue) {
showLastError();
return false;
} else if (//need manual refresh
!onSaveEvent) {
currentTab.setCurrentRow(currentTab.getCurrentRow());
}
//curTabPanel.dynamicDisplay(0);
//curTabPanel.afterSave(onSaveEvent);
toolbar.getCurrentPanel().dynamicDisplay(0);
toolbar.getCurrentPanel().afterSave(onSaveEvent);
return true;
}
}
use of org.compiere.model.GridTab in project adempiere by adempiere.
the class AbstractADWindowPanel method onFindCallback.
public void onFindCallback(MQuery query) {
// Confirmed query
if (query != null) {
GridTab currentTab = toolbar.getCurrentPanel().getGridTab();
// search history too
m_onlyCurrentRows = false;
currentTab.setQuery(query);
// autoSize
curTabPanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords());
// Elaine 2008/07/25
currentTab.dataRefresh(false);
onRefresh();
focusToActivePanel();
}
}
use of org.compiere.model.GridTab in project adempiere by adempiere.
the class AbstractADWindowPanel method onCopy.
// Elaine 2008/11/19
/**
* @see ToolbarListener#onCopy()
*/
public void onCopy() {
GridTab currentTab = toolbar.getCurrentPanel().getGridTab();
if (!currentTab.isInsertRecord()) {
logger.warning("Insert Record disabled for Tab");
return;
}
newRecord = currentTab.dataNew(true);
if (newRecord) {
curTabPanel.dynamicDisplay(0);
toolbar.enableChanges(false);
toolbar.enableDelete(false);
// Elaine 2008/12/02
toolbar.enableDeleteSelection(false);
toolbar.enableNavigation(false);
toolbar.enableTabNavigation(false);
toolbar.enableIgnore(true);
toolbar.enablePrint(currentTab.isPrinted());
toolbar.enableReport(true);
} else {
logger.severe("Could not create new record");
}
focusToActivePanel();
}
Aggregations