Search in sources :

Example 26 with GridTab

use of org.compiere.model.GridTab in project adempiere by adempiere.

the class AbstractADWindowPanel method onZoomAcross.

/**
     * @see ToolbarListener#onZoomAcross()
     */
public void onZoomAcross() {
    if (toolbar.getEvent() != null) {
        GridTab currentTab = toolbar.getCurrentPanel().getGridTab();
        int record_ID = currentTab.getRecord_ID();
        if (record_ID <= 0)
            return;
        //	Query
        MQuery query = new MQuery();
        //	Current row
        String link = currentTab.getKeyColumnName();
        //	Link for detail records
        if (link.length() == 0)
            link = currentTab.getLinkColumnName();
        if (link.length() != 0) {
            if (link.endsWith("_ID"))
                query.addRestriction(link, MQuery.EQUAL, new Integer(Env.getContextAsInt(ctx, curWindowNo, link)));
            else
                query.addRestriction(link, MQuery.EQUAL, Env.getContext(ctx, curWindowNo, link));
        }
        new WZoomAcross(toolbar.getEvent().getTarget(), currentTab.getTableName(), currentTab.getAD_Window_ID(), query);
    }
}
Also used : GridTab(org.compiere.model.GridTab) MQuery(org.compiere.model.MQuery) WZoomAcross(org.adempiere.webui.WZoomAcross)

Example 27 with GridTab

use of org.compiere.model.GridTab in project adempiere by adempiere.

the class AbstractADWindowPanel method onPrevious.

/**
     * @see ToolbarListener#onPrevious()
     */
public void onPrevious() {
    GridTab currentTab = toolbar.getCurrentPanel().getGridTab();
    currentTab.navigateRelative(-1);
    focusToActivePanel();
}
Also used : GridTab(org.compiere.model.GridTab)

Example 28 with GridTab

use of org.compiere.model.GridTab in project adempiere by adempiere.

the class AbstractADWindowPanel method onRequests.

//
// Elaine 2008/07/22
/**
     * @see ToolbarListener#onRequests()
     */
public void onRequests() {
    if (toolbar.getEvent() != null) {
        GridTab currentTab = toolbar.getCurrentPanel().getGridTab();
        if (currentTab.getRecord_ID() <= 0)
            return;
        int C_BPartner_ID = 0;
        Object bpartner = currentTab.getValue("C_BPartner_ID");
        if (bpartner != null)
            C_BPartner_ID = Integer.valueOf(bpartner.toString());
        new WRequest(toolbar.getEvent().getTarget(), currentTab.getAD_Table_ID(), currentTab.getRecord_ID(), C_BPartner_ID);
    }
}
Also used : WRequest(org.adempiere.webui.WRequest) GridTab(org.compiere.model.GridTab)

Example 29 with GridTab

use of org.compiere.model.GridTab in project adempiere by adempiere.

the class AbstractADWindowPanel method onRefresh.

/**
     * refresh all row
     * @param fireEvent
     */
public void onRefresh(boolean fireEvent) {
    onSave(false);
    GridTab currentTab = toolbar.getCurrentPanel().getGridTab();
    currentTab.dataRefreshAll(fireEvent, true);
    curTabPanel.dynamicDisplay(0);
    focusToActivePanel();
}
Also used : GridTab(org.compiere.model.GridTab)

Example 30 with GridTab

use of org.compiere.model.GridTab in project adempiere by adempiere.

the class AbstractADWindowPanel method doZoomToDetail.

private boolean doZoomToDetail(GridTab gTab, MQuery query, int tabIndex) {
    GridField[] fields = gTab.getFields();
    for (GridField field : fields) {
        if (field.getColumnName().equalsIgnoreCase(query.getZoomColumnName())) {
            gridWindow.initTab(tabIndex);
            int parentId = DB.getSQLValue(null, "SELECT " + gTab.getLinkColumnName() + " FROM " + gTab.getTableName() + " WHERE " + query.getWhereClause());
            if (parentId > 0) {
                Map<Integer, Object[]> parentMap = new TreeMap<Integer, Object[]>();
                int index = tabIndex;
                int oldpid = parentId;
                GridTab currentTab = gTab;
                while (index > 0) {
                    index--;
                    GridTab pTab = gridWindow.getTab(index);
                    if (pTab.getTabLevel() < currentTab.getTabLevel()) {
                        gridWindow.initTab(index);
                        if (index > 0) {
                            if (pTab.getLinkColumnName() != null && pTab.getLinkColumnName().trim().length() > 0) {
                                int pid = DB.getSQLValue(null, "SELECT " + pTab.getLinkColumnName() + " FROM " + pTab.getTableName() + " WHERE " + currentTab.getLinkColumnName() + " = ?", oldpid);
                                if (pid > 0) {
                                    parentMap.put(index, new Object[] { currentTab.getLinkColumnName(), oldpid });
                                    oldpid = pid;
                                    currentTab = pTab;
                                } else {
                                    parentMap.clear();
                                    break;
                                }
                            }
                        } else {
                            parentMap.put(index, new Object[] { currentTab.getLinkColumnName(), oldpid });
                        }
                    }
                }
                for (Map.Entry<Integer, Object[]> entry : parentMap.entrySet()) {
                    GridTab pTab = gridWindow.getTab(entry.getKey());
                    Object[] value = entry.getValue();
                    MQuery pquery = new MQuery(pTab.getAD_Table_ID());
                    pquery.addRestriction((String) value[0], "=", value[1]);
                    pTab.setQuery(pquery);
                    IADTabPanel tp = adTab.findADTabpanel(pTab);
                    tp.createUI();
                    tp.query();
                }
                MQuery targetQuery = new MQuery(gTab.getAD_Table_ID());
                targetQuery.addRestriction(gTab.getLinkColumnName(), "=", parentId);
                gTab.setQuery(targetQuery);
                IADTabPanel gc = null;
                if (!includedMap.containsKey(gTab.getAD_Tab_ID())) {
                    gc = adTab.findADTabpanel(gTab);
                } else {
                    ADTabPanel parent = (ADTabPanel) includedMap.get(gTab.getAD_Tab_ID());
                    gc = parent.findEmbeddedPanel(gTab);
                }
                gc.createUI();
                gc.query(false, 0, 0);
                GridTable table = gTab.getTableModel();
                int count = table.getRowCount();
                for (int i = 0; i < count; i++) {
                    int id = table.getKeyID(i);
                    if (id == ((Integer) query.getZoomValue()).intValue()) {
                        if (!includedMap.containsKey(gTab.getAD_Tab_ID())) {
                            setActiveTab(gridWindow.getTabIndex(gTab));
                        } else {
                            IADTabPanel parent = includedMap.get(gTab.getAD_Tab_ID());
                            int pindex = gridWindow.getTabIndex(parent.getGridTab());
                            if (pindex >= 0)
                                setActiveTab(pindex);
                        }
                        gTab.setCurrentRow(i);
                        return true;
                    }
                }
            }
        }
    }
    return false;
}
Also used : GridTable(org.compiere.model.GridTable) MQuery(org.compiere.model.MQuery) GridField(org.compiere.model.GridField) TreeMap(java.util.TreeMap) GridTab(org.compiere.model.GridTab) Map(java.util.Map) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap)

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