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);
+ }
+ }
}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java
index bb3767a25d..4665c2972c 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java
@@ -17,44 +17,24 @@
package org.adempiere.webui.panel;
+import java.util.List;
import java.util.Properties;
-import org.adempiere.webui.apps.AEnv;
-import org.adempiere.webui.apps.ProcessModalDialog;
-import org.adempiere.webui.apps.WReport;
-import org.adempiere.webui.apps.form.WCreateFrom;
-import org.adempiere.webui.apps.form.WPayment;
-import org.adempiere.webui.component.CWindowToolbar;
-import org.adempiere.webui.component.FTabbox;
-import org.adempiere.webui.component.GridPanel;
-import org.adempiere.webui.editor.WButtonEditor;
-import org.adempiere.webui.event.ActionEvent;
-import org.adempiere.webui.event.ActionListener;
-import org.adempiere.webui.event.ToolbarListener;
-import org.adempiere.webui.exception.ApplicationException;
-import org.adempiere.webui.session.SessionManager;
-import org.adempiere.webui.window.FDialog;
-import org.adempiere.webui.window.FindWindow;
-import org.compiere.model.DataStatusEvent;
-import org.compiere.model.DataStatusListener;
-import org.compiere.model.GridField;
-import org.compiere.model.GridTab;
-import org.compiere.model.GridWindow;
-import org.compiere.model.GridWindowVO;
-import org.compiere.model.GridWorkbench;
-import org.compiere.model.MQuery;
-import org.compiere.model.MRole;
-import org.compiere.process.DocAction;
+import org.adempiere.webui.LayoutUtils;
+import org.adempiere.webui.component.CompositeADTab;
+import org.adempiere.webui.component.IADTab;
+import org.adempiere.webui.component.Tabbox;
+import org.adempiere.webui.component.Tabpanel;
+import org.adempiere.webui.component.Tabs;
import org.compiere.util.CLogger;
-import org.compiere.util.DB;
-import org.compiere.util.Env;
-import org.compiere.util.Msg;
-import org.compiere.util.WebDoc;
-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.Component;
+import org.zkoss.zk.ui.HtmlBasedComponent;
+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.Tab;
-import org.zkoss.zul.Vbox;
/**
*
@@ -62,11 +42,11 @@ import org.zkoss.zul.Vbox;
* @author Jorg Janke
*
* @author Ashley G Ramdass
+ * @author Low Heng Sin
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
-public class ADWindowPanel extends Vbox implements ToolbarListener,
- EventListener, DataStatusListener, ActionListener
+public class ADWindowPanel extends AbstractADWindowPanel
{
private static final long serialVersionUID = 1L;
@@ -77,1056 +57,94 @@ public class ADWindowPanel extends Vbox implements ToolbarListener,
logger = CLogger.getCLogger(ADWindowPanel.class);
}
- private Properties ctx;
+ private Borderlayout layout;
- private GridWindow gridWindow;
-
- private StatusBarPanel statusBar;
-
- private FTabbox tabbox;
-
- private GridWorkbench workbench;
-
- private int curWindowNo;
-
- private GridTab curTab;
-
- private boolean m_onlyCurrentRows;
-
- private ADTabpanel curTabpanel;
-
- private CWindowToolbar toolbar;
-
- private int curTabIndex;
-
- private String title;
-
- private boolean newRecord;
-
- private boolean boolChanges = false;
-
- private GridPanel gridPanel;
-
- private boolean viewed = false;
-
- private boolean changesOccured = false;
-
- private int m_onlyCurrentDays = 0;
-
- public ADWindowPanel()
- {
-
- }
-
+ private Center contentArea;
+
public ADWindowPanel(Properties ctx, int windowNo)
{
- this.ctx = ctx;
- this.curWindowNo = windowNo;
-
- init();
+ super(ctx, windowNo);
}
- public void showTabbox(boolean visible)
- {
- if (visible)
- tabbox.setVisible(true);
- else
- tabbox.setVisible(false);
- }
-
- private void init()
- {
- initComponents();
-
- Vbox vbox = new Vbox();
- vbox.appendChild(toolbar);
- vbox.appendChild(tabbox);
- vbox.appendChild(statusBar);
- vbox.appendChild(gridPanel);
- this.appendChild(vbox);
- tabbox.addEventListener(Events.ON_SELECT, this);
- }
-
- public StatusBarPanel getStatusBar()
- {
- return statusBar;
- }
-
- private void initComponents()
- {
- /** Initalise toolbar */
- toolbar = new CWindowToolbar();
- toolbar.addListener(this);
-
- statusBar = new StatusBarPanel();
-
- tabbox = new FTabbox();
-
- gridPanel = new GridPanel(curWindowNo, this);
- gridPanel.showGrid(false);
- }
-
- public boolean initPanel(int adWindowId, MQuery query)
- {
- // Set AutoCommit for this Window
- Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx));
- boolean autoNew = Env.isAutoNew(ctx);
- Env.setAutoNew(ctx, curWindowNo, autoNew);
-
- GridWindowVO gWindowVO = AEnv.getMWindowVO(curWindowNo, adWindowId, 0);
- if (gWindowVO == null)
- {
- throw new ApplicationException(Msg.getMsg(ctx,
- "AccessTableNoView")
- + "(No Window Model Info)");
- }
- gridWindow = new GridWindow(gWindowVO);
- title = gridWindow.getName();
- // Set SO/AutoNew for Window
- Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx());
- if (!autoNew && gridWindow.isTransaction())
- {
- Env.setAutoNew(ctx, curWindowNo, true);
- }
-
- /**
- * Window Tabs
- */
- int tabSize = gridWindow.getTabCount();
- for (int tab = 0; tab < tabSize; tab++)
- {
- gridWindow.initTab(tab);
-
- GridTab gTab = gridWindow.getTab(tab);
- Env.setContext(ctx, curWindowNo, tab, "TabLevel", Integer
- .toString(gTab.getTabLevel()));
-
- ADTabpanel fTabPanel = new ADTabpanel();
- fTabPanel.init(this, curWindowNo, gTab, gridWindow);
- gTab.addDataStatusListener(this);
- tabbox.addTab(gTab, fTabPanel);
-
- // Query first tab
- if (tab == 0)
- {
- query = initialQuery(query, gTab);
- if (query != null && query.getRecordCount() <= 1)
- {
- // goSingleRow = true;
- }
- // Set initial Query on first tab
- if (query != null)
- {
- m_onlyCurrentRows = false;
- gTab.setQuery(query);
- }
- curTab = gTab;
- curTabpanel = fTabPanel;
- curTabIndex = tab;
- }
- }
-
- Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName());
- curTab.getTableModel().setChanged(false);
- curTabIndex = 0;
- curTabpanel.query();
- curTabpanel.activate(true);
-
- if (tabbox.getTabCount() > 0)
- {
- tabbox.setSelectedIndex(0);
- }
- toolbar.enableTabNavigation(tabbox.getTabCount() > 1);
- toolbar.enableFind(true);
- tabbox.evaluate(null);
- this.appendChild(tabbox);
-
- if (gridWindow.isTransaction())
- {
- toolbar.enableHistoryRecords(true);
- history(1);
+ protected Component doCreatePart(Component parent)
+ {
+ layout = new Borderlayout();
+ if (layout != null) {
+ layout.setParent(parent);
+ layout.setStyle("position:absolute");
+ layout.setHeight("100%");
+ layout.setWidth("100%");
+ } else {
+ layout.setPage(page);
}
- return true;
- }
-
- /**
- * Initial Query
- *
- * @param query
- * initial query
- * @param mTab
- * tab
- * @return query or null
- */
- private MQuery initialQuery(MQuery query, GridTab mTab)
- {
- // We have a (Zoom) query
- if (query != null && query.isActive() && query.getRecordCount() < 10)
- return query;
- //
- StringBuffer where = new StringBuffer();
- // Query automatically if high volume and no query
- boolean require = mTab.isHighVolume();
- if (!require && !m_onlyCurrentRows) // No Trx Window
- {
- String wh1 = mTab.getWhereExtended();
- if (wh1 == null || wh1.length() == 0)
- wh1 = mTab.getWhereClause();
- if (wh1 != null && wh1.length() > 0)
- where.append(wh1);
- //
- if (query != null)
- {
- String wh2 = query.getWhereClause();
- if (wh2.length() > 0)
- {
- if (where.length() > 0)
- where.append(" AND ");
- where.append(wh2);
- }
- }
- //
- StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM ")
- .append(mTab.getTableName());
- if (where.length() > 0)
- sql.append(" WHERE ").append(where);
- // Does not consider security
- int no = DB.getSQLValue(null, sql.toString());
- //
- require = MRole.getDefault().isQueryRequire(no);
- }
- // Show Query
- if (require)
- {
- GridField[] findFields = mTab.getFields();
- FindWindow find = new FindWindow(curWindowNo,
- mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(),
- where.toString(), findFields, 10); // no query below 10
- if (find.getTitle() != null && find.getTitle().length() > 0) {
- // Title is not set when the number of rows is below the minRecords parameter (10)
- find.setVisible(true);
- AEnv.showWindow(find);
- query = find.getQuery();
- find = null;
- }
- }
- return query;
- } // initialQuery
-
- public String getTitle()
- {
- return title;
- }
-
- public void onDetailRecord()
- {
- int maxInd = tabbox.getTabs().getChildren().size() - 1;
- int curInd = tabbox.getSelectedIndex();
- if (curInd < maxInd)
- {
- tabbox.setSelectedIndex(curInd + 1);
- }
- }
-
- public void onParentRecord()
- {
- int curInd = tabbox.getSelectedIndex();
- if (curInd > 0)
- {
- tabbox.setSelectedIndex(curInd - 1);
- }
- }
-
- public void onFirst()
- {
- curTab.navigate(0);
- }
-
- public void onLast()
- {
- curTab.navigate(curTab.getRowCount() - 1);
- }
-
- public void onNext()
- {
- curTab.navigateRelative(+1);
- }
-
- public void onPrevious()
- {
- curTab.navigateRelative(-1);
- }
-
- public void onHistoryRecords()
- {
- logger.info("");
-
- if (gridWindow.isTransaction())
- {
- if (curTab.needSave(true, true)/* && !onSave(false)*/)
- return;
-
- WOnlyCurrentDays ocd = new WOnlyCurrentDays();
- m_onlyCurrentDays = ocd.getCurrentDays();
-
- history(m_onlyCurrentDays);
- }
- }
-
- private void history(int onlyCurrentDays)
- {
- if (onlyCurrentDays == 1) // Day
- {
- m_onlyCurrentRows = true;
- onlyCurrentDays = 0; // no Created restriction
- }
- else
- m_onlyCurrentRows = false;
-
- curTab.setQuery(null); // reset previous queries
- MRole role = MRole.getDefault();
- int maxRows = role.getMaxQueryRecords();
-
- logger.config("OnlyCurrent=" + m_onlyCurrentRows
- + ", Days=" + m_onlyCurrentDays
- + ", MaxRows=" + maxRows);
-
- curTab.query(m_onlyCurrentRows, onlyCurrentDays, maxRows);
-
- }
-
- public void onAttachment()
- {
-/* int record_ID = curTab.getRecord_ID();
- logger.info("Record_ID=" + record_ID);
-
- if (record_ID == -1) // No Key
- {
- //aAttachment.setEnabled(false);
- return;
- }
-
- // Attachment va =
- new WAttachment ( curWindowNo, curTab.getAD_AttachmentID(),
- curTab.getAD_Table_ID(), record_ID, null);
-
- curTab.loadAttachments(); // reload
- //aAttachment.setPressed(m_curTab.hasAttachment());
-*/ }
-
- public void onGridToggle()
- {
- //curTabpanel.switchRowPresentation();
-
- if (!viewed)
- {
- gridPanel.init(curTab);
- viewed = true;
- }
-
- if (changesOccured)
- {
- changesOccured = false;
- gridPanel.clear();
- gridPanel.init(curTab);
- }
-
- if (tabbox.isVisible())
- {
- tabbox.setVisible(false);
- gridPanel.showGrid(true);
- }
- else
- {
- tabbox.setVisible(true);
- gridPanel.showGrid(false);
- }
-
- }
-
- public void onExit()
- {
- String message = "Please save changes before closing";
-
- if (!boolChanges)
- {
- SessionManager.getAppDesktop().removeWindow();
- }
- else
- FDialog.info(this.curWindowNo, this, message);
- }
-
- public boolean isAsap()
- {
- return true;
- }
-
- private void find()
- {
- MQuery mquery = new MQuery(curTab.getAD_Table_ID());
-
- }
-
- public void onEvent(Event event)
- {
- if (event.getTarget() instanceof Tab && tabbox.containsTab((Tab)event.getTarget()))
- {
-
- boolean back = false;
-
- int oldTabIndex = curTabIndex;
- int newTabIndex = tabbox.getSelectedIndex();
-
- if (oldTabIndex == newTabIndex)
- {
- return;
- }
-
- if (curTabpanel.isEditing())
- {
- FDialog.warn(curWindowNo, "Please save your changes before " +
- "switching tabs!!!", title);
- tabbox.setSelectedIndex(curTabIndex);
- return;
- }
-
- if (!tabbox.updateSelectedIndex(oldTabIndex, newTabIndex))
- {
- FDialog.warn(curWindowNo, "TabSwitchJumpGo", title);
- return;
- }
-
- back = (newTabIndex < oldTabIndex);
-
- ADTabpanel oldTabpanel = curTabpanel;
- ADTabpanel newTabpanel = tabbox.getSelectedTabpanel();
- curTab = newTabpanel.getGridTab();
-
- if (!back)
- {
- newTabpanel.query();
- }
- else
- {
- newTabpanel.refresh();
- }
-
- oldTabpanel.activate(false);
- newTabpanel.activate(true);
- curTabIndex = newTabIndex;
- curTabpanel = newTabpanel;
-
- toolbar.enableChanges(curTab.isReadOnly());
- toolbar.enabledNew(curTab.isInsertRecord());
-
- toolbar.enableTabNavigation(curTabIndex > 0,
- curTabIndex < (tabbox.getTabCount() - 1));
- }
- }
-
- public void dataStatusChanged(DataStatusEvent e)
- {
- /* // update Navigation
- boolean firstRow = e.isFirstRow();
- boolean lastRow = e.isLastRow();
- toolbar.enableFirstNavigation(!firstRow);
- toolbar.enableLastNavigation(!lastRow);
-
- // update Change
- boolean changed = e.isChanged() || e.isInserting();
- boolean readOnly = curTab.isReadOnly();
- boolean insertRecord = !readOnly;
- if (insertRecord)
- {
- insertRecord = curTab.isInsertRecord();
- }
-
- toolbar.enabledNew(!changed && insertRecord);
- toolbar.enableRefresh(!changed);
- toolbar.enableDelete(!changed && !readOnly);
-
- if (readOnly && curTab.isAlwaysUpdateField())
- {
- readOnly = false;
- }
-
- lblRecords.setValue(e.getMessage());
- tabbox.evaluate(e);*/
+ North n = new North();
+ n.setParent(layout);
+ n.setCollapsible(false);
+ n.setHeight("30px");
+ toolbar.setHeight("30px");
+ toolbar.setParent(n);
- logger.info(e.getMessage());
- String dbInfo = e.getMessage();
- if (curTab != null && curTab.isQueryActive())
- dbInfo = "[ " + dbInfo + " ]";
- statusBar.setStatusDB(dbInfo, e);
-
- // Set Message / Info
- if (e.getAD_Message() != null || e.getInfo() != null)
- {
- StringBuffer sb = new StringBuffer();
- String msg = e.getMessage();
- if (msg != null && msg.length() > 0)
- {
- sb.append(Msg.getMsg(Env.getCtx(), e.getAD_Message()));
- }
- String info = e.getInfo();
- if (info != null && info.length() > 0)
- {
- if (sb.length() > 0 && !sb.toString().trim().endsWith(":"))
- sb.append(": ");
- sb.append(info);
- }
- if (sb.length() > 0)
- {
- int pos = sb.indexOf("\n");
- if (pos != -1) // replace CR/NL
- sb.replace(pos, pos+1, " - ");
- statusBar.setStatusLine (sb.toString (), e.isError ());
- }
- }
-
- // Confirm Error
- if (e.isError() && !e.isConfirmed())
- {
- FDialog.error(curWindowNo, this, e.getAD_Message(), e.getInfo());
- e.setConfirmed(true); // show just once - if MTable.setCurrentRow is involved the status event is re-issued
- }
- // Confirm Warning
- else if (e.isWarning() && !e.isConfirmed())
- {
- FDialog.warn(curWindowNo, this, e.getAD_Message(), e.getInfo());
- e.setConfirmed(true); // show just once - if MTable.setCurrentRow is involved the status event is re-issued
- }
-
- // update Navigation
- boolean firstRow = e.isFirstRow();
- boolean lastRow = e.isLastRow();
- toolbar.enableFirstNavigation(!firstRow);
- toolbar.enableLastNavigation(!lastRow);
-
- // update Change
- boolean changed = e.isChanged() || e.isInserting();
- boolChanges = changed;
- boolean readOnly = curTab.isReadOnly();
- boolean insertRecord = !readOnly;
+ contentArea = new Center();
+ contentArea.setParent(layout);
+ contentArea.setAutoscroll(true);
+ contentArea.setFlex(true);
+ adTab.createPart(contentArea);
- if (insertRecord)
- {
- insertRecord = curTab.isInsertRecord();
- }
- toolbar.enabledNew(!changed && insertRecord);
- toolbar.enableCopy(!changed && insertRecord);
- toolbar.enableRefresh(!changed);
- toolbar.enableDelete(!changed && !readOnly);
- //
- if (readOnly && curTab.isAlwaysUpdateField())
- {
- readOnly = false;
- }
- toolbar.enableIgnore(changed && !readOnly);
- toolbar.enableSave(changed && !readOnly);
+ South s = new South();
+ layout.appendChild(s);
+ s.setCollapsible(false);
+ statusBar.setParent(s);
+ LayoutUtils.addSclass("adwindow-status", statusBar);
- //
- // No Rows
- if (e.getTotalRows() == 0 && insertRecord)
+ if (adTab.isUseExternalSelection())
{
- toolbar.enabledNew(true);
- toolbar.enableDelete(false);
- toolbar.enableDeleteSelection(false);
- }
- else
- {
- toolbar.enableDeleteSelection(true);
- }
-
- // Single-Multi
-// aMulti.setPressed(!m_curGC.isSingleRow());
-
- // History (on first Tab only)
- if (isFirstTab())
- {
-// aHistory.setPressed(!curTab.isOnlyCurrentRows());
- }
-
- // Transaction info
- String trxInfo = curTab.getTrxInfo();
- if (trxInfo != null)
- {
-// statusBar.setInfo(trxInfo);
- }
-
- // Check Attachment
- boolean canHaveAttachment = curTab.canHaveAttachment(); // not single _ID column
- //
- if (canHaveAttachment && e.isLoading() &&
- curTab.getCurrentRow() > e.getLoadedRows())
- {
- canHaveAttachment = false;
- }
- if (canHaveAttachment && curTab.getRecord_ID() == -1) // No Key
- {
- canHaveAttachment = false;
- }
- if (canHaveAttachment)
- {
- toolbar.enableAttachment(true);
- /*aAttachment.setPressed(m_curTab.hasAttachment());
- aChat.setEnabled(true);
- aChat.setPressed(m_curTab.hasChat());*/
- }
- else
- {
- toolbar.enableAttachment(false);
-// aChat.setEnabled(false);
- }
- // Lock Indicator
- /* if (m_isPersonalLock)
- {
- aLock.setPressed(m_curTab.isLocked());
- }*/
-
- tabbox.evaluate(e);
-
-
- toolbar.enablePrint(true);
- toolbar.enableReport(true);
- }
-
- public boolean isFirstTab()
- {
- int selTabIndex = tabbox.getSelectedIndex();
- return (selTabIndex == 0);
- }
-
- public void onRefresh()
- {
- curTab.dataRefreshAll();
- curTabpanel.dynamicDisplay(0);
- }
-
- public void onHelp()
- {
- WebDoc doc = gridWindow.getHelpDoc(true);
- SessionManager.getAppDesktop().showURL(doc, "Help", true);
- }
-
- public void onNew()
- {
- if (!curTab.isInsertRecord())
- {
- logger.warning("Insert Record disabled for Tab");
- return;
+ West w = new West();
+ layout.appendChild(w);
+ w.setSplittable(false);
+ w.setAutoscroll(true);
+ LayoutUtils.addSclass("adwindow-nav", w);
+ adTab.getTabSelectionComponent().setParent(w);
+ LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent());
}
- newRecord = curTab.dataNew (false);
- if (newRecord)
- {
-
- curTabpanel.editRecord(true);
- curTabpanel.dynamicDisplay(0);
- toolbar.enableChanges(false);
- toolbar.enableDelete(false);
- toolbar.enableNavigation(false);
- toolbar.enableTabNavigation(false);
- toolbar.enableIgnore(true);
- toolbar.enablePrint(true);
- toolbar.enableReport(true);
+ if (parent instanceof Tabpanel) {
+ TabOnCloseHanlder handler = new TabOnCloseHanlder();
+ ((Tabpanel)parent).setOnCloseHandler(handler);
}
- else
- {
- logger.severe("Could not create new record");
- }
-
- }
-
- public void onFind()
- {
- if (curTab == null)
- return;
-
- // Gets Fields from AD_Field_v
- GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID());
- FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(),
- curTab.getAD_Table_ID(), curTab.getTableName(),
- curTab.getWhereExtended(), findFields, 1);
- AEnv.showWindow(find);
- MQuery query = find.getQuery();
-
- find = null;
-
- // Confirmed query
- if (query != null)
- {
- m_onlyCurrentRows = false; // search history too
- curTab.setQuery(query);
- curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, 0); // autoSize
- }
- }
-
- public void onIgnore()
- {
- curTab.dataIgnore();
- curTab.dataRefresh();
- curTabpanel.dynamicDisplay(0);
- curTabpanel.editRecord(false);
- toolbar.enableIgnore(false);
- }
-
- public void onEdit()
- {
- curTabpanel.editRecord(true);
- toolbar.enableIgnore(true);
- toolbar.enabledNew(false);
- toolbar.enableDelete(false);
- toolbar.enableNavigation(false);
- toolbar.enableTabNavigation(false);
- toolbar.enablePrint(true);
- toolbar.enableReport(true);
- }
-
- public void onSave()
- {
- changesOccured = true;
-
- boolean retValue = curTab.dataSave(true);
-
- if (!retValue)
- {
- FDialog.error(curWindowNo, this, "SaveIgnored");
- statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "SaveIgnored"), true);
- }
- curTabpanel.dynamicDisplay(0);
- }
-
- public void onDelete()
- {
- if (curTab.isReadOnly())
- {
- return;
- }
-
- if (FDialog.ask(curWindowNo, this, "DeleteRecord?"))
- {
- if (!curTab.dataDelete())
- {
- FDialog.error(curWindowNo, "Could not delete record", "Error");
- }
- }
- curTabpanel.dynamicDisplay(0);
+ return layout;
}
- public void onPrint() {
- //Get process defined for this tab
- int AD_Process_ID = curTab.getAD_Process_ID();
- //log.info("ID=" + AD_Process_ID);
+ protected IADTab createADTab()
+ {
+ CompositeADTab composite = new CompositeADTab();
+ return composite;
+ }
- // No report defined
- if (AD_Process_ID == 0)
- {
- onReport();
-
- return;
- }
-
- //TODO: cmd_save(false) -> onSave ?
- //onSave();
- //
- int table_ID = curTab.getAD_Table_ID();
- int record_ID = curTab.getRecord_ID();
-
- ProcessModalDialog dialog = new ProcessModalDialog(null,this.getTitle(),null,0,
- AD_Process_ID,table_ID, record_ID, true);
- if (dialog.isValid()) {
- dialog.setPosition("center");
- try {
- dialog.doModal();
- }
- catch (InterruptedException e) {
-
- e.printStackTrace();
- }
- }
+ public Component getComponent() {
+ return layout;
}
-
- public void onReport() {
- if (!MRole.getDefault().isCanReport(curTab.getAD_Table_ID()))
- {
- FDialog.error(curWindowNo, this, "AccessCannotReport");
- return;
- }
+
+ class TabOnCloseHanlder implements ITabOnCloseHandler {
- //TODO: cmd_save(false); -> onSave ?
-
- // Query
- MQuery query = new MQuery(curTab.getTableName());
- // Link for detail records
- String queryColumn = curTab.getLinkColumnName();
- // Current row otherwise
- if (queryColumn.length() == 0)
- queryColumn = curTab.getKeyColumnName();
- // Find display
- String infoName = null;
- String infoDisplay = null;
- for (int i = 0; i < curTab.getFieldCount(); i++)
- {
- GridField field = curTab.getField(i);
- if (field.isKey())
- infoName = field.getHeader();
- if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo") )
- && field.getValue() != null)
- infoDisplay = field.getValue().toString();
- if (infoName != null && infoDisplay != null)
- break;
- }
- if (queryColumn.length() != 0)
- {
- if (queryColumn.endsWith("_ID"))
- query.addRestriction(queryColumn, MQuery.EQUAL,
- new Integer(Env.getContextAsInt(ctx, curWindowNo, queryColumn)),
- infoName, infoDisplay);
- else
- query.addRestriction(queryColumn, MQuery.EQUAL,
- Env.getContext(ctx, curWindowNo, queryColumn),
- infoName, infoDisplay);
- }
-
- new WReport (curTab.getAD_Table_ID(), query, null, curWindowNo);
-
- }
-
- /**************************************************************************
- * Start Button Process
- * @param vButton button
- */
- private void actionButton (WButtonEditor wButton)
- {
- logger.info(wButton.toString());
-
- boolean startWOasking = false;
- boolean batch = false;
- String col = wButton.getColumnName();
-
- // Zoom
-
- if (col.equals("Record_ID"))
- {
- int AD_Table_ID = Env.getContextAsInt (ctx, curWindowNo, "AD_Table_ID");
- int Record_ID = Env.getContextAsInt (ctx, curWindowNo, "Record_ID");
- AEnv.zoom(AD_Table_ID, Record_ID);
- return;
- } // Zoom
-
- // save first ---------------
-
- if (curTab.needSave(true, false))
- onSave();
-
- int table_ID = curTab.getAD_Table_ID();
-
- // Record_ID
-
- int record_ID = curTab.getRecord_ID();
-
- // Record_ID - Language Handling
-
- if (record_ID == -1 && curTab.getKeyColumnName().equals("AD_Language"))
- record_ID = Env.getContextAsInt (ctx, curWindowNo, "AD_Language_ID");
-
- // Record_ID - Change Log ID
-
- if (record_ID == -1
- && (wButton.getProcess_ID() == 306 || wButton.getProcess_ID() == 307))
- {
- Integer id = (Integer)curTab.getValue("AD_ChangeLog_ID");
- record_ID = id.intValue();
- }
-
- // Ensure it's saved
-
- if (record_ID == -1 && curTab.getKeyColumnName().endsWith("_ID"))
- {
- FDialog.error(curWindowNo, this, "SaveErrorRowNotFound");
- return;
- }
-
- // Pop up Payment Rules
-
- if (col.equals("PaymentRule"))
- {
- WPayment vp = new WPayment(curWindowNo, curTab, wButton);
-
-
- if (vp.isInitOK()) // may not be allowed
- {
- vp.setVisible(true);
- AEnv.showWindow(vp);
- }
- //vp.dispose();
-
- if (vp.needSave())
- {
- onSave();
- onRefresh();
- }
- } // PaymentRule
-
- // Pop up Document Action (Workflow)
-
- else if (col.equals("DocAction"))
- {
- WDocActionPanel win = new WDocActionPanel(curTab);
- //if (win.getNumberOfOptions() == 0)
- //{
- // vda.dispose ();
- // log.info("DocAction - No Options");
- // return;
- //}
- //else
- {
- win.setVisible(true);
- AEnv.showWindow(win);
-
- if (!win.isStartProcess())
- return;
-
- //batch = win.isBatch();
- startWOasking = true;
- //vda.dispose();
- } } // DocAction
-
- // Pop up Create From
-
- else if (col.equals("CreateFrom"))
- {
- // curWindowNo
- WCreateFrom wcf = WCreateFrom.create(curTab);
-
- if (wcf != null)
- {
- if (wcf.isInitOK())
- {
- wcf.setVisible(true);
- curTab.dataRefresh();
+ public void onClose(Tabpanel tabPanel) {
+ if (ADWindowPanel.this.onExit()) {
+ Tab tab = tabPanel.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;
+ }
+ }
}
- return;
+ tabPanel.detach();
+ tab.detach();
}
- // else may start process
- } // CreateFrom
-
- // Posting -----
-
- else if (col.equals("Posted") && MRole.getDefault().isShowAcct())
- {
- // Check Doc Status
-
- String processed = Env.getContext(ctx, curWindowNo, "Processed");
-
- if (!processed.equals("Y"))
- {
- String docStatus = Env.getContext(ctx, curWindowNo, "DocStatus");
-
- if (DocAction.STATUS_Completed.equals(docStatus)
- || DocAction.STATUS_Closed.equals(docStatus)
- || DocAction.STATUS_Reversed.equals(docStatus)
- || DocAction.STATUS_Voided.equals(docStatus))
- ;
- else
- {
- FDialog.error(curWindowNo, this, "PostDocNotComplete");
- return;
- }
- }
-
- // Check Post Status
- Object ps = curTab.getValue("Posted");
-
- if (ps != null && ps.equals("Y"))
- {
- new org.adempiere.webui.acct.WAcctViewer(Env.getContextAsInt (ctx, curWindowNo, "AD_Client_ID"),
- curTab.getAD_Table_ID(), curTab.getRecord_ID());
- }
- else
- {
- if (FDialog.ask(curWindowNo, this, "PostImmediate?"))
- {
- boolean force = ps != null && !ps.equals ("N"); // force when problems
-
- String error = AEnv.postImmediate (curWindowNo, Env.getAD_Client_ID(ctx),
- curTab.getAD_Table_ID(), curTab.getRecord_ID(), force);
-
- curTab.dataRefresh();
-
- if (error != null)
- FDialog.error(curWindowNo, this, "PostingError-N", error);
- }
- }
- return;
- } // Posted
-
- /**
- * Start Process ----
- */
-
- logger.config("Process_ID=" + wButton.getProcess_ID() + ", Record_ID=" + record_ID);
-
- if (wButton.getProcess_ID() == 0)
- return;
-
- // Save item changed
-
- if (curTab.needSave(true, false))
- this.onSave();
-
- // hengsin - [ 1639242 ] Inconsistent appearance of Process/Report Dialog
- // globalqss - Add support for Don't ShowHelp option in Process
- // this code must be changed if integrated the parameters and help in only one window
- /*
- MProcess pr = new MProcess(m_ctx, vButton.getProcess_ID(), null);
- if (pr.getShowHelp() != null && pr.getShowHelp().equals("N")) {
- startWOasking = true;
}
- // end globalqss
-
- // Ask user to start process, if Description and Help is not empty
-
- if (!startWOasking && !(vButton.getDescription().equals("") && vButton.getHelp().equals("")))
- if (!ADialog.ask(m_curWindowNo, this, "StartProcess?",
- // "" + vButton.getText() + "
" +
- vButton.getDescription() + "\n" + vButton.getHelp()))
- return;
- //
- String title = vButton.getDescription();
- if (title == null || title.length() == 0)
- title = vButton.getName();
- ProcessInfo pi = new ProcessInfo (title, vButton.getProcess_ID(), table_ID, record_ID);
- pi.setAD_User_ID (Env.getAD_User_ID(m_ctx));
- pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx));
- pi.setIsBatch(batch);
-
- // Trx trx = Trx.get(Trx.createTrxName("AppsPanel"), true);
- ProcessCtl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI
- */
-
- ProcessModalDialog dialog = new ProcessModalDialog(null,
- Env.getHeader(ctx, curWindowNo), null, curWindowNo,
- wButton.getProcess_ID(), table_ID, record_ID, startWOasking);
-
- if (dialog.isValid())
- {
- dialog.setWidth("500px");
- dialog.setVisible(true);
- dialog.setPosition("center");
- AEnv.showWindow(dialog);
- }
- curTab.dataRefresh();
- curTabpanel.dynamicDisplay(0);
- } // actionButton
-
- public void actionPerformed(ActionEvent event)
- {
- if (event.getSource() instanceof WButtonEditor)
- {
- actionButton((WButtonEditor)event.getSource());
- }
}
}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java
new file mode 100644
index 0000000000..fdf957a55d
--- /dev/null
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java
@@ -0,0 +1,1182 @@
+/******************************************************************************
+ * 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 java.util.Properties;
+
+import org.adempiere.webui.apps.AEnv;
+import org.adempiere.webui.apps.ProcessModalDialog;
+import org.adempiere.webui.apps.WReport;
+import org.adempiere.webui.apps.form.WCreateFrom;
+import org.adempiere.webui.apps.form.WPayment;
+import org.adempiere.webui.component.CWindowToolbar;
+import org.adempiere.webui.component.IADTabList;
+import org.adempiere.webui.component.IADTab;
+import org.adempiere.webui.editor.WButtonEditor;
+import org.adempiere.webui.event.ActionEvent;
+import org.adempiere.webui.event.ActionListener;
+import org.adempiere.webui.event.ToolbarListener;
+import org.adempiere.webui.exception.ApplicationException;
+import org.adempiere.webui.panel.StatusBarPanel;
+import org.adempiere.webui.panel.WDocActionPanel;
+import org.adempiere.webui.panel.WOnlyCurrentDays;
+import org.adempiere.webui.part.AbstractUIPart;
+import org.adempiere.webui.session.SessionManager;
+import org.adempiere.webui.window.FDialog;
+import org.adempiere.webui.window.FindWindow;
+import org.compiere.model.DataStatusEvent;
+import org.compiere.model.DataStatusListener;
+import org.compiere.model.GridField;
+import org.compiere.model.GridTab;
+import org.compiere.model.GridWindow;
+import org.compiere.model.GridWindowVO;
+import org.compiere.model.MQuery;
+import org.compiere.model.MRole;
+import org.compiere.process.DocAction;
+import org.compiere.util.CLogger;
+import org.compiere.util.DB;
+import org.compiere.util.Env;
+import org.compiere.util.Msg;
+import org.compiere.util.WebDoc;
+import org.zkoss.zk.ui.Component;
+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;
+
+/**
+ *
+ * This class is based on org.compiere.apps.APanel written by Jorg Janke.
+ * @author Jorg Janke
+ *
+ * @author Ashley G Ramdass
+ * @author Low Heng Sin
+ * @date Feb 25, 2007
+ * @version $Revision: 0.10 $
+ */
+public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener,
+ EventListener, DataStatusListener, ActionListener
+{
+ private static final long serialVersionUID = 1L;
+
+ private static final CLogger logger;
+
+ static
+ {
+ logger = CLogger.getCLogger(AbstractADWindowPanel.class);
+ }
+
+ private Properties ctx;
+
+ private GridWindow gridWindow;
+
+ protected StatusBarPanel statusBar;
+
+ protected IADTab adTab;
+
+ private int curWindowNo;
+
+ private GridTab curTab;
+
+ private boolean m_onlyCurrentRows = true;
+
+ private ADTabpanel curTabpanel;
+
+ protected CWindowToolbar toolbar;
+
+ private int curTabIndex;
+
+ protected String title;
+
+ private boolean newRecord;
+
+ private boolean boolChanges = false;
+
+ private boolean viewed = false;
+
+ private boolean changesOccured = false;
+
+ private int m_onlyCurrentDays = 0;
+
+ private Component parent;
+
+ public AbstractADWindowPanel(Properties ctx, int windowNo)
+ {
+ this.ctx = ctx;
+ this.curWindowNo = windowNo;
+
+ initComponents();
+ }
+
+ public Component createPart(Object parent)
+ {
+ if (parent instanceof Component)
+ this.parent = (Component) parent;
+
+ adTab = createADTab();
+ adTab.addSelectionEventListener(this);
+
+ return super.createPart(parent);
+ }
+
+ public StatusBarPanel getStatusBar()
+ {
+ return statusBar;
+ }
+
+ private void initComponents()
+ {
+ /** Initalise toolbar */
+ toolbar = new CWindowToolbar();
+ toolbar.addListener(this);
+ toolbar.setWidth("100%");
+
+ statusBar = new StatusBarPanel();
+ }
+
+ protected abstract IADTab createADTab();
+
+ public boolean initPanel(int adWindowId, MQuery query)
+ {
+ // Set AutoCommit for this Window
+ Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx));
+ boolean autoNew = Env.isAutoNew(ctx);
+ Env.setAutoNew(ctx, curWindowNo, autoNew);
+
+ GridWindowVO gWindowVO = AEnv.getMWindowVO(curWindowNo, adWindowId, 0);
+ if (gWindowVO == null)
+ {
+ throw new ApplicationException(Msg.getMsg(ctx,
+ "AccessTableNoView")
+ + "(No Window Model Info)");
+ }
+ gridWindow = new GridWindow(gWindowVO);
+ title = gridWindow.getName();
+
+ // Set SO/AutoNew for Window
+ Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx());
+ if (!autoNew && gridWindow.isTransaction())
+ {
+ Env.setAutoNew(ctx, curWindowNo, true);
+ }
+
+ m_onlyCurrentRows = gridWindow.isTransaction();
+
+ /**
+ * Window Tabs
+ */
+ int tabSize = gridWindow.getTabCount();
+
+ for (int tab = 0; tab < tabSize; tab++)
+ {
+ gridWindow.initTab(tab);
+
+ GridTab gTab = gridWindow.getTab(tab);
+ Env.setContext(ctx, curWindowNo, tab, "TabLevel", Integer
+ .toString(gTab.getTabLevel()));
+
+ ADTabpanel fTabPanel = new ADTabpanel();
+ fTabPanel.init(this, curWindowNo, gTab, gridWindow);
+ if (tab == 0)
+ fTabPanel.createUI();
+
+ gTab.addDataStatusListener(this);
+
+ adTab.addTab(gTab, fTabPanel);
+
+ // Query first tab
+ if (tab == 0)
+ {
+ query = initialQuery(query, gTab);
+ if (query != null && query.getRecordCount() <= 1)
+ {
+ // goSingleRow = true;
+ }
+ // Set initial Query on first tab
+ if (query != null)
+ {
+ m_onlyCurrentRows = false;
+ gTab.setQuery(query);
+ }
+ curTab = gTab;
+ curTabpanel = fTabPanel;
+ curTabIndex = tab;
+ }
+ }
+
+// ADTabListModel model = new ADTabListModel(tabLabelList, tabbox);
+// tabList.setItemRenderer(model);
+// tabList.setModel(model);
+// tabList.setSelectedIndex(0);
+
+ Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName());
+ curTab.getTableModel().setChanged(false);
+ curTabIndex = 0;
+ curTabpanel.query();
+ curTabpanel.activate(true);
+
+ //if (tabbox.getTabCount() > 0)
+ //{
+ adTab.setSelectedIndex(0);
+ //}
+ toolbar.enableTabNavigation(adTab.getTabCount() > 1);
+ toolbar.enableFind(true);
+ adTab.evaluate(null);
+
+ //force sync model
+// tabList.setModel(tabList.getModel());
+
+ if (gridWindow.isTransaction())
+ {
+ toolbar.enableHistoryRecords(true);
+ history(1);
+ }
+
+ updateToolbar();
+
+ return true;
+ }
+
+ /**
+ * Initial Query
+ *
+ * @param query
+ * initial query
+ * @param mTab
+ * tab
+ * @return query or null
+ */
+ private MQuery initialQuery(MQuery query, GridTab mTab)
+ {
+ // We have a (Zoom) query
+ if (query != null && query.isActive() && query.getRecordCount() < 10)
+ return query;
+ //
+ StringBuffer where = new StringBuffer();
+ // Query automatically if high volume and no query
+ boolean require = mTab.isHighVolume();
+ if (!require && !m_onlyCurrentRows) // No Trx Window
+ {
+ String wh1 = mTab.getWhereExtended();
+ if (wh1 == null || wh1.length() == 0)
+ wh1 = mTab.getWhereClause();
+ if (wh1 != null && wh1.length() > 0)
+ where.append(wh1);
+ //
+ if (query != null)
+ {
+ String wh2 = query.getWhereClause();
+ if (wh2.length() > 0)
+ {
+ if (where.length() > 0)
+ where.append(" AND ");
+ where.append(wh2);
+ }
+ }
+ //
+ StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM ")
+ .append(mTab.getTableName());
+ if (where.length() > 0)
+ sql.append(" WHERE ").append(where);
+ // Does not consider security
+ int no = DB.getSQLValue(null, sql.toString());
+ //
+ require = MRole.getDefault().isQueryRequire(no);
+ }
+ // Show Query
+ if (require)
+ {
+ GridField[] findFields = mTab.getFields();
+ FindWindow find = new FindWindow(curWindowNo,
+ mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(),
+ where.toString(), findFields, 10); // no query below 10
+ if (find.getTitle() != null && find.getTitle().length() > 0) {
+ // Title is not set when the number of rows is below the minRecords parameter (10)
+ find.setVisible(true);
+ AEnv.showWindow(find);
+ query = find.getQuery();
+ find = null;
+ }
+ }
+ return query;
+ } // initialQuery
+
+ public String getTitle()
+ {
+ return title;
+ }
+
+ public void onDetailRecord()
+ {
+ int maxInd = adTab.getTabCount() - 1;
+ int curInd = adTab.getSelectedIndex();
+ if (curInd < maxInd)
+ {
+ setActiveTab(curInd + 1);
+ }
+ }
+
+ public void onParentRecord()
+ {
+ int curInd = adTab.getSelectedIndex();
+ if (curInd > 0)
+ {
+ setActiveTab(curInd - 1);
+ }
+ }
+
+ public void onFirst()
+ {
+ curTab.navigate(0);
+ }
+
+ public void onLast()
+ {
+ curTab.navigate(curTab.getRowCount() - 1);
+ }
+
+ public void onNext()
+ {
+ curTab.navigateRelative(+1);
+ }
+
+ public void onPrevious()
+ {
+ curTab.navigateRelative(-1);
+ }
+
+ public void onHistoryRecords()
+ {
+ logger.info("");
+
+ if (gridWindow.isTransaction())
+ {
+ if (curTab.needSave(true, true)/* && !onSave(false)*/)
+ return;
+
+ WOnlyCurrentDays ocd = new WOnlyCurrentDays();
+ m_onlyCurrentDays = ocd.getCurrentDays();
+
+ history(m_onlyCurrentDays);
+ }
+ }
+
+ private void history(int onlyCurrentDays)
+ {
+ if (onlyCurrentDays == 1) // Day
+ {
+ m_onlyCurrentRows = true;
+ onlyCurrentDays = 0; // no Created restriction
+ }
+ else
+ m_onlyCurrentRows = false;
+
+ curTab.setQuery(null); // reset previous queries
+ MRole role = MRole.getDefault();
+ int maxRows = role.getMaxQueryRecords();
+
+ logger.config("OnlyCurrent=" + m_onlyCurrentRows
+ + ", Days=" + m_onlyCurrentDays
+ + ", MaxRows=" + maxRows);
+
+ curTab.query(m_onlyCurrentRows, onlyCurrentDays, maxRows);
+
+ }
+
+ public void onAttachment()
+ {
+ int record_ID = curTab.getRecord_ID();
+ logger.info("Record_ID=" + record_ID);
+
+ if (record_ID == -1) // No Key
+ {
+ //aAttachment.setEnabled(false);
+ return;
+ }
+
+ // Attachment va =
+ new WAttachment ( curWindowNo, curTab.getAD_AttachmentID(),
+ curTab.getAD_Table_ID(), record_ID, null);
+
+ curTab.loadAttachments(); // reload
+ //aAttachment.setPressed(m_curTab.hasAttachment());
+ }
+
+ public void onGridToggle()
+ {
+ curTabpanel.switchRowPresentation();
+
+ /*
+ if (!viewed)
+ {
+ viewed = true;
+ }
+
+ if (changesOccured)
+ {
+ changesOccured = false;
+ }
+
+ if (tabbox.isVisible())
+ {
+ tabbox.setVisible(false);
+ }
+ else
+ {
+ tabbox.setVisible(true);
+ }
+ */
+ }
+
+ public boolean onExit()
+ {
+ String message = "Please save changes before closing";
+
+ if (!boolChanges)
+ {
+ return true;
+ }
+ else
+ FDialog.info(this.curWindowNo, null, message);
+
+ return false;
+ }
+
+ public boolean isAsap()
+ {
+ return true;
+ }
+
+ private void find()
+ {
+ MQuery mquery = new MQuery(curTab.getAD_Table_ID());
+
+ }
+
+ public void onEvent(Event event)
+ {
+ if (!Events.ON_SELECT.equals(event.getName()))
+ return;
+
+ IADTabList tabList = null;
+ Component target = event.getTarget();
+ if (target instanceof IADTabList)
+ {
+ tabList = (IADTabList) target;
+ }
+ else
+ {
+ target = target.getParent();
+ while(target != null)
+ {
+ if (target instanceof IADTabList)
+ {
+ tabList = (IADTabList) target;
+ break;
+ }
+ target = target.getParent();
+ }
+ }
+
+ if (tabList != null)
+ {
+ int newTabIndex = tabList.getSelectedIndex();
+
+ if (setActiveTab(newTabIndex))
+ {
+ //force sync model
+ tabList.refresh();
+ }
+ else
+ {
+ //reset to original
+ tabList.setSelectedIndex(curTabIndex);
+ }
+ }
+ }
+
+ private boolean setActiveTab(int newTabIndex) {
+ boolean back = false;
+
+ int oldTabIndex = curTabIndex;
+
+ if (oldTabIndex == newTabIndex)
+ {
+ return true;
+ }
+
+ if (curTabpanel.isEditing())
+ {
+ FDialog.warn(curWindowNo, "Please save your changes before " +
+ "switching tabs!!!", title);
+ return false;
+ }
+
+ if (!adTab.updateSelectedIndex(oldTabIndex, newTabIndex))
+ {
+ FDialog.warn(curWindowNo, "TabSwitchJumpGo", title);
+ return false;
+ }
+
+ back = (newTabIndex < oldTabIndex);
+
+ ADTabpanel oldTabpanel = curTabpanel;
+ ADTabpanel newTabpanel = adTab.getSelectedTabpanel();
+ curTab = newTabpanel.getGridTab();
+
+ if (oldTabpanel != null)
+ oldTabpanel.activate(false);
+ newTabpanel.activate(true);
+
+ if (!back)
+ {
+ newTabpanel.query();
+ }
+ else
+ {
+ newTabpanel.refresh();
+ }
+
+ curTabIndex = newTabIndex;
+ curTabpanel = newTabpanel;
+
+ updateToolbar();
+
+ return true;
+ }
+
+ private void updateToolbar() {
+ toolbar.enableChanges(curTab.isReadOnly());
+ toolbar.enabledNew(curTab.isInsertRecord());
+
+ toolbar.enableTabNavigation(curTabIndex > 0,
+ curTabIndex < (adTab.getTabCount() - 1));
+ }
+
+ public void dataStatusChanged(DataStatusEvent e)
+ {
+ //TODO: ignore non-ui thread event for now.
+ if (Executions.getCurrent() == null)
+ return;
+
+ /* // update Navigation
+ boolean firstRow = e.isFirstRow();
+ boolean lastRow = e.isLastRow();
+ toolbar.enableFirstNavigation(!firstRow);
+ toolbar.enableLastNavigation(!lastRow);
+
+ // update Change
+ boolean changed = e.isChanged() || e.isInserting();
+ boolean readOnly = curTab.isReadOnly();
+ boolean insertRecord = !readOnly;
+ if (insertRecord)
+ {
+ insertRecord = curTab.isInsertRecord();
+ }
+
+ toolbar.enabledNew(!changed && insertRecord);
+ toolbar.enableRefresh(!changed);
+ toolbar.enableDelete(!changed && !readOnly);
+
+ if (readOnly && curTab.isAlwaysUpdateField())
+ {
+ readOnly = false;
+ }
+
+ lblRecords.setValue(e.getMessage());
+ tabbox.evaluate(e);*/
+
+ logger.info(e.getMessage());
+ String dbInfo = e.getMessage();
+ if (curTab != null && curTab.isQueryActive())
+ dbInfo = "[ " + dbInfo + " ]";
+ statusBar.setStatusDB(dbInfo, e);
+
+ // Set Message / Info
+ if (e.getAD_Message() != null || e.getInfo() != null)
+ {
+ StringBuffer sb = new StringBuffer();
+ String msg = e.getMessage();
+ if (msg != null && msg.length() > 0)
+ {
+ sb.append(Msg.getMsg(Env.getCtx(), e.getAD_Message()));
+ }
+ String info = e.getInfo();
+ if (info != null && info.length() > 0)
+ {
+ if (sb.length() > 0 && !sb.toString().trim().endsWith(":"))
+ sb.append(": ");
+ sb.append(info);
+ }
+ if (sb.length() > 0)
+ {
+ int pos = sb.indexOf("\n");
+ if (pos != -1) // replace CR/NL
+ sb.replace(pos, pos+1, " - ");
+ statusBar.setStatusLine (sb.toString (), e.isError ());
+ }
+ }
+
+ // Confirm Error
+ if (e.isError() && !e.isConfirmed())
+ {
+ FDialog.error(curWindowNo, null, e.getAD_Message(), e.getInfo());
+ e.setConfirmed(true); // show just once - if MTable.setCurrentRow is involved the status event is re-issued
+ }
+ // Confirm Warning
+ else if (e.isWarning() && !e.isConfirmed())
+ {
+ FDialog.warn(curWindowNo, null, e.getAD_Message(), e.getInfo());
+ e.setConfirmed(true); // show just once - if MTable.setCurrentRow is involved the status event is re-issued
+ }
+
+ // update Navigation
+ boolean firstRow = e.isFirstRow();
+ boolean lastRow = e.isLastRow();
+ toolbar.enableFirstNavigation(!firstRow);
+ toolbar.enableLastNavigation(!lastRow);
+
+ // update Change
+ boolean changed = e.isChanged() || e.isInserting();
+ boolChanges = changed;
+ boolean readOnly = curTab.isReadOnly();
+ boolean insertRecord = !readOnly;
+
+ if (insertRecord)
+ {
+ insertRecord = curTab.isInsertRecord();
+ }
+ toolbar.enabledNew(!changed && insertRecord);
+ toolbar.enableCopy(!changed && insertRecord);
+ toolbar.enableRefresh(!changed);
+ toolbar.enableDelete(!changed && !readOnly);
+ //
+ if (readOnly && curTab.isAlwaysUpdateField())
+ {
+ readOnly = false;
+ }
+ toolbar.enableIgnore(changed && !readOnly);
+ toolbar.enableSave(changed && !readOnly);
+
+ //
+ // No Rows
+ if (e.getTotalRows() == 0 && insertRecord)
+ {
+ toolbar.enabledNew(true);
+ toolbar.enableDelete(false);
+ toolbar.enableDeleteSelection(false);
+ }
+ else
+ {
+ toolbar.enableDeleteSelection(true);
+ }
+
+ // Single-Multi
+// aMulti.setPressed(!m_curGC.isSingleRow());
+
+ // History (on first Tab only)
+ if (isFirstTab())
+ {
+// aHistory.setPressed(!curTab.isOnlyCurrentRows());
+ }
+
+ // Transaction info
+ String trxInfo = curTab.getTrxInfo();
+ if (trxInfo != null)
+ {
+// statusBar.setInfo(trxInfo);
+ }
+
+ // Check Attachment
+ boolean canHaveAttachment = curTab.canHaveAttachment(); // not single _ID column
+ //
+ if (canHaveAttachment && e.isLoading() &&
+ curTab.getCurrentRow() > e.getLoadedRows())
+ {
+ canHaveAttachment = false;
+ }
+ if (canHaveAttachment && curTab.getRecord_ID() == -1) // No Key
+ {
+ canHaveAttachment = false;
+ }
+ if (canHaveAttachment)
+ {
+ toolbar.enableAttachment(true);
+ /*aAttachment.setPressed(m_curTab.hasAttachment());
+ aChat.setEnabled(true);
+ aChat.setPressed(m_curTab.hasChat());*/
+ }
+ else
+ {
+ toolbar.enableAttachment(false);
+// aChat.setEnabled(false);
+ }
+ // Lock Indicator
+ /* if (m_isPersonalLock)
+ {
+ aLock.setPressed(m_curTab.isLocked());
+ }*/
+
+ adTab.evaluate(e);
+
+ toolbar.enablePrint(true);
+ toolbar.enableReport(true);
+ }
+
+ public boolean isFirstTab()
+ {
+ int selTabIndex = adTab.getSelectedIndex();
+ return (selTabIndex == 0);
+ }
+
+ public void onRefresh()
+ {
+ curTab.dataRefreshAll();
+ curTabpanel.dynamicDisplay(0);
+ }
+
+ public void onHelp()
+ {
+ WebDoc doc = gridWindow.getHelpDoc(true);
+ SessionManager.getAppDesktop().showURL(doc, "Help", true);
+ }
+
+ public void onNew()
+ {
+ if (!curTab.isInsertRecord())
+ {
+ logger.warning("Insert Record disabled for Tab");
+ return;
+ }
+
+ newRecord = curTab.dataNew (false);
+ if (newRecord)
+ {
+
+ curTabpanel.editRecord(true);
+ curTabpanel.dynamicDisplay(0);
+ toolbar.enableChanges(false);
+ toolbar.enableDelete(false);
+ toolbar.enableNavigation(false);
+ toolbar.enableTabNavigation(false);
+ toolbar.enableIgnore(true);
+ toolbar.enablePrint(true);
+ toolbar.enableReport(true);
+ }
+ else
+ {
+ logger.severe("Could not create new record");
+ }
+
+ }
+
+ public void onFind()
+ {
+ if (curTab == null)
+ return;
+
+ // Gets Fields from AD_Field_v
+ GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID());
+ FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(),
+ curTab.getAD_Table_ID(), curTab.getTableName(),
+ curTab.getWhereExtended(), findFields, 1);
+ AEnv.showWindow(find);
+ MQuery query = find.getQuery();
+
+ find = null;
+
+ // Confirmed query
+ if (query != null)
+ {
+ m_onlyCurrentRows = false; // search history too
+ curTab.setQuery(query);
+ curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, 0); // autoSize
+ }
+ }
+
+ public void onIgnore()
+ {
+ curTab.dataIgnore();
+ curTab.dataRefresh();
+ curTabpanel.dynamicDisplay(0);
+ curTabpanel.editRecord(false);
+ toolbar.enableIgnore(false);
+ }
+
+ public void onEdit()
+ {
+ curTabpanel.editRecord(true);
+ toolbar.enableIgnore(true);
+ toolbar.enabledNew(false);
+ toolbar.enableDelete(false);
+ toolbar.enableNavigation(false);
+ toolbar.enableTabNavigation(false);
+ toolbar.enablePrint(true);
+ toolbar.enableReport(true);
+ }
+
+ public void onSave()
+ {
+ changesOccured = true;
+
+ boolean retValue = curTab.dataSave(true);
+
+ if (!retValue)
+ {
+ FDialog.error(curWindowNo, parent, "SaveIgnored");
+ statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "SaveIgnored"), true);
+ }
+ curTabpanel.dynamicDisplay(0);
+ }
+
+ public void onDelete()
+ {
+ if (curTab.isReadOnly())
+ {
+ return;
+ }
+
+ if (FDialog.ask(curWindowNo, null, "DeleteRecord?"))
+ {
+ if (!curTab.dataDelete())
+ {
+ FDialog.error(curWindowNo, "Could not delete record", "Error");
+ }
+ }
+ curTabpanel.dynamicDisplay(0);
+ }
+
+ public void onPrint() {
+ //Get process defined for this tab
+ int AD_Process_ID = curTab.getAD_Process_ID();
+ //log.info("ID=" + AD_Process_ID);
+
+ // No report defined
+ if (AD_Process_ID == 0)
+ {
+ onReport();
+
+ return;
+ }
+
+ //TODO: cmd_save(false) -> onSave ?
+ //onSave();
+ //
+ int table_ID = curTab.getAD_Table_ID();
+ int record_ID = curTab.getRecord_ID();
+
+ ProcessModalDialog dialog = new ProcessModalDialog(null,this.getTitle(),null,0,
+ AD_Process_ID,table_ID, record_ID, true);
+ if (dialog.isValid()) {
+ dialog.setPosition("center");
+ try {
+ dialog.doModal();
+ }
+ catch (InterruptedException e) {
+
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public void onReport() {
+ if (!MRole.getDefault().isCanReport(curTab.getAD_Table_ID()))
+ {
+ FDialog.error(curWindowNo, parent, "AccessCannotReport");
+ return;
+ }
+
+ //TODO: cmd_save(false); -> onSave ?
+
+ // Query
+ MQuery query = new MQuery(curTab.getTableName());
+ // Link for detail records
+ String queryColumn = curTab.getLinkColumnName();
+ // Current row otherwise
+ if (queryColumn.length() == 0)
+ queryColumn = curTab.getKeyColumnName();
+ // Find display
+ String infoName = null;
+ String infoDisplay = null;
+ for (int i = 0; i < curTab.getFieldCount(); i++)
+ {
+ GridField field = curTab.getField(i);
+ if (field.isKey())
+ infoName = field.getHeader();
+ if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo") )
+ && field.getValue() != null)
+ infoDisplay = field.getValue().toString();
+ if (infoName != null && infoDisplay != null)
+ break;
+ }
+ if (queryColumn.length() != 0)
+ {
+ if (queryColumn.endsWith("_ID"))
+ query.addRestriction(queryColumn, MQuery.EQUAL,
+ new Integer(Env.getContextAsInt(ctx, curWindowNo, queryColumn)),
+ infoName, infoDisplay);
+ else
+ query.addRestriction(queryColumn, MQuery.EQUAL,
+ Env.getContext(ctx, curWindowNo, queryColumn),
+ infoName, infoDisplay);
+ }
+
+ new WReport (curTab.getAD_Table_ID(), query, null, curWindowNo);
+
+ }
+
+ /**************************************************************************
+ * Start Button Process
+ * @param vButton button
+ */
+ private void actionButton (WButtonEditor wButton)
+ {
+ logger.info(wButton.toString());
+
+ boolean startWOasking = false;
+ boolean batch = false;
+ String col = wButton.getColumnName();
+
+ // Zoom
+
+ if (col.equals("Record_ID"))
+ {
+ int AD_Table_ID = Env.getContextAsInt (ctx, curWindowNo, "AD_Table_ID");
+ int Record_ID = Env.getContextAsInt (ctx, curWindowNo, "Record_ID");
+ AEnv.zoom(AD_Table_ID, Record_ID);
+ return;
+ } // Zoom
+
+ // save first ---------------
+
+ if (curTab.needSave(true, false))
+ onSave();
+
+ int table_ID = curTab.getAD_Table_ID();
+
+ // Record_ID
+
+ int record_ID = curTab.getRecord_ID();
+
+ // Record_ID - Language Handling
+
+ if (record_ID == -1 && curTab.getKeyColumnName().equals("AD_Language"))
+ record_ID = Env.getContextAsInt (ctx, curWindowNo, "AD_Language_ID");
+
+ // Record_ID - Change Log ID
+
+ if (record_ID == -1
+ && (wButton.getProcess_ID() == 306 || wButton.getProcess_ID() == 307))
+ {
+ Integer id = (Integer)curTab.getValue("AD_ChangeLog_ID");
+ record_ID = id.intValue();
+ }
+
+ // Ensure it's saved
+
+ if (record_ID == -1 && curTab.getKeyColumnName().endsWith("_ID"))
+ {
+ FDialog.error(curWindowNo, parent, "SaveErrorRowNotFound");
+ return;
+ }
+
+ // Pop up Payment Rules
+
+ if (col.equals("PaymentRule"))
+ {
+ WPayment vp = new WPayment(curWindowNo, curTab, wButton);
+
+
+ if (vp.isInitOK()) // may not be allowed
+ {
+ vp.setVisible(true);
+ AEnv.showWindow(vp);
+ }
+ //vp.dispose();
+
+ if (vp.needSave())
+ {
+ onSave();
+ onRefresh();
+ }
+ } // PaymentRule
+
+ // Pop up Document Action (Workflow)
+
+ else if (col.equals("DocAction"))
+ {
+ WDocActionPanel win = new WDocActionPanel(curTab);
+ //if (win.getNumberOfOptions() == 0)
+ //{
+ // vda.dispose ();
+ // log.info("DocAction - No Options");
+ // return;
+ //}
+ //else
+ {
+ win.setVisible(true);
+ AEnv.showWindow(win);
+
+ if (!win.isStartProcess())
+ return;
+
+ //batch = win.isBatch();
+ startWOasking = true;
+ //vda.dispose();
+ } } // DocAction
+
+ // Pop up Create From
+
+ else if (col.equals("CreateFrom"))
+ {
+ // curWindowNo
+ WCreateFrom wcf = WCreateFrom.create(curTab);
+
+ if (wcf != null)
+ {
+ if (wcf.isInitOK())
+ {
+ wcf.setVisible(true);
+ curTab.dataRefresh();
+ }
+ return;
+ }
+ // else may start process
+ } // CreateFrom
+
+ // Posting -----
+
+ else if (col.equals("Posted") && MRole.getDefault().isShowAcct())
+ {
+ // Check Doc Status
+
+ String processed = Env.getContext(ctx, curWindowNo, "Processed");
+
+ if (!processed.equals("Y"))
+ {
+ String docStatus = Env.getContext(ctx, curWindowNo, "DocStatus");
+
+ if (DocAction.STATUS_Completed.equals(docStatus)
+ || DocAction.STATUS_Closed.equals(docStatus)
+ || DocAction.STATUS_Reversed.equals(docStatus)
+ || DocAction.STATUS_Voided.equals(docStatus))
+ ;
+ else
+ {
+ FDialog.error(curWindowNo, parent, "PostDocNotComplete");
+ return;
+ }
+ }
+
+ // Check Post Status
+ Object ps = curTab.getValue("Posted");
+
+ if (ps != null && ps.equals("Y"))
+ {
+ new org.adempiere.webui.acct.WAcctViewer(Env.getContextAsInt (ctx, curWindowNo, "AD_Client_ID"),
+ curTab.getAD_Table_ID(), curTab.getRecord_ID());
+ }
+ else
+ {
+ if (FDialog.ask(curWindowNo, null, "PostImmediate?"))
+ {
+ boolean force = ps != null && !ps.equals ("N"); // force when problems
+
+ String error = AEnv.postImmediate (curWindowNo, Env.getAD_Client_ID(ctx),
+ curTab.getAD_Table_ID(), curTab.getRecord_ID(), force);
+
+ curTab.dataRefresh();
+
+ if (error != null)
+ FDialog.error(curWindowNo, null, "PostingError-N", error);
+ }
+ }
+ return;
+ } // Posted
+
+ /**
+ * Start Process ----
+ */
+
+ logger.config("Process_ID=" + wButton.getProcess_ID() + ", Record_ID=" + record_ID);
+
+ if (wButton.getProcess_ID() == 0)
+ return;
+
+ // Save item changed
+
+ if (curTab.needSave(true, false))
+ this.onSave();
+
+ // hengsin - [ 1639242 ] Inconsistent appearance of Process/Report Dialog
+ // globalqss - Add support for Don't ShowHelp option in Process
+ // this code must be changed if integrated the parameters and help in only one window
+ /*
+ MProcess pr = new MProcess(m_ctx, vButton.getProcess_ID(), null);
+ if (pr.getShowHelp() != null && pr.getShowHelp().equals("N")) {
+ startWOasking = true;
+ }
+ // end globalqss
+
+ // Ask user to start process, if Description and Help is not empty
+
+ if (!startWOasking && !(vButton.getDescription().equals("") && vButton.getHelp().equals("")))
+ if (!ADialog.ask(m_curWindowNo, this, "StartProcess?",
+ // "" + vButton.getText() + "
" +
+ vButton.getDescription() + "\n" + vButton.getHelp()))
+ return;
+ //
+ String title = vButton.getDescription();
+ if (title == null || title.length() == 0)
+ title = vButton.getName();
+ ProcessInfo pi = new ProcessInfo (title, vButton.getProcess_ID(), table_ID, record_ID);
+ pi.setAD_User_ID (Env.getAD_User_ID(m_ctx));
+ pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx));
+ pi.setIsBatch(batch);
+
+ // Trx trx = Trx.get(Trx.createTrxName("AppsPanel"), true);
+ ProcessCtl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI
+ */
+
+ ProcessModalDialog dialog = new ProcessModalDialog(null,
+ Env.getHeader(ctx, curWindowNo), null, curWindowNo,
+ wButton.getProcess_ID(), table_ID, record_ID, startWOasking);
+
+ if (dialog.isValid())
+ {
+ dialog.setWidth("500px");
+ dialog.setVisible(true);
+ dialog.setPosition("center");
+ AEnv.showWindow(dialog);
+ }
+ curTab.dataRefresh();
+ curTabpanel.dynamicDisplay(0);
+ } // actionButton
+
+ public void actionPerformed(ActionEvent event)
+ {
+ if (event.getSource() instanceof WButtonEditor)
+ {
+ actionButton((WButtonEditor)event.getSource());
+ }
+ }
+
+ public IADTab getADTab() {
+ return adTab;
+ }
+}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java
index 7132cba05c..c71dbe9d2a 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java
@@ -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 Ashley G Ramdass
+ * @author Low Heng Sin
* @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();
}
}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java
new file mode 100644
index 0000000000..e626018fdf
--- /dev/null
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java
@@ -0,0 +1,7 @@
+package org.adempiere.webui.panel;
+
+import org.adempiere.webui.component.Tabpanel;
+
+public interface ITabOnCloseHandler {
+ public void onClose(Tabpanel tabPanel);
+}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java
index d8092e56bd..ca09cf45d0 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java
@@ -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);
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java
index 005ac4aa17..ca7faafe45 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java
@@ -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;
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java
index b2cb4bdc64..9145c10c29 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java
@@ -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);
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SidePanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SidePanel.java
index 049ec65709..c0bf53ac5b 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SidePanel.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SidePanel.java
@@ -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
- {
-
- }
}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SideUserPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SideUserPanel.java
deleted file mode 100644
index 8bb8e11f33..0000000000
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SideUserPanel.java
+++ /dev/null
@@ -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 Ashley G Ramdass
- * @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());
- }
-}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java
index ec6daa2bba..78fda30b82 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java
@@ -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, "
");
+ Messagebox.showDialog(roleInfo, "Role Info", Messagebox.OK, Messagebox.INFORMATION);
+ }
}
}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java
index 094698b56d..5df1000db7 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java
@@ -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
/**
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java
index be977cfc4d..a895dcc499 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java
@@ -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"));
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java
new file mode 100644
index 0000000000..7a0672272b
--- /dev/null
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java
@@ -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);
+
+}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MainPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/MultiTabPart.java
similarity index 63%
rename from extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MainPanel.java
rename to extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/MultiTabPart.java
index a8169e51da..c0dcf3116d 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MainPanel.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/MultiTabPart.java
@@ -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;
+ }
}
-
-
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/UIPart.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/UIPart.java
new file mode 100644
index 0000000000..c028b9ae0c
--- /dev/null
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/UIPart.java
@@ -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();
+
+}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java
new file mode 100644
index 0000000000..f27746c49c
--- /dev/null
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java
@@ -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 Ashley G Ramdass
+ * @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;
+ }
+}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java
index 39ea250453..9488588801 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java
@@ -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;
/**
*
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionManager.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionManager.java
index d22557d6cb..6a247aa9a2 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionManager.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionManager.java
@@ -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()
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/ADWindow.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/ADWindow.java
index 4df87894e7..22bc314cea 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/ADWindow.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/ADWindow.java
@@ -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;
+ }
}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java
new file mode 100644
index 0000000000..9c04499ac9
--- /dev/null
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java
@@ -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 + "
");
+ text.setParent(this);
+ text = new Text(Adempiere.DB_VERSION +"
");
+ 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();
+ }
+
+}
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java
index db35cee3b7..be0911e8da 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java
@@ -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();
diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java
index ff2597e9ea..cac75fda53 100644
--- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java
+++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java
@@ -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");
}
diff --git a/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/Executions.java b/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/Executions.java
deleted file mode 100644
index e49f8cf496..0000000000
--- a/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/Executions.java
+++ /dev/null
@@ -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}).
- *
- * 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.
- *
- *
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}).
- *
- *
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.
- *
- *
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.
- *
- *
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)}.
- *
- *
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}.
- *
- *
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.
- *
- *
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.
- *
- *
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
- * synchronized (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 max-suspended-thread in zk.xml,
- * 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.
- *
- *
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.
- *
- *
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
- * synchronized (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.
- *
- *
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.
- *
- *
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
- * synchronized (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.
- *
- *
Unlike {@link #notify(Object)}, this method can be called any time.
- * It is designed to let working threads resume an event processing
- * thread.
- *
- *
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).
- *
- *
Notice: to resolve racing issue, you usually need to follow
- * this pattern.
- *
-//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);
- }
-}
-
- *
- * @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
- * synchronized (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.
- *
- * Unlike {@link #notifyAll(Object)}, this method can be called any time.
- * It is designed to let working threads resume an event processing
- * thread.
- *
- *
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).
- *
- *
Notice: to resolve racing issue, you usually need to follow
- * this pattern.
- *
-//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);
- }
-}
-
- *
- * @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
- * synchronized (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.
- *
- * 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.
- *
- *
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).
- *
- *
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.
- *
- *
A typical use pattern:
- *
- *
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)
- * }
- * }
- * }
- *}
- *
- * 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.
- *
- *
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
- *
- *
- * 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();
- }
-}
\ No newline at end of file
diff --git a/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/sys/ExecutionsCtrl.java b/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/sys/ExecutionsCtrl.java
deleted file mode 100644
index b6242d2ea4..0000000000
--- a/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/sys/ExecutionsCtrl.java
+++ /dev/null
@@ -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.
- *
- *
Note: you have to clean up the current execution
- * with try/finally:
- *
- * 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();
- }
-}
\ No newline at end of file
diff --git a/extension/posterita/webui/WEB-INF/tld/web/core.dsp.tld b/extension/posterita/webui/WEB-INF/tld/web/core.dsp.tld
index acd18c4663..82fc94735e 100755
--- a/extension/posterita/webui/WEB-INF/tld/web/core.dsp.tld
+++ b/extension/posterita/webui/WEB-INF/tld/web/core.dsp.tld
@@ -12,6 +12,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
-->
+ http://www.zkoss.org/dsp/web/core
Core methods and tags for zweb in DSP
@@ -91,12 +92,24 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
org.zkoss.web.servlet.dsp.action.When
+
+
+
+
+ ServletFns
+ org.zkoss.web.fn.ServletFns
+
+
+ Labels
+ org.zkoss.util.resource.Labels
+
+
boolean
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
boolean toBoolean(java.lang.Object)
Converts the specified object to a boolean.
@@ -104,7 +117,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
number
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
java.lang.Number toNumber(java.lang.Object)
Converts the specified object to a number.
@@ -112,7 +125,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
int
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
int toInt(java.lang.Object)
Converts the specified object to an integer.
@@ -120,7 +133,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
decimal
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
java.math.BigDecimal toDecimal(java.lang.Object)
Converts the specified object to a (big) decimal.
@@ -128,7 +141,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
string
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
java.lang.String toString(java.lang.Object)
Converts the specified object to a string.
@@ -136,7 +149,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
char
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
char toChar(java.lang.Object)
Converts the specified object to a character.
@@ -152,7 +165,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
isInstance
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
boolean isInstance(java.lang.Object, java.lang.Object)
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.
length
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
int length(java.lang.Object)
Returns the length of a string, array, collection or map.
@@ -169,7 +182,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
new
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
java.lang.Object new_(java.lang.Object)
Instantiates the specified class.
@@ -177,12 +190,21 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
+
+ getProperty
+ java.lang.System
+ java.lang.String getProperty(java.lang.String)
+
+ Returns the system property.
+
+
+
cat
- org.zkoss.el.fn.StringFns
+ org.zkoss.xel.fn.StringFns
java.lang.String cat(java.lang.String, java.lang.String)
@@ -192,7 +214,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
cat3
- org.zkoss.el.fn.StringFns
+ org.zkoss.xel.fn.StringFns
java.lang.String cat3(java.lang.String, java.lang.String, java.lang.String)
@@ -202,7 +224,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
cat4
- org.zkoss.el.fn.StringFns
+ org.zkoss.xel.fn.StringFns
java.lang.String cat4(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
@@ -212,7 +234,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
cat5
- org.zkoss.el.fn.StringFns
+ org.zkoss.xel.fn.StringFns
java.lang.String cat5(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
@@ -222,7 +244,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
replace
- org.zkoss.el.fn.StringFns
+ org.zkoss.xel.fn.StringFns
java.lang.String replace(java.lang.String, java.lang.String, java.lang.String)
@@ -233,12 +255,21 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
l
- org.zkoss.el.fn.CommonFns
+ org.zkoss.xel.fn.CommonFns
java.lang.String getLabel(java.lang.String)
Returns the label of the specified key.
+
+ l2
+ org.zkoss.xel.fn.CommonFns
+ java.lang.String getLabel(java.lang.String, java.lang.Object[])
+
+ Returns the label of the specified key, and formats with the specified
+ argument.
+
+
diff --git a/extension/posterita/webui/WEB-INF/tld/web/html.dsp.tld b/extension/posterita/webui/WEB-INF/tld/web/html.dsp.tld
index eae0a9a251..2523c44dc6 100755
--- a/extension/posterita/webui/WEB-INF/tld/web/html.dsp.tld
+++ b/extension/posterita/webui/WEB-INF/tld/web/html.dsp.tld
@@ -12,6 +12,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
-->
+ http://www.zkoss.org/dsp/web/html
Used to develop ZK components for XUL/HTML.
diff --git a/extension/posterita/webui/WEB-INF/tld/zk/core.dsp.tld b/extension/posterita/webui/WEB-INF/tld/zk/core.dsp.tld
index a6c25d937a..7de09b6f63 100755
--- a/extension/posterita/webui/WEB-INF/tld/zk/core.dsp.tld
+++ b/extension/posterita/webui/WEB-INF/tld/zk/core.dsp.tld
@@ -12,10 +12,22 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
-->
+ http://www.zkoss.org/dsp/zk/core
Methods and actions for ZK in DSP/ZUML
+
+
+
+
+ ZkFns
+ org.zkoss.zk.fn.ZkFns
+
+
+
+
+
redraw
org.zkoss.zk.fn.ZkFns
@@ -46,7 +58,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
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).
@@ -57,17 +69,72 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
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.
+
+
+
+ outDeviceStyleSheets
+ org.zkoss.zk.fn.ZkFns
+
+ java.lang.String outDeviceStyleSheets(java.lang.String deviceType)
+
+
+ Returns HTML tags to include all style sheets used by the specified device.
+ Note: unlike outLangStyleSheets, it can be called without current execution.
- outPageHeaders
+ outHeaders
org.zkoss.zk.fn.ZkFns
- java.lang.String outPageHeaders(org.zkoss.zk.ui.Page)
+ java.lang.String outHeaders(org.zkoss.zk.ui.Page)
- Returns HTML header tags defined in the specified page.
+ Returns the content that will be placed inside the header element
+ of the specified page.
+
+
+
+ outRootAttributes
+ org.zkoss.zk.fn.ZkFns
+
+ java.lang.String outRootAttributes(org.zkoss.zk.ui.Page)
+
+
+ Returns the content that will be placed as the attributes of
+ the root element of the specified page.
+
+
+
+ outContentType
+ org.zkoss.zk.fn.ZkFns
+
+ java.lang.String outContentType(org.zkoss.zk.ui.Page)
+
+
+ Returns the content type.
+
+
+
+ outDocType
+ org.zkoss.zk.fn.ZkFns
+
+ java.lang.String outDocType(org.zkoss.zk.ui.Page)
+
+
+ Returns the doc type.
+
+
+
+ outFirstLine
+ org.zkoss.zk.fn.ZkFns
+
+ java.lang.String outFirstLine(org.zkoss.zk.ui.Page)
+
+
+ Returns the first line to be generated to the output.
@@ -93,4 +160,15 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
Returns date relevant labels in JavaScript.
+
+
+ outPageAttrs
+ org.zkoss.zk.fn.ZkFns
+
+ java.lang.String outPageAttrs(org.zkoss.zk.ui.Page)
+
+
+ Returns the attributes to render a page.
+
+
diff --git a/extension/posterita/webui/WEB-INF/tld/zul/core.dsp.tld b/extension/posterita/webui/WEB-INF/tld/zul/core.dsp.tld
index abea5bf4d9..ce38873256 100755
--- a/extension/posterita/webui/WEB-INF/tld/zul/core.dsp.tld
+++ b/extension/posterita/webui/WEB-INF/tld/zul/core.dsp.tld
@@ -12,10 +12,22 @@ Copyright (C) 2006 Potix Corporation. All Rights Reserved.
-->
+ http://www.zkoss.org/dsp/zul/core
Methods and actions for ZUL in DSP/ZUML
+
+
+
+
+ ZulFns
+ org.zkoss.zul.fn.ZulFns
+
+
+
+
+
getColAttrs
org.zkoss.zul.fn.ZulFns
@@ -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.
-
-
- getBoxChildInnerAttrs
- org.zkoss.zul.fn.ZulFns
-
- java.lang.String getBoxChildInnerAttrs(org.zkoss.zk.ui.Component)
-
-
- Returns the outer attributes used for the cell of the specified child
- when it is placed inside of hbox/vbox.
-
+
+
+ getBoxChildInnerAttrs
+ org.zkoss.zul.fn.ZulFns
+
+ java.lang.String getBoxChildInnerAttrs(org.zkoss.zk.ui.Component)
+
+
+ Returns the outer attributes used for the cell of the specified child
+ when it is placed inside of hbox/vbox.
+
+
+
+ setStripeClass
+ org.zkoss.zul.fn.ZulFns
+
+ void setStripeClass(org.zkoss.zk.ui.Component)
+
+
+ Sets the stripe CSS for each row.
+
+
+
+ resetStripeClass
+ org.zkoss.zul.fn.ZulFns
+
+ void resetStripeClass(org.zkoss.zk.ui.Component)
+
+
+ Resets the stripe CSS for each row.
+
diff --git a/extension/posterita/webui/WEB-INF/xsd/zul.xsd b/extension/posterita/webui/WEB-INF/xsd/zul.xsd
new file mode 100644
index 0000000000..0861926882
--- /dev/null
+++ b/extension/posterita/webui/WEB-INF/xsd/zul.xsd
@@ -0,0 +1,2477 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extension/posterita/webui/WEB-INF/zk.xml b/extension/posterita/webui/WEB-INF/zk.xml
index 74de1fc0f7..659df2c9ba 100644
--- a/extension/posterita/webui/WEB-INF/zk.xml
+++ b/extension/posterita/webui/WEB-INF/zk.xml
@@ -8,7 +8,12 @@ Copyright (C) 2006 Potix Corporation. All Rights Reserved.
[Optional] Monitor i3-log.conf and register a handler for the specified log-base
-
+
+
+
+
+ true
+
-
\ No newline at end of file
+
+
+
+
+
+
\ No newline at end of file
diff --git a/extension/posterita/webui/js/layout.js b/extension/posterita/webui/js/layout.js
new file mode 100644
index 0000000000..0672106b2b
--- /dev/null
+++ b/extension/posterita/webui/js/layout.js
@@ -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();
+}