Search in sources :

Example 6 with GridTab

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);
    }
}
Also used : GridTab(org.compiere.model.GridTab)

Example 7 with GridTab

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();
    }
}
Also used : GridTab(org.compiere.model.GridTab) GridField(org.compiere.model.GridField)

Example 8 with GridTab

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;
    }
}
Also used : GridTab(org.compiere.model.GridTab)

Example 9 with GridTab

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();
    }
}
Also used : GridTab(org.compiere.model.GridTab)

Example 10 with GridTab

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();
}
Also used : GridTab(org.compiere.model.GridTab)

Aggregations

GridTab (org.compiere.model.GridTab)38 GridField (org.compiere.model.GridField)10 MQuery (org.compiere.model.MQuery)8 AdempiereException (org.adempiere.exceptions.AdempiereException)4 Point (java.awt.Point)3 MRole (org.compiere.model.MRole)3 PO (org.compiere.model.PO)3 Dimension (java.awt.Dimension)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 MBrowse (org.adempiere.model.MBrowse)2 ProcessModalDialog (org.adempiere.webui.apps.ProcessModalDialog)2 org.apache.ecs.xhtml.a (org.apache.ecs.xhtml.a)2 org.apache.ecs.xhtml.div (org.apache.ecs.xhtml.div)2 org.apache.ecs.xhtml.form (org.apache.ecs.xhtml.form)2 GridController (org.compiere.grid.GridController)2 ICreateFrom (org.compiere.grid.ICreateFrom)2 GridTable (org.compiere.model.GridTable)2 MOrderLine (org.compiere.model.MOrderLine)2