/** * Get the 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. * * @return the delay after page load before AJAX control triggered */ public int getDelay() { return getComponentModel().delay; }
/** * @return <code>true</code> if the trigger should be fired once only for each load of a page */ public boolean isLoadOnce() { return getComponentModel().loadOnce; }
/** * Get the indicator of whether a trigger may fire once or an unlimited number of times. If loadCount > 0 the * WAjaxControl may <strong>only fire once per page load</strong>. See * <a href="https://github.com/BorderTech/wcomponents/issues/495">#495</a>. * * @return 1 if the trigger may only load once, otherwise -1 * @deprecated 1.2.0 use {@link #isLoadOnce()}. */ public int getLoadCount() { return getComponentModel().loadOnce ? 1 : -1; }
/** * Create a WAjaxControl with specified trigger component and a List of target components. * * @param trigger the WComponent that will fire the AJAX request on change * @param targets the WComponents to be re-painted in the AJAX responses */ public WAjaxControl(final AjaxTrigger trigger, final List<? extends AjaxTarget> targets) { this(trigger); getComponentModel().targets = (List<AjaxTarget>) new ArrayList<>(targets); }
/** * Create a WAjaxControl with specified trigger and target components. * * @param trigger the WComponent that will fire the AJAX request on change * @param target the WComponent to be re-painted as a result of the AJAX request */ public WAjaxControl(final AjaxTrigger trigger, final AjaxTarget target) { this(trigger); List<AjaxTarget> targets = new ArrayList<>(); targets.add(target); getComponentModel().targets = targets; }
/** * Create a WAjaxControl with specified trigger component and an array of target components. * * @param trigger the WComponent that will fire the AJAX request on change * @param targets the WComponents to be re-painted in the AJAX response */ public WAjaxControl(final AjaxTrigger trigger, final AjaxTarget[] targets) { this(trigger); List<AjaxTarget> targetList = new ArrayList<>(); targetList.addAll(Arrays.asList(targets)); getComponentModel().targets = targetList; }
/** * <p> * Get the target WComponents that will be repainted as a consequence of the AJAX request. * </p> * <p> * When the AJAX request is triggered only the target component(s) will be re-painted. An empty list is returned if * no targets have been defined. * </p> * * @return the target regions that are repainted in the AJAX response */ public List<AjaxTarget> getTargets() { List<AjaxTarget> targets = getComponentModel().targets; if (targets == null) { return Collections.emptyList(); } return Collections.unmodifiableList(targets); }