Skip to main content

Porting Custom Swing Form to ZK

ADempiere...About 1 minCommunityWikiDeveloper's Guide

Introduction

  • ADempiere has 2 client modes to access the ERP application:
    • Java Swing which is rich client and runs perfectly via LAN
    • Web-based clients such as HTML and ZK Ajax that is mostly used via the Web.
  • All clients will access the Application Dictionary or Data Model to get the same data treatment. However the sourcecode that access and display that has to be mapped.
  • The content below is posted by Low Heng Sin who is chiefly responsible for the ZK Ajax client completion started by Posterita.
    • It illustrates the direct component to component mapping at the sourcecode level of the application.

Component Mapping

Swing ClasssZk ClassNotes
org.compiere.swing.CPanelorg.adempiere.webui.component.PanelsetLayout(layout) is replace by appendChild(layout). Layout manager is implemented as container component in Zk.
javax.swing.JLabelorg.adempiere.webui.component.Label
org.compiere.grid.ed.VLookuporg.adempiere.webui.editor.WTableDirEditor org.adempiere.webui.editor.WSearchEditorWtableDirEditor for combo box, WsearchEditor for lookup.
org.compiere.grid.ed.VStringorg.adempiere.webui.editor.WStringEditor
java.awt.GridBagLayoutorg.adempiere.webui.component.GridUse GridFactory.newGridLayout()
javax.swing.JcomboBoxorg.adempiere.webui.component.Listbox org.adempiere.webui.component.ComboboxOnly Combobox support auto complete
java.awt.BorderLayoutorg.zkoss.zkex.zul.BorderlayoutMust set width and height, either in pixel or %. Must setStyle("position: relative;") when use within ADForm.
org.compiere.apps.ConfirmPanelorg.adempiere.webui.component.ConfirmPanel
org.compiere.apps.StatusBarorg.adempiere.webui.panel.StatusBarPanel
org.compiere.minigrid.MiniTableorg.adempiere.webui.component.WListbox
org.compiere.grid.ed.VLocatororg.adempiere.webui.editor.WLocatorEditor
javax.swing.event.TableModelListenerorg.adempiere.webui.event.WTableModelListener
javax.swing.JCheckBoxorg.adempiere.webui.component.Checkbox
org.adempiere.swing.CDialogorg.adempiere.webui.component.Window
Java.awt.event.ActionListenerOrg.zkoss.zk.ui.event.EventListeneractionPerformed(ActionEvent) is replace by onEvent(Event)
Org.compiere.apps.AEnvOrg.adempiere.webui.apps.AEnv
Javax.swing.JScrollPaneOrg.adempiere.webui.component.PanelMost of the time, JscrollPane can be remove from the UI components tree when we port Swing form to Zk. If you are not sure, remove it and test.
Javax.swing.JSplitPaneOrg.zkoss.zul.Splitterorg.zkoss.zkex.zul.BorderLayoutSplitter must use together with Hbox or Vbox. If that's not suitable for the layout you are trying to build, use BorderLayout instead.
Org.compiere.apps.ADialogOrg.adempiere.webui.window.FDialog
Javax.swing.table.DefaultTableModelOrg.adempiere.webui.component.ListModelTable org.adempiere.webui.component.SimpleListModelUse ListModelTable with WListbox and SimpleListModel with Listbox.
Java.beans.VetoableChangeListenerOrg.adempiere.webui.event.ValueChangeListenerEvent listener for field editor. vetoableChange(PropertyChangeEvent) is replace by valueChange(ValueChangeEvent)
Org.adempiere.apps.form.FormPanelOrg.adempiere.webui.panel.ADForminit (int WindowNo, FormFrame frame) is replace by initForm(). Use the protected method getWindowNo to access the WindowNo variable.

Batch processing in custom form

  • Don't use the AsyncProcess interface.
  • Use Clients.showBusy and AuEcho to show busy message.
  • Use ServerPush to execute long task on separate thread.
  • Example for long task and batch printing: org.adempiere.webui.apps.form.WInvoiceGen.
Comments
  • Latest
  • Oldest
  • Hottest
Powered by Waline v2.15.8