* Upgrade to ZK 3.0.6

* New login dialog.
* New desktop layout ( tested only on FF3 and IE 7 ).
* Support for Attachment.
* Support for Field Group.
* Modification to form layout to align closer to swing client.
* Support for hierarchical tab.
* Added role info dialog.
* Added about dialog, Posterita highlighted as the initial contributor.
* Support for grid toggle for each tab. No editable grid support for now but you can double click on grid row to switch to single row edit mode.
This commit is contained in:
Heng Sin Low 2008-07-09 13:07:13 +00:00
parent b9d6775bf6
commit 04cc7208f9
70 changed files with 6215 additions and 2837 deletions

View File

@ -4,14 +4,21 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="src" path="/base"/>
<classpathentry kind="src" path="/looks"/>
<classpathentry kind="lib" path="WEB-INF/lib/zk.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/zcommon.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/j2ee.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/zul.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/yuiextz.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/zk.jar" sourcepath="WEB-INF/lib/zk-sources.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/zcommon.jar" sourcepath="WEB-INF/lib/zcommon-sources.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/zul.jar" sourcepath="WEB-INF/lib/zul-sources.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/junit.jar"/>
<classpathentry kind="src" path="/client"/>
<classpathentry kind="src" path="/JasperReports"/>
<classpathentry kind="src" path="/JasperReportsTools"/>
<classpathentry kind="output" path="bin"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/C-_applications_apache-tomcat-5.5.26"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="lib" path="/tools/lib/xercesImpl.jar"/>
<classpathentry kind="lib" path="lib/j2ee.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/zkmax.jar" sourcepath="WEB-INF/lib/zkmax-sources.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/zkex.jar" sourcepath="WEB-INF/lib/zkex-sources.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/zkplus.jar" sourcepath="WEB-INF/lib/zkplus-sources.jar"/>
<classpathentry kind="lib" path="WEB-INF/lib/zhtml.jar"/>
<classpathentry kind="output" path="WEB-INF/classes"/>
</classpath>

View File

@ -13,5 +13,6 @@
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.sysdeo.eclipse.tomcat.tomcatnature</nature>
</natures>
</projectDescription>

View File

@ -26,11 +26,16 @@ import org.compiere.model.MSession;
import org.compiere.util.Env;
import org.compiere.util.Language;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.Session;
import org.zkoss.zk.ui.event.ClientInfoEvent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.impl.ExecutionCarryOver;
import org.zkoss.zk.ui.sys.ExecutionCtrl;
import org.zkoss.zk.ui.sys.ExecutionsCtrl;
import org.zkoss.zk.ui.sys.Visualizer;
import org.zkoss.zul.Window;
/**
@ -39,7 +44,7 @@ import org.zkoss.zul.Window;
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class AdempiereWebUI extends Window implements EventListener
public class AdempiereWebUI extends Window implements EventListener, IWebClient
{
private static final long serialVersionUID = 1L;
@ -58,7 +63,9 @@ public class AdempiereWebUI extends Window implements EventListener
public AdempiereWebUI()
{
this.addEventListener(Events.ON_CLIENT_INFO, this);
this.setVisible(false);
}
public void onCreate()
{
this.getPage().setTitle(APP_NAME);
@ -69,12 +76,12 @@ public class AdempiereWebUI extends Window implements EventListener
if (!SessionManager.isUserLoggedIn(ctx))
{
loginDesktop = new WLogin(this);
this.appendChild(loginDesktop);
loginDesktop.createPart(this.getPage());
}
else
{
loginCompleted();
}
}
}
public void onOk()
@ -85,40 +92,77 @@ public class AdempiereWebUI extends Window implements EventListener
{
}
/* (non-Javadoc)
* @see org.adempiere.webui.IWebClient#loginCompleted()
*/
public void loginCompleted()
{
loginDesktop = null;
this.getChildren().clear();
if (loginDesktop != null)
{
loginDesktop.detach();
loginDesktop = null;
}
Properties ctx = Env.getCtx();
String langLogin = Env.getContext(ctx, Env.LANGUAGE);
if (langLogin == null || langLogin.length() <= 0) {
langLogin = langSession;
Env.setContext(ctx, Env.LANGUAGE, langSession);
}
// Validate language
Language language = Language.getLanguage(langLogin);
Env.verifyLanguage(ctx, language);
Env.setContext(ctx, Env.LANGUAGE, language.getAD_Language()); //Bug
appDesktop = new Desktop();
appDesktop.setParent(this);
appDesktop.setClientInfo(clientInfo);
this.setWidth("100%");
this.setHeight("100%");
this.appendChild(appDesktop);
Env.setContext(ctx, Env.LANGUAGE, language.getAD_Language()); //Bug
// Create adempiere Session - user id in ctx
Session currSess = Executions.getCurrent().getDesktop().getSession();
HttpSession httpSess = (HttpSession) currSess.getNativeSession();
MSession.get (ctx, currSess.getClientAddr(),
currSess.getClientHost(), httpSess.getId() );
MSession.get (ctx, currSess.getRemoteAddr(),
currSess.getRemoteHost(), httpSess.getId() );
IDesktop d = (IDesktop) currSess.getAttribute("application.desktop");
if (d != null && d instanceof Desktop)
{
ExecutionCarryOver eco = (ExecutionCarryOver) currSess.getAttribute("execution.carryover");
if (eco != null) {
appDesktop = (Desktop) d;
ExecutionCarryOver current = new ExecutionCarryOver(this.getPage().getDesktop());
ExecutionCtrl ctrl = ExecutionsCtrl.getCurrentCtrl();
Visualizer vi = ctrl.getVisualizer();
eco.carryOver();
ctrl = ExecutionsCtrl.getCurrentCtrl();
ctrl.setVisualizer(vi);
appDesktop.getComponent().detach();
eco.cleanup();
current.carryOver();
appDesktop.getComponent().setPage(this.getPage());
currSess.setAttribute("execution.carryover", current);
}
}
if (appDesktop == null)
{
appDesktop = new Desktop();
appDesktop.setClientInfo(clientInfo);
appDesktop.createPart(this.getPage());
currSess.setAttribute("application.desktop", appDesktop);
ExecutionCarryOver eco = new ExecutionCarryOver(this.getPage().getDesktop());
currSess.setAttribute("execution.carryover", eco);
}
}
/* (non-Javadoc)
* @see org.adempiere.webui.IWebClient#logout()
*/
public void logout()
{
MSession mSession = MSession.get(Env.getCtx(), false);
@ -128,17 +172,20 @@ public class AdempiereWebUI extends Window implements EventListener
SessionManager.clearSession();
super.getChildren().clear();
loginDesktop = new WLogin(this);
super.appendChild(loginDesktop);
Page page = this.getPage();
page.removeComponents();
Executions.sendRedirect("index.zul");
}
public Desktop getAppDeskop()
{
return appDesktop;
}
public boolean isAsap() {
return true;
}
public void onEvent(Event event) {
if (event instanceof ClientInfoEvent) {
ClientInfoEvent c = (ClientInfoEvent)event;

View File

@ -17,98 +17,116 @@
package org.adempiere.webui;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import org.adempiere.webui.apps.ProcessDialog;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.event.MenuListener;
import org.adempiere.webui.exception.ApplicationException;
import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.panel.FooterPanel;
import org.adempiere.webui.panel.HeaderPanel;
import org.adempiere.webui.panel.MainPanel;
import org.adempiere.webui.panel.SidePanel;
import org.adempiere.webui.part.AbstractUIPart;
import org.adempiere.webui.part.WindowContainer;
import org.adempiere.webui.window.ADWindow;
import org.compiere.model.MClient;
import org.compiere.model.MMenu;
import org.compiere.model.MQuery;
import org.compiere.model.MSysConfig;
import org.compiere.util.CCache;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.WebDoc;
import org.zkoss.util.media.AMedia;
import org.zkoss.zul.Hbox;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Page;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.North;
import org.zkoss.zkex.zul.West;
import org.zkoss.zul.Iframe;
import org.zkoss.zul.Label;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
* @date Mar 2, 2007
* @version $Revision: 0.10 $
*/
public class Desktop extends Window implements MenuListener
public class Desktop extends AbstractUIPart implements MenuListener, Serializable, IDesktop
{
private static final long serialVersionUID = 9056511175189603883L;
private static final CLogger logger = CLogger.getCLogger(Desktop.class);
private HeaderPanel pnlHead;
private transient ClientInfo clientInfo;
private SidePanel pnlSide;
private List<Object> windows;
private Center windowArea;
private MainPanel pnlMain;
private Borderlayout layout;
private FooterPanel pnlFooter;
private ClientInfo clientInfo;
private List<Window> windows;
private CCache<Integer, ADWindow> windowCache;
private WindowContainer windowContainer;
public Desktop()
{
windows = new ArrayList<Window>();
windowCache = new CCache<Integer, ADWindow>("ZKWindowCache", 20);
windowCache.setExpireMinutes(10); // Remove the cached window after 10 mins
init();
windows = new ArrayList<Object>();
}
private void init()
protected Component doCreatePart(Component parent)
{
pnlSide = new SidePanel();
pnlMain = new MainPanel();
pnlFooter = new FooterPanel();
pnlHead = new HeaderPanel();
SidePanel pnlSide = new SidePanel();
HeaderPanel pnlHead = new HeaderPanel();
pnlSide.getMenuPanel().addMenuListener(this);
VerticalBox verticalBox = new VerticalBox();
verticalBox.setWidth("1200px");
layout = new Borderlayout();
if (parent != null)
layout.setParent(parent);
else
layout.setPage(page);
Hbox hbox = new Hbox();
North n = new North();
layout.appendChild(n);
n.setCollapsible(false);
pnlHead.setParent(n);
hbox.setWidth("1200px");
hbox.setWidths("300px, 900px");
hbox.appendChild(pnlSide);
hbox.appendChild(pnlMain);
West w = new West();
layout.appendChild(w);
w.setWidth("300px");
w.setCollapsible(true);
w.setSplittable(true);
// w.setAutoscroll(true);
pnlSide.setParent(w);
windowArea = new Center();
windowArea.setParent(layout);
windowArea.setFlex(true);
// windowArea.setAutoscroll(true);
windowContainer = new WindowContainer();
windowContainer.createPart(windowArea);
String homeURL = MSysConfig.getValue("WEBUI_HOMEURL", "http://www.adempiere.com/");
showURL(homeURL, "Home", false);
createHomeTab();
verticalBox.appendChild(pnlHead);
verticalBox.appendChild(hbox);
//this.setBorder("normal");
this.setStyle("background-color: #FAFAFA");
//this.setWidth("100%");
//this.setHeight("100%");
this.appendChild(verticalBox);
return layout;
}
private void createHomeTab() {
//TODO: dashboard
Tabpanel homeTab = new Tabpanel();
windowContainer.addWindow(homeTab, "Home", false);
Label t = new Label();
t.setValue("My Home!");
t.setParent(homeTab);
//register as 0
registerWindow(homeTab);
}
/**
* Retrieves the Client website url
@ -118,8 +136,6 @@ public class Desktop extends Window implements MenuListener
{
MClient client = MClient.get(Env.getCtx());
String defaultUrl = "http://www.adempiere.com";
/* [ 1983672 ] Column AD_Client.WebSiteURL doesn't exist
String url = (String)client.get_Value("WebSiteURL");
if (url == null)
@ -131,8 +147,6 @@ public class Desktop extends Window implements MenuListener
logger.log(Level.SEVERE, "Website URL provided for the client is not valid!!!");
url = defaultUrl;
}
*/
String url = defaultUrl;
return url;
}
@ -158,20 +172,18 @@ public class Desktop extends Window implements MenuListener
if(menu.getAction().equals(MMenu.ACTION_Window))
{
Integer wMenuId = Integer.valueOf(menu.getAD_Window_ID());
ADWindow wndMain = windowCache.get(wMenuId);
if (wndMain == null)
{
wndMain = new ADWindow(Env.getCtx(), menu.getAD_Window_ID());
windowCache.put(wMenuId, wndMain);
}
pnlMain.addWindow(wndMain, wndMain.getTitle(), true);
ADWindow adWindow = new ADWindow(Env.getCtx(), menu.getAD_Window_ID());
Tabpanel tabPanel = new Tabpanel();
adWindow.createPart(tabPanel);
windowContainer.addWindow(tabPanel, adWindow.getTitle(), true);
}
else if(menu.getAction().equals(MMenu.ACTION_Process) ||
menu.getAction().equals(MMenu.ACTION_Report))
{
ProcessDialog pd = new ProcessDialog (menu.getAD_Process_ID(), menu.isSOTrx());
if (pd.isValid()) {
pd.setPage(this.getPage());
pd.setPage(page);
pd.setClosable(true);
pd.setWidth("500px");
try {
@ -185,7 +197,10 @@ public class Desktop extends Window implements MenuListener
else if(menu.getAction().equals(MMenu.ACTION_Form))
{
Window form = ADForm.openForm(menu.getAD_Form_ID());
pnlMain.addWindow(form, form.getTitle(), true);
Tabpanel tabPanel = new Tabpanel();
form.setParent(tabPanel);
windowContainer.addWindow(tabPanel, form.getTitle(), true);
}
else
{
@ -193,7 +208,7 @@ public class Desktop extends Window implements MenuListener
}
}
public void showURL(String url, boolean closeable)
public void showURL(String url, boolean closeable)
{
showURL(url, url, closeable);
}
@ -217,31 +232,40 @@ public class Desktop extends Window implements MenuListener
private void addWin(Iframe fr, String title, boolean closeable)
{
fr.setWidth("100%");
fr.setHeight("650px");
Window wndUrl = new Window();
//wndUrl.setHeight("650px");
//wndUrl.setWidth("800px");
wndUrl.appendChild(fr);
pnlMain.addWindow(wndUrl, title, closeable);
fr.setHeight("100%");
fr.setStyle("padding: 0; margin: 0; border: none; position: absolute");
Window window = new Window();
window.setWidth("100%");
window.setHeight("100%");
window.setStyle("padding: 0; margin: 0; border: none");
window.appendChild(fr);
window.setStyle("position: absolute");
Tabpanel tabPanel = new Tabpanel();
window.setParent(tabPanel);
windowContainer.addWindow(tabPanel, title, closeable);
}
public void showZoomWindow(int AD_Window_ID, MQuery query)
{
ADWindow wnd = new ADWindow(Env.getCtx(), AD_Window_ID, query);
Window window = new Window();
window.appendChild(wnd);
window.setBorder("normal");
pnlMain.addWindow(window,wnd.getTitle(),true);
Tabpanel tabPanel = new Tabpanel();
wnd.createPart(tabPanel);
windowContainer.addWindow(tabPanel, wnd.getTitle(), false);
}
public void showWindow(Window win)
public void showWindow(Window win)
{
String pos = win.getPosition();
this.showWindow(win, pos);
}
public void showWindow(Window win, String pos)
{
win.setPage(this.getPage());
win.setPage(page);
Object objMode = win.getAttribute("mode");
String pos = win.getPosition();
String mode = "modal";
@ -271,7 +295,7 @@ public class Desktop extends Window implements MenuListener
showHighlighted(win, pos);
}
win.setVisible(true);
// win.setVisible(true);
}
public void showModal(Window win)
@ -335,7 +359,7 @@ public class Desktop extends Window implements MenuListener
this.clientInfo = clientInfo;
}
public int registerWindow(Window win) {
public int registerWindow(Object win) {
int retValue = windows.size();
windows.add(win);
return retValue;
@ -347,7 +371,7 @@ public class Desktop extends Window implements MenuListener
}
public Window findWindow(int WindowNo) {
public Object findWindow(int WindowNo) {
if (WindowNo < windows.size())
return windows.get(WindowNo);
else
@ -356,6 +380,17 @@ public class Desktop extends Window implements MenuListener
public void removeWindow()
{
pnlMain.removeWindow();
windowContainer.removeWindow();
}
public void setPage(Page page) {
if (this.page != page) {
layout.setPage(page);
this.page = page;
}
}
public Component getComponent() {
return layout;
}
}

View File

@ -0,0 +1,29 @@
package org.adempiere.webui;
import org.adempiere.webui.component.Window;
import org.compiere.model.MQuery;
import org.compiere.util.WebDoc;
public interface IDesktop {
public ClientInfo getClientInfo();
public void onMenuSelected(int nodeId);
public int registerWindow(Object window);
public void removeWindow();
public void showURL(String url, boolean closeable);
public void showURL(WebDoc doc, String string, boolean closeable);
public void showWindow(Window win);
public void showWindow(Window win, String position);
public void showZoomWindow(int window_ID, MQuery query);
public void unregisterWindow(int windowNo);
}

View File

@ -0,0 +1,11 @@
package org.adempiere.webui;
public interface IWebClient {
public void loginCompleted();
public void logout();
public IDesktop getAppDeskop();
}

View File

@ -0,0 +1,36 @@
package org.adempiere.webui;
import org.zkoss.zk.au.out.AuScript;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zkex.zul.Borderlayout;
public final class LayoutUtils {
/**
* @param layout
*/
public static void sendDeferLayoutEvent(Borderlayout layout, int timeout) {
StringBuffer content = new StringBuffer();
content.append("ad_deferRenderBorderLayout('")
.append(layout.getUuid())
.append("',").append(timeout).append(");");
AuScript as = new AuScript(null, content.toString());
Clients.response("deferRenderBorderLayout", as);
}
public static void addSclass(String cls, HtmlBasedComponent target) {
final String sclass = target.getSclass();
if (!hasSclass(cls, target))
target.setSclass(sclass == null ? cls : sclass + " " + cls);
}
public static boolean hasSclass(String cls, HtmlBasedComponent target) {
String sclass = target.getSclass();
if (sclass == null)
sclass = "";
return cls == null
|| ((" " + sclass + " ").indexOf(" " + cls + " ") > -1);
}
}

View File

@ -17,31 +17,65 @@
package org.adempiere.webui;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.part.AbstractUIPart;
import org.adempiere.webui.window.LoginWindow;
import org.zkoss.zk.ui.Component;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
import org.zkoss.zul.Vbox;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @author Low Heng Sin
* @date Mar 3, 2007
* @version $Revision: 0.10 $
*/
public class WLogin extends Window
public class WLogin extends AbstractUIPart
{
private static final long serialVersionUID = 1L;
private AdempiereWebUI novita;
private LoginWindow loginWindow;
private IWebClient app;
private Borderlayout layout;
public WLogin(AdempiereWebUI novita)
public WLogin(IWebClient app)
{
this.novita = novita;
init();
this.app = app;
}
private void init()
protected Component doCreatePart(Component parent)
{
loginWindow = new LoginWindow(novita);
this.appendChild(loginWindow);
layout = new Borderlayout();
if (parent != null)
layout.setParent(parent);
else
layout.setPage(page);
Center c = new Center();
c.setParent(layout);
c.setBorder("none");
c.setFlex(true);
c.setAutoscroll(true);
Vbox vb = new Vbox();
vb.setParent(c);
vb.setHeight("100%");
vb.setWidth("100%");
vb.setPack("center");
vb.setAlign("center");
LayoutUtils.addSclass("login", vb);
LoginWindow loginWindow = new LoginWindow(app);
loginWindow.setParent(vb);
return layout;
}
public void detach() {
layout.detach();
layout = null;
}
public Component getComponent() {
return layout;
}
}

View File

@ -61,6 +61,7 @@ import org.zkoss.zul.Hbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listhead;
import org.zkoss.zul.Listheader;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.Separator;
/**
@ -666,7 +667,7 @@ public class WAcctViewer extends Window implements EventListener
private void actionAcctSchema()
{
ListItem listitem = selAcctSchema.getSelectedItem();
Listitem listitem = selAcctSchema.getSelectedItem();
KeyNamePair kp = null;
@ -765,7 +766,7 @@ public class WAcctViewer extends Window implements EventListener
// Save Selection Choices
ListItem listitem = selAcctSchema.getSelectedItem();
Listitem listitem = selAcctSchema.getSelectedItem();
KeyNamePair kp = null;
@ -973,7 +974,7 @@ public class WAcctViewer extends Window implements EventListener
private void actionTable()
{
ListItem listitem = selTable.getSelectedItem();
Listitem listitem = selTable.getSelectedItem();
ValueNamePair vp = null;
if (listitem != null)

View File

@ -52,10 +52,7 @@ public final class AEnv
*/
public static void showCenterScreen(Window window)
{
/* positionCenterScreen(window);
window.setVisible(true);
window.toFront();
*/
SessionManager.getAppDesktop().showWindow(window, "center");
} // showCenterScreen
/**

View File

@ -278,7 +278,7 @@ public class WAllocation extends ADForm implements EventListener,
Hbox hbox = new Hbox();
// Put the table label at the top of this panel
hbox.setWidth("98%");
hbox.setWidth("100%");
m_lblPayment.setValue(Msg.translate(Env.getCtx(), "C_Payment_ID"));
hbox.setStyle("text-align:left");
hbox.appendChild(m_lblPayment);
@ -292,7 +292,7 @@ public class WAllocation extends ADForm implements EventListener,
// Put the selected payment information just below the table and
// right-align it
hbox = new Hbox();
hbox.setWidth("98%");
hbox.setWidth("100%");
m_lblPaymentInfo.setValue(".");
hbox.setStyle("text-align:right");
hbox.appendChild(m_lblPaymentInfo);
@ -312,7 +312,7 @@ public class WAllocation extends ADForm implements EventListener,
Hbox hbox = new Hbox();
// Put the table label at the top of this panel
hbox.setWidth("98%");
hbox.setWidth("100%");
m_lblInvoice.setValue(Msg.translate(Env.getCtx(), "C_Invoice_ID"));
hbox.setStyle("text-align:left");
hbox.appendChild(m_lblInvoice);
@ -326,7 +326,7 @@ public class WAllocation extends ADForm implements EventListener,
// Put the selected invoice information just below the table and
// right-align it
hbox = new Hbox();
hbox.setWidth("98%");
hbox.setWidth("100%");
m_lblInvoiceInfo.setValue(".");
hbox.setStyle("text-align:right");
hbox.appendChild(m_lblInvoiceInfo);
@ -346,7 +346,7 @@ public class WAllocation extends ADForm implements EventListener,
Vbox vbox = new Vbox();
Separator separator = new Separator();
vbox.setWidth("98%");
vbox.setWidth("100%");
vbox.setHeight("200px");
vbox.setHeights("45%,5%,45%");
@ -501,7 +501,7 @@ public class WAllocation extends ADForm implements EventListener,
this.appendChild(m_statusBar);
this.setWidth("850px");
// this.setWidth("850px");
calculate();

View File

@ -34,10 +34,15 @@ import java.util.logging.Level;
import javax.swing.table.AbstractTableModel;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Column;
import org.adempiere.webui.component.Columns;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Datebox;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.component.WStatusBar;
import org.adempiere.webui.editor.WEditor;
@ -62,11 +67,6 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.Msg;
import org.compiere.util.NamePair;
import org.zkforge.yuiext.grid.Column;
import org.zkforge.yuiext.grid.Columns;
import org.zkforge.yuiext.grid.Grid;
import org.zkforge.yuiext.grid.Row;
import org.zkforge.yuiext.grid.Rows;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
@ -337,7 +337,7 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
for (int j = 0; j < tableModel.getColumnCount(); j++)
{
org.zkforge.yuiext.grid.Label lab = new org.zkforge.yuiext.grid.Label();
Label lab = new Label();
Label label = new Label("");
@ -380,7 +380,7 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi
label.setValue("Missing Class");
}
lab = new org.zkforge.yuiext.grid.Label(label.getValue());
lab = new Label(label.getValue());
row.appendChild(lab);
}
rows.appendChild(row);

View File

@ -0,0 +1,98 @@
package org.adempiere.webui.component;
import java.util.ArrayList;
import java.util.List;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.ADTabListModel.ADTabLabel;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
/**
*
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
*
*/
public class ADButtonTabList extends Panel implements IADTabList, EventListener {
private List<ADTabLabel> listItems = new ArrayList<ADTabLabel>();
private List<EventListener> listeners = new ArrayList<EventListener>();
private IADTab tabbox;
private int selectedIndex = 0;
public ADButtonTabList() {
this.setStyle("margin:0;padding:0");
}
public void refresh() {
this.getChildren().clear();
int i = 0;
for (ADTabLabel tabLabel : listItems) {
Button button = new Button();
button.setLabel(tabLabel.label);
int s = tabbox.getSelectedIndex();
if ( s == i)
LayoutUtils.addSclass("adwindow-navbtn-sel", button);
else {
if (!tabbox.canNavigateTo(s, i)) {
button.setDisabled(true);
LayoutUtils.addSclass("adwindow-navbtn-dis", button);
} else {
LayoutUtils.addSclass("adwindow-navbtn-uns", button);
}
}
String style = "margin-left:" + (tabLabel.tabLevel*15+5) + "px";
button.setStyle(style);
button.setParent(this);
button.setWidth((195 - tabLabel.tabLevel*15)+"px");
button.addEventListener(Events.ON_CLICK, this);
i++;
}
}
public int getSelectedIndex() {
return selectedIndex;
}
public void setSelectedIndex(int index) {
this.selectedIndex = index;
}
public void setItems(List<ADTabLabel> listItems) {
this.listItems = listItems;
refresh();
}
public void setADTab(IADTab adTab) {
this.tabbox = adTab;
}
public void addSelectionEventListener(EventListener listener) {
listeners.add(listener);
}
public boolean removeSelectionEventListener(EventListener listener) {
return listeners.remove(listener);
}
public void onEvent(Event event) throws Exception {
Event selectEvent = new Event(Events.ON_SELECT, this);
Button button = (Button) event.getTarget();
int i = 0;
for (ADTabLabel tabLabel : listItems) {
if (tabLabel.label.equals(button.getLabel())) {
break;
}
i++;
}
selectedIndex = i;
for (EventListener listener : listeners) {
listener.onEvent(selectEvent);
}
}
}

View File

@ -0,0 +1,68 @@
package org.adempiere.webui.component;
import java.util.List;
import org.zkoss.zul.AbstractListModel;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
import org.zkoss.zul.ListitemRendererExt;
public class ADTabListModel extends AbstractListModel implements ListitemRenderer, ListitemRendererExt {
List<ADTabLabel> listItems = null;
private IADTab tabbox;
public ADTabListModel(List<ADTabLabel> listItems, IADTab tabbox) {
this.listItems = listItems;
this.tabbox = tabbox;
}
public Object getElementAt(int index) {
ADTabLabel item = index < listItems.size() ? listItems.get(index) : null;
return item;
}
public int getSize() {
return listItems.size();
}
public static class ADTabLabel {
public String label;
public int tabLevel;
public ADTabLabel(String label, int tabLevel) {
this.label = label;
this.tabLevel = tabLevel;
}
}
public void render(Listitem item, Object data) throws Exception {
ADTabLabel tabLabel = (ADTabLabel)data;
Listcell cell = new Listcell(tabLabel.label, null);
if (tabLabel.tabLevel > 0) {
cell.setStyle("padding-left:" + (tabLabel.tabLevel*15+5) + "px");
}
cell.setParent(item);
int i = listItems.indexOf(tabLabel);
int s = tabbox.getSelectedIndex();
if (!tabbox.canNavigateTo(s, i))
cell.setVisible(false);
}
public int getControls() {
return DETACH_ON_RENDER;
}
public Listcell newListcell(Listitem item) {
return null;
}
public Listitem newListitem(Listbox listbox) {
ListItem item = new ListItem();
item.applyProperties();
return item;
}
}

View File

@ -18,65 +18,48 @@
package org.adempiere.webui.component;
import java.util.ArrayList;
import java.util.List;
import org.adempiere.webui.panel.ADTabpanel;
import org.compiere.grid.VTabbedPane;
import org.adempiere.webui.part.AbstractUIPart;
import org.compiere.model.DataStatusEvent;
import org.compiere.model.GridTab;
import org.compiere.util.CLogger;
import org.compiere.util.Evaluator;
import org.zkoss.zul.Tab;
import org.zkoss.zul.Tabpanels;
import org.zkoss.zul.Tabs;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class FTabbox extends Tabbox
public abstract class AbstractADTab extends AbstractUIPart implements IADTab
{
private static final long serialVersionUID = 1L;
/** Logger */
private static CLogger log = CLogger.getCLogger (VTabbedPane.class);
private static CLogger log = CLogger.getCLogger (AbstractADTab.class);
/** List of dependent Variables */
private ArrayList<String> m_dependents = new ArrayList<String>();
/** Tab Panels for this tab box */
private FTabpanels tabpanels;
/** Tabs associated to this tab box */
private Tabs tabs;
protected List<ADTabpanel> tabPanelList = new ArrayList<ADTabpanel>();
public FTabbox()
public AbstractADTab()
{
super();
init();
}
private void init()
{
tabpanels = new FTabpanels();
tabs = new Tabs();
//this.setSclass("lite");
this.appendChild(tabs);
this.appendChild(tabpanels);
this.setOrient("vertical");
}// init
/**
* Add Tab
* @param tabName name
* @param gTab grid tab model
* @param tabElement GridController or VSortTab
*/
public void addTab(GridTab gTab, Tabpanel tabPanel)
public void addTab(GridTab gTab, ADTabpanel tabPanel)
{
Tab tab = new Tab(gTab.getName());
tabPanel.setEnabled(gTab.isDisplayed());
tabs.appendChild(tab);
tabpanels.appendChild(tabPanel);
ArrayList<String> dependents = gTab.getDependentOn();
tabPanelList.add(tabPanel);
ArrayList<String> dependents = gTab.getDependentOn();
for (int i = 0; i < dependents.size(); i++)
{
String name = dependents.get(i);
@ -85,28 +68,27 @@ public class FTabbox extends Tabbox
m_dependents.add(name);
}
}
doAddTab(gTab, tabPanel);
}// addTab
/**
protected abstract void doAddTab(GridTab tab, ADTabpanel tabPanel);
/**
* @param index of tab panel
* @return
*/
public boolean isEnabledAt(int index)
{
Tabpanel tabpanel = tabpanels.getTabpanel(index);
if (tabpanel == null)
{
return false;
}
return tabpanel.isEnabled();
return true;
}// isEnabledAt
private boolean isDisplay(ADTabpanel tabpanel)
private boolean isDisplay(ADTabpanel newTab)
{
String logic = tabpanel.getDisplayLogic();
String logic = newTab.getDisplayLogic();
if (logic != null && logic.length() > 0)
{
boolean display = Evaluator.evaluateLogic(tabpanel, logic);
boolean display = Evaluator.evaluateLogic(newTab, logic);
if (!display)
{
log.info("Not displayed - " + logic);
@ -124,13 +106,10 @@ public class FTabbox extends Tabbox
*/
public boolean updateSelectedIndex(int oldIndex, int newIndex)
{
Tabpanel tabpanel = tabpanels.getTabpanel(newIndex);
ADTabpanel newTab = tabPanelList.get(newIndex);
ADTabpanel newTab = (ADTabpanel)tabpanel;
if (tabpanel == null || !isDisplay(newTab))
if (!isDisplay(newTab))
{
super.setSelectedIndex(oldIndex);
return false;
}
@ -138,16 +117,39 @@ public class FTabbox extends Tabbox
if (newIndex != oldIndex)
{
ADTabpanel oldTabpanel = tabpanels.getTabpanel(oldIndex);
canJump = canNavigateTo(oldIndex, newIndex);
if (canJump)
{
doTabSelectionChanged(oldIndex, newIndex);
}
}
return canJump;
}
protected abstract void doTabSelectionChanged(int oldIndex, int newIndex);
public boolean canNavigateTo(int fromIndex, int toIndex) {
ADTabpanel newTab = tabPanelList.get(toIndex);
if (!isDisplay(newTab))
{
return false;
}
boolean canJump = true;
if (toIndex != fromIndex)
{
ADTabpanel oldTabpanel = fromIndex >= 0 ? tabPanelList.get(fromIndex) : null;
if (oldTabpanel != null)
{
ADTabpanel oldTab = oldTabpanel;
if (newTab.getTabLevel() > oldTab.getTabLevel())
{
int currentLevel = newTab.getTabLevel();
for (int i = newIndex - 1; i >= 0; i--)
for (int i = toIndex - 1; i >= 0; i--)
{
ADTabpanel tabPanel = tabpanels.getTabpanel(i);
ADTabpanel tabPanel = tabPanelList.get(i);
if (tabPanel.getTabLevel() < currentLevel)
{
if (!tabPanel.isCurrent())
@ -159,30 +161,48 @@ public class FTabbox extends Tabbox
}
}
}
}
else
{
canJump = false;
}
}
if (canJump)
{
super.setSelectedIndex(newIndex);
}
else
{
super.setSelectedIndex (oldIndex);
}
}
}
return canJump;
}
/**
*
* @return full path
*/
public String getPath() {
StringBuffer path = new StringBuffer();
int s = this.getSelectedIndex();
if (s <= 0 ) s = 0;
ADTabpanel p = tabPanelList.get(s);
for (int i = 0; i <= s; i++) {
String n = null;
if (i == s)
n = p.getTitle();
else {
ADTabpanel t = tabPanelList.get(i);
if (t.getTabLevel() < p.getTabLevel())
n = t.getTitle();
}
if (n != null) {
if (path.length() > 0) {
path.append(" > ");
}
path.append(n);
}
}
return path.toString();
}
/**
* Evaluate Tab Logic
* @param e event
*/
public void evaluate (DataStatusEvent e)
{
boolean process = e == null;
boolean process = (e == null);
String columnName = null;
if (!process)
{
@ -195,37 +215,26 @@ public class FTabbox extends Tabbox
if (process)
{
log.config(columnName == null ? "" : columnName);
for (int i = 0; i < this.getTabCount(); i++)
{
ADTabpanel tabPanel = tabpanels.getTabpanel(i);
String logic = tabPanel.getDisplayLogic();
boolean display = true;
if (logic != null && logic.length() > 0)
{
display = Evaluator.evaluateLogic(tabPanel, logic);
}
tabPanel.setEnabled(display);
}
updateTabState();
}
} // evaluate
/**
protected abstract void updateTabState();
/**
* @return the number of tab panels present
*/
public int getTabCount()
{
return tabpanels.getChildren().size();
return tabPanelList.size();
}
public ADTabpanel getTabpanel(int index)
{
try
{
Tabpanels tabpanels = this.getTabpanels();
ADTabpanel tabPanel = (ADTabpanel)tabpanels.getChildren().get(index);
ADTabpanel tabPanel = tabPanelList.get(index);
return tabPanel;
}
catch (Exception ex)
@ -234,24 +243,8 @@ public class FTabbox extends Tabbox
}
}
/**
* Return the selected Tab Panel
*/
public ADTabpanel getSelectedTabpanel()
{
return getTabpanel(this.getSelectedIndex());
}
/**
* @return whether all events should be reported as they occur.
*/
public boolean isAsap()
{
return true;
}
public boolean containsTab(Tab tab)
{
return tabs.getChildren().contains(tab);
public void setSelectedIndex(int newIndex) {
int oldIndex = getSelectedIndex();
updateSelectedIndex(oldIndex, newIndex);
}
}

View File

@ -23,7 +23,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.logging.Level;
import org.adempiere.webui.constants.EventConstants;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.event.ToolbarListener;
import org.compiere.util.CLogger;
import org.zkoss.zk.ui.Component;
@ -46,24 +46,24 @@ public class CWindowToolbar extends FToolbar implements EventListener
private static CLogger log = CLogger.getCLogger(CWindowToolbar.class);
private Button btnIgnore;
private ToolBarButton btnIgnore;
private Button btnHelp, btnNew, btnDelete, btnSave;
private ToolBarButton btnHelp, btnNew, btnDelete, btnSave;
private Button btnRefresh, btnFind, btnAttachment;
private ToolBarButton btnRefresh, btnFind, btnAttachment;
private Button btnGridToggle;
private ToolBarButton btnGridToggle;
private Button btnHistoryRecords, btnMenu, btnParentRecord, btnDetailRecord;
private ToolBarButton btnHistoryRecords, btnMenu, btnParentRecord, btnDetailRecord;
private Button btnFirst, btnPrevious, btnNext, btnLast;
private ToolBarButton btnFirst, btnPrevious, btnNext, btnLast;
private Button btnReport, btnArchive, btnPrint;
private ToolBarButton btnReport, btnArchive, btnPrint;
private Button btnZoomAcross, btnActiveWorkflows, btnRequests, btnProductInfo;
private Button btnExit;
private ToolBarButton btnZoomAcross, btnActiveWorkflows, btnRequests, btnProductInfo;
// private ToolBarButton btnExit;
private ArrayList<ToolbarListener> listeners = new ArrayList<ToolbarListener>();
public CWindowToolbar()
@ -73,117 +73,119 @@ public class CWindowToolbar extends FToolbar implements EventListener
private void init()
{
btnIgnore = new Button("");
LayoutUtils.addSclass("adwindow-toolbar", this);
btnIgnore = new ToolBarButton();
btnIgnore.setName("btnIgnore");
btnIgnore.setImage("/images/Ignore16.gif");
btnIgnore.setTooltiptext("Ignore Changes");
// --
btnHelp = new Button("");
btnHelp = new ToolBarButton("");
btnHelp.setName("btnHelp");
btnHelp.setImage("/images/Help24.gif");
btnHelp.setTooltiptext("Help");
btnNew = new Button("");
btnNew = new ToolBarButton("");
btnNew.setName("btnNew");
btnNew.setImage("/images/New24.gif");
btnNew.setTooltiptext("New Record");
btnDelete = new Button("");
btnDelete = new ToolBarButton("");
btnDelete.setName("btnDelete");
btnDelete.setImage("/images/Delete24.gif");
btnDelete.setTooltiptext("Delete current record");
btnSave = new Button("");
btnSave = new ToolBarButton("");
btnSave.setName("btnSave");
btnSave.setImage("/images/Save24.gif");
btnSave.setTooltiptext("Save changes");
// --
btnRefresh = new Button("");
btnRefresh = new ToolBarButton("");
btnRefresh.setName("btnRefresh");
btnRefresh.setImage("/images/Refresh24.gif");
btnRefresh.setTooltiptext("Refresh Data");
btnFind = new Button("");
btnFind = new ToolBarButton("");
btnFind.setName("btnFind");
btnFind.setImage("/images/Find24.gif");
btnFind.setTooltiptext("Find Records");
btnAttachment = new Button("");
btnAttachment = new ToolBarButton("");
btnAttachment.setName("btnAttachment");
btnAttachment.setImage("/images/Attachment24.gif");
btnAttachment.setTooltiptext("Attachments");
// --
btnGridToggle = new Button("");
btnGridToggle = new ToolBarButton("");
btnGridToggle.setName("btnGridToggle");
btnGridToggle.setImage("/images/ZoomAcross24.gif");
btnGridToggle.setTooltiptext("Grid Toggle");
btnHistoryRecords = new Button("");
btnHistoryRecords = new ToolBarButton("");
btnHistoryRecords.setName("btnHistoryRecords");
btnHistoryRecords.setImage("/images/HistoryX24.gif");
btnHistoryRecords.setTooltiptext("History Records");
btnMenu = new Button("");
btnMenu = new ToolBarButton("");
btnMenu.setName("btnHome");
btnMenu.setImage("/images/Home24.gif");
btnMenu.setTooltiptext("Home");
btnParentRecord = new Button("");
btnParentRecord = new ToolBarButton("");
btnParentRecord.setName("btnParentRecord");
btnParentRecord.setImage("/images/Parent24.gif");
btnDetailRecord = new Button("");
btnDetailRecord = new ToolBarButton("");
btnDetailRecord.setName("btnDetailRecord");
btnDetailRecord.setImage("/images/Detail24.gif");
// --
btnFirst = new Button("");
btnFirst = new ToolBarButton("");
btnFirst.setName("btnFirst");
btnFirst.setImage("/images/First24.gif");
btnPrevious = new Button("");
btnPrevious = new ToolBarButton("");
btnPrevious.setName("btnPrevious");
btnPrevious.setImage("/images/Previous24.gif");
btnNext = new Button("");
btnNext = new ToolBarButton("");
btnNext.setName("btnNext");
btnNext.setImage("/images/Next24.gif");
btnLast = new Button("");
btnLast = new ToolBarButton("");
btnLast.setName("btnLast");
btnLast.setImage("/images/Last24.gif");
// --
btnReport = new Button("");
btnReport = new ToolBarButton("");
btnReport.setName("btnReport");
btnReport.setImage("/images/Report24.gif");
btnArchive = new Button("");
btnArchive = new ToolBarButton("");
btnArchive.setName("btnArchive");
btnArchive.setImage("/images/Archive24.gif");
btnPrint = new Button("");
btnPrint = new ToolBarButton("");
btnPrint.setName("btnPrint");
btnPrint.setImage("/images/Print24.gif");
// --
btnZoomAcross = new Button("");
btnZoomAcross = new ToolBarButton("");
btnZoomAcross.setName("btnZoomAcross");
btnZoomAcross.setImage("/images/ZoomAcross24.gif");
btnActiveWorkflows = new Button("");
btnActiveWorkflows = new ToolBarButton("");
btnActiveWorkflows.setName("btnActiveWorkflows");
btnActiveWorkflows.setImage("/images/WorkFlow24.gif");
btnRequests = new Button("");
btnRequests = new ToolBarButton("");
btnRequests.setName("btnRequests");
btnRequests.setImage("/images/Request24.gif");
btnProductInfo = new Button("");
btnProductInfo = new ToolBarButton("");
btnProductInfo.setName("btnProductInfo");
btnProductInfo.setImage("/images/Product24.gif");
btnExit = new Button("");
btnExit.setName("btnExit");
btnExit.setImage("/images/End24.gif");
// btnExit = new ToolBarButton("");
// btnExit.setName("btnExit");
// btnExit.setImage("/images/End24.gif");
this.appendChild(btnIgnore);
addSeparator();
@ -216,26 +218,26 @@ public class CWindowToolbar extends FToolbar implements EventListener
this.appendChild(btnActiveWorkflows);
this.appendChild(btnRequests);
this.appendChild(btnProductInfo);
addSeparator();
this.appendChild(btnExit);
// addSeparator();
// this.appendChild(btnExit);
for (Object obj : this.getChildren())
{
if (obj instanceof Button)
if (obj instanceof ToolBarButton)
{
((Button)obj).setWidth(BUTTON_WIDTH);
((Button)obj).addEventListener(Events.ON_CLICK, this);
((Button)obj).setEnabled(false);
((ToolBarButton)obj).setWidth(BUTTON_WIDTH);
((ToolBarButton)obj).addEventListener(Events.ON_CLICK, this);
((ToolBarButton)obj).setDisabled(true);
}
}
// Help and Exit should always be enabled
btnHelp.setEnabled(true);
btnExit.setEnabled(true);
btnHelp.setDisabled(false);
// btnExit.setDisabled(false);
// Testing Purposes
btnGridToggle.setEnabled(true);
btnGridToggle.setDisabled(false);
}
protected void addSeparator()
@ -263,11 +265,11 @@ public class CWindowToolbar extends FToolbar implements EventListener
Component eventComp = event.getTarget();
Iterator<ToolbarListener> listenerIter = listeners.iterator();
if(eventName.equals(EventConstants.ONCLICK))
if(eventName.equals(Events.ON_CLICK))
{
if(eventComp instanceof Button)
if(eventComp instanceof ToolBarButton)
{
Button cComponent = (Button) eventComp;
ToolBarButton cComponent = (ToolBarButton) eventComp;
String compName = cComponent.getName();
String methodName = "on" + compName.substring(3);
while(listenerIter.hasNext())
@ -305,15 +307,15 @@ public class CWindowToolbar extends FToolbar implements EventListener
public void enableHistoryRecords(boolean enabled)
{
this.btnHistoryRecords.setEnabled(enabled);
this.btnHistoryRecords.setDisabled(!enabled);
}
public void enableNavigation(boolean enabledd)
public void enableNavigation(boolean enabled)
{
this.btnFirst.setEnabled(enabledd);
this.btnPrevious.setEnabled(enabledd);
this.btnNext.setEnabled(enabledd);
this.btnLast.setEnabled(enabledd);
this.btnFirst.setDisabled(!enabled);
this.btnPrevious.setDisabled(!enabled);
this.btnNext.setDisabled(!enabled);
this.btnLast.setDisabled(!enabled);
}
public void enableTabNavigation(boolean enabled)
@ -323,25 +325,25 @@ public class CWindowToolbar extends FToolbar implements EventListener
public void enableTabNavigation(boolean enableParent, boolean enableDetail)
{
this.btnParentRecord.setEnabled(enableParent);
this.btnDetailRecord.setEnabled(enableDetail);
this.btnParentRecord.setDisabled(!enableParent);
this.btnDetailRecord.setDisabled(!enableDetail);
}
public void enableFirstNavigation(boolean enabled)
{
this.btnFirst.setEnabled(enabled);
this.btnPrevious.setEnabled(enabled);
this.btnFirst.setDisabled(!enabled);
this.btnPrevious.setDisabled(!enabled);
}
public void enableLastNavigation(boolean enabled)
{
this.btnLast.setEnabled(enabled);
this.btnNext.setEnabled(enabled);
this.btnLast.setDisabled(!enabled);
this.btnNext.setDisabled(!enabled);
}
public void enabledNew(boolean enabled)
{
this.btnNew.setEnabled(enabled);
this.btnNew.setDisabled(!enabled);
}
/* public void enableEdit(boolean enabled)
@ -351,22 +353,22 @@ public class CWindowToolbar extends FToolbar implements EventListener
public void enableRefresh(boolean enabled)
{
this.btnRefresh.setEnabled(enabled);
this.btnRefresh.setDisabled(!enabled);
}
public void enableSave(boolean enabled)
{
this.btnSave.setEnabled(enabled);
this.btnSave.setDisabled(!enabled);
}
public void enableExit(boolean enabled)
{
this.btnExit.setEnabled(enabled);
}
// public void enableExit(boolean enabled)
// {
// this.btnExit.setDisabled(!enabled);
// }
public void enableDelete(boolean enabled)
{
this.btnDelete.setEnabled(enabled);
this.btnDelete.setDisabled(!enabled);
}
public void enableDeleteSelection(boolean enabled)
@ -376,33 +378,33 @@ public class CWindowToolbar extends FToolbar implements EventListener
public void enableChanges(boolean enabled)
{
this.btnNew.setEnabled(enabled);
this.btnIgnore.setEnabled(enabled);
this.btnNew.setDisabled(!enabled);
this.btnIgnore.setDisabled(!enabled);
}
public void enableIgnore(boolean enabled)
{
this.btnIgnore.setEnabled(enabled);
this.btnIgnore.setDisabled(!enabled);
}
public void enableNew(boolean enabled)
{
this.btnNew.setEnabled(enabled);
this.btnNew.setDisabled(!enabled);
}
public void enableAttachment(boolean enabled)
{
this.btnAttachment.setEnabled(enabled);
this.btnAttachment.setDisabled(!enabled);
}
public void enablePrint(boolean enabled)
{
this.btnPrint.setEnabled(enabled);
this.btnPrint.setDisabled(!enabled);
}
public void enableReport(boolean enabled)
{
this.btnReport.setEnabled(enabled);
this.btnReport.setDisabled(!enabled);
}
public void enableCopy(boolean enabled)
@ -411,13 +413,13 @@ public class CWindowToolbar extends FToolbar implements EventListener
public void enableFind(boolean enabled)
{
this.btnFind.setEnabled(enabled);
this.btnFind.setDisabled(!enabled);
}
public void enableGridToggle(boolean enabled)
{
btnGridToggle.setEnabled(enabled);
btnGridToggle.setDisabled(!enabled);
}
public boolean isAsap()

View File

@ -0,0 +1,151 @@
/******************************************************************************
* Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/
package org.adempiere.webui.component;
import java.util.ArrayList;
import java.util.List;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.panel.ADTabpanel;
import org.compiere.model.DataStatusEvent;
import org.compiere.model.GridTab;
import org.compiere.util.CLogger;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Div;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class CompositeADTab extends AbstractADTab
{
private static final long serialVersionUID = 1L;
/** Logger */
private static CLogger log = CLogger.getCLogger (CompositeADTab.class);
private List<ADTabListModel.ADTabLabel> tabLabelList = new ArrayList<ADTabListModel.ADTabLabel>();
private Div div;
protected ADButtonTabList tabList;
public CompositeADTab()
{
tabList = new ADButtonTabList();
tabList.setADTab(this);
}
protected Component doCreatePart(Component parent)
{
div = new Div();
if (parent != null) {
div.setParent(parent);
LayoutUtils.addSclass("adtab-body", div);
} else {
div.setPage(page);
}
return div;
}
public Component getRootComponent() {
return div;
}
@Override
protected void doAddTab(GridTab gTab, ADTabpanel tabPanel) {
tabPanel.setParent(div);
tabPanel.setVisible(false);
ADTabListModel.ADTabLabel tabLabel = new ADTabListModel.ADTabLabel(gTab.getName(), gTab.getTabLevel());
tabLabelList.add(tabLabel);
}
/**
* Evaluate Tab Logic
* @param e event
*/
public void evaluate (DataStatusEvent e)
{
tabList.setItems(tabLabelList);
super.evaluate(e);
} // evaluate
@Override
protected void updateTabState() {
tabList.refresh();
}
/**
* Return the selected Tab Panel
*/
public ADTabpanel getSelectedTabpanel()
{
for(int i = 0; i < tabPanelList.size(); i++) {
if (tabPanelList.get(i).isVisible())
return tabPanelList.get(i);
}
return null;
}
public int getSelectedIndex() {
for(int i = 0; i < tabPanelList.size(); i++) {
if (tabPanelList.get(i).isVisible())
return i;
}
return -1;
}
public void addSelectionEventListener(EventListener listener) {
tabList.addSelectionEventListener(listener);
}
public Component getTabSelectionComponent() {
return tabList;
}
@Override
protected void doTabSelectionChanged(int oldIndex, int newIndex) {
ADTabpanel oldTabpanel = oldIndex >= 0 ? tabPanelList.get(oldIndex) : null;
ADTabpanel newTabpanel = tabPanelList.get(newIndex);
if (oldTabpanel != null) {
oldTabpanel.setVisible(false);
}
newTabpanel.createUI();
newTabpanel.setVisible(true);
if (tabList.getSelectedIndex() != newIndex)
tabList.setSelectedIndex(newIndex);
}
public boolean isUseExternalSelection() {
return true;
}
public Component getComponent() {
return div;
}
}

View File

@ -1,49 +0,0 @@
/******************************************************************************
* Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/
package org.adempiere.webui.component;
import org.adempiere.webui.panel.ADTabpanel;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class FTabpanels extends Tabpanels
{
private static final long serialVersionUID = 1L;
public boolean appendChild(Tabpanel tabPanel)
{
return super.appendChild(tabPanel);
}
public ADTabpanel getTabpanel(int index)
{
try
{
ADTabpanel tabPanel = (ADTabpanel)this.getChildren().get(index);
return tabPanel;
}
catch (Exception ex)
{
return null;
}
}
}

View File

@ -17,42 +17,28 @@
package org.adempiere.webui.component;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.Map;
import javax.swing.table.AbstractTableModel;
import org.adempiere.webui.panel.ADWindowPanel;
import org.adempiere.webui.LayoutUtils;
import org.compiere.model.GridField;
import org.compiere.model.GridTab;
import org.compiere.model.GridTable;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.NamePair;
import org.zkforge.yuiext.grid.Column;
import org.zkforge.yuiext.grid.Columns;
import org.zkforge.yuiext.grid.Grid;
import org.zkforge.yuiext.grid.Label;
import org.zkforge.yuiext.grid.Row;
import org.zkforge.yuiext.grid.Rows;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator;
import org.zkoss.zul.ListitemRenderer;
public class GridPanel extends Panel implements EventListener
public class GridPanel extends Div implements EventListener
{
private static final long serialVersionUID = 1L;
private Grid grid = new Grid();
private Rows rows = new Rows();
private Row row = new Row();
private Columns columns = new Columns();
private Column column = new Column();
private Label label = new Label();
private Listbox listbox = null;
private int pageSize = 10;
private long numPages;
@ -66,26 +52,32 @@ public class GridPanel extends Panel implements EventListener
private Button[] buttons;
private Hbox boxButtons = new Hbox();
private ADWindowPanel windowPanel;
private int windowNo;
private GridTab gridTab;
private int pageId = 0;
private ListHead listHead;
private boolean init;
public GridPanel()
{
super();
listbox = new Listbox();
}
public GridPanel(int windowNo, ADWindowPanel windowPanel)
public GridPanel(int windowNo)
{
this.windowNo = windowNo;
this.windowPanel = windowPanel;
listbox = new Listbox();
}
public void init(GridTab gridTab)
{
if (init) return;
this.gridTab = gridTab;
tableModel = gridTab.getTableModel();
@ -94,10 +86,34 @@ public class GridPanel extends Panel implements EventListener
gridField = ((GridTable)tableModel).getFields();
loadButtons();
loadGridHeader();
loadRecords(0, pageSize);
loadDisplay();
setupColumns();
render();
listbox.setSelectedIndex(gridTab.getCurrentRow());
this.init = true;
}
public boolean isInit() {
return init;
}
public void activate(GridTab gridTab) {
if (isInit())
refresh(gridTab);
else
init(gridTab);
}
public void refresh(GridTab gridTab) {
this.gridTab = gridTab;
tableModel = gridTab.getTableModel();
numRows = tableModel.getRowCount();
gridField = ((GridTable)tableModel).getFields();
updateModel();
listbox.setSelectedIndex(gridTab.getCurrentRow());
}
public void setPageSize(int pageSize)
@ -118,154 +134,73 @@ public class GridPanel extends Panel implements EventListener
this.setVisible(false);
}
private void loadGridHeader()
{
if (grid.getColumns() != null)
return;
private void setupColumns()
{
if (init) return;
columns = new Columns();
ListHead header = new ListHead();
header.setSizable(true);
Map colnames = new HashMap<Integer, String>();
int index = 0;
for (int i = 0; i < numColumns; i++)
{
if (gridField[i].isDisplayed())
{
column = new Column(gridField[i].getHeader());
columns.appendChild(column);
colnames.put(index, gridField[i].getHeader());
index++;
ListHeader colHeader = new ListHeader();
colHeader.setSort("auto");
colHeader.setLabel(gridField[i].getHeader());
int l = gridField[i].getDisplayLength() * 10;
if (l > 300)
l = 300;
else if ( l < 100)
l = 100;
colHeader.setWidth(Integer.toString(l) + "px");
header.appendChild(colHeader);
}
}
grid.appendChild(columns);
}
listbox.appendChild(header);
}
private void loadButtons()
private void render()
{
double pages = (double)numRows / (double)pageSize;
pages = Math.ceil(pages);
numPages = Math.round(pages);
LayoutUtils.addSclass("adtab-grid-panel", this);
if (numPages == 1)
return;
listbox.setVflex(true);
listbox.addEventListener(Events.ON_SELECT, this);
buttons = new Button[(int)numPages];
LayoutUtils.addSclass("adtab-grid", listbox);
if (boxButtons.getChildren() != null)
boxButtons.getChildren().clear();
for (int i = 0; i < buttons.length; i++)
{
Integer count = i;
buttons[i] = new Button();
buttons[i].setId(count.toString());
buttons[i].addEventListener(Events.ON_CLICK, this);
buttons[i].setLabel(count.toString());
boxButtons.appendChild(buttons[i]);
}
updateModel();
this.appendChild(listbox);
}
private String getCell(Object obj, int columnIndex)
{
if (obj == null)
return "";
if (tableModel.getColumnClass(columnIndex).equals(Integer.class))
{
if (gridField[columnIndex].isLookup())
{
MLookup lookup = MLookupFactory.get(
Env.getCtx(), windowNo, 0, gridField[columnIndex].getAD_Column_ID(),
gridField[columnIndex].getDisplayType());
NamePair namepair = lookup.get(obj);
if (namepair != null)
return namepair.getName();
else
return "";
}
else
return "Lookup";
}
else if (tableModel.getColumnClass(columnIndex).equals(Timestamp.class))
{
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date);
return dateFormat.format((Timestamp)obj);
}
else
return obj.toString();
}
private void loadRecords(int start, int end)
{
if (grid.getRows() != null)
grid.getRows().getChildren().clear();
if (rows.getChildren() != null)
rows.getChildren().clear();
if (end > numRows)
end = numRows;
for (int i = start; i < end; i++)
{
row = new Row();
for (int j = 0; j < numColumns; j++)
{
if (!gridField[j].isDisplayed())
break;
label = new Label(getCell(tableModel.getValueAt(i, j), j));
row.appendChild(label);
}
rows.appendChild(row);
}
if (grid.getRows() == null)
grid.appendChild(rows);
private void updateModel() {
GridTableListModel listModel = new GridTableListModel((GridTable)tableModel, windowNo);
listbox.setItemRenderer(listModel);
listbox.setModel(listModel);
}
private void loadDisplay()
{
this.setWidth("800px");
//this.setHeight("1000px");
grid.setWidth("100%");
grid.setHeight("800px");
grid.addEventListener(Events.ON_SELECT, this);
boxButtons.setWidth("60%");
this.appendChild(grid);
this.appendChild(new Separator());
this.appendChild(boxButtons);
public void deactivate() {
ListitemRenderer lr = null;
listbox.setItemRenderer(lr);
listbox.setModel(null);
}
public void onEvent(Event event) throws Exception
{
{
if (event == null)
return;
if (event.getTarget() instanceof Button)
return;
else if (event.getTarget() == listbox)
{
Button btn = (Button)event.getTarget();
pageId = new Integer(btn.getId());
int start = pageId * pageSize;
int end = start + pageSize;
loadRecords(start, end);
}
else if (event.getTarget() == grid)
{
int keyRecordId = grid.getSelectedIndex() + (pageId * pageSize);
gridTab.navigate(keyRecordId);
this.setVisible(false);
windowPanel.showTabbox(true);
gridTab.navigate(listbox.getSelectedIndex());
}
}
public Listbox getListbox() {
return listbox;
}
}

View File

@ -0,0 +1,154 @@
package org.adempiere.webui.component;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import org.compiere.model.DataStatusEvent;
import org.compiere.model.DataStatusListener;
import org.compiere.model.GridField;
import org.compiere.model.GridTable;
import org.compiere.model.MLookup;
import org.compiere.model.MLookupFactory;
import org.compiere.util.DisplayType;
import org.compiere.util.Env;
import org.compiere.util.NamePair;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.AbstractListModel;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listcell;
import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer;
import org.zkoss.zul.ListitemRendererExt;
import org.zkoss.zul.event.ListDataEvent;
public class GridTableListModel extends AbstractListModel implements ListitemRenderer, ListitemRendererExt, DataStatusListener {
private GridTable tableModel;
private GridField[] gridField;
private int windowNo;
public GridTableListModel(GridTable tableModel, int windowNo) {
this.tableModel = tableModel;
this.windowNo = windowNo;
gridField = tableModel.getFields();
tableModel.addDataStatusListener(this);
}
public Object getElementAt(int rowIndex) {
int columnCount = tableModel.getColumnCount();
Object[] values = new Object[columnCount];
if (rowIndex < tableModel.getRowCount()) {
for (int i = 0; i < columnCount; i++) {
values[i] = tableModel.getValueAt(rowIndex, i);
}
}
return values;
}
public int getSize() {
return tableModel.getRowCount();
}
public void render(Listitem listitem, Object data) throws Exception {
Object[] values = (Object[])data;
int columnCount = tableModel.getColumnCount();
for (int i = 0; i < columnCount; i++) {
if (!gridField[i].isDisplayed()) {
continue;
}
Listcell cell = null;
if (gridField[i].getDisplayType() == DisplayType.YesNo) {
cell = new Listcell("", null);
cell.setParent(listitem);
cell.setStyle("text-align:center");
Checkbox checkBox = new Checkbox();
if (values[i] != null && "true".equalsIgnoreCase(values[i].toString()))
checkBox.setChecked(true);
else
checkBox.setChecked(false);
checkBox.setDisabled(true);
checkBox.setParent(cell);
} else {
cell = new Listcell(getCell(values[i], i), null);
cell.setParent(listitem);
}
CellListener listener = new CellListener((Listbox) listitem.getParent());
cell.addEventListener(Events.ON_DOUBLE_CLICK, listener);
}
}
class CellListener implements EventListener {
private Listbox _listbox;
public CellListener(Listbox listbox) {
_listbox = listbox;
}
public void onEvent(Event event) throws Exception {
if (Events.ON_DOUBLE_CLICK.equals(event.getName())) {
Event evt = new Event(Events.ON_DOUBLE_CLICK, _listbox);
Events.sendEvent(_listbox, evt);
}
}
}
private String getCell(Object obj, int columnIndex)
{
if (obj == null)
return "";
if (tableModel.getColumnClass(columnIndex).equals(Integer.class))
{
if (gridField[columnIndex].isLookup())
{
MLookup lookup = MLookupFactory.get(
Env.getCtx(), windowNo, 0, gridField[columnIndex].getAD_Column_ID(),
gridField[columnIndex].getDisplayType());
NamePair namepair = lookup.get(obj);
if (namepair != null)
return namepair.getName();
else
return "";
}
else
return "Lookup";
}
else if (tableModel.getColumnClass(columnIndex).equals(Timestamp.class))
{
SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date);
return dateFormat.format((Timestamp)obj);
}
else
return obj.toString();
}
public int getControls() {
return DETACH_ON_RENDER;
}
public Listcell newListcell(Listitem item) {
return null;
}
public Listitem newListitem(Listbox listbox) {
ListItem item = new ListItem();
item.applyProperties();
return item;
}
public void dataStatusChanged(DataStatusEvent e) {
if (Executions.getCurrent() != null) {
fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1);
}
}
}

View File

@ -0,0 +1,41 @@
package org.adempiere.webui.component;
import org.adempiere.webui.panel.ADTabpanel;
import org.adempiere.webui.part.UIPart;
import org.compiere.model.DataStatusEvent;
import org.compiere.model.GridTab;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.EventListener;
/**
*
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
*
*/
public interface IADTab extends UIPart {
public int getSelectedIndex();
public boolean canNavigateTo(int fromIndex, int toIndex);
public void addTab(GridTab tab, ADTabpanel tabPanel);
public void setSelectedIndex(int i);
public int getTabCount();
public void evaluate(DataStatusEvent e);
public boolean updateSelectedIndex(int oldTabIndex, int newTabIndex);
public ADTabpanel getSelectedTabpanel();
public String getPath();
public void addSelectionEventListener(
EventListener listener);
public Component getTabSelectionComponent();
public boolean isUseExternalSelection();
}

View File

@ -0,0 +1,16 @@
package org.adempiere.webui.component;
/**
*
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
*
*/
public interface IADTabList {
int getSelectedIndex();
void setSelectedIndex(int curTabIndex);
void refresh();
}

View File

@ -18,6 +18,7 @@
package org.adempiere.webui.component;
import org.adempiere.webui.apps.AEnv;
import org.zkoss.zhtml.Text;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
@ -39,7 +40,8 @@ public class Messagebox extends Window implements EventListener
private String msg = new String("");
private String imgSrc = new String("");
private Label lblMsg = new Label();
// private Label lblMsg = new Label();
private Text lblMsg = new Text();
private Button btnOk = new Button();
private Button btnCancel = new Button();
@ -216,12 +218,19 @@ public class Messagebox extends Window implements EventListener
this.setPosition("center");
this.setClosable(true);
this.setAttribute("mode", "modal");
this.setSizable(true);
}
else
{
this.setTitle(title);
this.setAttribute("mode", "overlapped");
this.setWidth("500px");
this.setClosable(true);
this.setSizable(true);
}
this.setVisible(true);
AEnv.showWindow(this);
AEnv.showCenterScreen(this);
return returnValue;
}

View File

@ -37,4 +37,10 @@ public class Tab extends org.zkoss.zul.Tab
}
@Override
public void onClose() {
Tabpanel tp = (Tabpanel) getLinkedPanel();
tp.onClose();
}
}

View File

@ -17,6 +17,9 @@
package org.adempiere.webui.component;
import org.adempiere.webui.LayoutUtils;
import org.zkoss.zk.ui.Component;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zul.Tabpanels;
/**
@ -47,4 +50,19 @@ public class Tabbox extends org.zkoss.zul.Tabbox
{
return getTabpanel(this.getSelectedIndex());
}
/*
public void onEcho()
{
Tabpanel tp = (Tabpanel) this.getSelectedPanel();
Component child = tp.getFirstChild();
if (!child.isVisible())
{
child.setVisible(true);
if (child instanceof Borderlayout)
{
LayoutUtils.sendDeferLayoutEvent((Borderlayout) child, true);
}
}
}*/
}

View File

@ -17,6 +17,11 @@
package org.adempiere.webui.component;
import java.util.List;
import org.adempiere.webui.panel.ITabOnCloseHandler;
import org.zkoss.zul.Tab;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
@ -27,8 +32,12 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel
{
private static final long serialVersionUID = 1L;
private ITabOnCloseHandler onCloseHandler = null;
private boolean enabled;
private int tabLevel;
public boolean isEnabled()
{
return enabled;
@ -38,4 +47,40 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel
{
this.enabled = enabled;
}
public int getTabLevel()
{
return tabLevel;
}
public void setTabLevel(int l)
{
tabLevel = l;
}
public void onClose() {
if (onCloseHandler != null)
onCloseHandler.onClose(this);
else {
Tab tab = this.getLinkedTab();
Tabbox tabbox = (Tabbox) tab.getTabbox();
if (tabbox.getSelectedTab() == tab) {
Tabs tabs = (Tabs) tabbox.getTabs();
List childs = tabs.getChildren();
for(int i = 0; i < childs.size(); i++) {
if (childs.get(i) == tab) {
if (i > 0)
tabbox.setSelectedIndex((i-1));
break;
}
}
}
this.detach();
tab.detach();
}
}
public void setOnCloseHandler(ITabOnCloseHandler handler) {
this.onCloseHandler = handler;
}
}

View File

@ -26,4 +26,30 @@ public class ToolBarButton extends org.zkoss.zul.Toolbarbutton
private static final long serialVersionUID = 0L;
private String name;
public ToolBarButton() {}
@Override
public void setDisabled(boolean disabled) {
super.setDisabled(disabled);
if (disabled) {
this.setSclass("disableFilter");
} else {
this.setSclass("");
}
}
public ToolBarButton(String name) {
super();
this.name = name;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -1,40 +0,0 @@
/******************************************************************************
* Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/
package org.adempiere.webui.constants;
import org.zkoss.zul.Constraint;
import org.zkoss.zul.SimpleConstraint;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 18, 2007
* @version $Revision: 0.10 $
*/
public class Constraints
{
public static final Constraint MANDATORY;
public static final Constraint NO_CONSTRAINT;
static
{
MANDATORY = new SimpleConstraint(SimpleConstraint.NO_EMPTY);
NO_CONSTRAINT = (Constraint)null;
}
}

View File

@ -1,34 +0,0 @@
/******************************************************************************
* Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/
package org.adempiere.webui.constants;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 18, 2007
* @version $Revision: 0.10 $
*/
public class EventConstants
{
public static final String ONCLICK = "onClick";
public static final String ONCHANGE = "onChange";
public static final String ONSELECT = "onSelect";
}

View File

@ -148,7 +148,6 @@ public abstract class WEditor implements EventListener, PropertyChangeListener
label.setValue(strLabel);
label.setTooltiptext(description);
this.setMandatory (mandatory);
if (readOnly || !updateable)

View File

@ -45,8 +45,6 @@ public interface ToolbarListener
public void onRefresh();
public void onExit();
public void onPrint();
public void onReport();

View File

@ -65,6 +65,11 @@ public abstract class ADForm extends Window implements EventListener
protected ADForm()
{
m_windowNo = SessionManager.getAppDesktop().registerWindow(this);
this.setWidth("100%");
this.setHeight("95%");
this.setStyle("position:absolute");
this.setContentSclass("adform-content");
}
protected int getWindowNo()

View File

@ -18,12 +18,18 @@
package org.adempiere.webui.panel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.GridPanel;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.ToolBar;
import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.editor.WEditor;
import org.adempiere.webui.editor.WEditorPopupMenu;
@ -39,12 +45,21 @@ import org.compiere.model.GridTab;
import org.compiere.model.GridTable;
import org.compiere.model.GridWindow;
import org.compiere.model.MLookup;
import org.compiere.model.X_AD_FieldGroup;
import org.compiere.util.CLogger;
import org.compiere.util.Env;
import org.compiere.util.Evaluatee;
import org.zkoss.zhtml.Span;
import org.zkoss.zhtml.Text;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Image;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Toolbarbutton;
/**
*
@ -58,7 +73,7 @@ import org.zkoss.zul.Image;
* @version $Revision: 0.10 $
*
*/
public class ADTabpanel extends Tabpanel implements Evaluatee, EventListener,
public class ADTabpanel extends Div implements Evaluatee, EventListener,
DataStatusListener, ValueChangeListener
{
@ -69,13 +84,11 @@ DataStatusListener, ValueChangeListener
logger = CLogger.getCLogger(ADTabpanel.class);
}
private Image panelImage;
private GridTab gridTab;
private GridWindow gridWindow;
private ADWindowPanel windowPanel;
private AbstractADWindowPanel windowPanel;
private int windowNo;
@ -84,30 +97,43 @@ DataStatusListener, ValueChangeListener
private ArrayList<WEditor> editors = new ArrayList<WEditor>();
private boolean editing;
private boolean uiCreated = false;
private GridPanel listPanel;
private Map<String, List<Row>> fieldGroups = new HashMap<String, List<Row>>();
public ADTabpanel()
{
private ArrayList<Row> rowList;
public ADTabpanel()
{
init();
}
private void init()
{
initComponents();
// this.appendChild(panelImage);
// this.appendChild(grid);
}
private void initComponents()
{
LayoutUtils.addSclass("adtab-content", this);
grid = new Grid();
grid.setWidth("750px");
//have problem moving the following out as css class
grid.setWidth("99%");
grid.setHeight("100%");
grid.setStyle("margin:0; padding:0; position: absolute");
grid.setSclass("grid-no-striped");
grid.setOddRowSclass("even");
panelImage = new Image();
// panelImage.setSrc("/images/loading.png");
listPanel = new GridPanel();
listPanel.getListbox().addEventListener(Events.ON_DOUBLE_CLICK, this);
}
public void init(ADWindowPanel winPanel, int windowNo, GridTab gridTab,
public void init(AbstractADWindowPanel winPanel, int windowNo, GridTab gridTab,
GridWindow gridWindow)
{
this.windowNo = windowNo;
@ -115,29 +141,120 @@ DataStatusListener, ValueChangeListener
this.gridTab = gridTab;
this.windowPanel = winPanel;
gridTab.addDataStatusListener(this);
initGrid();
}
private void initGrid()
public void createUI()
{
if (uiCreated) return;
Rows rows = new Rows();
GridField fields[] = gridTab.getFields();
Row row = new Row();
String currentFieldGroup = null;
for (int i = 0; i < fields.length; i++)
{
GridField field = fields[i];
if (field.isDisplayed())
{
String fieldGroup = field.getFieldGroup();
if (fieldGroup != null && fieldGroup.trim().length() > 0)
{
if (!fieldGroup.equals(currentFieldGroup))
{
currentFieldGroup = fieldGroup;
if (row.getChildren().size() == 2)
{
row.appendChild(createSpacer());
row.appendChild(createSpacer());
row.appendChild(createSpacer());
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
} else if (row.getChildren().size() > 0)
{
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
}
row.setSpans("5");
row.appendChild(new Separator());
rows.appendChild(row);
if (X_AD_FieldGroup.FIELDGROUPTYPE_Collapse.equals(field.getFieldGroupType()) ||
X_AD_FieldGroup.FIELDGROUPTYPE_Tab.equals(field.getFieldGroupType()))
{
rowList = new ArrayList<Row>();
fieldGroups.put(fieldGroup, rowList);
}
else
{
rowList = null;
}
row = new Row();
row.setSpans("4");
if (rowList == null)
{
Label groupLabel = new Label(fieldGroup);
row.appendChild(groupLabel);
row.appendChild(createSpacer());
rows.appendChild(row);
}
else
{
ToolBar toolbar = new ToolBar();
Toolbarbutton button = new Toolbarbutton(fieldGroup, "images/ns-collapse.gif");
button.addEventListener(Events.ON_CLICK, this);
button.setParent(toolbar);
row.appendChild(toolbar);
row.appendChild(createSpacer());
rows.appendChild(row);
}
if (rowList == null) {
row = new Row();
row.setSpans("4");
Separator separator = new Separator();
separator.setBar(true);
row.appendChild(separator);
row.appendChild(createSpacer());
rows.appendChild(row);
}
row = new Row();
}
}
if (!field.isSameLine())
{
if (row.getChildren().size() == 2)
{
row.appendChild(new Label(" "));
row.appendChild(new Label(" "));
}
rows.appendChild(row);
row = new Row();
if(row.getChildren().size() > 0)
{
if (row.getChildren().size() == 2)
{
row.appendChild(createSpacer());
row.appendChild(createSpacer());
row.appendChild(createSpacer());
}
{
row.appendChild(createSpacer());
}
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
}
}
else if (row.getChildren().size() == 4)
{
row.appendChild(createSpacer());
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
}
WEditor comp = WebEditorFactory.getEditor(field, false);
@ -146,8 +263,19 @@ DataStatusListener, ValueChangeListener
comp.setGridTab(this.getGridTab());
field.addPropertyChangeListener(comp);
editors.add(comp);
row.appendChild(comp.getLabel());
Div div = new Div();
div.setAlign("right");
div.appendChild(comp.getLabel());
row.appendChild(div);
row.appendChild(comp.getComponent());
if (field.isLongField()) {
row.setSpans("1,3,1");
row.appendChild(createSpacer());
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
row = new Row();
}
if (comp instanceof WButtonEditor)
{
@ -158,6 +286,10 @@ DataStatusListener, ValueChangeListener
comp.addValueChangeListner(this);
}
if (comp.getComponent() instanceof HtmlBasedComponent) {
((HtmlBasedComponent)comp.getComponent()).setWidth("100%");
}
WEditorPopupMenu popupMenu = comp.getPopupMenu();
if (popupMenu != null)
@ -172,14 +304,26 @@ DataStatusListener, ValueChangeListener
{
if (row.getChildren().size() == 2)
{
row.appendChild(new Label(" "));
row.appendChild(new Label(" "));
row.appendChild(createSpacer());
row.appendChild(createSpacer());
row.appendChild(createSpacer());
}
rows.appendChild(row);
if (rowList != null)
rowList.add(row);
}
grid.appendChild(rows);
uiCreated = true;
}
private Component createSpacer() {
Span span = new Span();
Text text = new Text("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;");
text.setParent(span);
span.setStyle("width: 100%");
return span;
}
public void dynamicDisplay (int col)
{
@ -319,7 +463,21 @@ DataStatusListener, ValueChangeListener
this.appendChild(grid);
}
grid.setVisible(activate);
if (!this.getChildren().contains(listPanel))
{
this.appendChild(listPanel);
listPanel.setVisible(false);
}
if (listPanel.isVisible()) {
if (activate)
listPanel.activate(gridTab);
else
listPanel.deactivate();
} else {
if (activate)
grid.setVisible(activate);
}
}
public boolean isEditing()
@ -343,31 +501,32 @@ DataStatusListener, ValueChangeListener
public void onEvent(Event event)
{
/* if (event == null)
return;
if (event.getTarget() == listView)
{
keyRecordId = listView.getSelectedIndex();
//Object value = gridTab.getValue(keyRecordId, keyColumnName);
//MQuery mquery = MQuery.getEqualQuery(keyColumnName, value);
}
else if (confirmPanel.getButton("Ok").equals(event.getTarget()))
{
gridTab.navigate(keyRecordId);
gridView.setVisible(false);
}
else if (confirmPanel.getButton("Cancel").equals(event.getTarget()))
{
gridView.setVisible(false);
windowPanel.showTabbox(true);
}*/
if (event.getTarget() instanceof Toolbarbutton)
{
Toolbarbutton button = (Toolbarbutton) event.getTarget();
List<Row> list = fieldGroups.get(button.getLabel());
if (list.get(0).isVisible()) {
for (Row row : list) {
row.setVisible(false);
}
button.setImage("images/ns-expand.gif");
} else {
for (Row row : list) {
row.setVisible(true);
}
button.setImage("images/ns-collapse.gif");
}
} else if (event.getTarget() instanceof Listbox)
{
this.switchRowPresentation();
}
}
public void dataStatusChanged(DataStatusEvent e)
{
//TODO: ignore non-ui thread event for now
if (Executions.getCurrent() == null) return;
int col = e.getChangedColumn();
logger.config("(" + gridTab + ") Col=" + col + ": " + e.toString());
@ -453,4 +612,16 @@ DataStatusListener, ValueChangeListener
}
} // ValueChange
public void switchRowPresentation() {
if (grid.isVisible()) {
grid.setVisible(false);
} else {
grid.setVisible(true);
}
listPanel.setVisible(!grid.isVisible());
if (listPanel.isVisible()) {
listPanel.activate(gridTab);
}
}
}

View File

@ -17,22 +17,26 @@
package org.adempiere.webui.panel;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.session.SessionManager;
import org.adempiere.webui.window.AboutWindow;
import org.compiere.model.MSysConfig;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hbox;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.East;
import org.zkoss.zkex.zul.West;
import org.zkoss.zul.Image;
import org.zkoss.zul.Label;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
* @date Mar 2, 2007
* @version $Revision: 0.10 $
* @date July 7, 2007
* @version $Revision: 0.20 $
*/
public class HeaderPanel extends Panel implements EventListener
@ -40,7 +44,6 @@ public class HeaderPanel extends Panel implements EventListener
private static final long serialVersionUID = -4293371180738797244L;
private Image image = new Image();
private SideUserPanel pnlSideUser;
public HeaderPanel()
{
@ -50,44 +53,52 @@ public class HeaderPanel extends Panel implements EventListener
private void init()
{
pnlSideUser = new SideUserPanel();
this.setSclass("header");
Hbox hbox = new Hbox();
hbox.setWidth("100%");
hbox.setWidths("300px, 550px, 350px");
Panel right = new Panel();
right.setWidth("100%");
right.setStyle("text-align:right");
Panel left = new Panel();
left.setWidth("100%");
left.setStyle("text-align:center");
UserPanel userPanel = new UserPanel();
right.appendChild(pnlSideUser);
String homeURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/logo_ad.png");
image.setSrc(homeURL);
String logoURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/AD10030.png");
image.setSrc(logoURL);
image.addEventListener(Events.ON_CLICK, this);
left.appendChild(image);
image.setStyle("cursor: pointer;");
Borderlayout layout = new Borderlayout();
LayoutUtils.addSclass("header", layout);
layout.setParent(this);
West west = new West();
west.setParent(layout);
hbox.appendChild(left);
hbox.appendChild(new Label(""));
hbox.appendChild(right);
Vbox vb = new Vbox();
vb.setParent(west);
vb.setHeight("100%");
vb.setWidth("100%");
vb.setPack("center");
vb.setAlign("left");
image.setParent(vb);
LayoutUtils.addSclass("header-left", west);
//the following doesn't work when declare as part of the header-left style
west.setStyle("background-color: transparent; border: none;");
this.setWidth("100%");
this.appendChild(new Separator());
this.appendChild(hbox);
this.appendChild(new Separator());
East east = new East();
east.setParent(layout);
userPanel.setParent(east);
userPanel.setHeight("100%");
east.setFlex(true);
LayoutUtils.addSclass("header-right", east);
//the following doesn't work when declare as part of the header-right style
east.setStyle("background-color: transparent; border: none;");
}
public void onEvent(Event event) throws Exception {
if (event == null)
return;
if (event.getTarget() == image){
String homeURL = MSysConfig.getValue("WEBUI_HOMEURL", "http://www.adempiere.com/");
SessionManager.getAppDesktop().showURL(homeURL, true);
if (Events.ON_CLICK.equals(event.getName())) {
AboutWindow w = new AboutWindow();
w.setPage(this.getPage());
w.setPosition("center");
w.setTitle("About ADempiere");
w.setClosable(true);
w.doModal();
}
}

View File

@ -0,0 +1,7 @@
package org.adempiere.webui.panel;
import org.adempiere.webui.component.Tabpanel;
public interface ITabOnCloseHandler {
public void onClose(Tabpanel tabPanel);
}

View File

@ -33,11 +33,14 @@ import org.compiere.util.KeyNamePair;
import org.compiere.util.Language;
import org.compiere.util.Login;
import org.compiere.util.ValueNamePair;
import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.WrongValueException;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Image;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
@ -71,13 +74,23 @@ public class LoginPanel extends Window implements EventListener
initComponents();
init();
this.setId("loginPanel");
AuFocus auf = new AuFocus(txtUserId);
Clients.response(auf);
}
private void init()
{
Grid grid = new Grid();
//grid.setSclass("grid-no-striped");
grid.setOddRowSclass("even");
grid.setId("grdLogin");
Rows rows = new Rows();
Row logo = new Row();
logo.setSpans("2");
Image image = new Image();
image.setSrc("images/Logo.gif");
logo.appendChild(image);
Row rowUser = new Row();
rowUser.setId("rowUser");
Row rowPassword = new Row();
@ -105,6 +118,7 @@ public class LoginPanel extends Window implements EventListener
//pnlButtons.appendChild(btnCancel);
rowButtons.appendChild(pnlButtons);
rows.appendChild(logo);
rows.appendChild(rowUser);
rows.appendChild(rowPassword);
rows.appendChild(rowLanguage);

View File

@ -21,10 +21,8 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Properties;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.constants.EventConstants;
import org.adempiere.webui.event.MenuListener;
import org.adempiere.webui.exception.ApplicationException;
import org.adempiere.webui.session.SessionManager;
@ -35,7 +33,10 @@ import org.compiere.util.Env;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zul.Separator;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.South;
import org.zkoss.zul.Tree;
import org.zkoss.zul.Treechildren;
import org.zkoss.zul.Treecol;
@ -48,7 +49,7 @@ import org.zkoss.zul.Treeitem;
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class MenuPanel extends Window implements EventListener
public class MenuPanel extends Panel implements EventListener
{
private static final long serialVersionUID = 1L;
@ -77,31 +78,47 @@ public class MenuPanel extends Window implements EventListener
private void init()
{
this.setWidth("100%");
this.setHeight("100%");
this.setStyle("position:absolute;border:0;padding:0;margin:0");
menuTree = new Tree();
menuTree.setMultiple(false);
menuTree.setId("mnuMain");
menuTree.addEventListener(EventConstants.ONSELECT, this);
menuTree.setWidth("250px");
menuTree.setHeight("550px");
menuTree.setVflex(true);
menuTree.addEventListener(Events.ON_SELECT, this);
menuTree.setWidth("100%");
menuTree.setHeight("100%");
menuTree.setVflex(false);
menuTree.setPageSize(-1); // Due to bug in the new paging functionality
Panel menuPanel = new Panel();
menuTree.setStyle("border:0");
Borderlayout layout = new Borderlayout();
layout.setParent(this);
layout.setStyle("position:absolute");
layout.setWidth("100%");
layout.setHeight("100%");
South south = new South();
south.setParent(layout);
pnlSearch = new MenuSearchPanel(this);
menuPanel.appendChild(new Separator());
menuPanel.appendChild(pnlSearch);
menuPanel.appendChild(new Separator());
menuPanel.appendChild(new Separator());
menuPanel.appendChild(new Separator());
menuPanel.appendChild(menuTree);
this.appendChild(menuPanel);
pnlSearch.setParent(south);
LayoutUtils.addSclass("menu-search", pnlSearch);
Center center = new Center();
center.setFlex(true);
center.setAutoscroll(true);
center.setParent(layout);
menuTree.setParent(center);
}
private void initMenu(MTreeNode rootNode)
{
Treecols treeCols = new Treecols();
Treecol treeCol = new Treecol();
treeCol.setLabel(AdempiereWebUI.UID);
treeCol.setLabel("Menu");
Treechildren rootTreeChildren = new Treechildren();
generateMenu(rootTreeChildren, rootNode);
@ -183,7 +200,7 @@ public class MenuPanel extends Window implements EventListener
Component comp = event.getTarget();
String eventName = event.getName();
if(eventName.equals(EventConstants.ONSELECT))
if(eventName.equals(Events.ON_SELECT))
{
if(comp.equals(menuTree))
{
@ -217,11 +234,6 @@ public class MenuPanel extends Window implements EventListener
}
}
public void setWidth(String width)
{
menuTree.setWidth(width);
}
public boolean isAsap()
{
return true;

View File

@ -25,12 +25,15 @@ import org.adempiere.webui.exception.ApplicationException;
import org.adempiere.webui.window.LoginWindow;
import org.compiere.util.KeyNamePair;
import org.compiere.util.Login;
import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Button;
import org.zkoss.zul.Div;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Image;
import org.zkoss.zul.Label;
import org.zkoss.zul.Listbox;
import org.zkoss.zul.Listitem;
@ -69,13 +72,24 @@ public class RolePanel extends Window implements EventListener
initComponents();
init();
this.setId("rolePanel");
AuFocus auf = new AuFocus(lstRole);
Clients.response(auf);
}
private void init()
{
Grid grid = new Grid();
grid.setId("grdChooseRole");
grid.setOddRowSclass("even");
Rows rows = new Rows();
Row logo = new Row();
logo.setSpans("2");
Image image = new Image();
image.setSrc("images/Logo.gif");
logo.appendChild(image);
Row rowRole = new Row();
Row rowClient = new Row();
Row rowOrg = new Row();
@ -105,6 +119,7 @@ public class RolePanel extends Window implements EventListener
rowButtons.setSpans("2");
rowButtons.appendChild(pnlButtons);
rows.appendChild(logo);
rows.appendChild(rowRole);
rows.appendChild(rowClient);
rows.appendChild(rowOrg);

View File

@ -18,9 +18,6 @@
package org.adempiere.webui.panel;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.VerticalBox;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
/**
*
@ -28,24 +25,11 @@ import org.zkoss.zk.ui.event.EventListener;
* @date Mar 2, 2007
* @version $Revision: 0.10 $
*/
public class SidePanel extends Panel implements EventListener
public class SidePanel extends Panel
{
private static final long serialVersionUID = 1L;
private RequestNoticePanel pnlRequestNotice;
private MenuPanel pnlMenu;
//private SideUserPanel pnlSideUser;
//private HeaderPanel pnlHead;
/* private Tabs tabs = new Tabs();
private Tab tabUser = new Tab();
private Tab tabSearch = new Tab();
private Tab tabMenu = new Tab();
private Tabpanels tabpanels = new Tabpanels();
private Tabbox tabbox = new Tabbox();
*/
public SidePanel()
{
init();
@ -53,60 +37,16 @@ public class SidePanel extends Panel implements EventListener
private void init()
{
pnlRequestNotice = new RequestNoticePanel();
pnlMenu = new MenuPanel();
//pnlSideUser = new SideUserPanel();
//pnlHead = new HeaderPanel();
/* tabUser.setLabel("Logout");
tabSearch.setLabel("Search");
tabMenu.setLabel("Menu");
tabs.appendChild(tabUser);
tabs.appendChild(tabSearch);
tabs.appendChild(tabMenu);
Tabpanel tabPanelMenu = new Tabpanel();
tabPanelMenu.appendChild(new Separator());
tabPanelMenu.appendChild(pnlMenu.getSearchPanel());
tabPanelMenu.appendChild(new Separator());
tabpanels.appendChild(pnlSideUser);
tabpanels.appendChild(tabPanelMenu);
tabpanels.appendChild(pnlMenu);
tabbox.setWidth("300px");
tabbox.setOrient("horizontal");
tabbox.setMold("accordion");
tabbox.appendChild(tabs);
tabbox.appendChild(tabpanels);*/
VerticalBox mainBox = new VerticalBox();
//mainBox.appendChild(pnlHead);
//mainBox.appendChild(pnlSideUser);
//Iframe menuFrame = new Iframe("/zul/menu.zul");
//menuFrame.setWidth("300px");
//menuFrame.setHeight("650px");
//mainBox.appendChild(menuFrame);
mainBox.appendChild(pnlMenu);
Panel pan = new Panel();
pan.setAlign("center");
pan.appendChild(mainBox);
this.setWidth("300px");
this.appendChild(pan);
this.setWidth("100%");
this.setHeight("100%");
this.setStyle("position:absolute");
this.appendChild(pnlMenu);
}
public MenuPanel getMenuPanel()
{
return pnlMenu;
}
public void onEvent(Event event) throws Exception
{
}
}

View File

@ -1,59 +0,0 @@
/******************************************************************************
* Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/
package org.adempiere.webui.panel;
import org.adempiere.webui.component.Panel;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 2, 2007
* @version $Revision: 0.10 $
*/
public class SideUserPanel extends Panel
{
private static final long serialVersionUID = 1L;
//private Hbox hBox;
private UserPanel pnlUser;
//private LogoutPanel pnlLogout;
public SideUserPanel()
{
super();
init();
}
private void init()
{
//hBox = new Hbox();
pnlUser = new UserPanel();
//pnlLogout = new LogoutPanel();
//hBox.appendChild(pnlUser);
//hBox.appendChild(pnlLogout);
this.setWidth("100%");
this.appendChild(new Separator());
this.appendChild(pnlUser);
this.appendChild(new Separator());
}
}

View File

@ -21,11 +21,11 @@ import java.util.Properties;
import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Messagebox;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MClient;
import org.compiere.model.MOrg;
import org.compiere.model.MRole;
import org.compiere.model.MUser;
import org.compiere.util.Env;
@ -33,6 +33,8 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Vbox;
/**
*
@ -40,16 +42,15 @@ import org.zkoss.zul.Hbox;
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class UserPanel extends Hbox implements EventListener
public class UserPanel extends Vbox implements EventListener
{
private static final long serialVersionUID = 1L;
private Properties ctx;
private Grid grid;
private Label lblPrefix = new Label("You are logged in as: ");
private Label lblSeparator = new Label(" | ");
private Label lblLogout = new Label("logoff");
private ToolBarButton logout = new ToolBarButton();
private ToolBarButton role = new ToolBarButton();
private Label lblUserNameValue = new Label();
@ -61,58 +62,32 @@ public class UserPanel extends Hbox implements EventListener
private void init()
{
lblLogout.setStyle("cursor: hand;");
this.setStyle("text-align:right");
lblPrefix.setStyle("font-style: bold;");
lblUserNameValue.setValue(getUserName());
lblLogout.addEventListener(Events.ON_CLICK, this);
//this.setWidth("200px");
this.appendChild(lblPrefix);
lblUserNameValue.setValue(getUserName() + "@" + getClientName() + "." + getOrgName());
lblUserNameValue.setStyle("text-align:right");
lblUserNameValue.setSclass("headerFont");
this.appendChild(lblUserNameValue);
this.appendChild(lblSeparator);
this.appendChild(lblLogout);
Hbox hbox = new Hbox();
/* grid = new Grid();
grid.setWidth("200px");
Rows rows = new Rows();
Label lblUserName = new Label();
Label lblUserNameValue = new Label();
lblUserName.setValue("User Name");
lblUserNameValue.setValue(getUserName());
Row row = new Row();
row.appendChild(lblUserName);
row.appendChild(lblUserNameValue);
rows.appendChild(row);
Label lblRole = new Label();
Label lblRoleValue = new Label();
lblRole.setValue("Role");
lblRoleValue.setValue(getRoleName());
row = new Row();
row.appendChild(lblRole);
row.appendChild(lblRoleValue);
rows.appendChild(row);
Label lblClient = new Label();
Label lblClientValue = new Label();
lblRole.setValue("Client");
lblRoleValue.setValue(getClientName());
row = new Row();
row.appendChild(lblClient);
row.appendChild(lblClientValue);
rows.appendChild(row);
grid.appendChild(rows);
this.appendChild(grid);*/
role.setLabel(this.getRoleName());
role.addEventListener(Events.ON_CLICK, this);
role.setStyle("text-align:right");
role.setSclass("headerFont");
role.setParent(hbox);
Separator sep = new Separator("vertical");
sep.setBar(true);
sep.setParent(hbox);
logout.setLabel("Logout");
logout.addEventListener(Events.ON_CLICK, this);
logout.setStyle("text-align:right");
logout.setSclass("headerFont");
logout.setParent(hbox);
this.appendChild(hbox);
}
private String getUserName()
@ -132,15 +107,35 @@ public class UserPanel extends Hbox implements EventListener
MClient client = MClient.get(ctx);
return client.getName();
}
private String getOrgName()
{
int orgId = Env.getAD_Org_ID(ctx);
if (orgId > 0)
{
MOrg org = MOrg.get(ctx, orgId);
return org.getName();
}
else
{
return "*";
}
}
public void onEvent(Event event) throws Exception {
if (event == null)
return;
if (lblLogout == event.getTarget())
if (logout == event.getTarget())
{
SessionManager.logoutSession();
}
else if (role == event.getTarget())
{
String roleInfo = MRole.getDefault().toStringX(Env.getCtx());
roleInfo = roleInfo.replace(Env.NL, "<br>");
Messagebox.showDialog(roleInfo, "Role Info", Messagebox.OK, Messagebox.INFORMATION);
}
}
}

View File

@ -27,7 +27,6 @@ import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Textbox;
import org.adempiere.webui.component.VerticalBox;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.window.FDialog;
import org.compiere.model.MAttachment;
@ -40,13 +39,16 @@ import org.zkoss.util.media.Media;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zkex.zul.Borderlayout;
import org.zkoss.zkex.zul.Center;
import org.zkoss.zkex.zul.North;
import org.zkoss.zkex.zul.South;
import org.zkoss.zkex.zul.West;
import org.zkoss.zul.Filedownload;
import org.zkoss.zul.Fileupload;
import org.zkoss.zul.Hbox;
import org.zkoss.zul.Iframe;
import org.zkoss.zul.Image;
import org.zkoss.zul.Separator;
import org.zkoss.zul.Splitter;
public class WAttachment extends Window implements EventListener
{
@ -63,15 +65,12 @@ public class WAttachment extends Window implements EventListener
/** Change */
private boolean m_change = false;
private Iframe pdfViewer = new Iframe();
private Iframe preview = new Iframe();
private Textbox text = new Textbox();
private Textbox info = new Textbox();
private Listbox cbContent = new Listbox();
private Image gifPanel = new Image();
private Button bDelete = new Button();
private Button bOpen = new Button();
private Button bSave = new Button();
@ -82,12 +81,9 @@ public class WAttachment extends Window implements EventListener
private Panel graphPanel = new Panel();
private VerticalBox mainPanel = new VerticalBox();
private Borderlayout mainPanel = new Borderlayout();
private Panel northPanel = new Panel();
private Hbox toolBar = new Hbox();
private Hbox centerPane = new Hbox();
private Hbox toolBar = new Hbox();
private Hbox confirmPanel = new Hbox();
@ -166,8 +162,13 @@ public class WAttachment extends Window implements EventListener
this.setClosable(true);
this.setBorder("normal");
this.appendChild(mainPanel);
mainPanel.setHeight("100%");
mainPanel.setWidth("100%");
northPanel.appendChild(toolBar);
North northPanel = new North();
northPanel.setCollapsible(false);
northPanel.setSplittable(false);
cbContent.setMold("select");
cbContent.setRows(0);
@ -180,7 +181,8 @@ public class WAttachment extends Window implements EventListener
toolBar.appendChild(cbContent);
mainPanel.appendChild(northPanel);
mainPanel.appendChild(new Separator());
northPanel.appendChild(toolBar);
bOpen.setEnabled(false);
bOpen.setSrc("/images/Editor24.gif");
@ -200,29 +202,27 @@ public class WAttachment extends Window implements EventListener
bDelete.setTooltiptext(Msg.getMsg(Env.getCtx(), "Delete"));
bDelete.addEventListener(Events.ON_CLICK, this);
//Dimension size = cbContent.getPreferredSize();
//size.width = 200;
//cbContent.setPreferredSize(size);
// cbContent.setToolTipText(text);
//cbContent.addEventListener(Events.ON_SELECT,this);
//cbContent.setLightWeightPopupEnabled(false); // Acrobat Panel is heavy
//text.setBackground(AdempierePLAF.getInfoBackground());
//text.setPreferredSize(new Dimension(200, 200));
info.setText("-");
info.setEnabled(false);
graphPanel.appendChild(info);
graphPanel.appendChild(preview);
preview.setHeight("100%");
preview.setWidth("100%");
Center centerPane = new Center();
centerPane.setAutoscroll(true);
centerPane.setFlex(true);
mainPanel.appendChild(centerPane);
mainPanel.appendChild(new Separator());
centerPane.appendChild(graphPanel);
centerPane.appendChild(new Splitter());
centerPane.appendChild(text);
//centerPane.setResizeWeight(.75); // more to graph
mainPanel.appendChild(confirmPanel);
West westPane = new West();
westPane.setWidth("20%");
westPane.setSplittable(true);
westPane.setCollapsible(true);
mainPanel.appendChild(westPane);
westPane.appendChild(text);
South southPane = new South();
mainPanel.appendChild(southPane);
southPane.appendChild(confirmPanel);
southPane.setHeight("30px");
bCancel.setImage("/images/Cancel24.gif");
bCancel.addEventListener(Events.ON_CLICK, this);
@ -244,7 +244,7 @@ public class WAttachment extends Window implements EventListener
public void dispose ()
{
pdfViewer = null;
preview = null;
this.detach();
} // dispose
@ -273,9 +273,11 @@ public class WAttachment extends Window implements EventListener
cbContent.appendItem(m_attachment.getEntryName(i), m_attachment.getEntryName(i));
if (size > 0)
cbContent.setSelectedIndex(0);
else
displayData(0);
{
cbContent.setSelectedIndex(0);
}
displayData(0);
} // loadAttachment
/**
@ -288,10 +290,8 @@ public class WAttachment extends Window implements EventListener
MAttachmentEntry entry = m_attachment.getEntry(index);
log.config("Index=" + index + " - " + entry);
// Reset UI
gifPanel.setSrc(null);
graphPanel.getChildren().clear();
// Reset UI
preview.setVisible(false);
bDelete.setEnabled(false);
bOpen.setEnabled(false);
@ -299,13 +299,7 @@ public class WAttachment extends Window implements EventListener
Dimension size = null;
// no attachment
if (entry == null || entry.getData() == null)
{
info.setText("-");
}
else
if (entry != null && entry.getData() != null)
{
bOpen.setEnabled(true);
bSave.setEnabled(true);
@ -313,72 +307,17 @@ public class WAttachment extends Window implements EventListener
log.config(entry.toStringX());
info.setText(entry.toStringX());
if (entry.isPDF() && pdfViewer != null)
try
{
try
{
AMedia media = new AMedia(entry.getName(), "pdf", "application/pdf", entry.getData());
pdfViewer.setContent(media);
/* pdfViewer.loadPDF(entry.getInputStream());
pdfViewer.setScale(50);
size = pdfViewer.getPreferredSize();*/
// size.width = Math.min(size.width, 400);
// size.height = Math.min(size.height, 400);
info.setVisible(false);
pdfViewer.setVisible(true);
graphPanel.appendChild(pdfViewer);
}
catch (Exception e)
{
log.log(Level.SEVERE, "(pdf)", e);
}
AMedia media = new AMedia(entry.getName(), null, entry.getContentType(), entry.getData());
preview.setContent(media);
preview.setVisible(true);
}
else if (entry.isGraphic())
catch (Exception e)
{
// Can we display it
/* Image image = Toolkit.getDefaultToolkit().createImage(entry.getData());
if (image != null)
{
gifPanel.setImage(image);
size = gifPanel.getPreferredSize();
if (size.width == -1 && size.height == -1)
{
log.log(Level.SEVERE, "Invalid Image");
}
else
{
// size.width += 40;
// size.height += 40;
graphPanel.add(gifScroll, BorderLayout.CENTER);
}
}
else
log.log(Level.SEVERE, "Could not create image");*/
log.log(Level.SEVERE, "(pdf)", e);
}
}
if (graphPanel.getChildren().size() == 0)
{
graphPanel.appendChild(info);
}
log.config("Size=" + size);
// graphPanel.setPreferredSize(size);
// centerPane.setDividerLocation(size.width+30);
// size.width += 100;
// size.height += 100;
// centerPane.setPreferredSize(size);
// pack();
}
} // displayData
/**
@ -499,7 +438,8 @@ public class WAttachment extends Window implements EventListener
if (media != null)
{
pdfViewer.setContent(media);
// pdfViewer.setContent(media);
;
}
else
return;
@ -510,16 +450,8 @@ public class WAttachment extends Window implements EventListener
e.printStackTrace();
}
//JFileChooser chooser = new JFileChooser();
//chooser.setDialogType(JFileChooser.OPEN_DIALOG);
//chooser.setDialogTitle(Msg.getMsg(Env.getCtx(), "AttachmentNew"));
//int returnVal = chooser.showOpenDialog(this);
//if (returnVal != JFileChooser.APPROVE_OPTION)
// return;
String fileName = media.getName();
log.config(fileName);
File file = new File(fileName);
int cnt = m_attachment.getEntryCount();
//update
@ -528,18 +460,16 @@ public class WAttachment extends Window implements EventListener
{
if (m_attachment.getEntryName(i).equals(fileName))
{
//if (m_attachment.)
{
cbContent.setSelectedIndex(i);
m_change = true;
}
m_attachment.updateEntry(i, media.getByteData());
cbContent.setSelectedIndex(i);
m_change = true;
return;
}
}
//new
if (m_attachment.addEntry(file))
if (m_attachment.addEntry(fileName, media.getByteData()))
{
//MAttachmentEntry attachmentEntry = new MAttachmentEntry(media.getName(), media.getByteData());
@ -595,30 +525,19 @@ public class WAttachment extends Window implements EventListener
if (m_attachment.getEntryCount() < index)
return;
/* String fileName = getFileName(index);
String ext = fileName.substring (fileName.lastIndexOf('.'));
log.config( "Ext=" + ext);*/
ListItem listitem = cbContent.getSelectedItem();
Media media = (Media)listitem.getValue();
Filedownload.save(media);
/* JFileChooser chooser = new JFileChooser();
chooser.setDialogType(JFileChooser.SAVE_DIALOG);
chooser.setDialogTitle(Msg.getMsg(Env.getCtx(), "AttachmentSave"));
File f = new File(fileName);
chooser.setSelectedFile(f);
// Show dialog
int returnVal = chooser.showSaveDialog(this);
if (returnVal != JFileChooser.APPROVE_OPTION)
return;
File saveFile = chooser.getSelectedFile();
if (saveFile == null)
return;*/
/*log.config("Save to " + saveFile.getAbsolutePath());
m_attachment.getEntryFile(index, saveFile);*/
MAttachmentEntry entry = m_attachment.getEntry(index);
if (entry != null && entry.getData() != null)
{
try
{
AMedia media = new AMedia(entry.getName(), null, entry.getContentType(), entry.getData());
Filedownload.save(media);
}
catch (Exception e)
{
log.log(Level.SEVERE, "(pdf)", e);
}
}
} // saveAttachmentToFile
/**

View File

@ -26,7 +26,6 @@ import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.Row;
import org.adempiere.webui.component.Rows;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.constants.EventConstants;
import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridTab;
import org.compiere.process.DocumentEngine;
@ -208,7 +207,7 @@ public class WDocActionPanel extends Window implements EventListener
lstDocAction.setRows(0);
lstDocAction.setMold("select");
lstDocAction.setWidth("100px");
lstDocAction.addEventListener(EventConstants.ONSELECT, this);
lstDocAction.addEventListener(Events.ON_SELECT, this);
confirmPanel = new ConfirmPanel(true);
confirmPanel.addComponentsLeft(confirmPanel.createButton("Process"));

View File

@ -0,0 +1,28 @@
package org.adempiere.webui.part;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Page;
public abstract class AbstractUIPart implements UIPart {
protected Page page = null;
public Component createPart(Object parent) {
if (parent == null)
throw new IllegalArgumentException("Null parent.");
Component component = null;
if (parent instanceof Page) {
page = (Page)parent;
} else if (parent instanceof Component) {
component = (Component)parent;
} else {
throw new IllegalArgumentException("Parent must of class Page or Component.");
}
return doCreatePart(component);
}
protected abstract Component doCreatePart(Component parent);
}

View File

@ -15,14 +15,13 @@
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/
package org.adempiere.webui.panel;
package org.adempiere.webui.part;
import org.adempiere.webui.component.Tab;
import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs;
import org.adempiere.webui.component.Window;
import org.zkoss.zk.ui.Component;
/**
@ -31,73 +30,72 @@ import org.zkoss.zk.ui.Component;
* @date Mar 3, 2007
* @version $Revision: 0.10 $
*/
public class MainPanel extends Window
public class MultiTabPart extends AbstractUIPart
{
private static final long serialVersionUID = 1L;
private Tabbox tabbox;
private Tabpanels tabpanels;
private Tabs tabs;
public MainPanel()
public MultiTabPart()
{
init();
}
private void init()
protected Component doCreatePart(Component parent)
{
tabbox = new Tabbox();
tabpanels = new Tabpanels();
tabs = new Tabs();
tabbox.setSclass("lite");
Tabpanels tabpanels = new Tabpanels();
Tabs tabs = new Tabs();
tabbox.appendChild(tabs);
tabbox.appendChild(tabpanels);
tabbox.setWidth("100%");
tabbox.setHeight("100%");
this.setWidth("100%");
this.appendChild(tabbox);
//this.setBorder("normal");
if (parent != null)
tabbox.setParent(parent);
else
tabbox.setPage(page);
return tabbox;
}
public void addWindow(Component comp, String title, boolean closeable)
public void addTab(Component comp, String title, boolean closeable)
{
addWindow(comp, title, closeable, true);
addTab(comp, title, closeable, true);
}
public void addWindow(Component comp, String title, boolean closeable, boolean enable)
public void addTab(Component comp, String title, boolean closeable, boolean enable)
{
Tab tab = new Tab();
tab.setLabel(title);
tab.setClosable(closeable);
Tabpanel tabpanel = new Tabpanel();
tabpanel.appendChild(comp);
Tabpanel tabpanel = null;
if (comp instanceof Tabpanel) {
tabpanel = (Tabpanel) comp;
} else {
tabpanel = new Tabpanel();
tabpanel.appendChild(comp);
}
tabbox.getTabs().appendChild(tab);
tabbox.getTabpanels().appendChild(tabpanel);
tabs.appendChild(tab);
tabpanels.appendChild(tabpanel);
tabpanels.setHeight("100%");
setSelectedTab(enable, tab);
}
public void setSelectedTab(boolean enable, Tab tab)
{
if (enable)
{
tabbox.setSelectedTab(tab);
}
setSelectedTab(tab);
}
public void removeWindow()
public void setSelectedTab(Tab tab)
{
tabbox.setSelectedTab(tab);
}
public void removeTab()
{
tabbox.getSelectedTab().onClose();
}
public Component getComponent() {
return tabbox;
}
}

View File

@ -0,0 +1,11 @@
package org.adempiere.webui.part;
import org.zkoss.zk.ui.Component;
public interface UIPart {
public Component createPart(Object parent);
public Component getComponent();
}

View File

@ -0,0 +1,141 @@
/******************************************************************************
* Product: Posterita Ajax UI *
* Copyright (C) 2007 Posterita Ltd. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius *
* or via info@posterita.org or http://www.posterita.org/ *
*****************************************************************************/
package org.adempiere.webui.part;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Tab;
import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.Tabpanels;
import org.adempiere.webui.component.Tabs;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zkex.zul.Borderlayout;
/**
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 3, 2007
* @version $Revision: 0.10 $
*/
public class WindowContainer extends AbstractUIPart implements EventListener
{
private static final long serialVersionUID = 1L;
private Tabbox tabbox;
public WindowContainer()
{
}
public static WindowContainer createFrom(Tabbox tb)
{
WindowContainer wc = new WindowContainer();
wc.tabbox = tb;
return wc;
}
protected Component doCreatePart(Component parent)
{
tabbox = new Tabbox();
tabbox.setSclass("desktop-tb");
Tabpanels tabpanels = new Tabpanels();
Tabs tabs = new Tabs();
tabbox.appendChild(tabs);
tabbox.appendChild(tabpanels);
tabbox.setWidth("100%");
tabbox.setHeight("100%");
tabbox.addEventListener(Events.ON_SELECT, this);
if (parent != null)
tabbox.setParent(parent);
else
tabbox.setPage(page);
return tabbox;
}
public void addWindow(Component comp, String title, boolean closeable)
{
addWindow(comp, title, closeable, true);
}
public void addWindow(Component comp, String title, boolean closeable, boolean enable)
{
Tab tab = new Tab();
tab.setLabel(title);
tab.setClosable(closeable);
// tab.setHeight("20px");
Tabpanel tabpanel = null;
if (comp instanceof Tabpanel) {
tabpanel = (Tabpanel) comp;
} else {
tabpanel = new Tabpanel();
tabpanel.appendChild(comp);
}
tabpanel.setHeight("100%");
tabpanel.setWidth("100%");
tabpanel.setSclass("desktop-tabpanel");
tabpanel.setStyle("position: absolute;");
tabbox.getTabs().appendChild(tab);
tabbox.getTabpanels().appendChild(tabpanel);
if (enable)
setSelectedTab(tab);
deferLayout();
}
public void setSelectedTab(Tab tab)
{
tabbox.setSelectedTab(tab);
}
public void removeWindow()
{
tabbox.getSelectedTab().onClose();
}
public Tab getSelectedTab() {
return (Tab) tabbox.getSelectedTab();
}
public void onEvent(Event event) throws Exception {
if (Events.ON_SELECT.equals(event.getName()))
deferLayout();
}
private void deferLayout() {
Tabpanel panel = (Tabpanel) tabbox.getSelectedPanel();
if (panel.getFirstChild() instanceof Borderlayout) {
LayoutUtils.sendDeferLayoutEvent((Borderlayout) panel.getChildren().get(0), 350);
}
}
public Component getComponent() {
return tabbox;
}
}

View File

@ -19,7 +19,6 @@ package org.adempiere.webui.session;
import java.util.List;
import org.zkoss.lang.ThreadLocals;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
@ -28,6 +27,7 @@ import org.zkoss.zk.ui.event.EventThreadInit;
import org.zkoss.zk.ui.event.EventThreadResume;
import org.zkoss.zk.ui.util.ExecutionCleanup;
import org.zkoss.zk.ui.util.ExecutionInit;
import org.zkoss.zkplus.util.ThreadLocals;
/**
*

View File

@ -19,8 +19,8 @@ package org.adempiere.webui.session;
import java.util.Properties;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.Desktop;
import org.adempiere.webui.IDesktop;
import org.adempiere.webui.IWebClient;
import org.compiere.util.Env;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.Session;
@ -51,27 +51,29 @@ public class SessionManager
return Executions.getCurrent().getDesktop().getSession();
}
public static void setSessionApplication(AdempiereWebUI app)
public static void setSessionApplication(IWebClient app)
{
Session session = getSession();
session.setAttribute(SESSION_APPLICATION, app);
}
public static Desktop getAppDesktop()
public static IDesktop getAppDesktop()
{
return getSessionApplication().getAppDeskop();
}
public static AdempiereWebUI getSessionApplication()
public static IWebClient getSessionApplication()
{
Session session = getSession();
AdempiereWebUI app = (AdempiereWebUI)session.getAttribute(SESSION_APPLICATION);
IWebClient app = (IWebClient)session.getAttribute(SESSION_APPLICATION);
return app;
}
public static void clearSession()
{
Env.getCtx().clear();
Session session = getSession();
session.invalidate();
}
public static void logoutSession()

View File

@ -19,12 +19,11 @@ package org.adempiere.webui.window;
import java.util.Properties;
import org.adempiere.webui.component.Window;
import org.adempiere.webui.panel.ADWindowPanel;
import org.adempiere.webui.part.AbstractUIPart;
import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MQuery;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.Component;
/**
*
@ -32,7 +31,7 @@ import org.zkoss.zk.ui.event.EventListener;
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class ADWindow extends Window implements EventListener
public class ADWindow extends AbstractUIPart
{
private static final long serialVersionUID = 1L;
@ -41,6 +40,10 @@ public class ADWindow extends Window implements EventListener
private int adWindowId;
private String _title;
private int windowNo;
private MQuery query;
private Component windowPanelComponent;
public ADWindow(Properties ctx, int adWindowId)
{
@ -55,43 +58,30 @@ public class ADWindow extends Window implements EventListener
this.ctx = ctx;
this.adWindowId = adWindowId;
windowNo = SessionManager.getAppDesktop().registerWindow(this);
init(query);
this.query = query;
init();
}
private void init(MQuery query)
private void init()
{
windowPanel = new ADWindowPanel(ctx, windowNo);
windowPanel.initPanel(adWindowId, query);
this.appendChild(windowPanel);
this.setWidth("850px");
_title = windowPanel.getTitle();
windowPanel = new ADWindowPanel(ctx, windowNo);
}
public String getTitle()
{
return _title;
}
public boolean isAsap()
{
return false;
}
public void onEvent(Event event)
{
/* if (restoreButton.equals(event.getTarget()))
{
String mode = this.getMode();
if (ADWindow.MODE_EMBEDDED.equals(mode))
{
this.doOverlapped();
}
else
{
this.doEmbedded();
}
}*/
}
protected Component doCreatePart(Component parent)
{
windowPanelComponent = windowPanel.createPart(parent);
windowPanel.initPanel(adWindowId, query);
_title = windowPanel.getTitle();
return windowPanelComponent;
}
public Component getComponent() {
return windowPanelComponent;
}
}

View File

@ -0,0 +1,94 @@
package org.adempiere.webui.window;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.component.Window;
import org.compiere.Adempiere;
import org.zkoss.zhtml.Text;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Separator;
public class AboutWindow extends Window implements EventListener {
public AboutWindow() {
super();
init();
}
private void init() {
Text text = new Text("ADempiere ERP & CRM");
text.setParent(this);
Separator separator = new Separator();
separator.setParent(this);
text = new Text(Adempiere.MAIN_VERSION + "<br>");
text.setParent(this);
text = new Text(Adempiere.DB_VERSION +"<br>");
text.setParent(this);
separator = new Separator();
separator.setParent(this);
ToolBarButton link = new ToolBarButton();
link.setLabel("Sourceforge.net Project Site");
link.setHref("http://www.sourceforge.net/projects/adempiere");
link.setTarget("_blank");
link.setParent(this);
separator = new Separator();
separator.setParent(this);
link = new ToolBarButton();
link.setLabel("ADempiere Wiki");
link.setHref("http://www.adempiere.com/wiki/index.php");
link.setTarget("_blank");
link.setParent(this);
separator = new Separator();
separator.setParent(this);
link = new ToolBarButton();
link.setLabel("ADempiere Bazaar");
link.setHref("http://www.adempiere.org");
link.setTarget("_blank");
link.setParent(this);
separator = new Separator();
separator.setParent(this);
link = new ToolBarButton();
link.setLabel("ADempiere.com");
link.setHref("http://www.adempiere.com");
link.setTarget("_blank");
link.setParent(this);
separator = new Separator();
separator.setBar(true);
separator.setHeight("20px");
separator.setParent(this);
text = new Text("Initial code contributed by: ");
text.setParent(this);
link = new ToolBarButton();
link.setLabel("Posterita");
link.setHref("http://www.posterita.org");
link.setTarget("_blank");
link.setParent(this);
separator = new Separator();
separator.setParent(this);
separator = new Separator();
separator.setParent(this);
Button btnOk = new Button();
btnOk.setLabel("OK");
btnOk.setImage("/images/Ok24.gif");
btnOk.addEventListener(Events.ON_CLICK, this);
btnOk.setParent(this);
this.setBorder("normal");
}
public void onEvent(Event event) throws Exception {
this.detach();
}
}

View File

@ -50,7 +50,7 @@ import org.adempiere.webui.editor.WTableDirEditor;
import org.adempiere.webui.editor.WebEditorFactory;
import org.adempiere.webui.event.ValueChangeEvent;
import org.adempiere.webui.event.ValueChangeListener;
import org.adempiere.webui.panel.MainPanel;
import org.adempiere.webui.part.MultiTabPart;
import org.compiere.model.GridField;
import org.compiere.model.MProduct;
import org.compiere.model.MQuery;
@ -81,7 +81,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
{
private static final long serialVersionUID = 1L;
/** Main Window for the Lookup Panel */
private MainPanel winMain;
private MultiTabPart winMain;
/** Simple Window Tab */
private Window winLookupRecord;
/** Advanced Window Tab */
@ -174,8 +174,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
if (m_total < minRecords)
{
return;
}
this.appendChild(winMain);
}
this.setBorder("normal");
this.setWidth("550px");
this.setTitle("Lookup Record: "+ title);
@ -366,12 +365,12 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe
**/
private void initPanel()
{
winMain = new MainPanel();
winMain.setWidth("100%");
winMain = new MultiTabPart();
winMain.createPart(this);
winAdvanced = new Window();
winLookupRecord = new Window();
winMain.addWindow(winLookupRecord, "Lookup Record",false, true);
winMain.addWindow(winAdvanced, "Advanced", false, false);
winMain.addTab(winLookupRecord, "Lookup Record",false, true);
winMain.addTab(winAdvanced, "Advanced", false, false);
initSimple();
initAdvanced();

View File

@ -19,7 +19,7 @@ package org.adempiere.webui.window;
import java.util.Properties;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.IWebClient;
import org.adempiere.webui.component.FWindow;
import org.adempiere.webui.panel.LoginPanel;
import org.adempiere.webui.panel.RolePanel;
@ -40,12 +40,12 @@ public class LoginWindow extends FWindow implements EventListener
{
private static final long serialVersionUID = 1L;
private AdempiereWebUI app;
private IWebClient app;
private Properties ctx;
private LoginPanel pnlLogin;
private RolePanel pnlRole;
public LoginWindow(AdempiereWebUI app)
public LoginWindow(IWebClient app)
{
this.ctx = Env.getCtx();
this.app = app;
@ -58,7 +58,7 @@ public class LoginWindow extends FWindow implements EventListener
private void init()
{
this.appendChild(pnlLogin);
this.setWidth("300px");
this.setWidth("500px");
}

View File

@ -1,558 +0,0 @@
/* Executions.java
{{IS_NOTE
Purpose:
Description:
History:
Fri Jun 3 17:55:08 2005, Created by tomyeh
}}IS_NOTE
Copyright (C) 2005 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under GPL Version 2.0 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zk.ui;
import java.util.Map;
import java.io.Reader;
import java.io.Writer;
import java.io.IOException;
import org.zkoss.idom.Document;
import org.zkoss.zk.ui.metainfo.PageDefinition;
import org.zkoss.zk.ui.metainfo.LanguageDefinition;
import org.zkoss.zk.xel.Evaluator;
import org.zkoss.zk.ui.sys.UiEngine;
import org.zkoss.zk.ui.sys.WebAppCtrl;
import org.zkoss.zk.ui.sys.DesktopCtrl;
import org.zkoss.zk.ui.sys.ServerPush;
/**
* Utilities to access {@link Execution}.
*
* @author tomyeh
*/
public class Executions {
/** Stores the current {@link Execution}. */
protected static final InheritableThreadLocal _exec = new InheritableThreadLocal();
/** Returns the current execution.
*/
public static final Execution getCurrent() {
return (Execution)_exec.get();
}
/** Returns the evaluator of the current execution.
* It is usually used to parse the expression into {@link org.zkoss.xel.Expression}
* or used with {@link org.zkoss.zk.xel.ExValue}.
* for performance improvement.
*
* @param page the page that this evaluator is associated.
* If null, the current page and then the first page is assumed.
* @param expfcls the implementation of {@link org.zkoss.xel.ExpressionFactory},
* or null to use the default ({@link org.zkoss.zk.ui.util.Configuration#getExpressionFactoryClass}.
* @since 3.0.0
*/
public static final Evaluator getEvaluator(Page page, Class expfcls) {
return getCurrent().getEvaluator(page, expfcls);
}
/** Returns the evaluator of the current execution.
* It is a shortcut of getEvaluator(comp != null ? comp.getPage(): null)
*
* @param comp the component to retrieve the page for the evaluator
* @param expfcls the implementation of {@link org.zkoss.xel.ExpressionFactory},
* or null to use the default ({@link org.zkoss.zk.ui.util.Configuration#getExpressionFactoryClass}.
* @since 3.0.0
*/
public static final Evaluator getEvaluator(Component comp, Class expfcls) {
return getCurrent().getEvaluator(comp, expfcls);
}
/** Evluates the specified expression by use of the current context
* ({@link #getCurrent}).
*
* <p>The function mapper is retrieved from component's page's function
* mapper ({@link Page#getFunctionMapper}).
* If null, the current page, if any, is used to retrieve
* the mapper.
*
* <p>For better performance, you can use the instance returned by
*{@link #getEvaluator} to parse and cached the parsed expression.
* {@link org.zkoss.zk.xel.ExValue} is a utility class to simply
* the task.
*
* @param comp as the self variable (ignored if null)
*/
public static final Object evaluate(Component comp,
String expr, Class expectedType) {
return getCurrent().evaluate(comp, expr, expectedType);
}
/** Evluates the specified expression with the resolver of the current
* execution ({@link #getCurrent}).
*
* <p>The function mapper is retrieved from page's function
* mapper ({@link Page#getFunctionMapper}).
* If null, the current page, if any, is used to retrieve
* the mapper.
*
* <p>For better performance, you can use the instance returned by
*{@link #getEvaluator} to parse and cached the parsed expression.
* {@link org.zkoss.zk.xel.ExValue} is a utility class to simply
* the task.
*
* @param page used as the self variable and to retrieve the function
* mapper if funmap is not defined. Ignored if null.
*/
public static final Object evaluate(Page page,
String expr, Class expectedType) {
return getCurrent().evaluate(page, expr, expectedType);
}
/** Encodes an URL.
*
* <p>It resolves "*" contained in URI, if any, to the proper Locale,
* and the browser code.
* Refer to {@link org.zkoss.web.servlet.Servlets#locate(ServletContext, ServletRequest, String, Locator)}
* for details.
*/
public static final String encodeURL(String uri) {
return getCurrent().encodeURL(uri);
}
/** Creates components from a page file specified by an URI.
* Shortcut to {@link Execution#createComponents(String, Component, Map)}.
*
* @param parent the parent component, or null if you want it to be
* a root component. If parent is null, the page is assumed to be
* the current page, which is determined by the execution context.
* @param arg a map of parameters that is accessible by the arg variable
* in EL, or by {@link Execution#getArg}.
* Ignored if null.
* @see #createComponents(PageDefinition, Component, Map)
*/
public static final Component createComponents(
String uri, Component parent, Map arg) {
return getCurrent().createComponents(uri, parent, arg);
}
/** Creates components based on the specified page definition.
* Shortcut to {@link Execution#createComponents(PageDefinition, Component, Map)}.
*
* @param pagedef the page definition to use. It cannot be null.
* @param parent the parent component, or null if you want it to be
* a root component. If parent is null, the page is assumed to be
* the current page, which is determined by the execution context.
* @param arg a map of parameters that is accessible by the arg variable
* in EL, or by {@link Execution#getArg}.
* Ignored if null.
* @return the first component being created.
* @see #createComponents(String, Component, Map)
*/
public static final Component createComponents(PageDefinition pagedef,
Component parent, Map arg) {
return getCurrent().createComponents(pagedef, parent, arg);
}
/** Creates components from the raw content specified by a string.
* Shortcut to {@link Execution#createComponentsDirectly(String, String, Component, Map)}.
*
* @param content the raw content of the page. It must be a XML and
* compliant to the page format (such as ZUL).
* @param extension the default extension if the content doesn't specify
* an language. In other words, if
* the content doesn't specify an language, {@link LanguageDefinition#getByExtension}
* is called.
* If extension is null and the content doesn't specify a language,
* the language called "xul/html" is assumed.
* @param parent the parent component, or null if you want it to be
* a root component. If parent is null, the page is assumed to be
* the current page, which is determined by the execution context.
* @param arg a map of parameters that is accessible by the arg variable
* in EL, or by {@link Execution#getArg}.
* Ignored if null.
* @see #createComponents(PageDefinition, Component, Map)
* @see #createComponents(String, Component, Map)
* @see #createComponentsDirectly(Document, String, Component, Map)
* @see #createComponentsDirectly(Reader, String, Component, Map)
*/
public static final Component createComponentsDirectly(String content,
String extension, Component parent, Map arg) {
return getCurrent().createComponentsDirectly(content, extension, parent, arg);
}
/** Creates components from the raw content specified by a DOM tree.
* Shortcut to {@link Execution#createComponentsDirectly(Document, String, Component, Map)}.
*
* @param content the raw content in DOM.
* @param extension the default extension if the content doesn't specify
* an language. In other words, if
* the content doesn't specify an language, {@link LanguageDefinition#getByExtension}
* is called.
* If extension is null and the content doesn't specify a language,
* the language called "xul/html" is assumed.
* @param parent the parent component, or null if you want it to be
* a root component. If parent is null, the page is assumed to be
* the current page, which is determined by the execution context.
* @param arg a map of parameters that is accessible by the arg variable
* in EL, or by {@link Execution#getArg}.
* Ignored if null.
* @see #createComponents(PageDefinition, Component, Map)
* @see #createComponents(String, Component, Map)
* @see #createComponentsDirectly(String, String, Component, Map)
* @see #createComponentsDirectly(Reader, String, Component, Map)
*/
public static final Component createComponentsDirectly(Document content,
String extension, Component parent, Map arg) {
return getCurrent().createComponentsDirectly(content, extension, parent, arg);
}
/** Creates components from the raw content read from the specified reader.
* Shortcut to {@link Execution#createComponentsDirectly(Reader, String, Component, Map)}.
*
* <p>The raw content is loader and parsed to a page defintion by use of
* {@link Execution#getPageDefinitionDirectly(Reader, String)}, and then
* invokes {@link #createComponents(PageDefinition,Component,Map)}
* to create components.
*
* @param reader the reader to retrieve the raw content.
* @param extension the default extension if the content doesn't specify
* an language. In other words, if
* the content doesn't specify an language, {@link LanguageDefinition#getByExtension}
* is called.
* If extension is null and the content doesn't specify a language,
* the language called "xul/html" is assumed.
* @param parent the parent component, or null if you want it to be
* a root component. If parent is null, the page is assumed to be
* the current page, which is determined by the execution context.
* @param arg a map of parameters that is accessible by the arg variable
* in EL, or by {@link Execution#getArg}.
* Ignored if null.
* @see #createComponents(PageDefinition, Component, Map)
* @see #createComponents(String, Component, Map)
* @see #createComponentsDirectly(Document, String, Component, Map)
* @see #createComponentsDirectly(String, String, Component, Map)
*/
public static Component createComponentsDirectly(Reader reader,
String extension, Component parent, Map arg)
throws IOException {
return getCurrent().createComponentsDirectly(reader, extension, parent, arg);
}
/** Sends a temporary redirect response to the client using the specified
* redirect location URL by use of the current execution,
* {@link #getCurrent}.
*
* <p>After calling this method, the caller shall end the processing
* immediately (by returning). All pending requests and events will
* be dropped.
*
* @param uri the URI to redirect to, or null to reload the same page
* @see Execution#sendRedirect
*/
public static void sendRedirect(String uri) {
getCurrent().sendRedirect(uri);
}
/** A shortcut of Executions.getCurrent().include(page).
*
* @see Execution#include(Writer,String,Map,int)
* @see Execution#include(String)
*/
public static void include(String page)
throws IOException {
getCurrent().include(page);
}
/** A shortcut of Executions.getCurrent().forward(page).
*
* @see Execution#forward(Writer,String,Map,int)
* @see Execution#forward(String)
*/
public static void forward(String page)
throws IOException {
getCurrent().forward(page);
}
//-- wait/notify --//
/** Suspends the current processing of an event and wait until the
* other thread invokes {@link #notify(Object)}, {@link #notifyAll(Object)},
* {@link #notify(Desktop, Object)} or {@link #notifyAll(Desktop, Object)}
* for the specified object.
*
* <p>It can only be called when the current thread is processing an event.
* And, when called, the current processing is suspended and ZK continues
* to process the next event and finally render the result.
*
* <p>It is typical use to implement a modal dialog where it won't return
* until the modal dialog ends.
*
* @param mutex any non-null object to identify what to notify.
* It must be same object passed to {@link #notify(Desktop, Object)}.
* If there is racing issue, you have to enclose it with
* <code>synchronized</code> (though it is optional).
* @exception UiException if it is called not during event processing.
* @exception SuspendNotAllowedException if there are too many suspended
* exceptions.
* Deployers can control the maximal allowed number of suspended exceptions
* by specifying <code>max-suspended-thread</code> in <code>zk.xml</code>,
* or invoking {@link org.zkoss.zk.ui.util.Configuration#setMaxSuspendedThreads}.
*/
public static final void wait(Object mutex)
throws InterruptedException, SuspendNotAllowedException {
getUiEngine().wait(mutex);
}
/** Wakes up a single event processing thread that is waiting on the
* specified object.
*
* <p>Unlike {@link #notify(Desktop, Object)}, this method can be invoked only
* in the event listener that processing the same desktop.
* In addition, this method can be called under the event listener.
*
* <p>Use {@link #notify(Desktop, Object)} if you want to notify in other
* thread, such as a working thread.
*
* @param mutex any non-null object to identify what to notify.
* It must be same object passed to {@link #wait}.
* If there is racing issue, you have to enclose it with
* <code>synchronized</code> (though it is optional).
* @see #notify(Desktop, Object)
* @see #notifyAll(Object)
* @exception UiException if it is called not during event processing.
*/
public static final void notify(Object mutex) {
getUiEngine().notify(mutex);
}
/** Wakes up all event processing thread that are waiting on the
* specified object.
*
* <p>Unlike {@link #notify(Desktop, Object)}, this method can be invoked only
* in the event listener that processing the same desktop.
* In addition, this method can be called under the event listener.
*
* <p>Use {@link #notifyAll(Desktop, Object)} if you want to notify in other
* thread, such as a working thread.
*
* @param mutex any non-null object to identify what to notify.
* It must be same object passed to {@link #wait}.
* If there is racing issue, you have to enclose it with
* <code>synchronized</code> (though it is optional).
* @see #notify(Desktop, Object)
* @see #notifyAll(Object)
* @exception UiException if it is called not during event processing.
*/
public static final void notifyAll(Object mutex) {
getUiEngine().notifyAll(mutex);
}
/** Wakes up a single event processing thread for the specified desktop
* that is waiting on the specified object.
*
* <p>Unlike {@link #notify(Object)}, this method can be called any time.
* It is designed to let working threads resume an event processing
* thread.
*
* <p>Notice: if this method is NOT called in an event processing thread,
* the resumed thread won't execute until the next request is received.
* To enforce it happen, you might use the timer component (found in ZUL).
*
* <p>Notice: to resolve racing issue, you usually need to follow
* this pattern.
* <pre><code>
//Event Handling Thread
synchronized (mutex) {
final WorkingThread worker = new WorkingThread(desktop);
synchronized (mutex) {
worker.start();
Executions.wait(mutex);
}
....
}
//Working Thread
public void run() {
....
synchronized (mutex) {
Executions.notify(desktop, mutex);
}
}
</code></pre>
*
* @param desktop the desktop which the suspended thread is processing.
* It must be the same desktop of the suspended thread.
* @param mutex any non-null object to identify what to notify.
* It must be same object passed to {@link #wait}.
* If there is racing issue, you have to enclose it with
* <code>synchronized</code> (though it is optional).
* @see #notify(Object)
* @see #notifyAll(Desktop, Object)
*/
public static final void notify(Desktop desktop, Object mutex) {
getUiEngine(desktop).notify(desktop, mutex);
}
/** Wakes up all event processing theads for the specified desktop
* that are waiting on the specified object.
*
* <p>Unlike {@link #notifyAll(Object)}, this method can be called any time.
* It is designed to let working threads resume an event processing
* thread.
*
* <p>Notice: if this method is NOT called in an event processing thread,
* the resumed thread won't execute until the next request is received.
* To enforce it happen, you might use the timer component (found in ZUL).
*
* <p>Notice: to resolve racing issue, you usually need to follow
* this pattern.
* <pre><code>
//Event Handling Thread
synchronized (mutex) {
final WorkingThread worker = new WorkingThread(desktop);
synchronized (mutex) {
worker.start();
Executions.wait(mutex);
}
....
}
//Working Thread
public void run() {
....
synchronized (mutex) {
Executions.notifyAll(desktop, mutex);
}
}
</code></pre>
*
* @param desktop the desktop which the suspended thread is processing.
* It must be the same desktop of the suspended thread.
* @param mutex any non-null object to identify what to notify.
* It must be same object passed to {@link #wait}.
* If there is racing issue, you have to enclose it with
* <code>synchronized</code> (though it is optional).
* @see #notify(Object)
* @see #notifyAll(Desktop, Object)
*/
public static final void notifyAll(Desktop desktop, Object mutex) {
getUiEngine(desktop).notifyAll(desktop, mutex);
}
/** Activates a server-push thread.
* It causes the current thread to wait until the desktop is available
* to access, the desktop no longer exists,
* or some other thread interrupts this thread.
*
* <p>A server-push thread is a working thread that manipulates a desktop
* independent of event listeners. It can manipulate the components
* of the desktop as long as it is activated.
*
* <p>Due to the overhead of using server-push threads, the server-push
* feature is disabled by default. To use it, you have to enable
* it first with {@link Desktop#enableServerPush}.
* Once enabled, you can use as many as sevrer-push threads you like
* (for the desktop with the server-push feature enabled).
*
* <p>Before a server-push thread can access the components of the
* desktop it belongs, you have to activate it first.
* To activate a server-push thread, you have to invoke {@link #activate}.
* Once it returns, the server-push thread is activated and it, like
* event listeners, can manipulate the components of the corresponding
* desktop directly.
*
* <p>A typical use pattern:
*
* <pre><code>class MyWorkingThread extends Thread {
* public void run() {
* while (anything_to_publish) {
* //prepare something to publish
* //you can create new components and manipulate them before
* //activation, as long as they are not attached to the desktop
*
* Executions.activate(desktop);
* try {
* try {
* //activated
* //manipulate the components that are attached the desktop
* } finally {
* Executions.deactivate(desktop)
* }
* } catch (DesktopUnavailableException ex) {
* //clean up (since desktop is dead)
* }
* }
* }
*}</code></pre>
*
* <p>Note: the access of components is sequentialized. That is,
* at most one server-push thread is activated. All others, including
* the event listeners, have to wait util it is deactivated
* (i.e., until {@link #deactivate} is called).
* Thus, it is better to minimize the time remaining activated.
* A typical practice is to create new components and manipulate them
* before activated. Then, you have to only attach them after activated.
*
* <pre><code> Tree tree = new Tree();
* new Treechildren().setParent(tree); //initialize the tree
* Exections.activate(desktop);
* try {
* tree.setPage(page); //assume page is a page of desktop
*</code></pre>
*
* <p>Note: you don't need to invoke this method in the event listener
* since it is already activated when an event listen starts execution.
*
* @exception InterruptedException if it is interrupted by other thread
* @exception DesktopUnavailableException if the desktop is removed
* (when activating).
* @since 3.0.0
*/
public static final void activate(Desktop desktop)
throws InterruptedException, DesktopUnavailableException {
activate(desktop, 0);
}
/** Activates a server-push thread with, or until a certain amount of
* real time has elapsed.
* It causes the current thread to wait until the desktop is available
* to access, the desktop no longer exists,
* some other thread interrupts this thread,
* or a certain amount of real time has elapsed.
*
* @param timeout the maximum time to wait in milliseconds.
* Ingored (i.e., never timeout) if non-positive.
* @return whether it is activated or it is timeout.
* The only reason it returns false is timeout.
* @exception InterruptedException if it is interrupted by other thread
* @exception DesktopUnavailableException if the desktop is removed
* (when activating).
* @exception IllegalStateException if the server push is not
* enabled for this desktop yet ({@link Desktop#enableServerPush}).
* @since 3.0.0
* @see #activate(Desktop)
*/
public static final boolean activate(Desktop desktop, long timeout)
throws InterruptedException, DesktopUnavailableException {
final ServerPush spush = ((DesktopCtrl)desktop).getServerPush();
if (spush == null)
if (desktop.isAlive())
throw new IllegalStateException("Before activation, the server push must be enabled for "+desktop);
else
throw new DesktopUnavailableException("Stopped");
return spush.activate(timeout);
}
/** Deactivates a server-push thread.
* @since 3.0.0
*/
public static final void deactivate(Desktop desktop) {
final ServerPush spush = ((DesktopCtrl)desktop).getServerPush();
if (spush != null)
spush.deactivate();
}
private static final UiEngine getUiEngine(Desktop desktop) {
if (desktop == null)
throw new IllegalArgumentException("desktop cannot be null");
return ((WebAppCtrl)desktop.getWebApp()).getUiEngine();
}
private static final UiEngine getUiEngine() {
final Execution exec = getCurrent();
if (exec == null)
throw new IllegalStateException("This method can be called only under an event listener");
return ((WebAppCtrl)exec.getDesktop().getWebApp()).getUiEngine();
}
}

View File

@ -1,53 +0,0 @@
/* ExecutionsCtrl.java
{{IS_NOTE
Purpose:
Description:
History:
Mon Jun 6 12:20:51 2005, Created by tomyeh
}}IS_NOTE
Copyright (C) 2005 Potix Corporation. All Rights Reserved.
{{IS_RIGHT
This program is distributed under GPL Version 2.0 in the hope that
it will be useful, but WITHOUT ANY WARRANTY.
}}IS_RIGHT
*/
package org.zkoss.zk.ui.sys;
import org.zkoss.zk.ui.Execution;
import org.zkoss.zk.ui.Executions;
/**
* Additional utilities for {@link Execution}.
*
* @author tomyeh
*/
public class ExecutionsCtrl extends Executions {
protected ExecutionsCtrl() {} //prevent from instantiation
/** Sets the execution for the current thread.
* Called only internally.
*
* <p>Note: you have to clean up the current execution
* with try/finally:
* <pre><code>
* setCurrent(exec);
* try {
* ...
* finally {
* setCurrent(null);
* }
*/
public static final void setCurrent(Execution exec) {
_exec.set(exec);
}
/** Returns the current {@link ExecutionCtrl}.
*/
public static final ExecutionCtrl getCurrentCtrl() {
return (ExecutionCtrl)getCurrent();
}
}

View File

@ -12,6 +12,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
-->
<taglib>
<uri>http://www.zkoss.org/dsp/web/core</uri>
<description>
Core methods and tags for zweb in DSP
</description>
@ -91,12 +92,24 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
<tag-class>org.zkoss.web.servlet.dsp.action.When</tag-class>
</tag>
<!-- -->
<!-- Imports -->
<!-- -->
<import>
<import-name>ServletFns</import-name>
<import-class>org.zkoss.web.fn.ServletFns</import-class>
</import>
<import>
<import-name>Labels</import-name>
<import-class>org.zkoss.util.resource.Labels</import-class>
</import>
<!-- -->
<!-- Class Utilities -->
<!-- -->
<function>
<name>boolean</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>boolean toBoolean(java.lang.Object)</function-signature>
<description>
Converts the specified object to a boolean.
@ -104,7 +117,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>number</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>java.lang.Number toNumber(java.lang.Object)</function-signature>
<description>
Converts the specified object to a number.
@ -112,7 +125,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>int</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>int toInt(java.lang.Object)</function-signature>
<description>
Converts the specified object to an integer.
@ -120,7 +133,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>decimal</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>java.math.BigDecimal toDecimal(java.lang.Object)</function-signature>
<description>
Converts the specified object to a (big) decimal.
@ -128,7 +141,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>string</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>java.lang.String toString(java.lang.Object)</function-signature>
<description>
Converts the specified object to a string.
@ -136,7 +149,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>char</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>char toChar(java.lang.Object)</function-signature>
<description>
Converts the specified object to a character.
@ -152,7 +165,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>isInstance</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>boolean isInstance(java.lang.Object, java.lang.Object)</function-signature>
<description>
Tests whether an object (the second argument) is an instance of a class (the first argument).
@ -161,7 +174,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>length</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>int length(java.lang.Object)</function-signature>
<description>
Returns the length of a string, array, collection or map.
@ -169,7 +182,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>new</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>java.lang.Object new_(java.lang.Object)</function-signature>
<description>
Instantiates the specified class.
@ -177,12 +190,21 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</description>
</function>
<function>
<name>getProperty</name>
<function-class>java.lang.System</function-class>
<function-signature>java.lang.String getProperty(java.lang.String)</function-signature>
<description>
Returns the system property.
</description>
</function>
<!-- -->
<!-- String Utilities -->
<!-- -->
<function>
<name>cat</name>
<function-class>org.zkoss.el.fn.StringFns</function-class>
<function-class>org.zkoss.xel.fn.StringFns</function-class>
<function-signature>
java.lang.String cat(java.lang.String, java.lang.String)
</function-signature>
@ -192,7 +214,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>cat3</name>
<function-class>org.zkoss.el.fn.StringFns</function-class>
<function-class>org.zkoss.xel.fn.StringFns</function-class>
<function-signature>
java.lang.String cat3(java.lang.String, java.lang.String, java.lang.String)
</function-signature>
@ -202,7 +224,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>cat4</name>
<function-class>org.zkoss.el.fn.StringFns</function-class>
<function-class>org.zkoss.xel.fn.StringFns</function-class>
<function-signature>
java.lang.String cat4(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
</function-signature>
@ -212,7 +234,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>cat5</name>
<function-class>org.zkoss.el.fn.StringFns</function-class>
<function-class>org.zkoss.xel.fn.StringFns</function-class>
<function-signature>
java.lang.String cat5(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
</function-signature>
@ -222,7 +244,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function>
<function>
<name>replace</name>
<function-class>org.zkoss.el.fn.StringFns</function-class>
<function-class>org.zkoss.xel.fn.StringFns</function-class>
<function-signature>
java.lang.String replace(java.lang.String, java.lang.String, java.lang.String)
</function-signature>
@ -233,12 +255,21 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
<function>
<name>l</name>
<function-class>org.zkoss.el.fn.CommonFns</function-class>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>java.lang.String getLabel(java.lang.String)</function-signature>
<description>
Returns the label of the specified key.
</description>
</function>
<function>
<name>l2</name>
<function-class>org.zkoss.xel.fn.CommonFns</function-class>
<function-signature>java.lang.String getLabel(java.lang.String, java.lang.Object[])</function-signature>
<description>
Returns the label of the specified key, and formats with the specified
argument.
</description>
</function>
<!-- -->
<!-- XML/HTML Utilities -->

View File

@ -12,6 +12,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
-->
<taglib>
<uri>http://www.zkoss.org/dsp/web/html</uri>
<description>
Used to develop ZK components for XUL/HTML.
</description>

View File

@ -12,10 +12,22 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
-->
<taglib>
<uri>http://www.zkoss.org/dsp/zk/core</uri>
<description>
Methods and actions for ZK in DSP/ZUML
</description>
<!-- -->
<!-- Imports -->
<!-- -->
<import>
<import-name>ZkFns</import-name>
<import-class>org.zkoss.zk.fn.ZkFns</import-class>
</import>
<!-- -->
<!-- Functions -->
<!-- -->
<function>
<name>redraw</name>
<function-class>org.zkoss.zk.fn.ZkFns</function-class>
@ -46,7 +58,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function-signature>
<description>
Returns HTML tags to include all JavaScripts used by all languages.
The argument is the action.
The argument is ignored (since 3.1.0; reserved for backward compatible).
</description>
</function>
<function>
@ -57,17 +69,72 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
</function-signature>
<description>
Returns HTML tags to include all style sheets used by all languages.
Note: it cannot be called without current execution. In other words,
it is used to design component templates.
</description>
</function>
<function>
<name>outDeviceStyleSheets</name>
<function-class>org.zkoss.zk.fn.ZkFns</function-class>
<function-signature>
java.lang.String outDeviceStyleSheets(java.lang.String deviceType)
</function-signature>
<description>
Returns HTML tags to include all style sheets used by the specified device.
Note: unlike outLangStyleSheets, it can be called without current execution.
</description>
</function>
<function>
<name>outPageHeaders</name>
<name>outHeaders</name>
<function-class>org.zkoss.zk.fn.ZkFns</function-class>
<function-signature>
java.lang.String outPageHeaders(org.zkoss.zk.ui.Page)
java.lang.String outHeaders(org.zkoss.zk.ui.Page)
</function-signature>
<description>
Returns HTML header tags defined in the specified page.
Returns the content that will be placed inside the header element
of the specified page.
</description>
</function>
<function>
<name>outRootAttributes</name>
<function-class>org.zkoss.zk.fn.ZkFns</function-class>
<function-signature>
java.lang.String outRootAttributes(org.zkoss.zk.ui.Page)
</function-signature>
<description>
Returns the content that will be placed as the attributes of
the root element of the specified page.
</description>
</function>
<function>
<name>outContentType</name>
<function-class>org.zkoss.zk.fn.ZkFns</function-class>
<function-signature>
java.lang.String outContentType(org.zkoss.zk.ui.Page)
</function-signature>
<description>
Returns the content type.
</description>
</function>
<function>
<name>outDocType</name>
<function-class>org.zkoss.zk.fn.ZkFns</function-class>
<function-signature>
java.lang.String outDocType(org.zkoss.zk.ui.Page)
</function-signature>
<description>
Returns the doc type.
</description>
</function>
<function>
<name>outFirstLine</name>
<function-class>org.zkoss.zk.fn.ZkFns</function-class>
<function-signature>
java.lang.String outFirstLine(org.zkoss.zk.ui.Page)
</function-signature>
<description>
Returns the first line to be generated to the output.
</description>
</function>
@ -93,4 +160,15 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
Returns date relevant labels in JavaScript.
</description>
</function>
<function>
<name>outPageAttrs</name>
<function-class>org.zkoss.zk.fn.ZkFns</function-class>
<function-signature>
java.lang.String outPageAttrs(org.zkoss.zk.ui.Page)
</function-signature>
<description>
Returns the attributes to render a page.
</description>
</function>
</taglib>

View File

@ -12,10 +12,22 @@ Copyright (C) 2006 Potix Corporation. All Rights Reserved.
-->
<taglib>
<uri>http://www.zkoss.org/dsp/zul/core</uri>
<description>
Methods and actions for ZUL in DSP/ZUML
</description>
<!-- -->
<!-- Imports -->
<!-- -->
<import>
<import-name>ZulFns</import-name>
<import-class>org.zkoss.zul.fn.ZulFns</import-class>
</import>
<!-- -->
<!-- Functions -->
<!-- -->
<function>
<name>getColAttrs</name>
<function-class>org.zkoss.zul.fn.ZulFns</function-class>
@ -36,16 +48,36 @@ Copyright (C) 2006 Potix Corporation. All Rights Reserved.
Returns the inner attributes used for the cell of the specified child
when it is placed inside of hbox/vbox.
</description>
</function>
<function>
<name>getBoxChildInnerAttrs</name>
<function-class>org.zkoss.zul.fn.ZulFns</function-class>
<function-signature>
java.lang.String getBoxChildInnerAttrs(org.zkoss.zk.ui.Component)
</function-signature>
<description>
Returns the outer attributes used for the cell of the specified child
when it is placed inside of hbox/vbox.
</description>
</function>
<function>
<name>getBoxChildInnerAttrs</name>
<function-class>org.zkoss.zul.fn.ZulFns</function-class>
<function-signature>
java.lang.String getBoxChildInnerAttrs(org.zkoss.zk.ui.Component)
</function-signature>
<description>
Returns the outer attributes used for the cell of the specified child
when it is placed inside of hbox/vbox.
</description>
</function>
<function>
<name>setStripeClass</name>
<function-class>org.zkoss.zul.fn.ZulFns</function-class>
<function-signature>
void setStripeClass(org.zkoss.zk.ui.Component)
</function-signature>
<description>
Sets the stripe CSS for each row.
</description>
</function>
<function>
<name>resetStripeClass</name>
<function-class>org.zkoss.zul.fn.ZulFns</function-class>
<function-signature>
void resetStripeClass(org.zkoss.zk.ui.Component)
</function-signature>
<description>
Resets the stripe CSS for each row.
</description>
</function>
</taglib>

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,12 @@ Copyright (C) 2006 Potix Corporation. All Rights Reserved.
<log>
<description>[Optional] Monitor i3-log.conf and register a handler for the specified log-base</description>
<log-base></log-base>
</log>
</log>
<!-- change to false to use compress js which is much smaller -->
<client-config>
<debug-js>true</debug-js>
</client-config>
<!--
<language-config>
@ -26,5 +31,5 @@ Copyright (C) 2006 Potix Corporation. All Rights Reserved.
<listener>
<description>ADempiere WebUI Context management</description>
<listener-class>org.adempiere.webui.session.SessionContextListener</listener-class>
</listener>
</listener>
</zk>

View File

@ -13,7 +13,7 @@
<property name="classes.dir" value="${basedir}/WEB-INF/classes"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="WEBINF.dir" value="${basedir}/WEB-INF"/>
<property name="Adempiere.dir" value="${basedir}/../../../lib"></property>
<property name="Adempiere.dir" value="${basedir}/../lib"></property>
<property name="war.name" value="webui"/>
<property name="compile.debug" value="true"/>

View File

@ -0,0 +1,220 @@
<%@ page contentType="text/css;charset=UTF-8" %>
<%@ taglib uri="http://www.zkoss.org/dsp/web/core" prefix="c" %>
html,body {
margin: 0;
padding: 0;
height: 100%;
background-color: #D4E3F4;
}
.login {
background-color: #D4E3F4;
}
.header-left {
margin: 0;
margin-left: 5px;
margin-top: 3px;
}
.header-right {
margin: 0;
margin-top: 3px;
padding-right: 5px;
}
.disableFilter img {
filter: progid : DXImageTransform . Microsoft . Alpha(opacity = 20);
-moz-opacity: 0.2;
}
.header {
background-image: url(images/gradient-bg.gif);
background-repeat: repeat-x;
width: 100%;
height: 35px;
}
.headerFont {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
}
<%-- desktop tabbox --%>
.desktop-tb {
position:absolute;
}
td.tab-desktop-tb-first1 {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-first2.gif')});
width: 1px; height: 1px;
}
td.tab-desktop-tb-first2 {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-first2.gif')});
width: 3px; height: 1px;
}
td.tab-desktop-tb-last1 {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-last1.gif')});
width: 3px; height: 1px;
}
td.tab-desktop-tb-last2 {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-last1.gif')});
width: 1px; height: 1px;
}
td.tab-desktop-tb-tl-sel {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-tl-sel.gif')});
width: 5px; height: 6px;
}
td.tab-desktop-tb-tl-uns {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-tl-uns.gif')});
width: 5px; height: 6px;
}
td.tab-desktop-tb-tm-sel {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-tm-sel.gif')});
height: 6px;
}
td.tab-desktop-tb-tm-uns {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-tm-uns.gif')});
height: 6px;
}
td.tab-desktop-tb-tr-sel {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-tr-sel.gif')});
width: 5px; height: 6px;
}
td.tab-desktop-tb-tr-uns {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-tr-uns.gif')});
width: 5px; height: 6px;
}
td.tab-desktop-tb-ml-sel {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-ml-sel.gif')});
width: 5px;
}
td.tab-desktop-tb-ml-uns {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-ml-uns.gif')});
width: 5px;
}
td.tab-desktop-tb-mm-sel, td.tab-desktop-tb-mm-uns {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-white.gif')});
}
td.tab-desktop-tb-mr-sel {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-mr-sel.gif')});
width: 5px;
}
td.tab-desktop-tb-mr-uns {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-mr-uns.gif')});
width: 5px;
}
td.tab-desktop-tb-bl-sel, td.tab-desktop-tb-bm-sel, td.tab-desktop-tb-br-sel {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-white.gif')});
width: 5px; height: 1px;
}
td.tab-desktop-tb-bl-uns, td.tab-desktop-tb-bm-uns, td.tab-desktop-tb-br-uns {
background-image: url(${c:encodeURL('~./zul/img/tab/lite-last1.gif')});
width: 5px; height: 1px;
}
tr.tab-desktop-tb-m {
height: 21px;
}
.desktop-tabpanel {
margin: 0;
padding: 0;
border: 0;
position: absolute;
}
.menu-search {
background-color: #E0EAF7;
}
<%-- adwindow and form --%>
.adform-content-none {
overflow: auto;
position: absolute;
width: 100%;
}
.adwindow-status {
background-color: #E0EAF7;
height: 20px;
}
.adwindow-nav {
width: 200px;
}
.adwindow-nav-content {
background-color: #E0EAF7;
height: 100%;
}
.adwindow-toolbar {
border: 0px;
}
.adwindow-navbtn-dis, .adwindow-navbtn-sel, .adwindow-navbtn-uns {
border: 0px;
margin-top: 3px;
padding-top: 2px;
padding-bottom: 2px;
}
.adwindow-navbtn-sel {
background-color: #9CBDFF;
font-weight: bold;
color: #274D5F;
}
.adwindow-navbtn-uns {
background-color: #C4DCFB;
font-weight: normal;
color: #274D5F;
}
.adwindow-navbtn-dis {
background-color: #C4DCFB;
}
<%-- ad tab --%>
.adtab-body {
position: absolute;
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
.adtab-content {
margin: 0;
padding: 0;
overflow: auto;
width: 100%;
height: 100%;
position: absolute;
}
.adtab-grid-panel {
position: absolute;
overflow: hidden;
width: 100%;
height: 100%;
}
.adtab-grid {
width: 100%;
position: absolute;
}
.adtab-tabpanels {
width: 80%;
border-top: 1px solid #9CBDFF;
border-bottom: 1px solid #9CBDFF;
border-left: 2px solid #9CBDFF;
border-right: 2px solid #9CBDFF;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B

View File

@ -2,4 +2,9 @@
<!--
Copyright (C) 2007 Ashley G Ramdass.
-->
<window use="org.adempiere.webui.AdempiereWebUI"/>
<?page style="height:100%"?>
<zk>
<style src="css/default.css.dsp"/>
<script src="js/layout.js"/>
<window use="org.adempiere.webui.AdempiereWebUI"/>
</zk>

View File

@ -0,0 +1,14 @@
function ad_deferRenderBorderLayout(uuid, timeout) {
var meta = zkau.getMeta($e(uuid));
if (meta) {
zk.setVisible(zkau.getMeta($e(uuid)).el, false, false);
setTimeout("_ad_deferBDL('"+uuid+"')", timeout);
}
}
function _ad_deferBDL(uuid) {
zk.setVisible(zkau.getMeta($e(uuid)).el, true, false);
zk.beforeSizeAt();
zk.onSizeAt();
zkau.getMeta($e(uuid)).render();
}