/** * Set whether the trigger may fire once or an unlimited number of times. Any value > 0 will result in a trigger * which can only fire once per page. See * <a href="https://github.com/BorderTech/wcomponents/issues/495">#495</a>. * * @param loadCount The trigger count for this AJAX control. * @deprecated 1.2.0 use {@link #setLoadOnce(boolean)}. */ public void setLoadCount(final int loadCount) { getOrCreateComponentModel().loadOnce = loadCount > 0; }
/** * Flag to indicate the the AJAX trigger should be fired once only. * * @param loadOnce if <code>true</code> the target AJAX trigger only once for each load of a page */ public void setLoadOnce(final boolean loadOnce) { if (loadOnce != isLoadOnce()) { getOrCreateComponentModel().loadOnce = loadOnce; } }
/** * Add a single target WComponent to this AJAX control. * * @param target a WComponent to be repainted */ public void addTarget(final AjaxTarget target) { AjaxControlModel model = getOrCreateComponentModel(); if (model.targets == null) { model.targets = new ArrayList<>(); } model.targets.add(target); MemoryUtil.checkSize(model.targets.size(), this.getClass().getSimpleName()); }
/** * <p> * Set a delay period, in milliseconds, between the WAjaxControl being rendered in the view and it being * <em>automatically</em> triggered. A WAjaxControl with a delay > 0 will result in a request being made without * a change to any {@link AjaxTrigger} component. * </p> * <p> * The use of a delay may be useful for setting up a trigger which polls for changes in a part of a UI. See * {@link com.github.bordertech.wcomponents.WAjaxPollingRegion}. * </p> * <p> * If the trigger is part of a polling region (therefore it is itself updated and potentially re-triggers itself * possibly many times) then the delay <strong>must not</strong> be less than 334.</p> * * @param delay the delay after page load before AJAX control triggered */ public void setDelay(final int delay) { if (delay != getDelay()) { getOrCreateComponentModel().delay = delay; } }