IDEMPIERE-5570 Zk: Improve readability of code (#1755)

- Refinement up to org.adempiere.webui.component package.
This commit is contained in:
hengsin 2023-03-29 01:36:31 +08:00 committed by GitHub
parent 1ff384d70d
commit 10ade8a25b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
119 changed files with 2127 additions and 1045 deletions

View File

@ -81,7 +81,7 @@ import org.zkoss.zul.Style;
import org.zkoss.zul.Window; import org.zkoss.zul.Window;
/** /**
* * Entry point for iDempiere web client
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -90,10 +90,10 @@ import org.zkoss.zul.Window;
*/ */
public class AdempiereWebUI extends Window implements EventListener<Event>, IWebClient public class AdempiereWebUI extends Window implements EventListener<Event>, IWebClient
{ {
/** {@link Session} attribute to hold current login user id value **/ /** {@link Session} attribute to hold current login user id value */
public static final String CHECK_AD_USER_ID_ATTR = "Check_AD_User_ID"; public static final String CHECK_AD_USER_ID_ATTR = "Check_AD_User_ID";
/** Boolean attribute to indicate the HTTP session of a Desktop have been invalidated **/ /** Boolean attribute to indicate the HTTP session of a Desktop have been invalidated */
public static final String DESKTOP_SESSION_INVALIDATED_ATTR = "DesktopSessionInvalidated"; public static final String DESKTOP_SESSION_INVALIDATED_ATTR = "DesktopSessionInvalidated";
/** /**
@ -101,28 +101,34 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
*/ */
private static final long serialVersionUID = -6725805283410008847L; private static final long serialVersionUID = -6725805283410008847L;
/** {@link Desktop} attribute to hold {@link IDesktop} reference **/ /** {@link Desktop} attribute to hold {@link IDesktop} reference */
public static final String APPLICATION_DESKTOP_KEY = "application.desktop"; public static final String APPLICATION_DESKTOP_KEY = "application.desktop";
/** org.zkoss.zk.ui.WebApp.name preference from zk.xml */
public static String APP_NAME = null; public static String APP_NAME = null;
/** Match to version at lang-addon.xml */
public static final String UID = "1.0.0"; public static final String UID = "1.0.0";
/** Attribute for widget instance name, use for Selenium test **/ /** Attribute for widget instance name, use for Selenium test */
public static final String WIDGET_INSTANCE_NAME = "instanceName"; public static final String WIDGET_INSTANCE_NAME = "instanceName";
/** login and role selection window **/ /** login and role selection window */
private WLogin loginDesktop; private WLogin loginDesktop;
/** client info from browser **/ /** client info from browser */
private ClientInfo clientInfo = new ClientInfo(); private ClientInfo clientInfo = new ClientInfo();
/** Language for current session */
private String langSession; private String langSession;
/** Current login user's preference */
private UserPreference userPreference; private UserPreference userPreference;
/** User preference DB model */
private MUserPreference userPreferences; private MUserPreference userPreferences;
/** Global key listener */
private Keylistener keyListener; private Keylistener keyListener;
private static final CLogger logger = CLogger.getCLogger(AdempiereWebUI.class); private static final CLogger logger = CLogger.getCLogger(AdempiereWebUI.class);
@ -130,15 +136,16 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
@Deprecated(forRemoval = true, since = "11") @Deprecated(forRemoval = true, since = "11")
public static final String EXECUTION_CARRYOVER_SESSION_KEY = "execution.carryover"; public static final String EXECUTION_CARRYOVER_SESSION_KEY = "execution.carryover";
/** Session attribute to hold {@link ClientInfo} reference **/ /** Session attribute to hold {@link ClientInfo} reference */
private static final String CLIENT_INFO = "client.info"; private static final String CLIENT_INFO = "client.info";
/** the use of event thread have been deprecated, this should always be false **/ /** the use of event thread have been deprecated, this should always be false **/
private static boolean eventThreadEnabled = false; private static boolean eventThreadEnabled = false;
/** Parameters map from browser URL */
private ConcurrentMap<String, String[]> m_URLParameters; private ConcurrentMap<String, String[]> m_URLParameters;
/** Login completed event **/ /** Login completed event */
private static final String ON_LOGIN_COMPLETED = "onLoginCompleted"; private static final String ON_LOGIN_COMPLETED = "onLoginCompleted";
/** /**
@ -149,7 +156,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
this.setVisible(false); this.setVisible(false);
userPreference = new UserPreference(); userPreference = new UserPreference();
// preserve the original URL parameters as is destroyed later on loging // preserve the original URL parameters as is destroyed later on login
m_URLParameters = new ConcurrentHashMap<String, String[]>(Executions.getCurrent().getParameterMap()); m_URLParameters = new ConcurrentHashMap<String, String[]>(Executions.getCurrent().getParameterMap());
this.addEventListener(ON_LOGIN_COMPLETED, this); this.addEventListener(ON_LOGIN_COMPLETED, this);
@ -711,7 +718,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
} }
/** /**
* change role, asynchronous callback from {@link IDesktop#logout(org.adempiere.util.Callback)} * change role, asynchronous callback from {@link #changeRole(MUser)}
* @param httpSession * @param httpSession
* @param locale * @param locale
* @param properties * @param properties

View File

@ -29,17 +29,17 @@ import org.zkoss.zk.ui.WebApp;
import org.zkoss.zk.ui.util.WebAppInit; import org.zkoss.zk.ui.util.WebAppInit;
/** /**
* Handle web app init event to sync config store in web config file and database * Handle web app init event to manage configuration from zk.xml and AD_SysConfig
* @author hieplq * @author hieplq
* *
*/ */
public class DefaultWebAppInit implements WebAppInit { public class DefaultWebAppInit implements WebAppInit {
/** AD_SysConfig change listener */
private static SystemConfigHandler systemConfigChangeHandler; private static SystemConfigHandler systemConfigChangeHandler;
protected WebApp webApp = null; protected WebApp webApp = null;
/** /**
* Register listen model change * Register model change listener
*/ */
@Override @Override
public void init(WebApp wapp) throws Exception { public void init(WebApp wapp) throws Exception {
@ -67,7 +67,7 @@ public class DefaultWebAppInit implements WebAppInit {
} }
/** /**
* Process model event of table system config * Process model event of AD_SysConfig table
* @author hieplq * @author hieplq
* *
*/ */
@ -177,7 +177,7 @@ public class DefaultWebAppInit implements WebAppInit {
*/ */
protected void afterChange (PO po){ protected void afterChange (PO po){
if (po instanceof X_AD_SysConfig){ if (po instanceof X_AD_SysConfig){
// when change ZK_BROWSER_TITLE, set web config to new value // after change of ZK_BROWSER_TITLE, set app name of webApp to new value
if (MSysConfig.ZK_BROWSER_TITLE.equals(((X_AD_SysConfig) po).getName())){ if (MSysConfig.ZK_BROWSER_TITLE.equals(((X_AD_SysConfig) po).getName())){
String configAppname = ((X_AD_SysConfig) po).getValue(); String configAppname = ((X_AD_SysConfig) po).getValue();
webApp.setAppName(configAppname); webApp.setAppName(configAppname);

View File

@ -57,11 +57,11 @@ import org.zkoss.zk.ui.Component;
*/ */
public class Extensions { public class Extensions {
/** FormId:IFormFactory Reference. FormId is Java class name, OSGi component name or Equinox extension Id */
private final static CCache<String, IServiceReferenceHolder<IFormFactory>> s_formFactoryCache = new CCache<>(null, "IFormFactory", 100, false); private final static CCache<String, IServiceReferenceHolder<IFormFactory>> s_formFactoryCache = new CCache<>(null, "IFormFactory", 100, false);
/** /**
* * @param formId Java class name, OSGi component name or equinox extension Id
* @param formId Java class name or equinox extension Id
* @return IFormController instance or null if formId not found * @return IFormController instance or null if formId not found
*/ */
public static ADForm getForm(String formId) { public static ADForm getForm(String formId) {
@ -91,13 +91,14 @@ public class Extensions {
return null; return null;
} }
/** CacheKey:IProcessParameterListener Reference. CacheKey is ProcessClassName|ColumnName */
private final static CCache<String, List<IServiceReferenceHolder<IProcessParameterListener>>> s_processParameterListenerCache = new CCache<>(null, "List<IProcessParameterListener>", 100, false); private final static CCache<String, List<IServiceReferenceHolder<IProcessParameterListener>>> s_processParameterListenerCache = new CCache<>(null, "List<IProcessParameterListener>", 100, false);
/** /**
* *
* @param processClass * @param processClass Java class name of process
* @param columnName * @param columnName
* @return list of parameter listener * @return list of {@link IProcessParameterListener}
*/ */
public static List<IProcessParameterListener> getProcessParameterListeners(String processClass, String columnName) { public static List<IProcessParameterListener> getProcessParameterListeners(String processClass, String columnName) {
String cacheKey = processClass + "|" + columnName; String cacheKey = processClass + "|" + columnName;
@ -116,10 +117,10 @@ public class Extensions {
return listeners.stream().filter(e -> e.getService() != null).map(e -> e.getService()).collect(Collectors.toCollection(ArrayList::new)); return listeners.stream().filter(e -> e.getService() != null).map(e -> e.getService()).collect(Collectors.toCollection(ArrayList::new));
} }
/** AD_Tab_ID:ICreateFromFactory Reference */
private final static CCache<String, IServiceReferenceHolder<ICreateFromFactory>> s_createFromFactoryCache = new CCache<>(null, "ICreateFromFactory", 100, false); private final static CCache<String, IServiceReferenceHolder<ICreateFromFactory>> s_createFromFactoryCache = new CCache<>(null, "ICreateFromFactory", 100, false);
/** /**
*
* @param mTab * @param mTab
* @return ICreateFrom instance * @return ICreateFrom instance
*/ */
@ -154,11 +155,12 @@ public class Extensions {
return null; return null;
} }
/** CacheKey:IPaymentFormFactory Reference. CacheKey is AD_Tab_ID|Payment Rule */
private static final CCache<String, IServiceReferenceHolder<IPaymentFormFactory>> s_paymentFormFactoryCache = new CCache<>(null, "IPaymentFormFactory", 100, false); private static final CCache<String, IServiceReferenceHolder<IPaymentFormFactory>> s_paymentFormFactoryCache = new CCache<>(null, "IPaymentFormFactory", 100, false);
/** /**
*
* @param windowNo * @param windowNo
* @param mTab * @param mTab GridTab
* @param paymentRule * @param paymentRule
* @return IPaymentForm instance * @return IPaymentForm instance
*/ */
@ -189,10 +191,10 @@ public class Extensions {
return null; return null;
} }
/** URL:IDashboardGadgetFactory Reference */
private static final CCache<String, IServiceReferenceHolder<IDashboardGadgetFactory>> s_dashboardGadgetFactoryCache = new CCache<>(null, "IDashboardGadgetFactory", 100, false); private static final CCache<String, IServiceReferenceHolder<IDashboardGadgetFactory>> s_dashboardGadgetFactoryCache = new CCache<>(null, "IDashboardGadgetFactory", 100, false);
/** /**
*
* @param url * @param url
* @param parent * @param parent
* @return Gadget component * @return Gadget component
@ -202,7 +204,6 @@ public class Extensions {
} }
/** /**
*
* @param url * @param url
* @param parent * @param parent
* @param dc * @param dc
@ -225,8 +226,10 @@ public class Extensions {
IDashboardGadgetFactory service = factory.getService(); IDashboardGadgetFactory service = factory.getService();
if (service != null) { if (service != null) {
Component component = service.getGadget(url,parent,dc); Component component = service.getGadget(url,parent,dc);
if(component != null) if (component != null) {
s_dashboardGadgetFactoryCache.put(url, factory);
return component; return component;
}
} }
} }
@ -234,7 +237,6 @@ public class Extensions {
} }
/** /**
*
* @return list of {@link IChartRendererService} * @return list of {@link IChartRendererService}
*/ */
public static final List<IChartRendererService> getChartRendererServices() { public static final List<IChartRendererService> getChartRendererServices() {
@ -244,8 +246,7 @@ public class Extensions {
private static IServiceReferenceHolder<IMappedFormFactory> s_mappedFormFactoryReference = null; private static IServiceReferenceHolder<IMappedFormFactory> s_mappedFormFactoryReference = null;
/** /**
* * @return {@link IMappedFormFactory} instance
* @return {@link IMappedFormFactory}
*/ */
public static IMappedFormFactory getMappedFormFactory(){ public static IMappedFormFactory getMappedFormFactory(){
IMappedFormFactory formFactoryService = null; IMappedFormFactory formFactoryService = null;
@ -261,12 +262,12 @@ public class Extensions {
} }
return formFactoryService; return formFactoryService;
} }
/** AD_Window_ID:IQuickEntryFactory Reference */
private final static CCache<Integer, IServiceReferenceHolder<IQuickEntryFactory>> s_quickEntryFactoryCache = new CCache<>(null, "IQuickEntryFactory", 100, false); private final static CCache<Integer, IServiceReferenceHolder<IQuickEntryFactory>> s_quickEntryFactoryCache = new CCache<>(null, "IQuickEntryFactory", 100, false);
/** /**
* * @param AdWindowID AD_Window_ID
* @param AdWindowID
* @return IQuickEntryFactory instance or null if AdWindowID not found * @return IQuickEntryFactory instance or null if AdWindowID not found
*/ */
public static AbstractWQuickEntry getQuickEntry(Integer AdWindowID) { public static AbstractWQuickEntry getQuickEntry(Integer AdWindowID) {
@ -297,10 +298,9 @@ public class Extensions {
} }
/** /**
*
* @param WindowNo * @param WindowNo
* @param TabNo * @param TabNo
* @param AdWindowID * @param AdWindowID AD_Window_ID
* @return IQuickEntry instance or null if AdWindowID not found * @return IQuickEntry instance or null if AdWindowID not found
*/ */
public static AbstractWQuickEntry getQuickEntry(int WindowNo, int TabNo, int AdWindowID) { public static AbstractWQuickEntry getQuickEntry(int WindowNo, int TabNo, int AdWindowID) {
@ -330,14 +330,14 @@ public class Extensions {
return null; return null;
} }
/** CacheKey:IMediaViewProvider Reference. CacheKey is ContentType|File Extension */
private static final CCache<String, IServiceReferenceHolder<IMediaViewProvider>> s_mediaViewProviderCache = new CCache<>("_IMediaViewProvider_Cache", "IMediaViewProvider", 100, false); private static final CCache<String, IServiceReferenceHolder<IMediaViewProvider>> s_mediaViewProviderCache = new CCache<>("_IMediaViewProvider_Cache", "IMediaViewProvider", 100, false);
/** /**
*
* @param contentType * @param contentType
* @param extension * @param extension
* @param mobile * @param mobile true for mobile, otherwise for desktop
* @return {@link IMediaView} * @return {@link IMediaView} instance
*/ */
public static IMediaView getMediaView(String contentType, String extension, boolean mobile) { public static IMediaView getMediaView(String contentType, String extension, boolean mobile) {
String key = contentType + "|" + extension; String key = contentType + "|" + extension;
@ -373,7 +373,7 @@ public class Extensions {
/** /**
* @param tabType build in - FORM or SORT, custom - through IADTabPanelFactory extension * @param tabType build in - FORM or SORT, custom - through IADTabPanelFactory extension
* @return {@link IADTabpanel} * @return {@link IADTabpanel} instance
*/ */
public static IADTabpanel getADTabPanel(String tabType) public static IADTabpanel getADTabPanel(String tabType)
{ {

View File

@ -18,50 +18,51 @@ import org.adempiere.webui.part.AbstractUIPart;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
/** /**
* interface for any component want support show other window over it with a * Interface for any component want support show other window over it with a
* mask. object manage component as AbstractUIPart also implement this interface * mask.<br/> Class manage component as AbstractUIPart also implement this interface.<br/>
* consider below case. * Consider following scenario:<br/>
* <pre>
* 1. show a dialog =&gt; show mask * 1. show a dialog =&gt; show mask
* 2. process a event * 2. process an event
* 2.1. show other dialog =&gt; show mask * 2.1. show other dialog =&gt; show mask
* 2.1. hidden dialog in step 1 =&gt; hidden mask * 2.1. hide dialog in step 1 =&gt; hide mask
* 3. result dialog show without mask * 3. result dialog show without mask
* to void this case process as below * </pre>
* in {@link #showMask()} set a flag to request scope by call: {@link Component#setAttribute(String, Object, int)} * To void this issue, proceed as below:<br/>
* key is {@link #READY_SHOW_MASK_FLAG} value is Integer(1) and scope is {@link Component#REQUEST_SCOPE} * - In {@link #showMask()} set a flag to request scope by call {@link Component#setAttribute(String, Object, int)}
* in {@link #hideMask()} check flag before hidden mask. when has flag, don't hidden mask * with name {@link #READY_SHOW_MASK_FLAG}, value Integer(1) and scope {@link Component#REQUEST_SCOPE}.<br/>
* * - In {@link #hideMask()} check flag before hide mask. When has flag, don't hide mask.
* component want support show mask can implement this interface or use support class {@link ShowMaskWrapper} as composite object * <p>
* Component want support show mask can implement this interface or use support class {@link ShowMaskWrapper} as composite object
*/ */
public interface ISupportMask { public interface ISupportMask {
public static String READY_SHOW_MASK_FLAG = "ISupportMask_READY_SHOW_MASK_FLAG"; public static String READY_SHOW_MASK_FLAG = "ISupportMask_READY_SHOW_MASK_FLAG";
/** /**
* show mask over this component * Show mask over this component.<br/>
* when override, remember call {@link Component#setAttribute(String, Object, int)} with * When override, remember to call {@link Component#setAttribute(String, Object, int)} with
* key is {@link #READY_SHOW_MASK_FLAG} value is Integer(1) and scope is {@link Component#REQUEST_SCOPE} * name {@link #READY_SHOW_MASK_FLAG}, value Integer(1) and scope {@link Component#REQUEST_SCOPE}.<br/>
* by call {@link LayoutUtils} * Call by {@link LayoutUtils}.
*/ */
public void showMask(); public void showMask();
/** /**
* Hide mask. at code call showMask will hand reference to this object. and * Hide mask. With ISupportMask return from showMask, call this function in handle close event of window. <br/>
* call this function in handle close event of window * When override, remember check exists of key {@link #READY_SHOW_MASK_FLAG} at scope {@link Component#REQUEST_SCOPE} in attribute.
* when override, remember check exists of key {@link #READY_SHOW_MASK_FLAG} at scope {@link Component#REQUEST_SCOPE} in attribute * If flag exists, don't hide mask.<br/>
* by call {@link LayoutUtils} * Call by {@link LayoutUtils}.
* if exists flag, don't hidden mask
*/ */
public void hideMask(); public void hideMask();
/** /**
* return cache object or make new object and return * Return cache Mask or create new Mask and return.
* @return * @return {@link Mask}
*/ */
public Mask getMaskObj(); public Mask getMaskObj();
/** /**
* return self if is a component or return component it manage * Return self if is a component or return component it manage.<br/>
* if {@link AbstractUIPart} is implement this interface, return {@link AbstractUIPart#getComponent()} * {@link AbstractUIPart} subclasses that implement this interface should return {@link AbstractUIPart#getComponent()}.
* @return * @return {@link Component}
*/ */
public Component getMaskComponent(); public Component getMaskComponent();
} }

View File

@ -318,17 +318,18 @@ public final class LayoutUtils {
public static final int OVERLAP_SELF = 4; public static final int OVERLAP_SELF = 4;
/** /**
* show window with a mask below. mask over tabPanel, all window or only over a control, dependency ownModel flag. * show window with a mask below. Depends on ownModel flag, mask is shown over tabPanel, all window or over a component.
* when ownModel == {@link #OVERLAP_SELF}, window show overlap childOfOwn, * <pre>
* when childOfOwn doesn't implement {@link ISupportMask} make new {@link Mask} object to make mask layout * when ownModel is
* ownModel == {@link #OVERLAP_ALL_PAGE}, window show overlap all page * - {@link #OVERLAP_SELF}, mask childOfOwn. if childOfOwn doesn't implement {@link ISupportMask}, make new {@link Mask} object to mask it
* ownModel == {@link #OVERLAP_TAB_PANEL}, window show overlap tabPanel * - {@link #OVERLAP_ALL_PAGE}, window show overlap all page
* ownModel == {@link #OVERLAP_PARENT}, search near parent of childOfOwn implement {@link ISupportMask} if not exist user as OVERLAP_ALL_PAGE * - {@link #OVERLAP_TAB_PANEL}, window show overlap tabPanel
* - {@link #OVERLAP_PARENT}, search nearest parent of childOfOwn that implement {@link ISupportMask}, if not found use as OVERLAP_ALL_PAGE
* </pre>
* @param window * @param window
* @param childOfOwn * @param childOfOwn Component below window
* @param ownModel OVERLAP_TAB_PANEL, OVERLAP_ALL_PAGE, OVERLAP_PARENT or OVERLAP_SELF * @param ownModel OVERLAP_TAB_PANEL, OVERLAP_ALL_PAGE, OVERLAP_PARENT or OVERLAP_SELF
* @return when show success return IMask object, it is own window, use {@link ISupportMask#hideMask()} to hidden mask. * @return when show success return ISupportMask object, use {@link ISupportMask#hideMask()} to hide mask.
* other return null.
*/ */
public static ISupportMask showWindowWithMask(Window window, Component childOfOwn, int ownModel){ public static ISupportMask showWindowWithMask(Window window, Component childOfOwn, int ownModel){
ISupportMask ownWindow = null; ISupportMask ownWindow = null;
@ -392,7 +393,7 @@ public final class LayoutUtils {
} }
/** /**
* find parent of child component, parent must implement {@link ISupportMask} * find nearest parent of child component that implement {@link ISupportMask}.<br/>
* if parentClass != null, parent class must extends parentClass * if parentClass != null, parent class must extends parentClass
* @param child * @param child
* @param parentClass * @param parentClass
@ -414,7 +415,7 @@ public final class LayoutUtils {
} }
/** /**
* Compact grid to limit (for e.g, to max of 2 column) * Compact grid to limit (for e.g, to max of 2 column).<br/>
* Note: doesn't handle row span * Note: doesn't handle row span
* @param grid * @param grid
* @param limit * @param limit
@ -479,7 +480,7 @@ public final class LayoutUtils {
} }
/** /**
* Expand grid to min (for e.g, to min of 2 column) * Expand grid to min (for e.g, to min of 2 column).<br/>
* Note: doesn't handle row span * Note: doesn't handle row span
* @param grid * @param grid
* @param min * @param min
@ -550,7 +551,7 @@ public final class LayoutUtils {
} }
/** /**
* find first popup ancestor of comp * find first Popup ancestor of comp
* @param comp * @param comp
* @return {@link Popup} if comp or one of its ancestor is Popup * @return {@link Popup} if comp or one of its ancestor is Popup
*/ */

View File

@ -49,6 +49,7 @@ import org.compiere.util.WebUtil;
* Sync state of {@link HttpSession} and AD_Session * Sync state of {@link HttpSession} and AD_Session
*/ */
public class LoggedSessionListener implements HttpSessionListener, ServletContextListener, ServerStateChangeListener{ public class LoggedSessionListener implements HttpSessionListener, ServletContextListener, ServerStateChangeListener{
/** Http Session Id:HttpSession */
private static Hashtable<String, HttpSession> AD_SessionList = new Hashtable<String, HttpSession>(); private static Hashtable<String, HttpSession> AD_SessionList = new Hashtable<String, HttpSession>();
private static final CLogger logger = CLogger.getCLogger(LoggedSessionListener.class); private static final CLogger logger = CLogger.getCLogger(LoggedSessionListener.class);
@ -107,6 +108,9 @@ public class LoggedSessionListener implements HttpSessionListener, ServletContex
*/ */
} }
/**
* Update all active AD_Session records (Processed=N) to inactive (Processed=Y)
*/
private void DestroyAllSession() { private void DestroyAllSession() {
if (!Adempiere.isStarted()) if (!Adempiere.isStarted())
{ {
@ -124,6 +128,11 @@ public class LoggedSessionListener implements HttpSessionListener, ServletContex
Adempiere.removeServerStateChangeListener(this); Adempiere.removeServerStateChangeListener(this);
} }
/**
* Update AD_Session record to inactive (Processed=Y) by session id and server name
* @param sessionID Http Session Id
* @param serverName
*/
private void removeADSession(String sessionID, String serverName) { private void removeADSession(String sessionID, String serverName) {
String sql = "UPDATE AD_Session SET Processed='Y' WHERE WebSession=? AND ServerName=? AND Processed='N'"; String sql = "UPDATE AD_Session SET Processed='Y' WHERE WebSession=? AND ServerName=? AND Processed='N'";
int no = DB.executeUpdate(sql, new Object[] {sessionID, serverName}, false, null); int no = DB.executeUpdate(sql, new Object[] {sessionID, serverName}, false, null);

View File

@ -21,8 +21,8 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.Clients; import org.zkoss.zk.ui.util.Clients;
/** /**
* Helper class for {@link ISupportMask} implementation * Helper class for {@link ISupportMask} implementation.
* Just make a instance of this class and let it do everything * Just make a instance of this class and let it do everything.
* @author hieplq * @author hieplq
* *
*/ */
@ -117,9 +117,9 @@ public class ShowMaskWrapper implements ISupportMask {
} }
/** /**
* check flag {@link ISupportMask#READY_SHOW_MASK_FLAG} ready in scope Component.REQUEST_SCOPE * check flag {@link ISupportMask#READY_SHOW_MASK_FLAG} exists in scope Component.REQUEST_SCOPE
* @param comp * @param comp
* @return * @return true if flag exists
*/ */
public static boolean hasFlagShowMask (Component comp){ public static boolean hasFlagShowMask (Component comp){
return (comp.getAttribute(ISupportMask.READY_SHOW_MASK_FLAG, Component.REQUEST_SCOPE) != null); return (comp.getAttribute(ISupportMask.READY_SHOW_MASK_FLAG, Component.REQUEST_SCOPE) != null);

View File

@ -133,7 +133,7 @@ public class ValuePreference extends Window implements EventListener<Event>
AD_Client_ID, AD_Org_ID, AD_User_ID, AD_Window_ID, mField.getAD_Process_ID_Of_Panel(), mField.getAD_InfoWindow_ID_of_Panel(), AD_Client_ID, AD_Org_ID, AD_User_ID, AD_Window_ID, mField.getAD_Process_ID_Of_Panel(), mField.getAD_InfoWindow_ID_of_Panel(),
Attribute, DisplayAttribute, Value, DisplayValue, Attribute, DisplayAttribute, Value, DisplayValue,
displayType, AD_Reference_ID, ref); displayType, AD_Reference_ID, ref);
} // create } // start
/** The Name of the Dialog */ /** The Name of the Dialog */
public static final String NAME = "ValuePreference"; public static final String NAME = "ValuePreference";
@ -438,7 +438,7 @@ public class ValuePreference extends Window implements EventListener<Event>
} // dynInit } // dynInit
/** /**
* Action Listener * Event Listener
* @param e event * @param e event
*/ */
public void onEvent(Event e) throws Exception public void onEvent(Event e) throws Exception
@ -573,9 +573,9 @@ public class ValuePreference extends Window implements EventListener<Event>
} // delete } // delete
/** /**
* Get Context Key * Get Context Key.
* preferences in context update follow key. * Preferences in context update follow key.
* they load when login, and update when change. * They load when login, and update when change.
* @see Login#loadPreferences(org.compiere.util.KeyNamePair, org.compiere.util.KeyNamePair, java.sql.Timestamp, String) * @see Login#loadPreferences(org.compiere.util.KeyNamePair, org.compiere.util.KeyNamePair, java.sql.Timestamp, String)
* and set to field when display field, {@link GridField#getDefault()} * and set to field when display field, {@link GridField#getDefault()}
* @return Context Key * @return Context Key

View File

@ -140,7 +140,7 @@ public class WArchive implements EventListener<Event>
LayoutUtils.autoDetachOnClose(m_popup); LayoutUtils.autoDetachOnClose(m_popup);
} }
m_popup.open(invoker, "after_start"); m_popup.open(invoker, "after_start");
} // getZoomTargets } // getArchives
/** /**
* Listener * Listener

View File

@ -42,13 +42,13 @@ import org.zkoss.zul.Window;
*/ */
public class WLogin extends AbstractUIPart public class WLogin extends AbstractUIPart
{ {
/** IWebClient instance ({@link AdempiereWebUI}) **/ /** IWebClient instance ({@link AdempiereWebUI}) */
private IWebClient app; private IWebClient app;
/** Main layout **/ /** Main layout */
private Borderlayout layout; private Borderlayout layout;
@Deprecated(forRemoval = true, since = "11") @Deprecated(forRemoval = true, since = "11")
private Window browserWarningWindow; private Window browserWarningWindow;
/** embedded window for login and role selection **/ /** embedded window for login and role selection */
private LoginWindow loginWindow; private LoginWindow loginWindow;
/** /**
@ -61,7 +61,9 @@ public class WLogin extends AbstractUIPart
} }
/** /**
* Create UI from login.zul file. The main layout component ("layout") must be instance of {@link Borderlayout}. * Create UI from login.zul file. <br/>
* The main layout component ("layout") must be instance of {@link Borderlayout}. <br/>
* Get {@link #loginWindow} reference from zul using id "loginWindow".
*/ */
@Override @Override
protected Component doCreatePart(Component parent) protected Component doCreatePart(Component parent)

View File

@ -62,7 +62,7 @@ public class WRequest implements EventListener<Event>
m_C_BPartner_ID = C_BPartner_ID; m_C_BPartner_ID = C_BPartner_ID;
getRequests(invoker); getRequests(invoker);
} // AReport } // WRequest
/** The Table */ /** The Table */
private int m_AD_Table_ID; private int m_AD_Table_ID;

View File

@ -18,8 +18,8 @@ import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
/** /**
* {@link BundleActivator} for web UI * {@link BundleActivator} for web client.
* Start {@link WindowValidatorManager} * Start {@link WindowValidatorManager}.
* @author hengsin * @author hengsin
*/ */
public class WebUIActivator implements BundleActivator { public class WebUIActivator implements BundleActivator {

View File

@ -58,10 +58,10 @@ public class Actions {
} }
/** /**
* Image name: actionId+"24.png". * Image name: actionId+"24.png".<br/>
* Get image from current theme or plugin resource. * Get image from current theme or plugin resource.<br/>
* For plugin resource, it will try the path /action/images/{theme}/{image name}, /action/images/default/{image name} and * For plugin resource, it will try the path /action/images/{theme}/{image name}, /action/images/default/{image name} and
* /action/images/{image name} * /action/images/{image name}.
* @param actionId * @param actionId
* @return {@link AImage} * @return {@link AImage}
*/ */

View File

@ -129,11 +129,6 @@ import org.zkoss.zul.impl.XulElement;
/** /**
* UI for an AD_Tab content (AD_Tab + AD_Fields). * UI for an AD_Tab content (AD_Tab + AD_Fields).
* *
* This class is based on org.compiere.grid.GridController written by Jorg Janke.
* Changes have been brought for UI compatibility.
*
* @author Jorg Janke
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $

View File

@ -158,7 +158,6 @@ public class ADTreePanel extends Panel implements EventListener<Event>
{ {
String eventName = event.getName(); String eventName = event.getName();
// Elaine 2009/02/27 - expand tree
if (eventName.equals(Events.ON_CHECK) && event.getTarget() == expandToggle) if (eventName.equals(Events.ON_CHECK) && event.getTarget() == expandToggle)
{ {
Clients.showBusy(null); Clients.showBusy(null);
@ -169,7 +168,6 @@ public class ADTreePanel extends Panel implements EventListener<Event>
expandOnCheck(); expandOnCheck();
Clients.clearBusy(); Clients.clearBusy();
} }
//
} }
/** /**

View File

@ -48,9 +48,6 @@ import org.zkoss.zul.Vlayout;
/** /**
* Content area of {@link ADWindow}. * Content area of {@link ADWindow}.
* *
* This class is based on org.compiere.apps.APanel written by Jorg Janke.
* @author Jorg Janke
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a> * @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
* @date Feb 25, 2007 * @date Feb 25, 2007

View File

@ -32,8 +32,8 @@ import org.adempiere.webui.action.Actions;
import org.adempiere.webui.action.IAction; import org.adempiere.webui.action.IAction;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.Combobox; import org.adempiere.webui.component.Combobox;
import org.adempiere.webui.component.FToolbar;
import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.ToolBar;
import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.event.ToolbarListener; import org.adempiere.webui.event.ToolbarListener;
import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.part.WindowContainer;
@ -85,7 +85,7 @@ import org.zkoss.zul.impl.LabelImageElement;
* @author Cristina Ghita, www.arhipac.ro * @author Cristina Ghita, www.arhipac.ro
* <li>FR [ 2076330 ] Add new methods in CWindowToolbar class * <li>FR [ 2076330 ] Add new methods in CWindowToolbar class
*/ */
public class ADWindowToolbar extends FToolbar implements EventListener<Event> public class ADWindowToolbar extends ToolBar implements EventListener<Event>
{ {
/** /**
* generated serial id * generated serial id

View File

@ -145,9 +145,6 @@ import org.zkoss.zul.impl.LabelImageElement;
* *
* Abstract model class for the content of AD Window (toolbar+breadcrumb+tabs+statusbar). * Abstract model class for the content of AD Window (toolbar+breadcrumb+tabs+statusbar).
* *
* This class is based on org.compiere.apps.APanel written by Jorg Janke.
* @author Jorg Janke
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a> * @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
@ -175,11 +172,11 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
*/ */
private static final String DETAIL_TABPANEL_SAVED_ATTR = "detail.adtabpanel.saved"; private static final String DETAIL_TABPANEL_SAVED_ATTR = "detail.adtabpanel.saved";
/** onFocus event that's defer behind other event using echo **/ /** onFocus event that's defer behind other event using echo */
private static final String ON_FOCUS_DEFER_EVENT = "onFocusDefer"; private static final String ON_FOCUS_DEFER_EVENT = "onFocusDefer";
/** /**
* Event to set selected tab of detail pane. Defer behind other event using echo. * Event to set selected tab of detail pane. Defer behind other event using echo.<br/>
* Event data: data[0] is tab index and data[1] is current row * Event data: data[0] is tab index and data[1] is current row
*/ */
private static final String ON_DEFER_SET_DETAILPANE_SELECTION_EVENT = "onDeferSetDetailpaneSelection"; private static final String ON_DEFER_SET_DETAILPANE_SELECTION_EVENT = "onDeferSetDetailpaneSelection";
@ -191,19 +188,19 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
logger = CLogger.getCLogger(AbstractADWindowContent.class); logger = CLogger.getCLogger(AbstractADWindowContent.class);
} }
/** Env ctx **/ /** Env ctx */
private Properties ctx; private Properties ctx;
/** VO for AD Window **/ /** VO for AD Window */
private GridWindow gridWindow; private GridWindow gridWindow;
/** status bar for message and record info **/ /** status bar for message and record info */
protected StatusBar statusBar; protected StatusBar statusBar;
/** UI part for AD_Tabs **/ /** UI part for AD_Tabs */
protected IADTabbox adTabbox; protected IADTabbox adTabbox;
/** register window (desktop tab) no **/ /** register window (desktop tab) no */
private int curWindowNo; private int curWindowNo;
/** /**
@ -221,25 +218,25 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
*/ */
private int m_onlyCurrentDays = 0; private int m_onlyCurrentDays = 0;
/** true if find window cancel by user **/ /** true if find window cancel by user */
private boolean m_findCancelled; private boolean m_findCancelled;
/** true if user press new button at find window **/ /** true if user press new button at find window */
private boolean m_findCreateNew; private boolean m_findCreateNew;
/** true when initial query for first tab is running **/ /** true when initial query for first tab is running */
private boolean m_queryInitiating; private boolean m_queryInitiating;
/** path to selected tab **/ /** path to selected tab */
protected BreadCrumb breadCrumb; protected BreadCrumb breadCrumb;
/** AD_Window.AD_Window_ID **/ /** AD_Window.AD_Window_ID */
private int adWindowId; private int adWindowId;
/** image for window title **/ /** image for window title */
private MImage image; private MImage image;
/** delete confirmation logic for selected tab **/ /** delete confirmation logic for selected tab */
private String deleteConfirmationLogic; private String deleteConfirmationLogic;
/** /**
@ -252,7 +249,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
*/ */
protected ArrayList <Integer> quickFormOpenTabs = new ArrayList <Integer>(); protected ArrayList <Integer> quickFormOpenTabs = new ArrayList <Integer>();
/** track last focus field editor component **/ /** track last focus field editor component */
protected Component lastFocusEditor = null; protected Component lastFocusEditor = null;
/** /**
@ -811,10 +808,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
/** /**
* Show initial find window for first tab (if necessary) * Show initial find window for first tab (if necessary)
* *
* @param query * @param query initial query
* initial query * @param mTab tab
* @param mTab * @param callback callback for query to apply, must not be null
* tab
* @return query or null * @return query or null
*/ */
private void initialQuery(final MQuery query, GridTab mTab, final Callback<MQuery> callback) private void initialQuery(final MQuery query, GridTab mTab, final Callback<MQuery> callback)
@ -952,7 +948,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
/** /**
* Delegate to {@link BreadCrumbLink} ON_Click event * Navigate to parent record.
* Delegate to {@link BreadCrumbLink} ON_Click event.
* @see ToolbarListener#onParentRecord() * @see ToolbarListener#onParentRecord()
*/ */
@Override @Override
@ -1071,7 +1068,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
protected ADWindow adwindow; protected ADWindow adwindow;
//true if confirmation for exit dialog is visible /** true if confirmation for exit dialog is visible */
protected boolean showingOnExitDialog; protected boolean showingOnExitDialog;
/** /**
@ -1217,7 +1214,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
/** /**
* handle post it event * Open Post It note dialog.
*/ */
public void onPostIt() public void onPostIt()
{ {
@ -1506,7 +1503,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
* Change active tab to newTabIndex. * Change active tab to newTabIndex.
* Delegate to {@link #setActiveTab0(int, int, Callback)} * Delegate to {@link #setActiveTab0(int, int, Callback)}
* @param newTabIndex * @param newTabIndex
* @param callback * @param callback optional callback
*/ */
private void setActiveTab(final int newTabIndex, final Callback<Boolean> callback) { private void setActiveTab(final int newTabIndex, final Callback<Boolean> callback) {
@ -1545,7 +1542,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
/** /**
* save (if needed) and execute callback * save (if needed) and execute callback
* @param callback * @param callback callback for result of execution, must not be null
*/ */
public void saveAndNavigate(final Callback<Boolean> callback) { public void saveAndNavigate(final Callback<Boolean> callback) {
if (adTabbox != null) if (adTabbox != null)
@ -1581,7 +1578,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
* Change selected tab from oldTabIndex to newTabIndex * Change selected tab from oldTabIndex to newTabIndex
* @param oldTabIndex * @param oldTabIndex
* @param newTabIndex * @param newTabIndex
* @param callback * @param callback optional callback for result of execution
*/ */
private void setActiveTab0(int oldTabIndex, int newTabIndex, private void setActiveTab0(int oldTabIndex, int newTabIndex,
final Callback<Boolean> callback) { final Callback<Boolean> callback) {
@ -2128,7 +2125,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
/** /**
* Auto save current changes (if auto save is enable). * Auto save current changes (if auto save is enable).
* Delegate to {@link #asyncAutoSave()} * Delegate to {@link #asyncAutoSave()}
* @param e * @param e DataStatusEvent
*/ */
private synchronized void autoSaveChanges(DataStatusEvent e) { private synchronized void autoSaveChanges(DataStatusEvent e) {
if (!e.isInitEdit() && toolbar.isSaveEnable() && MSysConfig.getBooleanValue(MSysConfig.ZK_AUTO_SAVE_CHANGES, false, Env.getAD_Client_ID(Env.getCtx()))) { if (!e.isInitEdit() && toolbar.isSaveEnable() && MSysConfig.getBooleanValue(MSysConfig.ZK_AUTO_SAVE_CHANGES, false, Env.getAD_Client_ID(Env.getCtx()))) {
@ -2198,7 +2195,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
* Refresh all row. * Refresh all row.
* Delegate to {@link #doOnRefresh(boolean)} * Delegate to {@link #doOnRefresh(boolean)}
* @param fireEvent * @param fireEvent
* @param saveCurrentRow * @param saveCurrentRow if true, save before refresh
*/ */
public void onRefresh(final boolean fireEvent, final boolean saveCurrentRow) public void onRefresh(final boolean fireEvent, final boolean saveCurrentRow)
{ {
@ -2785,7 +2782,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
* @param navigationEvent * @param navigationEvent
* @param newRecord * @param newRecord
* @param wasChanged * @param wasChanged
* @param callback * @param callback optional callback for result of save
*/ */
private void onSave0(boolean onSaveEvent, boolean navigationEvent, private void onSave0(boolean onSaveEvent, boolean navigationEvent,
boolean newRecord, boolean wasChanged, Callback<Boolean> callback) { boolean newRecord, boolean wasChanged, Callback<Boolean> callback) {
@ -2922,7 +2919,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
/** /**
* Delegate to {@link #onSave(boolean, boolean, Callback)} * Save and create new record.
* Delegate to {@link #onSave(boolean, boolean, Callback)}.
* @see ToolbarListener#onSaveCreate() * @see ToolbarListener#onSaveCreate()
*/ */
@Override @Override
@ -3174,7 +3172,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
postCallback.onCallback(false); postCallback.onCallback(false);
} }
} }
//
/** /**
* Delegate to {@link #onPrintCallback(Callback)} * Delegate to {@link #onPrintCallback(Callback)}
@ -3212,9 +3209,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
private void onPrintCallback(final Callback<Boolean> postCallback) { private void onPrintCallback(final Callback<Boolean> postCallback) {
//Get process defined for this tab //Get process defined for this tab
final int AD_Process_ID = adTabbox.getSelectedGridTab().getAD_Process_ID(); final int AD_Process_ID = adTabbox.getSelectedGridTab().getAD_Process_ID();
//log.info("ID=" + AD_Process_ID);
// No report defined // No document print process defined
if (AD_Process_ID == 0) if (AD_Process_ID == 0)
{ {
onReport(); onReport();
@ -3231,7 +3227,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
final ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowContent.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true); final ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowContent.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true);
if (dialog.isValid()) { if (dialog.isValid()) {
//dialog.setWidth("500px");
dialog.setBorder("normal"); dialog.setBorder("normal");
getComponent().getParent().appendChild(dialog); getComponent().getParent().appendChild(dialog);
showBusyMask(dialog); showBusyMask(dialog);
@ -3323,7 +3318,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
} }
// Elaine 2008/07/17
/** /**
* @see ToolbarListener#onActiveWorkflows() * @see ToolbarListener#onActiveWorkflows()
*/ */
@ -3344,7 +3338,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
} }
} }
//
/** /**
* Close popup for toolbar button * Close popup for toolbar button
* @param btnName toobar button name * @param btnName toobar button name
@ -3377,9 +3371,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
new WRequest(toolbar.getToolbarItem("Requests"), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getRecord_ID(), C_BPartner_ID); new WRequest(toolbar.getToolbarItem("Requests"), adTabbox.getSelectedGridTab().getAD_Table_ID(), adTabbox.getSelectedGridTab().getRecord_ID(), C_BPartner_ID);
} }
} }
//
// Elaine 2008/07/22
/** /**
* @see ToolbarListener#onProductInfo() * @see ToolbarListener#onProductInfo()
*/ */
@ -3389,10 +3381,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
closeToolbarPopup("ProductInfo"); closeToolbarPopup("ProductInfo");
InfoPanel.showPanel(I_M_Product.Table_Name); InfoPanel.showPanel(I_M_Product.Table_Name);
} }
//
// Elaine 2008/07/28
/** /**
* Delegate to {@link WArchive} * Delegate to {@link WArchive}
* @see ToolbarListener#onArchive() * @see ToolbarListener#onArchive()
@ -3409,7 +3398,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
} }
//
/** /**
* Delegate to {@link ExportAction} * Delegate to {@link ExportAction}
*/ */
@ -3508,7 +3496,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
getCurrentFindWindow().dispose(); getCurrentFindWindow().dispose();
} }
/************************************************************************** /**
* Execute action for button. * Execute action for button.
* With the exception of zoom to record_id, delegate to {@link #actionButton0(String, IProcessButton)}. * With the exception of zoom to record_id, delegate to {@link #actionButton0(String, IProcessButton)}.
* @param wButton {@link IProcessButton} * @param wButton {@link IProcessButton}
@ -3568,7 +3556,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
} }
/************************************************************************** /**
* Execution action of button. * Execution action of button.
* Delegate to {@link #executeButtonProcess(IProcessButton, boolean, int, int, boolean)} for process * Delegate to {@link #executeButtonProcess(IProcessButton, boolean, int, int, boolean)} for process
* @param col column name * @param col column name
@ -3998,7 +3986,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (dialog.isValid()) if (dialog.isValid())
{ {
//dialog.setWidth("500px");
dialog.setBorder("normal"); dialog.setBorder("normal");
getComponent().getParent().appendChild(dialog); getComponent().getParent().appendChild(dialog);
if (ClientInfo.isMobile()) if (ClientInfo.isMobile())
@ -4109,14 +4096,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
template.run(); template.run();
} }
/************************************************************************** /**
* Process Callout(s). * Process Callout(s).
* <p>
* The Callout is in the string of
* "class.method;class.method;"
* If there is no class name, i.e. only a method name, the class is regarded
* as CalloutSystem.
* The class needs to comply with the Interface Callout.
* *
* @param field field * @param field field
* @return error message or "" * @return error message or ""
@ -4374,7 +4355,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
} }
/** /**
* * Get cache find window for current selected tab
* @return {@link FindWindow} * @return {@link FindWindow}
*/ */
public FindWindow getCurrentFindWindow() { public FindWindow getCurrentFindWindow() {

View File

@ -27,6 +27,7 @@ import org.adempiere.util.Callback;
import org.adempiere.webui.adwindow.DetailPane.Tabpanel; import org.adempiere.webui.adwindow.DetailPane.Tabpanel;
import org.adempiere.webui.component.ADTabListModel; import org.adempiere.webui.component.ADTabListModel;
import org.adempiere.webui.component.ADTabListModel.ADTabLabel; import org.adempiere.webui.component.ADTabListModel.ADTabLabel;
import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.util.ZKUpdateUtil; import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.Dialog; import org.adempiere.webui.window.Dialog;
import org.compiere.model.DataStatusEvent; import org.compiere.model.DataStatusEvent;
@ -56,8 +57,8 @@ import org.zkoss.zul.Vlayout;
/** /**
* Header and detail UI for AD_Tabs. * Header and detail UI for AD_Tabs.
* This class manage a list of tabs with the current selected tab as the attached and visible {@link ADTabpanel} instance. * This class manage a list of tabs with the current selected tab as the visible {@link ADTabpanel} instance.
* Child tabs of selected tab is shown in {@link DetailPane} inside {@link ADTabpanel}. * Child tabs of selected tab is shown in {@link DetailPane} using {@link Tabbox}.
* *
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a> * @author <a href="mailto:hengsin@gmail.com">Low Heng Sin</a>

View File

@ -310,9 +310,10 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
} }
/** /**
* get component to display value of a field. * Get component to display value of a field.<br/>
* when display is boolean or button, return correspond component * When display type is boolean or button, return corresponding component.<br/>
* other return a label with text get from {@link #getDisplayText(Object, GridField, int, boolean)} * Otherwise, use Label or Component from {@link WEditor#getDisplayComponent()} to display text from {@link #getDisplayText(Object, GridField, int, boolean)}
* (As it is, only {@link Html} is supported for {@link WEditor#getDisplayComponent()}).
* @param rowIndex * @param rowIndex
* @param value * @param value
* @param gridField * @param gridField
@ -347,7 +348,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
if (component instanceof Html){ if (component instanceof Html){
((Html)component).setContent(text); ((Html)component).setContent(text);
}else{ }else{
throw new UnsupportedOperationException("neet a componet has setvalue function"); throw new UnsupportedOperationException("Only implemented for Html component.");
} }
} }
} }

View File

@ -134,8 +134,8 @@ public class GridView extends Vlayout implements EventListener<Event>, IdSpace,
private int pageSize = DEFAULT_PAGE_SIZE; private int pageSize = DEFAULT_PAGE_SIZE;
/** /**
* list field display in grid mode, in case user customize grid * fields display in grid mode, in case user customize grid,
* this list container only display list. * this list include only display fields.
*/ */
private GridField[] gridFields; private GridField[] gridFields;

View File

@ -128,7 +128,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
private ProcessInfo m_pi = null; private ProcessInfo m_pi = null;
/** if true, auto call {@link #dispose()} in {@link #ON_COMPLETE_EVENT} handler. **/ /** if true, auto call {@link #dispose()} in {@link #ON_COMPLETE_EVENT} handler. **/
private boolean m_disposeOnComplete; private boolean m_disposeOnComplete;
/** Panel for process paramters **/ /** Panel for process parameters **/
private ProcessParameterPanel parameterPanel = null; private ProcessParameterPanel parameterPanel = null;
/** Checkbox to toggle running process/report as background job **/ /** Checkbox to toggle running process/report as background job **/
private Checkbox runAsJobField = null; private Checkbox runAsJobField = null;
@ -181,7 +181,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
* @param pi * @param pi
* @param autoStart * @param autoStart
* @param isDisposeOnComplete * @param isDisposeOnComplete
* @return * @return true if init is ok.
*/ */
protected boolean init(Properties ctx, int WindowNo, int AD_Process_ID, ProcessInfo pi, boolean autoStart, boolean isDisposeOnComplete) protected boolean init(Properties ctx, int WindowNo, int AD_Process_ID, ProcessInfo pi, boolean autoStart, boolean isDisposeOnComplete)
{ {

View File

@ -139,7 +139,6 @@ public class WPluginManager extends ADForm implements EventListener<Event> {
ZKUpdateUtil.setVflex(pluginsTable, "1"); ZKUpdateUtil.setVflex(pluginsTable, "1");
ZKUpdateUtil.setHflex(pluginsTable, "1"); ZKUpdateUtil.setHflex(pluginsTable, "1");
refreshPluginTable(); refreshPluginTable();
pluginsTable.autoSize();
pluginsTable.addEventListener(Events.ON_SELECT, this); pluginsTable.addEventListener(Events.ON_SELECT, this);
pluginActions = new Listbox(new KeyNamePair[] { new KeyNamePair(PLUGIN_ACTION_NONE, ""), pluginActions = new Listbox(new KeyNamePair[] { new KeyNamePair(PLUGIN_ACTION_NONE, ""),

View File

@ -96,7 +96,7 @@ public class WDocumentStatusIndicator extends Panel implements EventListener<Eve
} // getGoal } // getGoal
/** /**
* Init Graph Display * Init Document Status Display
*/ */
private void init() private void init()
{ {
@ -150,7 +150,7 @@ public class WDocumentStatusIndicator extends Panel implements EventListener<Eve
this.addEventListener(Events.ON_CLICK, this); this.addEventListener(Events.ON_CLICK, this);
} }
@Override
public void onEvent(Event event) throws Exception public void onEvent(Event event) throws Exception
{ {
int AD_Window_ID = m_documentStatus.getAD_Window_ID(); int AD_Window_ID = m_documentStatus.getAD_Window_ID();
@ -171,6 +171,9 @@ public class WDocumentStatusIndicator extends Panel implements EventListener<Eve
} }
/**
* Load {@link #m_documentStatus}
*/
public void refresh() { public void refresh() {
MDocumentStatus refresh_documentStatus = MDocumentStatus.get(Env.getCtx(), m_documentStatus.getPA_DocumentStatus_ID()); MDocumentStatus refresh_documentStatus = MDocumentStatus.get(Env.getCtx(), m_documentStatus.getPA_DocumentStatus_ID());
if(refresh_documentStatus != null) { if(refresh_documentStatus != null) {
@ -179,13 +182,16 @@ public class WDocumentStatusIndicator extends Panel implements EventListener<Eve
statusCount = MDocumentStatus.evaluate(m_documentStatus); statusCount = MDocumentStatus.evaluate(m_documentStatus);
} }
/**
* Update UI with data loaded in {@link #refresh()}
*/
public void updateUI() { public void updateUI() {
statusLabel.setText(Integer.toString(statusCount)); statusLabel.setText(Integer.toString(statusCount));
} }
/** /**
* Return the count for this indicator * Return the count for this indicator
* @return * @return status count
*/ */
public int getStatusCount() { public int getStatusCount() {
return statusCount; return statusCount;

View File

@ -31,6 +31,7 @@ package org.adempiere.webui.apps.graph;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.logging.Level;
import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Grid;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
@ -44,9 +45,12 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventQueue; import org.zkoss.zk.ui.event.EventQueue;
import org.zkoss.zk.ui.event.EventQueues; import org.zkoss.zk.ui.event.EventQueues;
/**
* Panel that hold one or more {@link WDocumentStatusIndicator}.
*/
public class WDocumentStatusPanel extends Panel { public class WDocumentStatusPanel extends Panel {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 7473476079783059880L; private static final long serialVersionUID = 7473476079783059880L;
@ -62,7 +66,7 @@ public class WDocumentStatusPanel extends Panel {
/** /**
* Get Panel if User has Document Status Indicators * Get Panel if User has Document Status Indicators
* @return panel * @return new WDocumentStatusPanel instance
*/ */
public static WDocumentStatusPanel get() public static WDocumentStatusPanel get()
{ {
@ -72,7 +76,7 @@ public class WDocumentStatusPanel extends Panel {
return new WDocumentStatusPanel(indicators); return new WDocumentStatusPanel(indicators);
} }
/************************************************************************** /**
* Constructor * Constructor
* @param Document Status Indicators * @param Document Status Indicators
*/ */
@ -84,11 +88,12 @@ public class WDocumentStatusPanel extends Panel {
} }
/** /**
* Static/Dynamic Init * Layout panel
*/ */
private void init() private void init()
{ {
log.info(""); if (log.isLoggable(Level.INFO))
log.info("");
Grid grid = new Grid(); Grid grid = new Grid();
appendChild(grid); appendChild(grid);
grid.setWidth("100%"); grid.setWidth("100%");
@ -110,6 +115,9 @@ public class WDocumentStatusPanel extends Panel {
} }
} // init } // init
/**
* Call {@link WDocumentStatusIndicator#refresh()} of {@link #indicatorList}.
*/
public void refresh() { public void refresh() {
lastRefreshCount = 0; lastRefreshCount = 0;
for (WDocumentStatusIndicator indicator : indicatorList) { for (WDocumentStatusIndicator indicator : indicatorList) {
@ -120,6 +128,9 @@ public class WDocumentStatusPanel extends Panel {
} }
/**
* Call {@link WDocumentStatusIndicator#updateUI()} of {@link #indicatorList}.
*/
public void updateUI() { public void updateUI() {
for (WDocumentStatusIndicator indicator : indicatorList) { for (WDocumentStatusIndicator indicator : indicatorList) {
indicator.updateUI(); indicator.updateUI();

View File

@ -66,7 +66,7 @@ import org.zkoss.zul.Toolbar;
*/ */
public class WGraph extends Div implements IdSpace { public class WGraph extends Div implements IdSpace {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -975989183542113080L; private static final long serialVersionUID = -975989183542113080L;
@ -92,7 +92,7 @@ public class WGraph extends Div implements IdSpace {
/** /**
* Load Performance Data * Load Performance Data
*/ */
ArrayList<GraphColumn> list = new ArrayList<GraphColumn>(); protected ArrayList<GraphColumn> list = new ArrayList<GraphColumn>();
private boolean m_chartSelection; private boolean m_chartSelection;
@ -104,7 +104,7 @@ public class WGraph extends Div implements IdSpace {
private String m_yAxisLabel; private String m_yAxisLabel;
public DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount); protected DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
/** /**
* Constructor * Constructor
@ -219,6 +219,9 @@ public class WGraph extends Div implements IdSpace {
} }
} }
/**
* Load MMeasure data for {@link #m_goal}.
*/
private void loadData() { private void loadData() {
// Calculated // Calculated
MMeasure measure = m_goal.getMeasure(); MMeasure measure = m_goal.getMeasure();
@ -256,6 +259,10 @@ public class WGraph extends Div implements IdSpace {
} }
} // loadData } // loadData
/**
* Render chart to {@link #panel}.
* @param type optional chart type. if null, fallback to m_goal.getChartType
*/
private void renderChart(String type) { private void renderChart(String type) {
int width = 560; int width = 560;
int height = 400; int height = 400;
@ -398,6 +405,10 @@ public class WGraph extends Div implements IdSpace {
return array; return array;
} }
/**
* Render {@link #m_goal} data in html table.
* @param parent
*/
private void renderTable(Component parent) { private void renderTable(Component parent) {
Div div = new Div(); Div div = new Div();
appendChild(div); appendChild(div);

View File

@ -45,6 +45,9 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Label; import org.zkoss.zul.Label;
/**
* Panel with one or more {@link WPerformanceIndicator}
*/
public class WPAPanel extends Panel implements EventListener<Event> public class WPAPanel extends Panel implements EventListener<Event>
{ {
/** /**
@ -53,7 +56,10 @@ public class WPAPanel extends Panel implements EventListener<Event>
private static final long serialVersionUID = -6367672112341229048L; private static final long serialVersionUID = -6367672112341229048L;
/** /**
* Load Performance Goals for current login user * Load Performance Goals for current login user.<br/>
* For asynchronous use case, load MGoal[] through this method in non event listener thread
* and call {@link #setGoals(MGoal[], Options)} in event listener thread to update UI. To
* keep UI responsive, we need to avoid running long operation in event listener thread.
* @return MGoal[] * @return MGoal[]
*/ */
public static MGoal[] loadGoal() public static MGoal[] loadGoal()
@ -136,7 +142,7 @@ public class WPAPanel extends Panel implements EventListener<Event>
} // init } // init
/** /**
* Event Listener for Drill Down * Open {@link WPerformanceDetail}
* @param e event * @param e event
*/ */
@Override @Override

View File

@ -33,15 +33,20 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Label; import org.zkoss.zul.Label;
/**
* Dashboard gadget panel for individual {@link WPerformanceIndicator}
*/
public class WPAWidget extends Panel { public class WPAWidget extends Panel {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 5684412399657327777L; private static final long serialVersionUID = 5684412399657327777L;
/************************************************************************** /**
* Constructor * @param goal
* @param options
* @param isShowTitle
*/ */
public WPAWidget (MGoal goal, Options options, boolean isShowTitle) public WPAWidget (MGoal goal, Options options, boolean isShowTitle)
{ {
@ -51,7 +56,7 @@ public class WPAWidget extends Panel {
} }
/** /**
* Static/Dynamic Init * Render panel
* @param goal * @param goal
* @param options * @param options
*/ */

View File

@ -5,8 +5,7 @@ import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MGoal; import org.compiere.model.MGoal;
/** /**
* Performance Detail Frame. * Window with Chart and Details for {@link MGoal}
* BarPanel for Drill-Down
* *
* @author Jorg Janke * @author Jorg Janke
* @version $Id: PerformanceDetail.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $ * @version $Id: PerformanceDetail.java,v 1.2 2006/07/30 00:51:28 jjanke Exp $
@ -14,13 +13,13 @@ import org.compiere.model.MGoal;
public class WPerformanceDetail extends Window public class WPerformanceDetail extends Window
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 3460594735973451874L; private static final long serialVersionUID = 3460594735973451874L;
/** /**
* Constructor. * Constructor.
* Called from PAPanel, ViewPI (Performance Indicator) * Called from {@link WPAPanel} and {@link WPAWidget}
* @param goal goal * @param goal goal
*/ */
public WPerformanceDetail (MGoal goal) public WPerformanceDetail (MGoal goal)
@ -28,12 +27,12 @@ public class WPerformanceDetail extends Window
super(); super();
setTitle(goal.getName()); setTitle(goal.getName());
WGraph barPanel = new WGraph(goal, 0, true, false, true, true); WGraph graph = new WGraph(goal, 0, true, false, true, true);
appendChild(barPanel); appendChild(graph);
this.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED); this.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
this.setStyle("height: 100%; width: 100%; position: absolute; overflow: auto"); this.setStyle("height: 100%; width: 100%; position: absolute; overflow: auto");
barPanel.setStyle("height: 100%; width: 100%; position: absolute; overflow: visible"); graph.setStyle("height: 100%; width: 100%; position: absolute; overflow: visible");
SessionManager.getAppDesktop().showWindow(this); SessionManager.getAppDesktop().showWindow(this);
} // PerformanceDetail } // PerformanceDetail
} }

View File

@ -36,7 +36,7 @@ import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Menupopup; import org.zkoss.zul.Menupopup;
/** /**
* Performance Indicator * Panel with chart for {@link MGoal}
* *
* @author hengsin * @author hengsin
*/ */

View File

@ -3,11 +3,14 @@ package org.adempiere.webui.apps.graph;
import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.panel.ADForm;
import org.compiere.model.MGoal; import org.compiere.model.MGoal;
/**
* Form for {@link WPAPanel}
*/
@org.idempiere.ui.zk.annotation.Form(name = "org.adempiere.apps.graph.ViewPI") @org.idempiere.ui.zk.annotation.Form(name = "org.adempiere.apps.graph.ViewPI")
public class WViewPI extends ADForm { public class WViewPI extends ADForm {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -755873621984745607L; private static final long serialVersionUID = -755873621984745607L;

View File

@ -32,8 +32,9 @@ import org.zkoss.zul.Imagemap;
/** /**
* @author Paul Bowden, Adaxa Pty Ltd * @author Paul Bowden, Adaxa Pty Ltd
* @author hengsin * @author hengsin
* * @deprecated replace by billboard based implementation
*/ */
@Deprecated
/* package */ class ChartRenderer { /* package */ class ChartRenderer {
private static final CLogger log = CLogger.getCLogger(ChartRenderer.class); private static final CLogger log = CLogger.getCLogger(ChartRenderer.class);

View File

@ -46,8 +46,9 @@ import org.zkoss.zul.Imagemap;
/** /**
* *
* @author hengsin * @author hengsin
* * @deprecated replace by billboard based implementation
*/ */
@Deprecated
public class ChartRendererServiceImpl implements IChartRendererService { public class ChartRendererServiceImpl implements IChartRendererService {
private final static CLogger log = CLogger.getCLogger(ChartRendererServiceImpl.class); private final static CLogger log = CLogger.getCLogger(ChartRendererServiceImpl.class);

View File

@ -31,8 +31,9 @@ import org.jfree.data.general.DefaultValueDataset;
/** /**
* *
* @author hengsin * @author hengsin
* * @deprecated replace by billboard based implementation
*/ */
@Deprecated
public class PerformanceGraphBuilder { public class PerformanceGraphBuilder {
public JFreeChart createIndicatorChart(IndicatorModel model) public JFreeChart createIndicatorChart(IndicatorModel model)

View File

@ -16,9 +16,8 @@ package org.adempiere.webui.apps.graph.model;
import org.compiere.model.MChart; import org.compiere.model.MChart;
/** /**
* * Model for chart (AD_Chart)
* @author hengsin * @author hengsin
*
*/ */
public class ChartModel { public class ChartModel {
public MChart chart; public MChart chart;

View File

@ -19,9 +19,8 @@ import org.adempiere.apps.graph.GraphColumn;
import org.compiere.model.MGoal; import org.compiere.model.MGoal;
/** /**
* * Model for performance graph (PA_Goal)
* @author hengsin * @author hengsin
*
*/ */
public class GoalModel { public class GoalModel {
public MGoal goal; public MGoal goal;

View File

@ -18,9 +18,8 @@ import java.awt.Color;
import org.compiere.model.MGoal; import org.compiere.model.MGoal;
/** /**
* * Model for performance indicator (meter/gauge)
* @author hengsin * @author hengsin
*
*/ */
public class IndicatorModel { public class IndicatorModel {
public MGoal goalModel; public MGoal goalModel;

View File

@ -66,27 +66,32 @@ import org.zkoss.zul.Toolbarbutton;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
/** /**
* * Workflow editor form
* @author Low Heng Sin * @author Low Heng Sin
*
*/ */
@org.idempiere.ui.zk.annotation.Form(name = "org.compiere.apps.wf.WFPanel") @org.idempiere.ui.zk.annotation.Form(name = "org.compiere.apps.wf.WFPanel")
public class WFEditor extends ADForm { public class WFEditor extends ADForm {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 4293422396394778274L; private static final long serialVersionUID = 4293422396394778274L;
/** Workflows dropdown list */
private Listbox workflowList; private Listbox workflowList;
private int m_workflowId = 0; private int m_workflowId = 0;
private Toolbarbutton zoomButton; private Toolbarbutton zoomButton;
private Toolbarbutton refreshButton; private Toolbarbutton refreshButton;
private Toolbarbutton newButton; private Toolbarbutton newButton;
/** Content of {@link #center} */
private Table table; private Table table;
/** Center of form */
private Center center; private Center center;
private MWorkflow m_wf; private MWorkflow m_wf;
private WFNodeContainer nodeContainer; private WFNodeContainer nodeContainer;
/**
* Layout form
*/
@Override @Override
protected void initForm() { protected void initForm() {
ZKUpdateUtil.setHeight(this, "100%"); ZKUpdateUtil.setHeight(this, "100%");
@ -159,6 +164,9 @@ public class WFEditor extends ADForm {
ZKUpdateUtil.setHeight(south, "36px"); ZKUpdateUtil.setHeight(south, "36px");
} }
/**
* Create {@link #table}
*/
private void createTable() { private void createTable() {
table = new Table(); table = new Table();
table.setDynamicProperty("cellpadding", "0"); table.setDynamicProperty("cellpadding", "0");
@ -219,6 +227,9 @@ public class WFEditor extends ADForm {
} }
} }
/**
* Create new workflow node
*/
private void createNewNode() { private void createNewNode() {
String nameLabel = Msg.getElement(Env.getCtx(), MWFNode.COLUMNNAME_Name); String nameLabel = Msg.getElement(Env.getCtx(), MWFNode.COLUMNNAME_Name);
String title = Msg.getMsg(Env.getCtx(), "CreateNewNode"); String title = Msg.getMsg(Env.getCtx(), "CreateNewNode");
@ -268,6 +279,11 @@ public class WFEditor extends ADForm {
w.doHighlighted(); w.doHighlighted();
} }
/**
* reload and re-render workflow nodes
* @param workflowId
* @param reread
*/
protected void reload(int workflowId, boolean reread) { protected void reload(int workflowId, boolean reread) {
center.removeChild(table); center.removeChild(table);
createTable(); createTable();
@ -275,6 +291,11 @@ public class WFEditor extends ADForm {
load(workflowId, reread); load(workflowId, reread);
} }
/**
* Load and render workflow nodes
* @param workflowId
* @param reread
*/
private void load(int workflowId, boolean reread) { private void load(int workflowId, boolean reread) {
// Get Workflow // Get Workflow
m_wf = MWorkflow.getCopy(Env.getCtx(), workflowId, (String)null); m_wf = MWorkflow.getCopy(Env.getCtx(), workflowId, (String)null);
@ -382,6 +403,10 @@ public class WFEditor extends ADForm {
} }
/**
* Show popup menu for workflow node
* @param target
*/
protected void showNodeMenu(Component target) { protected void showNodeMenu(Component target) {
Integer AD_WF_Node_ID = (Integer) target.getAttribute("AD_WF_Node_ID"); Integer AD_WF_Node_ID = (Integer) target.getAttribute("AD_WF_Node_ID");
if (AD_WF_Node_ID != null) { if (AD_WF_Node_ID != null) {
@ -453,7 +478,7 @@ public class WFEditor extends ADForm {
} }
/** /**
* Zoom to WorkFlow * Zoom to WorkFlow window
*/ */
private void zoom() private void zoom()
{ {
@ -463,9 +488,11 @@ public class WFEditor extends ADForm {
} // zoom } // zoom
/** /**
* Add Menu Item to - add new line to node * Menu item to add line to next node or to apply actions (delete, properties or zoom) to source workflow node.
* @param menu base menu * @param menu popup menu
* @param title title * @param title title
* @param node source workflow node
* @param AD_WF_NodeTo_ID if > 0, next workflow node id. if < 0, actions to apply to node
*/ */
private void addMenuItem (Menupopup menu, String title, MWFNode node, int AD_WF_NodeTo_ID) private void addMenuItem (Menupopup menu, String title, MWFNode node, int AD_WF_NodeTo_ID)
{ {
@ -475,9 +502,10 @@ public class WFEditor extends ADForm {
} // addMenuItem } // addMenuItem
/** /**
* Add Menu Item to - delete line * Add Menu Item to - delete line
* @param menu base menu * @param menu popup menu
* @param title title * @param title title
* @param line
*/ */
private void addMenuItem (Menupopup menu, String title, MWFNodeNext line) private void addMenuItem (Menupopup menu, String title, MWFNodeNext line)
{ {

View File

@ -1,5 +1,31 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.apps.wf; package org.adempiere.webui.apps.wf;
import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Textbox; import org.adempiere.webui.component.Textbox;
@ -26,10 +52,12 @@ import org.zkoss.zul.Vbox;
public class WFPopupItem extends Menuitem { public class WFPopupItem extends Menuitem {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -8409752634782368108L; private static final long serialVersionUID = -8409752634782368108L;
/** Node actions */
public static final int WFPOPUPITEM_DELETENODE = -1; public static final int WFPOPUPITEM_DELETENODE = -1;
public static final int WFPOPUPITEM_PROPERTIES = -2; public static final int WFPOPUPITEM_PROPERTIES = -2;
public static final int WFPOPUPITEM_ZOOM = -3; public static final int WFPOPUPITEM_ZOOM = -3;
@ -41,8 +69,8 @@ public class WFPopupItem extends Menuitem {
/** /**
* Add Line Item * Add Line Item
* @param title title * @param title title
* @param node node * @param node workflow node
* @param AD_WF_NodeTo_ID line to * @param AD_WF_NodeTo_ID if > 0, next workflow node id. if < 0, actions to apply to node
*/ */
public WFPopupItem (String title, MWFNode node, int AD_WF_NodeTo_ID) public WFPopupItem (String title, MWFNode node, int AD_WF_NodeTo_ID)
{ {
@ -64,15 +92,20 @@ public class WFPopupItem extends Menuitem {
m_AD_Workflow_ID = line.getAD_WF_Node().getAD_Workflow_ID(); m_AD_Workflow_ID = line.getAD_WF_Node().getAD_Workflow_ID();
} // WFPopupItem } // WFPopupItem
/** The Node */ /** Source Workfklow Node */
private MWFNode m_node; private MWFNode m_node;
/** The Line */ /** The Line to delete (if {@link #m_AD_WF_NodeTo_ID} = 0) */
private MWFNodeNext m_line; private MWFNodeNext m_line;
/** The Next Node ID */ /**
* <li>&gt; 0 - next workflow node id</li>
* <li>&lt; 0 - actions to apply to {@link #m_node} </li>
* <li>0 - to delete {@link #m_node} </li>
*/
private int m_AD_WF_NodeTo_ID; private int m_AD_WF_NodeTo_ID;
/** /**
* Execute * Execute action for menu item
* @param wfp WFEditor
*/ */
public void execute(final WFEditor wfp) public void execute(final WFEditor wfp)
{ {
@ -86,7 +119,8 @@ public class WFPopupItem extends Menuitem {
if (AD_Client_ID > 11) if (AD_Client_ID > 11)
newLine.setEntityType(MSysConfig.getValue(MSysConfig.DEFAULT_ENTITYTYPE, MEntityType.ENTITYTYPE_UserMaintained)); newLine.setEntityType(MSysConfig.getValue(MSysConfig.DEFAULT_ENTITYTYPE, MEntityType.ENTITYTYPE_UserMaintained));
newLine.saveEx(); newLine.saveEx();
log.info("Add Line to " + m_node + " -> " + newLine); if (log.isLoggable(Level.INFO))
log.info("Add Line to " + m_node + " -> " + newLine);
wfp.reload(m_AD_Workflow_ID, true); wfp.reload(m_AD_Workflow_ID, true);
} }
// Edit Properties // Edit Properties
@ -112,14 +146,16 @@ public class WFPopupItem extends Menuitem {
// Delete Node // Delete Node
else if (m_node != null && m_AD_WF_NodeTo_ID == WFPOPUPITEM_DELETENODE) else if (m_node != null && m_AD_WF_NodeTo_ID == WFPOPUPITEM_DELETENODE)
{ {
log.info("Delete Node: " + m_node); if (log.isLoggable(Level.INFO))
log.info("Delete Node: " + m_node);
m_node.delete(false); m_node.delete(false);
wfp.reload(m_AD_Workflow_ID, true); wfp.reload(m_AD_Workflow_ID, true);
} }
// Delete Line // Delete Line
else if (m_line != null) else if (m_line != null)
{ {
log.info("Delete Line: " + m_line); if (log.isLoggable(Level.INFO))
log.info("Delete Line: " + m_line);
m_line.delete(false); m_line.delete(false);
wfp.reload(m_AD_Workflow_ID, true); wfp.reload(m_AD_Workflow_ID, true);
} }
@ -127,6 +163,10 @@ public class WFPopupItem extends Menuitem {
log.warning("No Action??"); log.warning("No Action??");
} // execute } // execute
/**
* Edit node properties
* @param wfp WFEditor
*/
private void editNode(final WFEditor wfp) { private void editNode(final WFEditor wfp) {
String title = Msg.getMsg(Env.getCtx(), "Properties"); String title = Msg.getMsg(Env.getCtx(), "Properties");
final Window w = new Window(); final Window w = new Window();

View File

@ -77,7 +77,7 @@ import org.zkoss.zul.South;
import org.zkoss.zul.Vlayout; import org.zkoss.zul.Vlayout;
/** /**
* Direct port from WFActivity * Workflow activity form
* @author hengsin * @author hengsin
* *
*/ */
@ -85,7 +85,7 @@ import org.zkoss.zul.Vlayout;
public class WWFActivity extends ADForm implements EventListener<Event> public class WWFActivity extends ADForm implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -1658595186719510159L; private static final long serialVersionUID = -1658595186719510159L;
/** Window No */ /** Window No */
@ -127,12 +127,19 @@ public class WWFActivity extends ADForm implements EventListener<Event>
private WListbox listbox = new WListbox(); private WListbox listbox = new WListbox();
private final static String HISTORY_DIV_START_TAG = "<div style='overflow-y:scroll;height: 100px; border: 1px solid #7F9DB9;'>"; private final static String HISTORY_DIV_START_TAG = "<div style='overflow-y:scroll;height: 100px; border: 1px solid #7F9DB9;'>";
/**
* default constructor
*/
public WWFActivity() public WWFActivity()
{ {
super(); super();
LayoutUtils.addSclass("workflow-activity-form", this); LayoutUtils.addSclass("workflow-activity-form", this);
} }
/**
* Load activities and layout form
*/
protected void initForm() protected void initForm()
{ {
loadActivities(); loadActivities();
@ -161,12 +168,20 @@ public class WWFActivity extends ADForm implements EventListener<Event>
display(-1); display(-1);
} }
/**
* set tooltip text of btn
* @param btn
* @param key AD_Message key
*/
private void setTooltipText(Button btn, String key) { private void setTooltipText(Button btn, String key) {
String text = Util.cleanAmp(Msg.translate(Env.getCtx(), key)); String text = Util.cleanAmp(Msg.translate(Env.getCtx(), key));
if (!Util.isEmpty(text, true)) if (!Util.isEmpty(text, true))
btn.setTooltiptext(text); btn.setTooltiptext(text);
} }
/**
* Layout form
*/
private void init() private void init()
{ {
Grid grid = new Grid(); Grid grid = new Grid();
@ -303,6 +318,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
this.setStyle("height: 100%; width: 100%; position: relative;"); this.setStyle("height: 100%; width: 100%; position: relative;");
} }
@Override
public void onEvent(Event event) throws Exception public void onEvent(Event event) throws Exception
{ {
Component comp = event.getTarget(); Component comp = event.getTarget();
@ -342,7 +358,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
/** /**
* Get active activities count * Get active activities count
* @return int * @return pending activities count
*/ */
public int getActivitiesCount() public int getActivitiesCount()
{ {
@ -357,7 +373,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
/** /**
* Load Activities * Load Activities
* @return int * @return number of activities loaded
*/ */
public int loadActivities() public int loadActivities()
{ {
@ -422,7 +438,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
} // loadActivities } // loadActivities
/** /**
* Reset Display * Reset form and return activity at selIndex
* @param selIndex select index * @param selIndex select index
* @return selected activity * @return selected activity
*/ */
@ -464,8 +480,8 @@ public class WWFActivity extends ADForm implements EventListener<Event>
} // resetDisplay } // resetDisplay
/** /**
* Display. * Display activity at index
* Fill Editors * @param index
*/ */
public void display (int index) public void display (int index)
{ {
@ -537,7 +553,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
/** /**
* Zoom * Zoom to workflow activity window
*/ */
private void cmd_zoom() private void cmd_zoom()
{ {
@ -548,7 +564,7 @@ public class WWFActivity extends ADForm implements EventListener<Event>
} // cmd_zoom } // cmd_zoom
/** /**
* Answer Button * Action Button
*/ */
private void cmd_button() private void cmd_button()
{ {
@ -565,8 +581,9 @@ public class WWFActivity extends ADForm implements EventListener<Event>
MQuery query = MQuery.getEqualQuery(ColumnName, Record_ID); MQuery query = MQuery.getEqualQuery(ColumnName, Record_ID);
boolean IsSOTrx = m_activity.isSOTrx(); boolean IsSOTrx = m_activity.isSOTrx();
// //
log.info("Zoom to AD_Window_ID=" + AD_Window_ID if (log.isLoggable(Level.INFO))
+ " - " + query + " (IsSOTrx=" + IsSOTrx + ")"); log.info("Zoom to AD_Window_ID=" + AD_Window_ID
+ " - " + query + " (IsSOTrx=" + IsSOTrx + ")");
AEnv.zoom(AD_Window_ID, query); AEnv.zoom(AD_Window_ID, query);
} }

View File

@ -22,29 +22,42 @@ import org.zkoss.zul.Listitem;
import org.zkoss.zul.ListitemRenderer; import org.zkoss.zul.ListitemRenderer;
import org.zkoss.zul.ListitemRendererExt; import org.zkoss.zul.ListitemRendererExt;
/**
* List model and List item renderer implementation for list of AD_Tab label.
* ADTabLabel class aside, this is not use any more.
*/
public class ADTabListModel extends AbstractListModel<Object> implements ListitemRenderer<Object>, ListitemRendererExt { public class ADTabListModel extends AbstractListModel<Object> implements ListitemRenderer<Object>, ListitemRendererExt {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 7683969121090679214L; private static final long serialVersionUID = 7683969121090679214L;
List<ADTabLabel> listItems = null; protected List<ADTabLabel> listItems = null;
private IADTabbox tabbox; private IADTabbox tabbox;
/**
* @param listItems
* @param tabbox
*/
public ADTabListModel(List<ADTabLabel> listItems, IADTabbox tabbox) { public ADTabListModel(List<ADTabLabel> listItems, IADTabbox tabbox) {
this.listItems = listItems; this.listItems = listItems;
this.tabbox = tabbox; this.tabbox = tabbox;
} }
@Override
public Object getElementAt(int index) { public Object getElementAt(int index) {
ADTabLabel item = index < listItems.size() ? listItems.get(index) : null; ADTabLabel item = index < listItems.size() ? listItems.get(index) : null;
return item; return item;
} }
@Override
public int getSize() { public int getSize() {
return listItems.size(); return listItems.size();
} }
/**
* Value object for AD_Tab
*/
public static class ADTabLabel { public static class ADTabLabel {
public String label; public String label;
public int tabLevel; public int tabLevel;
@ -83,14 +96,17 @@ public class ADTabListModel extends AbstractListModel<Object> implements Listite
cell.setVisible(false); cell.setVisible(false);
} }
@Override
public int getControls() { public int getControls() {
return DETACH_ON_RENDER; return DETACH_ON_RENDER;
} }
@Override
public Listcell newListcell(Listitem item) { public Listcell newListcell(Listitem item) {
return null; return null;
} }
@Override
public Listitem newListitem(Listbox listbox) { public Listitem newListitem(Listbox listbox) {
ListItem item = new ListItem(); ListItem item = new ListItem();
item.applyProperties(); item.applyProperties();

View File

@ -57,7 +57,10 @@ public class ADTreeFavoriteOnDropListener implements EventListener<Event>
private int mTreeFavID; private int mTreeFavID;
// /**
* @param tree
* @param treeModel
*/
public ADTreeFavoriteOnDropListener(Tree tree, FavoriteSimpleTreeModel treeModel) public ADTreeFavoriteOnDropListener(Tree tree, FavoriteSimpleTreeModel treeModel)
{ {
this.tree = tree; this.tree = tree;

View File

@ -44,15 +44,14 @@ import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Treerow; import org.zkoss.zul.Treerow;
/** /**
* * Handle on drop event of tree node
* @author Low Heng Sin * @author Low Heng Sin
*
*/ */
public class ADTreeOnDropListener implements EventListener<Event> { public class ADTreeOnDropListener implements EventListener<Event> {
private SimpleTreeModel treeModel; private SimpleTreeModel treeModel;
private MTree mTree; private MTree mTree;
private int windowNo; private int windowNo;
private Tree tree; private Tree tree;
private static final CLogger log = CLogger.getCLogger(ADTreeOnDropListener.class); private static final CLogger log = CLogger.getCLogger(ADTreeOnDropListener.class);
@ -94,7 +93,8 @@ public class ADTreeOnDropListener implements EventListener<Event> {
*/ */
private void moveNode(DefaultTreeNode<Object> movingNode, DefaultTreeNode<Object> toNode) private void moveNode(DefaultTreeNode<Object> movingNode, DefaultTreeNode<Object> toNode)
{ {
log.info(movingNode.toString() + " to " + toNode.toString()); if (log.isLoggable(Level.INFO))
log.info(movingNode.toString() + " to " + toNode.toString());
if (movingNode == toNode) if (movingNode == toNode)
return; return;
@ -111,9 +111,6 @@ public class ADTreeOnDropListener implements EventListener<Event> {
int path[] = treeModel.getPath(toNode); int path[] = treeModel.getPath(toNode);
Treeitem toItem = tree.renderItemByPath(path); Treeitem toItem = tree.renderItemByPath(path);
//tree.setSelectedItem(toItem);
//Events.sendEvent(tree, new Event(Events.ON_SELECT, tree));
MenuListener listener = new MenuListener(movingNode, toNode); MenuListener listener = new MenuListener(movingNode, toNode);
Menupopup popup = new Menupopup(); Menupopup popup = new Menupopup();
@ -133,6 +130,12 @@ public class ADTreeOnDropListener implements EventListener<Event> {
} // moveNode } // moveNode
/**
* Move movingNode to after toNode or into toNode (if moveInto is true)
* @param movingNode
* @param toNode
* @param moveInto true to insert movingNode into summary folder node
*/
private void moveNode(DefaultTreeNode<Object> movingNode, DefaultTreeNode<Object> toNode, boolean moveInto) private void moveNode(DefaultTreeNode<Object> movingNode, DefaultTreeNode<Object> toNode, boolean moveInto)
{ {
DefaultTreeNode<Object> newParent; DefaultTreeNode<Object> newParent;
@ -164,8 +167,6 @@ public class ADTreeOnDropListener implements EventListener<Event> {
} }
@SuppressWarnings("unused") @SuppressWarnings("unused")
Treeitem movingItem = tree.renderItemByPath(path); Treeitem movingItem = tree.renderItemByPath(path);
//tree.setSelectedItem(movingItem);
//Events.sendEvent(tree, new Event(Events.ON_SELECT, tree));
// *** Save changes to disk // *** Save changes to disk
Trx trx = Trx.get (Trx.createTrxName("ADTree"), true); Trx trx = Trx.get (Trx.createTrxName("ADTree"), true);
@ -223,6 +224,13 @@ public class ADTreeOnDropListener implements EventListener<Event> {
} }
} }
/**
* Update parent_id and seqno of mtnMovingNode
* @param mtnParentNode
* @param mtnMovingNode
* @param NodeIndex
* @param trxName
*/
private void updateNodePO(MTreeNode mtnParentNode, MTreeNode mtnMovingNode, int NodeIndex, String trxName) { private void updateNodePO(MTreeNode mtnParentNode, MTreeNode mtnMovingNode, int NodeIndex, String trxName) {
StringBuilder whereClause = new StringBuilder("AD_Tree_ID=").append(mTree.getAD_Tree_ID()) StringBuilder whereClause = new StringBuilder("AD_Tree_ID=").append(mTree.getAD_Tree_ID())
.append(" AND Node_ID=").append(mtnMovingNode.getNode_ID()); .append(" AND Node_ID=").append(mtnMovingNode.getNode_ID());

View File

@ -29,22 +29,29 @@ import org.zkoss.zul.Div;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
/** /**
* A custom accoridon implementation using borderlayout * A custom accordion implementation using borderlayout
* @author hengsin * @author hengsin
* *
*/ */
public class Accordion extends Borderlayout implements EventListener<Event> { public class Accordion extends Borderlayout implements EventListener<Event> {
/**
* generated serial id
*/
private static final long serialVersionUID = 5898232602746332810L; private static final long serialVersionUID = 5898232602746332810L;
private Vbox southBox; private Vbox southBox;
private Vbox northBox; private Vbox northBox;
/** List of label for component in {@link #componentList} */
private List<String> labelList = new ArrayList<String>(); private List<String> labelList = new ArrayList<String>();
/** List of header Div for component in {@link #componentList}. Header div is shown in {@link #northBox} */
private List<Div> headerList = new ArrayList<Div>(); private List<Div> headerList = new ArrayList<Div>();
private List<Component> componentList = new ArrayList<Component>(); private List<Component> componentList = new ArrayList<Component>();
private int selectedIndex = -1; private int selectedIndex = -1;
/**
* default constructor
*/
public Accordion() { public Accordion() {
North north = new North(); North north = new North();
appendChild(north); appendChild(north);

View File

@ -26,16 +26,17 @@ import org.zkoss.zul.A;
import org.zkoss.zul.Span; import org.zkoss.zul.Span;
/** /**
* * Attachment item UI with Label and Link to remove attachment from container.
* @author hengsin * @author hengsin
*
*/ */
public class AttachmentItem extends Span implements EventListener<Event>{ public class AttachmentItem extends Span implements EventListener<Event>{
/** /**
* generate serial id * generate serial id
*/ */
private static final long serialVersionUID = -7599391160210459080L; private static final long serialVersionUID = -7599391160210459080L;
/** Attachment content */
private DataSource ds; private DataSource ds;
/** List that contains {@link #ds} */
private List<DataSource> list; private List<DataSource> list;
public AttachmentItem(DataSource ds, List<DataSource> list, boolean removable) { public AttachmentItem(DataSource ds, List<DataSource> list, boolean removable) {

View File

@ -32,30 +32,33 @@ import org.zkoss.zul.Comboitem;
* @author Niraj Sohun * @author Niraj Sohun
* Aug 20, 2007 * Aug 20, 2007
*/ */
public class AutoComplete extends Combobox public class AutoComplete extends Combobox
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 7437206681528058083L; private static final long serialVersionUID = 7437206681528058083L;
/** comboItems All menu labels */ /** comboItems All items */
private String[] comboItems; private String[] comboItems;
/** strDescription Description of menu items */ /** strDescription Description of items */
private String[] strDescription; private String[] strDescription;
/** Image url or font icon sclass */
private String[] images; private String[] images;
/** Content for comboitem */
private String[] contents; private String[] contents;
/** Value object for comboitem */
private Object[] values; private Object[] values;
/** Comboitem:Content. Content is from {@link #contents} */
private HashMap<Comboitem, String> mapItems = new HashMap<Comboitem, String>(); private HashMap<Comboitem, String> mapItems = new HashMap<Comboitem, String>();
/** /**
* Set menu labels * Set items
* *
* @param vals Menu labels * @param vals Menu labels
*/ */
@ -65,6 +68,10 @@ public class AutoComplete extends Combobox
setDict(vals, true); setDict(vals, true);
} }
/**
* @param vals values
* @param sort true to sort in natural order
*/
public void setDict(String[] vals, boolean sort) public void setDict(String[] vals, boolean sort)
{ {
comboItems = vals; comboItems = vals;
@ -76,9 +83,9 @@ public class AutoComplete extends Combobox
} }
/** /**
* Set description of menu items * Set description of items
* *
* @param vals Description of menu items * @param vals Description of items
*/ */
public void setDescription(String[] vals) public void setDescription(String[] vals)
@ -87,9 +94,9 @@ public class AutoComplete extends Combobox
} }
/** /**
* Set content of menu items * Set content of items
* *
* @param vals Content of menu items * @param vals Content of items
*/ */
public void setContents(String[] vals) public void setContents(String[] vals)
@ -97,11 +104,19 @@ public class AutoComplete extends Combobox
contents = vals; contents = vals;
} }
/**
* set image urls or font icon sclasses
* @param images
*/
public void setImages(String[] images) public void setImages(String[] images)
{ {
this.images = images; this.images = images;
} }
/**
* set comboitem object values
* @param values
*/
public void setValues(Object[] values) public void setValues(Object[] values)
{ {
this.values = values; this.values = values;
@ -109,19 +124,25 @@ public class AutoComplete extends Combobox
/** /**
* Constructor * Constructor
*/ */
public AutoComplete() public AutoComplete()
{ {
if (comboItems != null) if (comboItems != null)
refresh(""); refresh("");
} }
/**
* @param value
*/
public AutoComplete(String value) public AutoComplete(String value)
{ {
super.setValue(value); super.setValue(value);
} }
/**
* @param value
*/
@Override
public void setValue(String value) public void setValue(String value)
{ {
super.setValue(value); super.setValue(value);
@ -129,12 +150,11 @@ public class AutoComplete extends Combobox
} }
/** /**
* Event handler responsible to reducing number of items * Event handler responsible to reducing number of items.
* Method is invoked each time something is typed in the combobox * Method is invoked each time something is typed in the combobox.
* *
* @param evt The event * @param evt Input event
*/ */
public void onChanging(InputEvent evt) public void onChanging(InputEvent evt)
{ {
if (!evt.isChangingBySelectBack()) if (!evt.isChangingBySelectBack())
@ -143,9 +163,10 @@ public class AutoComplete extends Combobox
} }
} }
/** /**
* Refresh comboitem based on the specified value. * Filter {@link #comboItems} by val
*/ * @param val input text
*/
public void refresh(String val) public void refresh(String val)
{ {
if (comboItems == null || val == null) { if (comboItems == null || val == null) {
@ -203,6 +224,10 @@ public class AutoComplete extends Combobox
} }
} }
/**
* @param item
* @return content text
*/
public String getContent(Comboitem item) public String getContent(Comboitem item)
{ {
return mapItems.get(item); return mapItems.get(item);

View File

@ -17,6 +17,9 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/**
* Background color constants
*/
public final class BackgroundColours public final class BackgroundColours
{ {
public final static String MANDATORY = "background-color:#fbb5b5"; public final static String MANDATORY = "background-color:#fbb5b5";

View File

@ -18,7 +18,7 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/** /**
* * Extend {@link org.zkoss.zul.Bandbox}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 11, 2007 * @date Mar 11, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -26,15 +26,21 @@ package org.adempiere.webui.component;
public class Bandbox extends org.zkoss.zul.Bandbox public class Bandbox extends org.zkoss.zul.Bandbox
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 5834568392276375501L; private static final long serialVersionUID = 5834568392276375501L;
/**
* @param enabled
*/
public void setEnabled(boolean enabled) public void setEnabled(boolean enabled)
{ {
this.setDisabled(!enabled); this.setDisabled(!enabled);
} }
/**
* @return true if component is enabled, false otherwise
*/
public boolean isEnabled() public boolean isEnabled()
{ {
return !isDisabled(); return !isDisabled();

View File

@ -1,6 +1,27 @@
/** /***********************************************************************
* * This file is part of iDempiere ERP Open Source *
*/ * http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - teo_sarca *
**********************************************************************/
package org.adempiere.webui.component; package org.adempiere.webui.component;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
@ -11,21 +32,29 @@ import org.zkoss.zul.South;
import org.zkoss.zul.West; import org.zkoss.zul.West;
/** /**
* Extend {@link org.zkoss.zul.Borderlayout}
* @author teo_sarca * @author teo_sarca
*
*/ */
public class Borderlayout extends org.zkoss.zul.Borderlayout public class Borderlayout extends org.zkoss.zul.Borderlayout
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -6976820221945897268L; private static final long serialVersionUID = -6976820221945897268L;
/**
* Default constructor
*/
public Borderlayout() public Borderlayout()
{ {
super(); super();
} }
/**
* Add component to North
* @param c Component
* @return this
*/
public Borderlayout appendNorth(Component c) public Borderlayout appendNorth(Component c)
{ {
North north = getNorth(); North north = getNorth();
@ -37,6 +66,12 @@ public class Borderlayout extends org.zkoss.zul.Borderlayout
north.appendChild(c); north.appendChild(c);
return this; return this;
} }
/**
* Add component to West
* @param c Component
* @return this
*/
public Borderlayout appendWest(Component c) public Borderlayout appendWest(Component c)
{ {
West west = getWest(); West west = getWest();
@ -48,6 +83,12 @@ public class Borderlayout extends org.zkoss.zul.Borderlayout
west.appendChild(c); west.appendChild(c);
return this; return this;
} }
/**
* Add component to South
* @param c Component
* @return this
*/
public Borderlayout appendSouth(Component c) public Borderlayout appendSouth(Component c)
{ {
South south = getSouth(); South south = getSouth();
@ -59,6 +100,12 @@ public class Borderlayout extends org.zkoss.zul.Borderlayout
south.appendChild(c); south.appendChild(c);
return this; return this;
} }
/**
* Add component to East
* @param c Component
* @return this
*/
public Borderlayout appendEast(Component c) public Borderlayout appendEast(Component c)
{ {
East east = getEast(); East east = getEast();
@ -70,6 +117,12 @@ public class Borderlayout extends org.zkoss.zul.Borderlayout
east.appendChild(c); east.appendChild(c);
return this; return this;
} }
/**
* Add component to Center
* @param c Component
* @return this
*/
public Borderlayout appendCenter(Component c) public Borderlayout appendCenter(Component c)
{ {
Center center = getCenter(); Center center = getCenter();

View File

@ -21,7 +21,7 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
/** /**
* * Extend {@link org.zkoss.zul.Button}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 12, 2007 * @date Mar 12, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -29,38 +29,57 @@ import org.zkoss.zk.ui.event.Events;
public class Button extends org.zkoss.zul.Button public class Button extends org.zkoss.zul.Button
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -6562573800018819691L; private static final long serialVersionUID = -6562573800018819691L;
private String name; private String name;
/**
* Default constructor
*/
public Button() public Button()
{ {
super(); super();
setAutodisable("self"); setAutodisable("self");
} }
/**
* @param label
*/
public Button(String label) public Button(String label)
{ {
super(label); super(label);
setAutodisable("self"); setAutodisable("self");
} }
/**
* Set name of button
* @param name
*/
public void setName(String name) public void setName(String name)
{ {
this.name = name; this.name = name;
} }
/**
* @return name of button
*/
public String getName() public String getName()
{ {
return this.name; return this.name;
} }
/**
* @param enabled
*/
public void setEnabled(boolean enabled) public void setEnabled(boolean enabled)
{ {
super.setDisabled(!enabled); super.setDisabled(!enabled);
} }
/**
* @return true if enable, false otherwise
*/
public boolean isEnabled() public boolean isEnabled()
{ {
return !super.isDisabled(); return !super.isDisabled();

View File

@ -21,7 +21,7 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
/** /**
* * Extend {@link org.zkoss.zul.Checkbox}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -29,15 +29,21 @@ import org.zkoss.zk.ui.event.Events;
public class Checkbox extends org.zkoss.zul.Checkbox public class Checkbox extends org.zkoss.zul.Checkbox
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 3306775098016676628L; private static final long serialVersionUID = 3306775098016676628L;
/**
* @param enabled
*/
public void setEnabled(boolean enabled) public void setEnabled(boolean enabled)
{ {
this.setDisabled(!enabled); this.setDisabled(!enabled);
} }
/**
* @return true if enable, false otherwise
*/
public boolean isEnabled() public boolean isEnabled()
{ {
return !this.isDisabled(); return !this.isDisabled();

View File

@ -20,21 +20,20 @@ import java.beans.PropertyChangeSupport;
import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.LayoutUtils;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
import org.zkoss.addon.chosenbox.Chosenbox; import org.zkoss.addon.chosenbox.Chosenbox;
import org.zkoss.zk.ui.Page;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
/** /**
* Composite component of {@link Chosenbox} and {@link Button}
* @author Low Heng Sin * @author Low Heng Sin
*/ */
public class ChosenSearchBox extends Div { public class ChosenSearchBox extends Div {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -3152111756471436612L; private static final long serialVersionUID = -3152111756471436612L;
protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport( protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
this);
protected Chosenbox<ValueNamePair> chosenbox; protected Chosenbox<ValueNamePair> chosenbox;
protected Button btn; protected Button btn;
@ -55,12 +54,16 @@ public class ChosenSearchBox extends Div {
} }
/** /**
* Set image url for button
* @param imageSrc * @param imageSrc
*/ */
public void setButtonImage(String imageSrc) { public void setButtonImage(String imageSrc) {
btn.setImage(imageSrc); btn.setImage(imageSrc);
} }
/**
* Layout component
*/
private void initComponents() { private void initComponents() {
if (chosenbox == null) if (chosenbox == null)
chosenbox = new Chosenbox<>(); chosenbox = new Chosenbox<>();
@ -106,16 +109,18 @@ public class ChosenSearchBox extends Div {
} }
/** /**
* @return boolean * @return true if enable, false otherwise
*/ */
public boolean isEnabled() { public boolean isEnabled() {
return btn.isEnabled(); return btn.isEnabled();
} }
/** /**
* If evtnm is ON_CLICK, add listener to {@link #btn}, otherwise add to {@link #chosenbox}.
* @param evtnm * @param evtnm
* @param listener * @param listener
*/ */
@Override
public boolean addEventListener(String evtnm, EventListener<?> listener) { public boolean addEventListener(String evtnm, EventListener<?> listener) {
if (Events.ON_CLICK.equals(evtnm)) { if (Events.ON_CLICK.equals(evtnm)) {
return btn.addEventListener(evtnm, listener); return btn.addEventListener(evtnm, listener);
@ -125,13 +130,14 @@ public class ChosenSearchBox extends Div {
} }
/** /**
* @param l * @param l PropertyChangeListener
*/ */
public synchronized void addPropertyChangeListener(PropertyChangeListener l) { public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
m_propertyChangeListeners.addPropertyChangeListener(l); m_propertyChangeListeners.addPropertyChangeListener(l);
} }
/** /**
* Set tooltip text for {@link #chosenbox}
* @param tooltiptext * @param tooltiptext
*/ */
public void setToolTipText(String tooltiptext) { public void setToolTipText(String tooltiptext) {
@ -145,6 +151,9 @@ public class ChosenSearchBox extends Div {
return btn; return btn;
} }
/**
* @param flag true for grid view, false otherwise
*/
public void setTableEditorMode(boolean flag) { public void setTableEditorMode(boolean flag) {
if (flag) { if (flag) {
setHflex("0"); setHflex("0");
@ -157,9 +166,4 @@ public class ChosenSearchBox extends Div {
} }
} }
@Override
public void onPageAttached(Page newpage, Page oldpage) {
super.onPageAttached(newpage, oldpage);
}
} }

View File

@ -17,22 +17,30 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/**
* Extend {@link org.zkoss.zul.Column}
*/
public class Column extends org.zkoss.zul.Column public class Column extends org.zkoss.zul.Column
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 8036743691725958481L; private static final long serialVersionUID = 8036743691725958481L;
/**
* default constructor
*/
public Column() public Column()
{ {
this(null); this(null);
} }
public Column(String str) /**
* @param label column label/header
*/
public Column(String label)
{ {
this.setLabel(str); this.setLabel(label);
} }
} }

View File

@ -17,11 +17,13 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/**
* Extend {@link org.zkoss.zul.Columns}
*/
public class Columns extends org.zkoss.zul.Columns public class Columns extends org.zkoss.zul.Columns
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 702502881459697527L; private static final long serialVersionUID = 702502881459697527L;
} }

View File

@ -14,17 +14,19 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/** /**
* * Component for account editor
* @author Low Heng Sin * @author Low Heng Sin
*
*/ */
public class Combinationbox extends EditorBox public class Combinationbox extends EditorBox
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -3743140893368022592L; private static final long serialVersionUID = -3743140893368022592L;
/**
* Default constructor
*/
public Combinationbox() public Combinationbox()
{ {
super(); super();

View File

@ -37,18 +37,21 @@ import org.zkoss.zul.ComboitemRenderer;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
/** /**
* Composite component with {@link Combobox} and {@link Button}
* @author Low Heng Sin * @author Low Heng Sin
*/ */
public class ComboEditorBox extends Div { public class ComboEditorBox extends Div {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 4187563277424346012L; private static final long serialVersionUID = 4187563277424346012L;
protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport( protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
this);
protected Combobox txt; protected Combobox txt;
protected Button btn; protected Button btn;
/**
* Default constructor
*/
public ComboEditorBox() { public ComboEditorBox() {
initComponents(); initComponents();
} }
@ -62,12 +65,15 @@ public class ComboEditorBox extends Div {
} }
/** /**
* @param imageSrc * @param imageSrc image url of button
*/ */
public void setButtonImage(String imageSrc) { public void setButtonImage(String imageSrc) {
btn.setImage(imageSrc); btn.setImage(imageSrc);
} }
/**
* Layout component
*/
private void initComponents() { private void initComponents() {
txt = new Combobox(); txt = new Combobox();
txt.setButtonVisible(false); txt.setButtonVisible(false);
@ -138,13 +144,14 @@ public class ComboEditorBox extends Div {
} }
/** /**
* @return boolean * @return true if enable, false otherwise
*/ */
public boolean isEnabled() { public boolean isEnabled() {
return btn.isEnabled(); return btn.isEnabled();
} }
/** /**
* If evtnm is ON_CLICK, add to {@link #btn}, otherwise add to {@link #txt}
* @param evtnm * @param evtnm
* @param listener * @param listener
*/ */
@ -157,7 +164,7 @@ public class ComboEditorBox extends Div {
} }
/** /**
* @param l * @param l PropertyChangeListener
*/ */
public synchronized void addPropertyChangeListener(PropertyChangeListener l) { public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
m_propertyChangeListeners.addPropertyChangeListener(l); m_propertyChangeListeners.addPropertyChangeListener(l);
@ -177,6 +184,10 @@ public class ComboEditorBox extends Div {
return btn; return btn;
} }
/**
* set grid view mode on/off
* @param flag
*/
public void setTableEditorMode(boolean flag) { public void setTableEditorMode(boolean flag) {
if (flag) { if (flag) {
ZKUpdateUtil.setHflex(this, "0"); ZKUpdateUtil.setHflex(this, "0");

View File

@ -17,8 +17,10 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
import org.zkoss.zul.Comboitem;
/** /**
* Bad stuff, cannot overide method equals in AbstractComponent. * Extend {@link Comboitem}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 10, 2007 * @date Mar 10, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -26,15 +28,22 @@ package org.adempiere.webui.component;
public class ComboItem extends org.zkoss.zul.Comboitem public class ComboItem extends org.zkoss.zul.Comboitem
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 8483161780731035079L; private static final long serialVersionUID = 8483161780731035079L;
/**
* @param label
*/
public ComboItem(String label) public ComboItem(String label)
{ {
super(label); super(label);
} }
/**
* @param label
* @param value
*/
public ComboItem(String label, Object value) public ComboItem(String label, Object value)
{ {
super(label); super(label);

View File

@ -30,26 +30,42 @@ import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Comboitem; import org.zkoss.zul.Comboitem;
/** /**
* * Extend {@link org.zkoss.zul.Combobox}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public class Combobox extends org.zkoss.zul.Combobox implements IdSpace public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
{ {
/**
* generated serial id
*/
private static final long serialVersionUID = -6278632602577424842L;
/**
* Default constructor
*/
public Combobox() { public Combobox() {
super(); super();
override(); override();
init(); init();
} }
/**
* @param value
* @throws WrongValueException
*/
public Combobox(String value) throws WrongValueException { public Combobox(String value) throws WrongValueException {
super(value); super(value);
override(); override();
init(); init();
} }
/**
* Setup initial state of component
*/
private void init() { private void init() {
//ctrl+down to open combobox dropdown
this.setCtrlKeys("^#down"); this.setCtrlKeys("^#down");
this.addEventListener(Events.ON_CTRL_KEY, e -> { this.addEventListener(Events.ON_CTRL_KEY, e -> {
if (this.isEnabled() && LayoutUtils.isReallyVisible(this)) { if (this.isEnabled() && LayoutUtils.isReallyVisible(this)) {
@ -60,6 +76,9 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
}); });
} }
/**
* override "shallIgnoreClick_"
*/
private void override() { private void override() {
// idempiere always want to show context ever on disable control // idempiere always want to show context ever on disable control
this.setWidgetOverride("shallIgnoreClick_", "function(evt) {" this.setWidgetOverride("shallIgnoreClick_", "function(evt) {"
@ -68,10 +87,8 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
} }
/** /**
* * @param enabled
*/ */
private static final long serialVersionUID = -6278632602577424842L;
public void setEnabled(boolean enabled) public void setEnabled(boolean enabled)
{ {
this.setDisabled(!enabled); this.setDisabled(!enabled);
@ -87,6 +104,11 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
} }
} }
/**
* Add new combo item
* @param label
* @return added Comboitem
*/
public Comboitem appendItem(String label) public Comboitem appendItem(String label)
{ {
ComboItem item = new ComboItem(label); ComboItem item = new ComboItem(label);
@ -97,6 +119,9 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
return item; return item;
} }
/**
* @return true if enable, false otherwise
*/
public boolean isEnabled() { public boolean isEnabled() {
return !isDisabled(); return !isDisabled();
} }
@ -111,6 +136,11 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
} }
} }
/**
* add new combo item
* @param name
* @param value
*/
public void appendItem(String name, Object value) { public void appendItem(String name, Object value) {
ComboItem item = new ComboItem(name, value); ComboItem item = new ComboItem(name, value);
String id = AdempiereIdGenerator.escapeId(name); String id = AdempiereIdGenerator.escapeId(name);
@ -120,10 +150,10 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
} }
/** /**
* Set selected item for the list box based on the value of list item * Set selected item for the combo box based on the value of combo item.<br/>
* set selected to none if no item found matching the value given or * Set selected to none if no item found matching the value given or
* value is null * value is null.
* @param value Value of ListItem to set as selected * @param value Value of ComboItem to set as selected
*/ */
public void setValue(Object value) public void setValue(Object value)
{ {
@ -157,9 +187,8 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
} }
/** /**
*
* @param value * @param value
* @return boolean * @return true if current selected combo item is with value equal to value parameter
*/ */
public boolean isSelected(Object value) public boolean isSelected(Object value)
{ {

View File

@ -33,8 +33,7 @@ import org.zkoss.zul.Div;
import org.zkoss.zul.Hlayout; import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Messagebox; import org.zkoss.zul.Messagebox;
/** /**
* Application Confirm Panel * Confirm Panel for window, form and dialog
* Web UI port of the rich client's ConfirmPanel by Jorg Janke
* @author Sendy Yagambrum * @author Sendy Yagambrum
* @date July 25, 2007 * @date July 25, 2007
**/ **/
@ -43,7 +42,7 @@ public final class ConfirmPanel extends Div
private static final String SMALL_SCREEN_BUTTON_CLASS = "btn-small small-img-btn"; private static final String SMALL_SCREEN_BUTTON_CLASS = "btn-small small-img-btn";
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -2054986459098954685L; private static final long serialVersionUID = -2054986459098954685L;
@ -79,6 +78,7 @@ public final class ConfirmPanel extends Div
private boolean m_withText = false; private boolean m_withText = false;
/** Name:Button */
private Map<String, Button> buttonMap = new HashMap<String, Button>(); private Map<String, Button> buttonMap = new HashMap<String, Button>();
private boolean m_withImage = true; private boolean m_withImage = true;
@ -116,6 +116,12 @@ public final class ConfirmPanel extends Div
return button; return button;
} }
/**
* @param name
* @param image
* @param tooltip
* @return Button
*/
public Button createButton(String name, String image, String tooltip) public Button createButton(String name, String image, String tooltip)
{ {
Button button = ButtonFactory.createButton(name, image, tooltip); Button button = ButtonFactory.createButton(name, image, tooltip);
@ -176,7 +182,7 @@ public final class ConfirmPanel extends Div
* @param withHistoryButton with history * @param withHistoryButton with history
* @param withZoomButton with zoom * @param withZoomButton with zoom
* @param withText * @param withText
* @param withImage Incude image for button. Note that image always included if withText is false * @param withImage Include image for button. Note that image always included if withText is false
*/ */
public ConfirmPanel(boolean withCancelButton, public ConfirmPanel(boolean withCancelButton,
boolean withRefreshButton, boolean withRefreshButton,
@ -230,25 +236,29 @@ public final class ConfirmPanel extends Div
/** /**
* Create confirm panel with Ok and Cancel button * Create confirm panel with Ok and Cancel button
* @param withCancel with cancel * @param withCancel true to include cancel button, false otherwise
* *
*/ */
public ConfirmPanel(boolean withCancel) public ConfirmPanel(boolean withCancel)
{ {
this(withCancel,false,false,false,false,false); this(withCancel,false,false,false,false,false);
} }
//
/** Right buttons area */
private Hlayout pnlBtnRight; private Hlayout pnlBtnRight;
/** Left buttons area */
private Hlayout pnlBtnLeft; private Hlayout pnlBtnLeft;
// IDEMPIERE-1334 center panel, contain all process button // IDEMPIERE-1334 center panel, contain all process button
private Hlayout pnlBtnCenter; private Hlayout pnlBtnCenter;
/** Extra sclass for button */
private String extraButtonSClass; private String extraButtonSClass;
/** true to use {@link #SMALL_SCREEN_BUTTON_CLASS} for compact screen */
private boolean useSmallButtonClassForSmallScreen; private boolean useSmallButtonClassForSmallScreen;
/** /**
* initialise components * Layout panel
*/ */
private void init() private void init()
{ {
@ -257,13 +267,10 @@ public final class ConfirmPanel extends Div
pnlBtnRight = new Hlayout(); pnlBtnRight = new Hlayout();
pnlBtnRight.setSclass("confirm-panel-right"); pnlBtnRight.setSclass("confirm-panel-right");
// IDEMPIERE-1334 start
pnlBtnCenter = new Hlayout(); pnlBtnCenter = new Hlayout();
pnlBtnCenter.setSclass("confirm-panel-center"); pnlBtnCenter.setSclass("confirm-panel-center");
// IDEMPIERE-1334 end
this.appendChild(pnlBtnLeft); this.appendChild(pnlBtnLeft);
// IDEMPIERE-1334
this.appendChild(pnlBtnCenter); this.appendChild(pnlBtnCenter);
this.appendChild(pnlBtnRight); this.appendChild(pnlBtnRight);
this.setSclass("confirm-panel"); this.setSclass("confirm-panel");
@ -272,38 +279,43 @@ public final class ConfirmPanel extends Div
} }
/** /**
* IDEMPIERE-1334 * add button to center area of panel
* add a process button into center panel
* @param btName * @param btName
* @param imgName * @param imgName
* @return * @return
*/ */
public Button addButton (String btName, String imgName){ public Button addButton (String btName, String imgName){
Button btProcess = createButton(btName); Button button = createButton(btName);
// replace default image with image set at info process // replace default image with image set at info process
if (m_withImage && imgName != null && imgName.trim().length() > 0) if (m_withImage && imgName != null && imgName.trim().length() > 0)
{ {
if (ThemeManager.isUseFontIconForImage()) if (ThemeManager.isUseFontIconForImage())
btProcess.setIconSclass(ThemeManager.getIconSclass(imgName)); button.setIconSclass(ThemeManager.getIconSclass(imgName));
else else
btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName)); button.setImage(ThemeManager.getThemeResource("images/" + imgName));
} }
addComponentsCenter(btProcess); addComponentsCenter(button);
return btProcess; return button;
} }
/**
* add process button to center area of panel
* @param btName
* @param imgName
* @return Button
*/
public Button addProcessButton (String btName, String imgName){ public Button addProcessButton (String btName, String imgName){
Button btProcess = createButton(btName, imgName, null); Button btProcess = createButton(btName, imgName, null);
// replace default image with image set at info process // replace default image with image set at info process
if (m_withImage && imgName != null && imgName.trim().length() > 0) if (m_withImage && imgName != null && imgName.trim().length() > 0)
{ {
if (ThemeManager.isUseFontIconForImage()) if (ThemeManager.isUseFontIconForImage())
btProcess.setIconSclass(ThemeManager.getIconSclass(imgName)); btProcess.setIconSclass(ThemeManager.getIconSclass(imgName));
else else
btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName)); btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName));
} }
addComponentsCenter(btProcess); addComponentsCenter(btProcess);
return btProcess; return btProcess;
} }
/** /**
@ -333,7 +345,7 @@ public final class ConfirmPanel extends Div
} }
/** /**
* add button to the front of right side of the confirm panel * add button to the front of right area of the confirm panel
* @param button button * @param button button
*/ */
public void addComponentsBeforeRight(Button button) public void addComponentsBeforeRight(Button button)
@ -346,8 +358,7 @@ public final class ConfirmPanel extends Div
} }
/** /**
* IDEMPIERE-1334 * add button to the center area of the confirm panel
* add button to the center side of the confirm panel
* @param button button * @param button button
*/ */
public void addComponentsCenter(Button button) public void addComponentsCenter(Button button)
@ -360,7 +371,7 @@ public final class ConfirmPanel extends Div
} }
/** /**
* Add combobox to center panel * Add combobox to center area of panel
* @param cbb * @param cbb
*/ */
public void addComponentsCenter(Combobox cbb){ public void addComponentsCenter(Combobox cbb){
@ -368,7 +379,7 @@ public final class ConfirmPanel extends Div
} }
/** /**
* Add checkbox to center panel * Add checkbox to center area of panel
* @param cb * @param cb
*/ */
public void addComponentsCenter(Checkbox cb){ public void addComponentsCenter(Checkbox cb){
@ -429,6 +440,7 @@ public final class ConfirmPanel extends Div
btn.setVisible(visible); btn.setVisible(visible);
} }
} }
/** /**
* returns whether the specified button is visible or not * returns whether the specified button is visible or not
* @param btnName * @param btnName
@ -469,6 +481,7 @@ public final class ConfirmPanel extends Div
return false; return false;
} }
} }
/** /**
* enable specific button * enable specific button
* @param id button id * @param id button id
@ -500,8 +513,8 @@ public final class ConfirmPanel extends Div
} }
/** /**
* enable all components * enable/disable all buttons
* @param enabled enabled * @param enabled true to enable, false otherwise
*/ */
public void setEnabledAll(boolean enabled) public void setEnabledAll(boolean enabled)
{ {
@ -524,18 +537,16 @@ public final class ConfirmPanel extends Div
Button button = (Button)iter2.next(); Button button = (Button)iter2.next();
button.setEnabled(enabled); button.setEnabled(enabled);
} }
// IDEMPIERE-1334 start
while (iter3.hasNext()) while (iter3.hasNext())
{ {
Button button = (Button)iter3.next(); Button button = (Button)iter3.next();
button.setEnabled(enabled); button.setEnabled(enabled);
} }
// IDEMPIERE-1334 end
} }
/** /**
* add action listener on the existing buttons * add event listener on existing buttons
* @param event event * @param event event name
* @param listener listener * @param listener EventListener
*/ */
public void addActionListener(String event, EventListener<?> listener) public void addActionListener(String event, EventListener<?> listener)
{ {
@ -558,7 +569,6 @@ public final class ConfirmPanel extends Div
Button button = (Button)iter2.next(); Button button = (Button)iter2.next();
button.addEventListener(event, listener); button.addEventListener(event, listener);
} }
// IDEMPIERE-1334 start
while (iter3.hasNext()) while (iter3.hasNext())
{ {
Object element = iter3.next(); Object element = iter3.next();
@ -567,12 +577,11 @@ public final class ConfirmPanel extends Div
((Button)element).addEventListener(event, listener); ((Button)element).addEventListener(event, listener);
} }
} }
// IDEMPIERE-1334 start
} }
/** /**
* added to ease porting of swing form * add ON_CLICK listener for all buttons
* @param listener * @param listener EventListener
*/ */
public void addActionListener(EventListener<?> listener) { public void addActionListener(EventListener<?> listener) {
addActionListener(Events.ON_CLICK, listener); addActionListener(Events.ON_CLICK, listener);
@ -594,6 +603,11 @@ public final class ConfirmPanel extends Div
return getButton(A_OK); return getButton(A_OK);
} }
/**
* Add cls to sclass property of all buttons.
* Keep as {@link #extraButtonSClass} for new button created.
* @param cls
*/
public void addButtonSclass(String cls) { public void addButtonSclass(String cls) {
for(Button btn : buttonMap.values()) { for(Button btn : buttonMap.values()) {
LayoutUtils.addSclass(cls, btn); LayoutUtils.addSclass(cls, btn);
@ -601,18 +615,27 @@ public final class ConfirmPanel extends Div
extraButtonSClass = cls; extraButtonSClass = cls;
} }
/**
* Remove cls from sclass property of all buttons
* @param cls
*/
public void removeButtonSclass(String cls) { public void removeButtonSclass(String cls) {
for(Button btn : buttonMap.values()) { for(Button btn : buttonMap.values()) {
LayoutUtils.removeSclass(cls, btn); LayoutUtils.removeSclass(cls, btn);
} }
} }
/**
* Enable the use of {@link #SMALL_SCREEN_BUTTON_CLASS} for all buttons.
*/
public void useSmallButtonClassForSmallScreen() { public void useSmallButtonClassForSmallScreen() {
useSmallButtonClassForSmallScreen = true; useSmallButtonClassForSmallScreen = true;
addButtonSclass(SMALL_SCREEN_BUTTON_CLASS); addButtonSclass(SMALL_SCREEN_BUTTON_CLASS);
} }
/** Returns the map containing all buttons attached to the ConfirmPanel */ /**
* @return map containing all buttons attached to ConfirmPanel
*/
public Map<String, Button> getMap() { public Map<String, Button> getMap() {
return buttonMap; return buttonMap;
} }

View File

@ -22,7 +22,7 @@ import org.compiere.util.DisplayType;
import org.compiere.util.Env; import org.compiere.util.Env;
/** /**
* * Extend {@link org.zkoss.zul.Datebox}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -30,15 +30,22 @@ import org.compiere.util.Env;
public class Datebox extends org.zkoss.zul.Datebox public class Datebox extends org.zkoss.zul.Datebox
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -5890574778856946570L; private static final long serialVersionUID = -5890574778856946570L;
/**
* Default constructor.
* Set format to pattern from {@link DisplayType#getDateFormat(org.compiere.util.Language)}.
*/
public Datebox() { public Datebox() {
super(); super();
setFormat(DisplayType.getDateFormat(AEnv.getLanguage(Env.getCtx())).toPattern()); setFormat(DisplayType.getDateFormat(AEnv.getLanguage(Env.getCtx())).toPattern());
} }
/**
* @param enabled
*/
public void setEnabled(boolean enabled) public void setEnabled(boolean enabled)
{ {
this.setReadonly(!enabled); this.setReadonly(!enabled);
@ -46,6 +53,9 @@ public class Datebox extends org.zkoss.zul.Datebox
this.setButtonVisible(enabled); this.setButtonVisible(enabled);
} }
/**
* @return true if enable, false otherwise
*/
public boolean isEnabled() public boolean isEnabled()
{ {
return !isReadonly(); return !isReadonly();

View File

@ -22,20 +22,23 @@ import java.util.TimeZone;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
/** /**
* * Composite component with {@link Datebox} and {@link Timebox}
* @author Low Heng Sin * @author Low Heng Sin
* *
*/ */
public class DatetimeBox extends Panel { public class DatetimeBox extends Panel {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -1075410511739601354L; private static final long serialVersionUID = -1075410511739601354L;
private Datebox dateBox; private Datebox dateBox;
private Timebox timeBox; private Timebox timeBox;
private TimeZone timeZone; private TimeZone timeZone;
/**
* Default constructor
*/
public DatetimeBox() { public DatetimeBox() {
dateBox = new Datebox(); dateBox = new Datebox();
dateBox.setCols(10); dateBox.setCols(10);
@ -47,6 +50,9 @@ public class DatetimeBox extends Panel {
initComponents(); initComponents();
} }
/**
* Set initial state of component
*/
private void initComponents() { private void initComponents() {
this.setSclass("datetime-box"); this.setSclass("datetime-box");
} }
@ -60,7 +66,7 @@ public class DatetimeBox extends Panel {
} }
/** /**
* @param text * @param text input datetime text. assume date and time part is separated by white space character.
*/ */
public void setText(String text) { public void setText(String text) {
if (text != null && text.trim().length() > 0) if (text != null && text.trim().length() > 0)
@ -78,25 +84,33 @@ public class DatetimeBox extends Panel {
} }
/** /**
* @return String * @return text from {@link #dateBox} and {@link #timeBox}, separated by single white space character
*/ */
public String getText() { public String getText() {
return dateBox.getText() + " " + timeBox.getText(); return dateBox.getText() + " " + timeBox.getText();
} }
/**
* add event listener to {@link #dateBox} and {@link #timeBox}
* @param evtnm
* @param listener
* @return true if added
*/
@Override @Override
public boolean addEventListener(String evtnm, EventListener<?> listener) { public boolean addEventListener(String evtnm, EventListener<?> listener) {
return dateBox.addEventListener(evtnm, listener) && timeBox.addEventListener(evtnm, listener); return dateBox.addEventListener(evtnm, listener) && timeBox.addEventListener(evtnm, listener);
} }
/** /**
* @return boolean * @return true if enable, false otherwise
*/ */
public boolean isEnabled() { public boolean isEnabled() {
return !dateBox.isReadonly(); return !dateBox.isReadonly();
} }
/** /**
* Enable/disable {@link #dateBox} and {@link #timeBox}.<br/>
* Hide button of {@link #dateBox} and {@link #timeBox} if disable/readonly.
* @param readWrite * @param readWrite
*/ */
public void setEnabled(boolean readWrite) { public void setEnabled(boolean readWrite) {
@ -107,7 +121,7 @@ public class DatetimeBox extends Panel {
} }
/** /**
* @return date * @return Date (include date and time)
*/ */
public Date getValue() { public Date getValue() {
Date d = null; Date d = null;
@ -150,7 +164,7 @@ public class DatetimeBox extends Panel {
} }
/** /**
* * Set format of {@link #dateBox}
* @param dateFormat * @param dateFormat
*/ */
public void setDateFormat(SimpleDateFormat dateFormat) { public void setDateFormat(SimpleDateFormat dateFormat) {
@ -174,8 +188,8 @@ public class DatetimeBox extends Panel {
} }
/** /**
* * Set time zone of {@link #dateBox} and {@link #timeBox}
* @param tz * @param tz TimeZone
*/ */
public void setTimeZone(TimeZone tz) { public void setTimeZone(TimeZone tz) {
this.timeZone = tz; this.timeZone = tz;
@ -188,8 +202,7 @@ public class DatetimeBox extends Panel {
} }
/** /**
* * @param localTime LocalDateTime
* @param localTime
*/ */
public void setValueInLocalDateTime(LocalDateTime localTime) { public void setValueInLocalDateTime(LocalDateTime localTime) {
dateBox.setValueInLocalDateTime(localTime); dateBox.setValueInLocalDateTime(localTime);
@ -197,8 +210,7 @@ public class DatetimeBox extends Panel {
} }
/** /**
* * @param zdt ZonedDateTime
* @param zdt
*/ */
public void setValueInZonedDateTime(ZonedDateTime zdt) { public void setValueInZonedDateTime(ZonedDateTime zdt) {
dateBox.setValueInZonedDateTime(zdt); dateBox.setValueInZonedDateTime(zdt);

View File

@ -12,17 +12,18 @@
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.component; package org.adempiere.webui.component;
import org.adempiere.webui.desktop.DefaultDesktop;
import org.zkoss.zk.ui.IdSpace; import org.zkoss.zk.ui.IdSpace;
/** /**
* Tabpanel use by desktop to host AD Window, implements IdSpace to avoid Id conflict * Tabpanel use by {@link DefaultDesktop} to display each open window (AD Window, form, process dialog, etc) as tab. Implements IdSpace to avoid Id conflict.
* @author Low Heng Sin * @author Low Heng Sin
* *
*/ */
public class DesktopTabpanel extends Tabpanel implements IdSpace { public class DesktopTabpanel extends Tabpanel implements IdSpace {
/** /**
* generated serail version id * generated serial id
*/ */
private static final long serialVersionUID = -7142048018260264752L; private static final long serialVersionUID = -7142048018260264752L;

View File

@ -36,7 +36,7 @@ import org.zkoss.zul.A;
*/ */
public class DocumentLink extends A implements EventListener<Event> { public class DocumentLink extends A implements EventListener<Event> {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 1498406053715803814L; private static final long serialVersionUID = 1498406053715803814L;
@ -45,28 +45,54 @@ public class DocumentLink extends A implements EventListener<Event> {
protected int recordId; protected int recordId;
/**
* @return Record_ID
*/
public int getRecordId() { public int getRecordId() {
return recordId; return recordId;
} }
/**
* set Record_ID
* @param recordId
*/
public void setRecordId(int recordId) { public void setRecordId(int recordId) {
this.recordId = recordId; this.recordId = recordId;
} }
protected int adTableId; protected int adTableId;
/**
* @return AD_Table_ID
*/
public int getAdTableId() { public int getAdTableId() {
return adTableId; return adTableId;
} }
/**
* set AD_Table_ID
* @param adTableId
*/
public void setAdTableId(int adTableId) { public void setAdTableId(int adTableId) {
this.adTableId = adTableId; this.adTableId = adTableId;
} }
/**
* @param label
* @param adTableId AD_Table_ID
* @param recordId Record_ID
*/
public DocumentLink(String label, int adTableId, int recordId){ public DocumentLink(String label, int adTableId, int recordId){
this(label, adTableId, recordId, null); this(label, adTableId, recordId, null);
} }
/**
* @param label
* @param adTableId AD_Table_ID
* @param recordId Record_ID
* @param clickHandle Optional listener for ON_CLICK event. If null, the component
* will handle ON_CLICK event and zoom to AD Window by table and record id.
*/
public DocumentLink(String label, int adTableId, int recordId, EventListener<Event> clickHandle){ public DocumentLink(String label, int adTableId, int recordId, EventListener<Event> clickHandle){
super(); super();
if (label == null || label.trim().length() == 0) if (label == null || label.trim().length() == 0)

View File

@ -23,19 +23,24 @@ import org.zkoss.zk.au.AuRequest;
import org.zkoss.zk.au.AuService; import org.zkoss.zk.au.AuService;
import org.zkoss.zk.mesg.MZk; import org.zkoss.zk.mesg.MZk;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.UiException; import org.zkoss.zk.ui.UiException;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
/** /**
* * {@link Desktop} listener for onDrillAcross and onDrillDown {@link AuRequest}.<br/>
* Create {@link DrillEvent} from {@link AuRequest} and post to the component that send the {@link AuRequest}.
* @author hengsin * @author hengsin
*
*/ */
public class DrillCommand implements AuService { public class DrillCommand implements AuService {
/**
* Default constructor
*/
public DrillCommand() { public DrillCommand() {
} }
@Override
public boolean service(AuRequest request, boolean everError) { public boolean service(AuRequest request, boolean everError) {
if (!DrillEvent.ON_DRILL_ACROSS.equals(request.getCommand()) if (!DrillEvent.ON_DRILL_ACROSS.equals(request.getCommand())
&& !DrillEvent.ON_DRILL_DOWN.equals(request.getCommand())) && !DrillEvent.ON_DRILL_DOWN.equals(request.getCommand()))

View File

@ -22,8 +22,8 @@ import org.zkoss.zul.A;
import org.zkoss.zul.Filedownload; import org.zkoss.zul.Filedownload;
/** /**
* Link to download media
* @author hengsin * @author hengsin
*
*/ */
public class DynamicMediaLink extends A { public class DynamicMediaLink extends A {
@ -33,7 +33,10 @@ public class DynamicMediaLink extends A {
private static final long serialVersionUID = 5017833977652241179L; private static final long serialVersionUID = 5017833977652241179L;
private AMedia media; private AMedia media;
/**
* Default constructor
*/
public DynamicMediaLink() { public DynamicMediaLink() {
super(); super();
this.addEventListener(Events.ON_CLICK, new EventListener<Event>() { this.addEventListener(Events.ON_CLICK, new EventListener<Event>() {
@ -45,14 +48,25 @@ public class DynamicMediaLink extends A {
}); });
} }
/**
* @param label
* @param image
*/
public DynamicMediaLink(String label, String image) { public DynamicMediaLink(String label, String image) {
super(label, image); super(label, image);
} }
/**
* @param label
*/
public DynamicMediaLink(String label) { public DynamicMediaLink(String label) {
super(label); super(label);
} }
/**
* Set media for download
* @param media
*/
public void setMedia(AMedia media) { public void setMedia(AMedia media) {
this.media = media; this.media = media;
} }

View File

@ -22,18 +22,21 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
/** /**
* Composite component with {@link Textbox} and {@link Button}
* @author Low Heng Sin * @author Low Heng Sin
*/ */
public class EditorBox extends Div { public class EditorBox extends Div {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -3152111756471436612L; private static final long serialVersionUID = -3152111756471436612L;
protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport( protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
this);
protected Textbox txt; protected Textbox txt;
protected Button btn; protected Button btn;
/**
* Default constructor
*/
public EditorBox() { public EditorBox() {
initComponents(); initComponents();
} }
@ -53,6 +56,9 @@ public class EditorBox extends Div {
btn.setImage(imageSrc); btn.setImage(imageSrc);
} }
/**
* Layout component
*/
private void initComponents() { private void initComponents() {
txt = new Textbox(); txt = new Textbox();
txt.setSclass("editor-input"); txt.setSclass("editor-input");
@ -69,13 +75,14 @@ public class EditorBox extends Div {
} }
/** /**
* @return textbox component * @return Textbox component
*/ */
public Textbox getTextbox() { public Textbox getTextbox() {
return txt; return txt;
} }
/** /**
* Set value to text box
* @param value * @param value
*/ */
public void setText(String value) { public void setText(String value) {
@ -83,13 +90,15 @@ public class EditorBox extends Div {
} }
/** /**
* @return text * @return text from text box
*/ */
public String getText() { public String getText() {
return txt.getText(); return txt.getText();
} }
/** /**
* Enable/disable component.
* Hide button when component is diable/readonly.
* @param enabled * @param enabled
*/ */
public void setEnabled(boolean enabled) { public void setEnabled(boolean enabled) {
@ -111,15 +120,16 @@ public class EditorBox extends Div {
} }
/** /**
* @return boolean * @return true if enable, false otherwise
*/ */
public boolean isEnabled() { public boolean isEnabled() {
return btn.isEnabled(); return btn.isEnabled();
} }
/** /**
* @param evtnm * If evtnm is ON_CLICK, add listener to {@link #btn}, else add listener to {@link #txt}
* @param listener * @param evtnm Event name
* @param listener EventListener
*/ */
public boolean addEventListener(String evtnm, EventListener<?> listener) { public boolean addEventListener(String evtnm, EventListener<?> listener) {
if (Events.ON_CLICK.equals(evtnm)) { if (Events.ON_CLICK.equals(evtnm)) {
@ -130,7 +140,7 @@ public class EditorBox extends Div {
} }
/** /**
* @param l * @param l PropertyChangeListener
*/ */
public synchronized void addPropertyChangeListener(PropertyChangeListener l) { public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
m_propertyChangeListeners.addPropertyChangeListener(l); m_propertyChangeListeners.addPropertyChangeListener(l);
@ -150,6 +160,10 @@ public class EditorBox extends Div {
return btn; return btn;
} }
/**
* Set grid view mode.
* @param flag
*/
public void setTableEditorMode(boolean flag) { public void setTableEditorMode(boolean flag) {
if (flag) { if (flag) {
ZKUpdateUtil.setHflex(this, "0"); ZKUpdateUtil.setHflex(this, "0");

View File

@ -20,18 +20,23 @@ package org.adempiere.webui.component;
import org.zkoss.zul.Toolbar; import org.zkoss.zul.Toolbar;
/** /**
* * Extend {@link Toolbar}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
* @deprecated Replace by {@link ToolBar}
*/ */
@Deprecated
public class FToolbar extends Toolbar public class FToolbar extends Toolbar
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 7108523012451551639L; private static final long serialVersionUID = 7108523012451551639L;
/**
* @return id of component
*/
public String getName() public String getName()
{ {
return getId(); return getId();

View File

@ -19,18 +19,23 @@ package org.adempiere.webui.component;
/** /**
* * Extend {@link org.zkoss.zul.Window}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
* @deprecated Just use {@link Window} instead
*/ */
@Deprecated
public class FWindow extends Window public class FWindow extends Window
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 7047997664627639977L; private static final long serialVersionUID = 7047997664627639977L;
/**
* Default constructor
*/
public FWindow() public FWindow()
{ {
super(); super();

View File

@ -59,9 +59,8 @@ import org.zkoss.zul.event.TreeDataEvent;
*/ */
public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventListener<Event>, TreeitemRenderer<Object> public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventListener<Event>, TreeitemRenderer<Object>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 6950349031548896628L; private static final long serialVersionUID = 6950349031548896628L;
private static final CLogger LOG = CLogger.getCLogger(FavoriteSimpleTreeModel.class); private static final CLogger LOG = CLogger.getCLogger(FavoriteSimpleTreeModel.class);
@ -72,7 +71,9 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
private boolean itemDraggable; private boolean itemDraggable;
// /**
* @param root
*/
public FavoriteSimpleTreeModel(DefaultTreeNode<Object> root) public FavoriteSimpleTreeModel(DefaultTreeNode<Object> root)
{ {
super(root); super(root);
@ -122,7 +123,7 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
/** /**
* Creating Tree hierarchy * Creating Tree hierarchy
* *
* @param root * @param root MTreeNode
* @return {@link FavoriteSimpleTreeModel} * @return {@link FavoriteSimpleTreeModel}
*/ */
public static FavoriteSimpleTreeModel createFrom(MTreeNode root) public static FavoriteSimpleTreeModel createFrom(MTreeNode root)
@ -136,8 +137,8 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
/** /**
* Populate Node * Populate Node
* *
* @param stNode * @param stNode Root DefaultTreeNode
* @param root * @param root Root MTreeNode
*/ */
private static void populate(DefaultTreeNode<Object> stNode, MTreeNode root) private static void populate(DefaultTreeNode<Object> stNode, MTreeNode root)
{ {
@ -299,6 +300,10 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
} }
} // onEvent } // onEvent
/**
* Add new node to tree
* @param newNode
*/
public void addNode(DefaultTreeNode<Object> newNode) public void addNode(DefaultTreeNode<Object> newNode)
{ {
DefaultTreeNode<Object> root = (DefaultTreeNode<Object>) getRoot(); DefaultTreeNode<Object> root = (DefaultTreeNode<Object>) getRoot();
@ -307,11 +312,21 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
fireEvent(TreeDataEvent.INTERVAL_ADDED, getPath(root), root.getChildCount() - 1, root.getChildCount() - 1); fireEvent(TreeDataEvent.INTERVAL_ADDED, getPath(root), root.getChildCount() - 1, root.getChildCount() - 1);
} // addNode } // addNode
/**
* Get child node
* @param parent Parent node
* @param index Index of child node
* @return DefaultTreeNode
*/
public DefaultTreeNode<Object> getChild(DefaultTreeNode<Object> parent, int index) public DefaultTreeNode<Object> getChild(DefaultTreeNode<Object> parent, int index)
{ {
return (DefaultTreeNode<Object>) (parent).getChildAt(index); return (DefaultTreeNode<Object>) (parent).getChildAt(index);
} // getChild } // getChild
/**
* Open window to create new record
* @param menuID
*/
private void onNewRecord(int menuID) private void onNewRecord(int menuID)
{ {
try try
@ -344,21 +359,35 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
} }
} // onNewRecord } // onNewRecord
/**
* @param listener
*/
public void addOnDropEventListener(EventListener<Event> listener) public void addOnDropEventListener(EventListener<Event> listener)
{ {
onDropListners.add(listener); onDropListners.add(listener);
} }
/**
* @param isDraggable
*/
public void setItemDraggable(boolean isDraggable) public void setItemDraggable(boolean isDraggable)
{ {
itemDraggable = isDraggable; itemDraggable = isDraggable;
} }
/**
* @return true if item is draggable, false otherwise
*/
public boolean isItemDraggable() public boolean isItemDraggable()
{ {
return itemDraggable; return itemDraggable;
} }
/**
* Get icon image url for tree node (folder, window, report, etc)
* @param mt MTreeNode
* @return icon image url
*/
private static String getIconFile(MTreeNode mt) private static String getIconFile(MTreeNode mt)
{ {
if (mt.isSummary()) if (mt.isSummary())
@ -378,6 +407,11 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
return "images/mWindow.png"; return "images/mWindow.png";
} }
/**
* Get font icon sclass for tree node (summary, window, report, etc)
* @param mt
* @return font icon sclass
*/
private static String getIconSclass(MTreeNode mt) private static String getIconSclass(MTreeNode mt)
{ {
if (mt.isSummary()) if (mt.isSummary())

View File

@ -17,17 +17,20 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
/** /**
* * Composite component of textbox and file upload button.
* @author Low Heng Sin * @author Low Heng Sin
* *
*/ */
public class FilenameBox extends EditorBox public class FilenameBox extends EditorBox
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -3438731624652907300L; private static final long serialVersionUID = -3438731624652907300L;
/**
* Default constructor
*/
public FilenameBox() public FilenameBox()
{ {
super(); super();
@ -44,8 +47,9 @@ public class FilenameBox extends EditorBox
btn.setUpload(AdempiereWebUI.getUploadSetting()); btn.setUpload(AdempiereWebUI.getUploadSetting());
} }
/* (non-Javadoc) /**
* @see org.adempiere.webui.component.EditorBox#addEventListener(java.lang.String, org.zkoss.zk.ui.event.EventListener) * If evtnm is ON_UPLOAD, add listener to button.<br/>
* {@inheritDoc}
*/ */
@Override @Override
public boolean addEventListener(String evtnm, EventListener<?> listener) { public boolean addEventListener(String evtnm, EventListener<?> listener) {

View File

@ -41,11 +41,12 @@ import org.zkoss.zul.South;
public class FolderBrowser extends Window implements EventListener<Event> public class FolderBrowser extends Window implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 5477614056976038703L; private static final long serialVersionUID = 5477614056976038703L;
private Textbox txtPath = new Textbox(); private Textbox txtPath = new Textbox();
/** Listbox of folders and files */
private Listbox listDir = new Listbox(); private Listbox listDir = new Listbox();
private ConfirmPanel confirmPanel = new ConfirmPanel(true); private ConfirmPanel confirmPanel = new ConfirmPanel(true);
@ -53,13 +54,15 @@ public class FolderBrowser extends Window implements EventListener<Event>
private String path; private String path;
private File root; private File root;
/**
* Default constructor
*/
public FolderBrowser() public FolderBrowser()
{ {
this(null, false); this(null, false);
} }
/** /**
*
* @param browseForFolder * @param browseForFolder
*/ */
public FolderBrowser(boolean browseForFolder) public FolderBrowser(boolean browseForFolder)
@ -68,9 +71,8 @@ public class FolderBrowser extends Window implements EventListener<Event>
} }
/** /**
* * @param rootPath Optional root folder. If null, take ZK_ROOT_FOLDER_BROWSER from AD_SysConfig or iDempiere home as root folder.
* @param rootPath * @param browseForFolder true for folder browser, false for file.
* @param browseForFolder
*/ */
public FolderBrowser(String rootPath, boolean browseForFolder) public FolderBrowser(String rootPath, boolean browseForFolder)
{ {
@ -117,6 +119,10 @@ public class FolderBrowser extends Window implements EventListener<Event>
AEnv.showWindow(this); AEnv.showWindow(this);
} }
/**
* Get files and folders under dirPath
* @param dirPath Directory path
*/
private void getFileListing(String dirPath) private void getFileListing(String dirPath)
{ {
File dir = new File(dirPath); File dir = new File(dirPath);
@ -169,6 +175,7 @@ public class FolderBrowser extends Window implements EventListener<Event>
txtPath.setValue(dir.getAbsolutePath()); txtPath.setValue(dir.getAbsolutePath());
} }
@Override
public void onEvent(Event e) throws Exception public void onEvent(Event e) throws Exception
{ {
if(e.getName().equals(Events.ON_DOUBLE_CLICK) && e.getTarget() instanceof ListItem) if(e.getName().equals(Events.ON_DOUBLE_CLICK) && e.getTarget() instanceof ListItem)
@ -224,6 +231,9 @@ public class FolderBrowser extends Window implements EventListener<Event>
} }
} }
/**
* @return selected path
*/
public String getPath() public String getPath()
{ {
return path; return path;

View File

@ -28,25 +28,39 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
/** /**
* * Extend {@link org.zkoss.zul.Grid}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public class Grid extends org.zkoss.zul.Grid implements IdSpace public class Grid extends org.zkoss.zul.Grid implements IdSpace
{ {
/**
* Generated serial id
*/
private static final long serialVersionUID = -4483759833677794926L; private static final long serialVersionUID = -4483759833677794926L;
/** Event Name:List&lt;EventListenerInfo&gt; */
private transient Map<String, List<EventListenerInfo>> listeners; private transient Map<String, List<EventListenerInfo>> listeners;
/**
* Default constructor
*/
public Grid() { public Grid() {
super(); super();
listeners = new HashMap<String, List<EventListenerInfo>>(); listeners = new HashMap<String, List<EventListenerInfo>>();
} }
/**
* Remove the alternate background color rendering of grid rows.
*/
public void makeNoStrip() { public void makeNoStrip() {
setOddRowSclass("z-dummy"); setOddRowSclass("z-dummy");
} }
/**
* Add and return new Rows instance
* @return Rows
*/
public Rows newRows() { public Rows newRows() {
Rows rows = new Rows(); Rows rows = new Rows();
appendChild(rows); appendChild(rows);
@ -101,6 +115,11 @@ public class Grid extends org.zkoss.zul.Grid implements IdSpace
return b; return b;
} }
/**
* Copy event listeners from another grid.
* Use in the re-initialization grid view.
* @param grid
*/
public void copyEventListeners(Grid grid) { public void copyEventListeners(Grid grid) {
for(String evtnm : listeners.keySet()) { for(String evtnm : listeners.keySet()) {
if (evtnm.equals("onInitModel")) if (evtnm.equals("onInitModel"))
@ -112,6 +131,9 @@ public class Grid extends org.zkoss.zul.Grid implements IdSpace
} }
} }
/**
* Class to hold event listener details
*/
private static class EventListenerInfo { private static class EventListenerInfo {
private final int priority; private final int priority;
private final EventListener<? extends Event> listener; private final EventListener<? extends Event> listener;

View File

@ -1,3 +1,29 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - etan *
* - carlos *
* - hengsin *
**********************************************************************/
package org.adempiere.webui.component; package org.adempiere.webui.component;
import java.util.ArrayList; import java.util.ArrayList;
@ -14,31 +40,49 @@ import org.zkoss.zul.Label;
import org.zkoss.zul.Row; import org.zkoss.zul.Row;
import org.zkoss.zul.Span; import org.zkoss.zul.Span;
/**
* Extend {@link org.zkoss.zul.Group}
*/
public class Group extends org.zkoss.zul.Group { public class Group extends org.zkoss.zul.Group {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -6735090880559291438L; private static final long serialVersionUID = -6735090880559291438L;
/** {@link Row} attribute to hold visibility state of row */
public static final String GROUP_ROW_VISIBLE_KEY = "groupRowVisible"; public static final String GROUP_ROW_VISIBLE_KEY = "groupRowVisible";
private List<org.adempiere.webui.component.Row> m_rows = new ArrayList<org.adempiere.webui.component.Row>(); private List<org.adempiere.webui.component.Row> m_rows = new ArrayList<org.adempiere.webui.component.Row>();
/**
* Default constructor
*/
public Group() { public Group() {
super(); super();
setZclass("z-group"); setZclass("z-group");
} }
/**
* @param label
*/
public Group(String label) { public Group(String label) {
super(label); super(label);
setZclass("z-group"); setZclass("z-group");
} }
/**
* @param <T>
* @param label
* @param value
*/
public <T> Group(String label, T value) { public <T> Group(String label, T value) {
super(label, value); super(label, value);
setZclass("z-group"); setZclass("z-group");
} }
/**
* @return group label
*/
public String getLabel() { public String getLabel() {
final Component cell = getFirstChild(); final Component cell = getFirstChild();
return cell != null && cell instanceof GroupHeader ? ((GroupHeader)cell).getTitle() : null; return cell != null && cell instanceof GroupHeader ? ((GroupHeader)cell).getTitle() : null;
@ -49,6 +93,9 @@ public class Group extends org.zkoss.zul.Group {
autoFirstCell().setTitle(label); autoFirstCell().setTitle(label);
} }
/**
* @return GroupHeader
*/
private GroupHeader autoFirstCell() { private GroupHeader autoFirstCell() {
Component cell = getFirstChild(); Component cell = getFirstChild();
if (cell == null || cell instanceof GroupHeader) { if (cell == null || cell instanceof GroupHeader) {
@ -60,6 +107,10 @@ public class Group extends org.zkoss.zul.Group {
throw new UiException("Unsupported child for setLabel: "+cell); throw new UiException("Unsupported child for setLabel: "+cell);
} }
/**
* Set open/close state of group
* @param open true for open state, false for close state
*/
public void setOpen(boolean open) { public void setOpen(boolean open) {
super.setOpen(open); super.setOpen(open);
autoFirstCell().setOpen(isOpen()); autoFirstCell().setOpen(isOpen());
@ -77,14 +128,21 @@ public class Group extends org.zkoss.zul.Group {
} }
} }
/**
* Add row to group
* @param row
*/
public void add(org.adempiere.webui.component.Row row) { public void add(org.adempiere.webui.component.Row row) {
m_rows.add(row); m_rows.add(row);
} }
/**
* Group header component
*/
public static class GroupHeader extends Cell implements EventListener<Event> public static class GroupHeader extends Cell implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -4070011056533999557L; private static final long serialVersionUID = -4070011056533999557L;
private Span span; private Span span;
@ -93,6 +151,9 @@ public class Group extends org.zkoss.zul.Group {
private String title; private String title;
private boolean open; private boolean open;
/**
* Default constructor
*/
public GroupHeader() public GroupHeader()
{ {
super(); super();
@ -101,6 +162,9 @@ public class Group extends org.zkoss.zul.Group {
setOpen(true); setOpen(true);
} }
/**
* Layout component
*/
private void init() private void init()
{ {
setZclass("z-group-header"); setZclass("z-group-header");
@ -120,19 +184,33 @@ public class Group extends org.zkoss.zul.Group {
div.appendChild(lbl); div.appendChild(lbl);
} }
/**
* @return group title
*/
public String getTitle() { public String getTitle() {
return title; return title;
} }
/**
* set group title
* @param title
*/
public void setTitle(String title) { public void setTitle(String title) {
this.title = title; this.title = title;
lbl.setValue(this.title); lbl.setValue(this.title);
} }
/**
* @return true if open, false otherwise
*/
public boolean isOpen() { public boolean isOpen() {
return open; return open;
} }
/**
* Set open/close state of group
* @param open
*/
public void setOpen(boolean open) { public void setOpen(boolean open) {
this.open = open; this.open = open;
span.setSclass(this.open ? "z-group-icon-open" : "z-group-icon-close"); span.setSclass(this.open ? "z-group-icon-open" : "z-group-icon-close");

View File

@ -21,7 +21,7 @@ import org.adempiere.webui.LayoutUtils;
import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Component;
/** /**
* * Extend {@link org.zkoss.zul.Label}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -29,7 +29,7 @@ import org.zkoss.zk.ui.Component;
public class Label extends org.zkoss.zul.Label public class Label extends org.zkoss.zul.Label
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -6818124304324329510L; private static final long serialVersionUID = -6818124304324329510L;
@ -37,25 +37,41 @@ public class Label extends org.zkoss.zul.Label
private boolean mandatory; private boolean mandatory;
/**
* Default constructor
*/
public Label() public Label()
{ {
super(); super();
} }
/**
* @param value
*/
public Label(String value) public Label(String value)
{ {
super(value != null ? value.replaceAll("[&]", "") : null); super(value != null ? value.replaceAll("[&]", "") : null);
} }
/**
* @return true if using mandatory style, false otherwise
*/
public boolean isMandatory() { public boolean isMandatory() {
return mandatory; return mandatory;
} }
/**
* set mandatory/optional style
* @param mandatory true for mandatory style, false for optional
*/
public void setMandatory(boolean mandatory) { public void setMandatory(boolean mandatory) {
this.mandatory = mandatory; this.mandatory = mandatory;
setupMandatoryDecorator(); setupMandatoryDecorator();
} }
/**
* @return Decorator Component
*/
public Component getDecorator() { public Component getDecorator() {
return decorator; return decorator;
} }
@ -78,6 +94,9 @@ public class Label extends org.zkoss.zul.Label
return super.setVisible(visible); return super.setVisible(visible);
} }
/**
* Setup mandatory style decorator
*/
private void setupMandatoryDecorator() { private void setupMandatoryDecorator() {
if (decorator == null) if (decorator == null)
createMandatoryDecorator(); createMandatoryDecorator();
@ -88,6 +107,9 @@ public class Label extends org.zkoss.zul.Label
decorator.setVisible(false); decorator.setVisible(false);
} }
/**
* Create mandatory style decorator
*/
private void createMandatoryDecorator() { private void createMandatoryDecorator() {
decorator = new Label("*"); decorator = new Label("*");
((Label)decorator).setSclass("mandatory-decorator-text"); ((Label)decorator).setSclass("mandatory-decorator-text");
@ -103,6 +125,9 @@ public class Label extends org.zkoss.zul.Label
this.setValue(translate); this.setValue(translate);
} }
/**
* @return right align Label wrapped in Div
*/
public Component rightAlign() { public Component rightAlign() {
return LayoutUtils.makeRightAlign(this); return LayoutUtils.makeRightAlign(this);
} }

View File

@ -17,16 +17,27 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/**
* Extend {@link org.zkoss.zul.Listcell}
*/
public class ListCell extends org.zkoss.zul.Listcell public class ListCell extends org.zkoss.zul.Listcell
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 971168080286017036L; private static final long serialVersionUID = 971168080286017036L;
public ListCell(String str)
/**
* @param label
*/
public ListCell(String label)
{ {
super(str); super(label);
} }
/**
* Default constructor
*/
public ListCell() public ListCell()
{ {
super(); super();

View File

@ -17,10 +17,13 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/**
* Extend {@link org.zkoss.zul.Listhead}
*/
public class ListHead extends org.zkoss.zul.Listhead public class ListHead extends org.zkoss.zul.Listhead
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -7675491092309862710L; private static final long serialVersionUID = -7675491092309862710L;
} }

View File

@ -17,16 +17,29 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
import org.zkoss.zul.Listheader;
/**
* Extend {@link Listheader}
*/
public class ListHeader extends org.zkoss.zul.Listheader public class ListHeader extends org.zkoss.zul.Listheader
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -2709047642743510762L; private static final long serialVersionUID = -2709047642743510762L;
public ListHeader(String str)
/**
* @param label
*/
public ListHeader(String label)
{ {
super(str); super(label);
} }
/**
* Default constructor
*/
public ListHeader() public ListHeader()
{ {

View File

@ -22,8 +22,9 @@ import java.beans.PropertyChangeSupport;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
/** /**
* * Extend {@link org.zkoss.zul.Listitem}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 25, 2007 * @date Mar 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -31,31 +32,47 @@ import org.compiere.util.ValueNamePair;
public class ListItem extends org.zkoss.zul.Listitem public class ListItem extends org.zkoss.zul.Listitem
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -8052056834118074979L; private static final long serialVersionUID = -8052056834118074979L;
private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this); private PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
/**
* @param label
* @param value
*/
public ListItem(String label, Object value) public ListItem(String label, Object value)
{ {
super(label, value); super(label, value);
} }
/**
* Default constructor
*/
public ListItem() public ListItem()
{ {
super(); super();
} }
/**
* @param l PropertyChangeListener
*/
public synchronized void addPropertyChangeListener(PropertyChangeListener l) public synchronized void addPropertyChangeListener(PropertyChangeListener l)
{ {
m_propertyChangeListeners.addPropertyChangeListener(l); m_propertyChangeListeners.addPropertyChangeListener(l);
} }
/**
* @return KeyNamePair(Value, Label)
*/
public KeyNamePair toKeyNamePair() public KeyNamePair toKeyNamePair()
{ {
return new KeyNamePair((Integer)getValue(), getLabel()); return new KeyNamePair((Integer)getValue(), getLabel());
} }
/**
* @return ValueNamePair(Value, Label)
*/
public ValueNamePair toValueNamePair() { public ValueNamePair toValueNamePair() {
return new ValueNamePair((String)getValue(), getLabel()); return new ValueNamePair((String)getValue(), getLabel());
} }

View File

@ -33,9 +33,9 @@ import org.zkoss.zul.event.ListDataEvent;
import org.zkoss.zul.ext.Sortable; import org.zkoss.zul.ext.Sortable;
/** /**
* This is a ListModel<Object> to be used with Listbox. * ListModel<Object> for Listbox and provide support for the Sortable interface.<br/>
* The model allows for a table structure to be created, with columns * The model allows for a table structure to be created with columns,
* in addition to the rows provided by {@link org.zkoss.zul.ListModelList}. * in addition to the functionalities provided by {@link org.zkoss.zul.ListModelList}.
* *
* @author Andrew Kimball * @author Andrew Kimball
* *
@ -43,7 +43,7 @@ import org.zkoss.zul.ext.Sortable;
public class ListModelTable extends ListModelList<Object> implements Sortable<Object> public class ListModelTable extends ListModelList<Object> implements Sortable<Object>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 1891313647781142789L; private static final long serialVersionUID = 1891313647781142789L;
/** Array of listeners to changes in the table model. */ /** Array of listeners to changes in the table model. */
@ -65,7 +65,7 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
/** /**
* Construct the ListModel<Object> with a collection of objects. * Construct the ListModel<Object> with a collection of objects.
* A copy is made of the collection. * A copy is made of the collection.
* The objects should be vectors of objects * The element in collection should be vector of objects.
* *
* @param collection The collection of objects with which to initialise the list * @param collection The collection of objects with which to initialise the list
*/ */
@ -90,7 +90,7 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
} }
/** /**
* Query thenumber of columns in the table. * Get the number of columns in the table.
* *
* @return the number of columns in the table. 0 if uninitialised. * @return the number of columns in the table. 0 if uninitialised.
*/ */
@ -113,7 +113,7 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
} }
/** /**
* Ensure that each of the rows contains the correct number of elements. * Ensure that each element of every row contains the correct number of element/column (i.e == m_noColumns).<br/>
* Please note that the table cannot be shrunk. * Please note that the table cannot be shrunk.
*/ */
private void ensureRowSize() private void ensureRowSize()
@ -158,7 +158,7 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
} }
/** /**
* Query the number of rows in the table. * Get the number of rows in the table.
* @return the number of rows in the table * @return the number of rows in the table
*/ */
public int getNoRows() public int getNoRows()
@ -245,7 +245,7 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
} }
/** /**
* Set the number of rows in the table and initialise new rows. * Set the number of rows in the table and initialise new rows (if necessary).<br/>
* For each new row, an empty collection of the size specified by * For each new row, an empty collection of the size specified by
* {@link #setNoColumns(int)} is created. * {@link #setNoColumns(int)} is created.
* @param rowCount The number of rows to be contained in the table * @param rowCount The number of rows to be contained in the table
@ -279,7 +279,6 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
} }
else else
{ {
//hot fix for:IDEMPIERE-2154 wait complete solution from zk update
if (rowCount == 0) if (rowCount == 0)
clearSelection(); clearSelection();
removeRange(rowCount, currentSize); removeRange(rowCount, currentSize);
@ -308,13 +307,18 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
return; return;
} }
/**
* Remove WTableModelListener listener
* @param listener
*/
public void removeTableModelListener(WTableModelListener listener) public void removeTableModelListener(WTableModelListener listener)
{ {
m_listeners.remove(listener); m_listeners.remove(listener);
} }
/** /**
* Send the specified <code>event</code> to all listeners. * Fire table changed event to WTableModelListener in {@link #m_listeners}.
* *
* @param event The event tofire * @param event The event tofire
*/ */
private void fireTableChange(WTableModelEvent event) private void fireTableChange(WTableModelEvent event)
@ -323,8 +327,6 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
{ {
listener.tableChanged(event); listener.tableChanged(event);
} }
return;
} }
/* /*
@ -343,8 +345,6 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
WTableModelEvent.ALL_COLUMNS); WTableModelEvent.ALL_COLUMNS);
fireTableChange(event); fireTableChange(event);
return;
} }
/** /**
@ -395,6 +395,10 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
} }
} }
/**
* Set custom sorter for model
* @param lme Custom Sortable implementation
*/
public void setSorter(Sortable<Object> lme) public void setSorter(Sortable<Object> lme)
{ {
sorter = lme; sorter = lme;

View File

@ -30,7 +30,7 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Listitem; import org.zkoss.zul.Listitem;
/** /**
* * Extend {@link org.zkoss.zul.Listbox}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -38,7 +38,7 @@ import org.zkoss.zul.Listitem;
public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Event> public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -3713350125429939476L; private static final long serialVersionUID = -3713350125429939476L;
@ -47,6 +47,9 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
private boolean draggable; private boolean draggable;
private String oddRowSclass; private String oddRowSclass;
/**
* Default Constructor
*/
public Listbox() { public Listbox() {
super(); super();
//cache default //cache default
@ -54,6 +57,10 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
super.setOddRowSclass(oddRowSclass); super.setOddRowSclass(oddRowSclass);
} }
/**
* Create Listbox with items from pairs
* @param pairs KeyNamePair[]
*/
public Listbox(KeyNamePair[] pairs) { public Listbox(KeyNamePair[] pairs) {
super(); super();
if (pairs != null && pairs.length > 0) { if (pairs != null && pairs.length > 0) {
@ -66,23 +73,41 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
super.setOddRowSclass(oddRowSclass); super.setOddRowSclass(oddRowSclass);
} }
/**
* Set enable/disable listbox
* @param enabled
*/
public void setEnabled(boolean enabled) public void setEnabled(boolean enabled)
{ {
this.setDisabled(!enabled); this.setDisabled(!enabled);
} }
/**
* @return true if enable, false otherwise
*/
public boolean isEnabled() public boolean isEnabled()
{ {
return !this.isDisabled(); return !this.isDisabled();
} }
/**
* Add and return new {@link ListItem}
* @param label
* @param value
* @return ListItem
*/
public ListItem appendItem(String label, Object value) public ListItem appendItem(String label, Object value)
{ {
ListItem item = new ListItem(label, value); ListItem item = new ListItem(label, value);
super.appendChild(item); super.appendChild(item);
return item; return item;
} }
/**
* Add and return new {@link ListItem}
* @param label
* @param value
*/
public ListItem appendItem(String label, String value) public ListItem appendItem(String label, String value)
{ {
ListItem item = new ListItem(label, value); ListItem item = new ListItem(label, value);
@ -90,20 +115,27 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
return item; return item;
} }
/**
* @param index
* @return ListItem at index
*/
public ListItem getItemAtIndex(int index) public ListItem getItemAtIndex(int index)
{ {
return (ListItem)super.getItemAtIndex(index); return (ListItem)super.getItemAtIndex(index);
} }
/**
* @return Current selected ListItem
*/
public ListItem getSelectedItem() public ListItem getSelectedItem()
{ {
return (ListItem)super.getSelectedItem(); return (ListItem)super.getSelectedItem();
} }
/** /**
* Set selected item for the list box based on the value of list item * Set selected item for the list box based on the value of list item.<br/>
* set selected to none if no item found matching the value given or * Set selected to none if no item found matching the value given or
* value is null * value is null.
* @param value Value of ListItem to set as selected * @param value Value of ListItem to set as selected
*/ */
public void setValue(Object value) public void setValue(Object value)
@ -137,11 +169,17 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
} }
} }
/**
* @return ListHead
*/
public ListHead getListHead() public ListHead getListHead()
{ {
return (ListHead)super.getListhead(); return (ListHead)super.getListhead();
} }
/**
* @return int[] selected indices
*/
public int[] getSelectedIndices() { public int[] getSelectedIndices() {
Set<Listitem> selectedItems = this.getSelectedItems(); Set<Listitem> selectedItems = this.getSelectedItems();
int[] selecteds = new int[this.getSelectedCount()]; int[] selecteds = new int[this.getSelectedCount()];
@ -154,6 +192,10 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
return selecteds; return selecteds;
} }
/**
* Set selected indices
* @param selected int[] selected indices
*/
public void setSelectedIndices(int[] selected) { public void setSelectedIndices(int[] selected) {
if (selected != null && selected.length > 0) { if (selected != null && selected.length > 0) {
this.setSelectedIndex(selected[0]); this.setSelectedIndex(selected[0]);
@ -165,10 +207,18 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
} }
} }
/**
* Add listener for ON_DROP event
* @param listener
*/
public void addOnDropListener(EventListener<Event> listener) { public void addOnDropListener(EventListener<Event> listener) {
onDropListeners.add(listener); onDropListeners.add(listener);
} }
/**
* Add listener for DOUBLE_CLICK event
* @param listener
*/
public void addDoubleClickListener(EventListener<Event> listener) { public void addDoubleClickListener(EventListener<Event> listener) {
doubleClickListeners.add(listener); doubleClickListeners.add(listener);
} }
@ -188,14 +238,21 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
return super.insertBefore(newChild, refChild); return super.insertBefore(newChild, refChild);
} }
/**
* @return true if ListItem should be draggable
*/
public boolean isItemDraggable() { public boolean isItemDraggable() {
return draggable; return draggable;
} }
/**
* @param b true to enable draggable support for ListItem
*/
public void setItemDraggable(boolean b) { public void setItemDraggable(boolean b) {
draggable = b; draggable = b;
} }
@Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (Events.ON_DOUBLE_CLICK.equals(event.getName()) && !doubleClickListeners.isEmpty()) { if (Events.ON_DOUBLE_CLICK.equals(event.getName()) && !doubleClickListeners.isEmpty()) {
for(EventListener<Event> listener : doubleClickListeners) { for(EventListener<Event> listener : doubleClickListeners) {
@ -252,7 +309,7 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
/** /**
* select selected item base on vp.getValue, to ease porting of swing form * select selected item base on vp.getValue, to ease porting of swing form
* @param vp * @param vp ValueNamePair
*/ */
public void setSelectedValueNamePair(ValueNamePair vp) { public void setSelectedValueNamePair(ValueNamePair vp) {
int count = this.getItemCount(); int count = this.getItemCount();
@ -268,7 +325,7 @@ public class Listbox extends org.zkoss.zul.Listbox implements EventListener<Even
/** /**
* select selected item base on kp.getKey, to ease porting of swing form * select selected item base on kp.getKey, to ease porting of swing form
* @param kp * @param kp KeyNamePair
*/ */
public void setSelectedKeyNamePair(KeyNamePair kp) { public void setSelectedKeyNamePair(KeyNamePair kp) {
int count = this.getItemCount(); int count = this.getItemCount();

View File

@ -45,6 +45,10 @@ public class ListboxFactory {
return dataTable; return dataTable;
} }
/**
* Create new data table instance with sized by content on.
* @return WListbox
*/
public static WListbox newDataTableAutoSize() { public static WListbox newDataTableAutoSize() {
WListbox listBox = newDataTable(); WListbox listBox = newDataTable();
listBox.setSizedByContent(true); listBox.setSizedByContent(true);
@ -52,6 +56,11 @@ public class ListboxFactory {
return listBox; return listBox;
} }
/**
* Create combo mode Listbox from items.
* @param items String[]
* @return Listbox
*/
public static Listbox newDropdownListbox(String[] items) { public static Listbox newDropdownListbox(String[] items) {
Listbox listbox = newDropdownListbox(); Listbox listbox = newDropdownListbox();
if (items != null && items.length > 0) { if (items != null && items.length > 0) {

View File

@ -13,23 +13,28 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/** /**
* * Component for Location Editor
* @author Low Heng Sin * @author Low Heng Sin
*
*/ */
public class Locationbox extends EditorBox public class Locationbox extends EditorBox
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -9199586798474147872L; private static final long serialVersionUID = -9199586798474147872L;
/**
* Default constructor
*/
public Locationbox() public Locationbox()
{ {
super(); super();
txt.setReadonly(true); txt.setReadonly(true);
} }
/**
* @param text
*/
public Locationbox(String text) public Locationbox(String text)
{ {
this(); this();

View File

@ -16,12 +16,12 @@ package org.adempiere.webui.component;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
/** /**
* Background mask
* @author hengsin * @author hengsin
*
*/ */
public class Mask extends Div { public class Mask extends Div {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 7462166722064971644L; private static final long serialVersionUID = 7462166722064971644L;
@ -33,11 +33,13 @@ public class Mask extends Div {
"padding: 0; z-index:999; opacity:0.6; top: 0px; left: 0px;"); "padding: 0; z-index:999; opacity:0.6; top: 0px; left: 0px;");
} }
/**
* Close mask
*/
public void hideMask() { public void hideMask() {
if (this.getParent() != null){ if (this.getParent() != null){
this.detach(); this.detach();
} }
} }
} }

View File

@ -20,9 +20,8 @@ import org.zkoss.zk.ui.Page;
import org.zkoss.zul.impl.XulElement; import org.zkoss.zul.impl.XulElement;
/** /**
* * Extend {@link org.zkoss.zul.Menupopup}
* @author hengsin * @author hengsin
*
*/ */
public class Menupopup extends org.zkoss.zul.Menupopup { public class Menupopup extends org.zkoss.zul.Menupopup {
@ -32,13 +31,13 @@ public class Menupopup extends org.zkoss.zul.Menupopup {
private static final long serialVersionUID = -4929397362586559388L; private static final long serialVersionUID = -4929397362586559388L;
/** /**
* listo of xulelement that use this as the context menu * List of XulElement that uses this as the context menu
*/ */
private List<XulElement> elementList = new ArrayList<XulElement>(); private List<XulElement> elementList = new ArrayList<XulElement>();
/** /**
* add xul element that want to use this as the context menu * add xul element that want to use this as the context menu
* @param element * @param element XulElement
*/ */
public void addContextElement(XulElement element) { public void addContextElement(XulElement element) {
elementList.add(element); elementList.add(element);

View File

@ -55,18 +55,17 @@ import org.zkoss.zul.Vbox;
* @date Jul 31, 2007 * @date Jul 31, 2007
* @contributor Andreas Sumerauer IDEMPIERE-4702 * @contributor Andreas Sumerauer IDEMPIERE-4702
*/ */
public class Messagebox extends Window implements EventListener<Event> public class Messagebox extends Window implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 8928526331932742124L; private static final long serialVersionUID = 8928526331932742124L;
private static final String MESSAGE_PANEL_STYLE = "text-align:left; word-break: break-all; overflow: auto; max-height: 350pt; min-width: 230pt; max-width: 450pt;"; private static final String MESSAGE_PANEL_STYLE = "text-align:left; word-break: break-all; overflow: auto; max-height: 350pt; min-width: 230pt; max-width: 450pt;";
private static final String SMALLER_MESSAGE_PANEL_STYLE = "text-align:left; word-break: break-all; overflow: auto; max-height: 350pt; min-width: 180pt; "; private static final String SMALLER_MESSAGE_PANEL_STYLE = "text-align:left; word-break: break-all; overflow: auto; max-height: 350pt; min-width: 180pt; ";
private String msg = new String(""); private String msg = "";
private String imgSrc = new String(""); private String imgSrc = "";
private Text lblMsg = new Text(); private Text lblMsg = new Text();
@ -83,6 +82,7 @@ public class Messagebox extends Window implements EventListener<Event>
private Image img = new Image(); private Image img = new Image();
/** button constant for button pressed by user */
private int returnValue; private int returnValue;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
private Callback callback; private Callback callback;
@ -127,11 +127,17 @@ public class Messagebox extends Window implements EventListener<Event>
/** Contains no symbols. */ /** Contains no symbols. */
public static final String NONE = null; public static final String NONE = null;
/**
* Default constructor
*/
public Messagebox() public Messagebox()
{ {
super(); super();
} }
/**
* Layout dialog
*/
private void init() private void init()
{ {
setSclass("popup-dialog"); setSclass("popup-dialog");
@ -254,21 +260,60 @@ public class Messagebox extends Window implements EventListener<Event>
this.setPosition("left, top"); this.setPosition("left, top");
} }
/**
* Show message box dialog
* @param message
* @param title
* @param buttons buttons to be shown in the dialog. use the | operator to combine multiple button constant.
* @param icon image URL sfor message box icon
* @return button constant for button press by user
*/
public int show(String message, String title, int buttons, String icon) public int show(String message, String title, int buttons, String icon)
{ {
return show(message, title, buttons, icon, null); return show(message, title, buttons, icon, null);
} }
/**
* Show message box dialog
* @param message
* @param title
* @param buttons buttons to be shown in the dialog. use the | operator to combine multiple button constant.
* @param icon image URL for message box icon
* @param callback
* @return button constant for button press by user
*/
public int show(String message, String title, int buttons, String icon, Callback<Integer> callback) public int show(String message, String title, int buttons, String icon, Callback<Integer> callback)
{ {
return show(message, title, buttons, icon, callback, false); return show(message, title, buttons, icon, callback, false);
} }
/**
* Show message box dialog
* @param message
* @param title
* @param buttons buttons to be shown in the dialog. use the | operator to combine multiple button constant.
* @param icon image URL for message box icon
* @param callback
* @param modal
* @return button constant for button press by user
*/
public int show(String message, String title, int buttons, String icon, Callback<?> callback, boolean modal) public int show(String message, String title, int buttons, String icon, Callback<?> callback, boolean modal)
{ {
return show(message, title, buttons, icon, null, false, callback, modal); return show(message, title, buttons, icon, null, false, callback, modal);
} }
/**
* Show message box dialog with optional input editor
* @param message
* @param title
* @param buttons buttons to be shown in the dialog. use the | operator to combine multiple button constant.
* @param icon image URL for message box icon
* @param editor optional input editor
* @param isInputMandatory true if editor input is mandatory
* @param callback
* @param modal
* @return button constant for button press by user
*/
public int show(String message, String title, int buttons, String icon, WEditor editor, boolean isInputMandatory, Callback<?> callback, boolean modal) public int show(String message, String title, int buttons, String icon, WEditor editor, boolean isInputMandatory, Callback<?> callback, boolean modal)
{ {
this.msg = message; this.msg = message;
@ -350,32 +395,81 @@ public class Messagebox extends Window implements EventListener<Event>
return returnValue; return returnValue;
} }
/**
* Show message box dialog
* @param message
* @param title
* @param buttons
* @param icon image URL for message box icon
* @return button constant for button press by user
*/
public static int showDialog(String message, String title, int buttons, String icon) public static int showDialog(String message, String title, int buttons, String icon)
{ {
return showDialog(message, title, buttons, icon, null); return showDialog(message, title, buttons, icon, null);
} }
/**
* Show message box dialog
* @param message
* @param title
* @param buttons buttons to be shown in the dialog. use the | operator to combine multiple button constant.
* @param icon image URL for message box icon
* @param callback
* @return button constant for button press by user
*/
public static int showDialog(String message, String title, int buttons, String icon, Callback<Integer> callback) public static int showDialog(String message, String title, int buttons, String icon, Callback<Integer> callback)
{ {
return showDialog(message, title, buttons, icon, callback, false); return showDialog(message, title, buttons, icon, callback, false);
} }
/**
* Show message box dialog
* @param message
* @param title
* @param buttons buttons to be shown in the dialog. use the | operator to combine multiple button constant.
* @param icon image URL for message box icon
* @param callback
* @param modal
* @return button constant for button press by user
*/
public static int showDialog(String message, String title, int buttons, String icon, Callback<?> callback, boolean modal) public static int showDialog(String message, String title, int buttons, String icon, Callback<?> callback, boolean modal)
{ {
return showDialog(message, title, buttons, icon, null, false, callback, modal); return showDialog(message, title, buttons, icon, null, false, callback, modal);
} }
/**
* Show message box dialog
* @param message
* @param title
* @param buttons buttons to be shown in the dialog. use the | operator to combine multiple button constant.
* @param icon image URL for message box icon
* @param editor
* @param callback
* @param modal
* @return button constant for button press by user
*/
public static int showDialog(String message, String title, int buttons, String icon, WEditor editor, Callback<?> callback, boolean modal) { public static int showDialog(String message, String title, int buttons, String icon, WEditor editor, Callback<?> callback, boolean modal) {
return showDialog(message, title, buttons, icon, editor, false, callback, modal); return showDialog(message, title, buttons, icon, editor, false, callback, modal);
} }
/**
* Show message box dialog
* @param message
* @param title
* @param buttons buttons to be shown in the dialog. use the | operator to combine multiple button constant.
* @param icon image URL for message box icon
* @param editor optional input editor
* @param isInputMandatory true if input editor is mandatory
* @param callback
* @param modal
* @return button constant for button press by user
*/
public static int showDialog(String message, String title, int buttons, String icon, WEditor editor, boolean isInputMandatory, Callback<?> callback, boolean modal) public static int showDialog(String message, String title, int buttons, String icon, WEditor editor, boolean isInputMandatory, Callback<?> callback, boolean modal)
{ {
Messagebox msg = new Messagebox(); Messagebox msg = new Messagebox();
return msg.show(message, title, buttons, icon, editor, isInputMandatory, callback, modal); return msg.show(message, title, buttons, icon, editor, isInputMandatory, callback, modal);
} }
// Andreas Sumerauer IDEMPIERE 4702
@Listen("onCancel") @Listen("onCancel")
public void onCancel() throws Exception public void onCancel() throws Exception
{ {
@ -383,7 +477,7 @@ public class Messagebox extends Window implements EventListener<Event>
close(); close();
} }
@Override
public void onEvent(Event event) throws Exception public void onEvent(Event event) throws Exception
{ {
if (event == null) if (event == null)
@ -425,6 +519,10 @@ public class Messagebox extends Window implements EventListener<Event>
validateOnClose(); validateOnClose();
} }
/**
* Perform validation before closing of dialog.<br/>
* Throw {@link WrongValueException} if there's any validation error.
*/
private void validateOnClose() { private void validateOnClose() {
// Don't close on OK if input is mandatory while input field is empty // Don't close on OK if input is mandatory while input field is empty
@ -454,6 +552,9 @@ public class Messagebox extends Window implements EventListener<Event>
// //
} }
/**
* Close dialog
*/
private void close() { private void close() {
try { try {
this.detach(); this.detach();

View File

@ -39,7 +39,7 @@ import org.zkoss.zul.Popup;
import org.zkoss.zul.Vbox; import org.zkoss.zul.Vbox;
/** /**
* * Composite component of {@link Decimalbox} and {@link Button}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 11, 2007 * @date Mar 11, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -49,29 +49,35 @@ import org.zkoss.zul.Vbox;
public class NumberBox extends Div public class NumberBox extends Div
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 8543853599051754172L; private static final long serialVersionUID = 8543853599051754172L;
/** Text box for calculator */
private Textbox txtCalc = new Textbox(); private Textbox txtCalc = new Textbox();
boolean integral = false; /** true for integer, false for number with decimal point */
protected boolean integral = false;
NumberFormat format = null; protected NumberFormat format = null;
private Decimalbox decimalBox = null; private Decimalbox decimalBox = null;
private Button btn; private Button btn;
/** calculator popup */
private Popup popup; private Popup popup;
/**
* @param integral
*/
public NumberBox(boolean integral) public NumberBox(boolean integral)
{ {
this(integral, false); this(integral, false);
} }
/** /**
*
* @param integral * @param integral
* @param tableEditor
*/ */
public NumberBox(boolean integral, boolean tableEditor) public NumberBox(boolean integral, boolean tableEditor)
{ {
@ -80,6 +86,10 @@ public class NumberBox extends Div
init(tableEditor); init(tableEditor);
} }
/**
* Layout component
* @param tableEditor
*/
private void init(boolean tableEditor) private void init(boolean tableEditor)
{ {
decimalBox = new Decimalbox(); decimalBox = new Decimalbox();
@ -179,7 +189,7 @@ public class NumberBox extends Div
} }
/** /**
* * Set number format
* @param format * @param format
*/ */
public void setFormat(NumberFormat format) public void setFormat(NumberFormat format)
@ -188,7 +198,7 @@ public class NumberBox extends Div
} }
/** /**
* * Set value to {@link #decimalBox}
* @param value * @param value
*/ */
public void setValue(Object value) public void setValue(Object value)
@ -204,7 +214,7 @@ public class NumberBox extends Div
} }
/** /**
* * Get value from {@link #decimalBox}
* @return BigDecimal * @return BigDecimal
*/ */
public BigDecimal getValue() public BigDecimal getValue()
@ -213,7 +223,7 @@ public class NumberBox extends Div
} }
/** /**
* * Get text from {@link #decimalBox}
* @return text * @return text
*/ */
public String getText() public String getText()
@ -224,7 +234,7 @@ public class NumberBox extends Div
} }
/** /**
* * Set value to {@link #decimalBox}
* @param value * @param value
*/ */
public void setValue(String value) public void setValue(String value)
@ -248,6 +258,10 @@ public class NumberBox extends Div
} }
} }
/**
* Create calculator popup
* @return Popup
*/
private Popup getCalculatorPopup() private Popup getCalculatorPopup()
{ {
Popup popup = new Popup(); Popup popup = new Popup();
@ -437,16 +451,15 @@ public class NumberBox extends Div
} }
/** /**
* * @return true if it is for integer, false for decimal number
* @return boolean
*/ */
public boolean isIntegral() { public boolean isIntegral() {
return integral; return integral;
} }
/** /**
* * Set integer or decimal number mode
* @param integral * @param integral true for integer mode, false for decimal number mode
*/ */
public void setIntegral(boolean integral) { public void setIntegral(boolean integral) {
this.integral = integral; this.integral = integral;
@ -457,7 +470,8 @@ public class NumberBox extends Div
} }
/** /**
* * Set enable/disable.
* Hide calculator button if set to disable.
* @param enabled * @param enabled
*/ */
public void setEnabled(boolean enabled) public void setEnabled(boolean enabled)
@ -483,14 +497,20 @@ public class NumberBox extends Div
} }
/** /**
* * @return true if enable, false otherwise
* @return boolean
*/ */
public boolean isEnabled() public boolean isEnabled()
{ {
return !decimalBox.isReadonly(); return !decimalBox.isReadonly();
} }
/**
* If evtnm is ON_CLICK, add listener to {@link #btn}.
* Otherwise, add listener to {@link #decimalBox}.
* @param evtnm
* @param listener
* @return true if listener added
*/
@Override @Override
public boolean addEventListener(String evtnm, EventListener<?> listener) public boolean addEventListener(String evtnm, EventListener<?> listener)
{ {
@ -504,6 +524,9 @@ public class NumberBox extends Div
} }
} }
/**
* Focus to {@link #decimalBox}
*/
@Override @Override
public void focus() public void focus()
{ {
@ -511,7 +534,6 @@ public class NumberBox extends Div
} }
/** /**
*
* @return decimalBox * @return decimalBox
*/ */
public Decimalbox getDecimalbox() public Decimalbox getDecimalbox()
@ -519,11 +541,18 @@ public class NumberBox extends Div
return decimalBox; return decimalBox;
} }
/**
@return Button
*/
public Button getButton() public Button getButton()
{ {
return btn; return btn;
} }
/**
* Set to form or grid view mode.
* @param flag true for grid view mode, false otherwise
*/
public void setTableEditorMode(boolean flag) { public void setTableEditorMode(boolean flag) {
if (flag) { if (flag) {
ZKUpdateUtil.setHflex(this, "0"); ZKUpdateUtil.setHflex(this, "0");

View File

@ -17,16 +17,19 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/** /**
* Product Attribute Box * Component for Product Attribute editor
* @author Low Heng Sin * @author Low Heng Sin
*/ */
public class PAttributebox extends EditorBox public class PAttributebox extends EditorBox
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 6822449202155516221L; private static final long serialVersionUID = 6822449202155516221L;
/**
* Default constructor
*/
public PAttributebox() public PAttributebox()
{ {
super(); super();

View File

@ -20,7 +20,7 @@ package org.adempiere.webui.component;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
/** /**
* * Extend {@link Div}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -28,14 +28,19 @@ import org.zkoss.zul.Div;
public class Panel extends Div public class Panel extends Div
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -5549821938132356378L; private static final long serialVersionUID = -5549821938132356378L;
@Deprecated
public static final String HORIZONTAL = "horizontal"; public static final String HORIZONTAL = "horizontal";
@Deprecated
public static final String VERTICAL = "vertical"; public static final String VERTICAL = "vertical";
/**
* Default constructor
*/
public Panel() public Panel()
{ {
super(); super();

View File

@ -26,33 +26,47 @@ import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
/** /**
* * Composite component of {@link Combobox} and {@link Button}.
* For Payment Rule editor.
* @author Elaine * @author Elaine
*
*/ */
public class Paymentbox extends Div { public class Paymentbox extends Div {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 1807586169091171780L; private static final long serialVersionUID = 1807586169091171780L;
protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this); protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
/** List of payment rules */
protected Combobox combo; protected Combobox combo;
/** Button to open payment form */
protected Button btn; protected Button btn;
/**
* Default constructor
*/
public Paymentbox() { public Paymentbox() {
initComponents(); initComponents();
} }
/**
* @param comboitem
*/
public Paymentbox(Comboitem comboitem) { public Paymentbox(Comboitem comboitem) {
initComponents(); initComponents();
setSelectedComboItem(comboitem); setSelectedComboItem(comboitem);
} }
/**
* Set image URL of button
* @param imageSrc
*/
public void setButtonImage(String imageSrc) { public void setButtonImage(String imageSrc) {
btn.setImage(imageSrc); btn.setImage(imageSrc);
} }
/**
* Layout component
*/
private void initComponents() { private void initComponents() {
combo = new Combobox(); combo = new Combobox();
appendChild(combo); appendChild(combo);
@ -67,18 +81,33 @@ public class Paymentbox extends Div {
LayoutUtils.addSclass("payment-rule-editor", this); LayoutUtils.addSclass("payment-rule-editor", this);
} }
/**
* @return Combobox
*/
public Combobox getCombobox() { public Combobox getCombobox() {
return combo; return combo;
} }
/**
* Set selected Combo Item
* @param comboitem
*/
public void setSelectedComboItem(Comboitem comboitem) { public void setSelectedComboItem(Comboitem comboitem) {
combo.setSelectedItem(comboitem); combo.setSelectedItem(comboitem);
} }
/**
* @return selected Comboitem
*/
public Comboitem getSelectedComboItem() { public Comboitem getSelectedComboItem() {
return combo.getSelectedItem(); return combo.getSelectedItem();
} }
/**
* Set enable/disable. Hide button if disable.
* @param isComboEnabled
* @param isBtnEnabled
*/
public void setEnabled(boolean isComboEnabled, boolean isBtnEnabled) { public void setEnabled(boolean isComboEnabled, boolean isBtnEnabled) {
if (! MSysConfig.getBooleanValue(MSysConfig.ENABLE_PAYMENTBOX_BUTTON, true, Env.getAD_Client_ID(Env.getCtx()))) if (! MSysConfig.getBooleanValue(MSysConfig.ENABLE_PAYMENTBOX_BUTTON, true, Env.getAD_Client_ID(Env.getCtx())))
isBtnEnabled = false; isBtnEnabled = false;
@ -105,10 +134,20 @@ public class Paymentbox extends Div {
} }
} }
/**
* @return true if enable, false otherwise
*/
public boolean isEnabled() { public boolean isEnabled() {
return combo.isEnabled(); return combo.isEnabled();
} }
/**
* If evtnm is ON_CLICK, add listener to {@link #btn}.
* Otherwise add listener to {@link #combo}.
* @param evtnm
* @param listener
* @return true if listener added to Button or Combobox
*/
public boolean addEventListener(String evtnm, EventListener<?> listener) { public boolean addEventListener(String evtnm, EventListener<?> listener) {
if (Events.ON_CLICK.equals(evtnm)) { if (Events.ON_CLICK.equals(evtnm)) {
return btn.addEventListener(evtnm, listener); return btn.addEventListener(evtnm, listener);
@ -117,10 +156,16 @@ public class Paymentbox extends Div {
} }
} }
/**
* @param l PropertyChangeListener
*/
public synchronized void addPropertyChangeListener(PropertyChangeListener l) { public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
m_propertyChangeListeners.addPropertyChangeListener(l); m_propertyChangeListeners.addPropertyChangeListener(l);
} }
/**
* @return Button
*/
public Button getButton() { public Button getButton() {
return btn; return btn;
} }

View File

@ -48,14 +48,14 @@ import org.zkoss.zul.Image;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
/** /**
* * Dialog to display {@link ProcessInfo} details.
* @author milap.doshi * @author milap.doshi
* @author Deepak Pansheriya * @author Deepak Pansheriya
*/ */
public class ProcessInfoDialog extends Window implements EventListener<Event> { public class ProcessInfoDialog extends Window implements EventListener<Event> {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -1712025652050086903L; private static final long serialVersionUID = -1712025652050086903L;
@ -63,13 +63,17 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
private Text lblMsg = new Text(); private Text lblMsg = new Text();
private Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK); private Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
/** Button to print document from {@link #m_logs} */
private Button btnPrint = ButtonFactory.createNamedButton(ConfirmPanel.A_PRINT); private Button btnPrint = ButtonFactory.createNamedButton(ConfirmPanel.A_PRINT);
/** Info or Error image icon */
private Image img = new Image(); private Image img = new Image();
/** Array of ProcessInfoLog from ProcessInfo */
private ProcessInfoLog[] m_logs; private ProcessInfoLog[] m_logs;
public static final String INFORMATION = "~./zul/img/msgbox/info-btn.png"; public static final String INFORMATION = "~./zul/img/msgbox/info-btn.png";
public static final String ERROR = "~./zul/img/msgbox/info-btn.png"; public static final String ERROR = "~./zul/img/msgbox/info-btn.png";
/** If true, auto close dialog after user has click on zoom to window link */
private boolean isAutoCloseAfterZoom = false; private boolean isAutoCloseAfterZoom = false;
/** /**
@ -97,8 +101,8 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
/** /**
* show result after run a process * show result after run a process
* @param pi * @param pi ProcessInfo
* @param needFillLogFromDb * @param needFillLogFromDb true to load ProcessInfoLog from DB
*/ */
public ProcessInfoDialog(ProcessInfo pi, boolean needFillLogFromDb) { public ProcessInfoDialog(ProcessInfo pi, boolean needFillLogFromDb) {
if (needFillLogFromDb) if (needFillLogFromDb)
@ -107,10 +111,11 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
} }
/** /**
* * Layout dialog
* @param title * @param title
* @param header * @param header
* @param m_logs * @param pi ProcessInfo
* @param m_logs ProcessInfoLog[]
*/ */
private void init(String title, String header, ProcessInfo pi, ProcessInfoLog[] m_logs) { private void init(String title, String header, ProcessInfo pi, ProcessInfoLog[] m_logs) {
this.setTitle(title); this.setTitle(title);
@ -120,8 +125,6 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
this.setBorder("normal"); this.setBorder("normal");
this.setContentStyle("background-color:#ffffff;"); this.setContentStyle("background-color:#ffffff;");
//this.setId(title);
lblMsg.setEncode(false); lblMsg.setEncode(false);
lblMsg.setValue(header); lblMsg.setValue(header);
@ -231,6 +234,7 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
} }
@Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (event == null) if (event == null)
return; return;
@ -244,10 +248,9 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
} }
/** /**
* On Print * Print all printable documents in {@link #m_logs}
*/ */
private void onPrint() { private void onPrint() {
Clients.clearBusy(); Clients.clearBusy();
// Loop through all items // Loop through all items
List<File> pdfList = new ArrayList<File>(); List<File> pdfList = new ArrayList<File>();
@ -285,8 +288,7 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
} }
/** /**
* Is Printable * @return true if there are printable document in {@link #m_logs}
* @return boolean
*/ */
public boolean isPrintable() { public boolean isPrintable() {
if (m_logs == null) if (m_logs == null)
@ -322,11 +324,11 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
/** /**
* after run a process, call this function to show result in a dialog * after run a process, call this function to show result in a dialog
* @param pi * @param pi ProcessInfo
* @param windowNo * @param windowNo
* @param comp * @param comp Component
* @param needFillLogFromDb if ProcessInfoUtil.setLogFromDB(pi) is called by outer function, * @param needFillLogFromDb if ProcessInfoUtil.setLogFromDB(pi) is called by outer function,
* just pass false, other pass true to avoid duplicate message * just pass false, otherwise pass true to avoid duplicate message
*/ */
public static ProcessInfoDialog showProcessInfo (ProcessInfo pi, int windowNo, final Component comp, boolean needFillLogFromDb) { public static ProcessInfoDialog showProcessInfo (ProcessInfo pi, int windowNo, final Component comp, boolean needFillLogFromDb) {
ProcessInfoDialog dialog = new ProcessInfoDialog(pi, needFillLogFromDb); ProcessInfoDialog dialog = new ProcessInfoDialog(pi, needFillLogFromDb);

View File

@ -21,7 +21,7 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zul.Cell; import org.zkoss.zul.Cell;
/** /**
* * Extend {@link org.zkoss.zul.Row}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -29,16 +29,28 @@ import org.zkoss.zul.Cell;
public class Row extends org.zkoss.zul.Row public class Row extends org.zkoss.zul.Row
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -5813452501151101553L; private static final long serialVersionUID = -5813452501151101553L;
/** Last Cell added to Row */
private Cell m_lastCell; private Cell m_lastCell;
/**
* Add component to row
* @param child Component
* @return true if added
*/
public boolean appendCellChild(Component child) { public boolean appendCellChild(Component child) {
return this.appendCellChild(child, 1); return this.appendCellChild(child, 1);
} }
/**
* Add component to row. A new {@link Cell} with colspan will be created as parent of the component.
* @param child Component
* @param colspan Column span
* @return true if added
*/
public boolean appendCellChild(Component child, int colspan) { public boolean appendCellChild(Component child, int colspan) {
Cell cell = new Cell(); Cell cell = new Cell();
cell.setColspan(colspan); cell.setColspan(colspan);
@ -48,18 +60,29 @@ public class Row extends org.zkoss.zul.Row
return super.appendChild(cell); return super.appendChild(cell);
} }
/** Optional Group that own this Row instance */
private Group m_group; private Group m_group;
/**
* @return Group
*/
public Group getGroup() { public Group getGroup() {
return m_group; return m_group;
} }
/**
* Add row to Group
* @param group Group
*/
public void setGroup(Group group) { public void setGroup(Group group) {
this.m_group = group; this.m_group = group;
if (m_group != null) if (m_group != null)
m_group.add(this); m_group.add(this);
} }
/**
* @return last Cell added to Row
*/
public Cell getLastCell() { public Cell getLastCell() {
return m_lastCell; return m_lastCell;
} }

View File

@ -18,7 +18,7 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/** /**
* * Extend {@link org.zkoss.zul.Rows}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -26,10 +26,14 @@ package org.adempiere.webui.component;
public class Rows extends org.zkoss.zul.Rows public class Rows extends org.zkoss.zul.Rows
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 5100123951371296683L; private static final long serialVersionUID = 5100123951371296683L;
/**
* Create new Row
* @return Row
*/
public Row newRow() { public Row newRow() {
Row row = new Row(); Row row = new Row();
appendChild(row); appendChild(row);

View File

@ -12,18 +12,22 @@
*****************************************************************************/ *****************************************************************************/
package org.adempiere.webui.component; package org.adempiere.webui.component;
import org.adempiere.webui.apps.form.WTreeMaintenance;
/** /**
* * Search box for {@link WTreeMaintenance} form.
* @author Low Heng Sin * @author Low Heng Sin
*
*/ */
public class Searchbox extends EditorBox public class Searchbox extends EditorBox
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -5164796522319002269L; private static final long serialVersionUID = -5164796522319002269L;
/**
* Default constructor
*/
public Searchbox() public Searchbox()
{ {
} }

View File

@ -31,29 +31,39 @@ import org.zkoss.zul.event.ListDataEvent;
import org.zkoss.zul.ext.Sortable; import org.zkoss.zul.ext.Sortable;
/** /**
* * List model for {@link Listbox} that also implements {@link ListitemRenderer} interface.
* @author Low Heng Sin * @author Low Heng Sin
*
*/ */
public class SimpleListModel extends AbstractListModel<Object> implements ListitemRenderer<Object>, ListitemRendererExt, Sortable<Object> { public class SimpleListModel extends AbstractListModel<Object> implements ListitemRenderer<Object>, ListitemRendererExt, Sortable<Object> {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -572148106182756840L; private static final long serialVersionUID = -572148106182756840L;
/** List backing this model instance */
protected List<Object> list; protected List<Object> list;
/** Comparator for sorting */
private Comparator<Object> _sorting; private Comparator<Object> _sorting;
/** Sort Direction. True for Ascending, False for Descrending */
private boolean _sortDir; private boolean _sortDir;
/** Max length for each column (value <= 0 means no Max length) */
private int[] maxLength; private int[] maxLength;
/**
* Default constructor
*/
public SimpleListModel() { public SimpleListModel() {
this(new ArrayList<Object>()); this(new ArrayList<Object>());
} }
/**
* Create model from list
* @param list List<?>
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public SimpleListModel(List<?> list) { public SimpleListModel(List<?> list) {
this.list = (List<Object>)list; this.list = (List<Object>)list;
@ -72,6 +82,13 @@ public class SimpleListModel extends AbstractListModel<Object> implements Listit
return list.size(); return list.size();
} }
/**
* Truncate src to maxLength.<br/>
* "..." will be added to the end of truncated text to indicate text have been truncated.
* @param src Input text
* @param maxLength Maximum length of text
* @return truncated text
*/
protected StringBuffer truncate(String src, int maxLength) { protected StringBuffer truncate(String src, int maxLength) {
int j = maxLength; int j = maxLength;
while (j > 0 && Character.isWhitespace(src.charAt(j - 1))) while (j > 0 && Character.isWhitespace(src.charAt(j - 1)))
@ -92,6 +109,12 @@ public class SimpleListModel extends AbstractListModel<Object> implements Listit
} }
} }
/**
* Render text {@link Listbox} cell/column
* @param col Column index
* @param item Listitem
* @param value Text content for cell
*/
protected void renderCell(int col, Listitem item, String value) { protected void renderCell(int col, Listitem item, String value) {
String tooltip = null; String tooltip = null;
if (maxLength != null && maxLength.length > col && maxLength[col] > 0 && value.length() > maxLength[col]) { if (maxLength != null && maxLength.length > col && maxLength[col] > 0 && value.length() > maxLength[col]) {
@ -113,6 +136,11 @@ public class SimpleListModel extends AbstractListModel<Object> implements Listit
ZkCssHelper.appendStyle(listCell, "font-weight: bold"); ZkCssHelper.appendStyle(listCell, "font-weight: bold");
} }
/**
* Render collection of values
* @param item Listitem
* @param data Collection<?>
*/
private void renderCollection(Listitem item, Collection<?> data) { private void renderCollection(Listitem item, Collection<?> data) {
int i = 0; int i = 0;
for (Object col : data) { for (Object col : data) {
@ -122,6 +150,11 @@ public class SimpleListModel extends AbstractListModel<Object> implements Listit
} }
} }
/**
* Render array of values
* @param item Listitem
* @param data Object[]
*/
private void renderArray(Listitem item, Object[] data) { private void renderArray(Listitem item, Object[] data) {
int i = 0; int i = 0;
for (Object col : data) { for (Object col : data) {
@ -148,32 +181,57 @@ public class SimpleListModel extends AbstractListModel<Object> implements Listit
return item; return item;
} }
/**
* Set max length for each column
* @param maxLength int[]
*/
public void setMaxLength(int[] maxLength) { public void setMaxLength(int[] maxLength) {
this.maxLength = maxLength; this.maxLength = maxLength;
} }
/**
* Append new row
* @param obj Object
*/
public void addElement(Object obj) { public void addElement(Object obj) {
list.add(obj); list.add(obj);
int index = list.size() - 1; int index = list.size() - 1;
fireEvent(ListDataEvent.INTERVAL_ADDED, index, index); fireEvent(ListDataEvent.INTERVAL_ADDED, index, index);
} }
/**
* Add new row at index
* @param index
* @param obj Object
*/
public void add(int index, Object obj) { public void add(int index, Object obj) {
list.add(index, obj); list.add(index, obj);
fireEvent(ListDataEvent.INTERVAL_ADDED, index, index); fireEvent(ListDataEvent.INTERVAL_ADDED, index, index);
} }
/**
* Remove all elements
*/
public void removeAllElements() { public void removeAllElements() {
list.clear(); list.clear();
fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1); fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1);
} }
/**
* Remove element from list
* @param element
*/
public void removeElement(Object element) { public void removeElement(Object element) {
int index = list.indexOf(element); int index = list.indexOf(element);
list.remove(element); list.remove(element);
fireEvent(ListDataEvent.INTERVAL_REMOVED, index, index); fireEvent(ListDataEvent.INTERVAL_REMOVED, index, index);
} }
/**
* Replace element at index
* @param element Object
* @param index List index
*/
public void setElementAt(Object element, int index) { public void setElementAt(Object element, int index) {
list.set(index, element); list.set(index, element);
fireEvent(ListDataEvent.CONTENTS_CHANGED, index, index); fireEvent(ListDataEvent.CONTENTS_CHANGED, index, index);

View File

@ -19,6 +19,7 @@ import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.ClientInfo; import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.adwindow.ADTreePanel;
import org.adempiere.webui.panel.TreeSearchPanel; import org.adempiere.webui.panel.TreeSearchPanel;
import org.compiere.model.MTree; import org.compiere.model.MTree;
import org.compiere.model.MTreeNode; import org.compiere.model.MTreeNode;
@ -40,21 +41,27 @@ import org.zkoss.zul.Treerow;
import org.zkoss.zul.event.TreeDataEvent; import org.zkoss.zul.event.TreeDataEvent;
/** /**
* * {@link org.zkoss.zul.DefaultTreeModel} implementation that also implements the {@link TreeitemRenderer} interface.<br/>
* Use by {@link ADTreePanel}.
* @author Low Heng Sin * @author Low Heng Sin
* *
*/ */
public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> implements TreeitemRenderer<Object>, EventListener<Event> { public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> implements TreeitemRenderer<Object>, EventListener<Event> {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 4945968834244672653L; private static final long serialVersionUID = 4945968834244672653L;
private static final CLogger logger = CLogger.getCLogger(SimpleTreeModel.class); private static final CLogger logger = CLogger.getCLogger(SimpleTreeModel.class);
/** True if each tree item is draggable */
private boolean itemDraggable; private boolean itemDraggable;
/** Listeners for ON_DROP event */
private List<EventListener<Event>> onDropListners = new ArrayList<EventListener<Event>>(); private List<EventListener<Event>> onDropListners = new ArrayList<EventListener<Event>>();
/**
* @param root Root node
*/
public SimpleTreeModel(DefaultTreeNode<Object> root) { public SimpleTreeModel(DefaultTreeNode<Object> root) {
super(root); super(root);
} }
@ -69,6 +76,14 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
return initADTree(tree, AD_Tree_ID, windowNo, true, null); return initADTree(tree, AD_Tree_ID, windowNo, true, null);
} }
/**
* @param tree
* @param AD_Tree_ID
* @param windowNo
* @param linkColName
* @param linkID
* @return
*/
public static SimpleTreeModel initADTree(Tree tree, int AD_Tree_ID, int windowNo, String linkColName, int linkID) { public static SimpleTreeModel initADTree(Tree tree, int AD_Tree_ID, int windowNo, String linkColName, int linkID) {
return initADTree(tree, AD_Tree_ID, windowNo, true, null, linkColName, linkID); return initADTree(tree, AD_Tree_ID, windowNo, true, null, linkColName, linkID);
} }
@ -85,6 +100,17 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
return initADTree(tree, AD_Tree_ID, windowNo, editable, trxName, null, 0); return initADTree(tree, AD_Tree_ID, windowNo, editable, trxName, null, 0);
} }
/**
* Create tree model from AD_Tree structure
* @param tree
* @param AD_Tree_ID
* @param windowNo
* @param editable
* @param trxName
* @param linkColName
* @param linkID
* @return SimpleTreeModel
*/
public static SimpleTreeModel initADTree(Tree tree, int AD_Tree_ID, int windowNo, boolean editable, String trxName, String linkColName, int linkID) { public static SimpleTreeModel initADTree(Tree tree, int AD_Tree_ID, int windowNo, boolean editable, String trxName, String linkColName, int linkID) {
MTree vTree = new MTree (Env.getCtx(), AD_Tree_ID, editable, true, trxName, linkColName, linkID); MTree vTree = new MTree (Env.getCtx(), AD_Tree_ID, editable, true, trxName, linkColName, linkID);
MTreeNode root = vTree.getRoot(); MTreeNode root = vTree.getRoot();
@ -96,11 +122,11 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
if (tree.getTreecols() == null) if (tree.getTreecols() == null)
{ {
Treecols treeCols = new Treecols(); Treecols treeCols = new Treecols();
tree.getTreecols(); tree.getTreecols();
tree.appendChild(treeCols); tree.appendChild(treeCols);
Treecol treeCol = new Treecol(); Treecol treeCol = new Treecol();
treeCols.appendChild(treeCol); treeCols.appendChild(treeCol);
} }
tree.setPageSize(-1); tree.setPageSize(-1);
@ -116,27 +142,41 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
private boolean isTreeDrivenByValue = false; private boolean isTreeDrivenByValue = false;
/**
* @return true if sort by Value, false otherwise
*/
public boolean isTreeDrivenByValue() { public boolean isTreeDrivenByValue() {
return isTreeDrivenByValue; return isTreeDrivenByValue;
} }
/**
* Set tree sorted by Value or Name
* @param isTreeDrivenByValue
*/
public void setTreeDrivenByValue(boolean isTreeDrivenByValue) { public void setTreeDrivenByValue(boolean isTreeDrivenByValue) {
this.isTreeDrivenByValue = isTreeDrivenByValue; this.isTreeDrivenByValue = isTreeDrivenByValue;
} }
private boolean isValueDisplayed = false; private boolean isValueDisplayed = false;
/**
* @return true if Value is display in front of Name
*/
public boolean isValueDisplayed() { public boolean isValueDisplayed() {
return isValueDisplayed; return isValueDisplayed;
} }
/**
* Set whether Value is display
* @param isValueDisplayed
*/
public void setIsValueDisplayed(boolean isValueDisplayed) { public void setIsValueDisplayed(boolean isValueDisplayed) {
this.isValueDisplayed = isValueDisplayed; this.isValueDisplayed = isValueDisplayed;
} }
/** /**
* * Create model from {@link MTreeNode} structure
* @param root * @param root Root node
* @return SimpleTreeModel * @return SimpleTreeModel
*/ */
public static SimpleTreeModel createFrom(MTreeNode root) { public static SimpleTreeModel createFrom(MTreeNode root) {
@ -146,24 +186,29 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
DefaultTreeNode<Object> stRoot = new DefaultTreeNode<Object>(root, nodeEnum.hasMoreElements() ? new ArrayList<TreeNode<Object>>() : null); DefaultTreeNode<Object> stRoot = new DefaultTreeNode<Object>(root, nodeEnum.hasMoreElements() ? new ArrayList<TreeNode<Object>>() : null);
while(nodeEnum.hasMoreElements()) { while(nodeEnum.hasMoreElements()) {
MTreeNode childNode = (MTreeNode)nodeEnum.nextElement(); MTreeNode childNode = (MTreeNode)nodeEnum.nextElement();
DefaultTreeNode<Object> stNode = childNode.getChildCount() > 0 ? new DefaultTreeNode<Object>(childNode, new ArrayList<TreeNode<Object>>()) DefaultTreeNode<Object> stChildNode = childNode.getChildCount() > 0 ? new DefaultTreeNode<Object>(childNode, new ArrayList<TreeNode<Object>>())
: new DefaultTreeNode<Object>(childNode); : new DefaultTreeNode<Object>(childNode);
stRoot.getChildren().add(stNode); stRoot.getChildren().add(stChildNode);
if (childNode.getChildCount() > 0) { if (childNode.getChildCount() > 0) {
populate(stNode, childNode); populate(stChildNode, childNode);
} }
} }
model = new SimpleTreeModel(stRoot); model = new SimpleTreeModel(stRoot);
return model; return model;
} }
private static void populate(DefaultTreeNode<Object> stNode, MTreeNode root) { /**
Enumeration<?> nodeEnum = root.children(); *
* @param stParentNode DefaultTreeNode wrapper for parentNode
* @param parentNode
*/
private static void populate(DefaultTreeNode<Object> stParentNode, MTreeNode parentNode) {
Enumeration<?> nodeEnum = parentNode.children();
while(nodeEnum.hasMoreElements()) { while(nodeEnum.hasMoreElements()) {
MTreeNode childNode = (MTreeNode)nodeEnum.nextElement(); MTreeNode childNode = (MTreeNode)nodeEnum.nextElement();
DefaultTreeNode<Object> stChildNode = childNode.getChildCount() > 0 ? new DefaultTreeNode<Object>(childNode, new ArrayList<TreeNode<Object>>()) DefaultTreeNode<Object> stChildNode = childNode.getChildCount() > 0 ? new DefaultTreeNode<Object>(childNode, new ArrayList<TreeNode<Object>>())
: new DefaultTreeNode<Object>(childNode); : new DefaultTreeNode<Object>(childNode);
stNode.getChildren().add(stChildNode); stParentNode.getChildren().add(stChildNode);
if (childNode.getChildCount() > 0) { if (childNode.getChildCount() > 0) {
populate(stChildNode, childNode); populate(stChildNode, childNode);
} }
@ -173,6 +218,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
/** /**
* @param ti * @param ti
* @param node * @param node
* @param index
*/ */
@Override @Override
public void render(Treeitem ti, Object node, int index) { public void render(Treeitem ti, Object node, int index) {
@ -250,6 +296,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
} }
/** /**
* Set draggable or not draggable for each tree node
* @param b * @param b
*/ */
public void setItemDraggable(boolean b) { public void setItemDraggable(boolean b) {
@ -257,13 +304,14 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
} }
/** /**
* @return boolean * @return true if tree item is draggable, false otherwise
*/ */
public boolean isItemDraggable() { public boolean isItemDraggable() {
return itemDraggable; return itemDraggable;
} }
/** /**
* Add listener for ON_DROP event
* @param listener * @param listener
*/ */
public void addOnDropEventListener(EventListener<Event> listener) { public void addOnDropEventListener(EventListener<Event> listener) {
@ -274,6 +322,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
* @param event * @param event
* @see EventListener#onEvent(Event) * @see EventListener#onEvent(Event)
*/ */
@Override
public void onEvent(Event event) throws Exception { public void onEvent(Event event) throws Exception {
if (Events.ON_DROP.equals(event.getName())) { if (Events.ON_DROP.equals(event.getName())) {
for (EventListener<Event> listener : onDropListners) { for (EventListener<Event> listener : onDropListners) {
@ -283,8 +332,9 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
} }
/** /**
* Find parent node for treeNode
* @param treeNode * @param treeNode
* @return DefaultTreeNode * @return DefaultTreeNode or null if not found
*/ */
public DefaultTreeNode<Object> getParent(DefaultTreeNode<Object> treeNode) { public DefaultTreeNode<Object> getParent(DefaultTreeNode<Object> treeNode) {
int path[] = this.getPath(treeNode); int path[] = this.getPath(treeNode);
@ -306,7 +356,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
* @param newParent * @param newParent
* @param newNode * @param newNode
* @param index * @param index
* @return parent node. this could be a new instance created to replace the newParent node param * @return parent node. this could be a new instance created to replace the newParent node parameter
*/ */
public DefaultTreeNode<Object> addNode(DefaultTreeNode<Object> newParent, DefaultTreeNode<Object> newNode, public DefaultTreeNode<Object> addNode(DefaultTreeNode<Object> newParent, DefaultTreeNode<Object> newNode,
int index) { int index) {
@ -322,8 +372,9 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
} }
/** /**
* @param fromNode * Find node with Node_ID=recordId starting from fromNode or root node.
* @param recordId * @param fromNode Optional starting node. If null, start from Root node
* @param recordId Node_ID
* @return DefaultTreeNode * @return DefaultTreeNode
*/ */
public DefaultTreeNode<Object> find(DefaultTreeNode<Object> fromNode, int recordId) { public DefaultTreeNode<Object> find(DefaultTreeNode<Object> fromNode, int recordId) {
@ -345,7 +396,8 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
} }
/** /**
* @param node * Fire CONTENTS_CHANGED event for node
* @param node DefaultTreeNode
*/ */
public void nodeUpdated(DefaultTreeNode<Object> node) { public void nodeUpdated(DefaultTreeNode<Object> node) {
DefaultTreeNode<Object> parent = getParent(node); DefaultTreeNode<Object> parent = getParent(node);

View File

@ -41,30 +41,39 @@ import org.zkoss.zul.Include;
import org.zkoss.zul.impl.LabelImageElement; import org.zkoss.zul.impl.LabelImageElement;
/** /**
* * Extend {@link org.zkoss.zul.Tab}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public class Tab extends org.zkoss.zul.Tab public class Tab extends org.zkoss.zul.Tab
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -7504310693884092219L; private static final long serialVersionUID = -7504310693884092219L;
private boolean isDisableDraggDrop = false; private boolean isDisableDraggDrop = false;
public Tab(String str) /**
* @param label
*/
public Tab(String label)
{ {
this.setLabel(str); this.setLabel(label);
} }
/**
* Default constructor
*/
public Tab() public Tab()
{ {
} }
/**
* Set decorator for tab label
* @param decorateInfo
*/
public void setDecorateInfo (DecorateInfo decorateInfo){ public void setDecorateInfo (DecorateInfo decorateInfo){
if (decorateInfo != null) if (decorateInfo != null)
decorateInfo.decorate(this); decorateInfo.decorate(this);
@ -78,13 +87,16 @@ public class Tab extends org.zkoss.zul.Tab
} }
} }
/**
* @return true if dragged and drop is disable
*/
public boolean isDisableDraggDrop() { public boolean isDisableDraggDrop() {
return isDisableDraggDrop; return isDisableDraggDrop;
} }
/** /**
* home tab don't want to drag and drop. * home tab don't want to drag and drop.
* {@link Tab} like that can be set true for this properties * {@link Tab} like that can be set true for this properties.
* @param isDisableDraggDrop * @param isDisableDraggDrop
*/ */
public void setDisableDraggDrop(boolean isDisableDraggDrop) { public void setDisableDraggDrop(boolean isDisableDraggDrop) {
@ -92,7 +104,7 @@ public class Tab extends org.zkoss.zul.Tab
} }
/** /**
* class contain decorate info * class contain decorate info.<br/>
* at the moment, has only image info * at the moment, has only image info
* at the moment, it's use to transfer decorate info from info window, standard window, report, process,... to tab * at the moment, it's use to transfer decorate info from info window, standard window, report, process,... to tab
* @author hieplq * @author hieplq
@ -102,6 +114,9 @@ public class Tab extends org.zkoss.zul.Tab
private String imageKey; private String imageKey;
private URL imageIntenalUrl; private URL imageIntenalUrl;
/**
* @param comp
*/
public void decorate (LabelImageElement comp){ public void decorate (LabelImageElement comp){
if (imageIntenalUrl != null) { if (imageIntenalUrl != null) {
if (ThemeManager.isUseFontIconForImage()) { if (ThemeManager.isUseFontIconForImage()) {
@ -119,6 +134,9 @@ public class Tab extends org.zkoss.zul.Tab
} }
} }
/**
* @param imageData MImage
*/
public DecorateInfo (MImage imageData){ public DecorateInfo (MImage imageData){
if (imageData != null) { if (imageData != null) {
imageIntenalUrl = ManageImageCache.getImageInternalUrl(imageData); imageIntenalUrl = ManageImageCache.getImageInternalUrl(imageData);
@ -127,6 +145,9 @@ public class Tab extends org.zkoss.zul.Tab
} }
} }
/**
* @param imagePath Image URL
*/
public DecorateInfo (String imagePath){ public DecorateInfo (String imagePath){
if (imagePath != null) { if (imagePath != null) {
imageIntenalUrl = ManageImageCache.getImageInternalUrl(imagePath); imageIntenalUrl = ManageImageCache.getImageInternalUrl(imagePath);
@ -136,14 +157,19 @@ public class Tab extends org.zkoss.zul.Tab
} }
/** /**
* Helper method for create decorate info from adWindow info * Helper method to create decorate info from adWindow info
* @param adWindow * @param adWindow
* @return * @return DecorateInfo
*/ */
public static DecorateInfo get (ADWindow adWindow){ public static DecorateInfo get (ADWindow adWindow){
return adWindow == null?null:new DecorateInfo(adWindow.getMImage()); return adWindow == null?null:new DecorateInfo(adWindow.getMImage());
} }
/**
* Create DecorateInfo from Info Window.
* @param mInfo
* @return DecorateInfo
*/
public static DecorateInfo get (MInfoWindow mInfo){ public static DecorateInfo get (MInfoWindow mInfo){
if (mInfo != null) { if (mInfo != null) {
@ -220,9 +246,10 @@ public class Tab extends org.zkoss.zul.Tab
} }
/** /**
* http://tracker.zkoss.org/browse/ZK-3705 * http://tracker.zkoss.org/browse/ZK-3705.<br/>
* change default behavior to get prev tab is new active tab * Select next active tab.<br/>
* @return * Replace the default algorithm uses by Zk (org.zkoss.zul.Tab.selectNextTab()).
* @return org.zkoss.zul.Tab
*/ */
protected org.zkoss.zul.Tab selectNextTabWR() { protected org.zkoss.zul.Tab selectNextTabWR() {
Tabbox idTabbox = null; Tabbox idTabbox = null;

View File

@ -31,28 +31,39 @@ import org.zkoss.zul.Tabpanels;
import org.zkoss.zul.Tabs; import org.zkoss.zul.Tabs;
/** /**
* * Extend {@link org.zkoss.zul.Tabbox}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event> public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 1400484283064851775L; private static final long serialVersionUID = 1400484283064851775L;
private boolean isSupportTabDragDrop = false; private boolean isSupportTabDragDrop = false;
private boolean isActiveBySeq = false; private boolean isActiveBySeq = false;
private boolean isCheckVisibleOnlyForNextActive = true; private boolean isCheckVisibleOnlyForNextActive = true;
/**
* Deque of tab by selection sequence. Each time when a Tab is selected by user, the Tab is push to front of queue.
*/
private Deque<Tab> activeTabSeq = new ArrayDeque<>(); private Deque<Tab> activeTabSeq = new ArrayDeque<>();
/**
* Default constructor
*/
public Tabbox () { public Tabbox () {
super(); super();
this.addEventListener(Events.ON_SELECT, this); this.addEventListener(Events.ON_SELECT, this);
} }
/**
* Get tab panel at index
* @param index
* @return Tabpanel. Throw IndexOutOfBoundsException if index is invalid.
*/
public Tabpanel getTabpanel(int index) public Tabpanel getTabpanel(int index)
{ {
try try
@ -67,23 +78,32 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
} }
} }
/**
* @return selected Tabpanel
*/
public Tabpanel getSelectedTabpanel() public Tabpanel getSelectedTabpanel()
{ {
return getTabpanel(this.getSelectedIndex()); return getTabpanel(this.getSelectedIndex());
} }
/**
* @return true if drag and drop of tab is enable
*/
public boolean isSupportTabDragDrop() { public boolean isSupportTabDragDrop() {
return isSupportTabDragDrop; return isSupportTabDragDrop;
} }
/** /**
* let support drag&amp;drop {@link Tab} * Set enable/disable the drag and drop of {@link Tab}
* @param isSupportTabDragDrop * @param isSupportTabDragDrop
*/ */
public void setSupportTabDragDrop(boolean isSupportTabDragDrop) { public void setSupportTabDragDrop(boolean isSupportTabDragDrop) {
this.isSupportTabDragDrop = isSupportTabDragDrop; this.isSupportTabDragDrop = isSupportTabDragDrop;
} }
/**
* Send onPageAttached event
*/
@Override @Override
public void onPageAttached(Page newpage, Page oldpage) { public void onPageAttached(Page newpage, Page oldpage) {
super.onPageAttached(newpage, oldpage); super.onPageAttached(newpage, oldpage);
@ -91,6 +111,9 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
} }
/**
* Send onPageDetached event
*/
@Override @Override
public void onPageDetached(Page page) { public void onPageDetached(Page page) {
super.onPageDetached(page); super.onPageDetached(page);
@ -109,10 +132,8 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
Iterator itPrevSelectedTab = selectEvent.getPreviousSelectedItems().iterator(); Iterator itPrevSelectedTab = selectEvent.getPreviousSelectedItems().iterator();
if (itPrevSelectedTab.hasNext()) { if (itPrevSelectedTab.hasNext()) {
activeTabSeq.push((Tab)itPrevSelectedTab.next()); activeTabSeq.push((Tab)itPrevSelectedTab.next());
} }
}
}
} }
/** /**
@ -126,17 +147,25 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
super.setSelectedTab(tab); super.setSelectedTab(tab);
} }
/**
* @return true if set next active tab using {@link #activeTabSeq}
*/
public boolean isActiveBySeq() { public boolean isActiveBySeq() {
return isActiveBySeq; return isActiveBySeq;
} }
/**
* Enable/disable the use of {@link #activeTabSeq} for the setting of next active tab.
* @param isActiveBySeq
*/
public void setActiveBySeq(boolean isActiveBySeq) { public void setActiveBySeq(boolean isActiveBySeq) {
this.isActiveBySeq = isActiveBySeq; this.isActiveBySeq = isActiveBySeq;
} }
/** /**
* select next active tab by order store on stack folow FILO * Get next active tab by selection sequence store on {@link #activeTabSeq}.
* @return * @param currentTab current Tab to skip/ignore
* @return Tab or null if no valid candidate from {@link #activeTabSeq}.
*/ */
public Tab getNextActiveBySeq (Tab currentTab) { public Tab getNextActiveBySeq (Tab currentTab) {
Tab cadidateTabActive = null; Tab cadidateTabActive = null;
@ -146,8 +175,8 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
// move disable item to last stack it can be active late // move disable item to last stack it can be active late
cadidateTabActive = activeTabSeq.pop(); cadidateTabActive = activeTabSeq.pop();
activeTabSeq.addLast(cadidateTabActive); activeTabSeq.addLast(cadidateTabActive);
}else if (cadidateTabActive.getParent() == null || currentTab == cadidateTabActive) {// when call close other tab menu, remain tab = first tab on stack, so have to ignore it when find next tab }else if (cadidateTabActive.getParent() == null || currentTab == cadidateTabActive) {
activeTabSeq.pop();// this tab is close by code or by close at unselected state so just remove it from stack activeTabSeq.pop(); //not attached to page or == currentTab, remove
}else { }else {
return activeTabSeq.pop(); return activeTabSeq.pop();
} }
@ -157,20 +186,22 @@ public class Tabbox extends org.zkoss.zul.Tabbox implements EventListener<Event>
} }
/** /**
* activeTabSeq is maintain by selected tab event, so when close by code or close on unselected state should call this function to save memory<br/> * {@link #activeTabSeq} is maintain by selected tab event, so when a tab is close, code should call this function to save memory<br/>
* in case don't call it, it still manage from {@link #getNextActiveBySeq(Tab)}
* @param closeTab * @param closeTab
*/ */
public void removeTabFromActiveSeq (Tab closeTab) { public void removeTabFromActiveSeq (Tab closeTab) {
activeTabSeq.remove(closeTab); activeTabSeq.remove(closeTab);
} }
/**
* @return true if {@link #activeTabSeq} should ignore invisible tab.
*/
public boolean isCheckVisibleOnlyForNextActive() { public boolean isCheckVisibleOnlyForNextActive() {
return isCheckVisibleOnlyForNextActive; return isCheckVisibleOnlyForNextActive;
} }
/** /**
* Ignore invisible tab for next active by seq * Ignore invisible tab for next active by selection sequence
* @param isVisibleOnly * @param isVisibleOnly
*/ */
public void setCheckVisibleOnlyForNextActive(boolean isVisibleOnly) { public void setCheckVisibleOnlyForNextActive(boolean isVisibleOnly) {

View File

@ -25,7 +25,7 @@ import org.zkoss.zk.ui.IdSpace;
import org.zkoss.zul.Tab; import org.zkoss.zul.Tab;
/** /**
* * Extend {@link org.zkoss.zul.Tabpanel}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -33,18 +33,23 @@ import org.zkoss.zul.Tab;
public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace, ISupportMask public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace, ISupportMask
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -1057250877531248907L; private static final long serialVersionUID = -1057250877531248907L;
/** optional onClose handler */
private ITabOnCloseHandler onCloseHandler = null; private ITabOnCloseHandler onCloseHandler = null;
private boolean enabled; private boolean enabled;
@Deprecated
private int tabLevel; private int tabLevel;
protected ShowMaskWrapper showMaskWrapper = new ShowMaskWrapper(this); protected ShowMaskWrapper showMaskWrapper = new ShowMaskWrapper(this);
/**
* @return true if enable, false otherwise
*/
public boolean isEnabled() public boolean isEnabled()
{ {
return enabled; return enabled;
@ -52,31 +57,46 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace, ISuppor
@Override @Override
public boolean setVisible(boolean visible) { public boolean setVisible(boolean visible) {
// TODO Auto-generated method stub
return super.setVisible(visible); return super.setVisible(visible);
} }
@Override @Override
protected void setVisibleDirectly(boolean visible) { protected void setVisibleDirectly(boolean visible) {
// TODO Auto-generated method stub
super.setVisibleDirectly(visible); super.setVisibleDirectly(visible);
} }
/**
* Enable/disable tab panel
* @param enabled
*/
public void setEnabled(boolean enabled) public void setEnabled(boolean enabled)
{ {
this.enabled = enabled; this.enabled = enabled;
} }
/**
* @return AD_Tab Tab level
*/
@Deprecated
public int getTabLevel() public int getTabLevel()
{ {
return tabLevel; return tabLevel;
} }
/**
* Set AD_Tab tab level
* @param l Tab level
*/
@Deprecated
public void setTabLevel(int l) public void setTabLevel(int l)
{ {
tabLevel = l; tabLevel = l;
} }
/**
* Call {@link #onCloseHandler} (if not null).<br/>
* If {@link #onCloseHandler} is null, close linked tab.
*/
public void onClose() { public void onClose() {
if (onCloseHandler != null) { if (onCloseHandler != null) {
onCloseHandler.onClose(this); onCloseHandler.onClose(this);
@ -87,6 +107,10 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel implements IdSpace, ISuppor
} }
} }
/**
* Set on close handler
* @param handler ITabOnCloseHandler
*/
public void setOnCloseHandler(ITabOnCloseHandler handler) { public void setOnCloseHandler(ITabOnCloseHandler handler) {
this.onCloseHandler = handler; this.onCloseHandler = handler;
} }

View File

@ -18,7 +18,7 @@
package org.adempiere.webui.component; package org.adempiere.webui.component;
/** /**
* * Extend {@link org.zkoss.zul.Tabpanels}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007 * @date Feb 25, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
@ -26,10 +26,13 @@ package org.adempiere.webui.component;
public class Tabpanels extends org.zkoss.zul.Tabpanels public class Tabpanels extends org.zkoss.zul.Tabpanels
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = -2520923256815587165L; private static final long serialVersionUID = -2520923256815587165L;
/**
* Default constructor
*/
public Tabpanels() public Tabpanels()
{ {
super(); super();

View File

@ -28,27 +28,29 @@ import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Tab; import org.zkoss.zul.Tab;
import org.zkoss.zul.Tabpanels; import org.zkoss.zul.Tabpanels;
/** /**
* * Extend {@link org.zkoss.zul.Tabs}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a> * @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 2, 2007 * @date Mar 2, 2007
* @version $Revision: 0.10 $ * @version $Revision: 0.10 $
*/ */
public class Tabs extends org.zkoss.zul.Tabs implements EventListener<Event> public class Tabs extends org.zkoss.zul.Tabs implements EventListener<Event>
{ {
/** /**
* * generated serial id
*/ */
private static final long serialVersionUID = 4939779587719677815L; private static final long serialVersionUID = 4939779587719677815L;
/**
* Default constructor
*/
public Tabs() public Tabs()
{ {
super(); super();
} }
/** /**
* override to set drag/drop for {@link Tab} already add to {@link Tabs} before {@link Tabs} add to {@link Tabbox} * override to set drag/drop for {@link Tab} already added to {@link Tabs} before {@link Tabs} added to {@link Tabbox}
*/ */
@Override @Override
public void setParent(Component parent) { public void setParent(Component parent) {
@ -144,7 +146,7 @@ public class Tabs extends org.zkoss.zul.Tabs implements EventListener<Event>
if (dropComp instanceof Tab) { if (dropComp instanceof Tab) {
dropIndex = this.getChildren().indexOf(dropComp); dropIndex = this.getChildren().indexOf(dropComp);
dropPanel = tabpanels.getChildren().get(dropIndex); dropPanel = tabpanels.getChildren().get(dropIndex);
}// other case is drop to tabs }// else is drop to tabs
int draggIndex = this.getChildren().indexOf(draggComp); int draggIndex = this.getChildren().indexOf(draggComp);
Component draggPanel = tabpanels.getChildren().get(draggIndex); Component draggPanel = tabpanels.getChildren().get(draggIndex);

Some files were not shown because too many files have changed in this diff Show More