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;
/**
*
* Entry point for iDempiere web client
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
@ -90,10 +90,10 @@ import org.zkoss.zul.Window;
*/
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";
/** 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";
/**
@ -101,28 +101,34 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
*/
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";
/** org.zkoss.zk.ui.WebApp.name preference from zk.xml */
public static String APP_NAME = null;
/** Match to version at lang-addon.xml */
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";
/** login and role selection window **/
/** login and role selection window */
private WLogin loginDesktop;
/** client info from browser **/
/** client info from browser */
private ClientInfo clientInfo = new ClientInfo();
/** Language for current session */
private String langSession;
/** Current login user's preference */
private UserPreference userPreference;
/** User preference DB model */
private MUserPreference userPreferences;
/** Global key listener */
private Keylistener keyListener;
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")
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";
/** the use of event thread have been deprecated, this should always be false **/
private static boolean eventThreadEnabled = false;
/** Parameters map from browser URL */
private ConcurrentMap<String, String[]> m_URLParameters;
/** Login completed event **/
/** Login completed event */
private static final String ON_LOGIN_COMPLETED = "onLoginCompleted";
/**
@ -149,7 +156,7 @@ public class AdempiereWebUI extends Window implements EventListener<Event>, IWeb
this.setVisible(false);
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());
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 locale
* @param properties

View File

@ -29,17 +29,17 @@ import org.zkoss.zk.ui.WebApp;
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
*
*/
public class DefaultWebAppInit implements WebAppInit {
/** AD_SysConfig change listener */
private static SystemConfigHandler systemConfigChangeHandler;
protected WebApp webApp = null;
/**
* Register listen model change
* Register model change listener
*/
@Override
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
*
*/
@ -177,7 +177,7 @@ public class DefaultWebAppInit implements WebAppInit {
*/
protected void afterChange (PO po){
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())){
String configAppname = ((X_AD_SysConfig) po).getValue();
webApp.setAppName(configAppname);

View File

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

View File

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

View File

@ -318,17 +318,18 @@ public final class LayoutUtils {
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.
* when ownModel == {@link #OVERLAP_SELF}, window show overlap childOfOwn,
* when childOfOwn doesn't implement {@link ISupportMask} make new {@link Mask} object to make mask layout
* ownModel == {@link #OVERLAP_ALL_PAGE}, window show overlap all page
* ownModel == {@link #OVERLAP_TAB_PANEL}, window show overlap tabPanel
* ownModel == {@link #OVERLAP_PARENT}, search near parent of childOfOwn implement {@link ISupportMask} if not exist user as OVERLAP_ALL_PAGE
* show window with a mask below. Depends on ownModel flag, mask is shown over tabPanel, all window or over a component.
* <pre>
* when ownModel is
* - {@link #OVERLAP_SELF}, mask childOfOwn. if childOfOwn doesn't implement {@link ISupportMask}, make new {@link Mask} object to mask it
* - {@link #OVERLAP_ALL_PAGE}, window show 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 childOfOwn
* @param childOfOwn Component below window
* @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.
* other return null.
* @return when show success return ISupportMask object, use {@link ISupportMask#hideMask()} to hide mask.
*/
public static ISupportMask showWindowWithMask(Window window, Component childOfOwn, int ownModel){
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
* @param child
* @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
* @param grid
* @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
* @param grid
* @param min
@ -550,7 +551,7 @@ public final class LayoutUtils {
}
/**
* find first popup ancestor of comp
* find first Popup ancestor of comp
* @param comp
* @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
*/
public class LoggedSessionListener implements HttpSessionListener, ServletContextListener, ServerStateChangeListener{
/** Http Session Id:HttpSession */
private static Hashtable<String, HttpSession> AD_SessionList = new Hashtable<String, HttpSession>();
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() {
if (!Adempiere.isStarted())
{
@ -124,6 +128,11 @@ public class LoggedSessionListener implements HttpSessionListener, ServletContex
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) {
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);

View File

@ -21,8 +21,8 @@ import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.util.Clients;
/**
* Helper class for {@link ISupportMask} implementation
* Just make a instance of this class and let it do everything
* Helper class for {@link ISupportMask} implementation.
* Just make a instance of this class and let it do everything.
* @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
* @return
* @return true if flag exists
*/
public static boolean hasFlagShowMask (Component comp){
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(),
Attribute, DisplayAttribute, Value, DisplayValue,
displayType, AD_Reference_ID, ref);
} // create
} // start
/** The Name of the Dialog */
public static final String NAME = "ValuePreference";
@ -438,7 +438,7 @@ public class ValuePreference extends Window implements EventListener<Event>
} // dynInit
/**
* Action Listener
* Event Listener
* @param e event
*/
public void onEvent(Event e) throws Exception
@ -573,9 +573,9 @@ public class ValuePreference extends Window implements EventListener<Event>
} // delete
/**
* Get Context Key
* preferences in context update follow key.
* they load when login, and update when change.
* Get Context Key.
* Preferences in context update follow key.
* They load when login, and update when change.
* @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()}
* @return Context Key

View File

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

View File

@ -42,13 +42,13 @@ import org.zkoss.zul.Window;
*/
public class WLogin extends AbstractUIPart
{
/** IWebClient instance ({@link AdempiereWebUI}) **/
/** IWebClient instance ({@link AdempiereWebUI}) */
private IWebClient app;
/** Main layout **/
/** Main layout */
private Borderlayout layout;
@Deprecated(forRemoval = true, since = "11")
private Window browserWarningWindow;
/** embedded window for login and role selection **/
/** embedded window for login and role selection */
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
protected Component doCreatePart(Component parent)

View File

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

View File

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

View File

@ -58,10 +58,10 @@ public class Actions {
}
/**
* Image name: actionId+"24.png".
* Get image from current theme or plugin resource.
* Image name: actionId+"24.png".<br/>
* 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
* /action/images/{image name}
* /action/images/{image name}.
* @param actionId
* @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).
*
* 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>
* @date Feb 25, 2007
* @version $Revision: 0.10 $

View File

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

View File

@ -48,9 +48,6 @@ import org.zkoss.zul.Vlayout;
/**
* 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:hengsin@gmail.com">Low Heng Sin</a>
* @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.apps.AEnv;
import org.adempiere.webui.component.Combobox;
import org.adempiere.webui.component.FToolbar;
import org.adempiere.webui.component.Tabpanel;
import org.adempiere.webui.component.ToolBar;
import org.adempiere.webui.component.ToolBarButton;
import org.adempiere.webui.event.ToolbarListener;
import org.adempiere.webui.part.WindowContainer;
@ -85,7 +85,7 @@ import org.zkoss.zul.impl.LabelImageElement;
* @author Cristina Ghita, www.arhipac.ro
* <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

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).
*
* 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:hengsin@gmail.com">Low Heng Sin</a>
* @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";
/** 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";
/**
* 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
*/
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);
}
/** Env ctx **/
/** Env ctx */
private Properties ctx;
/** VO for AD Window **/
/** VO for AD Window */
private GridWindow gridWindow;
/** status bar for message and record info **/
/** status bar for message and record info */
protected StatusBar statusBar;
/** UI part for AD_Tabs **/
/** UI part for AD_Tabs */
protected IADTabbox adTabbox;
/** register window (desktop tab) no **/
/** register window (desktop tab) no */
private int curWindowNo;
/**
@ -221,25 +218,25 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
*/
private int m_onlyCurrentDays = 0;
/** true if find window cancel by user **/
/** true if find window cancel by user */
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;
/** true when initial query for first tab is running **/
/** true when initial query for first tab is running */
private boolean m_queryInitiating;
/** path to selected tab **/
/** path to selected tab */
protected BreadCrumb breadCrumb;
/** AD_Window.AD_Window_ID **/
/** AD_Window.AD_Window_ID */
private int adWindowId;
/** image for window title **/
/** image for window title */
private MImage image;
/** delete confirmation logic for selected tab **/
/** delete confirmation logic for selected tab */
private String deleteConfirmationLogic;
/**
@ -252,7 +249,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
*/
protected ArrayList <Integer> quickFormOpenTabs = new ArrayList <Integer>();
/** track last focus field editor component **/
/** track last focus field editor component */
protected Component lastFocusEditor = null;
/**
@ -811,10 +808,9 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
/**
* Show initial find window for first tab (if necessary)
*
* @param query
* initial query
* @param mTab
* tab
* @param query initial query
* @param mTab tab
* @param callback callback for query to apply, must not be null
* @return query or null
*/
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()
*/
@Override
@ -1071,7 +1068,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
protected ADWindow adwindow;
//true if confirmation for exit dialog is visible
/** true if confirmation for exit dialog is visible */
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()
{
@ -1506,7 +1503,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
* Change active tab to newTabIndex.
* Delegate to {@link #setActiveTab0(int, int, Callback)}
* @param newTabIndex
* @param callback
* @param callback optional 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
* @param callback
* @param callback callback for result of execution, must not be null
*/
public void saveAndNavigate(final Callback<Boolean> callback) {
if (adTabbox != null)
@ -1581,7 +1578,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
* Change selected tab from oldTabIndex to newTabIndex
* @param oldTabIndex
* @param newTabIndex
* @param callback
* @param callback optional callback for result of execution
*/
private void setActiveTab0(int oldTabIndex, int newTabIndex,
final Callback<Boolean> callback) {
@ -2128,7 +2125,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
/**
* Auto save current changes (if auto save is enable).
* Delegate to {@link #asyncAutoSave()}
* @param e
* @param e DataStatusEvent
*/
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()))) {
@ -2198,7 +2195,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
* Refresh all row.
* Delegate to {@link #doOnRefresh(boolean)}
* @param fireEvent
* @param saveCurrentRow
* @param saveCurrentRow if true, save before refresh
*/
public void onRefresh(final boolean fireEvent, final boolean saveCurrentRow)
{
@ -2785,7 +2782,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
* @param navigationEvent
* @param newRecord
* @param wasChanged
* @param callback
* @param callback optional callback for result of save
*/
private void onSave0(boolean onSaveEvent, boolean navigationEvent,
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()
*/
@Override
@ -3174,7 +3172,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
postCallback.onCallback(false);
}
}
//
/**
* Delegate to {@link #onPrintCallback(Callback)}
@ -3212,9 +3209,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
private void onPrintCallback(final Callback<Boolean> postCallback) {
//Get process defined for this tab
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)
{
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);
if (dialog.isValid()) {
//dialog.setWidth("500px");
dialog.setBorder("normal");
getComponent().getParent().appendChild(dialog);
showBusyMask(dialog);
@ -3323,7 +3318,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
}
// Elaine 2008/07/17
/**
* @see ToolbarListener#onActiveWorkflows()
*/
@ -3344,7 +3338,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
}
}
//
/**
* Close popup for toolbar button
* @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);
}
}
//
// Elaine 2008/07/22
/**
* @see ToolbarListener#onProductInfo()
*/
@ -3389,10 +3381,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
closeToolbarPopup("ProductInfo");
InfoPanel.showPanel(I_M_Product.Table_Name);
}
//
// Elaine 2008/07/28
/**
* Delegate to {@link WArchive}
* @see ToolbarListener#onArchive()
@ -3409,7 +3398,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
}
//
/**
* Delegate to {@link ExportAction}
*/
@ -3508,7 +3496,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
getCurrentFindWindow().dispose();
}
/**************************************************************************
/**
* Execute action for button.
* With the exception of zoom to record_id, delegate to {@link #actionButton0(String, IProcessButton)}.
* @param wButton {@link IProcessButton}
@ -3568,7 +3556,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}
}
/**************************************************************************
/**
* Execution action of button.
* Delegate to {@link #executeButtonProcess(IProcessButton, boolean, int, int, boolean)} for process
* @param col column name
@ -3998,7 +3986,6 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
if (dialog.isValid())
{
//dialog.setWidth("500px");
dialog.setBorder("normal");
getComponent().getParent().appendChild(dialog);
if (ClientInfo.isMobile())
@ -4109,14 +4096,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
template.run();
}
/**************************************************************************
* 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.
/**
* Process Callout(s).
*
* @param field field
* @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}
*/
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.component.ADTabListModel;
import org.adempiere.webui.component.ADTabListModel.ADTabLabel;
import org.adempiere.webui.component.Tabbox;
import org.adempiere.webui.util.ZKUpdateUtil;
import org.adempiere.webui.window.Dialog;
import org.compiere.model.DataStatusEvent;
@ -56,8 +57,8 @@ import org.zkoss.zul.Vlayout;
/**
* 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.
* Child tabs of selected tab is shown in {@link DetailPane} inside {@link ADTabpanel}.
* 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} using {@link Tabbox}.
*
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</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.
* when display is boolean or button, return correspond component
* other return a label with text get from {@link #getDisplayText(Object, GridField, int, boolean)}
* Get component to display value of a field.<br/>
* When display type is boolean or button, return corresponding component.<br/>
* 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 value
* @param gridField
@ -347,7 +348,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
if (component instanceof Html){
((Html)component).setContent(text);
}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;
/**
* list field display in grid mode, in case user customize grid
* this list container only display list.
* fields display in grid mode, in case user customize grid,
* this list include only display fields.
*/
private GridField[] gridFields;

View File

@ -128,7 +128,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
private ProcessInfo m_pi = null;
/** if true, auto call {@link #dispose()} in {@link #ON_COMPLETE_EVENT} handler. **/
private boolean m_disposeOnComplete;
/** Panel for process paramters **/
/** Panel for process parameters **/
private ProcessParameterPanel parameterPanel = null;
/** Checkbox to toggle running process/report as background job **/
private Checkbox runAsJobField = null;
@ -181,7 +181,7 @@ public abstract class AbstractProcessDialog extends Window implements IProcessUI
* @param pi
* @param autoStart
* @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)
{

View File

@ -139,7 +139,6 @@ public class WPluginManager extends ADForm implements EventListener<Event> {
ZKUpdateUtil.setVflex(pluginsTable, "1");
ZKUpdateUtil.setHflex(pluginsTable, "1");
refreshPluginTable();
pluginsTable.autoSize();
pluginsTable.addEventListener(Events.ON_SELECT, this);
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
/**
* Init Graph Display
* Init Document Status Display
*/
private void init()
{
@ -150,7 +150,7 @@ public class WDocumentStatusIndicator extends Panel implements EventListener<Eve
this.addEventListener(Events.ON_CLICK, this);
}
@Override
public void onEvent(Event event) throws Exception
{
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() {
MDocumentStatus refresh_documentStatus = MDocumentStatus.get(Env.getCtx(), m_documentStatus.getPA_DocumentStatus_ID());
if(refresh_documentStatus != null) {
@ -179,13 +182,16 @@ public class WDocumentStatusIndicator extends Panel implements EventListener<Eve
statusCount = MDocumentStatus.evaluate(m_documentStatus);
}
/**
* Update UI with data loaded in {@link #refresh()}
*/
public void updateUI() {
statusLabel.setText(Integer.toString(statusCount));
}
/**
* Return the count for this indicator
* @return
* @return status count
*/
public int getStatusCount() {
return statusCount;

View File

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

View File

@ -66,7 +66,7 @@ import org.zkoss.zul.Toolbar;
*/
public class WGraph extends Div implements IdSpace {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -975989183542113080L;
@ -92,7 +92,7 @@ public class WGraph extends Div implements IdSpace {
/**
* Load Performance Data
*/
ArrayList<GraphColumn> list = new ArrayList<GraphColumn>();
protected ArrayList<GraphColumn> list = new ArrayList<GraphColumn>();
private boolean m_chartSelection;
@ -104,7 +104,7 @@ public class WGraph extends Div implements IdSpace {
private String m_yAxisLabel;
public DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
protected DecimalFormat format = DisplayType.getNumberFormat(DisplayType.Amount);
/**
* Constructor
@ -219,6 +219,9 @@ public class WGraph extends Div implements IdSpace {
}
}
/**
* Load MMeasure data for {@link #m_goal}.
*/
private void loadData() {
// Calculated
MMeasure measure = m_goal.getMeasure();
@ -256,6 +259,10 @@ public class WGraph extends Div implements IdSpace {
}
} // loadData
/**
* Render chart to {@link #panel}.
* @param type optional chart type. if null, fallback to m_goal.getChartType
*/
private void renderChart(String type) {
int width = 560;
int height = 400;
@ -398,6 +405,10 @@ public class WGraph extends Div implements IdSpace {
return array;
}
/**
* Render {@link #m_goal} data in html table.
* @param parent
*/
private void renderTable(Component parent) {
Div div = new 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.Label;
/**
* Panel with one or more {@link WPerformanceIndicator}
*/
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;
/**
* 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[]
*/
public static MGoal[] loadGoal()
@ -136,7 +142,7 @@ public class WPAPanel extends Panel implements EventListener<Event>
} // init
/**
* Event Listener for Drill Down
* Open {@link WPerformanceDetail}
* @param e event
*/
@Override

View File

@ -33,15 +33,20 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Div;
import org.zkoss.zul.Label;
/**
* Dashboard gadget panel for individual {@link WPerformanceIndicator}
*/
public class WPAWidget extends Panel {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 5684412399657327777L;
/**************************************************************************
* Constructor
/**
* @param goal
* @param options
* @param 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 options
*/

View File

@ -5,8 +5,7 @@ import org.adempiere.webui.session.SessionManager;
import org.compiere.model.MGoal;
/**
* Performance Detail Frame.
* BarPanel for Drill-Down
* Window with Chart and Details for {@link MGoal}
*
* @author Jorg Janke
* @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
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 3460594735973451874L;
/**
* Constructor.
* Called from PAPanel, ViewPI (Performance Indicator)
* Called from {@link WPAPanel} and {@link WPAWidget}
* @param goal goal
*/
public WPerformanceDetail (MGoal goal)
@ -28,12 +27,12 @@ public class WPerformanceDetail extends Window
super();
setTitle(goal.getName());
WGraph barPanel = new WGraph(goal, 0, true, false, true, true);
appendChild(barPanel);
WGraph graph = new WGraph(goal, 0, true, false, true, true);
appendChild(graph);
this.setAttribute(Window.MODE_KEY, Window.MODE_EMBEDDED);
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);
} // PerformanceDetail
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -66,27 +66,32 @@ import org.zkoss.zul.Toolbarbutton;
import org.zkoss.zul.Vbox;
/**
*
* Workflow editor form
* @author Low Heng Sin
*
*/
@org.idempiere.ui.zk.annotation.Form(name = "org.compiere.apps.wf.WFPanel")
public class WFEditor extends ADForm {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 4293422396394778274L;
/** Workflows dropdown list */
private Listbox workflowList;
private int m_workflowId = 0;
private Toolbarbutton zoomButton;
private Toolbarbutton refreshButton;
private Toolbarbutton newButton;
/** Content of {@link #center} */
private Table table;
/** Center of form */
private Center center;
private MWorkflow m_wf;
private WFNodeContainer nodeContainer;
/**
* Layout form
*/
@Override
protected void initForm() {
ZKUpdateUtil.setHeight(this, "100%");
@ -159,6 +164,9 @@ public class WFEditor extends ADForm {
ZKUpdateUtil.setHeight(south, "36px");
}
/**
* Create {@link #table}
*/
private void createTable() {
table = new Table();
table.setDynamicProperty("cellpadding", "0");
@ -219,6 +227,9 @@ public class WFEditor extends ADForm {
}
}
/**
* Create new workflow node
*/
private void createNewNode() {
String nameLabel = Msg.getElement(Env.getCtx(), MWFNode.COLUMNNAME_Name);
String title = Msg.getMsg(Env.getCtx(), "CreateNewNode");
@ -268,6 +279,11 @@ public class WFEditor extends ADForm {
w.doHighlighted();
}
/**
* reload and re-render workflow nodes
* @param workflowId
* @param reread
*/
protected void reload(int workflowId, boolean reread) {
center.removeChild(table);
createTable();
@ -275,6 +291,11 @@ public class WFEditor extends ADForm {
load(workflowId, reread);
}
/**
* Load and render workflow nodes
* @param workflowId
* @param reread
*/
private void load(int workflowId, boolean reread) {
// Get Workflow
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) {
Integer AD_WF_Node_ID = (Integer) target.getAttribute("AD_WF_Node_ID");
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()
{
@ -463,9 +488,11 @@ public class WFEditor extends ADForm {
} // zoom
/**
* Add Menu Item to - add new line to node
* @param menu base menu
* @param title title
* Menu item to add line to next node or to apply actions (delete, properties or zoom) to source workflow node.
* @param menu popup menu
* @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)
{
@ -475,9 +502,10 @@ public class WFEditor extends ADForm {
} // addMenuItem
/**
* Add Menu Item to - delete line
* @param menu base menu
* @param title title
* Add Menu Item to - delete line
* @param menu popup menu
* @param title title
* @param 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;
import java.util.logging.Level;
import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Textbox;
@ -26,10 +52,12 @@ import org.zkoss.zul.Vbox;
public class WFPopupItem extends Menuitem {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -8409752634782368108L;
/** Node actions */
public static final int WFPOPUPITEM_DELETENODE = -1;
public static final int WFPOPUPITEM_PROPERTIES = -2;
public static final int WFPOPUPITEM_ZOOM = -3;
@ -41,8 +69,8 @@ public class WFPopupItem extends Menuitem {
/**
* Add Line Item
* @param title title
* @param node node
* @param AD_WF_NodeTo_ID line to
* @param node workflow node
* @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)
{
@ -64,15 +92,20 @@ public class WFPopupItem extends Menuitem {
m_AD_Workflow_ID = line.getAD_WF_Node().getAD_Workflow_ID();
} // WFPopupItem
/** The Node */
private MWFNode m_node;
/** The Line */
/** Source Workfklow Node */
private MWFNode m_node;
/** The Line to delete (if {@link #m_AD_WF_NodeTo_ID} = 0) */
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;
/**
* Execute
* Execute action for menu item
* @param wfp WFEditor
*/
public void execute(final WFEditor wfp)
{
@ -86,7 +119,8 @@ public class WFPopupItem extends Menuitem {
if (AD_Client_ID > 11)
newLine.setEntityType(MSysConfig.getValue(MSysConfig.DEFAULT_ENTITYTYPE, MEntityType.ENTITYTYPE_UserMaintained));
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);
}
// Edit Properties
@ -112,14 +146,16 @@ public class WFPopupItem extends Menuitem {
// Delete Node
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);
wfp.reload(m_AD_Workflow_ID, true);
}
// Delete Line
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);
wfp.reload(m_AD_Workflow_ID, true);
}
@ -127,6 +163,10 @@ public class WFPopupItem extends Menuitem {
log.warning("No Action??");
} // execute
/**
* Edit node properties
* @param wfp WFEditor
*/
private void editNode(final WFEditor wfp) {
String title = Msg.getMsg(Env.getCtx(), "Properties");
final Window w = new Window();

View File

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

View File

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

View File

@ -44,15 +44,14 @@ import org.zkoss.zul.Treeitem;
import org.zkoss.zul.Treerow;
/**
*
* Handle on drop event of tree node
* @author Low Heng Sin
*
*/
public class ADTreeOnDropListener implements EventListener<Event> {
private SimpleTreeModel treeModel;
private MTree mTree;
private int windowNo;
private int windowNo;
private Tree tree;
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)
{
log.info(movingNode.toString() + " to " + toNode.toString());
if (log.isLoggable(Level.INFO))
log.info(movingNode.toString() + " to " + toNode.toString());
if (movingNode == toNode)
return;
@ -111,9 +111,6 @@ public class ADTreeOnDropListener implements EventListener<Event> {
int path[] = treeModel.getPath(toNode);
Treeitem toItem = tree.renderItemByPath(path);
//tree.setSelectedItem(toItem);
//Events.sendEvent(tree, new Event(Events.ON_SELECT, tree));
MenuListener listener = new MenuListener(movingNode, toNode);
Menupopup popup = new Menupopup();
@ -133,6 +130,12 @@ public class ADTreeOnDropListener implements EventListener<Event> {
} // 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)
{
DefaultTreeNode<Object> newParent;
@ -164,8 +167,6 @@ public class ADTreeOnDropListener implements EventListener<Event> {
}
@SuppressWarnings("unused")
Treeitem movingItem = tree.renderItemByPath(path);
//tree.setSelectedItem(movingItem);
//Events.sendEvent(tree, new Event(Events.ON_SELECT, tree));
// *** Save changes to disk
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) {
StringBuilder whereClause = new StringBuilder("AD_Tree_ID=").append(mTree.getAD_Tree_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;
/**
* A custom accoridon implementation using borderlayout
* A custom accordion implementation using borderlayout
* @author hengsin
*
*/
public class Accordion extends Borderlayout implements EventListener<Event> {
/**
* generated serial id
*/
private static final long serialVersionUID = 5898232602746332810L;
private Vbox southBox;
private Vbox northBox;
/** List of label for component in {@link #componentList} */
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<Component> componentList = new ArrayList<Component>();
private int selectedIndex = -1;
/**
* default constructor
*/
public Accordion() {
North north = new North();
appendChild(north);

View File

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

View File

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

View File

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

View File

@ -18,7 +18,7 @@
package org.adempiere.webui.component;
/**
*
* Extend {@link org.zkoss.zul.Bandbox}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Mar 11, 2007
* @version $Revision: 0.10 $
@ -26,15 +26,21 @@ package org.adempiere.webui.component;
public class Bandbox extends org.zkoss.zul.Bandbox
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 5834568392276375501L;
/**
* @param enabled
*/
public void setEnabled(boolean enabled)
{
this.setDisabled(!enabled);
}
/**
* @return true if component is enabled, false otherwise
*/
public boolean isEnabled()
{
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;
import org.zkoss.zk.ui.Component;
@ -11,21 +32,29 @@ import org.zkoss.zul.South;
import org.zkoss.zul.West;
/**
* Extend {@link org.zkoss.zul.Borderlayout}
* @author teo_sarca
*
*/
public class Borderlayout extends org.zkoss.zul.Borderlayout
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -6976820221945897268L;
/**
* Default constructor
*/
public Borderlayout()
{
super();
}
/**
* Add component to North
* @param c Component
* @return this
*/
public Borderlayout appendNorth(Component c)
{
North north = getNorth();
@ -37,6 +66,12 @@ public class Borderlayout extends org.zkoss.zul.Borderlayout
north.appendChild(c);
return this;
}
/**
* Add component to West
* @param c Component
* @return this
*/
public Borderlayout appendWest(Component c)
{
West west = getWest();
@ -48,6 +83,12 @@ public class Borderlayout extends org.zkoss.zul.Borderlayout
west.appendChild(c);
return this;
}
/**
* Add component to South
* @param c Component
* @return this
*/
public Borderlayout appendSouth(Component c)
{
South south = getSouth();
@ -59,6 +100,12 @@ public class Borderlayout extends org.zkoss.zul.Borderlayout
south.appendChild(c);
return this;
}
/**
* Add component to East
* @param c Component
* @return this
*/
public Borderlayout appendEast(Component c)
{
East east = getEast();
@ -70,6 +117,12 @@ public class Borderlayout extends org.zkoss.zul.Borderlayout
east.appendChild(c);
return this;
}
/**
* Add component to Center
* @param c Component
* @return this
*/
public Borderlayout appendCenter(Component c)
{
Center center = getCenter();

View File

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

View File

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

View File

@ -20,21 +20,20 @@ import java.beans.PropertyChangeSupport;
import org.adempiere.webui.LayoutUtils;
import org.compiere.util.ValueNamePair;
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.Events;
import org.zkoss.zul.Div;
/**
* Composite component of {@link Chosenbox} and {@link Button}
* @author Low Heng Sin
*/
public class ChosenSearchBox extends Div {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -3152111756471436612L;
protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(
this);
protected PropertyChangeSupport m_propertyChangeListeners = new PropertyChangeSupport(this);
protected Chosenbox<ValueNamePair> chosenbox;
protected Button btn;
@ -55,12 +54,16 @@ public class ChosenSearchBox extends Div {
}
/**
* Set image url for button
* @param imageSrc
*/
public void setButtonImage(String imageSrc) {
btn.setImage(imageSrc);
}
/**
* Layout component
*/
private void initComponents() {
if (chosenbox == null)
chosenbox = new Chosenbox<>();
@ -106,16 +109,18 @@ public class ChosenSearchBox extends Div {
}
/**
* @return boolean
* @return true if enable, false otherwise
*/
public boolean isEnabled() {
return btn.isEnabled();
}
/**
* If evtnm is ON_CLICK, add listener to {@link #btn}, otherwise add to {@link #chosenbox}.
* @param evtnm
* @param listener
*/
@Override
public boolean addEventListener(String evtnm, EventListener<?> listener) {
if (Events.ON_CLICK.equals(evtnm)) {
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) {
m_propertyChangeListeners.addPropertyChangeListener(l);
}
/**
* Set tooltip text for {@link #chosenbox}
* @param tooltiptext
*/
public void setToolTipText(String tooltiptext) {
@ -145,6 +151,9 @@ public class ChosenSearchBox extends Div {
return btn;
}
/**
* @param flag true for grid view, false otherwise
*/
public void setTableEditorMode(boolean flag) {
if (flag) {
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;
/**
* Extend {@link org.zkoss.zul.Column}
*/
public class Column extends org.zkoss.zul.Column
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 8036743691725958481L;
/**
* default constructor
*/
public Column()
{
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;
/**
* Extend {@link org.zkoss.zul.Columns}
*/
public class Columns extends org.zkoss.zul.Columns
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 702502881459697527L;
}

View File

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

View File

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

View File

@ -17,8 +17,10 @@
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>
* @date Mar 10, 2007
* @version $Revision: 0.10 $
@ -26,15 +28,22 @@ package org.adempiere.webui.component;
public class ComboItem extends org.zkoss.zul.Comboitem
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 8483161780731035079L;
/**
* @param label
*/
public ComboItem(String label)
{
super(label);
}
/**
* @param label
* @param value
*/
public ComboItem(String label, Object value)
{
super(label);

View File

@ -30,26 +30,42 @@ import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Comboitem;
/**
*
* Extend {@link org.zkoss.zul.Combobox}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
{
/**
* generated serial id
*/
private static final long serialVersionUID = -6278632602577424842L;
/**
* Default constructor
*/
public Combobox() {
super();
override();
init();
}
/**
* @param value
* @throws WrongValueException
*/
public Combobox(String value) throws WrongValueException {
super(value);
override();
init();
}
/**
* Setup initial state of component
*/
private void init() {
//ctrl+down to open combobox dropdown
this.setCtrlKeys("^#down");
this.addEventListener(Events.ON_CTRL_KEY, e -> {
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() {
// idempiere always want to show context ever on disable control
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)
{
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)
{
ComboItem item = new ComboItem(label);
@ -97,6 +119,9 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
return item;
}
/**
* @return true if enable, false otherwise
*/
public boolean isEnabled() {
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) {
ComboItem item = new ComboItem(name, value);
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 to none if no item found matching the value given or
* value is null
* @param value Value of ListItem to set as selected
* 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
* value is null.
* @param value Value of ComboItem to set as selected
*/
public void setValue(Object value)
{
@ -157,9 +187,8 @@ public class Combobox extends org.zkoss.zul.Combobox implements IdSpace
}
/**
*
* @param value
* @return boolean
* @return true if current selected combo item is with value equal to value parameter
*/
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.Messagebox;
/**
* Application Confirm Panel
* Web UI port of the rich client's ConfirmPanel by Jorg Janke
* Confirm Panel for window, form and dialog
* @author Sendy Yagambrum
* @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";
/**
*
* generated serial id
*/
private static final long serialVersionUID = -2054986459098954685L;
@ -79,6 +78,7 @@ public final class ConfirmPanel extends Div
private boolean m_withText = false;
/** Name:Button */
private Map<String, Button> buttonMap = new HashMap<String, Button>();
private boolean m_withImage = true;
@ -116,6 +116,12 @@ public final class ConfirmPanel extends Div
return button;
}
/**
* @param name
* @param image
* @param tooltip
* @return Button
*/
public Button createButton(String name, String image, String tooltip)
{
Button button = ButtonFactory.createButton(name, image, tooltip);
@ -176,7 +182,7 @@ public final class ConfirmPanel extends Div
* @param withHistoryButton with history
* @param withZoomButton with zoom
* @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,
boolean withRefreshButton,
@ -230,25 +236,29 @@ public final class ConfirmPanel extends Div
/**
* 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)
{
this(withCancel,false,false,false,false,false);
}
//
/** Right buttons area */
private Hlayout pnlBtnRight;
/** Left buttons area */
private Hlayout pnlBtnLeft;
// IDEMPIERE-1334 center panel, contain all process button
private Hlayout pnlBtnCenter;
/** Extra sclass for button */
private String extraButtonSClass;
/** true to use {@link #SMALL_SCREEN_BUTTON_CLASS} for compact screen */
private boolean useSmallButtonClassForSmallScreen;
/**
* initialise components
* Layout panel
*/
private void init()
{
@ -257,13 +267,10 @@ public final class ConfirmPanel extends Div
pnlBtnRight = new Hlayout();
pnlBtnRight.setSclass("confirm-panel-right");
// IDEMPIERE-1334 start
pnlBtnCenter = new Hlayout();
pnlBtnCenter.setSclass("confirm-panel-center");
// IDEMPIERE-1334 end
this.appendChild(pnlBtnLeft);
// IDEMPIERE-1334
this.appendChild(pnlBtnCenter);
this.appendChild(pnlBtnRight);
this.setSclass("confirm-panel");
@ -272,38 +279,43 @@ public final class ConfirmPanel extends Div
}
/**
* IDEMPIERE-1334
* add a process button into center panel
* add button to center area of panel
* @param btName
* @param imgName
* @return
*/
public Button addButton (String btName, String imgName){
Button btProcess = createButton(btName);
Button button = createButton(btName);
// replace default image with image set at info process
if (m_withImage && imgName != null && imgName.trim().length() > 0)
{
if (ThemeManager.isUseFontIconForImage())
btProcess.setIconSclass(ThemeManager.getIconSclass(imgName));
button.setIconSclass(ThemeManager.getIconSclass(imgName));
else
btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName));
button.setImage(ThemeManager.getThemeResource("images/" + imgName));
}
addComponentsCenter(btProcess);
return btProcess;
addComponentsCenter(button);
return button;
}
/**
* add process button to center area of panel
* @param btName
* @param imgName
* @return Button
*/
public Button addProcessButton (String btName, String imgName){
Button btProcess = createButton(btName, imgName, null);
// replace default image with image set at info process
if (m_withImage && imgName != null && imgName.trim().length() > 0)
{
if (ThemeManager.isUseFontIconForImage())
btProcess.setIconSclass(ThemeManager.getIconSclass(imgName));
else
btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName));
}
addComponentsCenter(btProcess);
return btProcess;
Button btProcess = createButton(btName, imgName, null);
// replace default image with image set at info process
if (m_withImage && imgName != null && imgName.trim().length() > 0)
{
if (ThemeManager.isUseFontIconForImage())
btProcess.setIconSclass(ThemeManager.getIconSclass(imgName));
else
btProcess.setImage(ThemeManager.getThemeResource("images/" + imgName));
}
addComponentsCenter(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
*/
public void addComponentsBeforeRight(Button button)
@ -346,8 +358,7 @@ public final class ConfirmPanel extends Div
}
/**
* IDEMPIERE-1334
* add button to the center side of the confirm panel
* add button to the center area of the confirm panel
* @param 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
*/
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
*/
public void addComponentsCenter(Checkbox cb){
@ -429,6 +440,7 @@ public final class ConfirmPanel extends Div
btn.setVisible(visible);
}
}
/**
* returns whether the specified button is visible or not
* @param btnName
@ -469,6 +481,7 @@ public final class ConfirmPanel extends Div
return false;
}
}
/**
* enable specific button
* @param id button id
@ -500,8 +513,8 @@ public final class ConfirmPanel extends Div
}
/**
* enable all components
* @param enabled enabled
* enable/disable all buttons
* @param enabled true to enable, false otherwise
*/
public void setEnabledAll(boolean enabled)
{
@ -524,18 +537,16 @@ public final class ConfirmPanel extends Div
Button button = (Button)iter2.next();
button.setEnabled(enabled);
}
// IDEMPIERE-1334 start
while (iter3.hasNext())
{
Button button = (Button)iter3.next();
button.setEnabled(enabled);
}
// IDEMPIERE-1334 end
}
/**
* add action listener on the existing buttons
* @param event event
* @param listener listener
* add event listener on existing buttons
* @param event event name
* @param listener EventListener
*/
public void addActionListener(String event, EventListener<?> listener)
{
@ -558,7 +569,6 @@ public final class ConfirmPanel extends Div
Button button = (Button)iter2.next();
button.addEventListener(event, listener);
}
// IDEMPIERE-1334 start
while (iter3.hasNext())
{
Object element = iter3.next();
@ -567,12 +577,11 @@ public final class ConfirmPanel extends Div
((Button)element).addEventListener(event, listener);
}
}
// IDEMPIERE-1334 start
}
/**
* added to ease porting of swing form
* @param listener
* add ON_CLICK listener for all buttons
* @param listener EventListener
*/
public void addActionListener(EventListener<?> listener) {
addActionListener(Events.ON_CLICK, listener);
@ -594,6 +603,11 @@ public final class ConfirmPanel extends Div
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) {
for(Button btn : buttonMap.values()) {
LayoutUtils.addSclass(cls, btn);
@ -601,18 +615,27 @@ public final class ConfirmPanel extends Div
extraButtonSClass = cls;
}
/**
* Remove cls from sclass property of all buttons
* @param cls
*/
public void removeButtonSclass(String cls) {
for(Button btn : buttonMap.values()) {
LayoutUtils.removeSclass(cls, btn);
}
}
/**
* Enable the use of {@link #SMALL_SCREEN_BUTTON_CLASS} for all buttons.
*/
public void useSmallButtonClassForSmallScreen() {
useSmallButtonClassForSmallScreen = true;
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() {
return buttonMap;
}

View File

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

View File

@ -22,20 +22,23 @@ import java.util.TimeZone;
import org.zkoss.zk.ui.event.EventListener;
/**
*
* Composite component with {@link Datebox} and {@link Timebox}
* @author Low Heng Sin
*
*/
public class DatetimeBox extends Panel {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -1075410511739601354L;
private Datebox dateBox;
private Timebox timeBox;
private TimeZone timeZone;
/**
* Default constructor
*/
public DatetimeBox() {
dateBox = new Datebox();
dateBox.setCols(10);
@ -47,6 +50,9 @@ public class DatetimeBox extends Panel {
initComponents();
}
/**
* Set initial state of component
*/
private void initComponents() {
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) {
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() {
return dateBox.getText() + " " + timeBox.getText();
}
/**
* add event listener to {@link #dateBox} and {@link #timeBox}
* @param evtnm
* @param listener
* @return true if added
*/
@Override
public boolean addEventListener(String evtnm, EventListener<?> listener) {
return dateBox.addEventListener(evtnm, listener) && timeBox.addEventListener(evtnm, listener);
}
/**
* @return boolean
* @return true if enable, false otherwise
*/
public boolean isEnabled() {
return !dateBox.isReadonly();
}
/**
* Enable/disable {@link #dateBox} and {@link #timeBox}.<br/>
* Hide button of {@link #dateBox} and {@link #timeBox} if disable/readonly.
* @param 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() {
Date d = null;
@ -150,7 +164,7 @@ public class DatetimeBox extends Panel {
}
/**
*
* Set format of {@link #dateBox}
* @param dateFormat
*/
public void setDateFormat(SimpleDateFormat dateFormat) {
@ -174,8 +188,8 @@ public class DatetimeBox extends Panel {
}
/**
*
* @param tz
* Set time zone of {@link #dateBox} and {@link #timeBox}
* @param tz TimeZone
*/
public void setTimeZone(TimeZone tz) {
this.timeZone = tz;
@ -188,8 +202,7 @@ public class DatetimeBox extends Panel {
}
/**
*
* @param localTime
* @param localTime LocalDateTime
*/
public void setValueInLocalDateTime(LocalDateTime localTime) {
dateBox.setValueInLocalDateTime(localTime);
@ -197,8 +210,7 @@ public class DatetimeBox extends Panel {
}
/**
*
* @param zdt
* @param zdt ZonedDateTime
*/
public void setValueInZonedDateTime(ZonedDateTime zdt) {
dateBox.setValueInZonedDateTime(zdt);

View File

@ -12,17 +12,18 @@
*****************************************************************************/
package org.adempiere.webui.component;
import org.adempiere.webui.desktop.DefaultDesktop;
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
*
*/
public class DesktopTabpanel extends Tabpanel implements IdSpace {
/**
* generated serail version id
* generated serial id
*/
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> {
/**
*
* generated serial id
*/
private static final long serialVersionUID = 1498406053715803814L;
@ -45,28 +45,54 @@ public class DocumentLink extends A implements EventListener<Event> {
protected int recordId;
/**
* @return Record_ID
*/
public int getRecordId() {
return recordId;
}
/**
* set Record_ID
* @param recordId
*/
public void setRecordId(int recordId) {
this.recordId = recordId;
}
protected int adTableId;
/**
* @return AD_Table_ID
*/
public int getAdTableId() {
return adTableId;
}
/**
* set AD_Table_ID
* @param adTableId
*/
public void setAdTableId(int adTableId) {
this.adTableId = adTableId;
}
/**
* @param label
* @param adTableId AD_Table_ID
* @param recordId Record_ID
*/
public DocumentLink(String label, int adTableId, int recordId){
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){
super();
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.mesg.MZk;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Desktop;
import org.zkoss.zk.ui.UiException;
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
*
*/
public class DrillCommand implements AuService {
/**
* Default constructor
*/
public DrillCommand() {
}
@Override
public boolean service(AuRequest request, boolean everError) {
if (!DrillEvent.ON_DRILL_ACROSS.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;
/**
* Link to download media
* @author hengsin
*
*/
public class DynamicMediaLink extends A {
@ -33,7 +33,10 @@ public class DynamicMediaLink extends A {
private static final long serialVersionUID = 5017833977652241179L;
private AMedia media;
/**
* Default constructor
*/
public DynamicMediaLink() {
super();
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) {
super(label, image);
}
/**
* @param label
*/
public DynamicMediaLink(String label) {
super(label);
}
/**
* Set media for download
* @param media
*/
public void setMedia(AMedia media) {
this.media = media;
}

View File

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

View File

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

View File

@ -59,9 +59,8 @@ import org.zkoss.zul.event.TreeDataEvent;
*/
public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventListener<Event>, TreeitemRenderer<Object>
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 6950349031548896628L;
private static final CLogger LOG = CLogger.getCLogger(FavoriteSimpleTreeModel.class);
@ -72,7 +71,9 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
private boolean itemDraggable;
//
/**
* @param root
*/
public FavoriteSimpleTreeModel(DefaultTreeNode<Object> root)
{
super(root);
@ -122,7 +123,7 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
/**
* Creating Tree hierarchy
*
* @param root
* @param root MTreeNode
* @return {@link FavoriteSimpleTreeModel}
*/
public static FavoriteSimpleTreeModel createFrom(MTreeNode root)
@ -136,8 +137,8 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
/**
* Populate Node
*
* @param stNode
* @param root
* @param stNode Root DefaultTreeNode
* @param root Root MTreeNode
*/
private static void populate(DefaultTreeNode<Object> stNode, MTreeNode root)
{
@ -299,6 +300,10 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
}
} // onEvent
/**
* Add new node to tree
* @param newNode
*/
public void addNode(DefaultTreeNode<Object> newNode)
{
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);
} // 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)
{
return (DefaultTreeNode<Object>) (parent).getChildAt(index);
} // getChild
/**
* Open window to create new record
* @param menuID
*/
private void onNewRecord(int menuID)
{
try
@ -344,21 +359,35 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
}
} // onNewRecord
/**
* @param listener
*/
public void addOnDropEventListener(EventListener<Event> listener)
{
onDropListners.add(listener);
}
/**
* @param isDraggable
*/
public void setItemDraggable(boolean isDraggable)
{
itemDraggable = isDraggable;
}
/**
* @return true if item is draggable, false otherwise
*/
public boolean isItemDraggable()
{
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)
{
if (mt.isSummary())
@ -378,6 +407,11 @@ public class FavoriteSimpleTreeModel extends SimpleTreeModel implements EventLis
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)
{
if (mt.isSummary())

View File

@ -17,17 +17,20 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
/**
*
* Composite component of textbox and file upload button.
* @author Low Heng Sin
*
*/
public class FilenameBox extends EditorBox
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -3438731624652907300L;
/**
* Default constructor
*/
public FilenameBox()
{
super();
@ -44,8 +47,9 @@ public class FilenameBox extends EditorBox
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
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>
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 5477614056976038703L;
private Textbox txtPath = new Textbox();
/** Listbox of folders and files */
private Listbox listDir = new Listbox();
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
@ -53,13 +54,15 @@ public class FolderBrowser extends Window implements EventListener<Event>
private String path;
private File root;
/**
* Default constructor
*/
public FolderBrowser()
{
this(null, false);
}
/**
*
* @param browseForFolder
*/
public FolderBrowser(boolean browseForFolder)
@ -68,9 +71,8 @@ public class FolderBrowser extends Window implements EventListener<Event>
}
/**
*
* @param rootPath
* @param browseForFolder
* @param rootPath Optional root folder. If null, take ZK_ROOT_FOLDER_BROWSER from AD_SysConfig or iDempiere home as root folder.
* @param browseForFolder true for folder browser, false for file.
*/
public FolderBrowser(String rootPath, boolean browseForFolder)
{
@ -117,6 +119,10 @@ public class FolderBrowser extends Window implements EventListener<Event>
AEnv.showWindow(this);
}
/**
* Get files and folders under dirPath
* @param dirPath Directory path
*/
private void getFileListing(String dirPath)
{
File dir = new File(dirPath);
@ -169,6 +175,7 @@ public class FolderBrowser extends Window implements EventListener<Event>
txtPath.setValue(dir.getAbsolutePath());
}
@Override
public void onEvent(Event e) throws Exception
{
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()
{
return path;

View File

@ -28,25 +28,39 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
/**
*
* Extend {@link org.zkoss.zul.Grid}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class Grid extends org.zkoss.zul.Grid implements IdSpace
{
/**
* Generated serial id
*/
private static final long serialVersionUID = -4483759833677794926L;
/** Event Name:List&lt;EventListenerInfo&gt; */
private transient Map<String, List<EventListenerInfo>> listeners;
/**
* Default constructor
*/
public Grid() {
super();
listeners = new HashMap<String, List<EventListenerInfo>>();
}
/**
* Remove the alternate background color rendering of grid rows.
*/
public void makeNoStrip() {
setOddRowSclass("z-dummy");
}
/**
* Add and return new Rows instance
* @return Rows
*/
public Rows newRows() {
Rows rows = new Rows();
appendChild(rows);
@ -101,6 +115,11 @@ public class Grid extends org.zkoss.zul.Grid implements IdSpace
return b;
}
/**
* Copy event listeners from another grid.
* Use in the re-initialization grid view.
* @param grid
*/
public void copyEventListeners(Grid grid) {
for(String evtnm : listeners.keySet()) {
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 final int priority;
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;
import java.util.ArrayList;
@ -14,31 +40,49 @@ import org.zkoss.zul.Label;
import org.zkoss.zul.Row;
import org.zkoss.zul.Span;
/**
* Extend {@link org.zkoss.zul.Group}
*/
public class Group extends org.zkoss.zul.Group {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -6735090880559291438L;
/** {@link Row} attribute to hold visibility state of row */
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>();
/**
* Default constructor
*/
public Group() {
super();
setZclass("z-group");
}
/**
* @param label
*/
public Group(String label) {
super(label);
setZclass("z-group");
}
/**
* @param <T>
* @param label
* @param value
*/
public <T> Group(String label, T value) {
super(label, value);
setZclass("z-group");
}
/**
* @return group label
*/
public String getLabel() {
final Component cell = getFirstChild();
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);
}
/**
* @return GroupHeader
*/
private GroupHeader autoFirstCell() {
Component cell = getFirstChild();
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);
}
/**
* Set open/close state of group
* @param open true for open state, false for close state
*/
public void setOpen(boolean open) {
super.setOpen(open);
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) {
m_rows.add(row);
}
/**
* Group header component
*/
public static class GroupHeader extends Cell implements EventListener<Event>
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -4070011056533999557L;
private Span span;
@ -93,6 +151,9 @@ public class Group extends org.zkoss.zul.Group {
private String title;
private boolean open;
/**
* Default constructor
*/
public GroupHeader()
{
super();
@ -101,6 +162,9 @@ public class Group extends org.zkoss.zul.Group {
setOpen(true);
}
/**
* Layout component
*/
private void init()
{
setZclass("z-group-header");
@ -120,19 +184,33 @@ public class Group extends org.zkoss.zul.Group {
div.appendChild(lbl);
}
/**
* @return group title
*/
public String getTitle() {
return title;
}
/**
* set group title
* @param title
*/
public void setTitle(String title) {
this.title = title;
lbl.setValue(this.title);
}
/**
* @return true if open, false otherwise
*/
public boolean isOpen() {
return open;
}
/**
* Set open/close state of group
* @param open
*/
public void setOpen(boolean open) {
this.open = open;
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;
/**
*
* Extend {@link org.zkoss.zul.Label}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
@ -29,7 +29,7 @@ import org.zkoss.zk.ui.Component;
public class Label extends org.zkoss.zul.Label
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -6818124304324329510L;
@ -37,25 +37,41 @@ public class Label extends org.zkoss.zul.Label
private boolean mandatory;
/**
* Default constructor
*/
public Label()
{
super();
}
/**
* @param value
*/
public Label(String value)
{
super(value != null ? value.replaceAll("[&]", "") : null);
}
/**
* @return true if using mandatory style, false otherwise
*/
public boolean isMandatory() {
return mandatory;
}
/**
* set mandatory/optional style
* @param mandatory true for mandatory style, false for optional
*/
public void setMandatory(boolean mandatory) {
this.mandatory = mandatory;
setupMandatoryDecorator();
}
/**
* @return Decorator Component
*/
public Component getDecorator() {
return decorator;
}
@ -78,6 +94,9 @@ public class Label extends org.zkoss.zul.Label
return super.setVisible(visible);
}
/**
* Setup mandatory style decorator
*/
private void setupMandatoryDecorator() {
if (decorator == null)
createMandatoryDecorator();
@ -88,6 +107,9 @@ public class Label extends org.zkoss.zul.Label
decorator.setVisible(false);
}
/**
* Create mandatory style decorator
*/
private void createMandatoryDecorator() {
decorator = new Label("*");
((Label)decorator).setSclass("mandatory-decorator-text");
@ -103,6 +125,9 @@ public class Label extends org.zkoss.zul.Label
this.setValue(translate);
}
/**
* @return right align Label wrapped in Div
*/
public Component rightAlign() {
return LayoutUtils.makeRightAlign(this);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -33,9 +33,9 @@ import org.zkoss.zul.event.ListDataEvent;
import org.zkoss.zul.ext.Sortable;
/**
* This is a ListModel<Object> to be used with Listbox.
* The model allows for a table structure to be created, with columns
* in addition to the rows provided by {@link org.zkoss.zul.ListModelList}.
* ListModel<Object> for Listbox and provide support for the Sortable interface.<br/>
* The model allows for a table structure to be created with columns,
* in addition to the functionalities provided by {@link org.zkoss.zul.ListModelList}.
*
* @author Andrew Kimball
*
@ -43,7 +43,7 @@ import org.zkoss.zul.ext.Sortable;
public class ListModelTable extends ListModelList<Object> implements Sortable<Object>
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = 1891313647781142789L;
/** 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.
* 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
*/
@ -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.
*/
@ -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.
*/
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
*/
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
* {@link #setNoColumns(int)} is created.
* @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
{
//hot fix for:IDEMPIERE-2154 wait complete solution from zk update
if (rowCount == 0)
clearSelection();
removeRange(rowCount, currentSize);
@ -308,13 +307,18 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
return;
}
/**
* Remove WTableModelListener listener
* @param listener
*/
public void removeTableModelListener(WTableModelListener 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
*/
private void fireTableChange(WTableModelEvent event)
@ -323,8 +327,6 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
{
listener.tableChanged(event);
}
return;
}
/*
@ -343,8 +345,6 @@ public class ListModelTable extends ListModelList<Object> implements Sortable<Ob
WTableModelEvent.ALL_COLUMNS);
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)
{
sorter = lme;

View File

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

View File

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

View File

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

View File

@ -16,12 +16,12 @@ package org.adempiere.webui.component;
import org.zkoss.zul.Div;
/**
* Background mask
* @author hengsin
*
*/
public class Mask extends Div {
/**
*
* generated serial id
*/
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;");
}
/**
* Close mask
*/
public void hideMask() {
if (this.getParent() != null){
this.detach();
}
}
}
}

View File

@ -20,9 +20,8 @@ import org.zkoss.zk.ui.Page;
import org.zkoss.zul.impl.XulElement;
/**
*
* Extend {@link org.zkoss.zul.Menupopup}
* @author hengsin
*
*/
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;
/**
* 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>();
/**
* add xul element that want to use this as the context menu
* @param element
* @param element XulElement
*/
public void addContextElement(XulElement element) {
elementList.add(element);

View File

@ -55,18 +55,17 @@ import org.zkoss.zul.Vbox;
* @date Jul 31, 2007
* @contributor Andreas Sumerauer IDEMPIERE-4702
*/
public class Messagebox extends Window implements EventListener<Event>
{
/**
*
* generated serial id
*/
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 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 imgSrc = new String("");
private String msg = "";
private String imgSrc = "";
private Text lblMsg = new Text();
@ -83,6 +82,7 @@ public class Messagebox extends Window implements EventListener<Event>
private Image img = new Image();
/** button constant for button pressed by user */
private int returnValue;
@SuppressWarnings("rawtypes")
private Callback callback;
@ -127,11 +127,17 @@ public class Messagebox extends Window implements EventListener<Event>
/** Contains no symbols. */
public static final String NONE = null;
/**
* Default constructor
*/
public Messagebox()
{
super();
}
/**
* Layout dialog
*/
private void init()
{
setSclass("popup-dialog");
@ -254,21 +260,60 @@ public class Messagebox extends Window implements EventListener<Event>
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)
{
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)
{
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)
{
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)
{
this.msg = message;
@ -350,32 +395,81 @@ public class Messagebox extends Window implements EventListener<Event>
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)
{
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)
{
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)
{
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) {
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)
{
Messagebox msg = new Messagebox();
return msg.show(message, title, buttons, icon, editor, isInputMandatory, callback, modal);
}
// Andreas Sumerauer IDEMPIERE 4702
@Listen("onCancel")
public void onCancel() throws Exception
{
@ -383,7 +477,7 @@ public class Messagebox extends Window implements EventListener<Event>
close();
}
@Override
public void onEvent(Event event) throws Exception
{
if (event == null)
@ -425,6 +519,10 @@ public class Messagebox extends Window implements EventListener<Event>
validateOnClose();
}
/**
* Perform validation before closing of dialog.<br/>
* Throw {@link WrongValueException} if there's any validation error.
*/
private void validateOnClose() {
// 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() {
try {
this.detach();

View File

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

View File

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

View File

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

View File

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

View File

@ -48,14 +48,14 @@ import org.zkoss.zul.Image;
import org.zkoss.zul.Separator;
/**
*
* Dialog to display {@link ProcessInfo} details.
* @author milap.doshi
* @author Deepak Pansheriya
*/
public class ProcessInfoDialog extends Window implements EventListener<Event> {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -1712025652050086903L;
@ -63,13 +63,17 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
private Text lblMsg = new Text();
private Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
/** Button to print document from {@link #m_logs} */
private Button btnPrint = ButtonFactory.createNamedButton(ConfirmPanel.A_PRINT);
/** Info or Error image icon */
private Image img = new Image();
/** Array of ProcessInfoLog from ProcessInfo */
private ProcessInfoLog[] m_logs;
public static final String INFORMATION = "~./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;
/**
@ -97,8 +101,8 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
/**
* show result after run a process
* @param pi
* @param needFillLogFromDb
* @param pi ProcessInfo
* @param needFillLogFromDb true to load ProcessInfoLog from DB
*/
public ProcessInfoDialog(ProcessInfo pi, boolean needFillLogFromDb) {
if (needFillLogFromDb)
@ -107,10 +111,11 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
}
/**
*
* Layout dialog
* @param title
* @param header
* @param m_logs
* @param pi ProcessInfo
* @param m_logs ProcessInfoLog[]
*/
private void init(String title, String header, ProcessInfo pi, ProcessInfoLog[] m_logs) {
this.setTitle(title);
@ -120,8 +125,6 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
this.setBorder("normal");
this.setContentStyle("background-color:#ffffff;");
//this.setId(title);
lblMsg.setEncode(false);
lblMsg.setValue(header);
@ -231,6 +234,7 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
}
@Override
public void onEvent(Event event) throws Exception {
if (event == null)
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();
// Loop through all items
List<File> pdfList = new ArrayList<File>();
@ -285,8 +288,7 @@ public class ProcessInfoDialog extends Window implements EventListener<Event> {
}
/**
* Is Printable
* @return boolean
* @return true if there are printable document in {@link #m_logs}
*/
public boolean isPrintable() {
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
* @param pi
* @param pi ProcessInfo
* @param windowNo
* @param comp
* @param comp Component
* @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) {
ProcessInfoDialog dialog = new ProcessInfoDialog(pi, needFillLogFromDb);

View File

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

View File

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

View File

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

View File

@ -31,29 +31,39 @@ import org.zkoss.zul.event.ListDataEvent;
import org.zkoss.zul.ext.Sortable;
/**
*
* List model for {@link Listbox} that also implements {@link ListitemRenderer} interface.
* @author Low Heng Sin
*
*/
public class SimpleListModel extends AbstractListModel<Object> implements ListitemRenderer<Object>, ListitemRendererExt, Sortable<Object> {
/**
*
* generated serial id
*/
private static final long serialVersionUID = -572148106182756840L;
/** List backing this model instance */
protected List<Object> list;
/** Comparator for sorting */
private Comparator<Object> _sorting;
/** Sort Direction. True for Ascending, False for Descrending */
private boolean _sortDir;
/** Max length for each column (value <= 0 means no Max length) */
private int[] maxLength;
/**
* Default constructor
*/
public SimpleListModel() {
this(new ArrayList<Object>());
}
/**
* Create model from list
* @param list List<?>
*/
@SuppressWarnings("unchecked")
public SimpleListModel(List<?> list) {
this.list = (List<Object>)list;
@ -72,6 +82,13 @@ public class SimpleListModel extends AbstractListModel<Object> implements Listit
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) {
int j = maxLength;
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) {
String tooltip = null;
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");
}
/**
* Render collection of values
* @param item Listitem
* @param data Collection<?>
*/
private void renderCollection(Listitem item, Collection<?> data) {
int i = 0;
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) {
int i = 0;
for (Object col : data) {
@ -148,32 +181,57 @@ public class SimpleListModel extends AbstractListModel<Object> implements Listit
return item;
}
/**
* Set max length for each column
* @param maxLength int[]
*/
public void setMaxLength(int[] maxLength) {
this.maxLength = maxLength;
}
/**
* Append new row
* @param obj Object
*/
public void addElement(Object obj) {
list.add(obj);
int index = list.size() - 1;
fireEvent(ListDataEvent.INTERVAL_ADDED, index, index);
}
/**
* Add new row at index
* @param index
* @param obj Object
*/
public void add(int index, Object obj) {
list.add(index, obj);
fireEvent(ListDataEvent.INTERVAL_ADDED, index, index);
}
/**
* Remove all elements
*/
public void removeAllElements() {
list.clear();
fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1);
}
/**
* Remove element from list
* @param element
*/
public void removeElement(Object element) {
int index = list.indexOf(element);
list.remove(element);
fireEvent(ListDataEvent.INTERVAL_REMOVED, index, index);
}
/**
* Replace element at index
* @param element Object
* @param index List index
*/
public void setElementAt(Object element, int index) {
list.set(index, element);
fireEvent(ListDataEvent.CONTENTS_CHANGED, index, index);

View File

@ -19,6 +19,7 @@ import java.util.List;
import java.util.logging.Level;
import org.adempiere.webui.ClientInfo;
import org.adempiere.webui.adwindow.ADTreePanel;
import org.adempiere.webui.panel.TreeSearchPanel;
import org.compiere.model.MTree;
import org.compiere.model.MTreeNode;
@ -40,21 +41,27 @@ import org.zkoss.zul.Treerow;
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
*
*/
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 CLogger logger = CLogger.getCLogger(SimpleTreeModel.class);
/** True if each tree item is draggable */
private boolean itemDraggable;
/** Listeners for ON_DROP event */
private List<EventListener<Event>> onDropListners = new ArrayList<EventListener<Event>>();
/**
* @param root Root node
*/
public SimpleTreeModel(DefaultTreeNode<Object> 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);
}
/**
* @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) {
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);
}
/**
* 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) {
MTree vTree = new MTree (Env.getCtx(), AD_Tree_ID, editable, true, trxName, linkColName, linkID);
MTreeNode root = vTree.getRoot();
@ -96,11 +122,11 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
if (tree.getTreecols() == null)
{
Treecols treeCols = new Treecols();
tree.getTreecols();
tree.appendChild(treeCols);
Treecol treeCol = new Treecol();
treeCols.appendChild(treeCol);
Treecols treeCols = new Treecols();
tree.getTreecols();
tree.appendChild(treeCols);
Treecol treeCol = new Treecol();
treeCols.appendChild(treeCol);
}
tree.setPageSize(-1);
@ -116,27 +142,41 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
private boolean isTreeDrivenByValue = false;
/**
* @return true if sort by Value, false otherwise
*/
public boolean isTreeDrivenByValue() {
return isTreeDrivenByValue;
}
/**
* Set tree sorted by Value or Name
* @param isTreeDrivenByValue
*/
public void setTreeDrivenByValue(boolean isTreeDrivenByValue) {
this.isTreeDrivenByValue = isTreeDrivenByValue;
}
private boolean isValueDisplayed = false;
/**
* @return true if Value is display in front of Name
*/
public boolean isValueDisplayed() {
return isValueDisplayed;
}
/**
* Set whether Value is display
* @param isValueDisplayed
*/
public void setIsValueDisplayed(boolean isValueDisplayed) {
this.isValueDisplayed = isValueDisplayed;
}
/**
*
* @param root
* Create model from {@link MTreeNode} structure
* @param root Root node
* @return SimpleTreeModel
*/
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);
while(nodeEnum.hasMoreElements()) {
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);
stRoot.getChildren().add(stNode);
stRoot.getChildren().add(stChildNode);
if (childNode.getChildCount() > 0) {
populate(stNode, childNode);
populate(stChildNode, childNode);
}
}
model = new SimpleTreeModel(stRoot);
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()) {
MTreeNode childNode = (MTreeNode)nodeEnum.nextElement();
DefaultTreeNode<Object> stChildNode = childNode.getChildCount() > 0 ? new DefaultTreeNode<Object>(childNode, new ArrayList<TreeNode<Object>>())
: new DefaultTreeNode<Object>(childNode);
stNode.getChildren().add(stChildNode);
stParentNode.getChildren().add(stChildNode);
if (childNode.getChildCount() > 0) {
populate(stChildNode, childNode);
}
@ -173,6 +218,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
/**
* @param ti
* @param node
* @param index
*/
@Override
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
*/
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() {
return itemDraggable;
}
/**
* Add listener for ON_DROP event
* @param listener
*/
public void addOnDropEventListener(EventListener<Event> listener) {
@ -274,6 +322,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
* @param event
* @see EventListener#onEvent(Event)
*/
@Override
public void onEvent(Event event) throws Exception {
if (Events.ON_DROP.equals(event.getName())) {
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
* @return DefaultTreeNode
* @return DefaultTreeNode or null if not found
*/
public DefaultTreeNode<Object> getParent(DefaultTreeNode<Object> treeNode) {
int path[] = this.getPath(treeNode);
@ -306,7 +356,7 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
* @param newParent
* @param newNode
* @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,
int index) {
@ -322,8 +372,9 @@ public class SimpleTreeModel extends org.zkoss.zul.DefaultTreeModel<Object> impl
}
/**
* @param fromNode
* @param recordId
* Find node with Node_ID=recordId starting from fromNode or root node.
* @param fromNode Optional starting node. If null, start from Root node
* @param recordId Node_ID
* @return DefaultTreeNode
*/
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) {
DefaultTreeNode<Object> parent = getParent(node);

View File

@ -41,30 +41,39 @@ import org.zkoss.zul.Include;
import org.zkoss.zul.impl.LabelImageElement;
/**
*
* Extend {@link org.zkoss.zul.Tab}
* @author <a href="mailto:agramdass@gmail.com">Ashley G Ramdass</a>
* @date Feb 25, 2007
* @version $Revision: 0.10 $
*/
public class Tab extends org.zkoss.zul.Tab
{
/**
*
* generated serial id
*/
private static final long serialVersionUID = -7504310693884092219L;
private boolean isDisableDraggDrop = false;
public Tab(String str)
/**
* @param label
*/
public Tab(String label)
{
this.setLabel(str);
this.setLabel(label);
}
/**
* Default constructor
*/
public Tab()
{
}
/**
* Set decorator for tab label
* @param decorateInfo
*/
public void setDecorateInfo (DecorateInfo decorateInfo){
if (decorateInfo != null)
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() {
return isDisableDraggDrop;
}
/**
* 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
*/
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, it's use to transfer decorate info from info window, standard window, report, process,... to tab
* @author hieplq
@ -102,6 +114,9 @@ public class Tab extends org.zkoss.zul.Tab
private String imageKey;
private URL imageIntenalUrl;
/**
* @param comp
*/
public void decorate (LabelImageElement comp){
if (imageIntenalUrl != null) {
if (ThemeManager.isUseFontIconForImage()) {
@ -119,6 +134,9 @@ public class Tab extends org.zkoss.zul.Tab
}
}
/**
* @param imageData MImage
*/
public DecorateInfo (MImage imageData){
if (imageData != null) {
imageIntenalUrl = ManageImageCache.getImageInternalUrl(imageData);
@ -127,6 +145,9 @@ public class Tab extends org.zkoss.zul.Tab
}
}
/**
* @param imagePath Image URL
*/
public DecorateInfo (String imagePath){
if (imagePath != null) {
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
* @return
* @return DecorateInfo
*/
public static DecorateInfo get (ADWindow adWindow){
return adWindow == null?null:new DecorateInfo(adWindow.getMImage());
}
/**
* Create DecorateInfo from Info Window.
* @param mInfo
* @return DecorateInfo
*/
public static DecorateInfo get (MInfoWindow mInfo){
if (mInfo != null) {
@ -220,9 +246,10 @@ public class Tab extends org.zkoss.zul.Tab
}
/**
* http://tracker.zkoss.org/browse/ZK-3705
* change default behavior to get prev tab is new active tab
* @return
* http://tracker.zkoss.org/browse/ZK-3705.<br/>
* Select next active tab.<br/>
* Replace the default algorithm uses by Zk (org.zkoss.zul.Tab.selectNextTab()).
* @return org.zkoss.zul.Tab
*/
protected org.zkoss.zul.Tab selectNextTabWR() {
Tabbox idTabbox = null;

View File

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

View File

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

View File

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

View File

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

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