* Merge revisions 6401 from branches/adempiere341

This commit is contained in:
Heng Sin Low 2008-09-10 16:04:56 +00:00
parent a67d22109e
commit 8a010f9b52
17 changed files with 136 additions and 20 deletions

View File

@ -30,6 +30,7 @@ import org.adempiere.webui.apps.ProcessDialog;
import org.adempiere.webui.apps.graph.WPAPanel;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.DesktopTabpanel;
import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window;
@ -74,6 +75,8 @@ import org.zkoss.zul.Hbox;
import org.zkoss.zul.Iframe;
import org.zkoss.zul.Image;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Tabpanels;
import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Treerow;
import org.zkoss.zul.Vbox;
@ -1003,6 +1006,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
public void unregisterWindow(int WindowNo) {
if (WindowNo < windows.size())
windows.set(WindowNo, null);
Env.clearWinContext(WindowNo);
}
/**
@ -1019,10 +1023,61 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl
/**
* Close active tab
* @return boolean
*/
public void removeWindow()
public boolean closeActiveWindow()
{
windowContainer.removeWindow();
if ( windowContainer.closeActiveWindow() )
{
return true;
}
else
{
return false;
}
}
/**
* @return Component
*/
public Component getActiveWindow()
{
return windowContainer.getSelectedTab().getLinkedPanel().getFirstChild();
}
/**
*
* @param windowNo
* @return boolean
*/
public boolean closeWindow(int windowNo)
{
Tabbox tabbox = windowContainer.getComponent();
Tabpanels panels = tabbox.getTabpanels();
List childrens = panels.getChildren();
for (Object child : childrens)
{
Tabpanel panel = (Tabpanel) child;
Component component = panel.getFirstChild();
Object att = component.getAttribute("desktop.windowno");
if (att != null && (att instanceof Integer))
{
if (windowNo == (Integer)att)
{
Tab tab = panel.getLinkedTab();
panel.getLinkedTab().onClose();
if (tab.getParent() == null)
{
return true;
}
else
{
return false;
}
}
}
}
return false;
}
/**

View File

@ -30,8 +30,16 @@ public interface IDesktop {
/**
* close active window
* @return boolean
*/
public void removeWindow();
public boolean closeActiveWindow();
/**
*
* @param windowNo
* @return boolean
*/
public boolean closeWindow(int windowNo);
/**
*

View File

@ -524,11 +524,11 @@ public class WArchiveViewer extends ADForm implements EventListener, ValueChange
if (e.getTarget() == updateArchive)
cmd_updateArchive();
else if (e.getTarget().getId().equals(ConfirmPanel.A_CANCEL))
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
else if (e.getTarget().getId().equals(ConfirmPanel.A_OK))
{
if (tabbox.getSelectedIndex() == 1)
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
else
cmd_query();
}

View File

@ -648,10 +648,10 @@ public class WBOMDrop extends ADForm implements EventListener
else if (confirmPanel.getButton("Ok").equals(e.getTarget()))
{
if (cmd_save())
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
}
else if (confirmPanel.getButton("Cancel").equals(e.getTarget()))
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
// Enable OK
boolean OK = m_product != null;

View File

@ -897,7 +897,7 @@ public class WCharge extends ADForm implements EventListener
public void close()
{
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
}
}

View File

@ -309,7 +309,7 @@ public class WFileImport extends ADForm implements EventListener
}
else if (e.getTarget() == confirmPanel.getButton("Cancel"))
{
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
return;
}
@ -562,6 +562,6 @@ public class WFileImport extends ADForm implements EventListener
FDialog.info(m_WindowNo, this, "FileImportR/I", row + " / " + imported + "#");
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
} // cmd_process
}

View File

@ -749,7 +749,7 @@ public class WInOutGen extends ADForm implements EventListener, ValueChangeListe
@Override
public void dispose() {
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
}
} // VInOutGen

View File

@ -742,7 +742,7 @@ public class WInvoiceGen extends ADForm
@Override
public void dispose() {
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
}

View File

@ -366,7 +366,7 @@ public class WMatch extends ADForm
*/
public void dispose()
{
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
} // dispose

View File

@ -211,7 +211,7 @@ public class WMerge extends ADForm
*/
public void dispose()
{
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
} // dispose
/**

View File

@ -225,7 +225,7 @@ public class WPayPrint extends ADForm
*/
public void dispose()
{
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
} // dispose
/**

View File

@ -458,7 +458,7 @@ public class WPaySelect extends ADForm
*/
public void dispose()
{
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
} // dispose

View File

@ -227,7 +227,7 @@ public class WTrxMaterial extends ADForm
*/
public void dispose()
{
SessionManager.getAppDesktop().removeWindow();
SessionManager.getAppDesktop().closeActiveWindow();
} // dispose

View File

@ -26,6 +26,7 @@ import org.adempiere.webui.component.IADTab;
import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.session.SessionManager;
import org.compiere.util.CLogger;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.HtmlBasedComponent;
@ -119,6 +120,7 @@ public class ADWindowPanel extends AbstractADWindowPanel
Window w = (Window) adTab.getComponent();
w.addEventListener(Events.ON_CTRL_KEY, toolbar);
}
return layout;
}
@ -128,7 +130,7 @@ public class ADWindowPanel extends AbstractADWindowPanel
return composite;
}
public Component getComponent() {
public Borderlayout getComponent() {
return layout;
}
@ -151,6 +153,8 @@ public class ADWindowPanel extends AbstractADWindowPanel
}
tabPanel.detach();
tab.detach();
if (getWindowNo() > 0)
SessionManager.getAppDesktop().unregisterWindow(getWindowNo());
}
}
}

View File

@ -1321,17 +1321,30 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
}
}
/**
*
* @return IADTab
*/
public IADTab getADTab() {
return adTab;
}
/**
* @param pi
*/
public void executeASync(ProcessInfo pi) {
}
/**
* @return boolean
*/
public boolean isUILocked() {
return m_uiLocked;
}
/**
* @param pi
*/
public void lockUI(ProcessInfo pi) {
if (m_uiLocked) return;
@ -1358,6 +1371,9 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
}
}
/**
* @param pi
*/
public void unlockUI(ProcessInfo pi) {
if (!m_uiLocked) return;
@ -1419,7 +1435,26 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
pi.getTitle() + "<br>" + logInfo);
}
/**
*
* @return toolbar instance
*/
public CWindowToolbar getToolbar() {
return toolbar;
}
/**
* @return active grid tab
*/
public GridTab getActiveGridTab() {
return curTab;
}
/**
* @return windowNo
*/
public int getWindowNo() {
return curWindowNo;
}
}

View File

@ -121,9 +121,14 @@ public class WindowContainer extends AbstractUIPart implements EventListener
tabbox.setSelectedTab(tab);
}
public void removeWindow()
public boolean closeActiveWindow()
{
Tab tab = (Tab) tabbox.getSelectedTab();
tabbox.getSelectedTab().onClose();
if (tab.getParent() == null)
return true;
else
return false;
}
public Tab getSelectedTab() {
@ -152,7 +157,7 @@ public class WindowContainer extends AbstractUIPart implements EventListener
}
}
public Component getComponent() {
public Tabbox getComponent() {
return tabbox;
}
}

View File

@ -75,6 +75,8 @@ public class ADWindow extends AbstractUIPart
protected Component doCreatePart(Component parent)
{
windowPanelComponent = windowPanel.createPart(parent);
windowPanelComponent.setAttribute("ADWindow", this);
windowPanelComponent.setAttribute("desktop.windowno", windowNo);
windowPanel.initPanel(adWindowId, query);
_title = windowPanel.getTitle();
@ -84,4 +86,11 @@ public class ADWindow extends AbstractUIPart
public Component getComponent() {
return windowPanelComponent;
}
/**
* @return ADWindowPanel
*/
public ADWindowPanel getADWindowPanel() {
return windowPanel;
}
}